Difference between revisions of "MediaWiki:Common.js"
Jump to navigation
Jump to search
James Hare (talk | contribs) m (removing redundant header) |
SuperHamster (talk | contribs) (Migrating to mw.config.get) |
||
(140 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
− | /* |
+ | /* Interface modifications for anonymous users */ |
function removeSidebarSection(section) { |
function removeSidebarSection(section) { |
||
Line 16: | Line 16: | ||
} |
} |
||
+ | function customizeTopbarForAnon() { |
||
− | if (wgUserName == null) { |
||
+ | mw.util.addPortletLink( 'p-personal', '/wiki/Membership', 'Join now', 'pt-join', 'Join Wikimedia DC and help support our mission!', 'j', '#pt-createaccount' ); |
||
− | addOnloadHook(customizeSidebarForAnon); |
||
} |
} |
||
+ | if (mw.config.get('wgUserName') === null) { |
||
− | /* add membership payment button */ |
||
+ | $(customizeSidebarForAnon); |
||
− | if ( ( mw.config.get('wgPageName') == 'Membership' ) && ( wgNamespaceNumber == 0 ) ) { |
||
+ | $(customizeTopbarForAnon); |
||
− | $('#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"><table><tr></tr><tr><td><select name="os0"><option value="Regular Membership">Regular Membership : $10.00 USD - yearly</option><option value="Bronze Sponsor">Bronze Sponsor : $25.00 USD - yearly</option><option value="Silver Sponsor">Silver Sponsor : $50.00 USD - yearly</option><option value="Gold Sponsor">Gold Sponsor : $100.00 USD - yearly</option></select></td></tr></table><input type="hidden" name="currency_code" value="USD"><input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_subscribeCC_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 membership payment buttons */ |
− | 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>'); |
||
− | } |
||
+ | var monthlyId = 'monthlyform'; |
||
− | mw.loader.using( 'mediawiki.util', function() { |
||
+ | var annuallyId = 'annuallyform'; |
||
− | /* Begin of mw.loader.using callback */ |
||
− | |||
− | window.hasClass = ( function() { |
||
− | var reCache = {}; |
||
− | return function (element, className) { |
||
− | return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className); |
||
− | }; |
||
− | })(); |
||
+ | $('#memberbutton-monthly').html('<div class="plainlinks"><form id="monthlyform5" style="display:inline;" 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="9MHQE5FETJYFW"><a href="#" onclick="document.getElementById(monthlyId + 5).submit()"><div class="arrowbutton-green roundbutton-large" style="font-size:38px; line-height:1.75em;">$5</div></a></form><form id="monthlyform10" style="display:inline;" 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="ZJQJ5SPKDFQTY"><a href="#" onclick="document.getElementById(monthlyId + 10).submit()"><div class="arrowbutton-green roundbutton-large" style="font-size:38px; line-height:1.75em;">$10</div></a></form><form id="monthlyform25" style="display:inline;" 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="5XSU2JHD29WA6"><a href="#" onclick="document.getElementById(monthlyId + 25).submit()"><div class="arrowbutton-green roundbutton-large" style="font-size:38px; line-height:1.75em;">$25</div></a></form><form id="monthlyform50" style="display:inline;" 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="B7ETK3LZRACLQ"><a href="#" onclick="document.getElementById(monthlyId + 50).submit()"><div class="arrowbutton-green roundbutton-large" style="font-size:38px; line-height:1.75em;">$50</div></a></form><form id="monthlyform100" style="display:inline;" 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="B9F73YWFQBYXA"><a href="#" onclick="document.getElementById(monthlyId + 100).submit()"><div class="arrowbutton-gold roundbutton-large" style="font-size:31px; line-height:2.3em;">$100</div></a></form><form id="monthlyform200" style="display:inline;" 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="4E42KFD7MCNJ4"><a href="#" onclick="document.getElementById(monthlyId + 200).submit()"><div class="arrowbutton-gold roundbutton-large" style="font-size:31px; line-height:2.3em;">$200</div></a></form></div>'); |
||
− | /* collapsing tables */ |
||
+ | $('#memberbutton-annually').html('<div class="plainlinks"><form id="annuallyform5" style="display:inline;" 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="ZAKPCZYTXDRYN"><a href="#" onclick="document.getElementById(annuallyId + 5).submit()"><div class="arrowbutton-blue roundbutton" style="font-size:30px; line-height:1.75em;">$5</div></a></form><form id="annuallyform10" style="display:inline;" 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="8T8NESE2DWVX6"><a href="#" onclick="document.getElementById(annuallyId + 10).submit()"><div class="arrowbutton-blue roundbutton" style="font-size:30px; line-height:1.75em;">$10</div></a></form><form id="annuallyform25" style="display:inline;" 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="GSH4BLP9UTP6Q"><a href="#" onclick="document.getElementById(annuallyId + 25).submit()"><div class="arrowbutton-blue roundbutton" style="font-size:30px; line-height:1.75em;">$25</div></a></form><form id="annuallyform50" style="display:inline;" 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="BUJSW3H45AJY8"><a href="#" onclick="document.getElementById(annuallyId + 50).submit()"><div class="arrowbutton-blue roundbutton" style="font-size:30px; line-height:1.75em;">$50</div></a></form><form id="annuallyform100" style="display:inline;" 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="DWBBFHL3JKGPC"><a href="#" onclick="document.getElementById(annuallyId + 100).submit()"><div class="arrowbutton-blue roundbutton" style="font-size:25px; line-height:2.1em;">$100</div></a></form><form id="annuallyform200" style="display:inline;" 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="CPVX2SG6GSXNL"><a href="#" onclick="document.getElementById(annuallyId + 200).submit()"><div class="arrowbutton-blue roundbutton" style="font-size:25px; line-height:2.1em;">$200</div></a></form></div>'); |
||
− | var autoCollapse = 2; |
||
− | var collapseCaption = "hide"; |
||
− | var expandCaption = "show"; |
||
− | |||
− | window.collapseTable = function( tableIndex ){ |
||
− | var Button = document.getElementById( "collapseButton" + tableIndex ); |
||
− | var Table = document.getElementById( "collapsibleTable" + tableIndex ); |
||
− | |||
− | if ( !Table || !Button ) { |
||
− | return false; |
||
− | } |
||
− | |||
− | var Rows = Table.rows; |
||
− | |||
− | if ( Button.firstChild.data == collapseCaption ) { |
||
− | for ( var i = 1; i < Rows.length; i++ ) { |
||
− | Rows[i].style.display = "none"; |
||
− | } |
||
− | Button.firstChild.data = expandCaption; |
||
− | } else { |
||
− | for ( var i = 1; i < Rows.length; i++ ) { |
||
− | Rows[i].style.display = Rows[0].style.display; |
||
− | } |
||
− | Button.firstChild.data = collapseCaption; |
||
− | } |
||
− | } |
||
− | |||
− | function createCollapseButtons(){ |
||
− | var tableIndex = 0; |
||
− | var NavigationBoxes = new Object(); |
||
− | var Tables = document.getElementsByTagName( "table" ); |
||
− | |||
− | for ( var i = 0; i < Tables.length; i++ ) { |
||
− | if ( hasClass( Tables[i], "collapsible" ) ) { |
||
− | |||
− | /* only add button and increment count if there is a header row to work with */ |
||
− | var HeaderRow = Tables[i].getElementsByTagName( "tr" )[0]; |
||
− | if (!HeaderRow) continue; |
||
− | var Header = HeaderRow.getElementsByTagName( "th" )[0]; |
||
− | if (!Header) continue; |
||
− | |||
− | NavigationBoxes[ tableIndex ] = Tables[i]; |
||
− | Tables[i].setAttribute( "id", "collapsibleTable" + tableIndex ); |
||
− | |||
− | var Button = document.createElement( "span" ); |
||
− | var ButtonLink = document.createElement( "a" ); |
||
− | var ButtonText = document.createTextNode( collapseCaption ); |
||
− | |||
− | Button.className = "collapseButton"; //Styles are declared in Common.css |
||
− | |||
− | ButtonLink.style.color = Header.style.color; |
||
− | ButtonLink.setAttribute( "id", "collapseButton" + tableIndex ); |
||
− | ButtonLink.setAttribute( "href", "#" ); |
||
− | addHandler( ButtonLink, "click", new Function( "evt", "collapseTable(" + tableIndex + " ); return killEvt( evt );") ); |
||
− | ButtonLink.appendChild( ButtonText ); |
||
− | |||
− | Button.appendChild( document.createTextNode( "[" ) ); |
||
− | Button.appendChild( ButtonLink ); |
||
− | Button.appendChild( document.createTextNode( "]" ) ); |
||
− | |||
− | Header.insertBefore( Button, Header.firstChild ); |
||
− | tableIndex++; |
||
− | } |
||
− | } |
||
− | |||
− | for ( var i = 0; i < tableIndex; i++ ) { |
||
− | if ( hasClass( NavigationBoxes[i], "collapsed" ) || ( tableIndex >= autoCollapse && hasClass( NavigationBoxes[i], "autocollapse" ) ) ) { |
||
− | collapseTable( i ); |
||
− | } |
||
− | else if ( hasClass( NavigationBoxes[i], "innercollapse" ) ) { |
||
− | var element = NavigationBoxes[i]; |
||
− | while (element = element.parentNode) { |
||
− | if ( hasClass( element, "outercollapse" ) ) { |
||
− | collapseTable ( i ); |
||
− | break; |
||
− | } |
||
− | } |
||
− | } |
||
− | } |
||
− | } |
||
− | |||
− | $( createCollapseButtons ); |
||
+ | /* Add donation buttons */ |
||
− | // set up the words in your language |
||
+ | var dwYesMember = 'member'; |
||
− | var NavigationBarHide = '[' + collapseCaption + ']'; |
||
+ | var dwNoMember = 'donation'; |
||
− | var NavigationBarShow = '[' + expandCaption + ']'; |
||
+ | |||
− | |||
+ | var dwPartOne = '<div class="plainlinks"><form id="member" 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="'; |
||
− | // shows and hides content and picture (if available) of navigation bars |
||
+ | |||
− | // Parameters: |
||
+ | var dwPartTwo = '"><a href="#" onclick="document.getElementById(dwYesMember).submit()"><div class="arrowbutton arrowbutton-green" style="font-size:115%; width:300px; margin-bottom:0.5em;"><span style="font-weight:bold;">Yes</span>, sign me up as a member!</div></a></form><form id="donation" 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="'; |
||
− | // indexNavigationBar: the index of navigation bar to be toggled |
||
+ | |||
− | window.toggleNavigationBar = function(indexNavigationBar){ |
||
+ | var dwPartThree = '"><a href="#" onclick="document.getElementById(dwNoMember).submit()"><div class="arrowbutton arrowbutton-blue" style="font-size:115%; width:190px; margin-bottom:0.5em;"><span style="font-weight:bold;"></span>Just the donation</div></a></form></div>'; |
||
− | var NavToggle = document.getElementById("NavToggle" + indexNavigationBar); |
||
+ | |||
− | var NavFrame = document.getElementById("NavFrame" + indexNavigationBar); |
||
+ | var dwPartOneCir = '<div class="plainlinks"><form id="donation" 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="'; |
||
− | |||
+ | |||
− | if (!NavFrame || !NavToggle) { |
||
+ | var dwPartTwoCir = '"><a href="#" onclick="document.getElementById(dwNoMember).submit()"><span class="roundbutton arrowbutton-blue" style="line-height:1.75em; font-size:30px;">'; |
||
− | return false; |
||
+ | |||
− | } |
||
+ | var dwPartThreeCir = '</span></a></form></div>'; |
||
− | |||
+ | |||
− | // if shown now |
||
+ | $('#dw-5m').html(dwPartOne + '9MHQE5FETJYFW' + dwPartTwo + 'VHB9L9U8THY9A' + dwPartThree); |
||
− | if (NavToggle.firstChild.data == NavigationBarHide) { |
||
+ | $('#dw-10m').html(dwPartOne + 'ZJQJ5SPKDFQTY' + dwPartTwo + 'ELPHVEA56BGBA' + dwPartThree); |
||
− | for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) { |
||
+ | $('#dw-25m').html(dwPartOne + '5XSU2JHD29WA6' + dwPartTwo + 'Y9PGPAGD2EMP8' + dwPartThree); |
||
− | if (hasClass(NavChild, 'NavContent') || hasClass(NavChild, 'NavPic')) { |
||
+ | $('#dw-50m').html(dwPartOne + 'B7ETK3LZRACLQ' + dwPartTwo + 'PR7VLZVEEX8CA' + dwPartThree); |
||
− | NavChild.style.display = 'none'; |
||
+ | $('#dw-100m').html(dwPartOne + 'B9F73YWFQBYXA' + dwPartTwo + 'WDJKYZF7XPRUL' + dwPartThree); |
||
− | } |
||
+ | $('#dw-200m').html(dwPartOne + '4E42KFD7MCNJ4' + dwPartTwo + '4KL7SURFTFHA4' + dwPartThree); |
||
− | } |
||
+ | $('#dw-5a').html(dwPartOne + 'ZAKPCZYTXDRYN' + dwPartTwo + 'FUHX7TBVKE2BG' + dwPartThree); |
||
− | NavToggle.firstChild.data = NavigationBarShow; |
||
+ | $('#dw-10a').html(dwPartOne + '8T8NESE2DWVX6' + dwPartTwo + 'UEBVSV6KF9SSE' + dwPartThree); |
||
− | |||
+ | $('#dw-25a').html(dwPartOne + 'GSH4BLP9UTP6Q' + dwPartTwo + 'A922FAUXLDQSN' + dwPartThree); |
||
− | // if hidden now |
||
+ | $('#dw-50a').html(dwPartOne + 'BUJSW3H45AJY8' + dwPartTwo + 'MPXGN9SKV7HVY' + dwPartThree); |
||
− | } else if (NavToggle.firstChild.data == NavigationBarShow) { |
||
+ | $('#dw-100a').html(dwPartOne + 'DWBBFHL3JKGPC' + dwPartTwo + 'SLSKUBGGA63C8' + dwPartThree); |
||
− | for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) { |
||
+ | $('#dw-200a').html(dwPartOne + 'CPVX2SG6GSXNL' + dwPartTwo + 'X4HUYHNVHN8M2' + dwPartThree); |
||
− | if (hasClass(NavChild, 'NavContent') || hasClass(NavChild, 'NavPic')) { |
||
+ | $('#dw-5x').html(dwPartOne + 'QLWRD4W5AEYK4' + dwPartTwo + 'FG88LU479HZ7J' + dwPartThree); |
||
− | NavChild.style.display = 'block'; |
||
+ | $('#dw-10x').html(dwPartOne + '8Z4XGBQYJFP2L' + dwPartTwo + 'S7YX2BAZDVSAE' + dwPartThree); |
||
− | } |
||
+ | $('#dw-25x').html(dwPartOne + '8SDTJWLUAE3TW' + dwPartTwo + 'J3RV9PVMSRH8Y' + dwPartThree); |
||
− | } |
||
+ | $('#dw-50x').html(dwPartOne + '9C2JUGA7CWZWJ' + dwPartTwo + '3E66M99JDV836' + dwPartThree); |
||
− | NavToggle.firstChild.data = NavigationBarHide; |
||
+ | $('#dw-100x').html(dwPartOne + '4736NTBYA9SGN' + dwPartTwo + 'GNEQ7GUKNF9BS' + dwPartThree); |
||
− | } |
||
+ | $('#dw-200x').html(dwPartOne + 'ZUK7NJQSFMBX4' + dwPartTwo + 'BU3YMWQSVJ9HW' + dwPartThree); |
||
− | } |
||
+ | |||
− | |||
+ | $('#dw-25c').html(dwPartOne + '6AJJ62C5FUTTA' + dwPartTwo + 'HLF8JWCU25KTW' + dwPartThree); |
||
− | // adds show/hide-button to navigation bars |
||
+ | $('#dw-30c').html(dwPartOne + 'K8SUU6YWXTZGE' + dwPartTwo + 'WLLLRUEEDYKMY' + dwPartThree); |
||
− | function createNavigationBarToggleButton(){ |
||
+ | $('#dw-35c').html(dwPartOne + 'DQMBQLH46RT6E' + dwPartTwo + 'C69MHKJU4DUQC' + dwPartThree); |
||
− | var indexNavigationBar = 0; |
||
+ | $('#dw-50c').html(dwPartOne + 'PKJNESR6LNRPU' + dwPartTwo + 'LJE5WTYQZZK5W' + dwPartThree); |
||
− | // iterate over all < div >-elements |
||
+ | $('#dw-75c').html(dwPartOne + 'VYQLHU33XSKKL' + dwPartTwo + 'WJG7S47XVZGGN' + dwPartThree); |
||
− | var divs = document.getElementsByTagName("div"); |
||
+ | $('#dw-100c').html(dwPartOne + 'MBPUCFKJ3DVTL' + dwPartTwo + '2M4WLALKET9RL' + dwPartThree); |
||
− | for (var i = 0; NavFrame = divs[i]; i++) { |
||
+ | |||
− | // if found a navigation bar |
||
+ | /* Add mailing list signup form */ |
||
− | if (hasClass(NavFrame, "NavFrame")) { |
||
+ | var mailingList = 'mailinglist'; |
||
− | |||
+ | |||
− | indexNavigationBar++; |
||
+ | $('#mailinglistsignup').html('<link href="//cdn-images.mailchimp.com/embedcode/slim-081711.css" rel="stylesheet" type="text/css"><style type="text/css"> #mc_embed_signup{background:#fff; clear:left; font:14px Helvetica,Arial,sans-serif; }</style><div id="mc_embed_signup"><form action="//wikimediadc.us12.list-manage.com/subscribe/post?u=f329c96f3ad7841331cbffd9f&id=0fc61a72a9" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate style="padding-left:0;"><div id="mc_embed_signup_scroll"><input type="email" value="" name="EMAIL" class="email" id="mce-EMAIL" placeholder="email address" required style="width:98%; height:20px; font-size:115%;"><!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups--><div style="position: absolute; left: -5000px;" aria-hidden="true"><input type="text" name="b_f329c96f3ad7841331cbffd9f_0fc61a72a9" tabindex="-1" value=""></div><div class="clear"><input type="submit" value="⇒ Subscribe" name="subscribe" id="mc-embedded-subscribe" class="arrowbutton arrowbutton-green" style="font-size:115%; width:125px;"></div></div></form></div>'); |
||
− | var NavToggle = document.createElement("a"); |
||
+ | |||
− | NavToggle.className = 'NavToggle'; |
||
+ | /* Add embedded chat */ |
||
− | NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar); |
||
+ | $('#eventchat').html('<div id="rt-e8370f98c4dbfd6ee093107c010e5dcf"></div><script language="JavaScript" type="text/javascript" src="//www.rumbletalk.com/client/?L3aL2eqy"></script>'); |
||
− | NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');'); |
||
− | |||
− | var isCollapsed = hasClass( NavFrame, "collapsed" ); |
||
− | /* |
||
− | * Check if any children are already hidden. This loop is here for backwards compatibility: |
||
− | * the old way of making NavFrames start out collapsed was to manually add style="display:none" |
||
− | * to all the NavPic/NavContent elements. Since this was bad for accessibility (no way to make |
||
− | * the content visible without JavaScript support), the new recommended way is to add the class |
||
− | * "collapsed" to the NavFrame itself, just like with collapsible tables. |
||
− | */ |
||
− | for (var NavChild = NavFrame.firstChild; NavChild != null && !isCollapsed; NavChild = NavChild.nextSibling) { |
||
− | if ( hasClass( NavChild, 'NavPic' ) || hasClass( NavChild, 'NavContent' ) ) { |
||
− | if ( NavChild.style.display == 'none' ) { |
||
− | isCollapsed = true; |
||
− | } |
||
− | } |
||
− | } |
||
− | if (isCollapsed) { |
||
− | for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) { |
||
− | if ( hasClass( NavChild, 'NavPic' ) || hasClass( NavChild, 'NavContent' ) ) { |
||
− | NavChild.style.display = 'none'; |
||
− | } |
||
− | } |
||
− | } |
||
− | var NavToggleText = document.createTextNode(isCollapsed ? NavigationBarShow : NavigationBarHide); |
||
− | NavToggle.appendChild(NavToggleText); |
||
− | |||
− | // Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked) |
||
− | for(var j=0; j < NavFrame.childNodes.length; j++) { |
||
− | if (hasClass(NavFrame.childNodes[j], "NavHead")) { |
||
− | NavToggle.style.color = NavFrame.childNodes[j].style.color; |
||
− | NavFrame.childNodes[j].appendChild(NavToggle); |
||
− | } |
||
− | } |
||
− | NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar); |
||
− | } |
||
− | } |
||
− | } |
||
− | |||
− | $( createNavigationBarToggleButton ); |
||
− | /* End of mw.loader.using callback */ |
||
− | } ); |
||
− | /* |
+ | /* Add a few links to the toolbox */ |
− | + | $(function() { |
|
− | mw.util.addPortletLink( 'p-tb', ' |
+ | mw.util.addPortletLink( 'p-tb', '/wiki/Internal:Dashboard', 'Dashboard', 't-dashboard', 'Dashboard ', 'r', '#t-whatlinkshere' ); |
− | mw.util.addPortletLink( 'p-tb', ' |
+ | mw.util.addPortletLink( 'p-tb', '/wiki/Special:RecentChanges', 'Recent changes', 't-recentchanges', 'Recent changes ', 'r', '#t-recentchangeslinked' ); |
+ | $( '#megaheader img' ).css( 'opacity', 1 ); /* Thank you Jack Phoenix! */ |
||
}); |
}); |
Latest revision as of 08:47, 27 May 2021
/* 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 (mw.config.get('wgUserName') === null) {
$(customizeSidebarForAnon);
$(customizeTopbarForAnon);
}
/* Add membership payment buttons */
var monthlyId = 'monthlyform';
var annuallyId = 'annuallyform';
$('#memberbutton-monthly').html('<div class="plainlinks"><form id="monthlyform5" style="display:inline;" 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="9MHQE5FETJYFW"><a href="#" onclick="document.getElementById(monthlyId + 5).submit()"><div class="arrowbutton-green roundbutton-large" style="font-size:38px; line-height:1.75em;">$5</div></a></form><form id="monthlyform10" style="display:inline;" 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="ZJQJ5SPKDFQTY"><a href="#" onclick="document.getElementById(monthlyId + 10).submit()"><div class="arrowbutton-green roundbutton-large" style="font-size:38px; line-height:1.75em;">$10</div></a></form><form id="monthlyform25" style="display:inline;" 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="5XSU2JHD29WA6"><a href="#" onclick="document.getElementById(monthlyId + 25).submit()"><div class="arrowbutton-green roundbutton-large" style="font-size:38px; line-height:1.75em;">$25</div></a></form><form id="monthlyform50" style="display:inline;" 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="B7ETK3LZRACLQ"><a href="#" onclick="document.getElementById(monthlyId + 50).submit()"><div class="arrowbutton-green roundbutton-large" style="font-size:38px; line-height:1.75em;">$50</div></a></form><form id="monthlyform100" style="display:inline;" 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="B9F73YWFQBYXA"><a href="#" onclick="document.getElementById(monthlyId + 100).submit()"><div class="arrowbutton-gold roundbutton-large" style="font-size:31px; line-height:2.3em;">$100</div></a></form><form id="monthlyform200" style="display:inline;" 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="4E42KFD7MCNJ4"><a href="#" onclick="document.getElementById(monthlyId + 200).submit()"><div class="arrowbutton-gold roundbutton-large" style="font-size:31px; line-height:2.3em;">$200</div></a></form></div>');
$('#memberbutton-annually').html('<div class="plainlinks"><form id="annuallyform5" style="display:inline;" 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="ZAKPCZYTXDRYN"><a href="#" onclick="document.getElementById(annuallyId + 5).submit()"><div class="arrowbutton-blue roundbutton" style="font-size:30px; line-height:1.75em;">$5</div></a></form><form id="annuallyform10" style="display:inline;" 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="8T8NESE2DWVX6"><a href="#" onclick="document.getElementById(annuallyId + 10).submit()"><div class="arrowbutton-blue roundbutton" style="font-size:30px; line-height:1.75em;">$10</div></a></form><form id="annuallyform25" style="display:inline;" 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="GSH4BLP9UTP6Q"><a href="#" onclick="document.getElementById(annuallyId + 25).submit()"><div class="arrowbutton-blue roundbutton" style="font-size:30px; line-height:1.75em;">$25</div></a></form><form id="annuallyform50" style="display:inline;" 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="BUJSW3H45AJY8"><a href="#" onclick="document.getElementById(annuallyId + 50).submit()"><div class="arrowbutton-blue roundbutton" style="font-size:30px; line-height:1.75em;">$50</div></a></form><form id="annuallyform100" style="display:inline;" 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="DWBBFHL3JKGPC"><a href="#" onclick="document.getElementById(annuallyId + 100).submit()"><div class="arrowbutton-blue roundbutton" style="font-size:25px; line-height:2.1em;">$100</div></a></form><form id="annuallyform200" style="display:inline;" 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="CPVX2SG6GSXNL"><a href="#" onclick="document.getElementById(annuallyId + 200).submit()"><div class="arrowbutton-blue roundbutton" style="font-size:25px; line-height:2.1em;">$200</div></a></form></div>');
/* Add donation buttons */
var dwYesMember = 'member';
var dwNoMember = 'donation';
var dwPartOne = '<div class="plainlinks"><form id="member" 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="';
var dwPartTwo = '"><a href="#" onclick="document.getElementById(dwYesMember).submit()"><div class="arrowbutton arrowbutton-green" style="font-size:115%; width:300px; margin-bottom:0.5em;"><span style="font-weight:bold;">Yes</span>, sign me up as a member!</div></a></form><form id="donation" 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="';
var dwPartThree = '"><a href="#" onclick="document.getElementById(dwNoMember).submit()"><div class="arrowbutton arrowbutton-blue" style="font-size:115%; width:190px; margin-bottom:0.5em;"><span style="font-weight:bold;"></span>Just the donation</div></a></form></div>';
var dwPartOneCir = '<div class="plainlinks"><form id="donation" 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="';
var dwPartTwoCir = '"><a href="#" onclick="document.getElementById(dwNoMember).submit()"><span class="roundbutton arrowbutton-blue" style="line-height:1.75em; font-size:30px;">';
var dwPartThreeCir = '</span></a></form></div>';
$('#dw-5m').html(dwPartOne + '9MHQE5FETJYFW' + dwPartTwo + 'VHB9L9U8THY9A' + dwPartThree);
$('#dw-10m').html(dwPartOne + 'ZJQJ5SPKDFQTY' + dwPartTwo + 'ELPHVEA56BGBA' + dwPartThree);
$('#dw-25m').html(dwPartOne + '5XSU2JHD29WA6' + dwPartTwo + 'Y9PGPAGD2EMP8' + dwPartThree);
$('#dw-50m').html(dwPartOne + 'B7ETK3LZRACLQ' + dwPartTwo + 'PR7VLZVEEX8CA' + dwPartThree);
$('#dw-100m').html(dwPartOne + 'B9F73YWFQBYXA' + dwPartTwo + 'WDJKYZF7XPRUL' + dwPartThree);
$('#dw-200m').html(dwPartOne + '4E42KFD7MCNJ4' + dwPartTwo + '4KL7SURFTFHA4' + dwPartThree);
$('#dw-5a').html(dwPartOne + 'ZAKPCZYTXDRYN' + dwPartTwo + 'FUHX7TBVKE2BG' + dwPartThree);
$('#dw-10a').html(dwPartOne + '8T8NESE2DWVX6' + dwPartTwo + 'UEBVSV6KF9SSE' + dwPartThree);
$('#dw-25a').html(dwPartOne + 'GSH4BLP9UTP6Q' + dwPartTwo + 'A922FAUXLDQSN' + dwPartThree);
$('#dw-50a').html(dwPartOne + 'BUJSW3H45AJY8' + dwPartTwo + 'MPXGN9SKV7HVY' + dwPartThree);
$('#dw-100a').html(dwPartOne + 'DWBBFHL3JKGPC' + dwPartTwo + 'SLSKUBGGA63C8' + dwPartThree);
$('#dw-200a').html(dwPartOne + 'CPVX2SG6GSXNL' + dwPartTwo + 'X4HUYHNVHN8M2' + dwPartThree);
$('#dw-5x').html(dwPartOne + 'QLWRD4W5AEYK4' + dwPartTwo + 'FG88LU479HZ7J' + dwPartThree);
$('#dw-10x').html(dwPartOne + '8Z4XGBQYJFP2L' + dwPartTwo + 'S7YX2BAZDVSAE' + dwPartThree);
$('#dw-25x').html(dwPartOne + '8SDTJWLUAE3TW' + dwPartTwo + 'J3RV9PVMSRH8Y' + dwPartThree);
$('#dw-50x').html(dwPartOne + '9C2JUGA7CWZWJ' + dwPartTwo + '3E66M99JDV836' + dwPartThree);
$('#dw-100x').html(dwPartOne + '4736NTBYA9SGN' + dwPartTwo + 'GNEQ7GUKNF9BS' + dwPartThree);
$('#dw-200x').html(dwPartOne + 'ZUK7NJQSFMBX4' + dwPartTwo + 'BU3YMWQSVJ9HW' + dwPartThree);
$('#dw-25c').html(dwPartOne + '6AJJ62C5FUTTA' + dwPartTwo + 'HLF8JWCU25KTW' + dwPartThree);
$('#dw-30c').html(dwPartOne + 'K8SUU6YWXTZGE' + dwPartTwo + 'WLLLRUEEDYKMY' + dwPartThree);
$('#dw-35c').html(dwPartOne + 'DQMBQLH46RT6E' + dwPartTwo + 'C69MHKJU4DUQC' + dwPartThree);
$('#dw-50c').html(dwPartOne + 'PKJNESR6LNRPU' + dwPartTwo + 'LJE5WTYQZZK5W' + dwPartThree);
$('#dw-75c').html(dwPartOne + 'VYQLHU33XSKKL' + dwPartTwo + 'WJG7S47XVZGGN' + dwPartThree);
$('#dw-100c').html(dwPartOne + 'MBPUCFKJ3DVTL' + dwPartTwo + '2M4WLALKET9RL' + dwPartThree);
/* Add mailing list signup form */
var mailingList = 'mailinglist';
$('#mailinglistsignup').html('<link href="//cdn-images.mailchimp.com/embedcode/slim-081711.css" rel="stylesheet" type="text/css"><style type="text/css"> #mc_embed_signup{background:#fff; clear:left; font:14px Helvetica,Arial,sans-serif; }</style><div id="mc_embed_signup"><form action="//wikimediadc.us12.list-manage.com/subscribe/post?u=f329c96f3ad7841331cbffd9f&id=0fc61a72a9" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate style="padding-left:0;"><div id="mc_embed_signup_scroll"><input type="email" value="" name="EMAIL" class="email" id="mce-EMAIL" placeholder="email address" required style="width:98%; height:20px; font-size:115%;"><!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups--><div style="position: absolute; left: -5000px;" aria-hidden="true"><input type="text" name="b_f329c96f3ad7841331cbffd9f_0fc61a72a9" tabindex="-1" value=""></div><div class="clear"><input type="submit" value="⇒ Subscribe" name="subscribe" id="mc-embedded-subscribe" class="arrowbutton arrowbutton-green" style="font-size:115%; width:125px;"></div></div></form></div>');
/* Add embedded chat */
$('#eventchat').html('<div id="rt-e8370f98c4dbfd6ee093107c010e5dcf"></div><script language="JavaScript" type="text/javascript" src="//www.rumbletalk.com/client/?L3aL2eqy"></script>');
/* Add a few links to the toolbox */
$(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' );
$( '#megaheader img' ).css( 'opacity', 1 ); /* Thank you Jack Phoenix! */
});