Advertisement
xpppppppaicyber

sawstump

Jul 31st, 2024
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // hapus crafting
  2. // Function to filter li elements and hide ul if no matches are found
  3. function filterAndHideUl(ulSelector) {
  4.     // Select the target ul element
  5.     const ulElement = document.querySelector(ulSelector);
  6.  
  7.     // Get all li elements within the ul
  8.     const liElements = ulElement.querySelectorAll('li');
  9.  
  10.     // Initialize a flag to track if any li element contains the target text
  11.     let hasTargetItem = false;
  12.  
  13.     // Iterate through each li element
  14.     liElements.forEach(li => {
  15.       // Check if the li element contains the text "Borebranch Tree Kit"
  16.       if (li.textContent.includes("Sawstump Plank")) {
  17.         // If it does, display it
  18.         li.style.display = 'block';
  19.         hasTargetItem = true;
  20.       } else {
  21.         // If it doesn't, hide it
  22.         li.style.display = 'none';
  23.       }
  24.     });
  25.  
  26.     // If no li elements contain the target text, hide the ul element
  27.     if (!hasTargetItem) {
  28.       ulElement.style.display = 'none';
  29.     }
  30.   }
  31.  
  32.   // Selectors for the ul elements to be processed
  33.   const ulSelectors = [
  34.     "#__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)",
  35.     "#__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)",
  36.     "#__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)",
  37.     "#__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)"
  38.   ];
  39.  
  40.   // Process each ul element
  41.   ulSelectors.forEach(selector => {
  42.     filterAndHideUl(selector);
  43.   });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement