Greasy Fork

Greasy Fork is available in English.

Prime Video Sólo Contenido Prime [ESP]

Oculta las secciones de compra o alquiler en la portada de Amazon Prime Video.

当前为 2024-12-02 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name             Prime Video Sólo Contenido Prime [ESP]
// @name:en          Prime Video Show Prime Content Only [ESP]
// @namespace        http://tampermonkey.net/
// @version          0.3.4
// @description      Oculta las secciones de compra o alquiler en la portada de Amazon Prime Video.
// @description:en   Hide the purchase or rental sections on the Amazon Prime Video homepage.
// @author           Jeau
// @license          MIT
// @match            https://*.primevideo.com/*
// @icon             https://m.media-amazon.com/images/G/01/digital/video/DVUI/favicons/favicon-32x32.png
// @require          https://code.jquery.com/jquery-latest.min.js
// @grant            none
// @run-at           document-end
// ==/UserScript==

(function() {
    'use strict';

    var CONTINUE_WATCHING_STR = localizedContinueWatchingString();

    // Check node added to the webpage
    function checkNodes(n) {
        // Script won't work on 'store' and personal account pages
        if (location.href.includes('/settings')) return;
        if (location.href.includes('/mystuff')) return;
        if (location.href.includes('/addons')) return;
        if (location.href.includes('/subscription')) return;
        if (location.href.includes('/livetv')) return;
        if (location.href.includes('/collection/homepremiere')) return;

        // Hide subscription carousels
        if ($(n).find('section[data-testid*="carousel"]').length) {
            $(n).find('section[data-testid*="carousel"]').each(function() {
                try {
                    // Look for svg elements with subscription image
                    if ($(this).find('div[data-testid="card-overlay"]').find('svg').length) {
                        let carousel = this;

                        // Check every carousel
                        if ($(carousel).find('span[data-testid="carousel-title"]').length) {
                            let carouselTitle = $(carousel).find('span[data-testid="carousel-title"]')[0].firstElementChild.innerText.toUpperCase();
                            // Case: "Continue Watching" carousel only
                            if (carouselTitle.includes(CONTINUE_WATCHING_STR)) {
                                $(carousel).find('article[data-testid="card"]').each(function() {
                                    // Hide the card with purchase requirements only
                                    if ($(this).find('div[data-testid="card-overlay"]').find('svg').length) {
                                        $(this).css('display', 'none');
                                    }
                                });
                            } else {
                                $(carousel).parent().css('display', 'none');
                                return true;
                            }
                        } else {
                            $(carousel).parent().css('display', 'none');
                            return true;
                        }
                    }
                } catch(e) {
                    console.log('\n\n\n');
                    console.log('Error userscript "Mostrar Sólo Prime" (MutationObserver) !!!!');
                    console.log('Estructura no reconocida en el siguiente elemento:');
                    console.log(n);
                    console.log('\n\n\n');
                }
            });
        }
    }

    // Check carousels on window load
    checkNodes(document.body);

    // Declaration of Mutation observer
    let observer = new MutationObserver((mutations) => {
        for (const { addedNodes } of mutations) {
            for (const n of addedNodes) {
                if (n.tagName) {
                    checkNodes(n);
                }
            }
        }
    });

    observer.observe(document, {
        subtree: true,
        childList: true,
        characterData: false
    });


    // Get the localized string for 'Continue Watching' section
    function localizedContinueWatchingString() {
        var str;
        try {
            let userButtonStr = document.querySelector('button[data-testid="pv-nav-account-dropdown-trigger"]').getAttribute('aria-label');
            // English
            if (userButtonStr.includes('Profile, Settings, and Account')) {
                str = 'Continue watching';
            // Spanish - Español
            } else if (userButtonStr.includes('Perfil, Configuración y Cuenta')) {
                str = 'Seguir viendo';
            // Portuguese (Brazil) - Portugués (Brasil)
            } else if (userButtonStr.includes('Perfil, configurações e conta')) {
                str = 'Continuar assistindo';
            // Portuguese (Portugal) - Português (Portugal)
            } else if (userButtonStr.includes('Perfil, Definições e Conta')) {
                str = 'Continuar a ver';
            // French - Français
            } else if (userButtonStr.includes('Profil, paramètres et compte')) {
                str = 'Continuez à regarder';
            // Italian - Italiano
            } else if (userButtonStr.includes('Profilo, impostazioni e account')) {
                str = 'Continua a guardare';
            // German - Deutsch
            } else if (userButtonStr.includes('Profil, Einstellungen und Konto')) {
                str = 'Fortsetzen';
            // Dutch - Nederlands
            } else if (userButtonStr.includes('Profiel, instellingen en account')) {
                str = 'Kijk Verder';
            // Danish - Dansk
            } else if (userButtonStr.includes('Profil, indstillinger og konto')) {
                str = 'Fortsæt med at se';
            // Romanian - Română
            } else if (userButtonStr.includes('Profil, Setări și Cont')) {
                str = 'Continuă să vizionezi';
            // Finnish - Suomi
            } else if (userButtonStr.includes('Profiili, asetukset ja tili')) {
                str = 'Jatka katsomista';
            // Polish - Polski
            } else if (userButtonStr.includes('Profil, ustawienia i konto')) {
                str = 'Kontynuuj oglądanie';
            // Norwegian - Norsk
            } else if (userButtonStr.includes('Profil, innstillinger og konto')) {
                str = 'Fortsett å se';
            // Hungarian - Magyar
            } else if (userButtonStr.includes('Profil, Beállítások és Fiók')) {
                str = 'Megtekintés folytatása';
            // Malay - Bahasa Melayu
            } else if (userButtonStr.includes('Profil, Tetapan dan Akaun')) {
                str = 'Teruskan menonton';
            // Indonesian - Bahasa Indonesia
            } else if (userButtonStr.includes('Profil, Pengaturan, dan Akun')) {
                str = 'Lanjutkan Menonton';
            // Swedish - Svenska
            } else if (userButtonStr.includes('Profil, inställningar och konto')) {
                str = 'Fortsätt se';
            // Turkish - Türkçe
            } else if (userButtonStr.includes('Profil, Ayarlar ve Hesap')) {
                str = 'İzlemeye Devam Et';
            // Filipino - Wikang Filipino
            } else if (userButtonStr.includes('Profile, Mga Setting, at Account')) {
                str = 'Magpatuloy sa panonood';
            // Czech - Čeština
            } else if (userButtonStr.includes('Profil, nastavení a účet')) {
                str = 'Pokračovat ve sledování';
            // Greek - Ελληνικά
            } else if (userButtonStr.includes('Προφίλ, Ρυθμίσεις και Λογαριασμός')) {
                str = 'Συνεχίστε να παρακολουθείτε';
            // Russian - Русский
            } else if (userButtonStr.includes('Профиль, настройки и аккаунт')) {
                str = 'Продолжить просмотр';
            // Arabic - العربية
            } else if (userButtonStr.includes('الملف الشخصي والإعدادات والحساب')) {
                str = 'متابعة المشاهدة';
            // Hindi - हिन्दी
            } else if (userButtonStr.includes('प्रोफ़ाइल, सेटिंग्स और अकाउंट')) {
                str = 'देखना जारी रखें';
            // Tamil - தமிழ்
            } else if (userButtonStr.includes('சுயவிவரம், அமைப்புகள் மற்றும் கணக்கு')) {
                str = 'தொடர்ந்து காண்க';
            // Telugu - తెలుగు
            } else if (userButtonStr.includes('ప్రొఫైల్, సెట్టింగ్‌లు మరియు ఖాతా')) {
                str = 'చూడటాన్ని కొనసాగించండి';
            // Thai - ไทย
            } else if (userButtonStr.includes('โปรไฟล์ การตั้งค่า และบัญชี')) {
                str = 'ดูต่อ';
            // Japanese - 日本語
            } else if (userButtonStr.includes('プロフィール、設定、アカウント')) {
                str = '続けて観る';
            // Simplified Chinese - 简体中文
            } else if (userButtonStr.includes('个人资料、设置和账户')) {
                str = '继续播放';
            // Traditional Chinese - 繁體中文
            } else if (userButtonStr.includes('個人檔案、設定和帳戶')) {
                str = '繼續觀看';
            // Korean - 한국어
            } else if (userButtonStr.includes('프로필, 설정, 계정')) {
                str = '계속 시청하기';
            }

        // If checking actual Amazon site language fails then browser language is used
        } catch(e) {
            str = 'CONTINUE WATCHING';
            let locale = navigator.language.tolowerCase();
            let lang = locale.split(/-|_/)[0];

            // English
            if (lang === 'en') {
                str = 'Continue watching';
            // Spanish
            } else if (lang === 'es') {
                str = 'Seguir viendo';
            // Portuguese (Brazil)
            } else if (locale === 'pt-br') {
                str = 'Continuar assistindo';
            // Portuguese (Portugal)
            } else if (lang === 'pt') {
                str = 'Continuar a ver';
            // French
            } else if (lang === 'fr') {
                str = 'Continuez à regarder';
            // Italian
            } else if (lang === 'it') {
                str = 'Continua a guardare';
            // German
            } else if (lang === 'de') {
                str = 'Fortsetzen';
            // Dutch
            } else if (lang === 'nl') {
                str = 'Kijk Verder';
            // Danish
            } else if (lang === 'da') {
                str = 'Fortsæt med at se';
            // Romanian
            } else if (lang === 'ro') {
                str = 'Continuă să vizionezi';
            // Finnish
            } else if (lang === 'fi') {
                str = 'Jatka katsomista';
            // Polish
            } else if (lang === 'pl') {
                str = 'Kontynuuj oglądanie';
            // Norwegian
            } else if (lang === 'no') {
                str = 'Fortsett å se';
            // Hungarian
            } else if (lang === 'hu') {
                str = 'Megtekintés folytatása';
            // Malay
            } else if (lang === 'ms') {
                str = 'Teruskan menonton';
            // Indonesian
            } else if (lang === 'id') {
                str = 'Lanjutkan Menonton';
            // Swedish
            } else if (lang === 'sv') {
                str = 'Fortsätt se';
            // Turkish
            } else if (lang === 'tr') {
                str = 'İzlemeye Devam Et';
            // Filipino
            } else if (lang === 'fil') {
                str = 'Magpatuloy sa panonood';
            // Czech
            } else if (lang === 'cs') {
                str = 'Pokračovat ve sledování';
            // Greek
            } else if (lang === 'el') {
                str = 'Συνεχίστε να παρακολουθείτε';
            // Russian
            } else if (lang === 'ru') {
                str = 'Продолжить просмотр';
            // Arabic
            } else if (lang === 'ar') {
                str = 'متابعة المشاهدة';
            // Hindi
            } else if (lang === 'hi') {
                str = 'देखना जारी रखें';
            // Tamil
            } else if (lang === 'ta') {
                str = 'தொடர்ந்து காண்க';
            // Telugu
            } else if (lang === 'te') {
                str = 'చూడటాన్ని కొనసాగించండి';
            // Thai
            } else if (lang === 'th') {
                str = 'ดูต่อ';
            // Japanese
            } else if (lang === 'ja') {
                str = '続けて観る';
            // Simplified Chinese
            } else if (locale === 'zh-Hans') {
                str = '继续播放';
            // Traditional Chinese
            } else if (locale === 'zh-Hant') {
                str = '繼續觀看';
            // Korean
            } else if (lang === 'ko') {
                str = '계속 시청하기';
            }
        }
        if (str) str = str.toUpperCase();
        return str;
    }

})();