Greasy Fork is available in English.
Ищет фильм в Google и автоматически переходит на Flicksbar без использования API Кинопоиска (для правильной работы нужен второй скрипт "Автопереход на Flicksbar с Google")
当前为
// ==UserScript==
// @name Кнопка перехода на Flicksbar из Kinorium (без использования API Кинопоиска)
// @namespace http://tampermonkey.net/
// @version 0.9.3
// @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 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';
button.style.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}`;
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);
} else {
console.warn('Элемент для вставки кнопки не найден.');
}
}
// Запуск как можно раньше, но только после готовности DOM
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', createButton);
} else {
createButton();
}
})();