"МедиаВики:Common.js"-ны өөр хувилбарууд
(Edit) |
No edit summary |
||
1-р мөр: | 1-р мөр: | ||
function abs(l) { | |||
return l > 0 ? l : l*-1; | |||
try { | } | ||
var readyStateCheckInterval = setInterval(function() { | |||
if (document.readyState === "complete") { | |||
clearInterval(readyStateCheckInterval); | |||
try { | |||
var scroll = function(q) { | |||
try{q.style.overflowX = "auto";}catch(e){} | |||
return function (event){event.preventDefault(); | |||
var m = 0; | |||
var l = event.deltaY >= 0 ? 1 : -1; | |||
var s = setInterval(function(){ | |||
q.scrollLeft += l; | |||
m+=1; | m+=1; | ||
if(m >= | if(m >= abs(event.deltaY)){ | ||
clearInterval(s); | clearInterval(s); | ||
} | } | ||
},2); | },2); | ||
} | } | ||
} | |||
try{ | try{ | ||
document.querySelector(" | document.querySelector(".mw-content-ltr").addEventListener('wheel', scroll(document.querySelector(".mw-content-ltr"))); | ||
document.querySelector(".mw-body-content p").addEventListener('wheel', scroll); | document.querySelector(".mw-body-content p").addEventListener('wheel', scroll(document.querySelector(".mw-body-content p"),true)); | ||
} catch(e) {console.log(e);} | } catch(e) {console.log(e);} | ||
} catch(e) { | } catch(e) { | ||
console.log("Failed to register horizontal scroll due to: " + e); | console.log("Failed to register horizontal scroll due to: " + e); | ||
} | } | ||
}); | } | ||
}, 10); |
12:30, 7 Аравдугаар сар 2020-ий байдлаарх засвар
function abs(l) { return l > 0 ? l : l*-1; } var readyStateCheckInterval = setInterval(function() { if (document.readyState === "complete") { clearInterval(readyStateCheckInterval); try { var scroll = function(q) { try{q.style.overflowX = "auto";}catch(e){} return function (event){event.preventDefault(); var m = 0; var l = event.deltaY >= 0 ? 1 : -1; var s = setInterval(function(){ q.scrollLeft += l; m+=1; if(m >= abs(event.deltaY)){ clearInterval(s); } },2); } } try{ document.querySelector(".mw-content-ltr").addEventListener('wheel', scroll(document.querySelector(".mw-content-ltr"))); document.querySelector(".mw-body-content p").addEventListener('wheel', scroll(document.querySelector(".mw-body-content p"),true)); } catch(e) {console.log(e);} } catch(e) { console.log("Failed to register horizontal scroll due to: " + e); } } }, 10);