Guest User

Untitled

a guest
Mar 1st, 2021
962
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         Bol.com externe verkopers
  3. // @namespace    https://www.bol.com/
  4. // @version      1.0
  5. // @description  Highlight externe verkopers
  6. // @match        https://www.bol.com/*
  7. // @grant        none
  8. // ==/UserScript==
  9.  
  10. (function() {
  11.     'use strict';
  12.     let removeSearchResults = false;
  13.  
  14.     if(window.location.href.indexOf('bol.com/nl/s/') > -1) {
  15.         highlightExternalSellersInSearch(removeSearchResults);
  16.     }
  17.     else if (window.location.href.indexOf('bol.com/nl/p/') > -1) {
  18.         highlightExternalSellerOnProductPage();
  19.     }
  20.  
  21. })();
  22.  
  23. function highlightExternalSellersInSearch(removeSearchResults) {
  24.     let sellers = document.querySelectorAll('.product-seller');
  25.  
  26.     sellers.forEach(function(seller) {
  27.         if (seller.innerHTML.indexOf('bol.com') === -1) {
  28.             let productRow = seller.closest('.product-item--row');
  29.  
  30.             if (removeSearchResults) {
  31.                 productRow.remove();
  32.             } else {
  33.                 productRow.style.background = "rgba(255, 188, 163)";
  34.             }
  35.         }
  36.     });
  37. }
  38.  
  39. function highlightExternalSellerOnProductPage() {
  40.     let seller = document.querySelector('.product-seller');
  41.  
  42.     if (seller.innerHTML.indexOf('bol.com') === -1) {
  43.         seller.style.background = "rgba(255, 188, 163)";
  44.         seller.innerHTML = '<span style="color: red; font-weight: bold">Let op!</span>' + seller.innerHTML;
  45.     }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment