Jump to content

User:Rodejong/global.js

From Meta, a Wikimedia project coordination wiki

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)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
/* Any JavaScript added to this page will be loaded on all wikis where you have an account (see [[mw:Help:Extension:GlobalCssJs|documentation]]). */
window.myConfig = true;

/*******************
** Scripts on all wikis
*******************/
/**
 * Forces left-to-right layout and editing on RTL wikis.
 * @see https://meta.wikimedia.org/wiki/Force_ltr
 * @update-token [[File:Pathoschild/forceltr.js]]
 */
mw.loader.load('//tools-static.wmflabs.org/meta/scripts/pathoschild.forceltr.js');

/*
 * USER SCRIPTS
 * Use:  
let title = "User:YourName/YourScript.js";
mw.loader.load( "https://en.wikipedia.org/w/index.php?title="+title+"&action=raw&ctype=text/javascript" );
 * or use: 
mw.loader.load('//en.wikipedia.org/w/index.php?title=script.js&action=raw&ctype=text/javascript');
 * or use:
mw.loader.load( '/w/index.php?title=User:Example/script.js&action=raw&ctype=text/javascript' ); // Backlink: [[User:Example/script.js]]
*/

	// [[MediaWiki:Gadget-CodeLinks.js]]
mw.loader.load("//en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-CodeLinks.js&action=raw&ctype=text/javascript");


// Adds a link to the permanent link for the current page to the toolbox
$(document).ready(function() {
    var revisionId = mw.config.get('wgCurRevisionId') || mw.config.get('wgRevisionId');
    var pageTitle = mw.config.get('wgPageName');

    var permanentLinkUrl = mw.util.getUrl(pageTitle, {oldid: revisionId});
    mw.util.addPortletLink('p-tb', permanentLinkUrl, '๐Ÿ“Œโ‡’ Permanent Link', 't-permalink-url', 'Permalink');
});

	// Adds a link to prefix index for the current page to the toolbox
mw.util.addPortletLink('p-tb', '/wiki/Special:Prefixindex/' + mw.config.get('wgPageName'), '๐Ÿ“šโ€‹โ‡’Prefixindex', 'tb-prefixindex', 'Prefixindex', null, document.getElementById('t-whatlinkshere') || document.getElementById('t-upload') ); 
	// Adds a link to Special:LinkSearch for the current page to the toolbox
mw.util.addPortletLink('p-tb', '/wiki/Special:LinkSearch/' + mw.config.get('wgPageName'), '๐ŸŒโ‡’Link Search', 'tb-LinkSearch', 'LinkSearch', null, document.getElementById('t-whatlinkshere') || document.getElementById('t-upload') ); 
	// My Tools
mw.util.addPortletLink('p-tb', 'https://apps.jw.org/ui/E/meeting-search.html', '๐Ÿขโ‡’ Meeting-search', 'tb-meetingsearch', 'MeetingSearch', null, document.getElementById('t-whatlinkshere') || document.getElementById('t-upload') );
	// Excel 2 Wiki
mw.util.addPortletLink('p-tb', 'https://excel2wiki.toolforge.org', '๐Ÿ“Šโ‡’ Excel2Wiki', 'tb-excel2wiki', 'Excel2wiki', null, document.getElementById('t-whatlinkshere') || document.getElementById('t-upload') );
	// Table Converter
mw.util.addPortletLink('p-tb', 'https://tableconvert.com/html-to-mediawiki', '๐Ÿ“Šโ‡’ Table Convert', 'tb-tableconvert', 'Tableconvert', null, document.getElementById('t-whatlinkshere') || document.getElementById('t-upload') );
	// Open Street Map
mw.util.addPortletLink('p-tb', 'https://www.openstreetmap.org/', '๐ŸŒโ‡’ Openstreetmap', 'tb-openstreetmap', 'Openstreetmap', null, document.getElementById('t-whatlinkshere') || document.getElementById('t-upload') ); 
	// Chat
mw.util.addPortletLink('p-tb', 'https://kiwiirc.com/nextclient/irc.libera.chat/', '๐Ÿ‘จ๐Ÿ’ปโ‡’ CHAT', 'tb-chat', 'Chat', null, document.getElementById('t-whatlinkshere') || document.getElementById('t-upload') );
	// Zoeken op Wikidata naar de exacte titel
