CI/CD / preconditions (pull_request) Successful in 2s
Native JavaScript checks / Native launcher and release tests (pull_request) Successful in 1m4s
macOS checks / Native Rust tests and unsigned build (pull_request) Successful in 1m31s
CI/CD / test_and_check_app (pull_request) Successful in 6m44s
CI/CD / Publish immutable image (pull_request) Skipped
83 lines
2.6 KiB
JavaScript
83 lines
2.6 KiB
JavaScript
(() => {
|
|
if (window.top !== window || window.__kanbanNavigation) {
|
|
return;
|
|
}
|
|
|
|
let dragging = false;
|
|
const overlay = () =>
|
|
[
|
|
...document.querySelectorAll(
|
|
'dialog[open], [role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"], [data-reka-popper-content-wrapper]',
|
|
),
|
|
].some(
|
|
(element) =>
|
|
element.getAttribute('data-state') !== 'closed' &&
|
|
element.getClientRects().length > 0 &&
|
|
getComputedStyle(element).visibility !== 'hidden',
|
|
);
|
|
|
|
const constrainScroll = () => {
|
|
if (document.documentElement) {
|
|
document.documentElement.style.overscrollBehaviorY = 'none';
|
|
}
|
|
if (document.body) {
|
|
document.body.style.overscrollBehaviorY = 'none';
|
|
}
|
|
};
|
|
constrainScroll();
|
|
document.addEventListener('DOMContentLoaded', constrainScroll, {
|
|
once: true,
|
|
});
|
|
document.addEventListener('dragstart', () => {
|
|
dragging = true;
|
|
});
|
|
document.addEventListener('dragend', () => {
|
|
dragging = false;
|
|
});
|
|
document.addEventListener('drop', () => {
|
|
dragging = false;
|
|
});
|
|
|
|
window.__kanbanNavigation = Object.freeze({
|
|
canSwipe(x, y) {
|
|
if (dragging || overlay()) {
|
|
return false;
|
|
}
|
|
for (
|
|
let element = document.elementFromPoint(x, y);
|
|
element;
|
|
element = element.parentElement
|
|
) {
|
|
if (
|
|
element.matches(
|
|
'input, textarea, select, [contenteditable]:not([contenteditable="false"]), [draggable="true"]',
|
|
)
|
|
) {
|
|
return false;
|
|
}
|
|
const style = getComputedStyle(element);
|
|
if (
|
|
/(auto|scroll)/.test(style.overflowX) &&
|
|
element.scrollWidth > element.clientWidth
|
|
) {
|
|
return false;
|
|
}
|
|
if (
|
|
style.overscrollBehaviorX === 'contain' ||
|
|
style.overscrollBehaviorX === 'none'
|
|
) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
},
|
|
step(direction) {
|
|
// The host checks canGoBack/canGoForward. JS traversal preserves SPA entries
|
|
// that WebKit's user-initiated history traversal is allowed to skip.
|
|
if (direction === -1 || direction === 1) {
|
|
window.history.go(direction);
|
|
}
|
|
},
|
|
});
|
|
})();
|