// ==UserScript== // @name trakt.tv movie-web.app integration // @match https://trakt.tv/movies/* // @match https://trakt.tv/shows/* // @grant none // @version 0.0.1 // @icon https://icons.duckduckgo.com/ip2/trakt.tv.ico // @license GPLv3 // @description Adds a movie-web.app button to the overview page of shows and movies // @run-at document-end // @namespace https://greasyfork.org/users/1257939 // @downloadURL none // ==/UserScript== (function() { let tmdbLink = document.getElementById("external-link-tmdb"); if (!tmdbLink) { console.error("TMDB link doesn’t exist.") return; // Ensure the TMDB link exists before proceeding } let tmdbId = tmdbLink.href.split("/")[4]; let title = location.pathname.split("/")[2].replace(/-\d{4}$/, ''); // Remove trailing year from the title let buttonsPath = document.querySelector('.external > li'); if (!buttonsPath) { console.error("Path for buttons doesn’t exist.") return; // Ensure the path for buttons exists before proceeding } let linkElement = document.createElement('a'); linkElement.target = "_blank"; linkElement.id = "external-link-movie-web"; let showMovie = location.pathname.split("/")[1] === "movies" ? "movie" : "tv"; linkElement.href = "https://movie-web.app/media/tmdb-" + showMovie + "-" + tmdbId + "-" + title; linkElement.dataset.originalTitle = ""; linkElement.title = ""; linkElement.textContent = "movie-web"; buttonsPath.appendChild(linkElement); })();