// ==UserScript== // @name Trakt.tv | Custom Profile Image // @description A custom profile image for free users. Like the vip feature, except this one only works locally. Uses the native set/reset buttons and changes the dashboard + settings background as well. // @version 1.1.0 // @namespace https://github.com/Fenn3c401 // @author Fenn3c401 // @license GPL-3.0-or-later // @homepageURL https://github.com/Fenn3c401/Trakt.tv-Userscript-Collection#readme // @supportURL https://github.com/Fenn3c401/Trakt.tv-Userscript-Collection/issues // @updateURL https://raw.githubusercontent.com/Fenn3c401/Trakt.tv-Userscript-Collection/main/userscripts/meta/2dz6ub1t.meta.js // @downloadURL https://raw.githubusercontent.com/Fenn3c401/Trakt.tv-Userscript-Collection/main/userscripts/dist/2dz6ub1t.min.user.js // @icon https://trakt.tv/assets/logos/logomark.square.gradient-b644b16c38ff775861b4b1f58c1230f6a097a2466ab33ae00445a505c33fcb91.svg // @match https://trakt.tv/* // @match https://classic.trakt.tv/* // @run-at document-start // @grant unsafeWindow // @grant GM_info // @grant GM_addStyle // @grant GM_getValue // @grant GM_setValue // ==/UserScript== "use strict";let $,toastr;const Logger=Object.freeze({_DEFAULT_PREFIX:GM_info.script.name.replace("Trakt.tv","Userscript")+": ",_DEFAULT_TOAST:!0,_printMsg(e,t,o,{data:r,prefix:s=Logger._DEFAULT_PREFIX,toast:a=Logger._DEFAULT_TOAST}={}){o=s+o,console[e](o,r||""),a&&toastr[t](o+(r?" See console for details.":""))},info:(e,t)=>Logger._printMsg("info","info",e,t),success:(e,t)=>Logger._printMsg("info","success",e,t),warning:(e,t)=>Logger._printMsg("warn","warning",e,t),error:(e,t)=>Logger._printMsg("error","error",e,t)}),gmStorage={...GM_getValue("customProfileImage")};GM_setValue("customProfileImage",gmStorage);let styles=addStyles();window.addEventListener("turbo:load",()=>{if(!/^\/(shows|movies|users|dashboard|settings|oauth\/(authorized_)?applications)/.test(location.pathname)||($??=unsafeWindow.jQuery,toastr??=unsafeWindow.toastr,!$||!toastr))return;const e=$("body.is-self #cover-wrapper"),t=$("body.is-self #btn-set-profile-image"),o=$("body:is(.shows, .movies) #summary-wrapper > .full-screenshot");gmStorage.imgUrl&&e.length&&t.length&&addUserPageElems(e,t),o.length&&(o.attr("style")?addTitlePageElems(o):new MutationObserver((r,s)=>{s.disconnect(),addTitlePageElems(o)}).observe(o[0],{attributeFilter:["style"]}))});function addUserPageElems(e,t){e.has('a.selected:contains("Profile")').length?(e.removeClass("slim").find("> .poster-bg-wrapper").removeClass("poster-bg-wrapper").addClass("shade"),e.find("> #watching-now-wrapper").length||e.find("> .container").before(`
`)):e.find("> .poster-bg-wrapper").removeClass("poster-bg-wrapper").addClass("shadow-full-width"),t.popover("destroy").popover({trigger:"manual",container:"body",placement:"bottom",html:!0,template:'