सदस्य:Siddhartha Ghai/twinklefooter.js
सूचना: यह पृष्ठ सुरक्षित करने बाद, परिवर्तनों को देखने लिए ब्राउज़र का कैश ख़ाली करने की आवश्यकता हो सकती है।
- मोज़िला / फ़ायरफ़ॉक्स / सफ़ारी: shift hold करें जब आप reload क्लिक करते है, या Ctrl-Shift-R (अपल मैक में Cmd-Shift-R) दबाएँ;
- गूगल क्रोम: Ctrl-shift-R (मैक में Cmd-Shift-R) दबाएँ
- इंटरनेट एक्सप्लोरर: Ctrl hold करें जब आप refresh क्लिक करते हैं, या Ctrl-F5 क्लिक करते हैं;
- कॉङ्करर: सिर्फ़ Reload बटन पर क्लिक करें, या F5 क्लिक करें;
- ऑपरा सदस्य को Tools→Preferences में सम्पूर्ण कैश ख़ाली करने की ज़रूरत हो सकती है।
/**
* **************** General initialization code ****************
*/
//<nowiki>
( function ( window, document, $, undefined ) { // Wrap with anonymous function
var scriptpathbefore = mw.util.wikiScript( "index" ) + "?title=",
scriptpathafter = "&action=raw&ctype=text/javascript&happy=yes";
// Retrieve the user's Twinkle preferences
$.ajax({
url: scriptpathbefore + "User:" + encodeURIComponent( mw.config.get("wgUserName")) + "/twinkleoptions.js" + scriptpathafter,
dataType: "text"
})
.fail(function () { mw.notify( "twinkleoptions.js लोड नहीं हो सका" ); })
.done(function ( optionsText ) {
// Quick pass if user has no options
if ( optionsText === "" ) {
return;
}
// Twinkle options are basically a JSON object with some comments. Strip those:
optionsText = optionsText.replace( /(?:^(?:\/\/[^\n]*\n)*\n*|(?:\/\/[^\n]*(?:\n|$))*$)/g, "" );
// First version of options had some boilerplate code to make it eval-able -- strip that too. This part may become obsolete down the line.
if ( optionsText.lastIndexOf( "window.Twinkle.prefs = ", 0 ) === 0 ) {
optionsText = optionsText.replace( /(?:^window.Twinkle.prefs = |;\n*$)/g, "" );
}
try {
var options = JSON.parse( optionsText );
// Assuming that our options evolve, we will want to transform older versions:
//if ( options.optionsVersion === undefined ) {
// ...
// options.optionsVersion = 1;
//}
//if ( options.optionsVersion === 1 ) {
// ...
// options.optionsVersion = 2;
//}
// At the same time, twinkleconfig.js needs to be adapted to write a higher version number into the options.
if ( options ) {
Twinkle.prefs = options;
}
}
catch ( e ) {
mw.notify( "twinkleoptions.js पार्स नहीं हो सका" );
}
})
.always(function () {
$( Twinkle.load );
});
// Developers: you can import custom Twinkle modules here
// For example, mw.loader.load(scriptpathbefore + "User:UncleDouggie/morebits-test.js" + scriptpathafter);
Twinkle.load = function () {
// Don't activate on special pages other than those on the whitelist so that
// they load faster, especially the watchlist.
var specialPageWhitelist = [ 'Contributions', 'DeletedContributions', 'Prefixindex' ];
var isSpecialPage = ( mw.config.get('wgNamespaceNumber') === -1 &&
specialPageWhitelist.indexOf( mw.config.get('wgCanonicalSpecialPageName') ) === -1 );
// Also, Twinkle is incompatible with Internet Explorer versions 8 or lower,
// so don't load there either.
var isOldIE = ( $.client.profile().name === 'msie' &&
$.client.profile().versionNumber < 9 );
// Prevent users that are not autoconfirmed from loading Twinkle as well.
if ( isSpecialPage || isOldIE || !Twinkle.userAuthorized ) {
return;
}
// Prevent clickjacking
if ( window.top !== window.self ) {
return;
}
// Set custom Api-User-Agent header, for server-side logging purposes
Morebits.wiki.api.setApiUserAgent( 'Twinkle/2.0 (' + mw.config.get( 'wgDBname' ) + ')' );
// Load the modules in the order that the tabs should appears
// User/user talk-related
Twinkle.arv();
Twinkle.warn();
if ( Morebits.userIsInGroup('sysop') ) {
Twinkle.block();
}
Twinkle.welcome();
Twinkle.shared();
Twinkle.talkback();
// Deletion
Twinkle.speedy();
Twinkle.xfd();
// maintenance
Twinkle.protect();
Twinkle.tag();
// Misc. ones last
Twinkle.diff();
Twinkle.unlink();
Twinkle.config.init();
Twinkle.fluff.init();
if ( Morebits.userIsInGroup('sysop') ) {
Twinkle.batchdelete();
Twinkle.batchprotect();
Twinkle.batchundelete();
}
// Run the initialization callbacks for any custom modules
Twinkle.initCallbacks.forEach(function ( func ) { func(); });
Twinkle.addInitCallback = function ( func ) { func(); };
// Increases text size in Twinkle dialogs, if so configured
if ( Twinkle.getPref( "dialogLargeFont" ) ) {
mw.util.addCSS( ".morebits-dialog-content, .morebits-dialog-footerlinks { font-size: 100% !important; } " +
".morebits-dialog input, .morebits-dialog select, .morebits-dialog-content button { font-size: inherit !important; }" );
}
};
} ( window, document, jQuery )); // End wrap with anonymous function
//</nowiki>