MediaWiki:Common.js: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 8: | Line 8: | ||
function cursormove(e){ | function cursormove(e){ | ||
var x = e.clientX; | |||
var y = e.clientY; | |||
var x = e.clientX | console.log(mousestate, x, y); | ||
var y = e.clientY | |||
console.log(x, y); | |||
} | } | ||
function demoslider(){ | function demoslider(){ | ||
var cursor = document.getElementById(' | var cursor = document.getElementById('demoslider'); | ||
if(cursor != null){ | if(cursor != null){ | ||
cursor.onmousemove = cursormove; | cursor.onmousemove = cursormove; |
Revision as of 16:55, 2 July 2023
/* Any JavaScript here will be loaded for all users on every page load. */
var mousestate = 0;
function cursormousedown(){ mousestate = 1; }
function cursormouseup(){ mousestate = 0; }
function cursormove(e){
var x = e.clientX;
var y = e.clientY;
console.log(mousestate, x, y);
}
function demoslider(){
var cursor = document.getElementById('demoslider');
if(cursor != null){
cursor.onmousemove = cursormove;
cursor.onmousedown = cursormousedown;
cursor.onmouseup = cursormouseup;
}
}
function httpanim(){
var http = document.getElementById('demoHTTP');
http.innerHTML = 'POST';
http.style.top = 0;
http.style.left = 0;
http.style.display = 'flex';
var max = document.getElementById('demoHTTP').offsetWidth;
var cur = document.getElementById('demoHTTP').style.top;
if ( cur < max ) {
http.style.top = cur + 10;
setTimeout(httpanim,200);
}
else {
http.style.top = 0;
http.style.display = 'none';
}
}
function initanim(val){
var http = document.getElementById('demoHTTP');
var uart = document.getElementById('demoUART');
http.style.top = 0;
http.style.left = 0;
http.innerHTML = 'POST';
http.style.display = 'flex';
uart.style.top = 0;
uart.style.left = 0;
uart.innerHTML = val;
httpanim();
}
demoslider();