MediaWiki: Common.js

No edit summary
(Remove custom toolbox links.)
 
(13 intermediate revisions by 4 users not shown)
Line 1: Line 1:
/* Any JavaScript here will be loaded for all users on every page load. */
/* Any JavaScript here will be loaded for all users on every page load. */
/* Interface modifications for anonymous users */
/**
* Test if an element has a certain class
* @deprecated:  Use $(element).hasClass() instead.
*/
mw.log.deprecate( window, 'hasClass', function ( element, className ) {
    return $( element ).hasClass( className );
}, 'Use jQuery.hasClass() instead' );
/**
* Modify side and top navigation elements for anon users respectively.
*/
if ( null === mw.config.get( 'wgUserName' ) ) {
    // Remove 'tools' section from sidebar.
    $( '#p-tb' ).remove();
    // Add 'join' link in top bar.
    mw.loader.using( 'mediawiki.util' ).then( function () {
        mw.util.addPortletLink( 'p-personal', 'https://docs.google.com/forms/d/e/1FAIpQLSd8RkvwXpUl3_vkEKJgpjSBrSTW1_fDFrTcEtLabCUqDpM2Jg/viewform', 'Join now', 'pt-join', 'Join Wikimedia Australia and help support our mission!', 'j', '#pt-createaccount' );
    } );
}
/* 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="UDZRFWXHKZ9SN"><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="roundbutton roundbutton-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="roundbutton roundbutton-blue" style="font-size:115%; width:180px; margin-bottom:0.5em;"><span style="font-weight:bold;"></span>Just the donation</div></a></form></div>';
$('#dw-5m').html(dwPartOne + 'UDZRFWXHKZ9SN' + 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);
/* Add mailing list signup form */
var mailingList = 'mailinglist';
$('#mailinglistsignup').html('<form id="mailinglist" method="post" action="https://lists.wikimedia.org/mailman/subscribe/Wikimedia-AU-Announce"><input type="text" required name="email" value="" style="display:block; width:15.5em; font-size:115%; line-height:1.75em; margin-bottom:0.5em;" placeholder="Email address"><input type="hidden" name="language" value="en"><input type="hidden" name="digest" value="0"><a href="#" onclick="document.getElementById(mailingList).submit()"><div class="arrowbutton arrowbutton-green" style="font-size:115%; width:15em; text-align:center;">Subscribe</div></a></form>');


/** Collapsible tables *********************************************************
/** Collapsible tables *********************************************************
Line 12: Line 77:
var expandCaption = "show";
var expandCaption = "show";
   
   
function collapseTable( tableIndex )
function collapseTable( tableIndex ) {
{
var Button = document.getElementById( "collapseButton" + tableIndex );
    var Button = document.getElementById( "collapseButton" + tableIndex );
var Table = document.getElementById( "collapsibleTable" + tableIndex );
    var Table = document.getElementById( "collapsibleTable" + tableIndex );
   
   
    if ( !Table || !Button ) {
if ( !Table || !Button ) {
        return false;
return false;
    }
}
   
   
    var Rows = Table.rows;
var Rows = Table.rows;
   
   
    if ( Button.firstChild.data == collapseCaption ) {
if ( Button.firstChild.data == collapseCaption ) {
        for ( var i = 1; i < Rows.length; i++ ) {
for ( var i = 1; i < Rows.length; i++ ) {
            Rows[i].style.display = "none";
Rows[i].style.display = "none";
        }
}
        Button.firstChild.data = expandCaption;
Button.firstChild.data = expandCaption;
    } else {
} else {
        for ( var i = 1; i < Rows.length; i++ ) {
for ( var i = 1; i < Rows.length; i++ ) {
            Rows[i].style.display = Rows[0].style.display;
Rows[i].style.display = Rows[0].style.display;
        }
}
        Button.firstChild.data = collapseCaption;
Button.firstChild.data = collapseCaption;
    }
}
}
}
   
   
function createCollapseButtons()
function createCollapseButtons() {
{
var tableIndex = 0;
    var tableIndex = 0;
var NavigationBoxes = new Object();
    var NavigationBoxes = new Object();
var Tables = document.getElementsByTagName( "table" );
    var Tables = document.getElementsByTagName( "table" );
   
   
    for ( var i = 0; i < Tables.length; i++ ) {
for ( var i = 0; i < Tables.length; i++ ) {
        if ( hasClass( Tables[i], "collapsible" ) ) {
if ( hasClass( Tables[i], "collapsible" ) ) {
   
   
            /* only add button and increment count if there is a header row to work with */