mw.util.addPortletLink('p-tb', 'https:en.wikipedia.org/wiki/wikidata:Special:Search', '๐Ÿ“šโ‡’ Search-WIKIDATA', 'tb-Searchwikidata', 'Searchwikidata', null, document.getElementById('t-whatlinkshere') || document.getElementById('t-upload') );
	// Links to Wikipedia languages
mw.util.addPortletLink('p-tb', 'https://da.wikipedia.org/wiki/' + mw.config.get( 'wgCanonicalNamespace' ) + ':' + mw.config.get( 'wgTitle' ), "da:โ‡’", "da-wiki", "da-wiki");
mw.util.addPortletLink('p-tb', 'https://de.wikipedia.org/wiki/' + mw.config.get( 'wgCanonicalNamespace' ) + ':' + mw.config.get( 'wgTitle' ), "de:โ‡’", "de-wiki", "de-wiki");
mw.util.addPortletLink('p-tb', 'https://en.wikipedia.org/wiki/' + mw.config.get( 'wgCanonicalNamespace' ) + ':' + mw.config.get( 'wgTitle' ), "en:โ‡’", "en-wiki", "en-wiki");
mw.util.addPortletLink('p-tb', 'https://nl.wikipedia.org/wiki/' + mw.config.get( 'wgCanonicalNamespace' ) + ':' + mw.config.get( 'wgTitle' ), "nl:โ‡’", "nl-wiki", "nl-wiki");
mw.util.addPortletLink('p-tb', 'https://no.wikipedia.org/wiki/' + mw.config.get( 'wgCanonicalNamespace' ) + ':' + mw.config.get( 'wgTitle' ), "no:โ‡’", "no-wiki", "no-wiki");
mw.util.addPortletLink('p-tb', 'https://simple.wikipedia.org/wiki/' + mw.config.get( 'wgCanonicalNamespace' ) + ':' + mw.config.get( 'wgTitle' ), "simple:โ‡’", "simple-wiki", "simple-wiki");
mw.util.addPortletLink('p-tb', 'https://sv.wikipedia.org/wiki/' + mw.config.get( 'wgCanonicalNamespace' ) + ':' + mw.config.get( 'wgTitle' ), "sv:โ‡’", "sv-wiki", "sv-wiki");
	// Links to other projects
mw.util.addPortletLink('p-tb', 'https://commons.wikimedia.org/wiki/' + mw.config.get( 'wgCanonicalNamespace' ) + ':' + mw.config.get( 'wgTitle' ), "commons:โ‡’", "commons-wiki", "commons-wiki");
mw.util.addPortletLink('p-tb', 'https://www.wikidata.org/wiki/' + mw.config.get( 'wgCanonicalNamespace' ) + ':' + mw.config.get( 'wgTitle' ), "data:โ‡’", "data-wiki", "data-wiki");
mw.util.addPortletLink('p-tb', 'https://meta.wikimedia.org/wiki/' + mw.config.get( 'wgCanonicalNamespace' ) + ':' + mw.config.get( 'wgTitle' ), "meta:โ‡’", "meta-wiki", "meta-wiki");
mw.util.addPortletLink('p-tb', 'https://nl.wikisage.org/wiki/' + mw.config.get( 'wgCanonicalNamespace' ) + ':' + mw.config.get( 'wgTitle' ), "sage:โ‡’", "sage-wiki", "sage-wiki");



	// Add a link to the edit page for your Notes in your personal links
	// Note: We assume that short/pretty URLs are in use with ?action, ideally you would check for that.
mw.util.addPortletLink ( 'p-tb', mw.util.getUrl( 'Special:MyPage/Notes' ) + '?action=edit', '๐Ÿ“โ‡’Notes', 'pt-mynotes', 'Edit your personal notes');
	// [[File:Krinkle_RTRC.js]] -> meta.wikimedia.org/wiki/User:Krinkle/Tools
mw.loader.getState('ext.gadget.rtrc') ? mw.loader.load('ext.gadget.rtrc') : mw.loader.load('https://www.mediawiki.org/w/load.php?debug=false&modules=ext.gadget.rtrc&lang=' + mw.config.get('wgUserLanguage', 'en'));
	// Prefix Mediawiki
