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