popup.html 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539
  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. <button
  158. :data-playlist-name="playlistData.name"
  159. :data-playlist-index="video.originalIndex"
  160. x-bind="moveToSubmenuButton"
  161. class="menu-item move-to-playlist-item"
  162. >
  163. Move to…
  164. </button>
  165. <div
  166. class="move-to-submenu"
  167. :data-playlist-name="playlistData.name"
  168. :data-playlist-index="video.originalIndex"
  169. x-bind="moveToSubmenu"
  170. >
  171. <template x-for="pl in playlistData.otherPlaylists" :key="pl.name">
  172. <button
  173. class="menu-item move-to-playlist-option"
  174. :data-from-playlist-name="playlistData.name"
  175. :data-playlist-index="video.originalIndex"
  176. :data-to-playlist-name="pl.name"
  177. x-bind="moveToPlaylistButton"
  178. x-text="pl.display"
  179. ></button>
  180. </template>
  181. </div>
  182. </div>
  183. </div>
  184. </div>
  185. </div>
  186. </template>
  187. <!--
  188. <div x-show="videos.length === 0" class="empty-playlist">
  189. No videos in this playlist
  190. </div>
  191. -->
  192. </div>
  193. </div>
  194. </template>
  195. <div class="playlists-scroll-spacer" aria-hidden="true"></div>
  196. </div>
  197. <!-- Floating jump-scroll buttons (playlists view only) -->
  198. <div class="playlist-jump-buttons" x-bind="playlistJumpButtons">
  199. <button
  200. class="jump-btn jump-up-btn"
  201. x-bind="scrollUpButton"
  202. title="Jump to previous playlist"
  203. >
  204. ↑
  205. </button>
  206. <button
  207. class="jump-btn jump-down-btn"
  208. x-bind="scrollDownButton"
  209. title="Jump to next playlist"
  210. >
  211. ↓
  212. </button>
  213. </div>
  214. <!-- History view -->
  215. <div class="history-container" x-bind="historyContainer">
  216. <div class="history-list">
  217. <template x-for="videoHistory in sortedHistory" :key="videoHistory.videoId">
  218. <div class="history-item" :data-video-id="videoHistory.videoId">
  219. <div class="history-video-info">
  220. <div class="history-video-title" x-text="videoHistory.title" :title="videoHistory.title"></div>
  221. <a
  222. class="history-video-id"
  223. :href="videoHistory.url"
  224. x-text="videoHistory.formattedVideoId"
  225. x-bind="videoPlayLink"
  226. ></a>
  227. <div class="history-tags">
  228. <button
  229. class="tag-chip"
  230. :data-video-id="videoHistory.videoId"
  231. data-tag="notable"
  232. x-bind="tagChip"
  233. >
  234. notable
  235. </button>
  236. <button
  237. class="tag-chip"
  238. :data-video-id="videoHistory.videoId"
  239. data-tag="reference"
  240. x-bind="tagChip"
  241. >
  242. reference
  243. </button>
  244. <button
  245. class="tag-chip"
  246. :data-video-id="videoHistory.videoId"
  247. data-tag="to rewatch"
  248. x-bind="tagChip"
  249. >
  250. to rewatch
  251. </button>
  252. <button
  253. class="tag-chip"
  254. :data-video-id="videoHistory.videoId"
  255. data-tag="to save"
  256. x-bind="tagChip"
  257. >
  258. to save
  259. </button>
  260. </div>
  261. </div>
  262. <div class="history-events">
  263. <template x-for="event in videoHistory.processedEvents" :key="event.uniqueKey">
  264. <div class="history-event">
  265. <span class="event-action" x-text="event.formattedAction"></span>
  266. <span class="event-position" x-text="event.formattedPosition"></span>
  267. <span class="event-timestamp" x-text="event.formattedTimestamp"></span>
  268. </div>
  269. </template>
  270. </div>
  271. </div>
  272. </template>
  273. <div x-bind="historyEmptyState" class="empty-history">
  274. No video history yet
  275. </div>
  276. </div>
  277. </div>
  278. <!-- Save Channel view -->
  279. <div class="save-channel-container" x-bind="saveChannelContainer">
  280. <div class="save-channel-content">
  281. <div class="curl-command-section">
  282. <div class="curl-field-container">
  283. <textarea
  284. class="curl-command-field"
  285. x-text="curlCommand"
  286. readonly
  287. ></textarea>
  288. <button
  289. class="copy-curl-btn"
  290. x-bind="copyCurlButton"
  291. title="Copy to clipboard"
  292. >
  293. Copy
  294. </button>
  295. </div>
  296. </div>
  297. <div class="interval-section">
  298. <label for="check-interval-input" class="interval-label">Check Interval (days):</label>
  299. <input
  300. type="number"
  301. id="check-interval-input"
  302. class="interval-input"
  303. min="1"
  304. step="1"
  305. x-bind="intervalInput"
  306. />
  307. </div>
  308. <div class="category-section">
  309. <h3>Categories</h3>
  310. <div class="category-buttons">
  311. <template x-for="category in availableCategories" :key="category">
  312. <button
  313. class="category-btn"
  314. :data-category="category"
  315. x-bind="categoryButton"
  316. x-text="category"
  317. ></button>
  318. </template>
  319. </div>
  320. </div>
  321. <div class="save-channel-notice" x-bind="saveChannelNotice">
  322. <p>This feature is only available on YouTube channel pages (/videos).</p>
  323. </div>
  324. </div>
  325. </div>
  326. <!-- Wiki/Insp view -->
  327. <div class="wiki-insp-container" x-bind="wikiInspContainer">
  328. <div class="wiki-insp-content">
  329. <div class="wikitext-command-section">
  330. <textarea
  331. class="wikitext-command-field"
  332. x-text="wikitextCommand"
  333. readonly
  334. ></textarea>
  335. <div class="timestamp-controls">
  336. <div class="timestamp-checkbox-container">
  337. <label class="timestamp-checkbox-label">
  338. <input
  339. type="checkbox"
  340. class="timestamp-checkbox"
  341. x-bind="timestampCheckbox"
  342. />
  343. Include timestamp line
  344. </label>
  345. </div>
  346. <button
  347. class="refresh-timestamp-btn"
  348. x-bind="refreshTimestampButton"
  349. title="Refresh current video timestamp"
  350. >
  351. 🔄 Refresh
  352. </button>
  353. </div>
  354. <button
  355. class="copy-wikitext-btn"
  356. x-bind="copyWikitextButton"
  357. title="Copy to clipboard"
  358. >
  359. Copy
  360. </button>
  361. </div>
  362. <div class="wiki-insp-notice" x-bind="wikiInspNotice">
  363. <p>This feature is only available on YouTube video pages (/watch).</p>
  364. </div>
  365. </div>
  366. </div>
  367. <!-- Import view -->
  368. <div class="import-container" x-bind="importContainer">
  369. <div class="import-content">
  370. <div class="import-section">
  371. <textarea
  372. class="import-textarea"
  373. placeholder="Paste your JSON export here..."
  374. x-bind="importTextarea"
  375. ></textarea>
  376. <button
  377. class="import-submit-btn"
  378. x-bind="importSubmitButton"
  379. >
  380. Import
  381. </button>
  382. </div>
  383. </div>
  384. </div>
  385. <!-- Add current page button (above playlist view card) -->
  386. <div class="add-current-page-container" x-bind="addCurrentPageContainer">
  387. <button
  388. class="add-current-page-btn"
  389. x-bind="addCurrentPageButton"
  390. x-text="addCurrentPageButtonText"
  391. ></button>
  392. <div class="scatter-control">
  393. <input
  394. class="scatter-count-input"
  395. type="number"
  396. min="2"
  397. x-bind="scatterCountInput"
  398. />
  399. <button class="scatter-btn" x-bind="scatterButton">Scatter</button>
  400. </div>
  401. </div>
  402. <!-- Individual playlist view -->
  403. <div class="playlist-view-container" x-bind="playlistViewContainer">
  404. <div class="playlist-full-view">
  405. <template x-for="(video, index) in currentPlaylistVideos" :key="index">
  406. <div
  407. class="video-item"
  408. :title="video.title"
  409. :data-playlist-name="currentPlaylistName"
  410. :data-playlist-index="index"
  411. x-bind="videoItemClass"
  412. >
  413. <a
  414. class="video-title"
  415. :href="video.url"
  416. x-text="video.title"
  417. x-bind="videoPlayLink"
  418. ></a>
  419. <div class="video-actions">
  420. <button
  421. :data-playlist-name="currentPlaylistName"
  422. :data-playlist-index="index"
  423. x-bind="moveUpButton"
  424. class="move-up-btn"
  425. title="Move up"
  426. >
  427. ↑
  428. </button>
  429. <button
  430. :data-playlist-name="currentPlaylistName"
  431. :data-playlist-index="index"
  432. x-bind="moveDownButton"
  433. class="move-down-btn"
  434. title="Move down"
  435. >
  436. ↓
  437. </button>
  438. <div class="more-menu-container">
  439. <button
  440. :data-playlist-name="currentPlaylistName"
  441. :data-playlist-index="index"
  442. x-bind="moreMenuButton"
  443. class="more-btn"
  444. title="More actions"
  445. >
  446. ⋯
  447. </button>
  448. <div
  449. class="more-menu"
  450. :data-playlist-name="currentPlaylistName"
  451. :data-playlist-index="index"
  452. x-bind="moreMenu"
  453. >
  454. <button
  455. :data-playlist-name="currentPlaylistName"
  456. :data-playlist-index="index"
  457. x-bind="moveToTopButton"
  458. class="menu-item move-to-top-item"
  459. >
  460. Move to Top
  461. </button>
  462. <button
  463. :data-playlist-name="currentPlaylistName"
  464. :data-playlist-index="index"
  465. x-bind="moveToBottomButton"
  466. class="menu-item move-to-bottom-item"
  467. >
  468. Move to Bottom
  469. </button>
  470. <button
  471. :data-playlist-name="currentPlaylistName"
  472. :data-playlist-index="index"
  473. x-bind="toggleVideoDoneButton"
  474. class="menu-item done-item"
  475. x-text="video.doneButtonText"
  476. >
  477. </button>
  478. <button
  479. :data-playlist-name="currentPlaylistName"
  480. :data-playlist-index="index"
  481. x-bind="removeVideoButton"
  482. class="menu-item remove-item"
  483. >
  484. Remove
  485. </button>
  486. <button
  487. :data-playlist-name="currentPlaylistName"
  488. :data-playlist-index="index"
  489. x-bind="moveToSubmenuButton"
  490. class="menu-item move-to-playlist-item"
  491. >
  492. Move to…
  493. </button>
  494. <div
  495. class="move-to-submenu"
  496. :data-playlist-name="currentPlaylistName"
  497. :data-playlist-index="index"
  498. x-bind="moveToSubmenu"
  499. >
  500. <template x-for="pl in otherPlaylists" :key="pl.name">
  501. <button
  502. class="menu-item move-to-playlist-option"
  503. :data-from-playlist-name="currentPlaylistName"
  504. :data-playlist-index="index"
  505. :data-to-playlist-name="pl.name"
  506. x-bind="moveToPlaylistButton"
  507. x-text="pl.display"
  508. ></button>
  509. </template>
  510. </div>
  511. </div>
  512. </div>
  513. </div>
  514. </div>
  515. </template>
  516. <div x-bind="playlistViewEmptyState" class="empty-playlist">
  517. No videos in this playlist
  518. </div>
  519. </div>
  520. </div>
  521. </div>
  522. </body>
  523. </html>