mw.util.addPortletLink('p-krinkle', mw.util.getUrl('Special:Prefixindex/MediaWiki:'), 'Special:PrefixIndex/MediaWiki:');
	// [[File:Krinkle_CVNSimpleOverlay_wiki.js]] CVN SIMPLE OVERLAY
mw.loader.load('//meta.wikimedia.org/w/index.php?title=User:Krinkle/Scripts/CVNSimpleOverlay_wiki.js&action=raw&ctype=text/javascript');
	// [[File:Krinkle_VectorSearchNav.js]] -> meta.wikimedia.org/wiki/User:Krinkle/Tools
mw.loader.load('https://meta.wikimedia.org/w/index.php?title=User:Krinkle/Scripts/VectorSearchNav.js&action=raw&ctype=text/javascript');
	// UTC Clock
mw.loader.load('https://www.mediawiki.org/w/index.php?title=MediaWiki:Gadget-UTCLiveClock.js&action=raw&ctype=text/javascript' );
	// Gives some useful links on user, user talk and user contribution pages
	// by [[m:user:Hoo man]] <http://meta.wikimedia.org/wiki/User:Hoo_man/Scripts/Useful_links>
mw.loader.load('//meta.wikimedia.org/w/index.php?title=User:Hoo_man/useful_links.js&action=raw&ctype=text/javascript');
	// Shows the number of active (one log entry in the last 7 days, or as configured) sysops, uses data from the toolserver
	// by [[m:user:Hoo man]] <http://meta.wikimedia.org/wiki/User:Hoo_man/Scripts/Active_sysops>
mw.loader.load('//meta.wikimedia.org/w/index.php?title=User:Hoo_man/active_sysops.js&action=raw&ctype=text/javascript');
if(typeof(activeSysopsConfig) == 'undefined') activeSysopsConfig = {};
activeSysopsConfig.markWikisGS = true;
	// Useful script to tell if a user is currently blocked
mw.loader.load('//ru.wikipedia.org/w/index.php?title=MediaWiki:Gadget-markblocked.js&action=raw&ctype=text/javascript');
	// Provides several useful functions for rollback (custom edit summary, mark as bot edits and mass revert)
	// by [[m:user:Hoo man]] <http://meta.wikimedia.org/wiki/User:Hoo_man/Scripts/Smart_rollback>
mw.loader.load('//meta.wikimedia.org/w/index.php?title=User:Hoo_man/smart_rollback.js&action=raw&ctype=text/javascript');
	//Extra buttons
//mw.loader.load('//en.wikipedia.org/w/index.php?title=User:MarkS/extraeditbuttons.js&action=raw&ctype=text/javascript');

	// WIKIDATA
//mw.loader.load('http://www.wikidata.org/w/index.php?title=User:Yair rand/WikidataInfo.js&action=raw&ctype=text/javascript'); // [[d:User:Yair rand/WikidataInfo.js]]
	// [[d:User:Karima Rafes/DisplayCodeWikidata.js]]
//mw.loader.load("//www.wikidata.org/w/index.php?title=User:Karima Rafes/DisplayCodeWikidata.js&action=raw&ctype=text/javascript");
	// BrandonXLF
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:BrandonXLF/ToTop.js&action=raw&ctype=text/javascript');
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:BrandonXLF/ToTopButton.js&action=raw&ctype=text/javascript');
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:BrandonXLF/ToBottom.js&action=raw&ctype=text/javascript');


	// Zoeken op Wikidata naar de exacte titel
mw.util.addPortletLink('p-tb', 'https:en.wikipedia.org/wiki/wikidata:Special:Search', 'Search-WIKIDATA', 'tb-searchwikidata', 'Searchwikidata', null, document.getElementById('t-whatlinkshere') || document.getElementById('t-upload') );
mw.util.addPortletLink('p-cactions', 'https://www.wikidata.org/wiki/Special:ItemByTitle?site=enwiki&page=' + mw.config.get( 'wgPageName' ) + "&submit=Search", "data:", "data:", "data:");

	// other
/*
if ( mw.config.get("wgDBname") !== "Jwiki" ) {
	// Whatever JavaScript you want to run on all wikis but your homewiki,  goes here
}
*/

