Difference between revisions of "MediaWiki:EditTemplates.js"

From Donate
Jump to navigation Jump to search
(cleanup, add more tools)
Line 1: Line 1:
 
if ( wgPageName == "Special:FundraiserLandingPage" ){
 
if ( wgPageName == "Special:FundraiserLandingPage" ){
  +
// importScript('MediaWiki:EditTemplates.js');
 
 
importStylesheet( 'MediaWiki:EditTemplates.css' );
 
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="editTemplates"><span id="editText">Tools</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>' );
 
$( 'body' ).append( '<div id="editTemplatesList"></div>' );
   
$( '#editTemplatesList' ).append( '<h4>Templates</h4>' );
+
$( '#editTemplatesList' ).append( '<h4>Edit templates</h4>' );
   
var country = getQuerystring( 'country' );
+
var country = mw.util.getParamValue( 'country' ) || 'XX';
var language = getQuerystring( 'uselang' );
+
var language = mw.util.getParamValue( 'uselang' ) || 'en';
 
if ( country == '' ){
 
country = 'XX';
 
}
 
if ( language == '' ){
 
language = 'en';
 
}
 
   
 
var editList = '' +
 
var editList = '' +
Line 35: Line 27:
 
$( '#editTemplatesList' ).append( editList );
 
$( '#editTemplatesList' ).append( editList );
   
$( '#editTemplatesList' ).append( '<a href="/wiki/Special:Upload">Upload file</a>' );
+
$( '#editTemplatesList' ).append( '<h4>Other tools</h4>' );
  +
  +
var toolList = '' +
  +
'<ul>' +
  +
'<li><a href="/wiki/Special:AllPages">All pages</a></li>' +
  +
'<li><a href="/wiki/Special:AllPages?namespace=6">All files</a></li>' +
  +
'<li><a href="/wiki/Special:Upload">Upload file</a></li>' +
  +
'</ul>';
  +
  +
$( '#editTemplatesList' ).append( toolList );
   
   

Revision as of 10:53, 28 October 2014

if ( wgPageName == "Special:FundraiserLandingPage" ){

    importStylesheet( 'MediaWiki:EditTemplates.css' );

    $( 'body' ).append( '<div id="editTemplates"><span id="editText">Tools</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>Edit templates</h4>' );

    var country = mw.util.getParamValue( 'country' ) || 'XX';
    var language = mw.util.getParamValue( 'uselang' ) || '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( '<h4>Other tools</h4>' );

    var toolList = '' +
    '<ul>' +
    '<li><a href="/wiki/Special:AllPages">All pages</a></li>' +
    '<li><a href="/wiki/Special:AllPages?namespace=6">All files</a></li>' +
    '<li><a href="/wiki/Special:Upload">Upload file</a></li>' +
    '</ul>';

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


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

    hideEditBox();
}