User:RoyZuo/common.js
Jump to navigation
Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
The accompanying .css page for this skin can be added at User:RoyZuo/common.css. |
//<nowiki>
//catALot///////////////////////////////////////
////////// Cat-a-lot user preferences //////////
window.catALotPrefs = {"disambig_category":"Disambiguation categories","redir_category":"Category redirects","watchlist":"preferences","minor":true,"editpages":true,"docleanup":true,"subcatcount":50,"uncat":true,"button":true};
////////////////////////////////////catALotEnd//
window.HotCatAutoRemoveCheckCat = true;
window.hotcat_no_autocommit = true;
var mykey = mw.config.get('wgTitle').replace(/\sby\s.+/g, ""),
nsnum = mw.config.get('wgNamespaceNumber');
mw.loader.load( '/w/index.php?title=User:Magnus Manske/sdc_tool.js&action=raw&ctype=text/javascript' );
mw.loader.load( '/w/index.php?title=User:Rillke/bigChunkedUpload.js&action=raw&ctype=text/javascript' );
mw.loader.load( '/w/index.php?title=User:RoyZuo/CopyCodeBlock.js&action=raw&ctype=text/javascript' );
mw.loader.load('/w/index.php?title=User:Aafi/InterwikiLinksCopier.js&action=raw&ctype=text/javascript');
mw.loader.load('/w/index.php?title=User:Mahir256/subtitle-editor.js&action=raw&ctype=text/javascript');
if (nsnum === 6 && /SVG/i.test(mw.config.get('wgTitle').slice(-3))) // SVGedit on SVG files only
mw.loader.load( '/w/index.php?title=User:Rillke/SVGedit.js&action=raw&ctype=text/javascript' );
var customizeToolbar = function () {
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'main',
'groups': {
'mine': {
'label': 'mine'
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'main',
group: 'mine',
tools: {
"Asia": {
label: 'Countries of Asia',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/5/53/Map_marker_icon_–_Nicolas_Mollet_–_Pagoda_–_Tourism_–_Dark.png',
action: {
type: 'encapsulate',
options: {
pre: "{{Countries of Asia|prefix=",
post: "{{subst"+
":#invoke:String|sub|{{subst"+
":FULLPAGENAME}}|1|{{subst"+
":#expr:{{subst"+
":#invoke:String|find|{{subst"+
":FULLPAGENAME}}|%s%u%l+|15|false}}-1}}}}}}",
ownline: true
}
}
},
"CatRedirect": {
label: 'CatRedirect',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/a/a8/S-train_service_C.svg',
action: {
type: 'encapsulate',
options: {
pre: "{{Category redirect|",
post: "}}",
}
}
},
"MOTD": {
label: 'MOTD',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/5/59/Maki2-camera-24.svg',
action: {
type: 'encapsulate',
options: {
pre: "=={{Assessment}}==",
post: "{{Media of the day|{{subst"+":CURRENTYEAR}}||}}",
ownline: true
}
}
},
"en": {
label: 'en',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/8/8f/EN_English_Language_Symbol_ISO_639-1_IETF_Language_Tag_Icon.svg',
action: {
type: 'encapsulate',
options: {
pre: "{{en|",
post: "}}"
}
}
},
"yue": {
label: 'yue',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/c/c2/Latin_capital_letter_enlarged_small_Y.svg',
action: {
type: 'encapsulate',
options: {
pre: "{{yue|",
post: "}}"
}
}
}
}
} );
};
/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */
if ( [ 'edit', 'submit' ].indexOf( mw.config.get( 'wgAction' ) ) !== -1 ) {
mw.loader.using( 'user.options' ).then( function () {
// This can be the string "0" if the user disabled the preference ([[phab:T54542#555387]])
if ( mw.user.options.get( 'usebetatoolbar' ) == 1 ) {
$.when(
mw.loader.using( 'ext.wikiEditor' ), $.ready
).then( customizeToolbar );
}
} );
}
if (nsnum === 14) {
jQuery(document).ready(function(){
'use strict';
mw.util.addPortletLink('p-tb',
mw.config.get('wgScript') + "?title=Special:MediaSearch&search=deepcat:%22" +
(mw.config.get('wgTitle').split(" ").join("_")) + "%22",
'Deepcat MediaSearch',
'ca-deepcatsearch',
"Find images in sub-categories");
mw.util.addPortletLink('p-tb',
mw.config.get('wgScript') + "?title=Special:Search&limit=100&search=deepcat:%22" +
(mw.config.get('wgTitle').split(" ").join("_")) + "%22",
'Deepcat classic',
'ca-deepcatsearch',
"Find images in sub-categories");
mw.util.addPortletLink('p-cactions',
"https://petscan.wmflabs.org/?project=wikimedia&cb_labels_any_l=1&cb_labels_no_l=1&cb_labels_yes_l=1&language=commons&ns%5B6%5D=1&output_limit=999&depth=99&sortorder=descending&format=html&active_tab=tab_output&ext_image_data=on&doit=&categories=" +
mw.config.get('wgTitle').split(" ").join("_"),
'Deepcat PetScan 999',
'ca-deepcatsearch',
"PetScan images in sub-categories");
});
}
jQuery(document).ready(function(){
'use strict';
mw.util.addPortletLink('p-tb','', '██████████████');
mw.util.addPortletLink('p-tb',
"https://www.flickr.com/search/?license=4%2C5%2C7%2C8%2C9%2C10&view_all=1&sort=date-taken-desc&text=" +
encodeURIComponent(mykey),
'Flickr CC search',
'ca-freemediasearch',
"Find Commercial use & mods allowed on Flickr");
mw.util.addPortletLink('p-tb',
"https://www.youtube.com/results?sp=CAISAjAB&search_query=" +
encodeURIComponent(mykey),
'YouTube CC-BY search',
'ca-freemediasearch',
"Find CC-BY on YouTube");
if (nsnum === 102 || nsnum === 103) {
mw.util.addPortletLink('p-namespaces',
mw.config.get('wgScript') + "?title=File:" + mw.config.get('wgTitle').replace(/\.[^\.]+\.srt/g, ""),
'Back to File',
'ca-backtofile',
"Go to the associated file page");
}
if (nsnum === 6 || nsnum === 7 || nsnum === 102 || nsnum === 103) {
mw.util.addPortletLink('p-namespaces',
mw.config.get('wgArticlePath').replace("$1", "") + "Special:PrefixIndex/TimedText:" + mw.config.get('wgTitle'),
'TimedText list',
'ca-TimedTextList',
"List TimedText of this file");
}
});
//</nowiki>
//<nowiki>
//vFCvFCCfg/////////////////////////////////////
/////// VISUAL FILE CHANGE CONFIGURATION ///////
///// DO NOT MODIFY BY HAND - FINGERS AWAY! ////
////////////////////////////////////////////////
window.vFCSettings = {"userNote":"Yours sincerely,","firstTest":0,"testEdits":0,"defaultAction":"c_replace","watchlistUserTalk":"preferences","watchlistFiles":"preferences","watchlistReplace":"nochange","watchlistOTRS":"nochange","loadBatchSize":50,"maxSimultaneousReq":5,"summaryChacheLen":5,"loadThumbs":true,"loadWikitext":true};
//////////////////////////////////vFCvFCCfgEnd//
//</nowiki>