MediaWiki:Vector.js

Aus MoBaDaten
Wechseln zu: Navigation, Suche

Hinweis: Leere nach dem Speichern 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: Strg+F5 drücken oder Strg drücken und gleichzeitig Aktualisieren anklicken
  • Opera: Gehe zu Menü → Einstellungen (Opera → Einstellungen auf dem Mac) und dann auf Datenschutz & Sicherheit → Browserdaten löschen → Gespeicherte Bilder und Dateien.
 /*
  * moveEditsection
  * Dieses Script verschiebt die [Bearbeiten]-Buttons vom rechten Fensterrand
  * direkt rechts neben die jeweiligen Überschriften.
  * This script moves the [edit]-buttons from the right border of the window
  * directly right next to the corresponding headings.
  *
  * Zum Abschalten die folgende Zeile (ohne führendes Sternchen) in die eigene
  * vector.js (zu finden unter [[Special:Mypage/vector.js|Benutzer:Name/vector.js]]) kopieren:
  * var oldEditsectionLinks = true;
  *
  * dbenzhuser (de:Benutzer:Dbenzhuser)
  * Angepasst nach Vorschlag von https://de.wikipedia.org/w/index.php?title=MediaWiki_Diskussion:Vector.js&oldid=75510836
  */
 $( function () {
    if (typeof oldEditsectionLinks != 'undefined' && oldEditsectionLinks)   
      return;
    appendCSS("#bodyContent .editsection{float:none;margin-left:0}");
    var elt, item, numChilds;
    var root=document.getElementById("content");
    for (var i=1; i <= 6; ++i) {
      var list=root.getElementsByTagName("h" + i);
      for (var j=0, je=list.length; j < je; ++j) {
        item=list[j];
        numChilds=item.childNodes.length;
        if (numChilds > 1 && item.firstChild.className === "editsection")
        {
          // Zuerst das Leerzeichen von hinter dem Bearbeiten Link davor
            item.insertBefore(item.firstChild.nextSibling, item.firstChild);
          // Danach die große Rotation: Alles nach vorn, bis auf die beiden Elemente
          while (--numChilds > 1)
            item.insertBefore(item.lastChild, item.firstChild); // Überschrift vor Bearbeitenlink
        }
      }
    }
 });

/* ================================================================ */

