Zum Inhalt springen

„Benutzer:Fomafix/Gadget-toolserver-integration.js“ – Versionsunterschied

aus Wikipedia, der freien Enzyklopädie
Inhalt gelöscht Inhalt hinzugefügt
Tabs statt Leerzeichen (mw:Manual:Coding conventions#Tab size), Namensraumnummern kommentiert, Programmierung lesbarer.
Fehlende Übersetzungen ergänzt
Zeile 29: Zeile 29:
tab_untagged_tooltip: "Bilder mit unvollständiger Lizenz",
tab_untagged_tooltip: "Bilder mit unvollständiger Lizenz",
tab_webchecklinks: "Weblink-Check",
tab_webchecklinks: "Weblink-Check",
tab_webchecklinks_tooltip: "Externe Weblink auf Verfügbarkeit prüfen",
tab_webchecklinks_tooltip: "Externe Weblinks auf Verfügbarkeit prüfen",
tab_navicheck: "NaviLinkCheck",
tab_navicheck: "NaviLinkCheck",
tab_navicheck_tooltip: "Ist die Navi-Liste überall verlinkt?",
tab_navicheck_tooltip: "Ist die Navi-Liste überall verlinkt?",
Zeile 62: Zeile 62:
tab_mydiff_tooltip: "Changes since the own last change",
tab_mydiff_tooltip: "Changes since the own last change",
tab_gallery: "Gallery",
tab_gallery: "Gallery",
//tab_gallery_tooltip: null,
tab_gallery_tooltip: "Show from the user uploaded images",
tab_orphans: "orphans",
tab_orphans: "orphans",
//tab_orphans_tooltip: null,
tab_orphans_tooltip: "Show not used images",
tab_untagged: "Untagged",
tab_untagged: "Untagged",
//tab_untagged_tooltip: null,
tab_untagged_tooltip: "Images with incomplete licence",
tab_webchecklinks: "Weblink-Check",
tab_webchecklinks: "Weblink-Check",
//tab_webchecklinks_tooltip: null,
tab_webchecklinks_tooltip: "Check external weblinks for avaibility",
tab_navicheck: "NaviLinkCheck",
tab_navicheck: "NaviLinkCheck",
//tab_navicheck_tooltip: null,
tab_navicheck_tooltip: "Is the navi list linked everywhere?",
tab_reviw: "Rev-IW",
tab_reviw: "Rev-IW",
tab_reviw_tooltip: "Find all interlanguage links which link to this article",
tab_reviw_tooltip: "Find all interlanguage links which link to this article",
tab_userpages: "UserPages",
tab_userpages: "UserPages",
//tab_userpages_tooltip: null,
tab_userpages_tooltip: "Recent changes of the user page in all wikis",
tab_catscan: "CatScan",
tab_catscan: "CatScan",
//tab_catscan_tooltip: null,
tab_catscan_tooltip: "Search based on categories",
tab_catgraph_article: "Catgraph",
tab_catgraph_article: "Catgraph",
tab_catgraph_article_tooltip: "Visualisation of the category tree",
tab_catgraph_article_tooltip: "Visualisation of the category tree",

Version vom 5. Mai 2012, 13:36 Uhr

/*
  Integration vieler externer Hilfsfunktionen vor allem des Toolservers in die Oberfläche der Wikipedia
  mittels zusätzlicher Karteireiter an geeigneten Stellen abhängig vom Kontext der gerade dargestellten
  Seite (Artikel, Bildseite, Benutzerseite, Kategorie, …).
*/
switch ( mw.config.get( 'wgUserLanguage' ) ) {
case 'de':
case 'de-at':
case 'de-ch':
case 'de-formal':
	mw.messages.set( {
		tab_watchers: "°°",
		tab_watchers_tooltip: "Anzahl der Beobachter der Seite",
		tab_fist: "Bildsuche",
		tab_fist_tooltip: "Suche nach Bildern für den Artikel",
		tab_autoreviewer: "Fehlersuche",
		tab_autoreviewer_tooltip: "Artikelverbesserungen finden",
		tab_commonshelper: "Commonshelper",
		tab_commonshelper_tooltip: "Bilder nach Commons verschieben",
		tab_templatetiger: "Vorlagenauswertung",
		tab_templatetiger_tooltip: "Verwendung der Vorlage analysieren",
		tab_mydiff: "Diff zu mir",
		tab_mydiff_tooltip: "Änderungen seit der eigenen letzten Änderung",
		tab_gallery: "Galerie",
		tab_gallery_tooltip: "Vom Benutzer hochgeladene Bilder anzeigen",
		tab_orphans: "Waisen",
		tab_orphans_tooltip: "Nicht benutzte Bilder anzeigen",
		tab_untagged: "Lizenzlose",
		tab_untagged_tooltip: "Bilder mit unvollständiger Lizenz",
		tab_webchecklinks: "Weblink-Check",
		tab_webchecklinks_tooltip: "Externe Weblinks auf Verfügbarkeit prüfen",
		tab_navicheck: "NaviLinkCheck",
		tab_navicheck_tooltip: "Ist die Navi-Liste überall verlinkt?",
		tab_reviw: "Rev-IW",
		tab_reviw_tooltip: "Interwikis, die auf diese Seite zeigen",
		tab_userpages: "Globale Benutzerseiten",
		tab_userpages_tooltip: "Letzte Änderungen der Benutzerseite in allen Wikis",
		tab_catscan: "CatScan",
		tab_catscan_tooltip: "Suche anhand von Kategorien",
		tab_catgraph_article: "Kategorienbaum",
		tab_catgraph_article_tooltip: "Visuelle Darstellung des Kategorienbaumes",
		tab_catgraph_super: "Überkategorienbaum",
		tab_catgraph_super_tooltip: "Visuelle Darstellung der Überkategorien",
		tab_catgraph_sub: "Unterkategorienbaum",
		tab_catgraph_sub_tooltip: "Visuelle Darstellung der Unterkategorien"
	} );
	break;
case 'en':
default:
	mw.messages.set( {
		tab_watchers: "°°",
		tab_watchers_tooltip: "Number of watchers for this page",
		tab_fist: "FIST",
		tab_fist_tooltip: "Search for pictures for this article",
		tab_autoreviewer: "Autoreviewer",
		tab_autoreviewer_tooltip: "Find article improvements",
		tab_commonshelper: "Commonshelper",
		tab_commonshelper_tooltip: "Move pictures to Commons",
		tab_templatetiger: "Templatetiger",
		tab_templatetiger_tooltip: "Analyse the usage of this template",
		tab_mydiff: "MyDiff",
		tab_mydiff_tooltip: "Changes since the own last change",
		tab_gallery: "Gallery",
		tab_gallery_tooltip: "Show from the user uploaded images",
		tab_orphans: "orphans",
		tab_orphans_tooltip: "Show not used images",
		tab_untagged: "Untagged",
		tab_untagged_tooltip: "Images with incomplete licence",
		tab_webchecklinks: "Weblink-Check",
		tab_webchecklinks_tooltip: "Check external weblinks for avaibility",
		tab_navicheck: "NaviLinkCheck",
		tab_navicheck_tooltip: "Is the navi list linked everywhere?",
		tab_reviw: "Rev-IW",
		tab_reviw_tooltip: "Find all interlanguage links which link to this article",
		tab_userpages: "UserPages",
		tab_userpages_tooltip: "Recent changes of the user page in all wikis",
		tab_catscan: "CatScan",
		tab_catscan_tooltip: "Search based on categories",
		tab_catgraph_article: "Catgraph",
		tab_catgraph_article_tooltip: "Visualisation of the category tree",
		tab_catgraph_super: "Catgraph-Super",
		tab_catgraph_super_tooltip: "Visualisation of the super-categories",
		tab_catgraph_sub: "Catgraph-Sub",
		tab_catgraph_sub_tooltip: "Visualisation of the sub-categories"
	} );
	break;
};

$( function () {

	function portlet( name, url, param, nextnode ) {
		mw.util.addPortletLink(
			'p-cactions',
			typeof param === 'object'
			? url + '?' + $.param( param )
			: url,
			mw.msg( 'tab_' + name ),
			'ca-' + name,
			mw.msg( 'tab_' + name + '_tooltip' ),
			null,
			nextnode
		);
	};

	if ( mw.config.get( 'wgNamespaceNumber' ) >= 0
	  || mw.config.get( 'wgRelevantPageName' ) !== mw.config.get( 'wgPageName' ) ) {
		portlet( 'watchers', '//toolserver.org/~mzmcbride/cgi-bin/watcher.py', {
			db: mw.config.get( 'wgDBname' ) + '_p',
			titles: mw.config.get( 'wgRelevantPageName' )
		} );
		if ( document.getElementById( 'ca-history' ) ) {
			portlet( 'mydiff', '//toolserver.org/~daniel/WikiSense/MyDiff.php', {
				wiki: 'de.wikipedia.org',
				user: mw.config.get( 'wgUserName' ),
				title: mw.config.get( 'wgRelevantPageName' )
			}, document.getElementById( 'ca-history' ).nextSibling );
		}
	}

	// Reverselanglinks
	switch ( mw.config.get( 'wgNamespaceNumber' ) ) {
	case 0: // article
	case 2: // user
	case 4: // project
	case 10: // template
	case 12: // help
	case 14: // category
	case 100: // portal
		portlet( 'reviw', '//toolserver.org/~merl/reverselanglinks/query.php', {
			wiki: 'wikipedia',
			lang: 'de',
			ns: mw.config.get( 'wgNamespaceNumber' ),
			page: mw.config.get( 'wgTitle' )
		} );
		break;
	};

	switch ( mw.config.get( 'wgNamespaceNumber' ) ) {
	case -1: // special
		if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Watchlist'
		  || ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Contributions'
		    && $( '#contentSub a:first' ).text() === mw.config.get( 'wgUserName' ) ) ) {
			portlet( 'userpages', '//toolserver.org/~merl/UserPages/Changes/'
			+ mw.util.wikiUrlencode( mw.config.get( 'wgUserName' ) ) );
		}
		if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Contributions' ) {
			portlet( 'gallery', '//toolserver.org/~daniel/WikiSense/Gallery.php', {
				wikilang: 'de',
				wikifam: '.wikipedia.org',
				img_user_text: $( '#contentSub a:first' ).text()
			} );
		}
		break;
	case 0: // article
		portlet( 'fist', '//toolserver.org/~magnus/fist.php', {
			doit: 1,
			language: 'de',
			project: 'wikipedia',
			data: mw.config.get( 'wgPageName' ),
			datatype: 'articles',
			params: {
				catdepth: 0,
				random: 50,
				ll_max: 5,
				free_only: 1,
				commons_max: 5,
				commonsense: 'on',
				flickr_max: 5,
				flickr_new_name_from_article: 1,
				wts_max: 5,
				gimp_max: 5,
				esp_max: 5,
				esp_skip_flickr: 1,
				forarticles: 'all',
				lessthan_images: 3,
				jpeg: 1,
				png: 1,
				gif: 1,
				svg: 1,
				min_width: 80,
				min_height: 80
			},
			sources: {
				languagelinks: 1,
				commons: 1,
				flickr: 1,
				wts: 1,
				gimp: 1,
				everystockphoto: 1
			}
		} );
		portlet( 'autoreviewer', '//toolserver.org/~timl/cgi-bin/wikilint', {
			l: 'de',
			do_typo_check: 'ON',
			remove_century: 'ON',
			lemma: mw.config.get( 'wgPageName' )
		} );
		portlet( 'catgraph_article', '//toolserver.org/~dapete/catgraph/graph.php', {
			wiki: 'wikipedia',
			lang: 'de',
			sub: 'article',
			cat: mw.config.get( 'wgPageName' )
		} );
		portlet( 'webchecklinks', '//toolserver.org/~dispenser/cgi-bin/webchecklinks.py'
		+ '?page=' + mw.util.wikiUrlencode( 'de:' + mw.config.get( 'wgPageName' ) )
		);
		break;
	case 2: // user
	case 3: // user talk
		if ( document.getElementById( 't-log' ) // keine anonymen Benutzer
		  && mw.config.get( 'wgTitle' ).indexOf( '/' ) === -1 ) { // keine Unterseiten
			portlet( 'gallery', '//toolserver.org/~daniel/WikiSense/Gallery.php', {
				wikilang: 'de',
				wikifam: '.wikipedia.org',
				img_user_text: mw.config.get( 'wgTitle' )
			} );
			portlet( 'orphans', '//toolserver.org/~daniel/WikiSense/OrphanImages.php', {
				wikilang: 'de',
				wikifam: '.wikipedia.org',
				img_user_text: mw.config.get( 'wgTitle' )
			} );
			portlet( 'untagged', '//toolserver.org/~daniel/WikiSense/UntaggedImages.php', {
				wikilang: 'de',
				wikifam: '.wikipedia.org',
				img_user_text: mw.config.get( 'wgTitle' )
			} );
		}
		break;
	case 6: // file
		portlet( 'commonshelper', '//toolserver.org/~magnus/commonshelper.php', {
			interface: mw.config.get( 'wgUserLanguage' ),
			language: 'de',
			image: mw.config.get( 'wgTitle' ),
			project: 'wikipedia',
			username: mw.config.get( 'wgUserName' ),
			commonsense: 1,
			doit: 'Get text'
		} );
		portlet( 'catgraph_article', '//toolserver.org/~dapete/catgraph/graph.php', {
			wiki: mw.config.get( 'wgArticleId' ) === 0 ? 'commons' : 'wikipedia',
			lang: 'de',
			ns: mw.config.get( 'wgNamespaceNumber' ),
			cat: mw.config.get( 'wgTitle' )
		} );
		break;
	case 10: // template
		portlet( 'templatetiger', '//toolserver.org/~kolossos/templatetiger/tt-table4.php', {
			lang: 'de',
			offset: 0,
			limit: 30,
			template: mw.config.get( 'wgTitle' )
		} );
		if ( mw.config.get( 'wgTitle' ).substr( 0, 17 ) === 'Navigationsleiste' ) {
			portlet( 'navicheck', '//toolserver.org/~merl/specialpages/dewiki/Navigationsleistenwartung/'
			+ mw.util.wikiUrlencode( mw.config.get( 'wgTitle' ) ) );
		}
		break;
	case 14: // category
		portlet( 'catscan', '//toolserver.org/~magnus/catscan_rewrite.php', {
			interface_language: mw.config.get( 'wgUserLanguage' ),
			language: 'de',
			project: 'wikipedia',
			categories: mw.config.get( 'wgTitle' )
		} );
		portlet( 'catgraph_super', '//toolserver.org/~dapete/catgraph/graph.php', {
			wiki: 'wikipedia',
			lang: 'de',
			sub: 0,
			cat: mw.config.get( 'wgTitle' )
		} );
		portlet( 'catgraph_sub', '//toolserver.org/~dapete/catgraph/graph.php', {
			wiki: 'wikipedia',
			lang: 'de',
			sub: 1,
			cat: mw.config.get( 'wgTitle' )
		} );
		break;
	};

} );