MediaWiki:Gadget-Twinkle.js: Difference between revisions

Reverted to revision 36957 by Admin (talk): Reverting back. (TW)
(Trying a new version (from En Wikipedia))
(Reverted to revision 36957 by Admin (talk): Reverting back. (TW))
Line 15: Line 15:
  *
  *
  * This is AzaToth's Twinkle, the popular script sidekick for newbies, admins, and
  * This is AzaToth's Twinkle, the popular script sidekick for newbies, admins, and
  * every Wikipedian in between. Visit [[WP:TW]] for more information.
  * every Wikipedian in between. Visit [[SV:TW]] for more information.
  */
  */


Line 45: Line 45:
Twinkle.defaultConfig.twinkle = {
Twinkle.defaultConfig.twinkle = {
// General
// General
summaryAd: " ([[WP:TW|TW]])",
summaryAd: " ([[SV:TW|TW]])",
deletionSummaryAd: " ([[WP:TW|TW]])",
deletionSummaryAd: " ([[SV:TW|TW]])",
protectionSummaryAd: " ([[WP:TW|TW]])",
protectionSummaryAd: " ([[SV:TW|TW]])",
userTalkPageMode: "tab",
userTalkPageMode: "window",
dialogLargeFont: false,
dialogLargeFont: false,
// ARV
spiWatchReport: "yes",
// Block
blankTalkpageOnIndefBlock: false,
// Fluff (revert and rollback)
// Fluff (revert and rollback)
openTalkPage: [ "agf", "norm", "vand" ],
openTalkPage: [ "agf", "norm", "vand" ],
Line 73: Line 69:
// CSD
// CSD
speedySelectionStyle: "buttonClick",
speedySelectionStyle: "buttonClick",
speedyPromptOnG7: false,
watchSpeedyPages: [ "g3", "g5", "g10", "g11", "g12" ],
watchSpeedyPages: [ "g3", "g5", "g10", "g11", "g12" ],
markSpeedyPagesAsPatrolled: true,
markSpeedyPagesAsPatrolled: true,
// these next two should probably be identical by default
// these next two should probably be identical by default
notifyUserOnSpeedyDeletionNomination:    [ "db", "g1", "g2", "g3", "g4", "g6", "g10", "g11", "g12", "g13", "a1", "a2", "a3", "a5", "a7", "a9", "a10", "a11", "f1", "f2", "f3", "f7", "f9", "f10", "u3", "u5", "t2", "t3", "p1", "p2" ],
notifyUserOnSpeedyDeletionNomination:    [ "db", "g1", "g2", "g3", "g4", "g6", "g10", "g11", "g12", "g13", "a1", "a2", "a3", "a5", "a7", "a9", "a10", "a11", "f1", "f2", "f3", "f7", "f9", "f10", "u3", "t2", "t3", "p1", "p2" ],
welcomeUserOnSpeedyDeletionNotification: [ "db", "g1", "g2", "g3", "g4", "g6", "g10", "g11", "g12", "g13", "a1", "a2", "a3", "a5", "a7", "a9", "a10", "a11", "f1", "f2", "f3", "f7", "f9", "f10", "u3", "u5", "t2", "t3", "p1", "p2" ],
welcomeUserOnSpeedyDeletionNotification: [ "db", "g1", "g2", "g3", "g4", "g6", "g10", "g11", "g12", "g13", "a1", "a2", "a3", "a5", "a7", "a9", "a10", "a11", "f1", "f2", "f3", "f7", "f9", "f10", "u3", "t2", "t3", "p1", "p2" ],
promptForSpeedyDeletionSummary: [],
promptForSpeedyDeletionSummary: [ "db", "g1", "g2", "g3", "g4", "g6", "g7", "g8", "g10", "g11", "g12", "a1", "a2", "a3", "a5", "a7", "a9", "a10", "a11", "f2", "f4", "f7", "f8", "f10", "t2", "t3", "p1", "p2" ],
openUserTalkPageOnSpeedyDelete: [ "db", "g1", "g2", "g3", "g4", "g5", "g10", "g11", "g12", "a1", "a3", "a7", "a9", "a10", "a11", "f3", "f7", "f9", "u3", "u5", "t2", "p1" ],
openUserTalkPageOnSpeedyDelete: [ "db", "g1", "g2", "g3", "g4", "g5", "g10", "g11", "g12", "a1", "a3", "a7", "a9", "a10", "a11", "f3", "f7", "f9", "u3", "t2", "p1" ],
deleteTalkPageOnDelete: true,
deleteTalkPageOnDelete: false,
deleteRedirectsOnDelete: true,
deleteRedirectsOnDelete: true,
deleteSysopDefaultToTag: false,
deleteSysopDefaultToTag: false,
Line 89: Line 86:
noLogOnSpeedyNomination: [ "u1" ],
noLogOnSpeedyNomination: [ "u1" ],
// Unlink
// Unlink
unlinkNamespaces: [ "0", "10", "100", "118" ],
unlinkNamespaces: [ "0", "100" ],
// Warn
// Warn
defaultWarningGroup: "1",
defaultWarningGroup: "1",
showSharedIPNotice: true,
showSharedIPNotice: true,
watchWarnings: true,
watchWarnings: true,
blankTalkpageOnIndefBlock: false,
customWarningList: [],
customWarningList: [],
// XfD
// XfD
Line 100: Line 98:
xfdWatchPage: "default",
xfdWatchPage: "default",
xfdWatchUser: "default",
xfdWatchUser: "default",
markXfdPagesAsPatrolled: true,
// Hidden preferences
// Hidden preferences
revertMaxRevisions: 50,
revertMaxRevisions: 50,
batchdeleteChunks: 50,
batchdeleteChunks: 50,
batchDeleteMinCutOff: 5,
batchMax: 5000,
batchMax: 5000,
batchProtectChunks: 50,
batchProtectChunks: 50,
batchProtectMinCutOff: 5,
batchundeleteChunks: 50,
batchundeleteChunks: 50,
batchUndeleteMinCutOff: 5,
deliChunks: 500,
deliMax: 5000,
proddeleteChunks: 50
proddeleteChunks: 50
};
};
Line 186: Line 188:
return result;
return result;
};
};


