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. ↑
  69. </button>
  70. <button
  71. :data-playlist-name="playlistData.name"
  72. :data-playlist-index="video.originalIndex"
  73. x-bind="moveDownButton"
  74. class="move-down-btn"
  75. title="Move down"
  76. >
  77. ↓
  78. </button>
  79. <div class="more-menu-container">
  80. <button
  81. :data-playlist-name="playlistData.name"
  82. :data-playlist-index="video.originalIndex"
  83. x-bind="moreMenuButton"
  84. class="more-btn"
  85. title="More actions"
  86. >
  87. ⋯
  88. </button>
  89. <div
  90. class="more-menu"
  91. :data-playlist-name="playlistData.name"
  92. :data-playlist-index="video.originalIndex"
  93. x-bind="moreMenu"
  94. >
  95. <button
  96. :data-playlist-name="playlistData.name"
  97. :data-playlist-index="video.originalIndex"
  98. x-bind="toggleVideoDoneButton"
  99. class="menu-item done-item"
  100. x-text="video.doneButtonText"
  101. >
  102. </button>
  103. <button
  104. :data-playlist-name="playlistData.name"
  105. :data-playlist-index="video.originalIndex"
  106. x-bind="removeVideoButton"
  107. class="menu-item remove-item"
  108. >
  109. Remove
  110. </button>
  111. </div>
  112. </div>
  113. </div>
  114. </div>
  115. </template>
  116. <!--
  117. <div x-show="videos.length === 0" class="empty-playlist">
  118. No videos in this playlist
  119. </div>
  120. -->
  121. </div>
  122. </div>
  123. </template>
  124. </div>
  125. <!-- History view -->
  126. <div class="history-container" x-bind="historyContainer">
  127. <div class="history-list">
  128. <template x-for="videoHistory in sortedHistory" :key="videoHistory.videoId">
  129. <div class="history-item" :data-video-id="videoHistory.videoId">
  130. <div class="history-video-info">
  131. <div class="history-video-title" x-text="videoHistory.title"></div>
  132. <a
  133. class="history-video-id"
  134. :href="videoHistory.url"
  135. x-text="videoHistory.formattedVideoId"
  136. x-bind="videoPlayLink"
  137. ></a>
  138. <div class="history-tags">
  139. <button
  140. class="tag-chip"
  141. :data-video-id="videoHistory.videoId"
  142. data-tag="notable"
  143. x-bind="tagChip"
  144. >
  145. notable
  146. </button>
  147. <button
  148. class="tag-chip"
  149. :data-video-id="videoHistory.videoId"
  150. data-tag="reference"
  151. x-bind="tagChip"
  152. >
  153. reference
  154. </button>
  155. <button
  156. class="tag-chip"
  157. :data-video-id="videoHistory.videoId"
  158. data-tag="to rewatch"
  159. x-bind="tagChip"
  160. >
  161. to rewatch
  162. </button>
  163. <button
  164. class="tag-chip"
  165. :data-video-id="videoHistory.videoId"
  166. data-tag="to save"
  167. x-bind="tagChip"
  168. >
  169. to save
  170. </button>
  171. </div>
  172. </div>
  173. <div class="history-events">
  174. <template x-for="event in videoHistory.processedEvents" :key="event.uniqueKey">
  175. <div class="history-event">
  176. <span class="event-action" x-text="event.formattedAction"></span>
  177. <span class="event-position" x-text="event.formattedPosition"></span>
  178. <span class="event-timestamp" x-text="event.formattedTimestamp"></span>
  179. </div>
  180. </template>
  181. </div>
  182. </div>
  183. </template>
  184. <div x-bind="historyEmptyState" class="empty-history">
  185. No video history yet
  186. </div>
  187. </div>
  188. </div>
  189. <!-- Individual playlist view -->
  190. <div class="playlist-view-container" x-bind="playlistViewContainer">
  191. <div class="playlist-full-view">
  192. <template x-for="(video, index) in currentPlaylistVideos" :key="index">
  193. <div
  194. class="video-item"
  195. :title="video.title"
  196. :data-playlist-name="currentPlaylistName"
  197. :data-playlist-index="index"
  198. x-bind="videoItemClass"
  199. >
  200. <a
  201. class="video-title"
  202. :href="video.url"
  203. x-text="video.title"
  204. x-bind="videoPlayLink"
  205. ></a>
  206. <div class="video-actions">
  207. <button
  208. :data-playlist-name="currentPlaylistName"
  209. :data-playlist-index="index"
  210. x-bind="moveUpButton"
  211. class="move-up-btn"
  212. title="Move up"
  213. >
  214. ↑
  215. </button>
  216. <button
  217. :data-playlist-name="currentPlaylistName"
  218. :data-playlist-index="index"
  219. x-bind="moveDownButton"
  220. class="move-down-btn"
  221. title="Move down"
  222. >
  223. ↓
  224. </button>
  225. <div class="more-menu-container">
  226. <button
  227. :data-playlist-name="currentPlaylistName"
  228. :data-playlist-index="index"
  229. x-bind="moreMenuButton"
  230. class="more-btn"
  231. title="More actions"
  232. >
  233. ⋯
  234. </button>
  235. <div
  236. class="more-menu"
  237. :data-playlist-name="currentPlaylistName"
  238. :data-playlist-index="index"
  239. x-bind="moreMenu"
  240. >
  241. <button
  242. :data-playlist-name="currentPlaylistName"
  243. :data-playlist-index="index"
  244. x-bind="toggleVideoDoneButton"
  245. class="menu-item done-item"
  246. x-text="video.doneButtonText"
  247. >
  248. </button>
  249. <button
  250. :data-playlist-name="currentPlaylistName"
  251. :data-playlist-index="index"
  252. x-bind="removeVideoButton"
  253. class="menu-item remove-item"
  254. >
  255. Remove
  256. </button>
  257. </div>
  258. </div>
  259. </div>
  260. </div>
  261. </template>
  262. <div x-bind="playlistViewEmptyState" class="empty-playlist">
  263. No videos in this playlist
  264. </div>
  265. </div>
  266. <!-- Add current page button -->
  267. <div class="add-current-page-container">
  268. <button
  269. class="add-current-page-btn"
  270. x-bind="addCurrentPageButton"
  271. x-text="addCurrentPageButtonText"
  272. ></button>
  273. </div>
  274. </div>
  275. <!-- Export/Import/History buttons -->
  276. <div class="export-container" x-bind="exportContainer">
  277. <button class="export-btn" x-bind="exportButton">
  278. Export Playlists
  279. </button>
  280. <button class="import-btn" x-bind="importButton">
  281. Import Playlists
  282. </button>
  283. <button class="history-btn" x-bind="historyButton">
  284. History
  285. </button>
  286. <input
  287. type="file"
  288. id="import-file-input"
  289. accept=".json"
  290. style="display: none"
  291. x-bind="importFileInput"
  292. />
  293. </div>
  294. </div>
  295. </body>
  296. </html>