Benutzer:Kameloid/vector.js: Unterschied zwischen den Versionen

aus Kamelopedia, der wüsten Enzyklopädie
Zur Navigation springen Zur Suche springen
K (-wgArticlePath, tut irgendwie nicht...)
K (+wgScript)
 
Zeile 4: Zeile 4:
 
enableKamelionaryPreload = true;
 
enableKamelionaryPreload = true;
 
var hwNS = new Array("", "File", "News");
 
var hwNS = new Array("", "File", "News");
var linksPrefix = wgServer + "/index.php";
+
var linksPrefix = wgServer + wgScript;
 
/**********************************addNaviLinks***********************************
 
/**********************************addNaviLinks***********************************
 
  * Ergänzt Links und Menüs im Naviagtions Bereich
 
  * Ergänzt Links und Menüs im Naviagtions Bereich

Aktuelle Version vom 21. Juni 2012, 18:56 Uhr

// Dankend geklaut bei WP-Benutzer:Dbenzhuser/monobook.js 
//(und zur Unkenntlichkeit verwüstet durch WP-Benutzer:DanSy)
//****************Globale Variabeln***********************************************
enableKamelionaryPreload = true;
var hwNS = new Array("", "File", "News");
var linksPrefix = wgServer + wgScript;
/**********************************addNaviLinks***********************************
 * Ergänzt Links und Menüs im Naviagtions Bereich
 *************************************************
 * ("Menu_xxxxx", "Link", "Anzeigetext")
 * Menu_xxxxx=irgend ein intelligenter ID-name ("Menu_" muss sein)
 *********************************************************************************/
var linksMenu = new Array(); var cnt=0;
linksMenu [cnt] = new Array("Menu_nv_favoriten","http://tools.wikimedia.de/~tangotango/mayflower/search.php?q=&t=n","Mayflower");++cnt;
linksMenu [cnt] = new Array("Menu_nv_favoriten","http://www.flickr.com/","Flicker");++cnt;
linksMenu [cnt] = new Array("Menu_nv_favoriten","http://www.testkamelopedia.de/index.php?title=Spezial:Letzte_%C3%84nderungen","Test-Kamelo");++cnt;

linksMenu [cnt] = new Array("Menu_co_favoriten","Kamelopedia:BaustellenListe/Zur_Beerdigung_vorgeschlagener_Artikel","Vorhof Gruft");++cnt;
linksMenu [cnt] = new Array("Menu_co_favoriten","Kamelopedia:REDIRECT_nicht_bestatten","REDIRECT 2->1");++cnt;
linksMenu [cnt] = new Array("Menu_co_favoriten","Kategorie:Kamelopedia_Baustelle","Baustellen");++cnt;
linksMenu [cnt] = new Array("Menu_co_favoriten",linksPrefix+"?limit=50&title=Spezial%3ABeitr%E4ge&contribs=newbie&namespace=&year=&month=-1","Newbie Contributs");++cnt;
linksMenu [cnt] = new Array("Menu_co_favoriten","MediaWiki:vector.js","vector.js");++cnt;
linksMenu [cnt] = new Array("Menu_co_favoriten","MediaWiki:vector.css","vector.css");++cnt;
linksMenu [cnt] = new Array("Menu_co_favoriten","MediaWiki:common.js","common.js");++cnt;
linksMenu [cnt] = new Array("Menu_co_favoriten","MediaWiki:common.css","common.css");++cnt;
linksMenu [cnt] = new Array("Menu_co_favoriten","Hilfe:Edittools.js","Edittools.js");++cnt;

linksMenu [cnt] = new Array("Menu_tb_help","http://www.w3schools.com/cssref/","cssref");++cnt;
linksMenu [cnt] = new Array("Menu_tb_help","http://de.selfhtml.org/","selfhtml");++cnt;
linksMenu [cnt] = new Array("Menu_tb_help","http://de.wikipedia.org/wiki/Kategorie:Vorlage:Tabellenformatierung","Tabellen");++cnt;
linksMenu [cnt] = new Array("Menu_tb_help","http://de.wikipedia.org/wiki/Webfarben","Webfarben");++cnt;
linksMenu [cnt] = new Array("Menu_tb_help","http://semeb.com/dpldemo/index.php?title=DPL:Manual","DPL:Manual");++cnt;
linksMenu [cnt] = new Array("Menu_tb_help","http://www.mediawiki.org/wiki/Help:Extension:ParserFunctions","ParserF");++cnt;
linksMenu [cnt] = new Array("Menu_tb_help","http://www.mediawiki.org/wiki/Extension:StringFunctions","StringF");++cnt;
linksMenu [cnt] = new Array("Menu_tb_help","http://www.mediawiki.org/wiki/Extension:VariablesExtension","VariablesExt");++cnt;
linksMenu [cnt] = new Array("Menu_tb_help","http://www.mediawiki.org/wiki/Help:Magic_words","Magic_words");++cnt;

