Copy hash for YGG

Copy easly the hash from a torrent on YGG and past in Alldebrid.

As of 11/02/2023. See the latest version.

// ==UserScript==
// @namespace       https://greasyfork.org/fr/users/868328-invincible812
// @name            Copy hash for YGG
// @name:fr         Copieur de hash pour YGG
// @match           https://*/torrent/*
// @grant           none
// @version         1.0
// @author          Invincible812
// @description     Copy easly the hash from a torrent on YGG and past in Alldebrid.
// @description:fr  Copier facilement le hash d'un torrent en seulement un click pour le coller ensuite dans Alldebrid.
// @supportURL      https://www6.yggtorrent.lol/profile/9385666-invincible813
// @run-at          document-end
// ==/UserScript==

window.addEventListener('load', function() {
      let hash = 'magnet:xt=urn:btih:' + document.getElementsByClassName('informations')[0].childNodes[1].childNodes[9].childNodes[3].textContent;
      document.getElementsByTagName('tbody')[0].children[0].children[1].insertAdjacentHTML('beforeend',`\n<a style="max-width:100%;color:#d9a65a;top:-1px;font-size:11px;font-weight:700;text-transform:uppercase;border:3px solid #d9a65a;border-radius:25px;padding:5px 10px;transition: all 0.3s ease; cursor:pointer;" onclick="this.textContent='Copié !'" class="butt-hash" onmouseover="this.style.background='#d9a85a';this.style.color='#ffffff';" onmouseout="this.style.background='transparent';this.style.color='#d9ad5a';">Copier le hash <span class="ico_copy"></span>`);
      document.getElementsByClassName('butt-hash')[0].addEventListener('click', function() {
        navigator.clipboard.writeText(hash);
      });
});