NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Popup Keywords // @license MIT // @namespace http://tampermonkey.net/ // @version 1.0 // @description Popup predefined keywords found on a webpage // @match *://*/* // @grant none // ==/UserScript== (function() { 'use strict'; // Add your predefined keywords to this array var keywords = ['lithium', 'rechargeable', 'marker','built-in']; 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"; 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 = '20px'; popup.style.background = 'black'; popup.style.color = 'white'; popup.style.border = '1px solid white'; popup.style.borderRadius = "5px"; 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 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(ul); document.body.appendChild(popup); } else { alert('No keywords found on this page.'); } }; document.body.appendChild(searchButton); var timer = setTimeout(function() { searchButton.click(); }, 10000); })();