Benutzer:FF-11/common.js

aus Wikipedia, der freien Enzyklopädie
Zur Navigation springen Zur Suche springen

Hinweis: Leere nach dem Veröffentlichen den Browser-Cache, um die Änderungen sehen zu können.

  • Firefox/Safari: Umschalttaste drücken und gleichzeitig Aktualisieren anklicken oder entweder Strg+F5 oder Strg+R (⌘+R auf dem Mac) drücken
  • Google Chrome: Umschalttaste+Strg+R (⌘+Umschalttaste+R auf dem Mac) drücken
  • Edge: Strg+F5 drücken oder Strg drücken und gleichzeitig Aktualisieren anklicken
//clickDivertimento (Zum automatischen Öffnen von Seiten in neuen Tabs)
mw.loader.load("https://en.wikipedia.org/w/index.php?title=User:PerfektesChaos/js/clickDivertimento/r.js&action=raw&bcache=1&maxage=604800&ctype=text/javascript",
               "text/javascript");

//autoBackup
mw.loader.load("//en.wikipedia.org/w/index.php?title=User:PerfektesChaos/js/autoBackup/r.js&action=raw&ctype=text/javascript&maxage=604800&*",
               "text/javascript");

// DÜP-Tab (zur Verwendungsübersicht: bitte nicht entfernen→ [[Benutzer:Ireas/düp-setzen-monobook.js]] ←danke)
 mw.loader.load("//de.wikipedia.org/w/index.php?title=Benutzer:Ireas/d%C3%BCp-setzen-monobook.js&action=raw&ctype=text/javascript");    

