-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hide the recycle message on the item page.
- Loading branch information
1 parent
d411d61
commit 3527917
Showing
5 changed files
with
52 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
extension/scripts/features/hide-recycle-message/ttHideRecycleMessage.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
"use strict"; | ||
|
||
(async () => { | ||
if (!getPageStatus().access) return; | ||
|
||
featureManager.registerFeature( | ||
"Hide Recycle Message", | ||
"items", | ||
() => settings.pages.items.hideRecycleMessage, | ||
null, | ||
hideMessage, | ||
showMessage, | ||
{ | ||
storage: ["settings.pages.items.hideRecycleMessage"], | ||
}, | ||
null | ||
); | ||
|
||
function hideMessage() { | ||
const recycleMessageElement = document.evaluate( | ||
"//*[contains(@class, 'info-msg-cont')][.//*[contains(text(), 'clear up your inventory')]]", | ||
document, | ||
null, | ||
XPathResult.FIRST_ORDERED_NODE_TYPE, | ||
null | ||
).singleNodeValue; | ||
if (!recycleMessageElement) return; | ||
|
||
const delimiter = recycleMessageElement.previousElementSibling; | ||
|
||
console.log("DKK warning", recycleMessageElement); | ||
|
||
recycleMessageElement.dataset.type = "recycle-message"; | ||
recycleMessageElement.classList.add("tt-hidden"); | ||
delimiter.dataset.type = "recycle-message"; | ||
delimiter.classList.add("tt-hidden"); | ||
} | ||
|
||
function showMessage() { | ||
document.findAll(".tt-hidden[data-type='recycle-message']").forEach((hidden) => { | ||
hidden.classList.remove("tt-hidden"); | ||
}); | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters