"МедиаВики:Common.js"-ны өөр хувилбарууд
МедиаВики:Common.js (кодоор харах)
12:52, 7 Аравдугаар сар 2020-ий байдлаарх засвар
, 7 Аравдугаар сар 2020no edit summary
No edit summary |
No edit summary |
||
3-р мөр: | 3-р мөр: | ||
} | } | ||
function checkOverflow(el) | function checkOverflow(el) { | ||
{ | var isOverflowing = el.clientWidth < el.scrollWidth; | ||
return isOverflowing; | |||
} | } | ||
19-р мөр: | 18-р мөр: | ||
} catch (e) {} | } catch (e) {} | ||
return function(event) { | return function(event) { | ||
if(event.deltaY > event.deltaX){ | if (abs(event.deltaY) > abs(event.deltaX)) { | ||
event.preventDefault(); | 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 { | try { | ||
var a1 =document.querySelector(".mw-content-ltr"); | var a1 = document.querySelector(".mw-content-ltr"); | ||
if(checkOverflow(a1)){ | if (checkOverflow(a1)) { | ||
a1.addEventListener('wheel', scroll(a1)); | |||
} | } | ||
var a10 = document.querySelectorAll(".mw-body-content p"); | |||
for(var z = 0; z < a10.length; z++){ | for (var z = 0; z < a10.length; z++) { | ||
if (checkOverflow(a10[z])) { | |||
a10[z].addEventListener('wheel', scroll(a10[z], true)); | a10[z].addEventListener('wheel', scroll(a10[z], true)); | ||
} | } | ||
} | } | ||
} catch (e) { | } catch (e) { | ||
console.log(e); | console.log(e); |