User:Patrick87/common.js

From Inkscape Wiki
Jump to navigation Jump to search

Note: After saving, 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: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
// ########## interwiki content ##########

// #######################################
// ##########    userscripts    ##########
// #######################################


// [[mw:User:Remember the dot/Syntax highlighter]]
mw.loader.load('//www.mediawiki.org/w/index.php?action=raw&ctype=text/javascript&title=MediaWiki:Gadget-DotsSyntaxHighlighter.js&action=raw&ctype=application/javascript');


// [[de:Benutzer:Perhelion/signing]]
mw.loader.load('//de.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=Benutzer:Perhelion/signing.js');
$(document).bind('loadWikiScript', function (e, name, threadSign) {
	if (name === 'Benutzer:Perhelion/signing.js')
		threadSign.config = {
			sigText: ' --~~\~~'
	};
});


// [[en:User:Gary/comments in local time.js]]
mw.loader.load('//en.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=User:Gary/comments in local time.js');
var LocalComments = {
	dateDifference: false,
	dateFormat: 'ymd',
	twentyFourHours: true,
	dayOfWeek: false
};


// [[de:Benutzer:Schnark/js/linkUnlinked.js]]
mw.loader.load('//de.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=Benutzer:Schnark/js/linkUnlinked.js');


// [[en:User:Haza-w/Drop-down menus]]
//importStylesheetURI('//en.wikipedia.org/w/index.php?action=raw&ctype=text/css&title=MediaWiki:Gadget-dropdown-menus.css');
//mw.loader.load('//en.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=MediaWiki:Gadget-dropdown-menus.js');
mw.loader.load('//en.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=MediaWiki:Gadget-dropdown-menus-vector.js');


// [[de:Benutzer:Schnark/js/section-links.js]]
mw.loader.load('//de.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=Benutzer:Schnark/js/section-links.js');
mw.user.options.set('userjs-schnark-section-links-order', 'plus/edit/ve/top/link/done');


// [[de:Benutzer:Schnark/js/notizen.js]]
mw.loader.load('//de.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=Benutzer:Schnark/js/notizen.js');
// add link to [[Special:Wikinotes]] on Watchlist
if (mw.config.get('wgCanonicalSpecialPageName') == 'Watchlist') {
	$('<a>', {
		text: '⚑ Wikinotes',
		href: '/wiki/Special:Wikinotes',
		style: 'font-size:medium;font-family:sans-serif;font-weight:bold;float:right'
	}) .appendTo('#contentSub');
}


// [[de:Benutzer:TMg/filterContributions.js]]
// mw.loader.load('//de.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=Benutzer:TMg/filterContributions.js');

// [[de:Benutzer:Revolus/beitraege_filtern.js]]
// mw.loader.load('//de.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=Benutzer:Revolus/beitraege filtern.js');

// [[de:Benutzer:Fomafix/hideduplicatecontribs.js]]
// (vormals [[de:Benutzer:P.Copp/scripts/hideduplicatecontribs.js]])
mw.loader.load('//de.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=Benutzer:Fomafix/hideduplicatecontribs.js');


// [[de:Benutzer:TMg/moveInterwikisToTop.js]]
var moveInterwikisToTopArray = ["de", "en"];
mw.loader.load("//de.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=Benutzer:TMg/moveInterwikisToTop.js");





// #######################################
// ##########    UI changes     ##########
// #######################################

// remove accesskey from "Printable version" sidebar link (conflicts with accesskey "p" for preview button on Special:Upload)
$('#t-print > a').removeAttr('accesskey');


// WikiEditor [[mw:Extension:WikiEditor]]
var customizeToolbar = function() {
	// strikethrough button
	$('#wpTextbox1').wikiEditor('addToToolbar', {
		section: 'main',
		group: 'format',
		tools: {
			"strikethrough": {
				label: 'Strike',
				type: 'button',
				icon: '//upload.wikimedia.org/wikipedia/commons/f/f9/Toolbaricon_regular_S_stroke.png',
				action: {
					type: 'encapsulate',
					options: {
						pre: "<s>",
						post: "</s>"
					}
				}
			}
		}
	});
	// math button
	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
		section: 'advanced',
		group: 'format',
		tools: {
			"math": {
				label: 'Math',
				type: 'button',
				icon: '//upload.wikimedia.org/wikipedia/commons/3/38/Button_Math.png',
				action: {
					type: 'encapsulate',
					options: {
						pre: "<math>",
						post: "</math>"
					}
				}
			}
		}
	} );
	// code button
	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
		section: 'advanced',
		group: 'format',
		tools: {
			"code": {
				label: 'Code',
				type: 'button',
				icon: '//upload.wikimedia.org/wikipedia/commons/6/62/Toolbar_code.png',
				action: {
					type: 'encapsulate',
					options: {
						pre: "<code>",
						post: "</code>"
					}
				}
			}
		}
	} );
	// reorder buttons (move nowiki button to end)
	var buttongroup = document.getElementsByClassName("group-format")[1];
	var buttons = buttongroup.childNodes;
	for (var i in buttons) {
		if(buttons[i].nodeType == 1 && buttons[i].getAttribute('rel') == 'nowiki') {
			buttongroup.appendChild(buttons[i]);
			buttongroup.removeChild(buttons[i]);
			break;
		}
	}
};
/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar . . . */
if ( $.inArray( mw.config.get( 'wgAction' ), ['edit', 'submit'] ) !== -1 ) {
	mw.loader.using( 'user.options', function () {
	if ( mw.user.options.get('usebetatoolbar') ) {
		mw.loader.using( 'ext.wikiEditor.toolbar', function () {
			$( customizeToolbar );
		} );
		}
	} );
}
/* Add the customizations to LiquidThreads' edit toolbar, if available */
mw.hook( 'ext.lqt.textareaCreated' ).add( customizeToolbar );