Letterboxd Watchlist

Highlight films in your watchlist on Letterboxd

当前为 2023-10-28 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Letterboxd Watchlist
// @namespace    https://github.com/ar3h1d/Letterboxd_Watchlist
// @version      0.1
// @description  Highlight films in your watchlist on Letterboxd
// @author       ar3h1d
// @match        https://letterboxd.com/*
// @grant        none
// @icon         https://raw.githubusercontent.com/ar3h1d/Letterboxd_Watchlist/main/Letterboxd_Watchlist.png
// @license      GNU GPLv3
// ==/UserScript==

(function() {
    'use strict';

    // Function to highlight films
    function highlightFilms() {
        // Get all films elements
        var films = document.getElementsByClassName('react-component poster film-poster');

        // Loop through each film and add a highlight if it's in the watchlist
        for (var i = 0; i < films.length; i++) {
            if (films[i].getAttribute('data-film-in-watchlist') === 'true') {
                var film = films[i];
                film.style.position = 'relative';
                film.style.zIndex = '1';
                film.style.backgroundClip = 'padding-box';
                film.style.padding = '2px';

                var before = document.createElement('div');
                before.style.content = '';
                before.style.position = 'absolute';
                before.style.zIndex = '-1';
                before.style.top = '0';
                before.style.right = '0';
                before.style.bottom = '0';
                before.style.left = '0';
                before.style.backgroundImage = 'linear-gradient(to bottom, #00e054, blue)';
                before.style.borderRadius = '5px';

                film.appendChild(before);
            }
        }
    }

    // Run the highlight function when the DOM is ready
    window.onload = highlightFilms;
})();