/*******************************************************************************
 * Ergänzt Link im Navigation-Linkbereich. ("nv", "Link", "Anzeigetext")
 * Ergänzt Link im Mitmachen-Linkbereich. ("co", "Link", "Anzeigetext")
 * Ergänzt Link im Werkezuge-Linkbereich. ("tb", "Link", "Anzeigetext")
 * Ergänzt ein Menü ("tb"/"co"/"nv", "Menu_xxxxx", "Anzeigetext")
 * Ergänzt einen Trennstrich ("tb", "", "")
 *******************************************************************************/
var links = new Array();var cnt = 0;
//********Navigation-Linkbereich
links[cnt] = new Array("nv","","");++cnt;
links[cnt] = new Array("nv","Menu_nv_favoriten","Favoriten");++cnt;

//********Mitmachen-Linkbereich
links[cnt] = new Array("co","","");++cnt;
links[cnt] = new Array("co","Menu_co_favoriten","Favoriten");++cnt;

//********Werkzeug-Linkbereich
links[cnt] = new Array("tb","","");++cnt;
links[cnt] = new Array("tb","Kamel:"+wgUserName+"/vector.js","Mein js");++cnt;
links[cnt] = new Array("tb","Kamel:"+wgUserName+"/vector.css","Mein css");++cnt;
links[cnt] = new Array("tb","Menu_tb_help","Scripthelp");++cnt;
//********************************************************************************
jQuery(document).ready(function addNaviLinks(){
        //var user = document.getElementById( 'pt-userpage' ).firstChild.firstChild.data;

//        var ContentSub = document.getElementById("contentSub"); 
//        ContentSub.appendChild(document.createTextNode("Ich bins"));

	var navigationUl = document.getElementById("p-Navigation").getElementsByTagName("ul");
	var contribiuteUl = document.getElementById("p-Mitmachen").getElementsByTagName("ul");
	var ToolboxUl = document.getElementById("p-tb").getElementsByTagName("ul");

	for (var i=0; i < links.length; ++i) {
           //*******add Link / dash / menu to "li"***************
           var li=CreateLIaddURL(links[i][1],links[i][2],0);
	   //*******choose where to add
	   if (links[i][0]=="nv"){navigationUl[0].appendChild(li);}
	   if (links[i][0]=="co"){contribiuteUl[0].appendChild(li);}
	   if (links[i][0]=="tb"){ToolboxUl[0].appendChild(li);}
	}
})
//****************Erstellt ein Objekt "Li" und bastelt "url" & "text" dazu********
function CreateLIaddURL(url,text,pad){
	var li = document.createElement("li");
	li.style.whiteSpace = "nowrap";

	//*******add Link / dash / menu to "li"***************
	if (url!=""){
	   var a = document.createElement("a");
	   li.appendChild(a);
	   a.title = url;
	   if (url.substr(0,5)=="Menu_"){
               a.id = "T" + url;
	       a.appendChild(document.createTextNode("► "+text));
	       a.href = 'javascript:DisplayMenu("'+ url +'")';
	       li.appendChild(BuildMenu(url));
           }else{
               a.appendChild(document.createTextNode(text));
 	       if (pad==1){a.style.paddingLeft="15px"};
               if (url.substr(0,5).toLowerCase() =="http:"){
	           a.href = url;
	       }else{
		   a.href = linksPrefix +"/"+ url;
	       }
          }
	}else{
	   li.appendChild(document.createTextNode(" ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅"));
           li.style.color= "Gainsboro";
           li.style.height= "1px";
	}
        return li;
}
//****************Ein/Ausklapp Menü***********************************************
function DisplayMenu(MNid){
   var navMNid = document.getElementById(MNid);
   var navTMNid = document.getElementById("T" + MNid);
   var navTtext = navTMNid.text.substr(1,50);
   if (navMNid.style.display=="none"){
      navTMNid.text = "▼"+navTtext;
      navMNid.style.display="block";
   }else{
      navTMNid.text = "►"+navTtext;
      navMNid.style.display="none";
   }
}
//****************Bastelt eine Div & ul & li & a aus var linksMenu[]**************
function BuildMenu(MNid){
  var div = document.createElement("div");
  div.id = MNid;
  div.style.display = "none";
  div.style.border = "0px solid black";
  div.style.width = "100%";
  //div.style.height = "40px";
  div.style.position = "relative";
  div.style.overflow = "auto";
  var mn = document.createElement("ul");mn.id="UL_"+MNid;
  //*****Build Menu
  for (var ii=0; ii < linksMenu.length; ++ii) {
     if (linksMenu[ii][0]==MNid){mn.appendChild(CreateLIaddURL(linksMenu[ii][1],linksMenu[ii][2],1))}
  }
  div.appendChild(mn);
  return div;
}
/*********************************************************************************
 * Ende addNaviLinks
 *********************************************************************************/