Difference between revisions of "MediaWiki:Common.js"

From Wikimedia District of Columbia
Jump to navigation Jump to search
(One line for the buttons)
(Linking directly to images instead of thumbnails (since I'm uploading new versions anyway))
Line 27: Line 27:
 
/* Add a membership payment button */
 
/* Add a membership payment button */
 
if ( ( mw.config.get('wgPageName') == 'Membership' ) ) {
 
if ( ( mw.config.get('wgPageName') == 'Membership' ) ) {
$('#membershipbutton').html('<form action="https://www.paypal.com/cgi-bin/webscr" method="post"><input type="hidden" name="cmd" value="_s-xclick"><input type="hidden" name="hosted_button_id" value="R9RT2GWXZZWXL"><input type="hidden" name="on0" value="Donation Options"><input type="hidden" name="currency_code" value="USD"><div style="padding-bottom:0.3em;"><span style="padding-right:0.5em;"><input type="image" src="http://wikimediadc.org/w/images/thumb/3/38/Payment_button_-_10.png/75px-Payment_button_-_10.png" border="0" name="os0" value="Regular Membership" alt="Member dues: $10 per year"></span><span style="padding-right:0.5em;"><input type="image" src="http://wikimediadc.org/w/images/thumb/9/99/Payment_button_-_25.png/75px-Payment_button_-_25.png" border="0" name="os0" value="Bronze Sponsor" alt="Member dues with Bronze Sponsorship: $25 per year"></span><span style="padding-right:0.5em;"><input type="image" src="http://wikimediadc.org/w/images/thumb/e/ec/Payment_button_-_50.png/75px-Payment_button_-_50.png" border="0" name="os0" value="Silver Sponsor" alt="Member dues with Silver Sponsorship: $50 per year"></span><span><input type="image" src="http://wikimediadc.org/w/images/thumb/1/1d/Payment_button_-_100.png/75px-Payment_button_-_100.png" border="0" name="os0" value="Gold Sponsor" alt="Member dues with Gold Sponsorship: $100 per year"></span></div></form>');
+
$('#membershipbutton').html('<form action="https://www.paypal.com/cgi-bin/webscr" method="post"><input type="hidden" name="cmd" value="_s-xclick"><input type="hidden" name="hosted_button_id" value="R9RT2GWXZZWXL"><input type="hidden" name="on0" value="Donation Options"><input type="hidden" name="currency_code" value="USD"><div style="padding-bottom:0.3em;"><span style="padding-right:0.5em;"><input type="image" src="http://wikimediadc.org/w/images/3/38/Payment_button_-_10.png" border="0" name="os0" value="Regular Membership" alt="Member dues: $10 per year"></span><span style="padding-right:0.5em;"><input type="image" src="http://wikimediadc.org/w/images/9/99/Payment_button_-_25.png" border="0" name="os0" value="Bronze Sponsor" alt="Member dues with Bronze Sponsorship: $25 per year"></span><span style="padding-right:0.5em;"><input type="image" src="http://wikimediadc.org/w/images/e/ec/Payment_button_-_50.png" border="0" name="os0" value="Silver Sponsor" alt="Member dues with Silver Sponsorship: $50 per year"></span><span><input type="image" src="http://wikimediadc.org/w/images/1/1d/Payment_button_-_100.png" border="0" name="os0" value="Gold Sponsor" alt="Member dues with Gold Sponsorship: $100 per year"></span></div></form>');
 
}
 
}
   

Revision as of 17:49, 26 May 2013

/* Interface modifications for anonymous users */

function removeSidebarSection(section) {
  try {
    var target = "p-" + section;
    var sidebar = document.getElementById("mw-panel");
    var element = document.getElementById(target);
    sidebar.removeChild(element);
  } catch (e) {
    return;
   }
}

function customizeSidebarForAnon() {
  removeSidebarSection("tb");
}

function customizeTopbarForAnon() {
  mw.util.addPortletLink( 'p-personal', '/wiki/Membership', 'Join now', 'pt-join', 'Join Wikimedia DC and help support our mission!', 'j', '#pt-createaccount' );
}

if (wgUserName == null) {
  addOnloadHook(customizeSidebarForAnon);
  addOnloadHook(customizeTopbarForAnon);
}

/* Add a membership payment button */
if ( ( mw.config.get('wgPageName') == 'Membership' ) ) {
  $('#membershipbutton').html('<form action="https://www.paypal.com/cgi-bin/webscr" method="post"><input type="hidden" name="cmd" value="_s-xclick"><input type="hidden" name="hosted_button_id" value="R9RT2GWXZZWXL"><input type="hidden" name="on0" value="Donation Options"><input type="hidden" name="currency_code" value="USD"><div style="padding-bottom:0.3em;"><span style="padding-right:0.5em;"><input type="image" src="http://wikimediadc.org/w/images/3/38/Payment_button_-_10.png" border="0" name="os0" value="Regular Membership" alt="Member dues: $10 per year"></span><span style="padding-right:0.5em;"><input type="image" src="http://wikimediadc.org/w/images/9/99/Payment_button_-_25.png" border="0" name="os0" value="Bronze Sponsor" alt="Member dues with Bronze Sponsorship: $25 per year"></span><span style="padding-right:0.5em;"><input type="image" src="http://wikimediadc.org/w/images/e/ec/Payment_button_-_50.png" border="0" name="os0" value="Silver Sponsor" alt="Member dues with Silver Sponsorship: $50 per year"></span><span><input type="image" src="http://wikimediadc.org/w/images/1/1d/Payment_button_-_100.png" border="0" name="os0" value="Gold Sponsor" alt="Member dues with Gold Sponsorship: $100 per year"></span></div></form>');
}

/* Add a donate button */
if ( ( mw.config.get('wgPageName') == 'Donate' ) && ( wgNamespaceNumber == 0 ) ) {
  $('#donatebutton').html('<form action="https://www.paypal.com/cgi-bin/webscr" method="post"><input type="hidden" name="cmd" value="_s-xclick"><input type="hidden" name="hosted_button_id" value="PSCZL9L3NKNRQ"><input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"><img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1"></form>');
}

/* Add a few links to the toolbox */
addOnloadHook(function() {
  mw.util.addPortletLink( 'p-tb', '/wiki/Internal:Dashboard', 'Dashboard', 't-dashboard', 'Dashboard ', 'r', '#t-whatlinkshere' );
  mw.util.addPortletLink( 'p-tb', '/wiki/Special:RecentChanges', 'Recent changes', 't-recentchanges', 'Recent changes ', 'r', '#t-recentchangeslinked' );
  mw.util.addPortletLink( 'p-tb', '/wiki/Special:AllPages', 'All pages', 't-allpages', 'All pages ', 'p', '#t-recentchanges' );
});