Skip to content

Instantly share code, notes, and snippets.

@khandar-william
Last active August 16, 2020 11:53
Show Gist options
  • Save khandar-william/cde42c8f9e1e5694ad101df09b2c52a9 to your computer and use it in GitHub Desktop.
Save khandar-william/cde42c8f9e1e5694ad101df09b2c52a9 to your computer and use it in GitHub Desktop.
// Tokopedia
function removeAdsType1() {
var adsType1 = document.querySelectorAll('a[label-atm="taProduct"]');
adsType1.forEach(function (e) {
e.parentNode.remove(e);
});
}
window.setInterval(removeAdsType1, 10000);
function removeAdsType2() {
var container = document.querySelector('div[data-testid="divSRPContentProducts"]');
var adsType2 = container.querySelectorAll('a[href*="/promo/"]');
adsType2.forEach(function (e) {
if (!e.href.match(/clicks/)) return;
var d = e.parentNode.parentNode.parentNode.parentNode;
d.parentNode.remove(d);
});
}
window.setInterval(removeAdsType2, 10000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment