popup.html 16 KB

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