popup.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <title>My Playlists</title>
  7. <link rel="stylesheet" href="popup.css" />
  8. <script src="alpine.min.js" defer></script>
  9. <script src="../shared/playlist-utils.js"></script>
  10. <script src="popup.js"></script>
  11. </head>
  12. <body>
  13. <div id="app" x-data="playlistManager">
  14. <header x-bind="playlistsHeader">
  15. <h1>My Playlists</h1>
  16. </header>
  17. <header x-bind="historyHeader">
  18. <button class="back-btn-arrow" x-bind="backButton">←</button>
  19. <h1>History</h1>
  20. </header>
  21. <header x-bind="playlistViewHeader">
  22. <button class="back-btn-arrow" x-bind="backButton">←</button>
  23. <h1 x-text="currentPlaylistName"></h1>
  24. </header>
  25. <div class="playlists-container" x-bind="playlistsContainer">
  26. <template
  27. x-for="playlistData in playlistsForDisplay"
  28. :key="playlistData.name"
  29. >
  30. <div class="playlist">
  31. <h2
  32. class="playlist-name-clickable"
  33. x-text="playlistData.name"
  34. :data-playlist-name="playlistData.name"
  35. x-bind="playlistNameClick"
  36. ></h2>
  37. <div class="video-list">
  38. <!-- Truncated previous videos indicator -->
  39. <div
  40. class="truncated-videos"
  41. :data-playlist-name="playlistData.name"
  42. x-bind="truncatedVideosDisplay"
  43. >
  44. <span x-text="playlistData.truncationText"></span>
  45. </div>
  46. <template x-for="(video, index) in playlistData.visibleVideos" :key="index">
  47. <div
  48. class="video-item"
  49. :title="video.title"
  50. :data-playlist-name="playlistData.name"
  51. :data-playlist-index="video.originalIndex"
  52. x-bind="videoItemClass"
  53. >
  54. <a
  55. class="video-title"
  56. :href="video.url"
  57. x-text="video.title"
  58. x-bind="videoPlayLink"
  59. ></a>
  60. <div class="video-actions">
  61. <button
  62. :data-playlist-name="playlistData.name"
  63. :data-playlist-index="video.originalIndex"
  64. x-bind="moveUpButton"
  65. class="move-up-btn"
  66. title="Move up"
  67. >
  68. </button>
  69. <button
  70. :data-playlist-name="playlistData.name"
  71. :data-playlist-index="video.originalIndex"
  72. x-bind="moveDownButton"
  73. class="move-down-btn"
  74. title="Move down"
  75. >
  76. </button>
  77. <div class="more-menu-container">
  78. <button
  79. :data-playlist-name="playlistData.name"
  80. :data-playlist-index="video.originalIndex"
  81. x-bind="moreMenuButton"
  82. class="more-btn"
  83. title="More actions"
  84. >
  85. </button>
  86. <div
  87. class="more-menu"
  88. :data-playlist-name="playlistData.name"
  89. :data-playlist-index="video.originalIndex"
  90. x-bind="moreMenu"
  91. >
  92. <button
  93. :data-playlist-name="playlistData.name"
  94. :data-playlist-index="video.originalIndex"
  95. x-bind="toggleVideoDoneButton"
  96. class="menu-item done-item"
  97. x-text="video.doneButtonText"
  98. >
  99. </button>
  100. <button
  101. :data-playlist-name="playlistData.name"
  102. :data-playlist-index="video.originalIndex"
  103. x-bind="removeVideoButton"
  104. class="menu-item remove-item"
  105. >
  106. Remove
  107. </button>
  108. </div>
  109. </div>
  110. </div>
  111. </div>
  112. </template>
  113. <!--
  114. <div x-show="videos.length === 0" class="empty-playlist">
  115. No videos in this playlist
  116. </div>
  117. -->
  118. </div>
  119. </div>
  120. </template>
  121. </div>
  122. <!-- History view -->
  123. <div class="history-container" x-bind="historyContainer">
  124. <div class="history-list">
  125. <template x-for="videoHistory in sortedHistory" :key="videoHistory.videoId">
  126. <div class="history-item" :data-video-id="videoHistory.videoId">
  127. <div class="history-video-info">
  128. <div class="history-video-title" x-text="videoHistory.title"></div>
  129. <a
  130. class="history-video-id"
  131. :href="videoHistory.url"
  132. x-text="videoHistory.formattedVideoId"
  133. x-bind="videoPlayLink"
  134. ></a>
  135. <div class="history-tags">
  136. <button
  137. class="tag-chip"
  138. :data-video-id="videoHistory.videoId"
  139. data-tag="notable"
  140. x-bind="tagChip"
  141. >
  142. notable
  143. </button>
  144. <button
  145. class="tag-chip"
  146. :data-video-id="videoHistory.videoId"
  147. data-tag="reference"
  148. x-bind="tagChip"
  149. >
  150. reference
  151. </button>
  152. <button
  153. class="tag-chip"
  154. :data-video-id="videoHistory.videoId"
  155. data-tag="to rewatch"
  156. x-bind="tagChip"
  157. >
  158. to rewatch
  159. </button>
  160. <button
  161. class="tag-chip"
  162. :data-video-id="videoHistory.videoId"
  163. data-tag="to save"
  164. x-bind="tagChip"
  165. >
  166. to save
  167. </button>
  168. </div>
  169. </div>
  170. <div class="history-events">
  171. <template x-for="event in videoHistory.processedEvents" :key="event.uniqueKey">
  172. <div class="history-event">
  173. <span class="event-action" x-text="event.formattedAction"></span>
  174. <span class="event-position" x-text="event.formattedPosition"></span>
  175. <span class="event-timestamp" x-text="event.formattedTimestamp"></span>
  176. </div>
  177. </template>
  178. </div>
  179. </div>
  180. </template>
  181. <div x-bind="historyEmptyState" class="empty-history">
  182. No video history yet
  183. </div>
  184. </div>
  185. </div>
  186. <!-- Individual playlist view -->
  187. <div class="playlist-view-container" x-bind="playlistViewContainer">
  188. <div class="playlist-full-view">
  189. <template x-for="(video, index) in currentPlaylistVideos" :key="index">
  190. <div
  191. class="video-item"
  192. :title="video.title"
  193. :data-playlist-name="currentPlaylistName"
  194. :data-playlist-index="index"
  195. x-bind="videoItemClass"
  196. >
  197. <a
  198. class="video-title"
  199. :href="video.url"
  200. x-text="video.title"
  201. x-bind="videoPlayLink"
  202. ></a>
  203. <div class="video-actions">
  204. <button
  205. :data-playlist-name="currentPlaylistName"
  206. :data-playlist-index="index"
  207. x-bind="moveUpButton"
  208. class="move-up-btn"
  209. title="Move up"
  210. >
  211. </button>
  212. <button
  213. :data-playlist-name="currentPlaylistName"
  214. :data-playlist-index="index"
  215. x-bind="moveDownButton"
  216. class="move-down-btn"
  217. title="Move down"
  218. >
  219. </button>
  220. <div class="more-menu-container">
  221. <button
  222. :data-playlist-name="currentPlaylistName"
  223. :data-playlist-index="index"
  224. x-bind="moreMenuButton"
  225. class="more-btn"
  226. title="More actions"
  227. >
  228. </button>
  229. <div
  230. class="more-menu"
  231. :data-playlist-name="currentPlaylistName"
  232. :data-playlist-index="index"
  233. x-bind="moreMenu"
  234. >
  235. <button
  236. :data-playlist-name="currentPlaylistName"
  237. :data-playlist-index="index"
  238. x-bind="toggleVideoDoneButton"
  239. class="menu-item done-item"
  240. x-text="video.doneButtonText"
  241. >
  242. </button>
  243. <button
  244. :data-playlist-name="currentPlaylistName"
  245. :data-playlist-index="index"
  246. x-bind="removeVideoButton"
  247. class="menu-item remove-item"
  248. >
  249. Remove
  250. </button>
  251. </div>
  252. </div>
  253. </div>
  254. </div>
  255. </template>
  256. <div x-bind="playlistViewEmptyState" class="empty-playlist">
  257. No videos in this playlist
  258. </div>
  259. </div>
  260. <!-- Add current page button -->
  261. <div class="add-current-page-container">
  262. <button
  263. class="add-current-page-btn"
  264. x-bind="addCurrentPageButton"
  265. x-text="addCurrentPageButtonText"
  266. ></button>
  267. </div>
  268. </div>
  269. <!-- Export/Import/History buttons -->
  270. <div class="export-container" x-bind="exportContainer">
  271. <button class="export-btn" x-bind="exportButton">
  272. Export Playlists
  273. </button>
  274. <button class="import-btn" x-bind="importButton">
  275. Import Playlists
  276. </button>
  277. <button class="history-btn" x-bind="historyButton">
  278. History
  279. </button>
  280. <input
  281. type="file"
  282. id="import-file-input"
  283. accept=".json"
  284. style="display: none"
  285. x-bind="importFileInput"
  286. />
  287. </div>
  288. </div>
  289. </body>
  290. </html>