misc: uh what happened here
This commit is contained in:
@ -9,7 +9,7 @@
|
||||
// @run-at document-idle
|
||||
// @homepageURL https://gitlab.com/tretrauit/scripts
|
||||
// @supportURL https://gitlab.com/tretrauit/scripts/-/issues
|
||||
// @downloadURL https://gitlab.com/tretrauit/scripts/-/raw/main/userscripts/hidemy.name-free-ipport-export.user.js.user.js
|
||||
// @downloadURL https://gitlab.com/tretrauit/scripts/-/raw/main/userscripts/hidemy.name-free-ipport-export.user.js
|
||||
// ==/UserScript==
|
||||
|
||||
setTimeout(function() {
|
||||
|
||||
@ -32,6 +32,9 @@ function findElement(tag, properties) {
|
||||
}
|
||||
|
||||
function getAncestor(element, level) {
|
||||
if (element == null) {
|
||||
return null;
|
||||
}
|
||||
for (let i = 0; i < level; i++) {
|
||||
element = element.parentNode;
|
||||
}
|
||||
@ -39,29 +42,42 @@ function getAncestor(element, level) {
|
||||
}
|
||||
|
||||
console.log("Scanning class for components...");
|
||||
// Search box
|
||||
let searchBox = findElement("input", {"aria-autocomplete": "list"});
|
||||
if (searchBox != null) {
|
||||
searchBox = getAncestor(searchBox, 7);
|
||||
if (searchBox == null) {
|
||||
console.warn("Failed to get searchBox element.");
|
||||
throw new Error();
|
||||
}
|
||||
let textHeader = findElement("span", {"style": "line-height: 28px;"});
|
||||
searchBox = getAncestor(searchBox, 7);
|
||||
// Header & Text header
|
||||
let textHeader = findElement("span", {"style": "line-height: var(--base-line-clamp-line-height); --base-line-clamp-line-height:28px;"});
|
||||
let header;
|
||||
if (textHeader != null) {
|
||||
header = getAncestor(textHeader, 7);
|
||||
textHeader = textHeader.childNodes[0];
|
||||
if (textHeader == null) {
|
||||
console.warn("Failed to get textHeader element.");
|
||||
throw new Error();
|
||||
}
|
||||
header = getAncestor(textHeader, 7);
|
||||
textHeader = textHeader.childNodes[0];
|
||||
// Unread indicator
|
||||
let unreadIndicator = findElement("span", {"data-visualcompletion": "ignore"});
|
||||
// Action bar
|
||||
let actionBar = findElement("div", {"aria-expanded": "false"});
|
||||
if (actionBar != null) {
|
||||
actionBar = actionBar.parentNode;
|
||||
if (actionBar == null) {
|
||||
console.warn("Failed to get actionBar element.");
|
||||
throw new Error();
|
||||
}
|
||||
actionBar = actionBar.parentNode;
|
||||
// Chats
|
||||
let chats = findElement("div", {"aria-label": "Chats"});
|
||||
if (chats != null) {
|
||||
chats = chats.parentNode;
|
||||
if (chats == null) {
|
||||
console.warn("Failed to get chats element.");
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
chats = chats.parentNode;
|
||||
// Print elements
|
||||
console.log("Search box:", searchBox);
|
||||
console.log("Header:", header);
|
||||
console.log("Text header:", textHeader);
|
||||
console.log("Unread message indicator:", unreadIndicator);
|
||||
console.log("Action bar:", actionBar);
|
||||
console.log("Chat tab:", chats);
|
||||
console.log("Chat tab:", chats);
|
||||
|
||||
Reference in New Issue
Block a user