/* only add button and increment count if there is a header row to work with */
            var HeaderRow = Tables[i].getElementsByTagName( "tr" )[0];
var HeaderRow = Tables[i].getElementsByTagName( "tr" )[0];
            if (!HeaderRow) continue;
if (!HeaderRow) continue;
            var Header = HeaderRow.getElementsByTagName( "th" )[0];
var Header = HeaderRow.getElementsByTagName( "th" )[0];
            if (!Header) continue;
if (!Header) continue;
   
   
            NavigationBoxes[ tableIndex ] = Tables[i];
NavigationBoxes[ tableIndex ] = Tables[i];
            Tables[i].setAttribute( "id", "collapsibleTable" + tableIndex );
Tables[i].setAttribute( "id", "collapsibleTable" + tableIndex );
   
   
            var Button    = document.createElement( "span" );
var Button    = document.createElement( "span" );
            var ButtonLink = document.createElement( "a" );
var ButtonLink = document.createElement( "a" );
            var ButtonText = document.createTextNode( collapseCaption );
var ButtonText = document.createTextNode( collapseCaption );
   
   
            Button.style.styleFloat = "right";
Button.style.styleFloat = "right";
            Button.style.cssFloat = "right";
Button.style.cssFloat = "right";
            Button.style.fontWeight = "normal";
Button.style.fontWeight = "normal";
            Button.style.textAlign = "right";
Button.style.textAlign = "right";
            Button.style.width = "6em";
Button.style.width = "6em";
   
   
            ButtonLink.style.color = Header.style.color;
ButtonLink.style.color = Header.style.color;
            ButtonLink.setAttribute( "id", "collapseButton" + tableIndex );
ButtonLink.setAttribute( "id", "collapseButton" + tableIndex );
            ButtonLink.setAttribute( "href", "javascript:collapseTable(" + tableIndex + ");" );
ButtonLink.setAttribute( "href", "javascript:collapseTable(" + tableIndex + ");" );
            ButtonLink.appendChild( ButtonText );
ButtonLink.appendChild( ButtonText );
   
   
            Button.appendChild( document.createTextNode( "[" ) );
Button.appendChild( document.createTextNode( "[" ) );
            Button.appendChild( ButtonLink );
Button.appendChild( ButtonLink );
            Button.appendChild( document.createTextNode( "]" ) );
Button.appendChild( document.createTextNode( "]" ) );
   
   
            Header.insertBefore( Button, Header.childNodes[0] );
Header.insertBefore( Button, Header.childNodes[0] );
            tableIndex++;
tableIndex++;
        }
}
    }
}
   
   
    for ( var i = 0;  i < tableIndex; i++ ) {
for ( var i = 0;  i < tableIndex; i++ ) {
        if ( hasClass( NavigationBoxes[i], "collapsed" ) || ( tableIndex >= autoCollapse && hasClass( NavigationBoxes[i], "autocollapse" ) ) ) {
if ( hasClass( NavigationBoxes[i], "collapsed" ) || ( tableIndex >= autoCollapse && hasClass( NavigationBoxes[i], "autocollapse" ) ) ) {
            collapseTable( i );
collapseTable( i );
        }  
}
        else if ( hasClass( NavigationBoxes[i], "innercollapse" ) ) {
}
            var element = NavigationBoxes[i];
            while (element = element.parentNode) {
                if ( hasClass( element, "outercollapse" ) ) {
                    collapseTable ( i );
                    break;
                }
            }
        }
    }
}
}
   
   
addOnloadHook( createCollapseButtons );
jQuery( createCollapseButtons );
   
   
/** Dynamic Navigation Bars (experimental) *************************************
/** Dynamic Navigation Bars (experimental) *************************************
*
  *
*  Description: See [[Wikipedia:NavFrame]].
  *  Description: See [[Wikipedia:NavFrame]].
*  Maintainers: UNMAINTAINED
  *  Maintainers: UNMAINTAINED
*/
  */
   
   
