IMDb Trakt Link

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

You will need to install an extension such as Tampermonkey to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला 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];
}