|
66 | 66 | async function randomButtonHandler() { |
67 | 67 | const pathname = window.location.pathname.replace(/\/$/, ''); |
68 | 68 |
|
69 | | - if (pathname === '/scenes') return randomGlobal('Scene', 'scenes', '/scenes/'); |
70 | | - if (pathname === '/performers') return randomGlobal('Performer', 'performers', '/performers/'); |
71 | | - if (pathname === '/groups') return randomGlobal('Group', 'groups', '/groups/'); |
72 | | - if (pathname === '/studios') return randomGlobal('Studio', 'studios', '/studios/'); |
73 | | - if (pathname === '/tags') return randomGlobal('Tag', 'tags', '/tags/'); |
74 | | - if (pathname === '/galleries') return randomGlobal('Gallery', 'galleries', '/galleries/'); |
75 | | - if (pathname === '/images') return randomGlobal('Image', 'images', '/images/'); |
76 | | - |
77 | | - // --- INTERN --- |
| 69 | + // GLOBAL |
| 70 | + if (pathname === '/scenes' || pathname === '/' || pathname === '' || pathname === '/stats' || pathname === '/settings' || pathname === '/scenes/markers' || /^\/scenes\/\d+$/.test(pathname)) |
| 71 | + return randomGlobal('Scene', 'scenes', '/scenes/'); |
| 72 | + |
| 73 | + if (pathname === '/images' || /^\/images\/\d+$/.test(pathname)) |
| 74 | + return randomGlobal('Image', 'images', '/images/'); |
| 75 | + |
| 76 | + if (pathname === '/performers') |
| 77 | + return randomGlobal('Performer', 'performers', '/performers/'); |
| 78 | + |
| 79 | + if (pathname === '/studios') |
| 80 | + return randomGlobal('Studio', 'studios', '/studios/'); |
| 81 | + |
| 82 | + if (pathname === '/tags') |
| 83 | + return randomGlobal('Tag', 'tags', '/tags/'); |
| 84 | + |
| 85 | + if (pathname === '/groups') |
| 86 | + return randomGlobal('Group', 'groups', '/groups/'); |
| 87 | + |
| 88 | + if (pathname === '/galleries') |
| 89 | + return randomGlobal('Gallery', 'galleries', '/galleries/'); |
| 90 | + |
| 91 | + // Intern |
78 | 92 | let studioId = getIdFromPath(/^\/studios\/(\d+)\/scenes/); |
79 | | - if (studioId) return randomGlobal('Scene', 'scenes', '/scenes/', { studios: { value: [studioId], modifier: "INCLUDES_ALL" } }); |
| 93 | + if (studioId) |
| 94 | + return randomGlobal('Scene', 'scenes', '/scenes/', { studios: { value: [studioId], modifier: "INCLUDES_ALL" } }); |
80 | 95 |
|
81 | 96 | let groupId = getIdFromPath(/^\/groups\/(\d+)\/scenes/); |
82 | | - if (groupId) return randomGlobal('Scene', 'scenes', '/scenes/', { groups: { value: [groupId], modifier: "INCLUDES_ALL" } }); |
| 97 | + if (groupId) |
| 98 | + return randomGlobal('Scene', 'scenes', '/scenes/', { groups: { value: [groupId], modifier: "INCLUDES_ALL" } }); |
83 | 99 |
|
84 | 100 | let performerId = getIdFromPath(/^\/performers\/(\d+)\/scenes/); |
85 | | - if (performerId) return randomGlobal('Scene', 'scenes', '/scenes/', { performers: { value: [performerId], modifier: "INCLUDES_ALL" } }); |
| 101 | + if (performerId) |
| 102 | + return randomGlobal('Scene', 'scenes', '/scenes/', { performers: { value: [performerId], modifier: "INCLUDES_ALL" } }); |
86 | 103 |
|
87 | 104 | let tagId = getIdFromPath(/^\/tags\/(\d+)\/scenes/); |
88 | | - if (tagId) return randomGlobal('Scene', 'scenes', '/scenes/', { tags: { value: [tagId], modifier: "INCLUDES_ALL" } }); |
| 105 | + if (tagId) |
| 106 | + return randomGlobal('Scene', 'scenes', '/scenes/', { tags: { value: [tagId], modifier: "INCLUDES_ALL" } }); |
89 | 107 |
|
90 | | - let galleryId = getIdFromPath(/^\/galleries\/(\d+)/); |
91 | | - if (galleryId) return randomGlobal('Image', 'images', '/images/', { galleries: { value: [galleryId], modifier: "INCLUDES_ALL" } }); |
| 108 | + let galleryId = getIdFromPath(/^\/galleries\/(\d+)$/); |
| 109 | + if (galleryId) |
| 110 | + return randomGlobal('Image', 'images', '/images/', { galleries: { value: [galleryId], modifier: "INCLUDES_ALL" } }); |
92 | 111 |
|
93 | 112 | alert('Not supported'); |
94 | 113 | } |
|
0 commit comments