User:Kwj2772/global.js
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
//<nowiki>
window.userGlobalJSLoaded = true; // Global JS load check
mw.loader.using('mediawiki.util', function () { // declaring dependencies
var api = mw.config.get('wgServer') + '/w/api.php';
/*
* To import script more easily
*/
window.rawScriptLink = function (page, domain, mime = "text/javascript") {
if (!page) return false;
if (!domain) return false;
var url = '//' + domain + '.org' + mw.config.get( 'wgScript' ) + '?' + $.param({title: mw.util.wikiUrlencode(page), action: 'raw', ctype: mime});
return url;
};
/***** subPagesLink ********
* Adds a link to subpages of current page
*
* Maintainers: [[:he:משתמש:ערן]], [[User:Dschwen]]
****/
var subPagesLink = {
//
// Translations of the menu item
//
i18n : {
'en': 'Subpages', // default
'ko': '하위 문서 목록'
},
install: function() {
if ( document.getElementById("t-whatlinkshere")
&& mw.config.get( 'wgNamespaceNumber' ) != -2 // Media: (upcoming)
&& mw.config.get( 'wgNamespaceNumber' ) != -1 // Special:
&& mw.config.get( 'wgNamespaceNumber' ) != 6 // Image:
&& mw.config.get( 'wgNamespaceNumber' ) != 14 // Category:
) {
var subpagesText = subPagesLink.i18n[mw.config.get( 'wgUserLanguage' )] || subPagesLink.i18n['en'];
var subpagesLink = mw.config.get( 'wgArticlePath' ).split('$1').join('') + 'Special:Prefixindex/' + mw.config.get( 'wgPageName' ) +'/';
mw.util.addPortletLink( 'p-tb', subpagesLink, subpagesText, 't-subpages' );
}
}
};
if (mw.config.get( 'wgDBname' ) !='commonswiki') {
$(document).ready(subPagesLink.install);
}
if (mw.config.get('wgWikibaseItemId')) {
mw.util.addPortletLink('p-tb', 'https://tools.wmflabs.org/reasonator/?lang=ko&q=' + mw.config.get('wgWikibaseItemId'), 'Reasonator','t-reasonator');
mw.util.addPortletLink('p-tb', 'https://commons.wikimedia.org/wiki/Special:Search/haswbstatement:P180=' + mw.config.get('wgWikibaseItemId'), '묘사된 미디어 파일', 't-commonsdepicted');
mw.util.addPortletLink('p-tb', 'https://commons.wikimedia.org/wiki/Special:Search/haswbstatement:P8058=' + mw.config.get('wgWikibaseItemId'), '공용 상징 이미지', 't-commonssymbol');
}
/* Live Clock */
mw.loader.load(rawScriptLink('MediaWiki:Gadget-LocalLiveClock.js', 'www.mediawiki'));
/* adds a 'logs for this page' link to the toolbox bar
** if the page is a special page, then no link is displayed
** from User:Thebainer/monobook.js
*/
$(document).ready(function () {
if ( mw.config.get( 'wgCanonicalNamespace' ) == "Special" )
return; // don't display link for special pages
var pageLogUrl = mw.config.get( 'wgServer' ) + mw.config.get( 'wgScript' ) + '?title=Special:Log&page=' + mw.util.wikiUrlencode(mw.config.get( 'wgPageName' ));
mw.util.addPortletLink("p-tb", pageLogUrl, "문서 기록", "pt-logs");
});
/* Force external url open in new tab */
mw.loader.load(rawScriptLink('MediaWiki:Gadget-exlinks.js', 'en.wikipedia'));
/* Contribution Range */
if (mw.config.get( 'wgCanonicalSpecialPageName' ) == 'Contributions' ) {
mw.loader.load(rawScriptLink('MediaWiki:Gadget-contribsrange.js', 'commons.wikimedia'));
}
/*
* moveEditsection
* Dieses Script verschiebt die [Bearbeiten]-Buttons vom rechten Fensterrand
* direkt rechts neben die jeweiligen Überschriften.
* This script moves the [edit]-buttons from the right border of the window
* directly right next to the corresponding headings.
*
* dbenzhuser (de:Benutzer:Dbenzhuser)
*/
if ( mw.config.get( 'wgDBname' ) != 'commonswiki' ) {
$(document).ready(function() {
var spans = document.getElementsByTagName("span");
for (var i=0; i<spans.length; i++) {
var span = spans[i];
if (span.className != "editsection") continue;
span.style.fontSize = "x-small";
span.style.fontWeight = "normal";
span.style.styleFloat = "none"; // IE
span.style.cssFloat = "none";
span.style.marginLeft = "0px";
span.parentNode.appendChild(document.createTextNode(" "));
span.parentNode.appendChild(span);
}
});
}
if ( mw.config.get( 'wgAction' ) == 'edit' || mw.config.get( 'wgAction' ) == 'submit' ) {
/* Regex replace */
mw.loader.load(rawScriptLink('User:Kwj2772/temp.js', 'commons.wikimedia') + '&oldid=160246646'); //regexp replace. from [[en:User:Ilmari Karonen/replace.js]]. Fixed deprecated functions.
}
/* Short permalink */
$(document).ready(function(){ //remove title from permalink
var pLink = document.getElementById('t-permalink');
if (pLink) pLink.firstChild.href = pLink.firstChild.href.replace(/title=[^&]*&/,'');
});
/* Go to top icon */
if (mw.config.get( 'wgDBname' ) !== 'commonswiki') {
mw.loader.load(rawScriptLink('MediaWiki:Gadget-scrollUpButton.js','commons.wikimedia'));
}
// Turns the "+comment" tab into "+"
// [[:en:MediaWiki:Gadget-addsection-plus.js]]
$(document).ready(function() {
$('li#ca-addsection a').text('+');
});
// [[d:User:Yair rand/WikidataInfo.js]]
mw.loader.load(rawScriptLink('User:Yair rand/WikidataInfo.js', 'www.wikidata'));
mw.loader.load(rawScriptLink('User:Yair_rand/checksitelinks.js', 'www.wikidata')); // [[d:User:Yair rand/checksitelinks.js]]
// Wiki-Labels [[File:User:EpochFail/WikiLabels.js]] (workaround for [[phab:T35355]])
mw.loader.load('//meta.wikimedia.org/w/index.php?title=MediaWiki:Gadget-WikiLabels-loader.js&action=raw&ctype=text/javascript');
//Linkscount.js
mw.loader.load(rawScriptLink('MediaWiki:Linkscount.js','www.wikidata'));
//direct-commons-filelinks
//mw.loader.load(rawScriptLink('MediaWiki:Gadget-direct-commons.js','ko.wikipedia'));
//</nowiki>
}); //End of dependency declaration