// set up the words in your language
// set up the words in your language
Line 110: Line 163:
// Parameters:
// Parameters:
//    indexNavigationBar: the index of navigation bar to be toggled
//    indexNavigationBar: the index of navigation bar to be toggled
function toggleNavigationBar(indexNavigationBar)
function toggleNavigationBar(indexNavigationBar) {
{
var NavToggle = document.getElementById("NavToggle" + indexNavigationBar);
    var NavToggle = document.getElementById("NavToggle" + indexNavigationBar);
var NavFrame = document.getElementById("NavFrame" + indexNavigationBar);
    var NavFrame = document.getElementById("NavFrame" + indexNavigationBar);
   
   
    if (!NavFrame || !NavToggle) {
if (!NavFrame || !NavToggle) {
        return false;
return false;
    }
}
   
   
    // if shown now
// if shown now
    if (NavToggle.firstChild.data == NavigationBarHide) {
if (NavToggle.firstChild.data == NavigationBarHide) {
        for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) {
for (
            if ( hasClass( NavChild, 'NavPic' ) ) {
var NavChild = NavFrame.firstChild;
                NavChild.style.display = 'none';
NavChild != null;
            }
NavChild = NavChild.nextSibling
            if ( hasClass( NavChild, 'NavContent') ) {
) {
                NavChild.style.display = 'none';
if ( hasClass( NavChild, 'NavPic' ) ) {
            }
NavChild.style.display = 'none';
        }
}
    NavToggle.firstChild.data = NavigationBarShow;
if ( hasClass( NavChild, 'NavContent') ) {
NavChild.style.display = 'none';
}
}
NavToggle.firstChild.data = NavigationBarShow;
   
   
    // if hidden now
// if hidden now
    } else if (NavToggle.firstChild.data == NavigationBarShow) {
} else if (NavToggle.firstChild.data == NavigationBarShow) {
        for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) {
for (
            if (hasClass(NavChild, 'NavPic')) {
var NavChild = NavFrame.firstChild;
                NavChild.style.display = 'block';
NavChild != null;
            }
NavChild = NavChild.nextSibling
            if (hasClass(NavChild, 'NavContent')) {
) {
                NavChild.style.display = 'block';
if( hasClass(NavChild, 'NavPic') ) {
            }
NavChild.style.display = 'block';
        }
}
        NavToggle.firstChild.data = NavigationBarHide;
if( hasClass(NavChild, 'NavContent') ) {
    }
NavChild.style.display = 'block';
}
}
NavToggle.firstChild.data = NavigationBarHide;
}
}
}
   
   
// adds show/hide-button to navigation bars
// adds show/hide-button to navigation bars
function createNavigationBarToggleButton()
function createNavigationBarToggleButton() {
{
var indexNavigationBar = 0;
    var indexNavigationBar = 0;
// iterate over all < div >-elements  
    // iterate over all < div >-elements  
var divs = document.getElementsByTagName("div");
    var divs = document.getElementsByTagName("div");
for(
    for (var i = 0; NavFrame = divs[i]; i++) {
var i=0;  
        // if found a navigation bar
NavFrame = divs[i];  
        if (hasClass(NavFrame, "NavFrame")) {
i++
) {
// if found a navigation bar
if( hasClass(NavFrame, "NavFrame") ) {
   
   
            indexNavigationBar++;
indexNavigationBar++;
            var NavToggle = document.createElement("a");
var NavToggle = document.createElement("a");
            NavToggle.className = 'NavToggle';
NavToggle.className = 'NavToggle';
            NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar);
NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar);
            NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');');
NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');');
   
   
            var isCollapsed = hasClass( NavFrame, "collapsed" );
var NavToggleText = document.createTextNode(NavigationBarHide);
            /*
for (
            * Check if any children are already hidden.  This loop is here for backwards compatibility:
var NavChild = NavFrame.firstChild;
            * the old way of making NavFrames start out collapsed was to manually add style="display:none"
NavChild != null;
            * to all the NavPic/NavContent elements.  Since this was bad for accessibility (no way to make
NavChild = NavChild.nextSibling
            * 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.
if ( hasClass( NavChild, 'NavPic' ) || hasClass( NavChild, 'NavContent' ) ) {
            */
if (NavChild.style.display == 'none') {
            for (var NavChild = NavFrame.firstChild; NavChild != null && !isCollapsed; NavChild = NavChild.nextSibling) {
NavToggleText = document.createTextNode(NavigationBarShow);
                if ( hasClass( NavChild, 'NavPic' ) || hasClass( NavChild, 'NavContent' ) ) {
break;
                    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)
NavToggle.appendChild(NavToggleText);
            for(var j=0; j < NavFrame.childNodes.length; j++) {
// Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked)
                if (hasClass(NavFrame.childNodes[j], "NavHead")) {
for(
                    NavFrame.childNodes[j].appendChild(NavToggle);
var j=0;
                }
j < NavFrame.childNodes.length;
            }
j++
            NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar);
) {
        }
if( hasClass(NavFrame.childNodes[j], "NavHead") ) {
    }
NavFrame.childNodes[j].appendChild(NavToggle);
}
}
NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar);
}
}
}
}
   
   
addOnloadHook( createNavigationBarToggleButton );
jQuery( createNavigationBarToggleButton );