var customizeToolbar = function() {
/* ###### Unterstrichen */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
         'section': 'main',
         'group': 'format',
         'tools': {
                 'underlined': {
                         label: 'Unterstrichen', // or use labelMsg for a localized label, see above
                         type: 'button',
                         icon: 'http://www.mobadaten.info/MoBaDatenInfo/images/1/13/Toolbaricon_regular_U_underline.png',
                         action: {
                                 type: 'encapsulate',
                                 options: {
                                         pre: "<u>", // text to be inserted
                                         periMsg: "Unterstrichener Text",
                                         post: "</u>"
                                 }
                         }
                 }
         }
} );
/* ###### Festes Leerzeichen */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'advanced',
        'group': 'format',
        'tools': {
                'hardspace': {
                        label: 'Festes Leerzeichen',
                        type: 'button',
                        icon: 'http://www.mobadaten.info/MoBaDatenInfo/images/1/1b/Button_hardspace_clear.png',
                        action: {
                                type : 'encapsulate',
                                options: {
                                        pre: "{{~}}"
                                }
                        }
                }
        }
} );
/* ###### Zeilenumbruch */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'advanced',
        'group': 'format',
        'tools': {
                'wordwrap': {
                        label: 'Zeilenumbruch',
                        type: 'button',
                        icon: 'http://www.mobadaten.info/MoBaDatenInfo/images/0/09/Button_wordwrap_clear.png',
                        action: {
                                type : 'encapsulate',
                                options: {
                                        pre: "{{+}}"
                                }
                        }
                }
        }
} );
/* ###### Zeilenumbruch */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'advanced',
        'group': 'format',
        'tools': {
                'endoffloat': {
                        label: 'Fließtextende (für linksseitige Objekte)',
                        type: 'button',
                        icon: 'http://www.mobadaten.info/MoBaDatenInfo/images/5/5d/Button_EndOfFloat_clear.png',
                        action: {
                                type : 'encapsulate',
                                options: {
                                        pre: "{{+clr}}"
                                }
                        }
                }
        }
} );
/* ###### Zeilenumbruch rechts*/
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'advanced',
        'group': 'format',
        'tools': {
                'endoffloatright': {
                        label: 'Fließtextende (für rechtsseitige Objekte)',
                        type: 'button',
                        icon: 'http://www.mobadaten.info/MoBaDatenInfo/images/c/c1/Button_EndOfFloatRight_clear.png',
                        action: {
                                type : 'encapsulate',
                                options: {
                                        pre: "{{+clr+}}"
                                }
                        }
                }
        }
} );
/* ###### Gruppe Verschiedenes */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'advanced',
        'groups': {
                'misc': {
                        'label': 'Diverses' // or use labelMsg for a localized label, see above
                }
        }
} );
/* ###### Quellenangabe */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'advanced',
        'group': 'misc',
        'tools': {
                'tmplsrc': {
                        label: 'Quellenangabe', // or use labelMsg for a localized label, see above
                        type: 'button',
                        icon: 'http://www.mobadaten.info/MoBaDatenInfo/images/2/29/Button_fuente_clear.png',
                        action: {
                                type: 'encapsulate',
                                options: {
                                        pre: "{{Source|", // text to be inserted
                                        periMsg: "Hersteller-Kurzzeichen oder andere Quellenangabe",
                                        post: "}}"
                                }
                        }
                }
        }
} );
/* ###### NEM-Epochenangabe */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'advanced',
        'group': 'misc',
        'tools': {
                'epoch': {
                        label: 'Epochenangabe (NEM)', // or use labelMsg for a localized label, see above
                        type: 'button',
                        icon: 'http://www.mobadaten.info/MoBaDatenInfo/images/4/40/Vector_toolbar_hourglass_NEM.png',
                        action: {
                                type: 'encapsulate',
                                options: {
                                        pre: "{{Epoche|", // text to be inserted
                                        periMsg: "Epochennummer 1…6",
                                        post: "}}"
                                }
                        }
                }
        }
} );
/* ###### GB-Epochenangabe */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'advanced',
        'group': 'misc',
        'tools': {
                'epoch': {
                        label: 'Epochenangabe (GB)', // or use labelMsg for a localized label, see above
                        type: 'button',
                        icon: 'http://www.mobadaten.info/MoBaDatenInfo/images/2/26/Vector_toolbar_hourglass_GB.png',
                        action: {
                                type: 'encapsulate',
                                options: {
                                        pre: "{{Epoche-GB|", // text to be inserted
                                        periMsg: "Epochennummer 1…11",
                                        post: "}}"
                                }
                        }
                }
        }
} );
/* ###### USA-Epochenangabe */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'advanced',
        'group': 'misc',
        'tools': {
                'epoch': {
                        label: 'Epochenangabe (Nordamerika)', // or use labelMsg for a localized label, see above
                        type: 'button',
                        icon: 'http://www.mobadaten.info/MoBaDatenInfo/images/7/7e/Vector_toolbar_hourglass_USA.png',
                        action: {
                                type: 'encapsulate',
                                options: {
                                        pre: "{{Epoche-USA|", // text to be inserted
                                        periMsg: "Era W, S, T, D, M",
                                        post: "}}"
                                }
                        }
                }
        }
} );
/* ###### FULLPAGENAME einfügen */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'advanced',
        'group': 'misc',
        'tools': {
                'fullpagename': {
                        label: 'Seitennamen einfügen', // or use labelMsg for a localized label, see above
                        type: 'button',
                        icon: 'http://www.mobadaten.info/MoBaDatenInfo/images/d/d3/Vector_toolbar_fullpagename.png',
                        action: {
                                type: 'encapsulate',
                                options: {
                                        pre: "{{sub", // text to be inserted
                                        post: "st:FULLPAGENAME}}"
                                }
                        }
                }
        }
} );
/* ###### Typografische Anführungszeichen */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'advanced',
        'group': 'misc',
        'tools': {
                'endoffloat': {
                        label: 'Typografische Anführungszeichen',
                        type: 'button',
                        icon: 'http://www.mobadaten.info/MoBaDatenInfo/images/1/1c/German_quotation_marks.png',
                        action: {
                                type : 'encapsulate',
                                options: {
                                        pre: "\u201e", // text to be inserted
                                        periMsg: "Text",
                                        post: "\u201c"
                                }
                        }
                }
        }
} );
};
// Ende var customizeToolbar
 
/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */
if ( [ 'edit', 'submit' ].indexOf( mw.config.get( 'wgAction' ) ) !== -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 );
		}
	} );
}