Difference between revisions of "MediaWiki:EditTemplates.js"

From Donate
Jump to navigation Jump to search
Line 4: Line 4:
 
// importScriptURI( 'http://bits.pgehres.com/donate/js/MediaWiki:EditTemplates.js' );
 
// 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>' );
$( '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' );
$( '#editTemplatesList' ).append( '<h4>Templates</h4>' );
 
  +
var language = getQuerystring( 'uselang' );
   
var country = getQuerystring( 'country' );
+
if ( country == '' ){
  +
country = 'XX';
var language = getQuerystring( 'uselang' );
 
  +
}
  +
if ( language == '' ){
  +
language = 'en';
  +
}
   
if ( country == '' ){
+
var editList = '' +
  +
'<ul>' +
country = 'XX';
 
  +
'<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>' +
if ( language == '' ){
 
  +
'<li><a href="/wiki/Template:2011FR/Appeal-default/text/@language?action=edit">Appeal Text</a></li>' +
language = 'en';
 
  +
'<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>';
   
var editList = '' +
+
editList = editList.replace( /@country/g, country );
  +
editList = editList.replace( /@language/g, language );
'<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>' +
 
// '<li><a href="/wiki/Template:2011FR/?action=edit">Payment Methods</a></li>' +
 
// '<li><a href="/wiki/Template:2011FR/?action=edit">Infobox</a></li>' +
 
// '<li><a href="/wiki/Template:2011FR/?action=edit">Legalese</a></li></ul</li>' +
 
'</ul>';
 
   
  +
$( '#editTemplatesList' ).append( editList );
editList = editList.replace( /@country/g, country );
 
editList = editList.replace( /@language/g, language );
 
   
  +
$( '#editTemplatesList' ).append( '<a href="/wiki/Special:Upload">Upload file</a>' );
   
function showEditBox(){
 
$( '#editTemplatesList' ).css( 'display', 'inline-block' );
 
$( '#editTemplates' ).click( function(){ hideEditBox() } );
 
}
 
function hideEditBox(){
 
$( '#editTemplatesList' ).css( 'display', 'none' );
 
$( '#editTemplates' ).click( function(){ showEditBox() } );
 
}
 
   
  +
var showEditBox = function(){
  +
$( '#editTemplatesList' ).css( 'display', 'inline-block' );
  +
$( '#editTemplates' ).click( function(){ hideEditBox(); } );
  +
};
  +
var hideEditBox = function(){
  +
$( '#editTemplatesList' ).css( 'display', 'none' );
  +
$( '#editTemplates' ).click( function(){ showEditBox(); } );
  +
};
   
  +
hideEditBox();
$( '#editTemplatesList' ).append( editList );
 
hideEditBox();
 
 
}
 
}

Revision as of 12:51, 20 June 2014

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();
}