Common.js: Unterschied zwischen den Versionen
Aus Lünepedia
Keine Bearbeitungszusammenfassung |
(Add search icon to mobile view) |
||
| Zeile 277: | Zeile 277: | ||
} ); | } ); | ||
} | } | ||
window.addEventListener("load", () => { | |||
if(window.screen.width <= 767) { | |||
const mobileSearch = document.createElement("a"); | |||
mobileSearch.classList.add("fa", "fa-search") | |||
mobileSearch.setAttribute("href", "/Spezial:Suche") | |||
mobileSearch.style.cssText = "position: absolute;z-index: 1000000;top: 50%;color: #008d8d;transform: translateX(-20px) translateY(-50%);" | |||
document.querySelector("#right-nav-aside").prepend(mobileSearch) | |||
} | |||
}); | |||
Version vom 29. Juli 2024, 21:40 Uhr
/* 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: '{{Externer Link Icon}}'
}
}
}
}
});
$('#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: '<div class="map">{{#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}}Beschreibung der Karte</div>'
}
}
}
}
});
$('#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>'
}
}
},
}
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'main',
groups: {
list: {
tools: {
templates: {
label: 'Vorlagen',
type: 'select',
list: {
'Vorlage1': {
label: 'Übersichtsartikel',
action: {
type: 'encapsulate',
options: {
pre: '{{Übersicht}} <!-- Hinweis darauf, dass der Artikel eine Übersicht enthält. Ganz oben einfügen. -->'
}
}
},
'Vorlage2': {
label: 'Lückenhafter Artikel',
action: {
type: 'encapsulate',
options: {
pre: '{{Lückenhaft}} <!-- Hinweis darauf, dass im Artikel Informationen fehlen. Ganz oben einfügen. -->'
}
}
},
'Vorlage3': {
label: 'Lückenhafter Abschnitt',
action: {
type: 'encapsulate',
options: {
pre: '{{Lückenhafter Abschnitt}} <!-- Hinweis darauf, dass in exakt diesem Abschnitt Informationen fehlen. Direkt unter der Überschrift einfügen. -->'
}
}
},
'Vorlage4': {
label: 'Fotos fehlen',
action: {
type: 'encapsulate',
options: {
pre: '{{Fotos}} <!-- Hinweis darauf, dass im Artikel Fotos fehlen. Ganz oben einfügen. -->'
}
}
},
'Vorlage5': {
label: 'Neutraler Standpunkt',
action: {
type: 'encapsulate',
options: {
pre: '{{Neutralität}} <!-- Hinweis darauf, dass der Artikel (noch) nicht der Richtlinie eines neutralen Standpunktes entspricht. Ganz oben einfügen. -->'
}
}
},
'Vorlage6': {
label: 'Corona',
action: {
type: 'encapsulate',
options: {
pre: '{{Corona Abweichungen}} <!-- Hinweis darauf, dass es wegen Corona zu Abweichungen vom Normalbetrieb kommt. Ganz oben einfügen. -->'
}
}
},
'Vorlage7': {
label: 'Wikipedia',
action: {
type: 'encapsulate',
options: {
pre: '{{Wikipedia}} <!-- Hinweis darauf, dass die Artikelinhalte teilweise oder ganz von Wikipedia übernommen sind. Ganz unten einfügen. -->'
}
}
},
'Vorlage8': {
label: 'Infobox',
action: {
type: 'encapsulate',
options: {
pre: '{{Infobox| Titel = Überschrift der Infobox | Bild <!-- Optional! --> = Name_der_Datei.png| p1 = Erster Parameter (z. B. Gründungsjahr) | a1 = Erste Antwort (z. B. 1986) | p2 = | a2 = | p3 = | a3 = | p4 = | a4 = | p5 = | a5 = | p6 = | a6 = | p8 = | a8 = | p9 = | a9 = | p10 = | a10 = }} <!-- Erstellt eine steckbriefartige Infobox. Oben einfügen (ggf. unter anderen Vorlagen). Fülle die Parameter (p1, p2 usw.) aus und trage die Antworten (a1, a2 usw.) ein. Mehr unter Vorlage:Infobox -->'
}
}
},
'Vorlage9': {
label: 'Icon',
action: {
type: 'encapsulate',
options: {
pre: '{{Icon|fa=',
peri: 'Namen des Icons eingeben (z. B. info oder heart)',
post: '}} <!-- Alle verfügbaren Icons und ihre Namen findest du unter https://fontawesome.com/v4.7.0/icons/ -->'
}
}
},
}
}
}
}
}
} );
/* 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 );
}
} );
}
window.addEventListener("load", () => {
if(window.screen.width <= 767) {
const mobileSearch = document.createElement("a");
mobileSearch.classList.add("fa", "fa-search")
mobileSearch.setAttribute("href", "/Spezial:Suche")
mobileSearch.style.cssText = "position: absolute;z-index: 1000000;top: 50%;color: #008d8d;transform: translateX(-20px) translateY(-50%);"
document.querySelector("#right-nav-aside").prepend(mobileSearch)
}
});
