您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Skips to the print version of any recipe on allrecipes.com
当前为
// ==UserScript== // @name allrecipes print version // @namespace n/a // @version 3 // @description Skips to the print version of any recipe on allrecipes.com // @author Greasy.Fork.User // @match *://*.allrecipes.com/* // @grant none // ==/UserScript== function processClickEvent(ev) { "use strict"; var ele = ev.target; //check if the clicked element is within an "A" element while (ele.tagName !== "BODY") { if (ele.tagName === "A") { //make sure it links to a recipe page and it's not already pointing to a printable page if ((/^\/recipe\/\d+\//i).test(ele.pathname) && !(/^\/recipe\/\d+\/.*?\/print/i).test(ele.pathname)) { //change the URL path to point to the printable version of the page if (ele.pathname[ele.pathname.length-1] === "/") { ele.pathname += "print/"; } else { ele.pathname += "/print/"; } } break; //"A" element is already found. stop looking further } ele = ele.parentNode; } } (function() { "use strict"; document.addEventListener("click", processClickEvent, true); // Mouse Button 1 document.addEventListener("contextmenu", processClickEvent, true); // Mouse Button 2 document.addEventListener("auxclick", processClickEvent, true); // Mouse Button Middle })();