mirror of
https://github.com/turtlebasket/userscripts.git
synced 2026-03-05 03:54:30 -08:00
add regex urlpath filters
This commit is contained in:
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
let hideEls = [];
|
let hideEls = [];
|
||||||
let focusing = false;
|
let focusing = false;
|
||||||
|
let urlPath = new URL(window.location.href).pathname;
|
||||||
|
|
||||||
// title bar links - custom behavior for now
|
// title bar links - custom behavior for now
|
||||||
const titleBarExclude = ["Explore", "Marketplace", "Codespaces"];
|
const titleBarExclude = ["Explore", "Marketplace", "Codespaces"];
|
||||||
@@ -27,11 +28,12 @@ for (let i = 0; i < titleBarEls.length; i++) {
|
|||||||
// general exclusion list
|
// general exclusion list
|
||||||
|
|
||||||
[
|
[
|
||||||
["mail-status unread", [0], /.*/],
|
["mail-status unread", [0], /^.*$/],
|
||||||
["UnderlineNav-item", [1], /^\/$/],
|
["UnderlineNav-item", [1], /^\/$/],
|
||||||
]
|
]
|
||||||
.forEach(([className, hideIndices, pageRegex]) => {
|
.forEach(([className, hideIndices, pathRegex]) => {
|
||||||
hideIndices.forEach(i => {
|
hideIndices.forEach(i => {
|
||||||
|
if (urlPath.search(pathRegex) > -1) {
|
||||||
let el = document.getElementsByClassName(className)[i];
|
let el = document.getElementsByClassName(className)[i];
|
||||||
if (typeof el === 'undefined') {
|
if (typeof el === 'undefined') {
|
||||||
console.log(`focus mode: unable to find element ${className} [ ${i} ]`)
|
console.log(`focus mode: unable to find element ${className} [ ${i} ]`)
|
||||||
@@ -39,6 +41,7 @@ for (let i = 0; i < titleBarEls.length; i++) {
|
|||||||
else {
|
else {
|
||||||
hideEls.push(el);
|
hideEls.push(el);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user