Raw Source
ankit1211 / SeekSurge

// ==UserScript==
// @name         SeekSurge
// @license      MIT
// @namespace    kalpdev
// @version      1.1
// @description  Popup predefined keywords found on a webpage for Amazon pages only 
// @match        *://*/*
//@updateURL     https://openuserjs.org/meta/ankit1211/SeekSurge.meta.js
// @downloadURL https://openuserjs.org/install/ankit1211/SeekSurge.user.js
//@include  https://*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Add your predefined keywords to this array
    var keywords = ['lithium', 'rechargeable', 'marker', 'built-in','inbuilt','li-ion','lithium-ion','3.7v','3.7V','integreted','paint marker','dry erase marker','whiteboard marker',
'18650','alkaline','cr2','cr-2','lithium metal','CR2032','cr20232','cr123a','CR123A','included battery','individually packed','li-battery','lifepo4','lipo battery','lithium batteries',
'lithium-polymer','PIEZO','Ethanol gel','ZINC AIR','PEROXIDE','non-rechargeable','spillable','NON-SPILLABLE','power bank','AGM','watt hours','watt hour','watt-hours','watt-hour','LR44','Li-polymer',
'lithium polymer battery','COMPRESSED HORN',"what's in the box",'explosives','explosive','Crackers','refrigerant','Compressor','Ethanol','isopropyl','repair kit','Isobutene','tetrafluroethane','Isobutylene',
'isobutane','chalk marker','extinguisher','ferrocerium','magnesium','flint','Fire Extinguishers','Fire starter','Ittar','Attar','Alcohol','SD alcohol','butan','butane','propane',
'aerosol','aeresols','content under pressure','Long lasting LED light','Light up with every step','the battery only one time use','Battery cannot be replaced','Battery cannot be charged','ImpulseĀ® Sensors','Q-Chip technology',' Fidelity sensor',
'8 Under Armour(UA) HOVER Sonic','Under Armour(UA) HOVER Phantom','HOVER Phantom','Under Armour Speed Form','Crocs FunLab Clogs','Heelys Plus X2',' Crocs Mules','Crocs Hatchlings','LED shoe laces',' Dinosoles 3D','Twinkle toe','EDT','EDP','EDC','Eau De','Ethyl Methacrylate',' EMA ','Methyl Methacrylate','MMA ',
'80-62-6','97-63-2',];

    if (window.location.hostname.includes('amazon') && (window.location.href.includes('/dp/') || window.location.href.includes('https://argus.aka.amazon.com/'))) {
       var searchButton = document.createElement('button');
  searchButton.innerText = 'Search Keyword';
  searchButton.style.backgroundColor = 'black';
  searchButton.style.color = 'white';
  searchButton.style.position = 'fixed';
  searchButton.style.padding = '20px';
  searchButton.style.bottom = '20px';
  searchButton.style.right = '20px';
  searchButton.style.zIndex = '9999';
  searchButton.style.boxShadow = "2px 2px 5px #888888";
  searchButton.style.borderRadius = "5px";

  var isDragging = false;
  var currentX;
  var currentY;
  var initialX;
  var initialY;
  var xOffset = 0;
  var yOffset = 0;

  searchButton.addEventListener("mousedown", dragStart);
  searchButton.addEventListener("mouseup", dragEnd);
  searchButton.addEventListener("mousemove", drag);

  function dragStart(e) {
    initialX = e.clientX - xOffset;
    initialY = e.clientY - yOffset;

    if (e.target === searchButton) {
      isDragging = true;
    }
  }

  function dragEnd(e) {
    initialX = currentX;
    initialY = currentY;

    isDragging = false;
  }

  function drag(e) {
    if (isDragging) {
      e.preventDefault();

      currentX = e.clientX - initialX;
      currentY = e.clientY - initialY;

      xOffset = currentX;
      yOffset = currentY;

      setTranslate(currentX, currentY, searchButton);
    }
  }

  function setTranslate(xPos, yPos, el) {
    el.style.transform = "translate3d(" + xPos + "px, " + yPos + "px, 0)";
  }

  searchButton.onclick = function() {
            var popup = document.createElement('div');
            popup.style.position = 'fixed';
            popup.style.top = '50%';
            popup.style.left = '50%';
            popup.style.transform = 'translate(-50%, -50%)';
            popup.style.padding = '40px';
            popup.style.background = 'grey';
            popup.style.fontWeight = 'bold';
            popup.style.color = 'black';
            popup.style.border = '1px solid white';
            popup.style.borderRadius = "5px";
            popup.style.fontSize = '18px';
            popup.style.boxShadow = "2px 2px 5px #888888";
            popup.style.zIndex = '99999';

            var closeButton = document.createElement('button');
            closeButton.innerText = 'X';
            closeButton.style.position = 'absolute';
            closeButton.style.color = 'red';
            closeButton.style.top = '0';
            closeButton.style.right = '0';
            closeButton.onclick = function() {
                document.body.removeChild(popup);
            };
            popup.appendChild(closeButton);

            var heading = document.createElement('h3');
            heading.innerText = 'Available Keywords in DP';
            heading.style.fontSize = '16px';
            heading.style.marginTop = '2px';
            popup.appendChild(heading);

            var ul = document.createElement('ul');
            keywords.forEach(function(keyword) {
                if (document.body.innerText.toLowerCase().includes(keyword.toLowerCase())) {
                    var li = document.createElement('li');
                    li.innerText = keyword;
                    ul.appendChild(li);
                }
            });
            if (ul.children.length > 0) {
                popup.appendChild(document.createElement('hr')); // add horizontal rule before the disclaimer
                var disclaimer = document.createElement('p');
                disclaimer.innerText = 'Disclaimer: Please follow MC SOP.';
                disclaimer.style.fontSize = '12px';
                disclaimer.style.marginTop = '2px';
                disclaimer.style.marginBottom = '1px';
                popup.appendChild(ul);
                ul.style.marginBottom = '2px';
                popup.appendChild(disclaimer); // add the disclaimer after the keyword list
                document.body.appendChild(popup);
            } else {
                alert('No keywords found on this page.');
            }
        };
        document.body.appendChild(searchButton);

        var timer = setTimeout(function() {
            searchButton.click();
        }, 5000);
    }
})();