MV ref tpm

Block ref links in MV

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name        MV ref tpm
// @namespace   [email protected]
// @description Block ref links in MV
// @include http*://mediavida.com/*
// @include http*://www.mediavida.com/*
// @version     1
// @grant       none
// ==/UserScript==

var scriptCode = []; // Vamos a guardar el script aqui
var expression = new RegExp(/https?:\/\/(www\.)?amazon\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/g)

scriptCode.push('function amazon(){}'); // Vamos a reemplazar la función
var script = document.createElement('script'); // Creamos el objeto script
script.innerHTML = scriptCode.join('\n');
scriptCode.length = 0;
document.getElementsByTagName('head') [0].appendChild(script);

var links = document.getElementsByTagName('a');
var url;
for(var i=0; i<links.length; i++) {
  if (expression.test(links[i].href)) {
    url = links[i].href.split('%3F')
    links[i].setAttribute('href', url[0])
  }
}