/**
/**
Line 299: Line 299:
outerDiv.appendChild( h5 );
outerDiv.appendChild( h5 );


var innerDiv = null;
if ( type === "menu" ) {
if ( type === "menu" ) {
innerDiv = document.createElement( "div" );
var innerDiv = document.createElement( "div" );
innerDiv.className = innerDivClass;
innerDiv.className = innerDivClass;
outerDiv.appendChild(innerDiv);
outerDiv.appendChild(innerDiv);
Line 324: Line 323:
}
}
var link = mw.util.addPortletLink( Twinkle.getPref( "portletId" ), typeof task === "string" ? task : "#", text, id, tooltip );
var link = mw.util.addPortletLink( Twinkle.getPref( "portletId" ), typeof task === "string" ? task : "#", text, id, tooltip );
$('.client-js .skin-vector #p-cactions').css('margin-right', 'initial');
if ( $.isFunction( task ) ) {
if ( $.isFunction( task ) ) {
$( link ).click(function ( ev ) {
$( link ).click(function ( ev ) {
Line 367: Line 365:


try {
try {
var options = JSON.parse( optionsText );
var options = $.parseJSON( optionsText );


// Assuming that our options evolve, we will want to transform older versions:
// Assuming that our options evolve, we will want to transform older versions:
Line 396: Line 394:


Twinkle.load = function () {
Twinkle.load = function () {
// Don't activate on special pages other than those on the whitelist so that
    // Don't activate on special pages other than "Contributions" so that they load faster, especially the watchlist.
// they load faster, especially the watchlist.
var isSpecialPage = ( mw.config.get('wgNamespaceNumber') === -1
var specialPageWhitelist = [ 'Contributions', 'DeletedContributions', 'Prefixindex' ];
    && mw.config.get('wgCanonicalSpecialPageName') !== "Contributions"
var isSpecialPage = ( mw.config.get('wgNamespaceNumber') === -1 &&
    && mw.config.get('wgCanonicalSpecialPageName') !== "Prefixindex" ),
specialPageWhitelist.indexOf( mw.config.get('wgCanonicalSpecialPageName') ) === -1 );


// Also, Twinkle is incompatible with Internet Explorer versions 8 or lower,
    // Also, Twinkle is incompatible with Internet Explorer versions 8 or lower, so don't load there either.
// so don't load there either.
    isOldIE = ( $.client.profile().name === 'msie' && $.client.profile().versionNumber < 9 );
var isOldIE = ( $.client.profile().name === 'msie' &&
$.client.profile().versionNumber < 9 );


// Prevent users that are not autoconfirmed from loading Twinkle as well.
    // Prevent users that are not autoconfirmed from loading Twinkle as well.
if ( isSpecialPage || isOldIE || !Twinkle.userAuthorized ) {
if ( isSpecialPage || isOldIE || !Twinkle.userAuthorized ) {
return;
return;
}
}


// Prevent clickjacking
// Load the modules in the order that the tabs should appears
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 appear
// User/user talk-related
// User/user talk-related
Twinkle.arv();
Twinkle.arv();
Twinkle.warn();
Twinkle.warn();
if ( Morebits.userIsInGroup('sysop') ) {
Twinkle.block();
}
Twinkle.welcome();
Twinkle.welcome();
Twinkle.shared();
Twinkle.shared();
Line 444: Line 428:
Twinkle.fluff.init();
Twinkle.fluff.init();
if ( Morebits.userIsInGroup('sysop') ) {
if ( Morebits.userIsInGroup('sysop') ) {
Twinkle.delimages();
Twinkle.deprod();
Twinkle.deprod();
Twinkle.batchdelete();
Twinkle.batchdelete();
Line 450: Line 435:
}
}
// Run the initialization callbacks for any custom modules
// Run the initialization callbacks for any custom modules
Twinkle.initCallbacks.forEach(function ( func ) { func(); });
$( Twinkle.initCallbacks ).each(function ( k, v ) { v(); });
Twinkle.addInitCallback = function ( func ) { func(); };
Twinkle.addInitCallback = function ( func ) { func(); };


14,061

edits