MediaWiki:Common.js
Aus INOVe
Hinweis: Leere nach dem Veröffentlichen 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/Edge: Strg+F5 drücken oder Strg drücken und gleichzeitig Aktualisieren anklicken
- Opera: Strg+F5
/* Das folgende JavaScript wird für alle Benutzer geladen. */
/* Das folgende JavaScript wird für alle Benutzer geladen. */
var customizeToolbar = function () {
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'advanced',
'groups': {
'spezial': {
'label': 'Spezial' // or use labelMsg for a localized label, see above
}
}
} );
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'advanced',
group: 'spezial',
tools: {
"external": {
label: 'Externer Link Icon',
type: 'button',
icon: 'https://upload.wikimedia.org/wikipedia/commons/6/67/OOjs_UI_icon_external-link-ltr.svg',
action: {
type: 'encapsulate',
options: {
pre: '<span class="fa fa-external-link fa-lg small-icon"></span>'
}
}
}
}
});
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'advanced',
group: 'insert',
tools: {
"Video": {
label: 'Video einbetten',
type: 'button',
icon: 'https://upload.wikimedia.org/wikipedia/commons/6/64/Video_Camera_-_The_Noun_Project.svg',
action: {
type: 'encapsulate',
options: {
pre: '{{#ev:youtube|',
peri: 'Link zum Youtube-Video',
post: '|400|right|Videounterschrift}}'
}
}
}
}
});
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'advanced',
group: 'insert',
tools: {
"Karte": {
label: 'Karte',
type: 'button',
icon: 'https://upload.wikimedia.org/wikipedia/commons/b/b4/OOjs_UI_icon_map-ltr.svg',
action: {
type: 'encapsulate',
options: {
pre: '{{#display_map:',
peri: "Beispielstraße 1, Lüneburg~'''Überschrift (optional)'''~Kurze Beschreibung (optional); ggf. zweiter Marker evt. mit Koordinaten wie z. B. 53.23697, 10.40292",
post: '|fullscreen=on|scrollzoom=off}}'
}
}
}
}
});
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'advanced',
group: 'spezial',
tools: {
"seo": {
label: 'Suchmaschinenoptimierung',
type: 'button',
icon: 'https://upload.wikimedia.org/wikipedia/commons/5/56/Antu_tag-places-black.svg',
action: {
type: 'encapsulate',
options: {
pre: "{{#seo:|description=",
peri: "Kurze Beschreibung des Artikels für Suchmaschinen und Linkvorschau in Messengern",
post: "}}"
}
}
}
}
});
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'main',
groups: {
list: {
tools: {
templates: {
label: 'Gitter',
type: 'select',
list: {
'Gittereins': {
label: '2 Spalten',
action: {
type: 'encapsulate',
options: {
pre: '<div class="row"><div class="large-6 columns">Inhalt der 1. Spalte</div><div class="large-6 columns">Inhalt der 2. Spalte</div></div>'
}
}
},
'Gitterzwei': {
label: '3 Spalten',
action: {
type: 'encapsulate',
options: {
pre: '<div class="row"><div class="large-4 columns">Inhalt der 1. Spalte</div><div class="large-4 columns">Inhalt der 2. Spalte</div><div class="large-4 columns">Inhalt der 3. Spalte</div></div>'
}
}
},
'Gitterdrei': {
label: '2er + Überschrift',
action: {
type: 'encapsulate',
options: {
pre: '<div class="row"><div class="large-6 columns"><h3 class="subheader">1. Überschrift</h3>Inhalt der 1. Spalte</div><div class="large-6 columns"><h3 class="subheader">2. Überschrift</h3>Inhalt der 2. Spalte</div></div>'
}
}
},
'Gittervier': {
label: '3er + Überschrift',
action: {
type: 'encapsulate',
options: {
pre: '<div class="row"><div class="large-4 columns"><h3 class="subheader">1. Überschrift</h3>Inhalt der 1. Spalte</div><div class="large-4 columns"><h3 class="subheader">2. Überschrift</h3>Inhalt der 2. Spalte</div><div class="large-4 columns"><h3 class="subheader">3. Überschrift</h3>Inhalt der 3. Spalte</div></div>'
}
}
},
}
}
}
}
}
} );
/* Remove button for <big> */
$( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', {
'section': 'advanced',
'group': 'size',
'tool': 'big'
});
/* Remove button for <small> */
$( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', {
'section': 'advanced',
'group': 'size',
'tool': 'small'
});
/* Remove button for <br> */
$( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', {
'section': 'advanced',
'group': 'format',
'tool': 'newline'
});
};
/* 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 );
}
} );
}
