// ==UserScript== // @name LetterBoxd AP Features // @namespace https://greasyfork.org/en/users/689482-quin15 // @version 1.0.0 // @description Adds copying of native text and opening full size cover // @author Quin15 // @match https://letterboxd.com/film/* // @icon https://www.google.com/s2/favicons?domain=letterboxd.com // @grant none // @downloadURL none // ==/UserScript== var copyText = document.createElement('div') copyText.style = "height:50px;width:100px;border:1px solid;border-radius:8px;text-align:center;float:left;cursor:pointer" copyText.innerText = "Copy Native Text" document.querySelector('div[class="review body-text -prose -hero prettify"] div').appendChild(copyText); copyText.addEventListener("click", function() {copyTextFunct()}); var coverImage = document.createElement('div') coverImage.style = "height:50px;width:100px;border:1px solid;border-radius:8px;text-align:center;float:left;cursor:pointer;margin-left:10px;" coverImage.innerText = "Open Cover Image" document.querySelector('div[class="review body-text -prose -hero prettify"] div').appendChild(coverImage); coverImage.addEventListener("click", function() {open(document.querySelector('section[class^="poster-list"] div div img').srcset.replace(" 2x", ''), "")}); var copyTextFunct = function(text) { var text = document.querySelector('#featured-film-header p em').innerText; text = text.substring(1, text.length - 1); navigator.clipboard.writeText(text).then(function() { console.log('Async: Copying to clipboard was successful!'); copyText.innerText = "Copied!"; setTimeout(function() {copyText.innerText = "Copy Native Text";}, 1000) }, function(err) { console.error('Async: Could not copy text: ', err); copyText.innerText = "Copy failed!"; setTimeout(function() {copyText.innerText = "Copy Native Text";}, 1000) }); }