popup.html 19 KB

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