Pinterest middle click open image in new tab

Fixes pinterest middle click open image in new tab

当前为 2018-03-25 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Pinterest middle click open image in new tab
  3. // @namespace FuckPinterest
  4. // @version 0.1
  5. // @description Fixes pinterest middle click open image in new tab
  6. // @author codingjoe
  7. // @match *.pinterest.com/*
  8. // @include *.pinterest.com/*
  9. // @grant none
  10. // @run-at document-end
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. function fuckPinterest() {
  17. // search all _mn class types
  18. Array.from(document.getElementsByClassName("_mn")).forEach(function (curr) {
  19. var element = curr.firstChild.firstChild.firstChild;
  20.  
  21. // look for the image
  22. if (element && element.firstChild && element.firstChild.tagName === "IMG") {
  23. var img = element.firstChild;
  24. var pic = img.srcset;
  25. pic = pic.substring(pic.lastIndexOf("https"), pic.lastIndexOf(" 4x"));
  26.  
  27. curr.parentNode.parentNode.innerHTML = "<a href=\"" + pic + "\">" + img.outerHTML + "</a>";
  28. }
  29. });
  30. }
  31.  
  32. // check for new images on scroll
  33. window.addEventListener("scroll", fuckPinterest);
  34.  
  35. // delay first load to prevent page breaking
  36. window.setTimeout(fuckPinterest, 900);
  37. })();

QingJ © 2025

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