11// ==UserScript==
22// @name Trakt.tv | Nested Header Navigation Menus
33// @description Adds 150+ dropdown menus with a total of 1000+ entries to the header navigation bar for one-click access to just about any page on the entire website.
4- // @version 1.0.2
4+ // @version 1.0.5
55// @namespace txw82860
66// @icon data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBpZD0iTGF5ZXJfMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmlld0JveD0iMCAwIDQ4IDQ4Ij4KICA8ZGVmcz4KICAgIDxzdHlsZT4KICAgICAgLmNscy0xIHsKICAgICAgICBmaWxsOiB1cmwoI3JhZGlhbC1ncmFkaWVudCk7CiAgICAgIH0KCiAgICAgIC5jbHMtMiB7CiAgICAgICAgZmlsbDogI2ZmZjsKICAgICAgfQogICAgPC9zdHlsZT4KICAgIDxyYWRpYWxHcmFkaWVudCBpZD0icmFkaWFsLWdyYWRpZW50IiBjeD0iNDguNDYiIGN5PSItLjk1IiBmeD0iNDguNDYiIGZ5PSItLjk1IiByPSI2NC44NCIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiPgogICAgICA8c3RvcCBvZmZzZXQ9IjAiIHN0b3AtY29sb3I9IiM5ZjQyYzYiLz4KICAgICAgPHN0b3Agb2Zmc2V0PSIuMjciIHN0b3AtY29sb3I9IiNhMDQxYzMiLz4KICAgICAgPHN0b3Agb2Zmc2V0PSIuNDIiIHN0b3AtY29sb3I9IiNhNDNlYmIiLz4KICAgICAgPHN0b3Agb2Zmc2V0PSIuNTMiIHN0b3AtY29sb3I9IiNhYTM5YWQiLz4KICAgICAgPHN0b3Agb2Zmc2V0PSIuNjQiIHN0b3AtY29sb3I9IiNiNDMzOWEiLz4KICAgICAgPHN0b3Agb2Zmc2V0PSIuNzMiIHN0b3AtY29sb3I9IiNjMDJ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N2wtMS40NiwxLjQ2LDE0LjQsMTQuNCwxLjQ2LTEuNDctNC4zMi00LjMxTDQ2LjM1LDUuNGMtLjM2LS42LS43OC0xLjE2LTEuMjUtMS42OGwtMjMuNTYsMjMuNTYtOC42Mi04LjYxWk00Ny44Nyw5LjU4bC0xOS4xNywxOS4xNywxLjQ3LDEuNDYsMTcuODMtMTcuODN2LTEuMTJjMC0uNTctLjA0LTEuMTQtLjEzLTEuNjhaTTI1LjE2LDIyLjI3bC03LjkyLTcuOTItMS40NywxLjQ3LDcuOTIsNy45MiwxLjQ3LTEuNDdaTTQxLjMyLDM1LjEyYzAsMy40Mi0yLjc4LDYuMi02LjIsNi4ySDEyLjg4Yy0zLjQyLDAtNi4yLTIuNzgtNi4yLTYuMlYxMi44OGMwLTMuNDIsMi43OC02LjIxLDYuMi02LjIxaDIwLjc4di0yLjA3SDEyLjg4Yy00LjU2LDAtOC4yOCwzLjcxLTguMjgsOC4yOHYyMi4yNGMwLDQuNTYsMy43MSw4LjI4LDguMjgsOC4yOGgyMi4yNGM0LjU2LDAsOC4yOC0zLjcxLDguMjgtOC4yOHYtMy41MWgtMi4wN3YzLjUxWiIvPjwhLS0gNDVkMjM4NWQzYWFjYmI1OTMyNmEzODYxNDljNWE4NzggLS0+CiAgICAgIDwvZz4KICAgIDwvZz4KICA8L2c+Cjwvc3ZnPg==
77// @match https://trakt.tv/*
1818'use strict' ;
1919
2020const menuTemplates = {
21+ historySorting : ( hrefPrefix , [ anchorIndex = 1 , ...submenuAnchorIndexes ] = [ ] ) => ( {
22+ hrefPrefix,
23+ entries : ( ( arr ) => arr . with ( anchorIndex , { ...arr . at ( anchorIndex ) , anchor : true } ) ) ( [
24+ { text : 'SORT BY' } ,
25+ { text : 'Watched Date' , href : '/added' } ,
26+ { text : 'Plays' , href : '/plays' } ,
27+ { text : 'Time Spent' , href : '/time' } ,
28+ { text : 'Title' , href : '/title' } ,
29+ { text : 'Release Date' , href : '/released' } ,
30+ { text : 'Runtime' , href : '/runtime' } ,
31+ { text : 'Popularity' , href : '/popularity' } ,
32+ { text : 'Percentage' , href : '/percentage' } ,
33+ { text : 'Votes' , href : '/votes' } ,
34+ ] ) ,
35+ } ) ,
2136 progressSorting : ( hrefPrefix , [ anchorIndex = 1 , ...submenuAnchorIndexes ] = [ ] ) => ( {
2237 hrefPrefix,
2338 entries : ( ( arr ) => arr . with ( anchorIndex , { ...arr . at ( anchorIndex ) , anchor : true } ) ) ( [
@@ -36,35 +51,69 @@ const menuTemplates = {
3651 { text : 'Random' , href : '/random' } ,
3752 ] ) ,
3853 } ) ,
54+ librarySorting : ( hrefPrefix , [ anchorIndex = 1 , ...submenuAnchorIndexes ] = [ ] ) => ( {
55+ hrefPrefix,
56+ entries : ( ( arr ) => arr . with ( anchorIndex , { ...arr . at ( anchorIndex ) , anchor : true } ) ) ( [
57+ { text : 'SORT BY' } ,
58+ { text : 'Added Date' , href : '/added' } ,
59+ { text : 'Title' , href : '/title' } ,
60+ { text : 'Release Date' , href : '/released' } ,
61+ ...( / \/ s h o w s / . test ( hrefPrefix ) ? [
62+ { text : 'Episode Count' , href : '/episodes' } ,
63+ ] : [ ] ) ,
64+ ...( ! / \/ e p i s o d e s / . test ( hrefPrefix ) ? [
65+ { text : 'Runtime' , href : '/runtime' } ,
66+ { text : 'Popularity' , href : '/popularity' } ,
67+ ] : [ ] ) ,
68+ { text : 'Percentage' , href : '/percentage' } ,
69+ { text : 'Votes' , href : '/votes' } ,
70+ ] ) ,
71+ } ) ,
3972 ratingSelection : ( hrefPrefix , [ anchorIndex = 1 , ...submenuAnchorIndexes ] = [ ] ) => ( {
4073 hrefPrefix,
4174 entries : ( ( arr ) => arr . with ( anchorIndex , { ...arr . at ( anchorIndex ) , anchor : true } ) ) ( [
4275 { text : 'RATING' } ,
43- { text : 'All Ratings' , href : '/all' , submenu : {
44- hrefPrefix : hrefPrefix + '/all' ,
45- entries : [
46- { text : 'SORT BY' } ,
47- { text : 'Rated Date' , href : '/added' , anchor : true } ,
48- { text : 'Rating' , href : '/rating' } ,
49- ] ,
50- } } ,
51- { text : '10 - Totally Ninja!' , href : '/10' } ,
52- { text : '9 - Superb' , href : '/9' } ,
53- { text : '8 - Great' , href : '/8' } ,
54- { text : '7 - Good' , href : '/7' } ,
55- { text : '6 - Fair' , href : '/6' } ,
56- { text : '5 - Meh' , href : '/5' } ,
57- { text : '4 - Poor' , href : '/4' } ,
58- { text : '3 - Bad' , href : '/3' } ,
59- { text : '2 - Terrible' , href : '/2' } ,
60- { text : '1 - Weak Sauce :(' , href : '/1' } ,
76+ { text : 'All Ratings' , href : '/all' , submenu : menuTemplates . ratingsSorting ( hrefPrefix + '/all' , submenuAnchorIndexes ) } ,
77+ { text : '10 - Totally Ninja!' , href : '/10' , submenu : menuTemplates . ratingsSorting ( hrefPrefix + '/10' , submenuAnchorIndexes ) } ,
78+ { text : '9 - Superb' , href : '/9' , submenu : menuTemplates . ratingsSorting ( hrefPrefix + '/9' , submenuAnchorIndexes ) } ,
79+ { text : '8 - Great' , href : '/8' , submenu : menuTemplates . ratingsSorting ( hrefPrefix + '/8' , submenuAnchorIndexes ) } ,
80+ { text : '7 - Good' , href : '/7' , submenu : menuTemplates . ratingsSorting ( hrefPrefix + '/7' , submenuAnchorIndexes ) } ,
81+ { text : '6 - Fair' , href : '/6' , submenu : menuTemplates . ratingsSorting ( hrefPrefix + '/6' , submenuAnchorIndexes ) } ,
82+ { text : '5 - Meh' , href : '/5' , submenu : menuTemplates . ratingsSorting ( hrefPrefix + '/5' , submenuAnchorIndexes ) } ,
83+ { text : '4 - Poor' , href : '/4' , submenu : menuTemplates . ratingsSorting ( hrefPrefix + '/4' , submenuAnchorIndexes ) } ,
84+ { text : '3 - Bad' , href : '/3' , submenu : menuTemplates . ratingsSorting ( hrefPrefix + '/3' , submenuAnchorIndexes ) } ,
85+ { text : '2 - Terrible' , href : '/2' , submenu : menuTemplates . ratingsSorting ( hrefPrefix + '/2' , submenuAnchorIndexes ) } ,
86+ { text : '1 - Weak Sauce :(' , href : '/1' , submenu : menuTemplates . ratingsSorting ( hrefPrefix + '/1' , submenuAnchorIndexes ) } ,
87+ ] ) ,
88+ } ) ,
89+ ratingsSorting : ( hrefPrefix , [ anchorIndex = 1 , ...submenuAnchorIndexes ] = [ ] ) => ( {
90+ hrefPrefix,
91+ entries : ( ( arr ) => arr . with ( anchorIndex , { ...arr . at ( anchorIndex ) , anchor : true } ) ) ( [
92+ { text : 'SORT BY' } ,
93+ { text : 'Rated Date' , href : '/added' } ,
94+ { text : 'Rating' , href : '/rating' } ,
95+ ...( ! / \/ r a t i n g s \/ a l l / . test ( hrefPrefix ) ? [
96+ { text : 'Title' , href : '/title' } ,
97+ { text : 'Release Date' , href : '/released' } ,
98+ ...( / \/ ( m o v i e s | s h o w s ) / . test ( hrefPrefix ) ? [
99+ { text : 'Runtime' , href : '/runtime' } ,
100+ { text : 'Popularity' , href : '/popularity' } ,
101+ ] : [ ] ) ,
102+ { text : 'Percentage' , href : '/percentage' } ,
103+ { text : 'Votes' , href : '/votes' } ,
104+ ] : [ ] ) ,
61105 ] ) ,
62106 } ) ,
63107 listsViewSorting : ( hrefPrefix , [ anchorIndex = 1 , ...submenuAnchorIndexes ] = [ ] ) => ( {
64108 hrefPrefix,
65109 entries : ( ( arr ) => arr . with ( anchorIndex , { ...arr . at ( anchorIndex ) , anchor : true } ) ) ( [
66110 { text : 'SORT BY' } ,
67- { text : 'Rank' , href : 'rank' } ,
111+ ...( / \/ l i s t s \? / . test ( hrefPrefix ) ? [
112+ { text : 'Rank' , href : 'rank' } ,
113+ ] : [ ] ) ,
114+ ...( / \/ l i k e d / . test ( hrefPrefix ) ? [
115+ { text : 'Like Date' , href : 'liked' } ,
116+ ] : [ ] ) ,
68117 { text : 'Updated Date' , href : 'updated' } ,
69118 { text : 'Title' , href : 'title' } ,
70119 { text : 'Likes' , href : 'likes' } ,
@@ -110,8 +159,8 @@ const menuTemplates = {
110159 entries : ( ( arr ) => arr . with ( anchorIndex , { ...arr . at ( anchorIndex ) , anchor : true } ) ) ( [
111160 { text : 'SORT BY' } ,
112161 { text : 'Added Date' , href : '/added' } ,
113- { text : 'Likes <em>(30 Days)</em>' , href : '/likes_30' } ,
114- { text : 'Likes <em>(All Time)</em>' , href : '/likes' } ,
162+ { text : 'Reactions <em>(30 Days)</em>' , href : '/likes_30' } , // TODO change href once/if they switch to /reactions_30
163+ { text : 'Reactions <em>(All Time)</em>' , href : '/likes' } ,
115164 { text : 'Replies <em>(30 Days)</em>' , href : '/replies_30' } ,
116165 { text : 'Replies <em>(All Time)</em>' , href : '/replies' } ,
117166 { text : 'Plays' , href : '/plays' } ,
@@ -126,7 +175,7 @@ const menuTemplates = {
126175 { text : 'Date' , href : '/data' } ,
127176 ] ) ,
128177 } ) ,
129- showsMoviesCatTimePeriod : ( hrefPrefix , [ anchorIndex = 4 , ...submenuAnchorIndexes ] = [ ] ) => ( {
178+ showsMoviesCatTimePeriod : ( hrefPrefix , [ anchorIndex = - 1 , ...submenuAnchorIndexes ] = [ ] ) => ( {
130179 hrefPrefix,
131180 entries : ( ( arr ) => arr . with ( anchorIndex , { ...arr . at ( anchorIndex ) , anchor : true } ) ) ( [
132181 { text : 'PERIOD' } ,
@@ -144,19 +193,19 @@ const menus = {
144193 entries : [
145194 { text : 'TYPE' } ,
146195 { text : 'All Types' , href : '/all' , anchor : true } ,
147- { text : 'Movies' , href : '/movies' } ,
148- { text : 'Shows' , href : '/shows' } ,
149- { text : 'Episodes' , href : '/episodes' } ,
196+ { text : 'Movies' , href : '/movies' , submenu : menuTemplates . historySorting ( '/users/me/history/movies' ) } ,
197+ { text : 'Shows' , href : '/shows' , submenu : menuTemplates . historySorting ( '/users/me/history/shows' ) } ,
198+ { text : 'Episodes' , href : '/episodes' , submenu : menuTemplates . historySorting ( '/users/me/history/episodes' ) } ,
150199 ] ,
151200 } ,
152201 '.btn-profile a[href$="/library"]' : {
153202 hrefPrefix : '/users/me/library' ,
154203 entries : [
155204 { text : 'TYPE' } ,
156205 { text : 'All Types' , href : '/all' , anchor : true } ,
157- { text : 'Movies' , href : '/movies' } ,
158- { text : 'Shows' , href : '/shows' } ,
159- { text : 'Episodes' , href : '/episodes' } ,
206+ { text : 'Movies' , href : '/movies' , submenu : menuTemplates . librarySorting ( '/users/me/library/movies' ) } ,
207+ { text : 'Shows' , href : '/shows' , submenu : menuTemplates . librarySorting ( '/users/me/library/shows' ) } ,
208+ { text : 'Episodes' , href : '/episodes' , submenu : menuTemplates . librarySorting ( '/users/me/library/episodes' ) } ,
160209 ] ,
161210 } ,
162211 '.btn-profile a[href$="/progress"]' : {
@@ -180,10 +229,10 @@ const menus = {
180229 entries : [
181230 { text : 'TYPE' } ,
182231 { text : 'All Types' , href : '/all' , anchor : true , submenu : menuTemplates . ratingSelection ( '/users/me/ratings/all' ) } ,
183- { text : 'Movies' , href : '/movies' , submenu : menuTemplates . ratingSelection ( '/users/me/ratings/movies' ) } ,
184- { text : 'Shows' , href : '/shows' , submenu : menuTemplates . ratingSelection ( '/users/me/ratings/shows' ) } ,
185- { text : 'Seasons' , href : '/seasons' , submenu : menuTemplates . ratingSelection ( '/users/me/ratings/seasons' ) } ,
186- { text : 'Episodes' , href : '/episodes' , submenu : menuTemplates . ratingSelection ( '/users/me/ratings/episodes' ) } ,
232+ { text : 'Movies' , href : '/movies' , submenu : menuTemplates . ratingSelection ( '/users/me/ratings/movies' , [ , 4 ] ) } ,
233+ { text : 'Shows' , href : '/shows' , submenu : menuTemplates . ratingSelection ( '/users/me/ratings/shows' , [ , 4 ] ) } ,
234+ { text : 'Seasons' , href : '/seasons' , submenu : menuTemplates . ratingSelection ( '/users/me/ratings/seasons' , [ , - 1 ] ) } ,
235+ { text : 'Episodes' , href : '/episodes' , submenu : menuTemplates . ratingSelection ( '/users/me/ratings/episodes' , [ , - 1 ] ) } ,
187236 ] ,
188237 } ,
189238 '.btn-profile a[href$="/lists"]' : {
@@ -228,7 +277,7 @@ const menus = {
228277 { text : 'Shouts' , href : '/shouts' , submenu : menuTemplates . commentType ( '/users/me/comments/shouts' ) } ,
229278 { text : 'Replies' , href : '/replies' , submenu : menuTemplates . commentType ( '/users/me/comments/replies' ) } ,
230279 { } ,
231- { text : 'LIKED COMMENTS ' } ,
280+ { text : 'REACTIONS ' } ,
232281 { text : 'All Comments' , href : '/liked/all' , submenu : menuTemplates . commentType ( '/users/me/comments/liked/all' , [ - 1 , - 1 ] ) } ,
233282 { text : 'Reviews' , href : '/liked/reviews' , submenu : menuTemplates . commentType ( '/users/me/comments/liked/reviews' , [ - 1 , - 1 ] ) } ,
234283 { text : 'Shouts' , href : '/liked/shouts' , submenu : menuTemplates . commentType ( '/users/me/comments/liked/shouts' , [ - 1 , - 1 ] ) } ,
0 commit comments