Hide Temu Local Listings

Hide Temu listings from local warehouses

  1. // ==UserScript==
  2. // @license MIT
  3. // @name Hide Temu Local Listings
  4. // @namespace http://tampermonkey.net/
  5. // @version 0.1
  6. // @description Hide Temu listings from local warehouses
  7. // @author You
  8. // @match *://*.temu.com/*
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. // Text indicators that signify local listings
  16. const LOCAL_INDICATORS = [
  17. 'Local',
  18. 'local warehouse',
  19. 'Ships from nearby'
  20. ];
  21.  
  22. function hideLocalListings() {
  23. // Find the main container with the product listings
  24. const container = document.querySelector('.js-search-goodsList');
  25. if (!container) return;
  26.  
  27. // Find the autoFitList container
  28. const autoFitList = container.querySelector('.autoFitList');
  29. if (!autoFitList) return;
  30.  
  31. // Get all direct child divs of autoFitList (these are the product containers)
  32. const productContainers = autoFitList.children;
  33.  
  34. for (const productContainer of productContainers) {
  35. // Skip non-div elements
  36. if (productContainer.tagName !== 'DIV') continue;
  37.  
  38. // Get all text elements in this listing
  39. const textElements = productContainer.querySelectorAll('span, div');
  40.  
  41. // Check if any text elements contain our local indicators
  42. let isLocalListing = false;
  43. for (const element of textElements) {
  44. const text = element.textContent.trim();
  45.  
  46. // Check if text indicates a local listing
  47. if (LOCAL_INDICATORS.some(indicator => text.includes(indicator))) {
  48. isLocalListing = true;
  49. break;
  50. }
  51.  
  52. // Also check for the green color styling
  53. if (element.getAttribute('style') &&
  54. element.getAttribute('style').includes('color:#0A8800')) {
  55. isLocalListing = true;
  56. break;
  57. }
  58. }
  59.  
  60. // Hide the product container if it's a local listing
  61. if (isLocalListing) {
  62. productContainer.style.display = 'none';
  63. console.log('Hidden local listing:', productContainer);
  64. }
  65. }
  66. }
  67.  
  68. // Initial run
  69. function init() {
  70. hideLocalListings();
  71.  
  72. // Run again after a short delay to catch any lazy-loaded content
  73. setTimeout(hideLocalListings, 1500);
  74. }
  75.  
  76. // Run when DOM is ready
  77. if (document.readyState === 'loading') {
  78. document.addEventListener('DOMContentLoaded', init);
  79. } else {
  80. init();
  81. }
  82.  
  83. // Set up an observer for dynamically loaded content
  84. const observer = new MutationObserver((mutations) => {
  85. clearTimeout(window.localListingsTimer);
  86. window.localListingsTimer = setTimeout(hideLocalListings, 300);
  87. });
  88.  
  89. // Start observing changes to the body
  90. observer.observe(document.body, {
  91. childList: true,
  92. subtree: true
  93. });
  94. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址