您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Modify Amazon links to support the FSFE, always use SSL and shorten links
当前为
// ==UserScript== // @name FSFE Affiliate Programs + extras (auto-SSL...) // @namespace https://git.fsfe.org/FSFE/affiliate-script // @description Modify Amazon links to support the FSFE, always use SSL and shorten links // @version 0.5 // Contains the getASIN()-function from: // https://userscripts-mirror.org/scripts/review/3284 by Jim Biancolo // @include *://www.amazon.de/* // @include *://www.amazon.com/* // @include *://www.amazon.co.uk/* // @include *://www.amazon.ca/* // @include *://www.amazon.fr/* // @license GPL-3.0-or-later // see https://www.gnu.org/licenses/gpl-3.0-standalone.html // @author Hannes Hauswedell (original author), Max Mehl (maintainer) // @homepage https://git.fsfe.org/FSFE/affiliate-script // ==/UserScript== function getASIN(href) { var asinMatch; asinMatch = href.match(/\/exec\/obidos\/ASIN\/(\w{10})/i); if (!asinMatch) { asinMatch = href.match(/\/gp\/product\/(\w{10})/i); } if (!asinMatch) { asinMatch = href.match(/\/exec\/obidos\/tg\/detail\/\-\/(\w{10})/i); } if (!asinMatch) { asinMatch = href.match(/\/dp\/(\w{10})/i); } if (!asinMatch) { return null; } return asinMatch[1]; } (function() { var links = document.getElementsByTagName("a"); for (i = 0; i < links.length; i++) { var curLink = links[i].href; // AMAZON if (curLink.match(/https?\:\/\/(www\.)?amazon\./i)) { var affiliateID = ''; var host = ''; if (curLink.match(/amazon\.de/i)) { host = 'amazon.de'; affiliateID = 'fsfe-21'; } else if (curLink.match(/amazon\.co\.uk/i)) { host = 'amazon.co.uk'; affiliateID = 'fsfe05-21'; } else if (curLink.match(/amazon\.ca/i)) { host = 'amazon.ca'; affiliateID = 'fsfe-20'; } else if (curLink.match(/amazon\.fr/i)) { host = 'amazon.fr'; affiliateID = 'fsfeurope-21'; } else if (curLink.match(/amazon\.com/i)) { host = 'amazon.com'; affiliateID = 'freesoftfoune-20'; } var asin = getASIN(curLink); if (affiliateID != '') { if (asin != null) links[i].setAttribute("href", "https://www."+host+"/dp/" + asin + "/?tag="+affiliateID); // else // links[i].setAttribute("href", curLink + "?tag="+affiliateID); } } } })();