/* Change language to English works -Switched on */
mw.loader.using( 'mediawiki.user', function() {
	if ( mw.user.options.get( 'language' ) !== 'en' ) {
		( new mw.Api() ).postWithToken( 'csrf', {
			action: 'options',
			change: 'language=en'
		} ).done( function() {
			mw.loader.using( [], function() {
				mw.notify( 'Language has been changed to English. Please refresh the page.' );
			} );
		} );
	} else {
		console.log( 'Language already set to English!' );
	}
} );

/* Change language to Danish works -Switched off
mw.loader.using( 'mediawiki.user', function() {
	if ( mw.user.options.get( 'language' ) !== 'da' ) {
		( new mw.Api() ).postWithToken( 'csrf', {
			action: 'options',
			change: 'language=da'
		} ).done( function() {
			mw.loader.using( [], function() {
				mw.notify( 'Language has been changed to Danish. Please refresh the page.' );
			} );
		} );
	} else {
		console.log( 'Language already set to Danish!' );
	}
} );
*/

/* Change language to Dutch -Switched off
mw.loader.using( 'mediawiki.user', function() {
	if ( mw.user.options.get( 'language' ) !== 'nl' ) {
		( new mw.Api() ).postWithToken( 'csrf', {
			action: 'options',
			change: 'language=nl'
		} ).done( function() {
			mw.loader.using( [], function() {
				mw.notify( 'Language has been changed to Dutch. Please refresh the page.' );
			} );
		} );
	} else {
		console.log( 'Language already set to Dutch!' );
	}
} );  
*/

/*
 * Extra buttons in toolbar
 * @stats [[File:Krinkle_InsertWikiEditorButton.js]]
*/
$.ajax({ dataType: 'script', cache: true,
	url: 'https://meta.wikimedia.org/w/index.php?title=User:Krinkle/Scripts/InsertWikiEditorButton.js&action=raw&ctype=text/javascript'
}).then(function () {

	// Happy face
	krInsertWikiEditorButton({
		id: "mw-customeditbutton-myspecialbutton",
		icon: "https://upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Gnome-face-smile.svg/22px-Gnome-face-smile.svg.png",
		label: 'Insert happy face',
		insertBefore: '[[File:Gnome-face-smile.svg|21px|',
		insertAfter: ']]',
		sampleText: 'Happy face'
	});

    // Invoegen PAGENAME
	krInsertWikiEditorButton({
    	id: 'mw-customeditbutton-anotherspecialbutton',
    	icon: 'https://upload.wikimedia.org/wikipedia/commons/1/13/Toolbaricon_bold_N.png/22px-Toolbaricon_bold_N.png',
    	label: 'PAGENAME',
    	insertBefore: '\{\{PAGENAME',
    	insertAfter: '\}\}',
    	sampleText: 'PAGENAME'
	});
	
// Invoegen LOCALHOUR PAGENAME
	krInsertWikiEditorButton({
    	id: 'mw-customeditbutton-anotherspecialbutton',
    	icon: 'https://upload.wikimedia.org/wikipedia/commons/3/3f/Button_attendre.png/22px-Button_attendre.png',
    	label: 'Goodday',
    	insertBefore: '\'\'\'\{\{\#switch:\{\{LOCALHOUR\}\}\|06\|07\|08\|09\|10\|11=Good morning\|12\|13\|14\|15\|16\|17=Good afternoon\|18\|19\|20\|21\|22\|23=Good evening\|00\|01\|02\|03\|04\|05\|Good night\}\} ',
    	insertAfter: '\{\{PAGENAME\}\}\'\'\'',
    	sampleText: 'Good day'
	});

// Plain links
	krInsertWikiEditorButton({
    	id: 'mw-customeditbutton-anotherspecialbutton',
    	icon: 'https://upload.wikimedia.org/wikipedia/commons/4/48/Toolbar_Insert_link.png/22px-Toolbar_Insert_link.png',
    	label: 'plainlinks',
    	insertBefore: '\<div class\=\"plainlinks\"\>',
    	insertAfter: '\<\/div\>',
    	sampleText: 'Plain Links'
	});
	
// Add new one below


});