popup.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  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. <header x-bind="saveChannelHeader">
  26. <button class="back-btn-arrow" x-bind="backButton">←</button>
  27. <h1>Save Channel</h1>
  28. </header>
  29. <div class="playlists-container" x-bind="playlistsContainer">
  30. <template
  31. x-for="playlistData in playlistsForDisplay"
  32. :key="playlistData.name"
  33. >
  34. <div class="playlist">
  35. <h2
  36. class="playlist-name-clickable"
  37. x-text="playlistData.name"
  38. :data-playlist-name="playlistData.name"
  39. x-bind="playlistNameClick"
  40. ></h2>
  41. <div class="video-list">
  42. <!-- Truncated previous videos indicator -->
  43. <div
  44. class="truncated-videos"
  45. :data-playlist-name="playlistData.name"
  46. x-bind="truncatedVideosDisplay"
  47. >
  48. <span x-text="playlistData.truncationText"></span>
  49. </div>
  50. <template x-for="(video, index) in playlistData.visibleVideos" :key="index">
  51. <div
  52. class="video-item"
  53. :title="video.title"
  54. :data-playlist-name="playlistData.name"
  55. :data-playlist-index="video.originalIndex"
  56. x-bind="videoItemClass"
  57. >
  58. <a
  59. class="video-title"
  60. :href="video.url"
  61. x-text="video.title"
  62. x-bind="videoPlayLink"
  63. ></a>
  64. <div class="video-actions">
  65. <button
  66. :data-playlist-name="playlistData.name"
  67. :data-playlist-index="video.originalIndex"
  68. x-bind="moveUpButton"
  69. class="move-up-btn"
  70. title="Move up"
  71. >
  72. ↑
  73. </button>
  74. <button
  75. :data-playlist-name="playlistData.name"
  76. :data-playlist-index="video.originalIndex"
  77. x-bind="moveDownButton"
  78. class="move-down-btn"
  79. title="Move down"
  80. >
  81. ↓
  82. </button>
  83. <div class="more-menu-container">
  84. <button
  85. :data-playlist-name="playlistData.name"
  86. :data-playlist-index="video.originalIndex"
  87. x-bind="moreMenuButton"
  88. class="more-btn"
  89. title="More actions"
  90. >
  91. ⋯
  92. </button>
  93. <div
  94. class="more-menu"
  95. :data-playlist-name="playlistData.name"
  96. :data-playlist-index="video.originalIndex"
  97. x-bind="moreMenu"
  98. >
  99. <button
  100. :data-playlist-name="playlistData.name"
  101. :data-playlist-index="video.originalIndex"
  102. x-bind="toggleVideoDoneButton"
  103. class="menu-item done-item"
  104. x-text="video.doneButtonText"
  105. >
  106. </button>
  107. <button
  108. :data-playlist-name="playlistData.name"
  109. :data-playlist-index="video.originalIndex"
  110. x-bind="removeVideoButton"
  111. class="menu-item remove-item"
  112. >
  113. Remove
  114. </button>
  115. </div>
  116. </div>
  117. </div>
  118. </div>
  119. </template>
  120. <!--
  121. <div x-show="videos.length === 0" class="empty-playlist">
  122. No videos in this playlist
  123. </div>
  124. -->
  125. </div>
  126. </div>
  127. </template>
  128. </div>
  129. <!-- History view -->
  130. <div class="history-container" x-bind="historyContainer">
  131. <div class="history-list">
  132. <template x-for="videoHistory in sortedHistory" :key="videoHistory.videoId">
  133. <div class="history-item" :data-video-id="videoHistory.videoId">
  134. <div class="history-video-info">
  135. <div class="history-video-title" x-text="videoHistory.title"></div>
  136. <a
  137. class="history-video-id"
  138. :href="videoHistory.url"
  139. x-text="videoHistory.formattedVideoId"
  140. x-bind="videoPlayLink"
  141. ></a>
  142. <div class="history-tags">
  143. <button
  144. class="tag-chip"
  145. :data-video-id="videoHistory.videoId"
  146. data-tag="notable"
  147. x-bind="tagChip"
  148. >
  149. notable
  150. </button>
  151. <button
  152. class="tag-chip"
  153. :data-video-id="videoHistory.videoId"
  154. data-tag="reference"
  155. x-bind="tagChip"
  156. >
  157. reference
  158. </button>
  159. <button
  160. class="tag-chip"
  161. :data-video-id="videoHistory.videoId"
  162. data-tag="to rewatch"
  163. x-bind="tagChip"
  164. >
  165. to rewatch
  166. </button>
  167. <button
  168. class="tag-chip"
  169. :data-video-id="videoHistory.videoId"
  170. data-tag="to save"
  171. x-bind="tagChip"
  172. >
  173. to save
  174. </button>
  175. </div>
  176. </div>
  177. <div class="history-events">
  178. <template x-for="event in videoHistory.processedEvents" :key="event.uniqueKey">
  179. <div class="history-event">
  180. <span class="event-action" x-text="event.formattedAction"></span>
  181. <span class="event-position" x-text="event.formattedPosition"></span>
  182. <span class="event-timestamp" x-text="event.formattedTimestamp"></span>
  183. </div>
  184. </template>
  185. </div>
  186. </div>
  187. </template>
  188. <div x-bind="historyEmptyState" class="empty-history">
  189. No video history yet
  190. </div>
  191. </div>
  192. </div>
  193. <!-- Save Channel view -->
  194. <div class="save-channel-container" x-bind="saveChannelContainer">
  195. <div class="save-channel-content">
  196. <div class="curl-command-section">
  197. <div class="curl-field-container">
  198. <textarea
  199. class="curl-command-field"
  200. x-text="curlCommand"
  201. readonly
  202. ></textarea>
  203. <button
  204. class="copy-curl-btn"
  205. x-bind="copyCurlButton"
  206. title="Copy to clipboard"
  207. >
  208. Copy
  209. </button>
  210. </div>
  211. </div>
  212. <div class="interval-section">
  213. <label for="check-interval-input" class="interval-label">Check Interval (days):</label>
  214. <input
  215. type="number"
  216. id="check-interval-input"
  217. class="interval-input"
  218. min="1"
  219. step="1"
  220. x-bind="intervalInput"
  221. />
  222. </div>
  223. <div class="category-section">
  224. <h3>Categories</h3>
  225. <div class="category-buttons">
  226. <template x-for="category in availableCategories" :key="category">
  227. <button
  228. class="category-btn"
  229. :data-category="category"
  230. x-bind="categoryButton"
  231. x-text="category"
  232. ></button>
  233. </template>
  234. </div>
  235. </div>
  236. <div class="save-channel-notice" x-bind="saveChannelNotice">
  237. <p>This feature is only available on YouTube channel pages (/videos).</p>
  238. </div>
  239. </div>
  240. </div>
  241. <!-- Individual playlist view -->
  242. <div class="playlist-view-container" x-bind="playlistViewContainer">
  243. <div class="playlist-full-view">
  244. <template x-for="(video, index) in currentPlaylistVideos" :key="index">
  245. <div
  246. class="video-item"
  247. :title="video.title"
  248. :data-playlist-name="currentPlaylistName"
  249. :data-playlist-index="index"
  250. x-bind="videoItemClass"
  251. >
  252. <a
  253. class="video-title"
  254. :href="video.url"
  255. x-text="video.title"
  256. x-bind="videoPlayLink"
  257. ></a>
  258. <div class="video-actions">
  259. <button
  260. :data-playlist-name="currentPlaylistName"
  261. :data-playlist-index="index"
  262. x-bind="moveUpButton"
  263. class="move-up-btn"
  264. title="Move up"
  265. >
  266. ↑
  267. </button>
  268. <button
  269. :data-playlist-name="currentPlaylistName"
  270. :data-playlist-index="index"
  271. x-bind="moveDownButton"
  272. class="move-down-btn"
  273. title="Move down"
  274. >
  275. ↓
  276. </button>
  277. <div class="more-menu-container">
  278. <button
  279. :data-playlist-name="currentPlaylistName"
  280. :data-playlist-index="index"
  281. x-bind="moreMenuButton"
  282. class="more-btn"
  283. title="More actions"
  284. >
  285. ⋯
  286. </button>
  287. <div
  288. class="more-menu"
  289. :data-playlist-name="currentPlaylistName"
  290. :data-playlist-index="index"
  291. x-bind="moreMenu"
  292. >
  293. <button
  294. :data-playlist-name="currentPlaylistName"
  295. :data-playlist-index="index"
  296. x-bind="toggleVideoDoneButton"
  297. class="menu-item done-item"
  298. x-text="video.doneButtonText"
  299. >
  300. </button>
  301. <button
  302. :data-playlist-name="currentPlaylistName"
  303. :data-playlist-index="index"
  304. x-bind="removeVideoButton"
  305. class="menu-item remove-item"
  306. >
  307. Remove
  308. </button>
  309. </div>
  310. </div>
  311. </div>
  312. </div>
  313. </template>
  314. <div x-bind="playlistViewEmptyState" class="empty-playlist">
  315. No videos in this playlist
  316. </div>
  317. </div>
  318. <!-- Add current page button -->
  319. <div class="add-current-page-container">
  320. <button
  321. class="add-current-page-btn"
  322. x-bind="addCurrentPageButton"
  323. x-text="addCurrentPageButtonText"
  324. ></button>
  325. </div>
  326. </div>
  327. <!-- Export/Import/History buttons -->
  328. <div class="export-container" x-bind="exportContainer">
  329. <button class="export-btn" x-bind="exportButton">
  330. Export Playlists
  331. </button>
  332. <button class="import-btn" x-bind="importButton">
  333. Import Playlists
  334. </button>
  335. <button class="history-btn" x-bind="historyButton">
  336. History
  337. </button>
  338. <button class="save-channel-btn" x-bind="saveChannelButton">
  339. Save Channel
  340. </button>
  341. <input
  342. type="file"
  343. id="import-file-input"
  344. accept=".json"
  345. style="display: none"
  346. x-bind="importFileInput"
  347. />
  348. </div>
  349. </div>
  350. </body>
  351. </html>