kalpdev.1 / Attcheck

// ==UserScript==
// @name         Attcheck
// @author      @shjaisw
// @namespace    Kalpdev
// @version      1.0
// @description  Find if there is any document attached from seller.
// @match        https://www.amazon.com/dp/*
// @license MIT
// @grant        none
// ==/UserScript==

(function() {
  'use strict';

  var wordsToSearch = [
    "pdf",
    "gl_digital_products_22_accessory",
    "gl_fsn_devices",
    "gl_sud_devices",
    "gl_digital_devices_4",
    "gl_digital_products_9",
    "gl_digital_products_3",
    "gl_digital_products_18_accessory",
    "gl_digital_text_2",
    "gl_digital_text",
    "gl_zephyr"
  ];

  function createPopup(message) {
    var popup = document.createElement("div");
    popup.textContent = message;

    popup.style.position = "fixed";
    popup.style.top = "50%";
    popup.style.left = "50%";
    popup.style.transform = "translate(-50%, -50%)";
    popup.style.backgroundColor = "#FFCE33";
    popup.style.padding = "30px";
    popup.style.boxShadow = "0px 0px 10px rgba(0, 0, 0, 0.5)";
    popup.style.zIndex = "999";

    var closeButton = document.createElement("button");
    closeButton.textContent = "X";
    closeButton.style.marginTop = "1px";
    closeButton.addEventListener("click", function() {
      document.body.removeChild(popup);
    });

    popup.appendChild(closeButton);

    document.body.appendChild(popup);
  }

  function searchForWords() {
    var pageText = document.body.textContent.toLowerCase();

    wordsToSearch.forEach(function(word) {
      if (pageText.includes(word)) {
        createPopup("Document is attached to this Marketplace");
      }
    });
  }

  setTimeout(function() {
    searchForWords();
  }, 3000);
})();