Benutzer:Perhelion/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
  • Internet Explorer/Edge: Strg+F5 drücken oder Strg drücken und gleichzeitig Aktualisieren anklicken
  • Opera: Strg+F5
// <nowiki>
/* global $, mw */
var project = mw.config.get('wgDBname');
var dbug = mw.config.get("debug"); // get setting with [[mw:ResourceLoader/Features#Debug_mode]]
var fns = mw.config.get('wgFormattedNamespaces')[6];
var libs = mw.libs;
var usDebug = 1; // debug for signing & sectionSummary

libs.fliegelflagel = {};
mw.loader.load('//de.wikipedia.org/w/index.php?title=Benutzer:Schnark/js/fliegelflagel.js/global.js&action=raw&ctype=text/javascript&maxage=86400&smaxage=60&bcache=1');
libs.fliegelflagel.fliegelflagel = {
	before : function () {
		libs.fliegelflagel.register('emoticons', {
			scripts : '//de.wikipedia.beta.wmflabs.org/w/index.php?title=Benutzer:Perhelion/WikiEditorEmoticons.js&action=raw&ctype=text/javascript&debug=' + dbug,
			//only: function (action) {return action === 'edit';},
			title : 'Emoticons',
			description : 'sMirC-Emoticons-Bar for the WikiEditor',
			category : 'edit'
		});
	}
};

function customizeToolbar() { // Test hook 2
	$('#wpTextbox1').wikiEditor('addToToolbar', {
		'section' : 'main',
		'group' : 'insert',
		'tools' : {
			'signature' : {
				'label' : 'Signatur und Zeitstempel ohne Bindestriche',
				'type' : 'button',
				'icon' : '//upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Gnome-face-smile.svg/22px-Gnome-face-smile.svg.png',
				'action' : {
					'type' : 'encapsulate',
					'options' : {
						'pre' : 'hook'
					}
				}
			}
		}
	});
}

function chgButtons() {
	$('.tool-button[rel=big]') // Workaround for [[bugzilla:38487]]
	.off('click')
	.on('click', function (e) {
		e.preventDefault();
		$('#wpTextbox1').textSelection(
			'encapsulateSelection', {
			'pre' : '<span style="font-size: larger;">',
			'peri' : mw.msg('wikieditor-toolbar-tool-big-example'),
			'post' : '</span>'
		});
	});
}

if ([ 'edit', 'submit' ].indexOf( mw.config.get( 'wgAction' )) !== -1) {
	mw.loader.using('user.options', function () {
		if (mw.user.options.get('usebetatoolbar'))
			mw.loader.using(['jquery.textSelection', 'ext.wikiEditor'], function () {
				$(chgButtons);
			});
	});
	$('.tool-button[rel=gallery]')
	.off('click')
	.on('click', function (e) {
		e.preventDefault();
		$('#wpTextbox1').textSelection(
			'encapsulateSelection', {
			'pre' : '<gallery widths="100" heights="100" showfilename>\n',
			'peri' : mw.msg('wikieditor-toolbar-tool-gallery-example', fns),
			'post' : "\n</gallery>",
			'ownline' : true
		});
	});

	$('#wpTextbox1').on('wikiEditor-toolbar-doneInitialSections', function () {
		// Test hook
		$(this).wikiEditor('addToToolbar', {
			'section' : 'main',
			'group' : 'insert',
			'tools' : {
				'signature' : {
					'label' : 'Signatur und Zeitstempel ohne Bindestriche',
					'type' : 'button',
					'icon' : '//upload.wikimedia.org/wikipedia/commons/7/79/Insert-signature.png',
					'action' : {
						'type' : 'encapsulate',
						'options' : {
							'pre' : '\~\~\~\~'
						}
					}
				}
			}
		});
	});

	// Automatische Unterschrift [[:de:Benutzer:Perhelion/signing]] (loaded as Gadget)
	$(document).bind('loadWikiScript', function (e, name, threadSign) {
		if (name === 'Perhelion/signing.js')
			threadSign.config = {
				sigText : "<kbd style=\"white-space:nowrap;color:#808;\">~~~\u2003<small>~~~~~</small></kbd>",
				dSum : '@'
			};
	});
} // End inEdit

// importScript('Benutzer:PDD/monobook.js'); //benötigt Ausblendschaltfläche
importScript('User:Perhelion/titleTruncation.js');
importScript('User:Perhelion/viewerInfo.js');

//</nowiki>