Startpage Direct Image URL

Allow direct linking to images from Startpage, without a proxy

  1. // ==UserScript==
  2. // @name Startpage Direct Image URL
  3. // @namespace http://tampermonkey.net/
  4. // @version 3.1
  5. // @description Allow direct linking to images from Startpage, without a proxy
  6. // @author YXXXXNN
  7. // @license GPL
  8. // @match https://startpage.com/sp/search*
  9. // @match https://startpage.com/do/dsearch*
  10. // @match https://www.startpage.com/sp/search*
  11. // @match https://www.startpage.com/do/dsearch*
  12. // @match https://eu.startpage.com/sp/search*
  13. // @match https://eu.startpage.com/do/dsearch*
  14. // @match https://us.startpage.com/sp/search*
  15. // @match https://us.startpage.com/do/dsearch*
  16. // @match https://*.startpage.com/sp/search*
  17. // @match https://*.startpage.com/do/dsearch*
  18. // @icon https://www.google.com/s2/favicons?domain=startpage.com
  19. // @grant none
  20.  
  21. // ==/UserScript==
  22.  
  23. const dirImgClassName = "css-dirimg451";
  24. window.addEventListener('load', () => {
  25. // Link element
  26. var a = document.createElement("a");
  27. a.rel = "noopener nofollow noreferrer";
  28. a.target = "_blank";
  29. a.ariaLabel = "link";
  30. a.className = dirImgClassName;
  31. a.innerHTML = "View direct image";
  32. a.style = "color: #7f869f; font-size: 13px; text-decoration: none; margin-top: 15px;"
  33. document.getElementsByClassName("expanded-details-link")[0].append(a);
  34. // Add functionality
  35. var imgbtn = document.getElementsByClassName('image-links')[0].children[0];
  36. var observer = new MutationObserver((mutations) => {
  37. let url = imgbtn.href;
  38. url = url.substring(52);
  39. url = url.substring(0, url.indexOf('&'));
  40. url = decodeURIComponent(url);
  41. document.getElementsByClassName(dirImgClassName)[0].href = url;
  42. });
  43. observer.observe(imgbtn, {
  44. attributes: true,
  45. attributeFilter: ['href'] });
  46. imgbtn.dataset.selectContentVal = 1;
  47. }, false);

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址