Difference between revisions of "MediaWiki:Common.js"
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
/* Das folgende JavaScript wird für alle Benutzer geladen. */ | /* Das folgende JavaScript wird für alle Benutzer geladen. */ | ||
+ | |||
+ | /** | ||
+ | * Füge eigene Buttons zur Symbolleiste hinzu | ||
+ | * | ||
+ | * @source: http://www.mediawiki.org/wiki/Snippets/Custom_buttons_in_the_toolbar | ||
+ | * @rev: 1 | ||
+ | */ | ||
+ | if ( $.isArray( window.mwCustomEditButtons ) ) { | ||
+ | |||
+ | // Neuen Button zum Einfügen einer Wikitabelle hinzufügen | ||
+ | mwCustomEditButtons[mwCustomEditButtons.length] = { | ||
+ | 'imageFile': 'http://upload.wikimedia.org/wikipedia/commons/0/04/Button_array.png', | ||
+ | 'speedTip': 'Wikitabelle einfügen', | ||
+ | 'tagOpen': '{| class="wikitable"\n|-\n', | ||
+ | 'tagClose': "\n|}", | ||
+ | 'sampleText': "! Kopfzeile 1\n! Kopfzeile 2\n! Kopfzeile 3\n|-\n| Kopfzeile 1, Spalte 1\n| Zeile 1, Spalte 2\n| Zeile 1, Spalte 3\n|-\n| Zeile 2, Spalte 1\n| Zeile 2, Spalte 2\n| Zeile 2, Spalte 3" | ||
+ | }; | ||
+ | |||
+ | } | ||
function nav_top_test() { | function nav_top_test() { | ||
Line 94: | Line 113: | ||
} | } | ||
window.onload = nav_top_test; | window.onload = nav_top_test; | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Revision as of 10:40, 30 November 2012
/* Das folgende JavaScript wird für alle Benutzer geladen. */
/**
* Füge eigene Buttons zur Symbolleiste hinzu
*
* @source: http://www.mediawiki.org/wiki/Snippets/Custom_buttons_in_the_toolbar
* @rev: 1
*/
if ( $.isArray( window.mwCustomEditButtons ) ) {
// Neuen Button zum Einfügen einer Wikitabelle hinzufügen
mwCustomEditButtons[mwCustomEditButtons.length] = {
'imageFile': 'http://upload.wikimedia.org/wikipedia/commons/0/04/Button_array.png',
'speedTip': 'Wikitabelle einfügen',
'tagOpen': '{| class="wikitable"\n|-\n',
'tagClose': "\n|}",
'sampleText': "! Kopfzeile 1\n! Kopfzeile 2\n! Kopfzeile 3\n|-\n| Kopfzeile 1, Spalte 1\n| Zeile 1, Spalte 2\n| Zeile 1, Spalte 3\n|-\n| Zeile 2, Spalte 1\n| Zeile 2, Spalte 2\n| Zeile 2, Spalte 3"
};
}
function nav_top_test() {
var a = window.location.href;
var c = document.getElementById("seite_aktuell");
var d = document.getElementById("top_nav_link1");
var e = document.getElementById("top_nav_link2");
var f = document.getElementById("top_nav_link3");
switch (true) {
case /vis_ttni_de/.test(a):
c.innerHTML = "Visuell";
d.href = "http://www.thinktanknetworkresearch.net/wiki_ttni_de/index.php?title=Hauptseite";
d.innerHTML = "Wiki";
e.href = "http://www.thinktanknetworkresearch.net/blog_ttni_de/";
e.innerHTML = "Blog";
f.href = "http://www.thinktanknetworkresearch.net/strt_ttni_de/index.html";
f.innerHTML = "Startseite";
break;
case /vis_ttni_en/.test(a):
c.innerHTML = "visual";
d.href = "http://www.thinktanknetworkresearch.net/wiki_ttni_en/index.php?title=Main_Page";
d.innerHTML = "Wiki";
e.href = "http://www.thinktanknetworkresearch.net/blog_ttni_en/";
e.innerHTML = "Blog";
f.href = "http://www.thinktanknetworkresearch.net/strt_ttni_en/index.html";
f.innerHTML = "Main Page";
break;
case /wiki_ttni_de/.test(a):
c.innerHTML = "Wiki";
d.href = "http://www.thinktanknetworkresearch.net/vis_ttni_de/";
d.innerHTML = "Visuell";
e.href = "http://www.thinktanknetworkresearch.net/blog_ttni_de/";
e.innerHTML = "Blog";
f.href = "http://www.thinktanknetworkresearch.net/strt_ttni_de/index.html";
f.innerHTML = "Startseite";
break;
case /wiki_ttni_en/.test(a):
c.innerHTML = "Wiki";
d.href = "http://www.thinktanknetworkresearch.net/vis_ttni_en/";
d.innerHTML = "visual";
e.href = "http://www.thinktanknetworkresearch.net/blog_ttni_en/";
e.innerHTML = "Blog";
f.href = "http://www.thinktanknetworkresearch.net/strt_ttni_en/index.html";
f.innerHTML = "Main Page";
break;
case /blog_ttni_de/.test(a):
c.innerHTML = "Blog";
d.href = "http://www.thinktanknetworkresearch.net/wiki_ttni_de/index.php?title=Hauptseite";
d.innerHTML = "Wiki";
e.href = "http://www.thinktanknetworkresearch.net/vis_ttni_de/";
e.innerHTML = "Visuell";
f.href = "http://www.thinktanknetworkresearch.net/strt_ttni_de/index.html";
f.innerHTML = "Startseite";
break;
case /strt_ttni_de/.test(a):
c.innerHTML = "Startseite";
d.href = "http://www.thinktanknetworkresearch.net/wiki_ttni_de/index.php?title=Hauptseite";
d.innerHTML = "Wiki";
e.href = "http://www.thinktanknetworkresearch.net/vis_ttni_de/";
e.innerHTML = "Visuell";
f.href = "http://www.thinktanknetworkresearch.net/blog_ttni_de/";
f.innerHTML = "Blog";
break;
case /strt_ttni_en/.test(a):
c.innerHTML = "Main Page";
d.href = "http://www.thinktanknetworkresearch.net/wiki_ttni_en/index.php?title=Main_Page";
d.innerHTML = "Wiki";
e.href = "http://www.thinktanknetworkresearch.net/vis_ttni_en/";
e.innerHTML = "visual";
f.href = "http://www.thinktanknetworkresearch.net/blog_ttni_en/";
f.innerHTML = "Blog";
break;
default:
c.innerHTML = "Startseite";
break;
}
var b = /_ttni_en/;
if (b.test(a)) {
document.getElementById("spr_en").style.textDecoration = "underline";
document.getElementById("spr_de").style.textDecoration = "none";}
else {
document.getElementById("spr_en").style.textDecoration = "none";
document.getElementById("spr_de").style.textDecoration = "underline";}
}
function deutsch() {
var haddr = window.location.host;
location.href = "http://" + haddr + "/wiki_ttni_de/index.php";
}
function english() {
var haddr = window.location.host;
location.href = "http://" + haddr + "/wiki_ttni_en/index.php";
}
window.onload = nav_top_test;