Greasy Fork

Greasy Fork is available in English.

Кнопка перехода на Flicksbar из Kinorium (без использования API Кинопоиска)

Ищет фильм в Google и автоматически переходит на Flicksbar без использования API Кинопоиска (для правильной работы нужен второй скрипт "Автопереход на Flicksbar с Google")

当前为 2025-04-06 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Кнопка перехода на Flicksbar из Kinorium (без использования API Кинопоиска)
// @namespace    http://tampermonkey.net/
// @version      0.9.1
// @description  Ищет фильм в Google и автоматически переходит на Flicksbar без использования API Кинопоиска (для правильной работы нужен второй скрипт "Автопереход на Flicksbar с Google")
// @author       CgPT & Vladimir_0202
// @icon         https://ru.kinorium.com/favicon.ico
// @include      /^https?:\/\/.*kinorium.*\/.*$/
// @grant        none
// @license      MIT
// ==/UserScript==

(function () {
    'use strict';

    function getFilmDetails() {
        const titleElement = document.querySelector('.film-page__title-text.film-page__itemprop');
        const originalTitleElement = document.querySelector('.film-page__orig_with_comment');
        //const yearLink = document.querySelector('.b-post__info a[href*="/year/"]');
        const typeLink = document.querySelector('.b-post__info a[href*="/series/"]');

        const title = titleElement ? titleElement.textContent.trim() : '';
        const originalTitle = originalTitleElement ? originalTitleElement.textContent.trim() : '';

        const yearElement = document.querySelector('.film-page__date a[href*="years_min="]');
        const year = yearElement ? yearElement.textContent.trim() : '';

        console.log(`Extracted movie data: Title: "${title}", Original Title: "${originalTitle}", Year: "${year}"`);

        const isSeries = typeLink !== null;
        return { title, originalTitle, year, isSeries };
    }

    function createButton() {
        const button = document.createElement('button');
        button.textContent = 'Найти на Flicksbar';
        button.style.padding = '9px';
        button.style.marginTop = '5px';
        button.style.marginBottom = '2px';
        button.style.backgroundColor = '#007bff';
        button.style.color = 'white';
        button.style.border = 'none';
        button.style.borderRadius = '3px';
        button.style.width = '100%';
        button.style.cursor = 'pointer';

        // Получаем данные фильма для поиска
        const { title, originalTitle, year, isSeries } = getFilmDetails();
        const searchQuery = `${title} ${originalTitle} ${year}`;
        // Устанавливаем tooltip с поисковым запросом
        button.title = `Поиск: ${searchQuery}`;


        button.onclick = () => {
            const { title, originalTitle, year, isSeries } = getFilmDetails();
            if (!title) {
                alert('Не удалось извлечь информацию о фильме.');
                return;
            }

            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);
        }
    }

    window.addEventListener('load', createButton);
})();