Pinterest middle click open image in new tab

Fixes pinterest middle click open image in new tab

当前为 2018-04-09 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Pinterest middle click open image in new tab
  3. // @namespace FuckPinterest
  4. // @version 0.3
  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. Array.from(document.querySelectorAll("[data-force-refresh='1']")).forEach(function (curr) {
  18. curr.removeAttribute("data-force-refresh");
  19. curr.outerHTML = curr.outerHTML;
  20. });
  21. }
  22.  
  23. // old function
  24. /*function fuckPinterest() {
  25. // search all _mn class types
  26. Array.from(document.getElementsByClassName("_mn")).forEach(function (curr) {
  27. var element = curr.firstChild.firstChild.firstChild;
  28.  
  29. // look for the image
  30. if (element && element.firstChild && element.firstChild.tagName === "IMG") {
  31. var img = element.firstChild;
  32. var pic = img.srcset;
  33. pic = pic.substring(pic.lastIndexOf("https"), pic.lastIndexOf(" 4x"));
  34.  
  35. curr.parentNode.parentNode.innerHTML = "<a href=\"" + pic + "\">" + img.outerHTML + "</a>";
  36. }
  37. });
  38. }*/
  39.  
  40. // check for new images on scroll
  41. window.addEventListener("scroll", fuckPinterest);
  42.  
  43. // delay first load to prevent page breaking
  44. window.setTimeout(fuckPinterest, 900);
  45. })();

QingJ © 2025

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