popup.html 18 KB

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