Hash to YGGLands

Ajoute un bouton pour voir le torrent sur ygglands

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Hash to YGGLands
// @version      0.1
// @description  Ajoute un bouton pour voir le torrent sur ygglands
// @author       Gyro3630
// @match        *://*/*
// @grant        none
// @namespace https://greasyfork.org/users/1256993
// ==/UserScript==

(function() {
    'use strict';
		var regex = /^https:\/\/.*\.ygg[a-z]{0,7}\.[a-z]{2,5}\/torrent\/.+/;
  
    function addYGGbutton() {
      	if (regex.test(window.location.href)) {
					var infoHashCell = document.evaluate('//td[text()="Info Hash"]/following-sibling::td[1]', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
      		console.log(infoHashCell.innerText);

      		infoHashCell.innerHTML = infoHashCell.innerText+'<a target="_blank" href="https://yggland.fr/FAQ-Tutos/test-torrent-tracker-ygg.php?hash='+infoHashCell.innerText+'"><img style="height:20px;width:auto;" src="https://yggland.fr/assets/img/yggland-30.png"></a>';
       }
    }


    window.addEventListener('load', addYGGbutton);
})();