MediaWiki:EditTemplates.js: Difference between revisions

From Donate
Jump to navigation Jump to search
Content deleted Content added
m unicode arrow
adding tax messages link
 
(30 intermediate revisions by the same user not shown)
Line 1: Line 1:
$(document).ready(function() {
$(document).ready(function() {


mw.loader.load( '/w/index.php?title=MediaWiki:EditTemplates.css&action=raw&ctype=text/css', 'text/css' );
if ( mw.config.get('wgPageName') === 'Special:LandingPage' ) {
$( '#p-logo' ).after( '<div id="toolBox" style="display: none;"></div>' );
$( '#toolBox' ).append( '<div id="toolLink">Tools ▶</div>' )


var toolListHTML = `
importStylesheet( 'MediaWiki:EditTemplates.css' );
<div id="toolList" style="display: none;">

<h4>Edit templates/translations</h4>
$( 'body' ).append( '<div id="toolBox">Tools </div>' );

var toolListHTML = `
<div id="toolList">
<h4>Edit templates</h4>
<ul>
<ul>
<li><a href="/wiki/Template:Lp-layout-default?action=edit">Overall Layout</a></li>
<li><a href="/wiki/Template:Lp-layout-default?action=edit">Overall Layout</a></li>
<li><a href="/wiki/Template:Lp-layout-endowment?action=edit">Endowment Page</a></li>
<li><a href="/wiki/Template:Appeal/@appeal/@language?action=edit">Appeal</a></li>
<li><a href="/wiki/Template:Appeal/@appeal/@language?action=edit">Appeal</a></li>
<li>
<li><a href="/wiki/Template:2012FR/Form-template-whereyourdonation?action=edit">Form Template</a></li>
Form:
<li>- <a href="/wiki/Template:2012FR/@formCS/@country?action=edit">Form Content</a></li>
<li><a href="/wiki/Template:2012FR/Form-section/Infobox/Default/title/@language?action=edit">Infobox Title</a></li>
<a href="/wiki/Template:Form-template/@formTemplate?action=edit">template</a> ·
<li><a href="/wiki/Template:2012FR/Form-section/Infobox/Default/text/@language?action=edit">Infobox Text</a></li>
<a href="/wiki/Template:2012FR/@formCS/@country?action=edit">content</a>
</li>
<li>
Monthly pitch
<a href="/wiki/Template:MonthlyPitch/Default">template</a> ·
<a href="/wiki/Template:MonthlyPitchText">texts</a>
</li>
<li><a href="/wiki/Template:Infobox/@infobox/@language?action=edit">Infobox</a></li>
<li>
Opt-in:
<a href="/wiki/Template:Optin/Default">template</a> ·
<a href="/wiki/Template:OptinText">texts</a>
</li>
<li><a href="/wiki/Template:PTF Text/Default">PTF texts</a></li>
<li>
Monthly convert:
<a href="/wiki/Template:MonthlyConvert/Default">template</a> ·
<a href="/wiki/Special:PrefixIndex/Template:MonthlyConvert/">list</a> ·
<a href="/wiki/Template:MonthlyConvertText">texts</a> ·
<a href="/wiki/MediaWiki:MonthlyConvert.js">JS</a>
</li>
<li><a href="/wiki/Template:Tax">Tax messages</a></li>
<li><a href="/wiki/Template:Donatewiki_translations">Translations on donatewiki</a></li>
<li><a href="/wiki/Template:DonationInterface_messages">Translations on translatewiki</a></li>
<li><a href="/wiki/Template:Styles/Default.css">Default CSS</a></li>
</ul>
</ul>
<h4>Files</h4>
<h4>Files</h4>
<ul>
<ul>
<li><a href="/wiki/Special:AllPages?namespace=6">All files</a></li>
<li><a href="/wiki/Special:AllPages?namespace=6">All files</a></li>
<li><a href="/wiki/Special:NewFiles">New files (gallery)</a></li>
<li><a href="/wiki/Special:Upload">Upload file</a></li>
<li><a href="/wiki/Special:Upload">Upload file</a></li>
</ul>
</ul>
Line 27: Line 53:
<li><a href="/wiki/Special:AllPages">All pages</a></li>
<li><a href="/wiki/Special:AllPages">All pages</a></li>
<li><a href="/wiki/Special:PrefixIndex">All pages with prefix</a></li>
<li><a href="/wiki/Special:PrefixIndex">All pages with prefix</a></li>
<li><a href="/wiki/Special:PrefixIndex?prefix=Appeal/&namespace=10">All appeals</a>
<li><a href="/wiki/Special:PrefixIndex?prefix=Appeal/&namespace=10">All appeals</a></li>
<li><a href="/wiki/Special:PrefixIndex?prefix=2012FR/Form-&namespace=10">All forms</a>
<li><a href="/wiki/Special:PrefixIndex?prefix=2012FR/Form-&namespace=10">All forms</a></li>
<li><a href="/wiki/Special:PrefixIndex?prefix=Infobox/&namespace=10">All infoboxes</a></li>
<li><a href="/wiki/Special:PrefixIndex?prefix=Styles&namespace=10">All styles</a></li>
<li><a href="/wiki/Special:PrefixIndex?prefix=Styles&namespace=10">All styles</a></li>
</ul>
</ul>
<h4>Other</h4>
<h4>Other</h4>
<ul>
<ul>
<li><a href="/wiki/Template:2012FR/Form-section/Paymentmethods">Payment methods</a></li>
<li><a href="/wiki/Template:Paymentmethod">Payment methods</a></li>
<li><a href="/wiki/MediaWiki:Common.js">Site JavaScript</a></li>
<li><a href="/wiki/MediaWiki:Common.js">Site JavaScript</a></li>
<li><a href="/wiki/Template:2012FR/Form-section/Processing/Default">Default form processing JS</a></li>
<li><a href="/wiki/MediaWiki:DonationForm.js">Donation form JavaScript</a></li>
<li><a href="/wiki/Special:CategoryTree?target=Category%3ACategories">Category Tree</a></li>
<li><a href="/wiki/Template:CountryNope">Blocked country message</a></li>
<li><a href="/wiki/Special:CategoryTree?target=Category%3ACategories">Category tree</a></li>
<li><a href="/wiki/Special:SpecialPages">Special pages</a></li>
<li><a href="/wiki/Special:SpecialPages">Special pages</a></li>
<li><a href="/wiki/Special:ListUsers">Users list</a></li>
<li><a href="/wiki/Special:MyContributions">My contributions</a></li>
<li><a href="/wiki/Special:MyContributions">My contributions</a></li>
<li><a href="/wiki/Special:RecentChanges">Recent changes</a></li>
<li><a href="/wiki/MediaWiki:EditTemplates.js">This toolbox</a></li>
<li><a href="/wiki/MediaWiki:EditTemplates.js">This toolbox</a></li>
</ul>
</ul>
<h4><a href="/wiki/Support_pages">Support pages</a></h4>
<h4><a href="https://collab.wikimedia.org/wiki/Fundraising/Donatewiki_documentation" target="_blank">Documentation</a></h4>
<h4><a href="https://collab.wikimedia.org/wiki/Fundraising/Donatewiki_documentation" target="_blank">Documentation</a></h4>
</div>`;
</div>`;


var country = mw.util.getParamValue( 'country' ) || 'XX';
var country = mw.util.getParamValue( 'country' ) || 'XX';
var language = mw.util.getParamValue( 'uselang' ) || 'en';
var language = mw.util.getParamValue( 'uselang' ) || 'en';
var appeal = mw.util.getParamValue( 'appeal' ) || 'Appeal-default';
var appeal = mw.util.getParamValue( 'appeal' ) || 'default';
appeal = appeal.replace( 'Appeal-', '' );
appeal = appeal.replace( 'Appeal-', '' );
var formCS = mw.util.getParamValue( 'form-countryspecific' ) || 'Form-countryspecific-control';
var formCS = mw.util.getParamValue( 'form-countryspecific' ) || 'Form-countryspecific-control';
var formTemplate = mw.util.getParamValue( 'form-template' ) || 'Form-template-default';
var infobox = mw.util.getParamValue( 'infobox' ) || 'Default';


toolListHTML = toolListHTML.replace( /@country/g, country );
toolListHTML = toolListHTML.replace( /@country/g, country );
toolListHTML = toolListHTML.replace( /@language/g, language );
toolListHTML = toolListHTML.replace( /@language/g, language );
toolListHTML = toolListHTML.replace( /@appeal/g, appeal );
toolListHTML = toolListHTML.replace( /@appeal/g, appeal );
toolListHTML = toolListHTML.replace( /@formCS/g, formCS );
toolListHTML = toolListHTML.replace( /@formCS/g, formCS );
toolListHTML = toolListHTML.replace( /@formTemplate/g, formTemplate );
toolListHTML = toolListHTML.replace( /@infobox/g, infobox );


$( 'body' ).append( toolListHTML );
$( '#toolBox' ).append( toolListHTML );
$( '#toolBox' ).show();


$( '#toolBox' ).click( function() {
$( '#toolLink' ).click( function() {
$( '#toolList' ).toggle();
$( '#toolList' ).toggle();
});
});
}
});
});