/**
* Insert WikiEditor (sMirC) emoticons buttons
* @created 2014-08-16
* @source [[mw:Extension:WikiEditor/Toolbar customization]], [[c:SMirC]]
* @version 0.2.3 (11:13, 3 November 2017 (UTC))
* @author [[User:Perhelion]], 2014
* @license released in the public domain
* @ToDo:
* Classic toolbar support?
* Flow support?
* Config UI with autoamtic save
* meh , glass
* @required modules: mw.user, wikiEditor
**/
/*global jQuery, mediaWiki*/
/*jshint eqeqeq:true, forin:false, laxbreak:true,
trailing:true, undef:true, unused:true, white:false, smarttabs:true */
(function ($, mw) {
"use strict";

// $( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', { 'section': 'emoticons' }); // Remove
// window.customSmilies = [':-)',';-)',':-D',':-S','X-)','mm','lol','doh','=>'];

mw.loader.load('//de.wikipedia.org/w/index.php?title=Benutzer:FNDE/secWatch/view.js&action=raw&ctype=text/javascript');

// ---------------------------------------------------------------------------------------------

// Pool of available smilies
var smilyPool = {
":-)" : ["6/69", "smile"],
";-)" : ["e/ec", "wink"],
":-D" : ["e/e3", "beam"],
":-S" : ["8/8c", "dunno"],
"X-)" : ["6/66", "grin"],
"=>" : ["9/90", "happy"],
"lol" : ["5/5a", "laugh"],
"doh" : ["a/a2", "doh"],
"mm" : ["0/00", "mmm"],
"-.-" : ["6/6d", "bored"],
"\"-:" : ["0/0b", "whistle"],
"^_^" : ["9/91", "chuckle"],
"B)" : ["0/08", "cool"],
"ʕ•ᴥ•ʔ" : ["e/e3", "bearhug"],
"0:)" : ["3/3f", "angel"],
"3:D" : ["4/40", "devil"],
"*,,*" : ["c/c2", "vamp"],
"(.V.)" : ["b/bf", "alien"],
"☠" : ["b/b3", "dead"],
"@_,@" : ["b/b3", "stoned"],
"(゚*゚)" : ["5/56", "puke"],
"(°₀°)" : ["5/54", "jealous"],
">:[]" : ["0/0e", "angry"],
"♨" : ["0/0d", "hot"],
":-{}" : ["9/93", "freezing"],
"x_x" : ["3/3d", "spent"],
"hi" : ["5/5a", "hi"],
"stop" : ["4/47", "beware"],
"-<-@" : ["6/62", "congrats"],
"*<:o)" : ["f/f5", "party"],
"yes" : ["1/1f", "thumbsup"],
"no" : ["c/c8", "thumbsdown"],
"O_O" : ["0/0c", "shock"],
"°o°" : ["5/5f", "goggle"],
"8-O" : ["e/e8", "scream"],
// 35
":-(" : ["3/39", "sad"],
":-|" : ["d/d5", "medium"],
"8-(" : ["a/aa", "puppyeyes"],
"8)" : ["6/66", "rolleyes"],
"(~_~)" : ["e/e3", "unnerved"],
";,(" : ["a/ae", "cry"],
"<3" : ["b/b6", "love"],
":-*" : ["8/80", "kiss"],
"???" : ["3/35", "what"],
"zZz" : ["4/4b", "zzz"],
";-/" : ["c/c2", "sceptic"],
":-x" : ["5/58", "silent"],
":-P" : ["c/c3", "tongue"],
"%Þ" : ["1/1e", "crazy"],
"<3Þ" : ["6/64", "horny"],
"$Þ" : ["e/ec", "greedy"],
"●^_^●" : ["0/00", "shy"],
"●°.°●" : ["7/7f", "embarassed"],
"8-)" : ["d/d2", "nerd"],
"8-°" : ["d/d8", "wasntI"],
"8-[" : ["8/85", "worry"],
"o_O" : ["8/8b", "wtf"],
"(-°-)" : ["1/17", "martial"],
"xmas" : ["a/ab", "xmas"],
"C(_)" : ["3/33", "coffeebreak"],
"m(" : ["9/95", "facepalm"],
"daisy" : ["2/23", "daisy"],
"☀" : ["5/5d", "sunny"],
"☁" : ["3/37", "cloudy"],
"☂" : ["d/d2", "rainy"],
"☈" : ["2/27", "thundery"],
"☃" : ["9/9e", "snowy"],
"≈" : ["5/55", "hazy"],
"\\S/" : ["d/d3", "super"],
"wine" : ["0/07", "wine"],
"palm" : ["9/90", "palm"],
"(_*_)" : ["1/10", "ass"]
},
specialSmilyPool = [ // none sMirc
["e/e0", "Thumbs_up_icon", "=b"] //👍
],
smilies = [];

// Add smilies to the toolbar in the specified order and count
var order = window.customSmilies;

if ( $.isArray(order) ) {
	for (var i = 0, l = order.length; i < l; i++) {
		var smilie = smilyPool[order[i]];
		if (!smilie)
			throw new Error('Unknown smilie: ' + order[i]);
		else {  // Dict to array
			smilie.push(order[i]);
			smilies.push(smilie);
		}
	}
} else { // Dict to array
	for ( var k in smilyPool ) {
		smilyPool[k].push( k );
		smilies.push( smilyPool[k] );
	}
}

var ns = mw.config.get('wgNamespaceNumber'),
	cUrl = 'https://upload.wikimedia.org/wikipedia/commons/thumb/', //Commons
	/** sMirC emoticons only **/
	s = 'SMirC-',
	sMList = {},
	sRlen = Math.max(Math.ceil(smilies.length / 2), 35), // Max 35 preferred
	sRo = ['¹','²','',''], // ,'³','⁴' Max 2 rows supported?
	sRi = 0, // smilie row index
	fns = '[[' + mw.config.get('wgFormattedNamespaces')[6] + ':';

if (smilies.length > sRlen) {
	addSmilie(sRo[sRi], smilies.splice(0, sRlen), s);
	sRi++;
}
if (smilies.length) {
	addSmilie(sRo[sRi], smilies, s);
	sRi++;
}
if (smilies.length) // add special smilie
	addSmilie(sRo[sRi], specialSmilyPool, '');

function addSmilie(gp, sL, s) { // Make buttons
	var sb = {}; // Smilie buttons
	for (var i = 0, l = sL.length; i < l; i++) {
	// for (var i in sL) {
		var id = s + sL[i][1];
		var k = sL[i][2];
		var src = cUrl + sL[i][0] + '/' + id + '.svg/22px-' + id + '.svg.png';
		sb[k] = {
			label : k,
			type : 'button',
			icon : src,
			action : {
				type : 'encapsulate',
				options : { pre : fns + id + '.svg|x20px|' + k + ']]' }
			}
		};
	}
	sMList[gp] = {
		label : gp,
		tools : sb
	};
}

function wikiEditorEmoticons () { // make to toolbar
	if (mw.libs.wikiEditorEmoticons instanceof Object) return; // load only once
	$('#wpTextbox1').wikiEditor('addToToolbar', {
		'sections' : {
			'emoticons' : {
				'type' : 'toolbar',
				//'deferLoad': true,
				'groups' : sMList
			}
		}
	});
	$('#wikiEditor-ui-toolbar .tabs .tab-emoticons a').append($('<img>') // made section button (hack)
		.attr({
			src : cUrl + '5/59/Cute_Ball_-_Games.png/22px-Cute_Ball_-_Games.png',
			width : 22,
			height : 22,
			title : 'Emoticons',
			rel : s,
			role : 'button',
			'class' : 'tool tool-button'
		}));
	if ($(document).width() < 1100) // made bar wider (hack)
		mw.loader.using('mediawiki.util' , function () {
			mw.util.addCSS(".section-emoticons .label {display:none}" +
				".section-emoticons {width:900px;margin-left:-5px}" +
				"#content {margin-left:140px; margin-right:-54px; padding: 9px}" +
				"#mw-panel {margin-left:-22px}");
		});
	mw.libs.wikiEditorEmoticons = wikiEditorEmoticons;
}

// Check if view is in edit mode and that the required modules are available. Then, customize the toolbar… 
$(function () {
	if (!['edit', 'submit'].indexOf(mw.config.get('wgAction')) &&
		(ns % 2 === 1 || $.inArray(ns, [2, 4]) !== -1) &&
		mw.config.get('wgPageContentModel') === "wikitext")
			mw.loader.using('user.options' , function () {
				if ( mw.user.options.get('usebetatoolbar') ) {
					mw.loader.using('ext.wikiEditor', wikiEditorEmoticons);
				}
			});
});
})(jQuery, mediaWiki);