-
Notifications
You must be signed in to change notification settings - Fork 0
/
Letterboxd_Watchlist.js
48 lines (42 loc) · 1.75 KB
/
Letterboxd_Watchlist.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// ==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;
})();