IMDb Trakt Link

Add link on IMDb movie pages to that title's page on Trakt

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name           IMDb Trakt Link
// @namespace		https://greasyfork.org/en/users/7864-curtis-gibby
// @description    Add link on IMDb movie pages to that title's page on Trakt
// @grant			none
// @version			1.0.1
// @include			http*://*.imdb.com/title/*/*
// @include			http*://*.imdb.com/title/*/#*
// @include			http*://*.imdb.com/title/*/combined*
// @include			http*://*.imdb.com/title/*/maindetails*
// @include			http*://imdb.com/title/*/*
// @include			http*://imdb.com/title/*/#*
// @include			http*://imdb.com/title/*/combined*
// @include			http*://imdb.com/title/*/maindetails*
// ==/UserScript==

var topNav = document.getElementById('imdbHeader');
var linkPadding = 3;
var linkTop = topNav.offsetHeight + linkPadding;

var link = document.createElement('a');
link.href = 'https://trakt.tv/search/imdb?q=tt' + getIMDBid();
link.setAttribute('target','_blank');
link.innerHTML = '<img src="https://walter.trakt.tv/hotlink-ok/public/favicon.ico" alt="Search Trakt.tv" style="width: 16px; height: 16px;"/>';
link.style.position = 'absolute';
link.style.top = linkTop + 'px';
link.style.right = linkPadding + 'px';
document.body.appendChild(link);


function getIMDBid () {
	var regexImdbNum = /\/title\/tt(\d{7})\//;
	id = regexImdbNum.exec(document.location);
	return id[1];
}