Jump to content

User:Speravir/global.js

From Meta, a Wikimedia project coordination wiki
This is an archived version of this page, as edited by Speravir (talk | contribs) at 02:05, 30 November 2018. It may differ significantly from the current version.

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.
// <nowiki>
var isActive = true;

if (isActive) {
var ns = mw.config.get('wgNamespaceNumber'), // cf. [[Help:Namespaces]]
	action = mw.config.get('wgAction');

$.when(mw.loader.using(['mediawiki.util']), $.ready).done(function () {
/* Script collection Fliegelflagel, [[:de:Benutzer:Schnark/js/fliegelflagel]] */
(function (module) {
	if (mw.loader.getState(module)) {
		mw.loader.using(module).done(function () {
			((mw.libs.ve.targetLoader && mw.libs.ve.targetLoader.addPlugin) || mw.libs.ve.addPlugin)(function () {
				var ve = $.Deferred();
				mw.hook('userjs.schnark-fliegelflagel.ve').fire(ve);
				return ve.promise();
			});
		});
	}
})('ext.visualEditor.desktopArticleTarget.init');
mw.hook('userjs.schnark-fliegelflagel.userdefine').fire({
	version: 1.1,
	profile: undefined,
	config: {
		extratabs: function (extratabs) {
			extratabs.enable('visualeditor');
			extratabs.remove('blame');
		}
	},
	additional: {
	// PerfektesChaos
		fragmentAnchorsPC: { // [[:de:Benutzer:PerfektesChaos/js/fragmentAnchors]]
			title: "FragmentAnchors (PerfektesChaos)",
			scripts: "https://en.wikipedia.org/w/index.php?title=User:PerfektesChaos/js/fragmentAnchors/r.js&action=raw&bcache=1&maxage=604800&ctype=text/javascript",
			description: "Zeigt vorhandene Anker im HTML-Dokument an und macht darauf aufmerksam, falls solche mehrfach vergeben wurden oder sonstwie inkonsistent sind.",
			docpage: "https://de.wikipedia.org/wiki/Benutzer:PerfektesChaos/js/fragmentAnchors",
			defaultEnabled: 7,
			category: "history",
			status: "stable"
		},
		listPageOptionsPC: { // [[:de:Benutzer:PerfektesChaos/js/listPageOptions]]
			title: "ListPageOptions (PerfektesChaos)",
			scripts: "https://en.wikipedia.org/w/index.php?title=User:PerfektesChaos/js/listPageOptions/r.js&action=raw&bcache=1&maxage=604800&ctype=text/javascript",
			description: "Fügt in Beobachtungslisten und auf der Seite „Letzte Änderungen“ der Benutzeroberfläche besondere Möglichkeiten hinzu.",
			docpage: "https://de.wikipedia.org/wiki/Benutzer:PerfektesChaos/js/listPageOptions",
			defaultEnabled: 7,
			category: "history",
			status: "stable"
		},
		pageLinkHelperPC: { // [[:de:Benutzer:PerfektesChaos/js/pageLinkHelper]]
			title: "PageLinkHelper (PerfektesChaos)",
			scripts: "https://en.wikipedia.org/w/index.php?title=User:PerfektesChaos/js/pageLinkHelper/r.js&action=raw&bcache=1&maxage=604800&ctype=text/javascript",
			description: "Verschiedene kleine Helferlein für Links im Zusammenhang mit Wiki-Seiten: Difflink, Permalink, Purge, Weiterleitung in History.",
			docpage: "https://de.wikipedia.org/wiki/Benutzer:PerfektesChaos/js/pageLinkHelper",
			defaultEnabled: 7,
			status: "stable",
			before: function() {
						mw.libs.pageLinkHelper = { purge: "p-tb" };
					}
		},
		remindErrorMessagesPC: { // [[:de:Benutzer:PerfektesChaos/js/remindErrorMessages]]
			title: "RemindErrorMessages (PerfektesChaos)",
			scripts: "https://en.wikipedia.org/w/index.php?title=User:PerfektesChaos/js/remindErrorMessages/r.js&action=raw&bcache=1&maxage=604800&ctype=text/javascript",
			description: "Zur Anzeige von Fehlermeldungen.",
			docpage: "https://de.wikipedia.org/wiki/Benutzer:PerfektesChaos/js/remindErrorMessages",
			defaultEnabled: 7,
			status: "stable"
		},
		resultListSortPC: { // [[:de:Benutzer:PerfektesChaos/js/resultListSort]]
			title: "ResultListSort (PerfektesChaos)",
			scripts: "https://www.mediawiki.org/w/index.php?title=User:PerfektesChaos/js/resultListSort/r.js&action=raw&ctype=text/javascript&bcache=1&maxage=604800",
			description: "Macht Ergebnislisten auf Spezialseiten sortierbar.",
			docpage: "https://de.wikipedia.org/wiki/Benutzer:PerfektesChaos/js/resultListSort",
			defaultEnabled: 7,
			category: "history",
			status: "stable"
		},
	// Perhelion, [[:m:User talk:Perhelion]]
		checkTitleExistsPhln: { // for statistics: [[File:Perhelion_checkTitleExists.js]]
			title: "CheckTitleExists (Perhelion)",
			scripts: "https://meta.wikimedia.org/w/index.php?title=User:Perhelion/checkTitleExists.js&action=raw&ctype=text/javascript",
			description: "Virtueller Text-Linker, „Artikel-Exist-Check“.",
			docpage: "https://meta.wikimedia.org/wiki/User:Perhelion/checkTitleExists",
			defaultEnabled: 7,
			category: "other",
			status: "stable"
		},
		viewerInfoPhln: { // [[:m:User:Perhelion/viewerInfo.js]]
			title: "ViewerInfo (Perhelion)",
			scripts: "https://meta.wikimedia.org/w/index.php?title=User:Perhelion/viewerInfo.js&action=raw&ctype=text/javascript",
			description: "Grobe Übersicht über Beobachterzahl im Seitenkopf.",
			defaultEnabled: 7,
			category: "read",
			status: "stable"
		},
		WikiEditorEmoticonsPhln: { // [[:m:User:Perhelion/WikiEditorEmoticons.js]]
			title: "WikiEditorEmoticons (Perhelion)",
			scripts: "https://meta.wikimedia.org/w/index.php?title=User:Perhelion/WikiEditorEmoticons.js&action=raw&ctype=text/javascript",
			description: "Knöpfe für Emoticons (sMirC-Set) im WikiEditor.",
			defaultEnabled: 7,
			category: "edit",
			status: "stable"
		},
	// TMg
		cleanDiffTMG: { // [[:de:Benutzer:TMg/cleanDiff]]
			title: "CleanDiff (TMg)",
			scripts: "https://de.wikipedia.org/w/index.php?title=Benutzer:TMg/cleanDiff.js&action=raw&ctype=text/javascript",
			description: "Verbesserte Standard-Diffansicht.",
			docpage: "https://de.wikipedia.org/wiki/Benutzer:TMg/cleanDiff",
			defaultEnabled: 6,
			category: "edit",
			status: "stable"
		},
		filterContributionsTMG: { // [[:de:Benutzer:TMg/filterContributions]]
			title: "FilterContributions (TMg)",
			scripts: "https://de.wikipedia.org/w/index.php?title=Benutzer:TMg/filterContributions.js&action=raw&ctype=text/javascript",
			description: "Blendet auf verschiedenen Spezialseiten zusätzliche Filter ein.",
			docpage: "https://de.wikipedia.org/wiki/Benutzer:TMg/filterContributions",
			defaultEnabled: 7,
			category: "history",
			status: "stable"
		},
	// others
		antispoofScript: { // [[:de:Benutzer:Schnark/js/antispoof]]
			title: "antispoof (Schnark, ungepflegt)",
			scripts: "https://de.wikipedia.org/w/index.php?title=Benutzer:Schnark/js/antispoof.js&action=raw&ctype=text/javascript",
			before: function() {
						mw.loader.load("https://de.wikipedia.org/w/index.php?title=Benutzer:Schnark/js/highlight.js&action=raw&ctype=text/javascript&bcache=1&maxage=604800");
					},
			description: "Hebt verdächtige Sonderzeichen hervor.",
			docpage: "https://de.wikipedia.org/wiki/Benutzer:Schnark/js/antispoof",
			defaultEnabled: 0,
			status: "stable"
		},
		DeepcatGadget: { // [[:de:Hilfe:Suche/Deepcat]], [[:wikitech:Nova Resource:Catgraph/Deepcat]]
			title: "Deepcat",
			scripts: "https://de.wikipedia.org/wiki/MediaWiki:Gadget-DeepCat.js&action=raw&ctype=text/javascript&bcache=1&maxage=604800",
			description: "Bietet eine erweiterte Möglichkeit zur Suche in Kategorien.",
			docpage: "https://de.wikipedia.org/wiki/Hilfe:Suche/Deepcat",
			defaultenabled: 0,
			status: "stable"
		},
		lockrollbackWhym: { // [[:commons:User:Whym/lockrollback.js]]/[[:commons:User talk:Whym]]
			title: "lockrollback (Whym)",
			scripts: "https://commons.wikimedia.org/w/index.php?title=User:Whym/lockrollback.js&action=raw&ctype=text/javascript",
			description: "Rollback-Links („Zurücksetzen“) standardmäßig deaktivieren.",
			defaultEnabled: 7,
			category: "history"
		},
		unsignedSeth: { // [[:de:Benutzer_Diskussion:lustiger_seth/unsigned.js#Benutzung]]
			title: "Unsigned (Lustiger Seth)",
			scripts: "https://de.wikipedia.org/w/index.php?title=user:lustiger_seth/unsigned.js&action=raw&ctype=text/javascript",
			description: "Ermöglicht bequeme Nachsignierung.",
			docpage: "https://de.wikipedia.org/wiki/Benutzer_Diskussion:Lustiger_seth/unsigned.js#Benutzung",
			defaultEnabled: 6,
			category: "edit",
			status: "stable"
		},
		WDWListLabelsE37: { // [[:w:User:Evad37/WikidataWatchlistLabels.js]]
			title: "WikidataWatchlistLabels (Evad37)",
			scripts:  "https://en.wikipedia.org/w/index.php?title=User:Evad37/WikidataWatchlistLabels.js&action=raw&ctype=text/javascript",
			description: "Titel/Bezeichnung für P- u. Q-Nummern in der Beobachtungsliste.",
			docpage: "https://en.wikipedia.org/wiki/User:Evad37/WikidataWatchlistLabels",
			defaultEnabled: 7,
			category: "other",
			status: "stable"
		}
	} // additional
}); // mw.hook…fire FliegelFlagel
//[[:de:Benutzer:Schnark/js/fliegelflagel.js/define.js]]
mw.loader.load("https://de.wikipedia.org/w/index.php?title=Benutzer:Schnark/js/fliegelflagel.js/define.js&action=raw&ctype=text/javascript&bcache=1&maxage=604800");
mw.loader.load("https://de.wikipedia.org/w/index.php?title=Benutzer:Schnark/js/fliegelflagel.js/load.js&action=raw&ctype=text/javascript&bcache=1&maxage=604800");
//End of Fliegelflagel

/***************************************/
/* more Scripts by PerfektesChaos - loaded separately, cause more complex */
// [[:de:Benutzer:PerfektesChaos/js/clickDivertimento]]
if ( typeof mw.libs.clickDivertimento !== "object" ) {
	mw.libs.clickDivertimento = { };
}
mw.libs.clickDivertimento.large = true;
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");

// [[:de:Benutzer:PerfektesChaos/js/prettyPageHeading]]
if ( typeof mw.libs.prettyPageHeading !== "object" ) {
	mw.libs.prettyPageHeading = { };
}
mw.libs.prettyPageHeading.link = true;
mw.loader.load( "https://en.wikipedia.org/w/index.php?title=User:PerfektesChaos/js/prettyPageHeading/r.js&action=raw&bcache=1&maxage=604800&ctype=text/javascript", "text/javascript" );
/* End of scripts PC */

// [[:m:User:Perhelion/userstatus]]
$(document).on("loadWikiScript", function (e, userstatus) {
	if (userstatus.name === "Userstatus") {
		userstatus.lastEditSeconds = true; // show seconds of last edit
		userstatus.viewPatrolNumber = true; // uses data from [[:de:Benutzer:HRoestBot]]
		userstatus.styleMissingData = "color: #987; font-style: italic";
		userstatus.styleLoading = "font-style: italic";
		userstatus.styleBlocked = "color: #c20";
		userstatus.styleNotBlocked = "color: #182";
	}
});
if ( [ 2, 3 ].indexOf( mw.config.get( 'wgNamespaceNumber' ) ) !== -1 && ( !mw.config.get( 'wgArticleId' ) || mw.config.get( 'wgAction' ) === 'view' ) )
	mw.loader.load( "https://meta.wikimedia.org/w/index.php?title=User:Perhelion/userstatus.js&action=raw&ctype=text/javascript" ); // for statistics: [[File:Perhelion/userstatus.js]]

if (action === "edit" || "submit") {
// [[:mw:Extension:WikiEditor]] / [[:mw:Extension:WikiEditor/Toolbar customization]]
var customizeToolbar = function () {
	$( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', {
		section: 'main',
		group: 'insert',
		tool: 'signature' // Remove default signature button
	},{
		section: 'advanced',
		group: 'size',
		tools: [
			'big', // inserts obsolete HTML element "<big>"
			'small' // just for consistency
		]
	}); // 'removeFromToolbar'
	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
		section: 'main',
		group: 'insert',
		tools: {
			'customsig': { // Custom signature
				label: 'Signatur & Datum',
				type: 'button',
				icon: 'https://upload.wikimedia.org/wikipedia/commons/thumb/2/2d/Insert-signature2.svg/22px-Insert-signature2.svg.png',
					// [[:commons:File:Insert-signature2.svg]]
				action: {
					type: 'encapsulate',
					options: {
						pre: '—&nbsp;~~~&nbsp;<span style="font-size:80%;color:#555;">–&nbsp;~~~~~</span>' // signature
					}
				}
			}
		}
	}, // section 'main'
	{ section: 'advanced',
		groups: {
			'format': {
				tools: {
					'strikethrough': {
						label: 'Durchgestrichen',
						type: 'button',
						icon: 'https://upload.wikimedia.org/wikipedia/commons/f/f9/Toolbaricon_regular_S_stroke.png',
							// [[:commons:File:Toolbaricon regular S stroke.png]]
						action: {
							type: 'encapsulate',
							options: {
								pre: '<s>',
								post: '</s>'
							}
						}
					},
					'comment': {
						label: 'Kommentar',
						type: 'button',
						icon: 'https://upload.wikimedia.org/wikipedia/commons/9/93/Toolbaricon_decomment.png',
							// [[:commons:File:Toolbaricon decomment.png]]
						action: {
							type: 'encapsulate',
							options: {
								pre: '<!-- ',
								post: ' -->'
							}
						}
					} // 'comment'
				}
			}, // 'format'
			'size': {
				tools: {
					'bigger': {
						label: 'Größer',
						type: 'button',
						icon: 'https://upload.wikimedia.org/wikipedia/commons/0/0d/OOjs_UI_icon_bigger-ltr.svg',
							// [[:commons:File:OOjs UI icon bigger-ltr.svg]]
						action: {
							type: 'encapsulate',
							options: {
								pre: '<span style="font-size: larger;">', // clean with CSS
								post: "</span>"
							}
						}
					},
					'smaller': {
						label: 'Kleiner',
						type: 'button',
						icon: 'https://upload.wikimedia.org/wikipedia/commons/d/dc/OOjs_UI_icon_smaller-ltr.svg',
							// [[:commons:File:OOjs UI icon smaller-ltr.svg]]
						action: {
							type: 'encapsulate',
							options: {
								pre: '<small>',
								post: '</small>'
							}
						}
					}
				}
			} // 'size'
		}
	}); // 'addToToolbar'
}; // var customizeToolbar
/* 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' ).then( function () {
		// This can be the string "0" if the user disabled the preference ([[phab:T54542#555387]])
		if ( mw.user.options.get( 'usebetatoolbar' ) == 1 ) {
			$.when(
				mw.loader.using( 'ext.wikiEditor' ), $.ready
			).then( customizeToolbar );
		}
	} );
} // end of edit check

// [[:m:TemplateScript]] / [[:m:User talk:Pathoschild]]
/* @update-token [[File:Pathoschild/templatescript.js]] */
	mw.loader.load( "https://tools-static.wmflabs.org/meta/scripts/i18n/de.js" );
	mw.loader.load( "https://tools-static.wmflabs.org/meta/scripts/pathoschild.templatescript.js" );
} // if action "edit"/"submit"

if (action === "view" && ns !== (6 || 7) ) { // 6 = File, 7 = File talk
// [[:en:User:Yair rand]]/[[:d:User:Yair rand/WikidataInfo.js]]
mw.loader.load("https://www.wikidata.org/w/index.php?title=User:Yair_rand/WikidataInfo.js&action=raw&ctype=text/javascript"); //Wikidata descriptions also used on mobile devices
}
}); // End of loading function for
   // mw.loader.using( 'mediawiki.util' )

/***************************************/
// Media-Viewer always inactive
mw.config.set('wgMediaViewerOnClick', false);

// picked up from [[:m:User:MisterSynergy/columnedRefs.js]]
$("ol.references").each(function() {
	if( $(this).contents('li').length >= 4 ){
	$(this).addClass("columned_refs"); // rule in [[User:Speravir/global.css]]
	}
});
}// if (isActive)
// </nowiki>