MediaWiki:Vector.js: Unterschied zwischen den Versionen
Zeile 40: | Zeile 40: | ||
var customizeToolbar = function() { | var customizeToolbar = function() { | ||
/* ###### Unterstrichen */ | /* ###### 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 */ | /* ###### Festes Leerzeichen */ | ||
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { |
Version vom 15. Juni 2019, 19:34 Uhr
/* * 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.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/7/76/Button_wordwrap.png', action: { type : 'encapsulate', options: { pre: "{{+}}" } } } } } ); /* ###### Zeilenumbruch */ $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { 'section': 'advanced', 'group': 'format', 'tools': { 'endoffloat': { label: 'Fließtextende', type: 'button', icon: 'http://www.mobadaten.info/MoBaDatenInfo/images/1/19/Button_EndOfFloat.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/0/0b/Button_fuente.png', action: { type: 'encapsulate', options: { pre: "{{Source|", // text to be inserted periMsg: "Hersteller-Kurzzeichen oder andere Quellenangabe", post: "}}" } } } } } ); /* ###### Epochenangabe */ $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { 'section': 'advanced', 'group': 'misc', 'tools': { 'epoch': { label: 'Epochenangabe', // or use labelMsg for a localized label, see above type: 'button', icon: 'http://www.mobadaten.info/MoBaDatenInfo/images/2/2d/Vector_toolbar_hourglass.png', action: { type: 'encapsulate', options: { pre: "{{Epoche|", // text to be inserted periMsg: "Epochennummer 1…6", 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 ); } } ); }