Zum Inhalt springen
Wikipedia Die freie Enzyklopädie

Benutzer:Hlambert63/common.js

aus Wikipedia, der freien Enzyklopädie

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
  • Edge: Strg+F5 drücken oder Strg drücken und gleichzeitig Aktualisieren anklicken
 console.log("+++ --- start of common");
 popupShortcutKeys=true;
 popupShortCutKeys=true;// von mir
 popupHideDelay=0;
 popupOnlyArticleLinks=false;
 popupMaxWidth=500;
 popupPreviewFirstParOnly=false;
 popupPreviewFirstPartOnly=false;// von mir
 // popupPreviewKillTemplates = true; // default
 popupPreviewKillTemplates=false;
 popupStructure='menus';// for long menus
 popupLazyPreviews=false;// load popup data since available; true: loads, if visible 

 // 05.11.2023 shortdesc helper for show short descr. from wikidata object
 mw.loader.getScript('https://en.wikipedia.org/w/load.php?modules=ext.gadget.libSettings').then(function(){
 mw.loader.load('https://en.wikipedia.org/w/load.php?modules=ext.gadget.Shortdesc-helper');
 });

 // load tabellenstile 
 mw.loader.load('https://de.wikipedia.org/wiki/Vorlage:Tabellenstile/styles.css?action=raw&ctype=text/css','text/css');

 // add class 'tabelle-kopf-fixiert' to all elements with class "wikitable"

 // debugger;
 constaddFunc=function(element){
 // console.log( "+++ +++ in func" );
 if(element.classList&&!element.classList.contains('tabelle-kopf-fixiert')){
 constthElements=element.getElementsByTagName('th');
 // console.log("+ + + th elements length: " + thElements.length);
 varmaxHeight=0;
 for(vari=0;thElements&&i<thElements.length;i++){
 constthElem=thElements[i];
 // debugger;
 // console.log("+ + + th element at " + i + " is: " + thElem + " cl.height: " + thElem.clientHeight + " offs.height: " + thElem.offsetHeight);
 if(thElem.clientHeight>maxHeight){
 maxHeight=thElem.clientHeight;
 }
 }
 // console.log("+ + + maxHeight of th elements: " + maxHeight + " win.innerH*0.2: " + window.innerHeight*0.2 );
 if(maxHeight>window.innerHeight*0.2){
 // console.log("+ + + maxHeight > win.innerH*0.2, return, no add class ");
 return;
 }
 element.classList.add('tabelle-kopf-fixiert');
 // console.log( "+++ +++ added 'tabelle-kopf-fixiert' to wikitable" );
 }
 };
 constwikiTabClassElements=document.getElementsByClassName("wikitable");
 // console.log("+++ wikiTabClassElements is: "+ wikiTabClassElements);
 if(wikiTabClassElements&&wikiTabClassElements.length>0){

 constelemsLen=wikiTabClassElements.length;
 // console.log("+++ +++ wikiTabClassElement has " + elemsLen + " elements");

 if(elemsLen==1){
 constsingleElem=wikiTabClassElements[0];
 addFunc(singleElem);
 }else{
 vari=0;
 while(i<elemsLen){
 constelem=wikiTabClassElements[i];
 i++;
 // console.log("+++ +++ wikiTabClassElement: " + elem + " i=" + i);
 addFunc(elem);
 }// end loop
 }// end else
 }// end if wikitable elems

 // Beobachtungslisten-Helferlein

 /*
 mw.loader.load("https://en.wikipedia.org/w/index.php?title=User:PerfektesChaos/js/listPageOptions/r.js&action=raw&bcache=1&maxage=604800&ctype=text/javascript",
  "text/javascript");
 if ( typeof mw.libs.listPageOptions !== "object" ) {
  mw.libs.listPageOptions = { };
 }
 mw.libs.listPageOptions.lower = false;
 mw.libs.listPageOptions.luxury = true;
 */

 // Beob.liste: move node "Als gelesen" down / dont work
 /* 
 const elementsToMove = document.getElementsByClassName("mw-rcfilters-ui-watchlistTopSectionWidget-savedLinksTable");
 if ( elementsToMove && elementsToMove.length == 1) {
  console.log( "watchlist 'mark as readed' to move found");

 } else {
  console.log( "no watchlist 'mark as readed' to move found: " + ( elementsToMove ? elementsToMove.length : elementsToMove ) );
 } */

 // Change title of 'Aend. an verlinkten Seiten'

 constallUrlParams=window.location.search,suchStr="target=";
 // debugger;
 if(allUrlParams.indexOf(suchStr)>=0){
 constabTarg=allUrlParams.substring(allUrlParams.indexOf(suchStr));
 constindNextPar=abTarg.indexOf('&');
 constcolonInd=abTarg.indexOf('%3A');
 if(colonInd<indNextPar){
 varnewTitle;
 if(colonInd>=0){
 newTitle="Ae "+abTarg.substring(suchStr.length,suchStr.length+1)+':'+abTarg.substring(colonInd+3,indNextPar);
 }else{
 newTitle="Ae Li "+abTarg.substring(7,indNextPar);
 }
 newTitle=newTitle.replace('%28',"(");
 newTitle=newTitle.replace('%29',")");
 newTitle=newTitle.replace('+'," ");// 2 x + in 'Essen+und+Trinken'
 newTitle=newTitle.replace('+'," ");

 newTitle=newTitle.replace('%C3%A4',"ä");
 newTitle=newTitle.replace('%C3%BC',"ü");
 newTitle=newTitle.replace('%C3%B6',"ö");

 newTitle=newTitle.replace('%2F',"/");

 document.title=newTitle;
 }
 }

 console.log("+++ --- end of common");

AltStyle によって変換されたページ (->オリジナル) /