MediaWiki:Gadget-Twinkle.js: Perbedaan antara revisi

Konten dihapus Konten ditambahkan
k Dikembalikan ke revisi 17086128 oleh Rachmat04 (bicara)
Tag: Pembatalan
Jon (WMF) (bicara | kontrib)
<maintenance> more info TypeError: Twinkle[module] is not a function. (In 'Twinkle[module]()', 'Twinkle[module]' is undefined)
 
(7 revisi perantara oleh 3 pengguna tidak ditampilkan)
Baris 8:
* Imported from github [https://github.com/azatoth/twinkle].
* All changes should be made in the repository, otherwise they will be lost.
*
* To update this script from github, you must have a local repository set up. Then
* follow the instructions at [https://github.com/azatoth/twinkle/blob/master/README.md].
*
* ----------
Baris 17 ⟶ 14:
* every Wikipedian in between. Visit [[WP:TW]] for more information.
*/
// <nowiki>
 
/* global Morebits */
 
( function ( window, document, $, undefined ) { // Wrap with anonymous function
 
// Check if account is experienced enough to use Twinkle
if (!Morebits.userIsInGroup('autoconfirmed') && !Morebits.userIsInGroup('confirmed')) {
return;
}
 
var Twinkle = {};
window.Twinkle = Twinkle; // allow global access
 
// Check if account is experienced enough to use Twinkle
Twinkle.userAuthorized = Morebits.userIsInGroup( "autoconfirmed" ) || Morebits.userIsInGroup( "confirmed" );
 
// for use by custom modules (normally empty)
Twinkle.initCallbacks = [];
Twinkle.addInitCallback = function twinkleAddInitCallback( func ) {
Twinkle.initCallbacks.push( func );
};
 
Twinkle.defaultConfig = {};
/**
* This holds the default set of preferences used by Twinkle.
* Twinkle.defaultConfig.twinkle and Twinkle.defaultConfig.friendly
*
* This holds the default set of preferences used by Twinkle. (The |friendly| object holds preferences stored in the FriendlyConfig object.)
* It is important that all new preferences added here, especially admin-only ones, are also added to
* |Twinkle.config.sections| in twinkleconfig.js, so they are configurable via the Twinkle preferences panel.
* For help on the actual preferences, see the comments in twinkleconfig.js.
*
* Formerly Twinkle.defaultConfig.twinkle and Twinkle.defaultConfig.friendly
*/
Twinkle.defaultConfig.twinkle = {
// General
summaryAd: "' ([[WP:TW|TW]])"',
deletionSummaryAd: "' ([[WP:TW|TW]])"',
protectionSummaryAd: "' ([[WP:TW|TW]])"',
userTalkPageMode: "'tab"',
dialogLargeFont: false,
disabledModules: [],
disabledSysopModules: [],
 
// ARV
spiWatchReport: "'yes"',
 
// Block
defaultToPartialBlocks: false,
blankTalkpageOnIndefBlock: false,
 
// Fluff (revert and rollback)
autoMenuAfterRollback: false,
openTalkPage: [ "agf", "norm", "vand" ],
openTalkPage: [ 'agf', 'norm', 'vand' ],
openTalkPageOnAutoRevert: false,
rollbackInPlace: false,
markRevertedPagesAsMinor: [ "vand" ],
markRevertedPagesAsMinor: [ 'vand' ],
watchRevertedPages: [ "agf", "norm", "vand", "torev" ],
watchRevertedPages: [ 'agf', 'norm', 'vand', 'torev' ],
offerReasonOnNormalRevert: true,
confirmOnFluff: false,
showRollbackLinks: [ "'diff"', "'others"' ],
 
// DI (twinkleimage)
notifyUserOnDeli: true,
deliWatchPage: "'default"',
deliWatchUser: "'default"',
 
// PROD
watchProdPages: true,
markProdPagesAsPatrolled: false,
prodReasonDefault: "",
prodReasonDefault: '',
logProdPages: false,
prodLogPageName: "'Log PROD"',
 
// CSD
speedySelectionStyle: "'buttonClick"',
watchSpeedyPages: [ "'u3"', "'u5"', "'u10"', "'u11"', "'u12"' ],
markSpeedyPagesAsPatrolled: truefalse,
 
// these next two should probably be identical by default
notifyUserOnSpeedyDeletionNominationwelcomeUserOnSpeedyDeletionNotification: [ "'db"', "'u1"', "'u2"', "'u3"', "'u4"', "'u6"', "'u10"', "'u11"', "'u12"', "'u13', 'u14', 'a1"', "'a2"', "'a3"', "'a5"', "'a7"', "'a9"', "'a10"', "'a11', 'b1"', "'b2"', "'b3"', "'b7"', "'b9"', "'b10"', "'h3"', 'h5', "'t2"', "'t3"', "'p1"', "'p2"' ],
welcomeUserOnSpeedyDeletionNotificationnotifyUserOnSpeedyDeletionNomination: [ "'db"', "'u1"', "'u2"', "'u3"', "'u4"', "'u6"', "'u10"', "'u11"', "'u12"', "'u13', 'u14', 'a1"', "'a2"', "'a3"', "'a5"', "'a7"', "'a9"', "'a10"', "'b1"', "'b2"', "'b3"', "'b7"', "'b9"', "'b10"', "'h3"', 'h5', "'t2"', "'t3"', "'p1"', "'p2"' ],
promptForSpeedyDeletionSummarywarnUserOnSpeedyDelete: [ "'db"', "'u1"', "'u2"', "'u3"', "'u4"', "'u6"', "u7"'u10', "u8"'u11', "u10"'u12', "u11"'u13', "u12"'u14', "'a1"', "'a2"', "'a3"', "'a5"', "'a7"', "'a9"', "'a10"', "'a11', 'b1', 'b2"', "b4"'b3', "'b7"', "b8"'b9', "'b10"', 'h3', 'h5', "'t2"', "'t3"', "'p1"', "'p2"' ],
promptForSpeedyDeletionSummary: [],
openUserTalkPageOnSpeedyDelete:[ "db", "u1", "u2", "u3", "u4", "u5", "u10", "u11", "u12", "a1", "a3", "a7", "a9", "a10", "b3", "b7", "b9", "h3", "t2", "p1" ],
deleteTalkPageOnDelete: true,
deleteRedirectsOnDelete: true,
deleteSysopDefaultToTagdeleteSysopDefaultToDelete: false,
speedyWindowHeight: 500,
speedyWindowWidth: 800,
logSpeedyNominations: false,
speedyLogPageName: "'Log KPC"',
noLogOnSpeedyNomination: [ "'h1"' ],
 
// Unlink
unlinkNamespaces: [ "'0"', "'10"', "'100"', "'118"' ],
 
// Warn
defaultWarningGroup: "'1"',
combinedSingletMenus: false,
showSharedIPNotice: true,
watchWarnings: true,
oldSelect: false,
customWarningList: [],
autoMenuAfterRollback: false,
 
// XfD
logXfdNominations: false,
xfdWatchDiscussion: "default",
xfdLogPageName: 'XfD log',
xfdWatchList: "no",
noLogOnXfdNomination: [],
xfdWatchPage: "default",
xfdWatchUserxfdWatchDiscussion: "'default"',
xfdWatchList: 'no',
xfdWatchRelated: "default",
xfdWatchPage: 'default',
xfdWatchUser: 'default',
xfdWatchRelated: 'default',
markXfdPagesAsPatrolled: true,
 
// Hidden preferences
revertMaxRevisions: 50,
autolevelStaleDays: 3, // Huggle is 3, CBNG is 2
batchMax: 5000,
batchdeleteChunks: 50,
batchMax: 5000,
batchProtectChunks: 50,
batchundeleteChunks: 50,
proddeleteChunks: 50,
};
 
// Formerly defaultConfig.friendly:
// now some skin dependent config.
if ( mw.config.get( "skin" ) === "vector" ) {
Twinkle.defaultConfig.twinkle.portletArea = "right-navigation";
Twinkle.defaultConfig.twinkle.portletId = "p-twinkle";
Twinkle.defaultConfig.twinkle.portletName = "TW";
Twinkle.defaultConfig.twinkle.portletType = "menu";
Twinkle.defaultConfig.twinkle.portletNext = "p-search";
} else {
Twinkle.defaultConfig.twinkle.portletArea = null;
Twinkle.defaultConfig.twinkle.portletId = "p-cactions";
Twinkle.defaultConfig.twinkle.portletName = null;
Twinkle.defaultConfig.twinkle.portletType = null;
Twinkle.defaultConfig.twinkle.portletNext = null;
}
 
Twinkle.defaultConfig.friendly = {
// Tag
groupByDefault: true,
Baris 146 ⟶ 141:
markTaggedPagesAsMinor: false,
markTaggedPagesAsPatrolled: true,
tagArticleSortOrder: "'cat"',
customTagList: [],
customFileTagList: [],
Baris 154 ⟶ 149:
topWelcomes: false,
watchWelcomes: true,
welcomeHeading: "'Selamat datang!"',
insertHeadings: true,
insertUsername: true,
insertSignature: true, // sign welcome templates, where appropriate
quickWelcomeMode: "'norm"',
quickWelcomeTemplate: "'sd2"',
customWelcomeList: [],
customWelcomeSignature: true,
Baris 166 ⟶ 161:
markTalkbackAsMinor: true,
insertTalkbackSignature: true, // always sign talkback templates
talkbackHeading: "'Pesan baru dari "' + mw.config.get("'wgUserName"'),
adminNoticeHeading: "'Perhatian"',
mailHeading: "'Anda memiliki pesan baru!"',
 
// Shared
Baris 174 ⟶ 169:
};
 
// now some skin dependent config.
Twinkle.getPref = function twinkleGetPref( name ) {
switch (mw.config.get('skin')) {
var result;
case 'vector':
if ( typeof Twinkle.prefs === "object" && typeof Twinkle.prefs.twinkle === "object" ) {
Twinkle.defaultConfig.portletArea = 'right-navigation';
// look in Twinkle.prefs (twinkleoptions.js)
result = Twinkle.prefsdefaultConfig.portletId = 'p-twinkle[name]';
Twinkle.defaultConfig.portletName = 'TW';
} else if ( typeof window.TwinkleConfig === "object" ) {
Twinkle.defaultConfig.portletType = 'menu';
// look in TwinkleConfig
Twinkle.defaultConfig.portletNext = 'p-search';
result = window.TwinkleConfig[name];
break;
}
case 'timeless':
Twinkle.defaultConfig.portletArea = '#page-tools .sidebar-inner';
Twinkle.defaultConfig.portletId = 'p-twinkle';
Twinkle.defaultConfig.portletName = 'Twinkle';
Twinkle.defaultConfig.portletType = null;
Twinkle.defaultConfig.portletNext = 'p-userpagetools';
break;
default:
Twinkle.defaultConfig.portletArea = null;
Twinkle.defaultConfig.portletId = 'p-cactions';
Twinkle.defaultConfig.portletName = null;
Twinkle.defaultConfig.portletType = null;
Twinkle.defaultConfig.portletNext = null;
}
 
if ( result === undefined ) {
return Twinkle.defaultConfig.twinkle[name];
}
return result;
};
 
Twinkle.getFriendlyPrefgetPref = function twinkleGetFriendlyPreftwinkleGetPref(name) {
if (typeof Twinkle.prefs === 'object' && Twinkle.prefs[name] !== undefined) {
var result;
return Twinkle.prefs[name];
if ( typeof Twinkle.prefs === "object" && typeof Twinkle.prefs.friendly === "object" ) {
// look in Twinkle.prefs (twinkleoptions.js)
result = Twinkle.prefs.friendly[ name ];
} else if ( typeof window.FriendlyConfig === "object" ) {
// look in FriendlyConfig
result = window.FriendlyConfig[ name ];
}
// Old preferences format, used before twinkleoptions.js was a thing
 
if (typeof window.TwinkleConfig === 'object' && window.TwinkleConfig[name] !== undefined) {
if ( result === undefined ) {
return Twinklewindow.defaultConfig.friendlyTwinkleConfig[ name ];
}
if (typeof window.FriendlyConfig === 'object' && window.FriendlyConfig[name] !== undefined) {
return result;
return window.FriendlyConfig[name];
}
return Twinkle.defaultConfig[name];
};
 
 
 
Baris 427 ⟶ 428:
 
Twinkle.load = function () {
// Don't activate on special pages other than those onlisted the whitelisthere, so that
// theythat others load faster, especially the watchlist.
var specialPageWhitelistactiveSpecialPageList = [ 'Block', 'Contributions', 'Recentchanges', 'Recentchangeslinked' ]; // wgRelevantUserName defined for non-sysops on Special:Block
if (Morebits.userIsSysop) {
specialPageWhitelistactiveSpecialPageList = specialPageWhitelistactiveSpecialPageList.concat([ 'DeletedContributions', 'Prefixindex' ]);
}
if (mw.config.get('wgNamespaceNumber') === -1 &&
specialPageWhitelistactiveSpecialPageList.indexOf(mw.config.get('wgCanonicalSpecialPageName')) === -1) {
return;
}
Baris 451 ⟶ 452:
'arv', 'warn', 'block', 'welcome', 'shared', 'talkback',
// Deletion
'speedy', 'prod', /* 'xfd', */ 'image',
// Maintenance
'protect', 'tag',
Baris 462 ⟶ 463:
return disabledModules.indexOf(mod) === -1;
}).forEach(function(module) {
if ( typeof Twinkle[module]( === 'function' ); {
Twinkle[module]();
}
});
Twinkle.config.init(); // Can't turn off