Adds links to search for popular torrent sites
/* globals GM, GM.xmlHttpRequest, GM_setValue, GM_getValue, GM_info */ // ==UserScript== // @name Kinopoisk+ // @name:ru Кинопоиск+ // @description Adds links to search for popular torrent sites // @description:ru Добавляет ссылки для поиска по популярным торрент-сайтам // @namespace kp.user.js // @version 1.1.8 // @author Xant1k@bt (2015-2017), askornot (2020-2022) // @license MIT // @icon https://icons.duckduckgo.com/ip9/kinopoisk.ru.ico // @homepageURL https://greasyfork.org/en/scripts/418547-kinopoisk // @supportURL https://greasyfork.org/en/scripts/418547-kinopoisk/feedback // @match https://www.kinopoisk.ru/* // @grant GM.xmlHttpRequest // @grant GM_getValue // @grant GM_setValue // @connect www.google.com // @run-at document-end // @compatible chrome Violentmonkey 2.12.7 // @compatible firefox Greasemonkey 4.10.0 // @compatible firefox Tampermonkey 4.11.6120 // @noframes // ==/UserScript== 'use strict'; const css = String.raw` <style type="text/css"> .resources { padding: 4px; } .resources a { display: inline-block; margin: 2px; } .resources a img { width: 16px; height: 16px; } .iface__resources { display: none; } .iface__resources__active { display: block; } .plus__square { background: none; vertical-align: top; border: none; color: rgba(31,31,31,.5); padding: 1px; } .plus__square:hover { color: #1f1f1f; } .plus__square:before { content: "\02795"; } .minus__square:before { content: "\2796"; } .input__resource { width: 80%; } label[for="input__resource"] { color: #393939; font-weight: 400; font-size: 12px; } </style>`; const DEFAULT_RESOURCES = [ 'https://reyohoho.github.io/reyohoho/#%id', 'https://rutracker.org/forum/tracker.php?nm=%text %year', 'http://kinozal.tv/browse.php?s=%text&d=%year', 'http://rutor.info/search/0/0/100/0/%text %year', 'https://teamhd.org/browse?search=%text&year=%YEAR', 'https://nnmclub.to/forum/tracker.php?nm=%text %year', 'https://www.imdb.com/search/title/?title=%engtext&release_date=%year,%endyear', 'https://www.youtube.com/r###lts?search_query=%text %year' ]; const HINT = ( 'Шаблоны для составления запроса %id, %text %engtext %year %endyear' ); const LOADING_IMG = 'data:image/gif;base64,R0lGODlhIAAgAOYAAP////39/f7+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MChY6PhQcIHBwlFQ8klAWMkJ0E###alicnNQsqLBAaFAedhZ8iD7GhFScLCzUQKg0NFQgBrgIMERQUHLMatbipKkoNLxAUjZAMIBEKxsgVJMu6zj0vHgoDjwYg1tfGD6EnJDW5zQ09QuFCItODAw4ICNbYxxpELTihi9e8F+GGCAFBSEABB/v6XaMEokABBgUUaIAgpKMHDzuGHGmAj0CCBBD5WXNAQAA+AANAnNjxMeSQER0cCBJgwOLJfSASAINEgIWHITdHHIGhRFAABhh9Jijw8lGBGh2UHpHR4QIDAAcMGIAadWgwBFtlcO0wYwFYAwT/xI4l4IrQABUXOnSAwdeDAAKAAxsgV3enCBeIEc/YIeCAY8eAq7qK0PWC5RkdBAzYPMAxp8KCIhiZQZo0Dc2cN5sFjeADjdevZQgIQLt2AMmdFnzYzZsGgNrTVhf2YAKHceMjALgU5ABCCQTKCyvAYcKEj+tJGuw88CLEhBQ+WDAMBgNJkiTVrT8YBCFFkRAhbsT48PURzxE8MmQwf95FK7AmhFCEBQSGYIELFfzn1AEKjKCDDkTohwQSRDQlyABJCEggChxawAQMKmAT0BErBMHDCg9GmAENdA2ygwQGcniDBCncsIQEG2BARBAY5LDBDyemmMF6hBgww4Yz0rjEeARMYgCEDUEwscGPJ66wgXaOOHCBgDOmkMKSLWCAQQxQ5iDlD2jq4IFwgxQwwxIhKMlkC0CMaUOZUm6wQg9sFomfgV/SKWYTZAaRgw06ktCnIxy4sIEEE1gAxARiPolBCya4BdogBCgAgQlJpPADBkFkoIMRREISCAA7'; const CONTAINER_WAITING_TIME = 1000; const ONE_PIXEL = 1; const STORAGE_KEY = '__kp_resources'; const USER_RESOURCES = []; const QUERY_DATA = {}; let containerResources, controlResources; const blobToBase64 = (blob, fn) => { const reader = new FileReader(); reader.readAsDataURL(blob); reader.onloadend = () => fn(reader.r###lt); }; const favicon = ({ target }) => { if (target.naturalWidth === ONE_PIXEL) { target.setAttribute('src', LOADING_IMG); GM.xmlHttpRequest({ url: 'https://www.google.com/s2/favicons?domain=' + target.alt, method: 'GET', onload: ({ status, response }) => { if (status === 200) { blobToBase64(response, (base64) => { target.setAttribute('src', base64); }); } }, responseType: 'blob' }); } }; const safeURL = (str) => { try { return new URL(str); } catch { return {}; } }; const querystring = (str) => ( str.replace(/(?:%(\w+)?)/g, (str, word) => { if (word === undefined) return ''; word = word.toLowerCase(); return word in QUERY_DATA ? encodeURIComponent(QUERY_DATA[word]) : str; }) ); const extractQueryData = () => { try { const script = document.querySelector('#__NEXT_DATA__'); const { props, query } = JSON.parse(script.textContent); const { apolloState: { data } } = props; const { id } = query; const { releaseYears, productionYear, title } = ( data[`TvSeries:${id}`] || data[`Film:${id}`] ); const [ year ] = Array.isArray(releaseYears) ? releaseYears : [ productionYear ]; const { start, end } = typeof year === 'object' ? year : { start: year, end: year }; Object.assign(QUERY_DATA, { id, year: start, endyear: end, engtext: title.original || title.russian, text: title.russian }); } catch {} }; const addResource = (host, href) => { const a = document.createElement('a'); const img = document.createElement('img'); const query = querystring(href); a.setAttribute('target', '_blank'); a.setAttribute('rel', 'noopener noreferrer'); a.setAttribute('title', host); a.setAttribute('href', query); img.setAttribute('src', 'https://favicon.yandex.net/favicon/' + host); img.setAttribute('alt', host); img.addEventListener('load', favicon, { once: true }); img.addEventListener('error', favicon, { once: true }); a.append(img); containerResources.insertAdjacentElement('afterbegin', a); }; const addResourceClick = ({ target }) => { const { previousSibling: input } = target; const { host, href } = safeURL(input.value); if (host === undefined) return false; addResource(host, href); USER_RESOURCES.push(href); input.value = ''; }; const controlClick = ({ target }) => { target.classList.toggle('minus__square'); controlResources.classList.toggle('iface__resources__active'); }; const initInterface = () => { const label = document.createElement('label'); const input = document.createElement('input'); const button = document.createElement('button'); const span = document.createElement('span'); span.classList.add('error__resource'); input.classList.add('input__resource'); label.textContent = HINT; button.textContent = '+'; label.setAttribute('for', 'input__resource'); input.setAttribute('id', 'input__resource'); button.addEventListener('click', addResourceClick); controlResources.append(label); controlResources.append(input); controlResources.append(button); controlResources.append(span); containerResources.insertAdjacentElement('afterend', controlResources); }; const initControl = () => { const button = document.createElement('button'); const i = document.createElement('i'); button.className = 'plus__square'; button.setAttribute('role', 'button'); button.setAttribute('title', 'Добавить новый ресурс'); button.addEventListener('click', controlClick); button.append(i); containerResources.append(button); }; const initResources = (resources) => { for (const resource of resources) { const { host, href } = safeURL(resource); if (host === undefined) continue; addResource(host, href); } }; extractQueryData(); if (Object.keys(QUERY_DATA).length === 0) return; containerResources = document.createElement('div'); containerResources.classList.add('resources'); initResources(DEFAULT_RESOURCES); const timer = setInterval(() => { const container = document.querySelector('.styles_posterContainer__F02wH'); if (container) clearInterval(timer); document.head.insertAdjacentHTML('beforeend', css); container.insertAdjacentElement('beforeend', containerResources); if (GM_info.scriptHandler !== 'Greasemonkey') { controlResources = document.createElement('div'); controlResources.classList.add('iface__resources'); const resources = GM_getValue(STORAGE_KEY, USER_RESOURCES); USER_RESOURCES.push(...resources); initResources(resources); initControl(); initInterface(); window.onbeforeunload = (event) => { GM_setValue(STORAGE_KEY, USER_RESOURCES); delete event.returnValue; }; } }, CONTAINER_WAITING_TIME);