MediaWiki:Common.js
Revision as of 06:12, 6 June 2013 by James Hare (talk | contribs) (Going to move this into personal JS)
Note: After saving, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
/* 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 donation buttons */
if ( ( mw.config.get('wgPageName') == 'Donate' ) ) {
var formId = 'donateform';
$('#donatebutton').html('<div class="plainlinks"><form id="donateform10" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"><input type="hidden" name="cmd" value="_s-xclick"><input type="hidden" name="hosted_button_id" value="S7YX2BAZDVSAE"><a href="#" onclick="document.getElementById(formId + 10).submit()"><span class="btn btn-large btn-primary" style="width:60px; color:white !important; font-size:200% !important;">$10</span></a></form><div style="padding: 0.3em;"></div><form id="donateform25" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"><input type="hidden" name="cmd" value="_s-xclick"><input type="hidden" name="hosted_button_id" value="J3RV9PVMSRH8Y"><a href="#" onclick="document.getElementById(formId + 25).submit()"><span class="btn btn-large btn-primary" style="width:60px; color:white !important; font-size:200% !important;">$25</span></a></form><div style="padding: 0.3em;"></div><form id="donateform50" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"><input type="hidden" name="cmd" value="_s-xclick"><input type="hidden" name="hosted_button_id" value="3E66M99JDV836"><a href="#" onclick="document.getElementById(formId + 50).submit()"><span class="btn btn-large btn-primary" style="width:60px; color:white !important; font-size:200% !important;">$50</span></a></form><div style="padding: 0.3em;"></div><form id="donateform100" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"><input type="hidden" name="cmd" value="_s-xclick"><input type="hidden" name="hosted_button_id" value="GNEQ7GUKNF9BS"><a href="#" onclick="document.getElementById(formId + 100).submit()"><span class="btn btn-large btn-primary" style="width:60px; color:white !important; font-size:200% !important;">$100</span></a></form><div style="padding: 0.3em;"></div><form id="donateform200" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"><input type="hidden" name="cmd" value="_s-xclick"><input type="hidden" name="hosted_button_id" value="BU3YMWQSVJ9HW"><a href="#" onclick="document.getElementById(formId + 200).submit()"><span class="btn btn-large btn-primary" style="width:60px; color:white !important; font-size:200% !important;">$200</span></a></form></div>');
}
/* 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' );
});