MediaWiki:EditTemplates.js

From Donate
Revision as of 12:51, 20 June 2014 by Pcoombe (talk | contribs)
Jump to navigation Jump to search

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: 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.
if ( wgPageName == "Special:FundraiserLandingPage" ){
    // importScript('MediaWiki:EditTemplates.js');
    importStylesheet( 'MediaWiki:EditTemplates.css' );
    // importScriptURI( 'http://bits.pgehres.com/donate/js/MediaWiki:EditTemplates.js' );

    $( 'body' ).append( '<div id="editTemplates"><span id="editText">Edit</span><img id="editArrow" width="8" src="//upload.wikimedia.org/wikipedia/commons/thumb/1/10/ArrowRightNavbox.svg/32px-ArrowRightNavbox.svg.png"/></div>' );

    $( 'body' ).append( '<div id="editTemplatesList"></div>' );

    $( '#editTemplatesList' ).append( '<h4>Templates</h4>' );

    var country = getQuerystring( 'country' );
    var language = getQuerystring( 'uselang' );

    if ( country == '' ){
        country = 'XX';
    }
    if ( language == '' ){
        language = 'en';
    }

    var editList = '' +
    '<ul>' +
    '<li><a href="/wiki/Template:Lp-layout-default?action=edit">Overall Layout</a></li>' +
    '<li><a href="/wiki/Template:2011FR/Appeal-template-default?action=edit">Appeal Template</a><ul>' +
    '<li><a href="/wiki/Template:2011FR/Appeal-default/text/@language?action=edit">Appeal Text</a></li>' +
    '<li><a href="/wiki/Template:2011FR/Appeal-default/title/@language?action=edit">Appeal Title</a></li></ul></li>' +
    '<li><a href="/wiki/Template:2012FR/Form-countryspecific-control/@country?action=edit">Form Layout</a><ul>' +
    '<li><a href="/wiki/Template:2012FR/Form-countryspecific-control/@country&action=edit">Radio Buttons</a></li>' +
    '</ul>';

    editList = editList.replace( /@country/g, country );
    editList = editList.replace( /@language/g, language );

    $( '#editTemplatesList' ).append( editList );

    $( '#editTemplatesList' ).append( '<a href="/wiki/Special:Upload">Upload file</a>' );


    var showEditBox = function(){
        $( '#editTemplatesList' ).css( 'display', 'inline-block' );
        $( '#editTemplates' ).click( function(){ hideEditBox(); } ); 
    };
    var hideEditBox = function(){
        $( '#editTemplatesList' ).css( 'display', 'none' );
        $( '#editTemplates' ).click( function(){ showEditBox(); } ); 
    };

    hideEditBox();
}