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