您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
Adds pseudo-flix.pro and Braflix buttons to the overview page of shows and movies
当前为
// ==UserScript== // @name trakt.tv pseudo-flix.pro, Braflix integration // @match https://trakt.tv/movies/* // @match https://trakt.tv/shows/* // @grant none // @version 1.1.0 // @license GPLv3 // @icon https://icons.duckduckgo.com/ip2/trakt.tv.ico // @description Adds pseudo-flix.pro and Braflix buttons to the overview page of shows and movies // @run-at document-end // @namespace http://greasyfork.icu/users/1257939 // ==/UserScript== (function() { const createExternalLink = () => { const tmdbLink = document.getElementById("external-link-tmdb"); if (!tmdbLink) { console.error("TMDB link doesn’t exist."); return; } const { tmdbId, season, episode } = extractDetailsFromUrl(tmdbLink.href); const title = sanitizeTitle(location.pathname.split("/")[2]); // Extract title from location const buttonsPath = document.querySelector('.external > li'); if (!buttonsPath) { console.error("Path for buttons doesn’t exist."); return; } const showMovie = location.pathname.split("/")[1] === "movies" ? "movie" : "tv"; const linkElementMovieWeb = createNewLinkElement("pseudo-flix", `media/tmdb-${showMovie}-${tmdbId}-${title}`); const linkElementBraflix = createNewLinkElement("braflix", `${showMovie}/${tmdbId}/${season}/${episode}?play=true`); buttonsPath.appendChild(linkElementMovieWeb); buttonsPath.appendChild(linkElementBraflix); }; const extractDetailsFromUrl = (url) => { const parts = url.split("/"); return { tmdbId: parts[4], season: parts[6], episode: parts[8] }; }; const sanitizeTitle = (title) => { return title.replace(/-\d{4}$/, ''); // Removes year from URL }; const createNewLinkElement = (service, suffix) => { const linkElement = document.createElement('a'); linkElement.target = "_blank"; linkElement.id = `external-link-${service}`; linkElement.href = `https://${service === 'pseudo-flix' ? 'pseudo-flix.pro' : 'www.braflix.video/de'}/${suffix}`; linkElement.dataset.originalTitle = ""; linkElement.title = ""; linkElement.textContent = service === 'braflix' ? 'Braflix' : 'pseudo-flix'; return linkElement; }; createExternalLink(); })();