Latest revision as of 19:48, 30 September 2024

$(document).ready(function() {

    mw.loader.load( '/w/index.php?title=MediaWiki:EditTemplates.css&action=raw&ctype=text/css', 'text/css' );
    
    $( '#p-logo' ).after( '<div id="toolBox" style="display: none;"></div>' );
    
    $( '#toolBox' ).append( '<div id="toolLink">Tools ▶</div>' )

    var toolListHTML = `
<div id="toolList" style="display: none;">
    <h4>Edit templates/translations</h4>
    <ul>
        <li><a href="/wiki/Template:Lp-layout-default?action=edit">Overall Layout</a></li>
        <li><a href="/wiki/Template:Lp-layout-endowment?action=edit">Endowment Page</a></li>
        <li><a href="/wiki/Template:Appeal/@appeal/@language?action=edit">Appeal</a></li>
        <li>
        	Form:
        	<a href="/wiki/Template:Form-template/@formTemplate?action=edit">template</a> · 
        	<a href="/wiki/Template:2012FR/@formCS/@country?action=edit">content</a>
        </li>
        <li>
            Monthly pitch
        	<a href="/wiki/Template:MonthlyPitch/Default">template</a> · 
        	<a href="/wiki/Template:MonthlyPitchText">texts</a>
        </li>
        <li><a href="/wiki/Template:Infobox/@infobox/@language?action=edit">Infobox</a></li>
        <li>
        	Opt-in:
        	<a href="/wiki/Template:Optin/Default">template</a> · 
        	<a href="/wiki/Template:OptinText">texts</a>
        </li>
        <li><a href="/wiki/Template:PTF Text/Default">PTF texts</a></li>
        <li>
        	Monthly convert: 
        	<a href="/wiki/Template:MonthlyConvert/Default">template</a> ·
        	<a href="/wiki/Special:PrefixIndex/Template:MonthlyConvert/">list</a> ·
        	<a href="/wiki/Template:MonthlyConvertText">texts</a> · 
			<a href="/wiki/MediaWiki:MonthlyConvert.js">JS</a>
		</li>
		<li><a href="/wiki/Template:Tax">Tax messages</a></li>
		<li><a href="/wiki/Template:Donatewiki_translations">Translations on donatewiki</a></li>
		<li><a href="/wiki/Template:DonationInterface_messages">Translations on translatewiki</a></li>
        <li><a href="/wiki/Template:Styles/Default.css">Default CSS</a></li>
    </ul>
    <h4>Files</h4>
    <ul>
        <li><a href="/wiki/Special:AllPages?namespace=6">All files</a></li>
        <li><a href="/wiki/Special:NewFiles">New files (gallery)</a></li>
        <li><a href="/wiki/Special:Upload">Upload file</a></li>
    </ul>
    <h4>Lists</h4>
    <ul>
        <li><a href="/wiki/Special:AllPages">All pages</a></li>
        <li><a href="/wiki/Special:PrefixIndex">All pages with prefix</a></li>
        <li><a href="/wiki/Special:PrefixIndex?prefix=Appeal/&namespace=10">All appeals</a></li>
        <li><a href="/wiki/Special:PrefixIndex?prefix=2012FR/Form-&namespace=10">All forms</a></li>
        <li><a href="/wiki/Special:PrefixIndex?prefix=Infobox/&namespace=10">All infoboxes</a></li>
        <li><a href="/wiki/Special:PrefixIndex?prefix=Styles&namespace=10">All styles</a></li>
    </ul>
    <h4>Other</h4>
    <ul>
        <li><a href="/wiki/Template:Paymentmethod">Payment methods</a></li>
        <li><a href="/wiki/MediaWiki:Common.js">Site JavaScript</a></li>
        <li><a href="/wiki/MediaWiki:DonationForm.js">Donation form JavaScript</a></li>
        <li><a href="/wiki/Template:CountryNope">Blocked country message</a></li>
        <li><a href="/wiki/Special:CategoryTree?target=Category%3ACategories">Category tree</a></li>
        <li><a href="/wiki/Special:SpecialPages">Special pages</a></li>
        <li><a href="/wiki/Special:ListUsers">Users list</a></li>
        <li><a href="/wiki/Special:MyContributions">My contributions</a></li>
        <li><a href="/wiki/Special:RecentChanges">Recent changes</a></li>
        <li><a href="/wiki/MediaWiki:EditTemplates.js">This toolbox</a></li>
    </ul>
    <h4><a href="/wiki/Support_pages">Support pages</a></h4>
    <h4><a href="https://collab.wikimedia.org/wiki/Fundraising/Donatewiki_documentation" target="_blank">Documentation</a></h4>
</div>`;

    var country  = mw.util.getParamValue( 'country' ) || 'XX';
    var language = mw.util.getParamValue( 'uselang' ) || 'en';
    var appeal   = mw.util.getParamValue( 'appeal'  ) || 'default';
    appeal = appeal.replace( 'Appeal-', '' );
    var formCS   = mw.util.getParamValue( 'form-countryspecific' ) || 'Form-countryspecific-control';
    var formTemplate = mw.util.getParamValue( 'form-template' ) || 'Form-template-default';
    var infobox  = mw.util.getParamValue( 'infobox' ) || 'Default';

    toolListHTML = toolListHTML.replace( /@country/g, country );
    toolListHTML = toolListHTML.replace( /@language/g, language );
    toolListHTML = toolListHTML.replace( /@appeal/g, appeal );
    toolListHTML = toolListHTML.replace( /@formCS/g, formCS );
    toolListHTML = toolListHTML.replace( /@formTemplate/g, formTemplate );
    toolListHTML = toolListHTML.replace( /@infobox/g, infobox );

    $( '#toolBox' ).append( toolListHTML );
    $( '#toolBox' ).show();

    $( '#toolLink' ).click( function() {
        $( '#toolList' ).toggle();
    });
    
});