Latest revision as of 01:16, 13 October 2019

/* Any JavaScript here will be loaded for all users on every page load. */

/* Interface modifications for anonymous users */

/**
 * Test if an element has a certain class
 * @deprecated:  Use $(element).hasClass() instead.
 */
mw.log.deprecate( window, 'hasClass', function ( element, className ) {
    return $( element ).hasClass( className );
}, 'Use jQuery.hasClass() instead' );

/**
 * Modify side and top navigation elements for anon users respectively.
 */
if ( null === mw.config.get( 'wgUserName' ) ) {
    // Remove 'tools' section from sidebar.
    $( '#p-tb' ).remove();
    // Add 'join' link in top bar.
    mw.loader.using( 'mediawiki.util' ).then( function () {
        mw.util.addPortletLink( 'p-personal', 'https://docs.google.com/forms/d/e/1FAIpQLSd8RkvwXpUl3_vkEKJgpjSBrSTW1_fDFrTcEtLabCUqDpM2Jg/viewform', 'Join now', 'pt-join', 'Join Wikimedia Australia and help support our mission!', 'j', '#pt-createaccount' );
    } );
}

/* 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="UDZRFWXHKZ9SN"><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="roundbutton roundbutton-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="roundbutton roundbutton-blue" style="font-size:115%; width:180px; margin-bottom:0.5em;"><span style="font-weight:bold;"></span>Just the donation</div></a></form></div>';

$('#dw-5m').html(dwPartOne + 'UDZRFWXHKZ9SN' + 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);

/* Add mailing list signup form */
var mailingList = 'mailinglist';

$('#mailinglistsignup').html('<form id="mailinglist" method="post" action="https://lists.wikimedia.org/mailman/subscribe/Wikimedia-AU-Announce"><input type="text" required name="email" value="" style="display:block; width:15.5em; font-size:115%; line-height:1.75em; margin-bottom:0.5em;" placeholder="Email address"><input type="hidden" name="language" value="en"><input type="hidden" name="digest" value="0"><a href="#" onclick="document.getElementById(mailingList).submit()"><div class="arrowbutton arrowbutton-green" style="font-size:115%; width:15em; text-align:center;">Subscribe</div></a></form>');

/** Collapsible tables *********************************************************
 *
 *  Description: Allows tables to be collapsed, showing only the header. See
 *               [[Wikipedia:NavFrame]].
 *  Maintainers: [[User:R. Koot]]
 */
 
var autoCollapse = 2;
var collapseCaption = "hide";
var expandCaption = "show";
 
