您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Ищет фильм в Google и автоматически переходит на Flicksbar без использования API Кинопоиска
当前为
// ==UserScript== // @name Кнопка перехода на Flicksbar из Kinorium (без использования API Кинопоиска) // @namespace http://tampermonkey.net/ // @version 1.0.5.1.0 // @description Ищет фильм в Google и автоматически переходит на Flicksbar без использования API Кинопоиска // @author CgPT & Vladimir_0202 // @icon https://ru.kinorium.com/favicon.ico // @match *://*.kinorium.com/* // @match *://www.google.com/search* // @match *://flicksbar.mom/* // @grant GM_setValue // @grant GM_getValue // @license MIT // ==/UserScript== (function () { 'use strict'; const url = window.location.href; // === 1. KINORIUM: Добавляем кнопку на страницу фильма === if (/kinorium\.com\/\d+\/?$/.test(url)) { // Сохраняем постер и описание в хранилище Tampermonkey const posterEl = document.querySelector('.jsCarouselImageContainer img'); const descEl = document.querySelector('.film-page__text'); const titleEl = document.querySelector('.film-page__title-text.film-page__itemprop'); const originalTitleEl = document.querySelector('.film-page__orig_with_comment'); const yearEl = document.querySelector('.film-page__date a[href*="years_min="]'); const raitingEl = document.querySelector('.film-page__title-rating'); const poster = posterEl?.src; const description = descEl?.innerText; const titleTMP = titleEl?.innerText; const originalTitleTMP = originalTitleEl?.innerText; const yearTMP = yearEl?.innerText; const raitingTMP = raitingEl?.innerText; if (poster && description) { GM_setValue('flicksbar_poster', poster); // Сохраняем в хранилище Tampermonkey GM_setValue('flicksbar_description', description); // Сохраняем в хранилище Tampermonkey GM_setValue('flicksbar_titleTMP', titleTMP); // Сохраняем в хранилище Tampermonkey GM_setValue('flicksbar_originalTitleTMP', originalTitleTMP); // Сохраняем в хранилище Tampermonkey GM_setValue('flicksbar_yearTMP', yearTMP); // Сохраняем в хранилище Tampermonkey GM_setValue('flicksbar_raitingTMP', raitingTMP); // Сохраняем в хранилище Tampermonkey console.log('✅ Постер и описание сохранены в Tampermonkey storage'); } else { console.warn('⚠️ Не удалось найти постер или описание'); } function getFilmDetails() { const titleElement = document.querySelector('.film-page__title-text.film-page__itemprop'); const originalTitleElement = document.querySelector('.film-page__orig_with_comment'); const typeLink = document.querySelector('.b-post__info a[href*="/series/"]'); const yearElement = document.querySelector('.film-page__date a[href*="years_min="]'); const title = titleElement ? titleElement.textContent.trim() : ''; const originalTitle = originalTitleElement ? originalTitleElement.textContent.trim() : ''; const year = yearElement ? yearElement.textContent.trim() : ''; const isSeries = typeLink !== null; return { title, originalTitle, year, isSeries }; } function createButton() { const button = document.createElement('button'); button.innerHTML = '<span style="display:inline-flex; align-items:center; justify-content:center; width:20px; height:22px; margin-right:8px; border:2px solid white; border-radius:50%; font-size:12px; padding-left:2px;">▶</span>Смотреть на Flicksbar'; button.style.cssText = ` padding: 9px; margin-top: -5px; margin-bottom: 2px; background-color: #007bff; color: white; border: none; border-radius: 3px; width: 100%; cursor: pointer; transition: background-color 0.3s ease; `; button.addEventListener('mouseenter', () => button.style.backgroundColor = '#0056b3'); button.addEventListener('mouseleave', () => button.style.backgroundColor = '#007bff'); const { title, originalTitle, year } = getFilmDetails(); button.title = `Смотреть "${title} ${originalTitle} ${year}" бесплатно онлайн на Flicksbar`; button.onclick = () => { const { title, originalTitle, year, isSeries } = getFilmDetails(); if (!title) return alert('Не удалось извлечь информацию о фильме.'); const searchQuery = encodeURIComponent(`${title} ${originalTitle} ${year} кинопоиск`); const flicksbarType = isSeries ? 'series' : 'film'; const googleUrl = `https://www.google.com/search?q=${searchQuery}&btnK&flcks_type=${flicksbarType}`; window.open(googleUrl, '_blank'); }; const sideCover = document.querySelector('.collectionWidget.collectionWidgetData.withFavourites'); if (sideCover) sideCover.appendChild(button); else console.warn('Элемент для вставки кнопки не найден.'); } if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', createButton); } else { createButton(); } } // === 2. GOOGLE: Автопереход на Flicksbar по найденному ID Кинопоиска === if (/google\.com\/search/.test(url)) { function showConfirmWithTimeout(flicksbarUrl, timeout = 5000) { return new Promise((resolve) => { const modal = document.createElement('div'); Object.assign(modal.style, { position: 'fixed', top: '50%', left: '50%', transform: 'translate(-50%, -50%)', padding: '20px', backgroundColor: '#EEE8AA', border: '1px solid #ccc', zIndex: '9999', boxShadow: '0 4px 8px rgba(0, 0, 0, 0.2)', borderRadius: '8px', }); const message = document.createElement('p'); message.style.color = 'black'; message.innerHTML = `<b>Переход на Flicksbar</b> <br><br>Перейти по ссылке: <b>${flicksbarUrl}</b> ?`; modal.appendChild(message); const okButton = document.createElement('button'); okButton.textContent = 'Да'; Object.assign(okButton.style, { marginRight: '10px', padding: '5px 10px', backgroundColor: '#28a745', color: 'white', border: 'none', cursor: 'pointer', borderRadius: '5px', }); okButton.onclick = () => { resolve(true); modal.remove(); }; modal.appendChild(okButton); const cancelButton = document.createElement('button'); cancelButton.textContent = 'Нет'; Object.assign(cancelButton.style, { padding: '5px 10px', backgroundColor: '#dc3545', color: 'white', border: 'none', cursor: 'pointer', borderRadius: '5px', }); cancelButton.onclick = () => { resolve(false); modal.remove(); }; modal.appendChild(cancelButton); document.body.appendChild(modal); setTimeout(() => { resolve(false); //resolve(false); - если надо чтобы после таймера нажималась кнопка Отмена modal.remove(); }, timeout); }); } async function tryRedirect() { const kpLink = document.querySelector('a[href*="kinopoisk.ru/film/"]'); if (!kpLink) return; const match = kpLink.href.match(/kinopoisk\.ru\/film\/(\d+)/); if (!match) return; const kpId = match[1]; const urlParams = new URLSearchParams(window.location.search); const type = urlParams.get('flcks_type') || 'film'; const flicksbarUrl = `https://flicksbar.mom/${type}/${kpId}/`; const answer = await showConfirmWithTimeout(flicksbarUrl, 5000); //чтобы производился Автопереход без окна запроса, то закоментирвать это! if (answer) window.location.href = flicksbarUrl; //и это закоментирвать else console.log('Переход отменен пользователем или истек таймаут.'); //и вот это закоментирвать //window.location.href = flicksbarUrl; // А это раскомментировать! } if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', tryRedirect); } else { tryRedirect(); } } // === 3. Flicksbar: изменение плеера и добавление постера и описания === if (/flicksbar\.mom\/film\/\d+\/?$/.test(location.href)) { // Функция для отображения постера и описания в блоке справа function displayMovieInfo(poster, description, titleTMP, originalTitleTMP, yearTMP, raitingTMP) { const infoBox = document.getElementById("kinorium-info"); if (infoBox && poster && description && titleTMP && originalTitleTMP && yearTMP && raitingTMP) { infoBox.innerHTML = ` <p style="font-size:25px;">${titleTMP} ${originalTitleTMP} ${yearTMP} ${raitingTMP}</p><br><img src="${poster}" alt="Постер" style="width:100%;border-radius:10px;margin-bottom:10px;display:flex;justify-content:center;align-items:center; "> <p style="color:white;font-size:16px;line-height:1.4;">${description}</p> `; } } // Убираем рекламу function removeAds() { const selectors = [ "#tgWrapper", "#TopAdMb", ".brand", ".topAdPad", ".adDown", "body > span", "body > script:first-child" ]; selectors.forEach(sel => { const el = document.querySelector(sel); if (el) el.remove(); }); } // Структурируем страницу function restructurePage() { const main = document.querySelector(".mainContainer"); const player = document.querySelector(".kinobox"); if (!main || !player) return; player.style.minHeight = "0"; player.style.height = "100%"; const layout = document.createElement("div"); layout.style.display = "flex"; layout.style.gap = "30px"; layout.style.marginTop = "20px"; layout.style.alignItems = "stretch"; const left = document.createElement("div"); left.style.flex = "7"; left.style.height = "80%"; left.style.minHeight = "500px"; left.style.marginLeft = "5px"; left.style.display = "flex"; left.style.flexDirection = "column"; left.appendChild(player); const right = document.createElement("div"); right.style.flex = "3"; right.style.fontFamily = "sans-serif"; right.style.color = "#eee"; right.style.borderRadius = "5px"; right.style.marginRight = "5px"; right.style.padding = "15px"; right.style.background = "#222"; right.style.overflow = "hidden"; // ограничим всё внутри const infoWrapper = document.createElement("div"); infoWrapper.id = "kinorium-info"; //infoWrapper.style.display = "flex"; infoWrapper.style.flexDirection = "column"; infoWrapper.style.gap = "20px"; infoWrapper.style.maxHeight = "100%"; right.appendChild(infoWrapper); layout.appendChild(left); layout.appendChild(right); main.innerHTML = ""; main.appendChild(layout); } // Добавялем инфу про фильм function loadAndDisplayInfo() { const poster = GM_getValue('flicksbar_poster', null); const description = GM_getValue('flicksbar_description', null); const titleTMP = GM_getValue('flicksbar_titleTMP', null); const originalTitleTMP = GM_getValue('flicksbar_originalTitleTMP', null); const yearTMP = GM_getValue('flicksbar_yearTMP', null); const raitingTMP = GM_getValue('flicksbar_raitingTMP', null); const infoContainer = document.querySelector("#kinorium-info"); if (!infoContainer) { console.log('#kinorium-info element not found on the page.'); return; } infoContainer.innerHTML = ""; // Заголовок if (titleTMP || originalTitleTMP || yearTMP) { const titleElement = document.createElement("div"); titleElement.innerHTML = ` <div style="text-align: center; margin-bottom: 5px;"> <div style="font-size: 22px; font-weight: bold;">${titleTMP || ""}</div> ${(originalTitleTMP || yearTMP) ? ` <div style="font-size: 18px; margin-top: 2px;"> <span style="color: #aaa;">${originalTitleTMP || ""}</span> ${yearTMP ? `<span style="color: #fff;"> (${yearTMP})</span>` : ""} </div> ` : ""} </div> `; infoContainer.appendChild(titleElement); } // Рейтинг if (raitingTMP) { let ratingColor = "#aaa"; const ratingNum = parseFloat(raitingTMP); if (ratingNum < 5) ratingColor = "red"; else if (ratingNum < 7) ratingColor = "orange"; else ratingColor = "lightgreen"; const ratingElement = document.createElement("p"); ratingElement.textContent = `Рейтинг: ${raitingTMP}`; ratingElement.style.cssText = ` font-size: 18px; color: ${ratingColor}; text-align: center; margin: 0 0 5px; `; infoContainer.appendChild(ratingElement); } // Постер if (poster) { const posterElement = document.createElement("img"); posterElement.src = poster; posterElement.alt = "Постер фильма"; posterElement.style.maxWidth = "100%"; posterElement.style.borderRadius = "12px"; posterElement.style.display = "block"; posterElement.style.margin = "0 auto 10px"; infoContainer.appendChild(posterElement); } // Описание if (description) { const descriptionWrapper = document.createElement("div"); descriptionWrapper.style.overflowY = "auto"; descriptionWrapper.style.maxHeight = "300px"; descriptionWrapper.style.paddingRight = "8px"; const descPara = document.createElement("p"); descPara.innerText = description; descPara.style.fontSize = "16px"; descPara.style.lineHeight = "1.5"; descPara.style.textAlign = "justify"; descPara.style.boxShadow = "0 0 15px rgba(0,0,0,0.4)"; descPara.style.borderRadius = "10px"; descPara.style.padding = "5px"; descPara.style.background = "#1c1c1c"; descPara.style.animation = "fadeIn 0.8s ease-out"; descriptionWrapper.appendChild(descPara); infoContainer.appendChild(descriptionWrapper); // Плавное уменьшение шрифта при переполнении setTimeout(() => { let fontSize = 16; while (descriptionWrapper.scrollHeight > descriptionWrapper.clientHeight && fontSize > 11) { fontSize--; descPara.style.fontSize = fontSize + "px"; } }, 100); } console.log('✅ Информация успешно отображена (гибкий режим)'); } // Вызываем всё нужное if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', () => { removeAds(); restructurePage(); loadAndDisplayInfo(); }); } else { removeAds(); restructurePage(); loadAndDisplayInfo(); } } })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址