|
|
Zeile 6: |
Zeile 6: |
| */ | | */ |
| mw.config.set( 'tableSorterCollation', {'Ä':'A', 'Ö':'O', 'Ü':'U', 'ä':'a', 'ö':'o', 'ü':'u', 'ß':'ss'} ); | | mw.config.set( 'tableSorterCollation', {'Ä':'A', 'Ö':'O', 'Ü':'U', 'ä':'a', 'ö':'o', 'ü':'u', 'ß':'ss'} ); |
|
| |
| /**
| |
| * Stay on the same server as much as possible
| |
| * Load page: [[MediaWiki:Common.js/relative.js]]
| |
| */
| |
| if( mw.config.get( 'wgNamespaceNumber' ) > 0 ) { //not in main space and special pages
| |
| mw.loader.using( [ 'user', 'mediawiki.user', 'user.options' ], function() { //wait for overrides in user.js
| |
| if( mw.user.options.get( 'relativeProtocols', true ) ) { //disable in user.js, if not needed
| |
| mw.loader.load( '//de.wikipedia.org/w/index.php?title=MediaWiki:Common.js/relative.js'
| |
| + '&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400' );
| |
| }
| |
| });
| |
| }
| |
|
| |
|
| /** | | /** |
| * load the Edittools on [[Special:Upload]] and prefill the summary textarea | | * load the Edittools on [[Special:Upload]] and prefill the summary textarea |
| * Load pages: [[MediaWiki:Onlyifuploading.js]], [[MediaWiki:Onlyifediting.js]] | | * Load pages: [[MediaWiki:Gadget-uploadtools.js]] |
| */ | | */ |
| if (mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Upload') { | | if (mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Upload') { |
| importScript("MediaWiki:Onlyifuploading.js"); | | mw.loader.load('ext.gadget.uploadtools'); |
| importScript("MediaWiki:Onlyifediting.js");
| |
| }
| |
| | |
| /**
| |
| * load the Edittools ([[MediaWiki:Edittools]], the part under the edit form)
| |
| * Load page: [[MediaWiki:Onlyifediting.js]]
| |
| */
| |
| if ( mw.config.get( 'wgAction' ) === 'edit' || mw.config.get( 'wgAction' ) === 'submit' ) {
| |
| importScript("MediaWiki:Onlyifediting.js");
| |
| } | | } |
|
| |
|
Zeile 42: |
Zeile 20: |
| */ | | */ |
| if (mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Watchlist') { | | if (mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Watchlist') { |
| importScript("MediaWiki:Common.js/watchlist.js"); | | mw.loader.load('//de.wikipedia.org/w/index.php?title=MediaWiki:Common.js/watchlist.js&action=raw&ctype=text/javascript'); |
| } | | } |
|
| |
| /**
| |
| * Load jquery.ui.button if used in content
| |
| * for backward-compatibilty
| |
| * Should be removed/replaced with mediawiki.ui, when that is loaded on each page
| |
| */
| |
| mw.hook( 'wikipage.content' ).add( function ( $content ) {
| |
| if ( $content.find( '.ui-button' ).length ) {
| |
| mw.loader.load( 'jquery.ui.button' );
| |
| }
| |
| } );
| |
|
| |
| //=============================================================
| |
| //*** Configuration for "star" logo in front of interwiki links to Featured Articles
| |
| //*** and green symbol in front of interwiki links to Good Articles
| |
| /** set in Special:Mypage/common.js to switch off this "feature"
| |
| mw.user.options.set( 'linkFA_enabled', false );
| |
| * star logo for featured articles in other languages,
| |
| * see Template:Link_FA / Template:Link_GA and MediaWiki:Common.css / MediaWiki:Cologneblue.css
| |
| */
| |
| mw.loader.using( [ 'user', 'mediawiki.user', 'user.options' ], function() { $(function() {
| |
| /** description that is displayed when cursor hovers above FA interwiki links */
| |
| var linkFA_description = "Dieser Artikel wurde als exzellent bewertet.";
| |
| var linkGA_description = "Dieser Artikel wurde als lesenswert bewertet.";
| |
|
| |
| // early exit when disabled
| |
| if ( !mw.user.options.get( 'linkFA_enabled', true ) ) {
| |
| return;
| |
| }
| |
|
| |
| var skin = mw.config.get( 'skin' );
| |
| if (skin === "monobook" || skin === "modern" || skin === "vector" ) {
| |
| linkFA_CSS("p-lang", "li");
| |
| }
| |
| else if (skin === "cologneblue") {
| |
| linkFA_CSS("langlinks", "span");
| |
| }
| |
|
| |
| function linkFA_CSS(rootId, tagName) {
| |
| // links are to replaced in p-lang only
| |
| var pLang = document.getElementById(rootId);
| |
| if (!pLang) return;
| |
| var lis = pLang.getElementsByTagName(tagName);
| |
| for (var i = 0; i < lis.length; i++) {
| |
| var li = lis[i];
| |
| //extract necessary classname
| |
| var matches = li.className.match( /(?:^| )(interwiki-[^ ]+)(?: |$)/ );
| |
| if ( !matches || matches.length != 2 ) {
| |
| continue;
| |
| }
| |
| var className = matches[1];
| |
| // only links with a corresponding Link_FA template are interesting
| |
| if (document.getElementById(className + "-fa")) {
| |
| li.className += " FA"; // additional class so the template can be hidden with CSS
| |
| li.title = linkFA_description; // change title
| |
| continue;
| |
| }
| |
| if (document.getElementById(className + "-ga")) {
| |
| li.className += " GA"; // additional class so the template can be hidden with CSS
| |
| li.title = linkGA_description; // change title
| |
| continue;
| |
| }
| |
| }
| |
| }
| |
| })});
| |
|
| |
|
| /* | | /* |
Zeile 203: |
Zeile 116: |
| // using 'jquery.makeCollapsible': for messages | | // using 'jquery.makeCollapsible': for messages |
| // using 'user', 'mediawiki.user', 'user.options': wait for overrides in user.js | | // using 'user', 'mediawiki.user', 'user.options': wait for overrides in user.js |
| mw.loader.using( [ 'mediawiki.util', 'jquery.makeCollapsible', 'user', 'mediawiki.user', 'user.options' ], function() { $(function() { | | mw.loader.using( [ 'jquery.makeCollapsible', 'user', 'mediawiki.user', 'user.options' ], function() { mw.hook( 'wikipage.content' ).add( function( $content ) { |
| // allow setting NavigationBarShowDefault | | // allow setting NavigationBarShowDefault |
| var showDefaultCount = mw.user.options.get( 'NavigationBarShowDefault', | | var showDefaultCount = mw.user.options.get( 'NavigationBarShowDefault', |
Zeile 255: |
Zeile 168: |
| } | | } |
| // iterate over all NavFrames | | // iterate over all NavFrames |
| var NavFrames = mw.util.$content.find( 'div.NavFrame' ); | | var NavFrames = $content.find( 'div.NavFrame' ); |
|
| |
|
| // if more Navigation Bars found and not template namespace than Default: hide all | | // if more Navigation Bars found and not template namespace than Default: hide all |
Zeile 292: |
Zeile 205: |
|
| |
|
| /** Skript für [[Vorlage:Galerie]] */ | | /** Skript für [[Vorlage:Galerie]] */ |
| jQuery( document ).ready(function() {
| | $( function() { |
| if (document.URL.match(/printable/g)) return; | | if (document.URL.match(/printable/g)) return; |
|
| |
|
Zeile 382: |
Zeile 295: |
| }); | | }); |
| }); | | }); |
| }
| |
|
| |
| /**
| |
| * Lokaler Dateidiskussionsseitenlink eines Commonsbildes verweist nach Commons
| |
| */
| |
| if (mw.config.get( 'wgNamespaceNumber' ) === 6) {
| |
| mw.loader.using( [ 'mediawiki.util', 'user', 'mediawiki.user' ], function() { $( function() { //wait for overrides in user.js
| |
| if ( mw.config.get( 'keepLocalFileTabs', false ) ) {
| |
| return;
| |
| }
| |
| if ( $( '#ca-history' ).length ) {
| |
| return; //Lokale Dateibeschreibung vorhanden?
| |
| }
| |
| if ( !$( 'div.sharedUploadNotice' ).length ) {
| |
| return; //Nur bei Commons-Bildern
| |
| }
| |
|
| |
| var path = '//commons.wikimedia.org/wiki/';
| |
|
| |
| // Ändere Link auf Diskussionsseite
| |
| var talkLink = $( '#ca-talk.new a' );
| |
| talkLink.attr( 'href', path + 'File_talk:' + mw.util.wikiUrlencode( mw.config.get( 'wgTitle' ) ) + '?uselang=' + mw.util.rawurlencode( mw.config.get( 'wgUserLanguage' ) ) );
| |
| talkLink.addClass( 'commonstab' );
| |
|
| |
| // Ändere Bearbeiten-Link
| |
| var editLink = $( '#ca-edit a, #ca-viewsource a' );
| |
| editLink.attr( 'href', path + 'File:' + mw.util.wikiUrlencode( mw.config.get( 'wgTitle' ) ) + '?action=edit&uselang=' + mw.util.rawurlencode( mw.config.get( 'wgUserLanguage' ) ) );
| |
| editLink.addClass( 'commonstab' );
| |
| editLink.text( 'Bearbeiten' );
| |
| })});
| |
| } | | } |
|
| |
|
Zeile 448: |
Zeile 331: |
| } | | } |
| }); | | }); |
| }
| |
|
| |
| /**
| |
| * Verwendung von OpenStreetMap in Wikipedia.
| |
| * (c) 2008 by Magnus Manske, Released under GPL
| |
| */
| |
| //mediawiki.util is used by openStreetMapToggle
| |
| mw.loader.using( [ 'mediawiki.util' ], function() { $( function() {
| |
| var c = $( '#coordinates' );
| |
| if ( !c.length ) {
| |
| return;
| |
| }
| |
|
| |
| var a = c.find( 'a' );
| |
| var geohack = false;
| |
| for (var i = 0; i < a.length; i++) {
| |
| var h = a[i].href;
| |
| if (!h.match(/geohack/)) continue;
| |
| if (h.match(/skyhack/)) continue;
| |
| if (h.match(/_globe:/)) continue; // no OSM for moon, mars, etc
| |
| geohack = true;
| |
| break;
| |
| }
| |
| if ( !geohack ) {
| |
| return;
| |
| }
| |
|
| |
| var separator = $( document.createElement( 'span' ) );
| |
| separator.text( ' | ' );
| |
| separator.attr( 'class', 'noprint coordinates-separator' );
| |
| c.append( separator );
| |
| var img = $( document.createElement( 'img' ) );
| |
| img.attr( {
| |
| 'src': '//upload.wikimedia.org/wikipedia/commons/thumb/c/c9/OpenStreetMapLogo.png/17px-OpenStreetMapLogo.png',
| |
| 'width': '17px',
| |
| 'height': '17px'
| |
| } );
| |
| var a = $( document.createElement( 'a' ) );
| |
| a.attr( {
| |
| 'href': '#',
| |
| 'title': 'Zeige Koordinaten auf einer Karte von OpenStreetMap',
| |
| 'class': 'noprint osm-icon-coordinates'
| |
| } );
| |
| a.click( openStreetMapToggle );
| |
| a.append( img );
| |
| c.append( a );
| |
| })});
| |
| // The function to toggle
| |
| function openStreetMapToggle() {
| |
| var c = $( '#coordinates' );
| |
| if ( !c.length) {
| |
| return;
| |
| }
| |
| var cs = $( '#contentSub' );
| |
| var osm = $( '#openstreetmap' );
| |
|
| |
| if ( cs.length && osm.length ) {
| |
| if ( osm.css( 'display' ) === 'none' ) {
| |
| osm.css( 'display', 'block' );
| |
| } else {
| |
| osm.css( 'display', 'none' );
| |
| }
| |
| return false;
| |
| }
| |
|
| |
| var found_link = false;
| |
| var a = c.find( 'a' );
| |
| var h;
| |
| for (var i = 0; i < a.length; i++) {
| |
| h = a[i].href;
| |
| if (!h.match(/geohack/)) continue;
| |
| found_link = true;
| |
| break;
| |
| }
| |
| if ( !found_link ) {
| |
| return; // No geohack link found
| |
| }
| |
|
| |
| h = h.split('params=')[1];
| |
|
| |
| var url = '//tools.wmflabs.org/wiwosm/osm-on-ol/kml-on-ol.php?lang=de&uselang='
| |
| + mw.util.rawurlencode( mw.config.get( 'wgUserLanguage' ) )
| |
| + '¶ms=' + h
| |
| + '&title=' + mw.util.wikiUrlencode( mw.config.get( 'wgTitle' ) );
| |
|
| |
| var iframe = $( document.createElement( 'iframe' ) );
| |
| iframe.attr( 'id', 'openstreetmap' );
| |
| iframe.css({
| |
| 'width': '100%',
| |
| 'height': '350px',
| |
| 'clear': 'both'
| |
| });
| |
| iframe.attr( 'src', url );
| |
| cs.append( iframe );
| |
| return false;
| |
| } | | } |
|
| |
|
Zeile 564: |
Zeile 352: |
| * erzeuge einen "Neuen Abschnitt"-Link an der letzten Überschrift | | * erzeuge einen "Neuen Abschnitt"-Link an der letzten Überschrift |
| */ | | */ |
| $( function() { | | mw.loader.using( [ 'jquery.accessKeyLabel' ], function() { $( function() { |
| var newSectionLink = $( '#ca-addsection a' ); | | var newSectionLink = $( '#ca-addsection a' ); |
| if( newSectionLink.length ) { | | if( newSectionLink.length ) { |
| var link = newSectionLink.clone(); //create a copy | | var link = newSectionLink.clone(); //create a copy |
| //avoid duplicate accesskey | | //avoid duplicate accesskey |
| link.removeAttr( 'accesskey' ).attr( 'title', function ( index, oldTitle ) { | | link.removeAttr( 'accesskey' ).updateTooltipAccessKeys(); |
| return oldTitle.replace( /\s*\[.*\]\s*$/, '' );
| |
| } );
| |
| //add it within the brackets | | //add it within the brackets |
| var lastEditsectionLink = $( 'span.mw-editsection:last a:last' ); | | var lastEditsectionLink = $( 'span.mw-editsection:last a:last' ); |
Zeile 577: |
Zeile 363: |
| lastEditsectionLink.after( ' | ' ); //see [[MediaWiki:Pipe-separator]] | | lastEditsectionLink.after( ' | ' ); //see [[MediaWiki:Pipe-separator]] |
| } | | } |
| }); | | })}); |
|
| |
|
| /** | | /** |