[GC] - Virtupets.net Search Link

Add virtupets.net search link to sitewide search helper.

  1. // ==UserScript==
  2. // @name [GC] - Virtupets.net Search Link
  3. // @namespace https://greasyfork.org/en/users/1225524-kaitlin
  4. // @match https://www.grundos.cafe/*
  5. // @version 1.1
  6. // @license MIT
  7. // @description
  8. // @author Cupkait
  9. // @icon https://i.imgur.com/4Hm2e6z.png
  10. // @description Add virtupets.net search link to sitewide search helper.
  11. // ==/UserScript==
  12.  
  13.  
  14. document.querySelectorAll('div.searchhelp').forEach(function(div) {
  15. var item = div.id;
  16.  
  17. item = item.trim().replace(/-links/g, '').replace(/\s+/g, '%20');
  18.  
  19.  
  20. var link = document.createElement('a');
  21. link.href = `https://virtupets.net/search?q=${item}`;
  22.  
  23.  
  24. var img = document.createElement('img');
  25. // SWITCH THE // FROM THE BEGINNING OF THE IMG.SRC SO THE ONE YOU DONT WANT TO USE IS GREYED OUT
  26.  
  27. //COLOR:
  28. img.src = 'https://virtupets.net/assets/images/vp.png';
  29.  
  30. //BASIC:
  31. // img.src = 'https://i.imgur.com/ogwfJ45.png';
  32.  
  33.  
  34. img.alt = 'Virtupets';
  35. img.style.width = '20px';
  36.  
  37. link.appendChild(img);
  38. div.appendChild(link);
  39. });
  40.