Benutzer:Totto/common.js: Unterschied zwischen den Versionen
Benutzer:Totto/common.js (Quelltext anzeigen)
Version vom 1. Februar 2021, 18:54 Uhr
, 1. Februar 2021Wikimedia gat schon hotkeys :fp:
Totto (Diskussion | Beiträge) K (function(){?anon}) |
Totto (Diskussion | Beiträge) K (Wikimedia gat schon hotkeys :fp:) |
||
Zeile 5:
var container = document.createElement("li");
container.setAttribute("class","TottoCustomContainer");
container.innerHTML='<a href="/wiki/ConanWiki:NextHints" dir="auto" title="Quick Acess Hints"
container.setAttribute("id","TottoHints");
containerQuickJump.prepend(container);
var container2 = document.createElement("li");
container2.setAttribute("class","TottoCustomContainer");
container2.innerHTML='<a href="/wiki/Vorlage:Anime-JP" dir="auto" title="Quick Acess Vorlage JP"
container2.setAttribute("id","TottoVorlageJP");
containerQuickJump.prepend(container2);
var container3 = document.createElement("li");
container3.setAttribute("class","TottoCustomContainer");
container3.innerHTML='<a onclick="scrollToBottom();" dir="auto" title="Quick Acess Down"
container3.setAttribute("id","TottoScrollDown");
containerQuickJump.prepend(container3);
//addHotkey("s","scrollToBottom");
//addHotkey("p","preview");
//AddAcessKeys();
}
Zeile 34 ⟶ 35:
}
function addToQuicklink(title,link){
var tf=document.getElementById("p-personal");
var containerQuickJump= tf.getElementsByTagName("ul")[0];
var container = document.createElement("li");
container.setAttribute("class","TottoCustomContainer");
container.innerHTML='<a href="'+link+'" dir="auto" title="Quick Acess '+title+'" >'+title+'</a>';
container.setAttribute("id","TottoHints");
containerQuickJump.prepend(container);
}
function scrollToBottom(){
window.scrollTo(0,document,0)
}
function scrollToTop(){
window.scrollTo(0,document.body.scrollHeight);
}
function addHotkey(hotkey,function_to_call){
var num= hotkey.toUpperCase().charCodeAt(0);
document.addEventListener("keydown", function(event) { const key = event.keyCode; if(key===num&&event.altKey&&event.shiftKey){ window[function_to_call](); } } );
}
Zeile 51 ⟶ 71:
function addHotkeyF(hotkey,function_to_call){
var num= hotkey.toUpperCase().charCodeAt(0);
document.addEventListener("keydown", function(event) { const key = event.keyCode; if(key===num&&event.altKey&&event.shiftKey){ function_to_call(); } } );
}
|