Benutzer:Totto/common.js: Unterschied zwischen den Versionen

Zur Navigation springen Zur Suche springen
K
error?
K (onlinecounter)
K (error?)
Zeile 29:
//addHotkey("p","preview");
//AddAcessKeys();
onlinecounter();
}
Zeile 111:
}
function refresh(){
onlinecounter();
}
 
function onlinecounter(){
var url="https://conanwiki.org/wiki/Spezial:Wer_ist_gerade_online"
fetch(url).then(function (response)=> {
// The API call was successful!
return response.text();
}).then(function (html)=> {
var num=0;
// Convert the HTML string into a document object
Zeile 125:
var doc = parser.parseFromString(html, 'text/html');
var cont=document.getElementById("TottoOnlineCounter").getElementsByTagName("a")[0];
var c=doc.getElementById("mw-content-text");
num=c.getElementsByTagName("ul")[0].getElementsByTagName("li").length;
cont.innerHTML=num;
console.log(num);
}).catch(function (err)=> {
// There was an error
console.warn('Something went wrong.', err);
1.060

Bearbeitungen

Navigationsmenü