Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // hapus crafting
- // Function to filter li elements and hide ul if no matches are found
- function filterAndHideUl(ulSelector) {
- // Select the target ul element
- const ulElement = document.querySelector(ulSelector);
- // Get all li elements within the ul
- const liElements = ulElement.querySelectorAll('li');
- // Initialize a flag to track if any li element contains the target text
- let hasTargetItem = false;
- // Iterate through each li element
- liElements.forEach(li => {
- // Check if the li element contains the text "Borebranch Tree Kit"
- if (li.textContent.includes("Sawstump Plank")) {
- // If it does, display it
- li.style.display = 'block';
- hasTargetItem = true;
- } else {
- // If it doesn't, hide it
- li.style.display = 'none';
- }
- });
- // If no li elements contain the target text, hide the ul element
- if (!hasTargetItem) {
- ulElement.style.display = 'none';
- }
- }
- // Selectors for the ul elements to be processed
- const ulSelectors = [
- "#__next > div > div.room-layout > div > div.commons_modalBackdrop__EOPaN > div > div > div > div > div > div > div.Crafting_leftPage__S3WpY > div > div.Crafting_recipeSection__2_HQt > div > div.commons_scrollArea__dCnqw.Crafting_recipelist__Ls7m5 > ul:nth-child(2)",
- "#__next > div > div.room-layout > div > div.commons_modalBackdrop__EOPaN > div > div > div > div > div > div > div.Crafting_leftPage__S3WpY > div > div.Crafting_recipeSection__2_HQt > div > div.commons_scrollArea__dCnqw.Crafting_recipelist__Ls7m5 > ul:nth-child(4)",
- "#__next > div > div.room-layout > div > div.commons_modalBackdrop__EOPaN > div > div > div > div > div > div > div.Crafting_leftPage__S3WpY > div > div.Crafting_recipeSection__2_HQt > div > div.commons_scrollArea__dCnqw.Crafting_recipelist__Ls7m5 > ul:nth-child(6)",
- "#__next > div > div.room-layout > div > div.commons_modalBackdrop__EOPaN > div > div > div > div > div > div > div.Crafting_leftPage__S3WpY > div > div.Crafting_recipeSection__2_HQt > div > div.commons_scrollArea__dCnqw.Crafting_recipelist__Ls7m5 > ul:nth-child(8)"
- ];
- // Process each ul element
- ulSelectors.forEach(selector => {
- filterAndHideUl(selector);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement