IMDb Scout

Add links from IMDb pages to torrent sites -- easy downloading from IMDb

目前為 2017-12-26 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name IMDb Scout
  3. // @namespace https://greasyfork.org/users/1057-kannibalox
  4. // @description Add links from IMDb pages to torrent sites -- easy downloading from IMDb
  5. //
  6. // Preference window for userscripts, hosted by greasyfork:
  7. // @require https://greasyfork.org/libraries/GM_config/20131122/GM_config.js
  8. // @require http://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js
  9. //
  10. // @version 4.5.2
  11. // @include http://*.imdb.tld/title/tt*
  12. // @include http://*.imdb.tld/search/title*
  13. // @include http://*.imdb.com/title/tt*
  14. // @include http://*.imdb.com/search/title*
  15. // @include http*://*iloveclassics.com/viewrequests.php?*
  16. //
  17. // @connect *
  18. // @grant GM_log
  19. // @grant GM_getValue
  20. // @grant GM_setValue
  21. // @grant GM_addStyle
  22. // @grant GM_openInTab
  23. // @grant GM_xmlhttpRequest
  24. // @grant GM_registerMenuCommand
  25. //
  26. // ==/UserScript==
  27. /*---------------------Version History--------------------
  28. 1.00 - Initial public release, everything works on barebones greasemonkey
  29.  
  30. 1.50 - Added the ability to select which sites to load from the GM script commands
  31. - Moved the required method to userscripts
  32. - Removed FH, NZB, Avax
  33.  
  34. 1.60 - Added style elements and shading to display on imdb
  35.  
  36. 1.62 - Fixed bug:SCC-ARC not removing when unchecked
  37. - Alphabetized list
  38.  
  39. 1.70 - Cleaned up code
  40. - Added option to not run script on page load
  41.  
  42. 1.71 - Deprecated action-box field
  43.  
  44. 1.80 - Added icons that link to OpenSubs, Criticker, RT, YT
  45.  
  46. 1.81 - Added support for tv, only displays on shows listed as 'tv series'
  47. - Added support for icheckmovies at top bar.
  48.  
  49. 1.82 - Fixed title parsing for tv shows.
  50.  
  51. 1.83 - Fixed dhive not working properly
  52.  
  53. 1.90 - Set height of preference window to 450px, added scroll bar
  54.  
  55. 1.91 - Added another 11 torrent sites
  56.  
  57. 2.00 - Added auto updater
  58.  
  59. 2.01 - Added TC, FreshOn, TVT, STF, CC
  60. - Cleaned up code (tabbing)
  61. - Removed THR
  62. - Added TV-Rage to top bar
  63.  
  64. 2.02 - Added PS, THC, HH, HDStar
  65. - Fixed CC false positive
  66.  
  67. 2.03 - TehC now uses tt
  68. - Added Raymoz mod for AT
  69.  
  70. 2.04 - Added HDbits
  71. - Added TL
  72.  
  73. 2.10 - Added genre page search functionality
  74.  
  75. 2.11 - Fixed ICM because Nuked was whining
  76.  
  77. 2.12 - Removed tvrage
  78. - Fixed iCM (added tt)
  79. - Added HDVNbits
  80. - Changed RevTT to .me
  81. - Added HDT
  82. - removed autoupdate
  83.  
  84. 2.13 - removed xvidme
  85. - reinstated autoupdate
  86. - removed google chrome code
  87. - fixed hdvn and hdt issues
  88.  
  89. 2.14 - Added @grant entries for API access
  90. - Fixed tt parser to work on imdb pages with referral info in url
  91.  
  92. 2.2 - Switch preferences window to use GM_config
  93. - Consolidate icon & site lists
  94. - Added IPT, KASS, sHD, and HDW
  95. - Fix "Open All" link
  96. - Add option for strikethroughs on search page
  97. - Removed arrays from search URLs
  98. - Spring cleaning
  99.  
  100. 2.21 - Added SSL to TVT, HDME, TC, AHD, IPT, SCC
  101. - Added SSL option for CG
  102. - Added GFT, GFT-Gems, GFT-TV
  103. - Fixed SCC, SCC-ARC search URL
  104. - Removed TheBox, TheDVDClub
  105. - Added more comments, cleaned up some more stuff
  106.  
  107. 2.22 - Fixed TehC, BTN, BTN-Req, THC
  108. - Added a bunch of TV sites, courtesy of seedless
  109. - Added "both" option for sites, and made changes
  110. to allow coexistence of movie and TV sites with
  111. the same name
  112. - Code re-organization, documentation
  113. - Re-added code to allow an array for searchUrl
  114.  
  115. 2.22.1 - Minor fixes
  116.  
  117. 2.23 - Fixed THC, BTN
  118. - Distinguish between movies and TV on search page
  119.  
  120. 2.24 - Separate load_on_start option for search page
  121. - Fix search_string on search page
  122.  
  123. 2.25 - Added some helpful text when no sites have been enabled
  124.  
  125. 2.26 - Added code to show links when on pages besides just the "front" one
  126. (e.g. http://www.imdb.com/title/tt2310332/reference)
  127.  
  128. 2.26.1 - Correctly detect TV shows when on aforementioned pages.
  129.  
  130. 2.3 - Incorporate a bunch of changes courtesy of Inguin:
  131. - Added SSL to AT, TE, D-noid, TG, YT, RT
  132. - Changed tracker short titles to canonical form ADC, KG
  133. - Updated D-noid from .me to .pw
  134. - Fixed broken AT search; also updated to use .me so avoids redirect
  135. - Added BitHQ, ET (eutorrents)
  136. - Removed two broken THC; replaced with one fixed
  137. - Removed iplay, horrorhaven, hdstar, scandbits, leecherslair
  138. - Removed needless CG http/https duplication - plenty of listed sites self-sign
  139. - A-Z sites list for readability
  140. - Cleanup YT search string
  141. - Copyedits
  142. - Clean up code (tabs, trailing spaces)
  143. - Use consistent naming style
  144. - Added Letterboxd, Subscene to icons
  145. - Added options for showing icons
  146.  
  147. 2.31 - Added preliminary check for TSH
  148. - Change all SCC links to .org
  149.  
  150. 2.31.1 - Typo fix
  151.  
  152. 2.32 - On uncertain pages, display both movie and TV sites
  153.  
  154. 2.33 - Add year to possible search params
  155. - Add rutorrent
  156.  
  157. 2.33.1 - Change KG to .in
  158.  
  159. 2.33.2 - Change TSH to .me
  160.  
  161. 2.34 - Updated AT, TPB
  162. - Removed HDWing, TVT and CHDBits
  163. - Added RARBG
  164. - Re-added reverse match checking to support rarbg
  165.  
  166. 2.35 - Fixed YouTube icon, add SubtitleSeeker icon
  167. - Added FL.ro, bB, BHD, HDS
  168. - Fixed TL, TehC, HDb, HDVN, AHD, KG
  169. - Renamed reverseMatch to positiveMatch
  170.  
  171. 2.36 - Added Wikipedia to icon sites
  172.  
  173. 2.36.1 - Typo fix
  174.  
  175. 2.37 - Add PxHD
  176.  
  177. 2.38 - Fix subtitle seeker
  178. - Added CG-c
  179. - Added FilmAffinity
  180. - Added option to skip http check entirely
  181.  
  182. 2.38.1 - Typo fix
  183.  
  184. 2.38.2 - Global replace parameters
  185.  
  186. 2.38.3 - Typo fix
  187.  
  188. 3.00 - Clean up some formatting
  189. - Add support for new IMDb page format
  190. - Update jquery
  191.  
  192. 3.0.1 - Added Classix
  193.  
  194. 3.0.2 - Updated documentation/comments
  195.  
  196. 3.0.3 - Removed GOEM, FY, PS, MT
  197. - Added Metacritic, CanIStream.It?, AllMovie, Facebook, Amazon, Cartoon Chaos, MySpleen, Secret Cinema
  198. - Fixed Wikipedia icon
  199.  
  200. 3.1 - Handle HTTP failures less silently
  201.  
  202. 3.1.1 - Fix KASS
  203.  
  204. 3.1.2 - Fix TPB, TE, HDT
  205. - Add MTV, DVDSeed
  206.  
  207. 3.1.3 - Add M-T, UHDB, HDC, Blu-ray.com
  208. - Fix scenehd, RT
  209.  
  210. 3.1.4 - Add HDClub
  211.  
  212. 3.2 - Fix the button on new-style pages
  213.  
  214. 3.2.1 - Fix AHD
  215.  
  216. 3.3 - Be less obnoxious about failed calls
  217.  
  218. 3.4 - Add Netflix icon
  219. - Remove a default parameter to satisfy Chrome
  220.  
  221. 3.5 - Add KZ, NNM, BB-HD, t411, TD, Rutor
  222. - Fix HDClub
  223. - Fix preferences in Chrome, sort sites properly
  224.  
  225. 3.5.1 - Remove DHive, Fix AHD
  226.  
  227. 4.0 - Bring in UI changes courtesy of janot
  228. - Add spaceEncode and goToUrl to site options
  229. - Add option to show results as links instead of text
  230. - Differentiate between missing and logged out
  231. - General refactoring
  232.  
  233. 4.1 - Add RARAT
  234.  
  235. 4.2 - Fix t411
  236. - Use magic .tld domain in @include
  237.  
  238. 4.3 - Set @connect in metadata block
  239.  
  240. 4.3.1 - Fix THC
  241.  
  242. 4.3.2 - Add AR, TtN
  243. - Add year and "trailer" to youtube search
  244. - Fix M-team
  245.  
  246. 4.3.3 - Fix BitHQ, PTP-Req, SCC
  247.  
  248. 4.3.4 - Fix M-team, myspleen, avistaz, eutorrents
  249. - Removed KAT
  250.  
  251. 4.3.5 - Fix IPT, Freshon
  252. - Add ExtraTorrent
  253.  
  254. 4.3.6 - Fix Demonoid, EuTorrents (now CinemaZ)
  255. - Fix "Actually search for torrents" option
  256. - Add PrivateHD for movies and tv
  257.  
  258. 4.3.7 - Apply CinemaZ fixes to AvistaZ as well
  259.  
  260. 4.3.8 - Fix SurrealMoviez and MySpleen, switch to new PTP url
  261.  
  262. 4.3.9 - Fix criticker, add CN
  263.  
  264. 4.3.10 - Fix Netflix, MTV
  265.  
  266. 4.3.11 - Add CHD back
  267.  
  268. 4.3.12 - Fix typo
  269.  
  270. 4.4 - Fix BeyondHD
  271. - Allow unicode when searching by name
  272.  
  273. 4.4.1 - Add trakt.tv
  274.  
  275. 4.4.2 - Added XS, HD-S, PTN, TBD, Blutopia
  276. - Removed Freshon, CN, ExT, t411, SCC
  277. - Fixed SC, TE, TG, Tik
  278. - Add .com for script runners that don't support .tld
  279.  
  280. 4.5 - (Chameleon)
  281. - Added an option to run on ILC request pages
  282. - Fixed running on reference pages (new imdb style)
  283. - Added a delay of 1 second between loading the same site (by domain) - no more popcorn quota timeouts
  284. - Fixed running on search pages
  285.  
  286. 4.5.1 - Removed (dead): BitHQ, TehC, FSS, ExtraTorrent, Cine-Clasico, and Secret-Cinema
  287. - Fixed the hack on goToUrl
  288.  
  289. 4.5.2 - Fixed filelist.ro, Tik, TD
  290. - Added HDHome, HDU, OurBits
  291. --------------------------------------------------------*/
  292.  
  293.  
  294. if (window.top != window.self) // Don't run on frames or iframes
  295. {
  296. return;
  297. }
  298.  
  299. //------------------------------------------------------
  300. // A list of all the sites, and the data necessary to
  301. // check IMDb against them.
  302. // Each site is a dictionary with the following attributes:
  303. // - name:
  304. // The site name, abbreviated
  305. // - searchUrl:
  306. // The URL to perform the search against, see below for how
  307. // to tailor the string to a site
  308. // - matchRegex:
  309. // The string which appears if the searchUrl *doesn't* return a result
  310. // - postiveMatch:
  311. // Changes the test to return true if the searchUrl *does* return
  312. // a result that matches matchRegex
  313. // - TV (optional):
  314. // If true, it means that this site will only show up on TV pages.
  315. // By default, sites only show up on movie pages.
  316. // - both (optional):
  317. // Means that the site will show up on both movie and TV pages
  318. // - spaceEncode (optional):
  319. // Changes the character used to encode spaces in movie titles
  320. // The default is '+'.
  321. // - goToUrl (optional):
  322. // Most of the time the same URLs that are used for checking are
  323. // the ones that are used to actually get to the movie,
  324. // but this allows overriding that.
  325. // - loggedOutRegex (optional):
  326. // If any text on the page matches this regex, the site is treated
  327. // as being logged out, rather than mising the movie. This option is
  328. // not effected by postiveMatch.
  329. // To create a search URL, there are four parameters
  330. // you can use inside the URL:
  331. // - %tt%:
  332. // The IMDb id with the tt prefix (e.g. tt0055630)
  333. // - %nott%:
  334. // The IMDb id without the tt prefix (e.g. 0055630)
  335. // - %search_string%:
  336. // The movie title (e.g. Yojimbo)
  337. // - %year%:
  338. // The movie year (e.g. 1961)
  339. // See below for examples
  340. //------------------------------------------------------
  341.  
  342. var sites = [
  343. { 'name': 'ADC',
  344. 'searchUrl': 'https://asiandvdclub.org/browse.php?descr=1&btnSubmit=Submit&search=%tt%',
  345. 'matchRegex': /Your search returned zero results|<h1>You need cookies enabled to log in.<\/h1>/,
  346. 'both': true},
  347. { 'name': 'AHD',
  348. 'searchUrl': 'https://awesome-hd.me/torrents.php?id=%tt%',
  349. 'matchRegex': /Your search did not match anything.|<h2>Error 404<\/h2>/,
  350. 'both': true},
  351. { 'name': 'AR',
  352. 'searchUrl': 'https://alpharatio.cc/torrents.php?searchstr=%search_string%+%year%&filter_cat[6]=1&filter_cat[7]=1&filter_cat[8]=1&filter_cat[9]=1',
  353. 'matchRegex': /Your search did not match anything/},
  354. { 'name': 'AR',
  355. 'searchUrl': 'https://alpharatio.cc/torrents.php?searchstr=%search_string%&filter_cat[1]=1&filter_cat[2]=1&filter_cat[3]=1&filter_cat[4]=1&filter_cat[5]=1',
  356. 'matchRegex': /Your search did not match anything/,
  357. 'TV': true},
  358. { 'name': 'AT',
  359. 'searchUrl': 'https://avistaz.to/movies?search=&imdb=%tt%',
  360. 'matchRegex': /class="overlay-container"/,
  361. 'positiveMatch': true},
  362. { 'name': 'AT',
  363. 'searchUrl': 'https://avistaz.to/tv-shows?search=&imdb=%tt%',
  364. 'matchRegex': /class="overlay-container"/,
  365. 'positiveMatch': true,
  366. 'TV': true},
  367. { 'name': 'Blutopia',
  368. 'searchUrl': 'https://blutopia.xyz/search?name=%search_string%',
  369. 'both': true},
  370. { 'name': 'bB',
  371. 'searchUrl': 'https://baconbits.org/torrents.php?action=basic&filter_cat[9]=1&searchstr=%search_string%+%year%',
  372. 'matchRegex': /Your search was way too l33t|You will be banned for 6 hours after your login attempts run out/},
  373. { 'name': 'bB',
  374. 'searchUrl': 'https://baconbits.org/torrents.php?action=basic&filter_cat[8]=1&filter_cat[10]=1&searchstr=%search_string%',
  375. 'matchRegex': /Your search was way too l33t|You will be banned for 6 hours after your login attempts run out/,
  376. 'TV': true},
  377. { 'name': 'BB-HD',
  378. 'searchUrl': 'https://bluebird-hd.org/browse.php?search=&incldead=0&cat=0&dsearch=%tt%&stype=or',
  379. 'matchRegex': /Nothing found|Ничего не найдено/,
  380. 'both': true},
  381. { 'name': 'BHD',
  382. 'searchUrl': 'https://beyondhd.xyz/browse.php?search=%tt%&searchin=title&incldead=1',
  383. 'matchRegex': /Nothing found!|Please login or Register a personal account to access our user area and great community/},
  384. { 'name': 'BHD',
  385. 'searchUrl': 'https://beyondhd.xyz/browse.php?c40=1&c44=1&c48=1&c89=1&c46=1&c45=1&search=%search_string%&searchin=title&incldead=0',
  386. 'matchRegex': /Nothing found!|Please login or Register a personal account to access our user area and great community/,
  387. 'TV': true},
  388. { 'name': 'BitHD',
  389. 'searchUrl': 'http://www.bit-hdtv.com/torrents.php?cat=0&search=%tt%',
  390. 'matchRegex': /<h2>No match!<\/h2>/},
  391. { 'name': 'BMTV',
  392. 'searchUrl': 'https://www.bitmetv.org/browse.php?search=%search_string%',
  393. 'matchRegex': /Nothing found!<\/h2>/,
  394. 'TV': true},
  395. { 'name': 'BTN',
  396. 'searchUrl': 'https://broadcasthe.net/torrents.php?imdb=%tt%',
  397. 'matchRegex': /Error 404|Lost your password\?/,
  398. 'TV': true},
  399. { 'name': 'BTN-Req',
  400. 'searchUrl': 'https://broadcasthe.net/requests.php?search=%search_string%',
  401. 'matchRegex': /Nothing found|Lost your password\?/,
  402. 'TV': true},
  403. { 'name': 'CaCh',
  404. 'searchUrl': 'http://www.cartoonchaos.org/index.php?page=torrents&search=%search_string%&category=0&options=0&active=0',
  405. 'matchRegex': />Av.<\/td>\s*<\/tr>\s*<\/table>|not authorized to view the Torrents/,
  406. 'both': true},
  407. { 'name': 'CG',
  408. 'searchUrl': 'https://cinemageddon.net/browse.php?search=%tt%',
  409. 'matchRegex': /<h2>Nothing found!<\/h2>/,
  410. 'loggedOutRegex': 'Not logged in!'},
  411. { 'name': 'CG-c',
  412. 'searchUrl': 'https://cinemageddon.net/cocks/endoscope.php?what=imdb&q=%tt%',
  413. 'matchRegex': /<h2>Nothing found!<\/h2>/,
  414. 'loggedOutRegex': 'Not logged in!'},
  415. { 'name': 'CHD',
  416. 'searchUrl': 'https://chdbits.co/torrents.php?incldead=1&spstate=0&inclbookmarked=0&search_area=4&search_mode=0&search=%tt%',
  417. 'matchRegex': /Nothing found/},
  418. { 'name': 'Classix',
  419. 'searchUrl': 'http://classix-unlimited.co.uk/torrents-search.php?search=%search_string%',
  420. 'matchRegex': /Nothing Found<\/div>/},
  421. { 'name': 'Demnoid',
  422. 'searchUrl': 'http://www.demonoid.pw/files/?query=%tt%',
  423. 'matchRegex': /<b>No torrents found<\/b>|We are currently performing the daily site maintenance.<br>/,
  424. 'both': true},
  425. { 'name': 'DVDSeed',
  426. 'searchUrl': 'http://www.dvdseed.eu/browse2.php?search=%tt%&wheresearch=2&incldead=1&polish=0&nuke=0&rodzaj=0',
  427. 'matchRegex': /Nic tutaj nie ma!<\/h2>/},
  428. { 'name': 'ET',
  429. 'searchUrl': 'https://cinemaz.to/movies?search=&imdb=%tt%',
  430. 'matchRegex': /class="overlay-container"/,
  431. 'positiveMatch': true},
  432. { 'name': 'ET',
  433. 'searchUrl': 'https://cinemaz.to/tv-shows?search=&imdb=%tt%',
  434. 'matchRegex': /class="overlay-container"/,
  435. 'positiveMatch': true,
  436. 'TV': true},
  437. { 'name': 'eThor',
  438. 'searchUrl': 'http://ethor.net/browse.php?stype=b&c23=1&c20=1&c42=1&c5=1&c19=1&c25=1&c6=1&c37=1&c43=1&c7=1&c9=1&advcat=0&incldead=0&includedesc=1&search=%tt%',
  439. 'matchRegex': /Try again with a refined search string.|<h1>Note: Vous devez activer vos 'cookies' pour pouvoir vous identifier.<\/h1>/},
  440. { 'name': 'FL',
  441. 'searchUrl': 'https://filelist.ro/browse.php?search=%nott%',
  442. 'matchRegex': /<h2>Nu s-a găsit nimic!<\/h2>/,
  443. 'both': true},
  444. { 'name': 'GFT',
  445. 'searchUrl': 'https://www.thegft.org/browse.php?view=0&c2=1&c1=1&c9=1&c11=1&c48=1&c8=1&c18=1&c49=1&c7=1&c38=1&c46=1&c5=1&c13=1&c26=1&c37=1&c19=1&c47=1&c17=1&c4=1&c22=1&c25=1&c20=1&c3=1&search=%tt%&searchtype=0',
  446. 'matchRegex': /Nothing found!<\/h2>/},
  447. { 'name': 'GFT',
  448. 'searchUrl': 'https://www.thegft.org/browse.php?view=0&search=%search_string%',
  449. 'matchRegex': /Nothing found!<\/h2>/,
  450. 'TV': true},
  451. { 'name': 'GFT-Gems',
  452. 'searchUrl': 'https://www.thegft.org/browse.php?view=1&search=%tt%&searchtype=0',
  453. 'matchRegex': /Nothing found!<\/h2>/},
  454. { 'name': 'HD',
  455. 'searchUrl': 'http://hounddawgs.org/torrents.php?type=&userid=&searchstr=&searchimdb=%tt%&searchlang=&searchtags=&order_by=s3&order_way=desc&showOnly=#results',
  456. 'matchRegex': /<h2>Din søgning gav intet resultat.<\/h2>/,
  457. 'both': true},
  458. { 'name': 'HDb',
  459. 'searchUrl': 'https://hdbits.org/browse.php?c3=1&c1=1&c4=1&c2=1&imdb=%tt%',
  460. 'matchRegex': /Nothing here!|You need cookies enabled to log in/,
  461. 'both': true},
  462. { 'name': 'HDC',
  463. 'searchUrl': 'https://hdchina.club/torrents.php?incldead=0&spstate=0&inclbookmarked=0&boardid=0&seeders=&search=%tt%&search_area=4&search_mode=2',
  464. 'matchRegex': /Nothing found! Try again with a refined search string./},
  465. { 'name': 'HDClub',
  466. 'searchUrl': 'http://hdclub.org/browse.php?webdl=0&3d=0&search=&incldead=0&dsearch=%tt%',
  467. 'matchRegex': /Nothing was found|Ничего не найдено|Нічого не знайдено/,
  468. 'both': true},
  469. { 'name': 'HDHome',
  470. 'searchUrl': 'http://hdhome.org/torrents.php?search_area=4&search=%tt%',
  471. 'matchRegex': /Nothing found! Try again with a refined search string/},
  472. { 'name': 'HDME',
  473. 'searchUrl': 'https://hdme.eu/browse.php?blah=2&cat=0&incldead=1&search=%tt%',
  474. 'matchRegex': /Try again with a refined search string.|<h1>You need cookies enabled to log in.<\/h1>/},
  475. { 'name': 'HDME',
  476. 'searchUrl': 'https://hdme.eu/browse.php?search=%search_string%&blah=0&cat=0&incldead=1',
  477. 'matchRegex': /Try again with a refined search string.|<h1>You need cookies enabled to log in.<\/h1>/,
  478. 'TV': true},
  479. { 'name': 'HDS',
  480. 'searchUrl': 'https://hdsky.me/torrents.php?incldead=1&search=%tt%&search_area=4&search_mode=0',
  481. 'matchRegex': /Nothing found! Try again with a refined search string|Email:hdsky.me@gmail.com/},
  482. { 'name': 'HDS',
  483. 'searchUrl': 'https://hdsky.me/torrents.php?cat402=1&cat403=1&incldead=1&search=%search_string%&search_area=0&search_mode=0',
  484. 'matchRegex': /Nothing found! Try again with a refined search string|Email:hdsky.me@gmail.com/,
  485. 'TV': true},
  486. { 'name': 'HDSpace',
  487. 'icon': 'http://www.favicon.by/ico/5991df36e3635.ico',
  488. 'searchUrl': 'https://hd-space.org/index.php?page=torrents&active=0&options=2&search=%nott%',
  489. 'both': true},
  490. { 'name': 'HDT',
  491. 'icon': 'https://hdts.ru/favicon.ico',
  492. 'searchUrl': 'http://hd-torrents.org/torrents.php?active=0&options=2&search=%tt%',
  493. 'matchRegex': /No torrents here.../,
  494. 'both': true},
  495. { 'name': 'HDU',
  496. 'searchUrl': 'https://pt.upxin.net/torrents.php?search_area=4&search=tt0068646',
  497. 'matchRegex': /Nothing found! Try again with a refined search string/},
  498. { 'name': 'HDVN',
  499. 'searchUrl': 'http://torviet.com/torrents.php?search=%tt%&search_area=4&search_mode=0',
  500. 'matchRegex': /Nothing found! Try again with a refined search string|You need cookies enabled to log in or switch language/,
  501. 'both': true},
  502. { 'name': 'ILC',
  503. 'searchUrl': 'http://www.iloveclassics.com/browse.php?incldead=1&searchin=2&search=%tt%',
  504. 'matchRegex': /Try again with a refined search string|<h1>Not logged in!<\/h1>/},
  505. { 'name': 'IPT',
  506. 'searchUrl': 'https://www.iptorrents.com/torrents/?q=%tt%',
  507. 'matchRegex': /<h1 style="color:yellow">No Torrents Found!/},
  508. { 'name': 'IPT',
  509. 'searchUrl': 'https://www.iptorrents.com/torrents/?q=%search_string%',
  510. 'matchRegex': /<h1 style="color:yellow">No Torrents Found!/,
  511. 'TV': true},
  512. { 'name': 'KG',
  513. 'searchUrl': 'https://www.karagarga.in/browse.php?search_type=imdb&search=%nott%',
  514. 'matchRegex': /<h2>No torrents found|<h1>If you want the love<\/h1>/},
  515. { 'name': 'KZ',
  516. 'searchUrl': 'http://kinozal.tv/browse.php?s=%search_string%+%year%&g=0&c=1002&v=0&d=0&w=0&t=0&f=0',
  517. 'matchRegex': 'Нет активных раздач, приносим извинения. Пожалуйста, уточните параметры поиска'},
  518. { 'name': 'KZ',
  519. 'searchUrl': 'http://kinozal.tv/browse.php?s=%search_string%+%year%&g=0&c=1001&v=0&d=0&w=0&t=0&f=0',
  520. 'matchRegex': 'Нет активных раздач, приносим извинения. Пожалуйста, уточните параметры поиска',
  521. 'TV': true},
  522. { 'name': 'M-T',
  523. 'searchUrl': 'https://tp.m-team.cc/movie.php?incldead=1&spstate=0&inclbookmarked=0&search=%tt%&search_area=4&search_mode=2',
  524. 'matchRegex': /Nothing here!|Try again with a refined search string./},
  525. { 'name': 'MS',
  526. 'searchUrl': 'http://www.myspleen.org/browse.php?search=%search_string%&title=0&cat=0',
  527. 'matchRegex': /<strong>Nothing found!<\/strong>|<title>MySpleen :: Login<\/title>/,
  528. 'both': true},
  529. { 'name': 'MTV',
  530. 'searchUrl': 'https://www.morethan.tv/torrents.php?searchstr=%search_string%+%year%&tags_type=1&order_by=time&order_way=desc&group_results=1&filter_cat%5B1%5D=1&action=basic&searchsubmit=1',
  531. 'matchRegex': /<h2>Your search did not match anything.<\/h2>/},
  532. { 'name': 'MTV',
  533. 'searchUrl': 'https://www.morethan.tv/torrents.php?searchstr=%search_string%&tags_type=1&order_by=time&order_way=desc&group_results=1&filter_cat%5B2%5D=1&action=basic&searchsubmit=1',
  534. 'matchRegex': /<h2>Your search did not match anything.<\/h2>/,
  535. 'TV': true},
  536. { 'name': 'NNM',
  537. 'searchUrl': 'https://nnm-club.me/forum/tracker.php?nm=%search_string%+%year%',
  538. 'matchRegex': 'Не найдено',
  539. 'both': true},
  540. { 'name': 'NB',
  541. 'searchUrl': 'https://norbits.net/browse.php?incldead=1&fullsearch=0&scenerelease=0&imdbsearch=%tt%&imdb_from=0&imdb_to=0&search=',
  542. 'matchRegex': /<h3>Ingenting her!<\/h3>/,
  543. 'both': true},
  544. { 'name': 'NBL',
  545. 'searchUrl': 'https://nebulance.io/torrents.php?order_by=time&order_way=desc&searchtext=%search_string%&search_type=0&taglist=&tags_type=0',
  546. 'matchRegex': /Your search did not match anything/,
  547. 'TV': true},
  548. { 'name': 'OurBits',
  549. 'searchUrl': 'https://ourbits.club/torrents.php?search_area=4&search=%tt%',
  550. 'matchRegex': /Nothing found! Try again with a refined search string/},
  551. { 'name': 'PHD',
  552. 'searchUrl': 'https://privatehd.to/movies?search=&imdb=%tt%',
  553. 'matchRegex': /class="overlay-container"/,
  554. 'positiveMatch': true},
  555. { 'name': 'PHD',
  556. 'searchUrl': 'https://privatehd.to/tv-shows?search=&imdb=%tt%',
  557. 'matchRegex': /class="overlay-container"/,
  558. 'positiveMatch': true,
  559. 'TV': true},
  560. { 'name': 'PTN',
  561. 'icon': 'https://piratethenet.org/pic/favicon.ico',
  562. 'searchUrl': 'https://piratethenet.org/browseold.php?incldead=1&_by=3&search=%tt%',
  563. 'matchRegex': /Nothing found!/,
  564. 'both': true},
  565. { 'name': 'PTP',
  566. 'searchUrl': 'https://passthepopcorn.me/torrents.php?imdb=%tt%',
  567. 'matchRegex': /<h2>Your search did not match anything.<\/h2>/},
  568. { 'name': 'PTP-Req',
  569. 'searchUrl': 'https://passthepopcorn.me/requests.php?submit=true&search=%tt%',
  570. 'matchRegex': /Your search did not match anything.|<h1>Keep me logged in.<\/h1>/},
  571. { 'name': 'PxHD',
  572. 'searchUrl': 'https://pixelhd.me/torrents.php?groupname=&year=&tmdbover=&tmdbunder=&tmdbid=&imdbover=&imdbunder=&imdbid=%tt%&order_by=time&order_way=desc&taglist=&tags_type=1&filterTorrentsButton=Filter+Torrents',
  573. 'matchRegex': /<h2>Your search did not match anything.<\/h2>/},
  574. { 'name': 'RARAT',
  575. 'searchUrl': 'https://rarat.org/api/v1/torrents?extendedSearch=false&hideOld=false&index=0&limit=15&order=asc&page=search&searchText=%tt%&sort=n#https://rarat.org/search?search=%tt%',
  576. 'goToUrl': 'https://rarat.org/search?search=%tt%',
  577. 'matchRegex': /^$/,
  578. 'both': true},
  579. { 'name': 'RARBG',
  580. 'searchUrl': 'https://rarbg.to/torrents.php?imdb=%tt%',
  581. 'matchRegex': '//dyncdn.me/static/20/images/imdb_thumb.gif',
  582. 'positiveMatch': true,
  583. 'both': true},
  584. { 'name': 'RevTT',
  585. 'searchUrl': 'https://www.revolutiontt.me/browse.php?search=%tt%',
  586. 'matchRegex': /<h2>Nothing found!<\/h2>/},
  587. { 'name': 'RevTT',
  588. 'searchUrl': 'https://www.revolutiontt.me/browse.php?search=%search_string%&cat=0&incldead=1&titleonly=1',
  589. 'matchRegex': /<h2>Nothing found!<\/h2>/,
  590. 'TV': true},
  591. { 'name': 'RuT',
  592. 'searchUrl': 'https://rutracker.org/forum/tracker.php?nm=%search_string%',
  593. 'matchRegex': 'Не найдено',
  594. 'both': true},
  595. { 'name': 'Rutor',
  596. 'searchUrl': 'http://rutor.info/search/0/0/010/0/%tt%',
  597. 'matchRegex': 'Результатов поиска 0',
  598. 'both': true},
  599. { 'name': 'SDBits',
  600. 'searchUrl': 'http://sdbits.org/browse.php?c6=1&c3=1&c1=1&c4=1&c5=1&c2=1&m1=1&incldead=0&from=&to=&imdbgt=0&imdblt=10&uppedby=&imdb=&search=%tt%',
  601. 'matchRegex': /Nothing found!|<h1>You need cookies enabled to log in.<\/h1>/},
  602. { 'name': 'sHD',
  603. 'searchUrl': 'https://scenehd.org/browse.php?search=%tt%',
  604. 'matchRegex': /<h2>No torrents found!<\/h2>/},
  605. { 'name': 'SM',
  606. 'searchUrl': 'https://surrealmoviez.info/search.php?stext=%tt%',
  607. 'matchRegex': /0 Movies found matching search criteria|You need to be logged in to view this page/},
  608. { 'name': 'TBD',
  609. 'icon': 'https://1.bp.blogspot.com/-F2JeKtPCJYI/VgjpVxwMO4I/AAAAAAAAADg/VyNyp-yW9Ac/s1600/TBD.ico',
  610. 'searchUrl': 'http://www.torrentbd.com/torrent/torrents-search.php?search=%search_string%',
  611. 'matchRegex': /No torrents were found based on your search criteria./,
  612. 'both': true},
  613. { 'name': 'TD',
  614. 'searchUrl': 'https://www.torrentday.com/t?q=%tt%',
  615. 'matchRegex': /No Torrents Found!/,
  616. 'both': true},
  617. { 'name': 'TE',
  618. 'searchUrl': 'http://theempire.bz/browse.php?incldead=0&country=&nonboolean=1&search=%tt%',
  619. 'matchRegex': /Try again with a refined search string|<h1>You need cookies enabled to log in.<\/h1>/,
  620. 'both': true},
  621. { 'name': 'TG',
  622. 'searchUrl': 'https://thegeeks.bz/browse.php?incldead=0&country=&nonboolean=1&search=%tt%',
  623. 'matchRegex': /Try again with a refined search string|<h1>You need cookies enabled to log in.<\/h1>/,
  624. 'both': true},
  625. { 'name': 'THC',
  626. 'searchUrl': 'https://horrorcharnel.org/browse.php?search=%nott%&cat=0&incldead=1',
  627. 'matchRegex': /<h1>Not logged in!<\/h1>|<h2>Nothing found!<\/h2>/},
  628. { 'name': 'Tik',
  629. 'searchUrl': 'https://www.cinematik.net/browse.php?&cat=0&incldead=1&sort=1&type=asc&srchdtls=1&search=%tt%',
  630. 'matchRegex': /The page you tried to view can only be used when you're logged in|Nothing found!/},
  631. { 'name': 'TL',
  632. 'searchUrl': 'http://www.torrentleech.org/torrents/browse/index/query/%search_string%+%year%/categories/1,8,9,10,11,12,13,14,15,29',
  633. 'matchRegex': /Signup With Invite|Please refine your search./},
  634. { 'name': 'TL',
  635. 'searchUrl': 'http://www.torrentleech.org/torrents/browse/index/query/%search_string%/categories/2,26,27,32',
  636. 'matchRegex': /Signup With Invite|Please refine your search./,
  637. 'TV': true},
  638. { 'name': 'TPB',
  639. 'searchUrl': 'https://thepiratebay.org/search/%tt%',
  640. 'matchRegex': /No hits. Try adding an asterisk in you search phrase.<\/h2>/,
  641. 'both': true},
  642. { 'name': 'TVV',
  643. 'searchUrl': 'http://tv-vault.me/torrents.php?searchstr=%search_string%',
  644. 'matchRegex': /Nothing found<\/h2>/,
  645. 'TV': true},
  646. { 'name': 'UHDB',
  647. 'searchUrl': 'https://uhdbits.org/torrents.php?action=advanced&groupname=%tt%',
  648. 'matchRegex': /Your search did not match anything./},
  649. { 'name': 'x264',
  650. 'searchUrl': 'http://x264.me/browse.php?incldead=0&xtype=0&stype=3&search=%tt%',
  651. 'matchRegex': /Try again with a refined search string.|<h1>Forgot your password?<\/h1>/}
  652. ];
  653.  
  654. var icon_sites = [
  655. { 'name': 'OpenSubtitles',
  656. 'searchUrl': 'http://www.opensubtitles.org/en/search/imdbid-%tt%'},
  657. { 'name': 'YouTube.com',
  658. 'searchUrl': 'https://www.youtube.com/results?search_query="%search_string%"+%year%+trailer'},
  659. { 'name': 'Rotten Tomatoes',
  660. 'searchUrl': 'https://www.rottentomatoes.com/search/?search=%search_string%'},
  661. { 'name': 'Criticker',
  662. 'searchUrl': 'https://www.criticker.com/?search=%search_string%&type=films'},
  663. { 'name': 'iCheckMovies',
  664. 'searchUrl': 'https://www.icheckmovies.com/search/movies/?query=%tt%'},
  665. { 'name': 'Letterboxd',
  666. 'searchUrl': 'http://letterboxd.com/imdb/%nott%'},
  667. { 'name': 'Subscene',
  668. 'searchUrl': 'http://subscene.com/subtitles/title?q=%search_string%'},
  669. { 'name': 'SubtitleSeeker',
  670. 'searchUrl': 'http://www.subtitleseeker.com/%nott%/Movie/Releases/English/'},
  671. { 'name': 'Wikipedia',
  672. 'searchUrl': 'https://en.wikipedia.org/w/index.php?search=%search_string%&go=Go'},
  673. { 'name': 'FilmAffinity',
  674. 'searchUrl': 'http://www.filmaffinity.com/en/advsearch.php?stext=%search_string%&stype[]=title&fromyear=%year%&toyear=%year%',
  675. 'showByDefault': false},
  676. { 'name': 'Metacritic',
  677. 'searchUrl': 'http://www.metacritic.com/search/all/%search_string%/results?cats[movie]=1&cats[tv]=1&search_type=advanced&sort=relevancy',
  678. 'showByDefault': false},
  679. { 'name': 'Can I Stream.It? (Movie)',
  680. 'searchUrl': 'http://www.canistream.it/search/movie/%search_string%',
  681. 'showByDefault': false},
  682. { 'name': 'Can I Stream.It? (TV)',
  683. 'searchUrl': 'http://www.canistream.it/search/tv/%search_string%',
  684. 'showByDefault': false},
  685. { 'name': 'AllMovie',
  686. 'searchUrl': 'http://www.allmovie.com/search/movies/%search_string%',
  687. 'showByDefault': false},
  688. { 'name': 'Facebook',
  689. 'searchUrl': 'https://www.facebook.com/search/str/%search_string%/keywords_pages',
  690. 'showByDefault': false},
  691. { 'name': 'Amazon',
  692. 'searchUrl': 'http://www.amazon.com/s/ref=nb_sb_noss?url=search-alias%3Dmovies-tv&field-keywords=%search_string%',
  693. 'showByDefault': false},
  694. { 'name': 'Netflix',
  695. 'searchUrl': 'http://www.netflix.com/search/%search_string%',
  696. 'showByDefault': false},
  697. { 'name': 'Blu-ray.com',
  698. 'searchUrl': 'http://www.blu-ray.com/search/?quicksearch=1&quicksearch_country=all&quicksearch_keyword=%search_string%+&section=bluraymovies',
  699. 'showByDefault': false},
  700. { 'name': 'trakt.tv',
  701. 'icon': 'https://walter.trakt.tv/hotlink-ok/public/favicon.ico',
  702. 'searchUrl': 'https://trakt.tv/search?query=%search_string%',
  703. 'showByDefault': false}
  704. ];
  705.  
  706. // For internal use (order matters)
  707. var valid_states = [
  708. 'found',
  709. 'missing',
  710. 'logged_out',
  711. 'error'
  712. ]
  713.  
  714. function replaceSearchUrlParams(site, movie_id, movie_title) {
  715. var search_url = site['searchUrl']
  716. // If an array, do a little bit of recursion
  717. if ($.isArray(search_url)) {
  718. var search_array = [];
  719. $.each(search_url, function(index, url) {
  720. search_array[index] = replaceSearchUrlParams(url, movie_id, movie_title);
  721. });
  722. return search_array;
  723. }
  724. var space_replace = ('spaceEncode' in site) ? site['spaceEncode'] : '+'
  725. var search_string = movie_title.replace(/ +\(.*/, '').replace(/\s+/g, space_replace);
  726. var movie_year = document.title.replace(/^(.+) \((.*)([0-9]{4})(.*)$/gi, '$3');
  727. var s= search_url.replace(/%tt%/g, 'tt' + movie_id)
  728. .replace(/%nott%/g, movie_id)
  729. .replace(/%search_string%/g, search_string)
  730. .replace(/%year%/g, movie_year);
  731. return s;
  732. }
  733.  
  734. function getPageSetting(key) {
  735. return (onSearchPage ? GM_config.get(key + '_search') : GM_config.get(key + '_movie'))
  736. }
  737.  
  738. // Small utility function to return a site's icon
  739. function getFavicon(site, hide_on_err) {
  740. if (typeof(hide_on_err) === 'undefined') hide_on_err = false;
  741. if ('icon' in site) {
  742. var favicon = site['icon'];
  743. } else {
  744. var url = new URL(site['searchUrl'])
  745. var favicon = url.origin + '\/favicon.ico';
  746. }
  747. var img = $('<img />').attr({'style': '-moz-opacity: 0.4; border: 0; vertical-align: text-top',
  748. 'width': '16',
  749. 'src': favicon,
  750. 'title': site['name'],
  751. 'alt': site['name']});
  752. if (hide_on_err) img.attr('onerror', "this.style.display='none';");
  753. return img;
  754. }
  755.  
  756. // Adds search links to an element
  757. // state should always be one of the values defined in valid_states
  758. function addLink(elem, link_text, target, site, state) {
  759. var link = $('<a />').attr('href', target).attr('target', '_blank');
  760. if ($.inArray(state, valid_states) < 0) {
  761. console.log("Unknown state " + state);
  762. }
  763. if (getPageSetting('use_icons')) {
  764. var icon = getFavicon(site);
  765. icon.css({'border-width': '3px', 'border-style': 'solid', 'border-radius': '2px'});
  766. if (state == 'error' || state == 'logged_out') {
  767. icon.css('border-color', 'red');
  768. } else if (state == 'missing') {
  769. icon.css('border-color', 'yellow');
  770. } else {
  771. icon.css('border-color', 'green');
  772. }
  773. link.append(icon);
  774. } else {
  775. if (state == 'missing' || state == 'error' || state == 'logged_out') {
  776. link.append($('<s />').append(link_text));
  777. } else {
  778. link.append(link_text);
  779. }
  780. if (state == 'error' || state == 'logged_out') {
  781. link.css('color', 'red');
  782. }
  783. }
  784.  
  785. if (!onSearchPage) {
  786. $('#imdbscout_' + state).append(link).append(' ');
  787. } else {
  788. var result_box = $(elem).find('td.result_box');
  789. if (result_box.length > 0) {
  790. $(result_box).append(link);
  791. } else {
  792. $(elem).append($('<td />').append(link).addClass('result_box'));
  793. }
  794. }
  795. }
  796.  
  797. // Performs an ajax request to determine
  798. // whether or not a url should be displayed
  799. function maybeAddLink(elem, link_text, search_url, site) {
  800. // If the search URL is an array, recurse briefly on the elements.
  801. if ($.isArray(search_url)) {
  802. $.each(search_url, function(index, url) {
  803. maybeAddLink(elem, link_text + '_' + (index + 1).toString(), url, site);
  804. });
  805. return;
  806. }
  807.  
  808. var domain=search_url.split('/')[2];
  809. var now=(new Date())*1;
  810. var lastLoaded=window.localStorage[domain+'_lastLoaded'];
  811. if(!lastLoaded) {
  812. lastLoaded=now-5000;
  813. } else {
  814. lastLoaded=parseInt(lastLoaded);
  815. }
  816. if(now-lastLoaded < 1000) {
  817. window.setTimeout(maybeAddLink.bind(undefined, elem, site['name'], search_url, site), 1000);
  818. return;
  819. }
  820. else
  821. {
  822. window.localStorage[domain+'_lastLoaded']=(new Date())*1;
  823. }
  824.  
  825. var target = search_url;
  826. if(site.goToUrl)
  827. target=site.goToUrl;
  828. var success_match = ('positiveMatch' in site) ? site['positiveMatch'] : false;
  829. GM_xmlhttpRequest({
  830. method: 'GET',
  831. url: search_url,
  832. onload: function(response_details) {
  833. if (String(response_details.responseText).match(site['matchRegex']) ? !(success_match) : success_match) {
  834. if (!getPageSetting('hide_missing')) {
  835. addLink(elem, link_text, target, site, 'missing');
  836. }
  837. } else if (site['loggedOutRegex'] && String(response_details.responseText).match(site['loggedOutRegex'])) {
  838. addLink(elem, link_text, target, site, 'logged_out');
  839. } else {
  840. addLink(elem, link_text, target, site, 'found');
  841. }
  842. },
  843. onerror: function(response) {
  844. addLink(elem, link_text, target, site, 'error');
  845. },
  846. onabort: function(response) {
  847. addLink(elem, link_text, target, site, 'error');
  848. }
  849. });
  850. }
  851.  
  852. // Run code to create fields and display sites
  853. function perform(elem, movie_id, movie_title, is_tv, is_movie) {
  854. var site_shown = false;
  855. $.each(sites, function(index, site) {
  856. if (site['show']) {
  857. site_shown = true;
  858. // If we're on a TV page, only show TV links.
  859. if ((Boolean(site['TV']) == is_tv ||
  860. Boolean(site['both'])) ||
  861. (!is_tv && !is_movie)) {
  862. searchUrl = replaceSearchUrlParams(site, movie_id, movie_title);
  863. if(site.goToUrl)
  864. site.goToUrl=replaceSearchUrlParams({
  865. 'searchUrl': site['goToUrl'],
  866. 'spaceEncode': ('spaceEncode' in site) ? site['spaceEncode'] : '+'
  867. }, movie_id, movie_title);
  868. if (getPageSetting('call_http')) {
  869. maybeAddLink(elem, site['name'], searchUrl, site);
  870. } else {
  871. addLink(elem, site['name'], searchUrl, site, 'found');
  872. }
  873. }
  874. }
  875. });
  876. if (!site_shown) {
  877. $(elem).append('No sites enabled! You can change this via the Greasemonkey option "IMDb Scout Preferences".');
  878. }
  879. }
  880.  
  881. //------------------------------------------------------
  882. // Button Code
  883. //------------------------------------------------------
  884.  
  885. function displayButton() {
  886. var p = $('<p />').attr('id', 'imdbscout_button');
  887. p.append($('<button>Load IMDb Scout</button>').click(function() {
  888. $('#imdbscout_button').remove();
  889. if (onSearchPage) {
  890. performSearch();
  891. } else {
  892. performPage();
  893. }
  894. }));
  895. if (onSearchPage) {
  896. $('#sidebar').append(p);
  897. } else if ($('h1.header:first').length) {
  898. $('h1.header:first').parent().append(p);
  899. } else {
  900. $('#title-overview-widget').parent().append(p);
  901. }
  902. }
  903.  
  904. //------------------------------------------------------
  905. // Icons at top bar
  906. //------------------------------------------------------
  907.  
  908. // Adds a dictionary of icons to the top of the page.
  909. // Unlike the other URLs, they aren't checked to see if the movie exists.
  910. function addIconBar(movie_id, movie_title) {
  911. if ($('h1.header:first').length) {
  912. var iconbar = $('h1.header:first').append($('<br/>'));
  913. } else if ($('.title_wrapper h1')) {
  914. var iconbar = $('.title_wrapper h1').append($('<br/>'));
  915. } else {
  916. var iconbar = $('#tn15title .title-extra');
  917. }
  918. $.each(icon_sites, function(index, site) {
  919. if (site['show']) {
  920. var search_url = replaceSearchUrlParams(site, movie_id, movie_title);
  921. var image = getFavicon(site);
  922. var html = $('<span />').append($('<a />').attr('href', search_url)
  923. .addClass('iconbar_icon').append(image));
  924. iconbar.append(html).append(' ');
  925. }
  926. });
  927. //If we have access to the openInTab function, add an Open All feature
  928. if (GM_openInTab) {
  929. var aopenall = $('<a />').text('Open All')
  930. .attr('href', 'javascript:;')
  931. .attr('style', 'font-weight:bold;font-size:10px;font-family: Calibri, Verdana, Arial, Helvetica, sans-serif;');
  932. aopenall.click(function() {
  933. $('.iconbar_icon').each(function() {
  934. GM_openInTab($(this).attr('href'));
  935. });
  936. }, false);
  937. iconbar.append(aopenall);
  938. }
  939. }
  940.  
  941. //------------------------------------------------------
  942. // Search page code
  943. //------------------------------------------------------
  944.  
  945. function performSearch() {
  946. //Add css for the new table cells we're going to add
  947. var styles = '.result_box {width: 335px}';
  948. styles += ' .result_box a { margin-right: 5px; color: #444;} ';
  949. styles += ' .result_box a:visited { color: #551A8B; }';
  950. styles += ' #content-2-wide #main, #content-2-wide';
  951. styles += ' .maindetails_center {margin-left: 5px; width: 1001px;} ';
  952. GM_addStyle(styles);
  953.  
  954. if($('div#main table.results tr.detailed').length !== 0) {
  955. //Loop through each result row
  956. $('div#main table.results tr.detailed').each(function() {
  957. var link = $(this).find('.title>a');
  958. var is_tv = Boolean($(this).find('.year_type').html()
  959. .match('TV Series'));
  960. var is_movie = Boolean($(this).find('.year_type').html()
  961. .match(/\(([0-9]*)\)/));
  962. var movie_title = link.html();
  963. var movie_id = link.attr('href').match(/tt([0-9]*)\/?$/)[1];
  964.  
  965. $(this).find('span.genre a').each(function() {
  966. if ($(this).html() == 'Adult') {
  967. $(this).parent().parent().parent()
  968. .css('background-color', 'red');
  969. }
  970. });
  971. perform($(this), movie_id, movie_title, is_tv, is_movie);
  972. });
  973. } else {
  974. // Chameleon code, in a different style
  975. var titleDivs=document.getElementsByClassName('col-title');
  976. var compact=true;
  977. if(titleDivs.length === 0)
  978. {
  979. titleDivs=document.getElementsByClassName('lister-item-header');
  980. compact=false;
  981. }
  982. for(var i=0; i<titleDivs.length; i++)
  983. {
  984. var t=titleDivs[i];
  985. var link=t.getElementsByTagName('a')[0];
  986. var is_tv=link.nextElementSibling.textContent.indexOf('-')!==-1;
  987. var is_movie=!is_tv;
  988. var movie_title=link.textContent;
  989. var movie_id=link.href.split("/title/tt")[1].split("/")[0];
  990.  
  991. var elem=t.parentNode.parentNode;
  992. if(!compact)
  993. elem=t.parentNode;
  994. perform(elem, movie_id, movie_title, is_tv, is_movie);
  995. }
  996. }
  997. }
  998.  
  999. //------------------------------------------------------
  1000. // TV/movie page code
  1001. //------------------------------------------------------
  1002.  
  1003. function performPage() {
  1004. var movie_title = $('title').text().match(/^(.*?) \(/)[1];
  1005. var movie_id = document.URL.match(/\/tt([0-9]+)\//)[1].trim('tt');
  1006. var is_tv_page = Boolean($('title').text().match('TV Series')) ||
  1007. Boolean($('.tv-extra').length);
  1008. var is_movie_page = Boolean($('title').text().match(/.*? \(([0-9]*)\)/));
  1009. //Create area to put links in
  1010. perform(getLinkArea(), movie_id, movie_title,
  1011. is_tv_page, is_movie_page);
  1012. addIconBar(movie_id, movie_title);
  1013. }
  1014.  
  1015. //------------------------------------------------------
  1016. // Find/create elements
  1017. //------------------------------------------------------
  1018.  
  1019. function getLinkArea() {
  1020. // If it already exists, just return it
  1021. if ($('#imdbscout_header').length) {
  1022. return $('#imdbscout_header');
  1023. }
  1024. var p = $('<p />').append('<h2>' + GM_config.get('imdbscout_header_text') + '</h2>').attr('id', 'imdbscout_header').css({
  1025. 'padding': '0px 20px',
  1026. 'font-weight': 'bold'
  1027. });
  1028. $.each(valid_states, function(i, name) {
  1029. if (GM_config.get('one_line')) {
  1030. p.append($('<span />').attr('id', 'imdbscout_' + name));
  1031. } else {
  1032. var title = $('<span>' + name.replace('_', ' ') + ': </span>').css({
  1033. 'textTransform': 'capitalize',
  1034. 'min-width': '100px',
  1035. 'display': 'inline-block'
  1036. });
  1037. p.append($('<div />').attr('id', 'imdbscout_' + name).append(title));
  1038. }
  1039. });
  1040. if ($('h1.header:first').length) {
  1041. $('h1.header:first').parent().append(p);
  1042. } else if ($('#title-overview-widget').length) {
  1043. $('#title-overview-widget').parent().append(p);
  1044. } else if ($('.titlereference-header').length) {
  1045. $('.titlereference-header').append(p);
  1046. } else {
  1047. $('#tn15rating').before(p);
  1048. }
  1049. return $('#imdbscout_header');
  1050. }
  1051.  
  1052. //------------------------------------------------------
  1053. // Code being run (main)
  1054. //------------------------------------------------------
  1055.  
  1056. // Get everything configured
  1057.  
  1058. // Create the non-site dictionary for GM_config
  1059. var config_fields = {
  1060. 'imdbscout_header_text': {
  1061. 'label': 'Header text:',
  1062. 'type': 'text',
  1063. 'default': 'Pirate this film: '
  1064. },
  1065. 'call_http_movie': {
  1066. 'section': 'Movie Page:',
  1067. 'type': 'checkbox',
  1068. 'label': 'Actually check for torrents?',
  1069. 'default': true
  1070. },
  1071. 'load_on_start_movie': {
  1072. 'type': 'checkbox',
  1073. 'label': 'Load on start?',
  1074. 'default': true
  1075. },
  1076. 'hide_missing_movie': {
  1077. 'type': 'checkbox',
  1078. 'label': 'Hide missing links?',
  1079. 'default': false
  1080. },
  1081. 'use_icons_movie': {
  1082. 'type': 'checkbox',
  1083. 'label': 'Use icons instead of text?',
  1084. 'default': false
  1085. },
  1086. 'one_line': {
  1087. 'type': 'checkbox',
  1088. 'label': 'Show results on one line?',
  1089. 'default': true
  1090. },
  1091. 'call_http_search': {
  1092. 'section': 'Search Page:',
  1093. 'type': 'checkbox',
  1094. 'label': 'Actually check for torrents?',
  1095. 'default': true
  1096. },
  1097. 'load_on_start_search': {
  1098. 'type': 'checkbox',
  1099. 'label': 'Load on start?',
  1100. 'default': true
  1101. },
  1102. 'hide_missing_search': {
  1103. 'type': 'checkbox',
  1104. 'label': 'Hide missing links?',
  1105. 'default': false
  1106. },
  1107. 'use_icons_search': {
  1108. 'type': 'checkbox',
  1109. 'label': 'Use icons instead of text?',
  1110. 'default': false
  1111. },
  1112. 'load_on_ILC_requests': {
  1113. 'section': 'Extra pages to run on:',
  1114. 'type': 'checkbox',
  1115. 'label': 'ILC Requests',
  1116. 'default': false
  1117. }
  1118. };
  1119.  
  1120. // Add each site to a GM_config dictionary schema
  1121. // The GM_config default for checkboxes is false
  1122. $.each(sites, function(index, site) {
  1123. config_fields['show_' + site['name'] + (site['TV'] ? '_TV' : '')] = {
  1124. 'section': (index == 0) ? ['Torrents:'] : '',
  1125. 'type': 'checkbox',
  1126. 'label': ' ' + site['name'] + (site['TV'] ? ' (TV)' : '')
  1127. };
  1128. });
  1129.  
  1130. // Icon sites should be shown by default though,
  1131. // since they barely use any resources.
  1132. $.each(icon_sites, function(index, icon_site) {
  1133. config_fields['show_icon_' + icon_site['name']] = {
  1134. 'section': (index == 0) ? ['Other sites:'] : '',
  1135. 'type': 'checkbox',
  1136. 'label': ' ' + icon_site['name'],
  1137. 'default': ('showByDefault' in icon_site) ?
  1138. icon_site['showByDefault'] : true
  1139. };
  1140. });
  1141.  
  1142. // Initialize and register GM_config
  1143. GM_config.init({
  1144. 'id': 'imdb_scout',
  1145. 'title': 'IMDb Scout Preferences',
  1146. 'fields': config_fields,
  1147. 'css': '.section_header { \
  1148. background: white !important; \
  1149. color: black !important; \
  1150. border: 0px !important; \
  1151. text-align: left !important;} \
  1152. .field_label { \
  1153. font-weight: normal !important;}',
  1154. 'events':
  1155. {
  1156. 'open': function() {
  1157. $('#imdb_scout').contents().find('#imdb_scout_section_3').find('.field_label').each(function(index, label) {
  1158. url = new URL(sites[index].searchUrl);
  1159. $(label).append(' ' + '<a class="grey_link" target="_blank" style="color: gray; text-decoration : none" href="' + url.origin + '">'
  1160. + (/www./.test(url.hostname) ? url.hostname.match(/www.(.*)/)[1] : url.hostname) + '</a>');
  1161. $(label).prepend(getFavicon(sites[index], true));
  1162. });
  1163. $('#imdb_scout').contents().find('#imdb_scout_section_4').find('.field_label').each(function(index, label) {
  1164. $(label).prepend(getFavicon(icon_sites[index], true));
  1165. });
  1166. }
  1167. }
  1168. });
  1169. GM_registerMenuCommand('IMDb Scout Preferences', function() {GM_config.open()});
  1170.  
  1171. // Fetch per-site values from GM_config
  1172. $.each(sites, function(index, site) {
  1173. site['show'] = GM_config.get('show_' + site['name'] +
  1174. (site['TV'] ? '_TV' : ''));
  1175. });
  1176.  
  1177. $.each(icon_sites, function(index, icon_site) {
  1178. icon_site['show'] = GM_config.get('show_icon_' + icon_site['name']);
  1179. });
  1180.  
  1181. // Are we on a search page?
  1182. // This variable is camelCased to show it's global
  1183. // Hopefully it can be factored out of the global scope in the future
  1184. var onSearchPage = Boolean(location.href.match('search'));
  1185.  
  1186. $('title').ready(function() {
  1187. if(window.location.href.indexOf('iloveclassics.com') !== -1 && GM_config.get('load_on_ILC_requests'))
  1188. {
  1189. iloveclassics();
  1190. return;
  1191. }
  1192. if (!onSearchPage && GM_config.get('load_on_start_movie')) {
  1193. performPage();
  1194. } else if (onSearchPage && GM_config.get('load_on_start_search')) {
  1195. performSearch();
  1196. } else {
  1197. displayButton();
  1198. }
  1199. });
  1200.  
  1201. function iloveclassics()
  1202. {
  1203. var movie_id=document.body.textContent.split('imdb.com/title/tt');
  1204. if(movie_id.length < 2)
  1205. return;
  1206.  
  1207. var tr=document.createElement('tr');
  1208. tr.setAttribute('style', 'background-color: rgb(59,59,59); background-image: url("http://www.iloveclassics.com/themes/NB-iSkin/images/NB_col1.gif"); background-position: 50% 0%; background-repeat: repeat-x; empty-cells: show;');
  1209. var e=document.getElementsByClassName('clearalt6')[0].parentNode;
  1210. e.parentNode.insertBefore(tr, e);
  1211.  
  1212. var td=document.createElement('td');
  1213. td.style.textAlign='right';
  1214. tr.appendChild(td);
  1215. td.innerHTML=GM_config.get('imdbscout_header_text');
  1216.  
  1217. var td=document.createElement('td');
  1218. td.setAttribute('id', 'imdbscout_found');
  1219. tr.appendChild(td);
  1220.  
  1221.  
  1222. var movie_title = document.getElementsByClassName('table_head')[0].textContent;
  1223. var movie_id = parseInt(movie_id[1]);
  1224. while(movie_id.length < 7)
  1225. movie_id='0'+movie_id;
  1226. var is_tv_page = false;
  1227. var is_movie_page = true;
  1228. perform(td, movie_id, movie_title,
  1229. is_tv_page, is_movie_page);
  1230. }