МедиаВики:Common.js: Засвар хоорондын ялгаа
Харагдац
No edit summary |
No edit summary |
||
| 1-р мөр: | 1-р мөр: | ||
var ___mendee_shiftKey_active__ = false; | |||
/** | /** | ||
* | * | ||
| 17-р мөр: | 19-р мөр: | ||
return isOverflowing; | return isOverflowing; | ||
} | |||
try { | |||
window.addEventListener('keydown', function (event) { | |||
if (event.key === "Shift") { | |||
___mendee_shiftKey_active__ = true; | |||
} | |||
}); | |||
window.addEventListener('keyup', function (event) { | |||
if (event.key === "Shift") { | |||
___mendee_shiftKey_active__ = false; | |||
} | |||
}); | |||
} catch (error) { | |||
} | } | ||
| 36-р мөр: | 53-р мөр: | ||
} catch (e) { } | } catch (e) { } | ||
return function (event) { | return function (event) { | ||
if ( | if (___mendee_shiftKey_active__) { | ||
return; | return; | ||
} | } | ||
23:43, 17 Хоёрдугаар сар 2025-ий байдлаарх засвар
var ___mendee_shiftKey_active__ = false;
/**
*
* @param l number
* @returns {number} absolute value of l
*/
function abs(l) {
return l > 0 ? l : l * -1;
}
/**
*
* @param el HTMLElement
* @returns {boolean} Whether the element is overflowing horizontally
*/
function checkOverflow(el) {
var isOverflowing = el.clientWidth < el.scrollWidth;
return isOverflowing;
}
try {
window.addEventListener('keydown', function (event) {
if (event.key === "Shift") {
___mendee_shiftKey_active__ = true;
}
});
window.addEventListener('keyup', function (event) {
if (event.key === "Shift") {
___mendee_shiftKey_active__ = false;
}
});
} catch (error) {
}
var readyStateCheckInterval = setInterval(function () {
if (document.readyState !== "complete") {
return;
}
clearInterval(readyStateCheckInterval);
try {
/**
*
* @param q EventTarget
* @returns
*/
var scroll = function (q) {
try {
q.style.overflowX = "auto";
} catch (e) { }
return function (event) {
if (___mendee_shiftKey_active__) {
return;
}
var absdy = abs(event.deltaY);
if (absdy <= abs(event.deltaX)) {
return;
}
event.preventDefault();
q.scrollLeft += event.deltaY
};
};
try {
var bodyContentElement = document.querySelector("#bodyContent");
if (checkOverflow(bodyContentElement)) {
bodyContentElement.addEventListener('wheel', scroll(bodyContentElement), { passive: false });
}
} catch (e) {
console.log(e);
}
} catch (e) {
console.log("Failed to register horizontal scroll due to: " + e);
}
}, 10);