popup.html 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  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. <header x-bind="wikiInspHeader">
  30. <button class="back-btn-arrow" x-bind="backButton">←</button>
  31. <h1>Wiki/Insp</h1>
  32. </header>
  33. <header x-bind="importHeader">
  34. <button class="back-btn-arrow" x-bind="backButton">←</button>
  35. <h1>Import Playlists</h1>
  36. </header>
  37. <div class="playlists-container" x-bind="playlistsContainer">
  38. <template
  39. x-for="playlistData in playlistsForDisplay"
  40. :key="playlistData.name"
  41. >
  42. <div class="playlist">
  43. <h2
  44. class="playlist-name-clickable"
  45. x-text="playlistData.name"
  46. :data-playlist-name="playlistData.name"
  47. x-bind="playlistNameClick"
  48. ></h2>
  49. <div class="video-list">
  50. <!-- Truncated previous videos indicator -->
  51. <div
  52. class="truncated-videos"
  53. :data-playlist-name="playlistData.name"
  54. x-bind="truncatedVideosDisplay"
  55. >
  56. <span x-text="playlistData.truncationText"></span>
  57. </div>
  58. <template x-for="(video, index) in playlistData.visibleVideos" :key="index">
  59. <div
  60. class="video-item"
  61. :title="video.title"
  62. :data-playlist-name="playlistData.name"
  63. :data-playlist-index="video.originalIndex"
  64. x-bind="videoItemClass"
  65. >
  66. <a
  67. class="video-title"
  68. :href="video.url"
  69. x-text="video.title"
  70. x-bind="videoPlayLink"
  71. ></a>
  72. <div class="video-actions">
  73. <button
  74. :data-playlist-name="playlistData.name"
  75. :data-playlist-index="video.originalIndex"
  76. x-bind="moveUpButton"
  77. class="move-up-btn"
  78. title="Move up"
  79. >
  80. </button>
  81. <button
  82. :data-playlist-name="playlistData.name"
  83. :data-playlist-index="video.originalIndex"
  84. x-bind="moveDownButton"
  85. class="move-down-btn"
  86. title="Move down"
  87. >
  88. </button>
  89. <div class="more-menu-container">
  90. <button
  91. :data-playlist-name="playlistData.name"
  92. :data-playlist-index="video.originalIndex"
  93. x-bind="moreMenuButton"
  94. class="more-btn"
  95. title="More actions"
  96. >
  97. </button>
  98. <div
  99. class="more-menu"
  100. :data-playlist-name="playlistData.name"
  101. :data-playlist-index="video.originalIndex"
  102. x-bind="moreMenu"
  103. >
  104. <button
  105. :data-playlist-name="playlistData.name"
  106. :data-playlist-index="video.originalIndex"
  107. x-bind="moveToTopButton"
  108. class="menu-item move-to-top-item"
  109. >
  110. Move to Top
  111. </button>
  112. <button
  113. :data-playlist-name="playlistData.name"
  114. :data-playlist-index="video.originalIndex"
  115. x-bind="moveToBottomButton"
  116. class="menu-item move-to-bottom-item"
  117. >
  118. Move to Bottom
  119. </button>
  120. <button
  121. :data-playlist-name="playlistData.name"
  122. :data-playlist-index="video.originalIndex"
  123. x-bind="toggleVideoDoneButton"
  124. class="menu-item done-item"
  125. x-text="video.doneButtonText"
  126. >
  127. </button>
  128. <button
  129. :data-playlist-name="playlistData.name"
  130. :data-playlist-index="video.originalIndex"
  131. x-bind="removeVideoButton"
  132. class="menu-item remove-item"
  133. >
  134. Remove
  135. </button>
  136. </div>
  137. </div>
  138. </div>
  139. </div>
  140. </template>
  141. <!--
  142. <div x-show="videos.length === 0" class="empty-playlist">
  143. No videos in this playlist
  144. </div>
  145. -->
  146. </div>
  147. </div>
  148. </template>
  149. </div>
  150. <!-- History view -->
  151. <div class="history-container" x-bind="historyContainer">
  152. <div class="history-list">
  153. <template x-for="videoHistory in sortedHistory" :key="videoHistory.videoId">
  154. <div class="history-item" :data-video-id="videoHistory.videoId">
  155. <div class="history-video-info">
  156. <div class="history-video-title" x-text="videoHistory.title"></div>
  157. <a
  158. class="history-video-id"
  159. :href="videoHistory.url"
  160. x-text="videoHistory.formattedVideoId"
  161. x-bind="videoPlayLink"
  162. ></a>
  163. <div class="history-tags">
  164. <button
  165. class="tag-chip"
  166. :data-video-id="videoHistory.videoId"
  167. data-tag="notable"
  168. x-bind="tagChip"
  169. >
  170. notable
  171. </button>
  172. <button
  173. class="tag-chip"
  174. :data-video-id="videoHistory.videoId"
  175. data-tag="reference"
  176. x-bind="tagChip"
  177. >
  178. reference
  179. </button>
  180. <button
  181. class="tag-chip"
  182. :data-video-id="videoHistory.videoId"
  183. data-tag="to rewatch"
  184. x-bind="tagChip"
  185. >
  186. to rewatch
  187. </button>
  188. <button
  189. class="tag-chip"
  190. :data-video-id="videoHistory.videoId"
  191. data-tag="to save"
  192. x-bind="tagChip"
  193. >
  194. to save
  195. </button>
  196. </div>
  197. </div>
  198. <div class="history-events">
  199. <template x-for="event in videoHistory.processedEvents" :key="event.uniqueKey">
  200. <div class="history-event">
  201. <span class="event-action" x-text="event.formattedAction"></span>
  202. <span class="event-position" x-text="event.formattedPosition"></span>
  203. <span class="event-timestamp" x-text="event.formattedTimestamp"></span>
  204. </div>
  205. </template>
  206. </div>
  207. </div>
  208. </template>
  209. <div x-bind="historyEmptyState" class="empty-history">
  210. No video history yet
  211. </div>
  212. </div>
  213. </div>
  214. <!-- Save Channel view -->
  215. <div class="save-channel-container" x-bind="saveChannelContainer">
  216. <div class="save-channel-content">
  217. <div class="curl-command-section">
  218. <div class="curl-field-container">
  219. <textarea
  220. class="curl-command-field"
  221. x-text="curlCommand"
  222. readonly
  223. ></textarea>
  224. <button
  225. class="copy-curl-btn"
  226. x-bind="copyCurlButton"
  227. title="Copy to clipboard"
  228. >
  229. Copy
  230. </button>
  231. </div>
  232. </div>
  233. <div class="interval-section">
  234. <label for="check-interval-input" class="interval-label">Check Interval (days):</label>
  235. <input
  236. type="number"
  237. id="check-interval-input"
  238. class="interval-input"
  239. min="1"
  240. step="1"
  241. x-bind="intervalInput"
  242. />
  243. </div>
  244. <div class="category-section">
  245. <h3>Categories</h3>
  246. <div class="category-buttons">
  247. <template x-for="category in availableCategories" :key="category">
  248. <button
  249. class="category-btn"
  250. :data-category="category"
  251. x-bind="categoryButton"
  252. x-text="category"
  253. ></button>
  254. </template>
  255. </div>
  256. </div>
  257. <div class="save-channel-notice" x-bind="saveChannelNotice">
  258. <p>This feature is only available on YouTube channel pages (/videos).</p>
  259. </div>
  260. </div>
  261. </div>
  262. <!-- Wiki/Insp view -->
  263. <div class="wiki-insp-container" x-bind="wikiInspContainer">
  264. <div class="wiki-insp-content">
  265. <div class="wikitext-command-section">
  266. <textarea
  267. class="wikitext-command-field"
  268. x-text="wikitextCommand"
  269. readonly
  270. ></textarea>
  271. <div class="timestamp-controls">
  272. <div class="timestamp-checkbox-container">
  273. <label class="timestamp-checkbox-label">
  274. <input
  275. type="checkbox"
  276. class="timestamp-checkbox"
  277. x-bind="timestampCheckbox"
  278. />
  279. Include timestamp line
  280. </label>
  281. </div>
  282. <button
  283. class="refresh-timestamp-btn"
  284. x-bind="refreshTimestampButton"
  285. title="Refresh current video timestamp"
  286. >
  287. 🔄 Refresh
  288. </button>
  289. </div>
  290. <button
  291. class="copy-wikitext-btn"
  292. x-bind="copyWikitextButton"
  293. title="Copy to clipboard"
  294. >
  295. Copy
  296. </button>
  297. </div>
  298. <div class="wiki-insp-notice" x-bind="wikiInspNotice">
  299. <p>This feature is only available on YouTube video pages (/watch).</p>
  300. </div>
  301. </div>
  302. </div>
  303. <!-- Import view -->
  304. <div class="import-container" x-bind="importContainer">
  305. <div class="import-content">
  306. <div class="import-section">
  307. <textarea
  308. class="import-textarea"
  309. placeholder="Paste your JSON export here..."
  310. x-bind="importTextarea"
  311. ></textarea>
  312. <button
  313. class="import-submit-btn"
  314. x-bind="importSubmitButton"
  315. >
  316. Import
  317. </button>
  318. </div>
  319. </div>
  320. </div>
  321. <!-- Individual playlist view -->
  322. <div class="playlist-view-container" x-bind="playlistViewContainer">
  323. <div class="playlist-full-view">
  324. <template x-for="(video, index) in currentPlaylistVideos" :key="index">
  325. <div
  326. class="video-item"
  327. :title="video.title"
  328. :data-playlist-name="currentPlaylistName"
  329. :data-playlist-index="index"
  330. x-bind="videoItemClass"
  331. >
  332. <a
  333. class="video-title"
  334. :href="video.url"
  335. x-text="video.title"
  336. x-bind="videoPlayLink"
  337. ></a>
  338. <div class="video-actions">
  339. <button
  340. :data-playlist-name="currentPlaylistName"
  341. :data-playlist-index="index"
  342. x-bind="moveUpButton"
  343. class="move-up-btn"
  344. title="Move up"
  345. >
  346. </button>
  347. <button
  348. :data-playlist-name="currentPlaylistName"
  349. :data-playlist-index="index"
  350. x-bind="moveDownButton"
  351. class="move-down-btn"
  352. title="Move down"
  353. >
  354. </button>
  355. <div class="more-menu-container">
  356. <button
  357. :data-playlist-name="currentPlaylistName"
  358. :data-playlist-index="index"
  359. x-bind="moreMenuButton"
  360. class="more-btn"
  361. title="More actions"
  362. >
  363. </button>
  364. <div
  365. class="more-menu"
  366. :data-playlist-name="currentPlaylistName"
  367. :data-playlist-index="index"
  368. x-bind="moreMenu"
  369. >
  370. <button
  371. :data-playlist-name="currentPlaylistName"
  372. :data-playlist-index="index"
  373. x-bind="moveToTopButton"
  374. class="menu-item move-to-top-item"
  375. >
  376. Move to Top
  377. </button>
  378. <button
  379. :data-playlist-name="currentPlaylistName"
  380. :data-playlist-index="index"
  381. x-bind="moveToBottomButton"
  382. class="menu-item move-to-bottom-item"
  383. >
  384. Move to Bottom
  385. </button>
  386. <button
  387. :data-playlist-name="currentPlaylistName"
  388. :data-playlist-index="index"
  389. x-bind="toggleVideoDoneButton"
  390. class="menu-item done-item"
  391. x-text="video.doneButtonText"
  392. >
  393. </button>
  394. <button
  395. :data-playlist-name="currentPlaylistName"
  396. :data-playlist-index="index"
  397. x-bind="removeVideoButton"
  398. class="menu-item remove-item"
  399. >
  400. Remove
  401. </button>
  402. </div>
  403. </div>
  404. </div>
  405. </div>
  406. </template>
  407. <div x-bind="playlistViewEmptyState" class="empty-playlist">
  408. No videos in this playlist
  409. </div>
  410. </div>
  411. <!-- Add current page button -->
  412. <div class="add-current-page-container">
  413. <button
  414. class="add-current-page-btn"
  415. x-bind="addCurrentPageButton"
  416. x-text="addCurrentPageButtonText"
  417. ></button>
  418. </div>
  419. </div>
  420. <!-- Export/Import/History buttons -->
  421. <div class="export-container" x-bind="exportContainer">
  422. <button class="export-btn" x-bind="exportButton">
  423. Export Playlists
  424. </button>
  425. <button class="import-btn" x-bind="importButton">
  426. Import Playlists
  427. </button>
  428. <button class="history-btn" x-bind="historyButton">
  429. History
  430. </button>
  431. <button class="save-channel-btn" x-bind="saveChannelButton">
  432. Save Channel
  433. </button>
  434. <button class="wiki-insp-btn" x-bind="wikiInspButton">
  435. Wiki/Insp
  436. </button>
  437. </div>
  438. </div>
  439. </body>
  440. </html>