function collapseTable( 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.style.styleFloat = "right";
			Button.style.cssFloat = "right";
			Button.style.fontWeight = "normal";
			Button.style.textAlign = "right";
			Button.style.width = "6em";
 
			ButtonLink.style.color = Header.style.color;
			ButtonLink.setAttribute( "id", "collapseButton" + tableIndex );
			ButtonLink.setAttribute( "href", "javascript:collapseTable(" + tableIndex + ");" );
			ButtonLink.appendChild( ButtonText );
 
			Button.appendChild( document.createTextNode( "[" ) );
			Button.appendChild( ButtonLink );
			Button.appendChild( document.createTextNode( "]" ) );
 
			Header.insertBefore( Button, Header.childNodes[0] );
			tableIndex++;
		}
	}
 
	for ( var i = 0;  i < tableIndex; i++ ) {
		if ( hasClass( NavigationBoxes[i], "collapsed" ) || ( tableIndex >= autoCollapse && hasClass( NavigationBoxes[i], "autocollapse" ) ) ) {
			collapseTable( i );
		}
	}
}
 
jQuery( createCollapseButtons );
 
 /** Dynamic Navigation Bars (experimental) *************************************
  *
  *  Description: See [[Wikipedia:NavFrame]].
  *  Maintainers: UNMAINTAINED
  */
 
// set up the words in your language
var NavigationBarHide = '[' + collapseCaption + ']';
var NavigationBarShow = '[' + expandCaption + ']';
 
// shows and hides content and picture (if available) of navigation bars
// Parameters:
//     indexNavigationBar: the index of navigation bar to be toggled
function toggleNavigationBar(indexNavigationBar) {
	var NavToggle = document.getElementById("NavToggle" + indexNavigationBar);
	var NavFrame = document.getElementById("NavFrame" + indexNavigationBar);
 
	if (!NavFrame || !NavToggle) {
		return false;
	}
 
	// if shown now
	if (NavToggle.firstChild.data == NavigationBarHide) {
		for (
			var NavChild = NavFrame.firstChild;
			NavChild != null;
			NavChild = NavChild.nextSibling
		) {
		if ( hasClass( NavChild, 'NavPic' ) ) {
			NavChild.style.display = 'none';
		}
		if ( hasClass( NavChild, 'NavContent') ) {
			NavChild.style.display = 'none';
		}
	}
	NavToggle.firstChild.data = NavigationBarShow;
 
	// if hidden now
	} else if (NavToggle.firstChild.data == NavigationBarShow) {
	for (
		var NavChild = NavFrame.firstChild;
		NavChild != null;
		NavChild = NavChild.nextSibling
	) {
		if( hasClass(NavChild, 'NavPic') ) {
			NavChild.style.display = 'block';
		}
		if( hasClass(NavChild, 'NavContent') ) {
			NavChild.style.display = 'block';
		}
	}
	NavToggle.firstChild.data = NavigationBarHide;
	}
}
 
// adds show/hide-button to navigation bars
function createNavigationBarToggleButton() {
	var indexNavigationBar = 0;
	// iterate over all < div >-elements 
	var divs = document.getElementsByTagName("div");
	for(
		var i=0; 
		NavFrame = divs[i]; 
		i++
		) {
	// if found a navigation bar
	if( hasClass(NavFrame, "NavFrame") ) {
 
		indexNavigationBar++;
		var NavToggle = document.createElement("a");
		NavToggle.className = 'NavToggle';
		NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar);
		NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');');
 
		var NavToggleText = document.createTextNode(NavigationBarHide);
		for (
			var NavChild = NavFrame.firstChild;
			NavChild != null;
			NavChild = NavChild.nextSibling
			) {
		if ( hasClass( NavChild, 'NavPic' ) || hasClass( NavChild, 'NavContent' ) ) {
			if (NavChild.style.display == 'none') {
				NavToggleText = document.createTextNode(NavigationBarShow);
				break;
			}
		}
	}
 
		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") ) {
				NavFrame.childNodes[j].appendChild(NavToggle);
			}
		}
		NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar);
		}
	}
}
 
jQuery( createNavigationBarToggleButton );
Discuss this page