popup.html 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  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. <div class="playlists-container" x-bind="playlistsContainer">
  38. <template
  39. x-for="playlistData in playlistsForDisplay"
  40. :key="playlistData.name"
  41. >
  42. <div class="playlist">
  43. <h2
  44. class="playlist-name-clickable"
  45. x-text="playlistData.name"
  46. :data-playlist-name="playlistData.name"
  47. x-bind="playlistNameClick"
  48. ></h2>
  49. <div class="video-list">
  50. <!-- Truncated previous videos indicator -->
  51. <div
  52. class="truncated-videos"
  53. :data-playlist-name="playlistData.name"
  54. x-bind="truncatedVideosDisplay"
  55. >
  56. <span x-text="playlistData.truncationText"></span>
  57. </div>
  58. <template x-for="(video, index) in playlistData.visibleVideos" :key="index">
  59. <div
  60. class="video-item"
  61. :title="video.title"
  62. :data-playlist-name="playlistData.name"
  63. :data-playlist-index="video.originalIndex"
  64. x-bind="videoItemClass"
  65. >
  66. <a
  67. class="video-title"
  68. :href="video.url"
  69. x-text="video.title"
  70. x-bind="videoPlayLink"
  71. ></a>
  72. <div class="video-actions">
  73. <button
  74. :data-playlist-name="playlistData.name"
  75. :data-playlist-index="video.originalIndex"
  76. x-bind="moveUpButton"
  77. class="move-up-btn"
  78. title="Move up"
  79. >
  80. ↑
  81. </button>
  82. <button
  83. :data-playlist-name="playlistData.name"
  84. :data-playlist-index="video.originalIndex"
  85. x-bind="moveDownButton"
  86. class="move-down-btn"
  87. title="Move down"
  88. >
  89. ↓
  90. </button>
  91. <div class="more-menu-container">
  92. <button
  93. :data-playlist-name="playlistData.name"
  94. :data-playlist-index="video.originalIndex"
  95. x-bind="moreMenuButton"
  96. class="more-btn"
  97. title="More actions"
  98. >
  99. ⋯
  100. </button>
  101. <div
  102. class="more-menu"
  103. :data-playlist-name="playlistData.name"
  104. :data-playlist-index="video.originalIndex"
  105. x-bind="moreMenu"
  106. >
  107. <button
  108. :data-playlist-name="playlistData.name"
  109. :data-playlist-index="video.originalIndex"
  110. x-bind="moveToTopButton"
  111. class="menu-item move-to-top-item"
  112. >
  113. Move to Top
  114. </button>
  115. <button
  116. :data-playlist-name="playlistData.name"
  117. :data-playlist-index="video.originalIndex"
  118. x-bind="moveToBottomButton"
  119. class="menu-item move-to-bottom-item"
  120. >
  121. Move to Bottom
  122. </button>
  123. <button
  124. :data-playlist-name="playlistData.name"
  125. :data-playlist-index="video.originalIndex"
  126. x-bind="toggleVideoDoneButton"
  127. class="menu-item done-item"
  128. x-text="video.doneButtonText"
  129. >
  130. </button>
  131. <button
  132. :data-playlist-name="playlistData.name"
  133. :data-playlist-index="video.originalIndex"
  134. x-bind="removeVideoButton"
  135. class="menu-item remove-item"
  136. >
  137. Remove
  138. </button>
  139. </div>
  140. </div>
  141. </div>
  142. </div>
  143. </template>
  144. <!--
  145. <div x-show="videos.length === 0" class="empty-playlist">
  146. No videos in this playlist
  147. </div>
  148. -->
  149. </div>
  150. </div>
  151. </template>
  152. </div>
  153. <!-- History view -->
  154. <div class="history-container" x-bind="historyContainer">
  155. <div class="history-list">
  156. <template x-for="videoHistory in sortedHistory" :key="videoHistory.videoId">
  157. <div class="history-item" :data-video-id="videoHistory.videoId">
  158. <div class="history-video-info">
  159. <div class="history-video-title" x-text="videoHistory.title"></div>
  160. <a
  161. class="history-video-id"
  162. :href="videoHistory.url"
  163. x-text="videoHistory.formattedVideoId"
  164. x-bind="videoPlayLink"
  165. ></a>
  166. <div class="history-tags">
  167. <button
  168. class="tag-chip"
  169. :data-video-id="videoHistory.videoId"
  170. data-tag="notable"
  171. x-bind="tagChip"
  172. >
  173. notable
  174. </button>
  175. <button
  176. class="tag-chip"
  177. :data-video-id="videoHistory.videoId"
  178. data-tag="reference"
  179. x-bind="tagChip"
  180. >
  181. reference
  182. </button>
  183. <button
  184. class="tag-chip"
  185. :data-video-id="videoHistory.videoId"
  186. data-tag="to rewatch"
  187. x-bind="tagChip"
  188. >
  189. to rewatch
  190. </button>
  191. <button
  192. class="tag-chip"
  193. :data-video-id="videoHistory.videoId"
  194. data-tag="to save"
  195. x-bind="tagChip"
  196. >
  197. to save
  198. </button>
  199. </div>
  200. </div>
  201. <div class="history-events">
  202. <template x-for="event in videoHistory.processedEvents" :key="event.uniqueKey">
  203. <div class="history-event">
  204. <span class="event-action" x-text="event.formattedAction"></span>
  205. <span class="event-position" x-text="event.formattedPosition"></span>
  206. <span class="event-timestamp" x-text="event.formattedTimestamp"></span>
  207. </div>
  208. </template>
  209. </div>
  210. </div>
  211. </template>
  212. <div x-bind="historyEmptyState" class="empty-history">
  213. No video history yet
  214. </div>
  215. </div>
  216. </div>
  217. <!-- Save Channel view -->
  218. <div class="save-channel-container" x-bind="saveChannelContainer">
  219. <div class="save-channel-content">
  220. <div class="curl-command-section">
  221. <div class="curl-field-container">
  222. <textarea
  223. class="curl-command-field"
  224. x-text="curlCommand"
  225. readonly
  226. ></textarea>
  227. <button
  228. class="copy-curl-btn"
  229. x-bind="copyCurlButton"
  230. title="Copy to clipboard"
  231. >
  232. Copy
  233. </button>
  234. </div>
  235. </div>
  236. <div class="interval-section">
  237. <label for="check-interval-input" class="interval-label">Check Interval (days):</label>
  238. <input
  239. type="number"
  240. id="check-interval-input"
  241. class="interval-input"
  242. min="1"
  243. step="1"
  244. x-bind="intervalInput"
  245. />
  246. </div>
  247. <div class="category-section">
  248. <h3>Categories</h3>
  249. <div class="category-buttons">
  250. <template x-for="category in availableCategories" :key="category">
  251. <button
  252. class="category-btn"
  253. :data-category="category"
  254. x-bind="categoryButton"
  255. x-text="category"
  256. ></button>
  257. </template>
  258. </div>
  259. </div>
  260. <div class="save-channel-notice" x-bind="saveChannelNotice">
  261. <p>This feature is only available on YouTube channel pages (/videos).</p>
  262. </div>
  263. </div>
  264. </div>
  265. <!-- Wiki/Insp view -->
  266. <div class="wiki-insp-container" x-bind="wikiInspContainer">
  267. <div class="wiki-insp-content">
  268. <div class="wikitext-command-section">
  269. <textarea
  270. class="wikitext-command-field"
  271. x-text="wikitextCommand"
  272. readonly
  273. ></textarea>
  274. <div class="timestamp-controls">
  275. <div class="timestamp-checkbox-container">
  276. <label class="timestamp-checkbox-label">
  277. <input
  278. type="checkbox"
  279. class="timestamp-checkbox"
  280. x-bind="timestampCheckbox"
  281. />
  282. Include timestamp line
  283. </label>
  284. </div>
  285. <button
  286. class="refresh-timestamp-btn"
  287. x-bind="refreshTimestampButton"
  288. title="Refresh current video timestamp"
  289. >
  290. 🔄 Refresh
  291. </button>
  292. </div>
  293. <button
  294. class="copy-wikitext-btn"
  295. x-bind="copyWikitextButton"
  296. title="Copy to clipboard"
  297. >
  298. Copy
  299. </button>
  300. </div>
  301. <div class="wiki-insp-notice" x-bind="wikiInspNotice">
  302. <p>This feature is only available on YouTube video pages (/watch).</p>
  303. </div>
  304. </div>
  305. </div>
  306. <!-- Import view -->
  307. <div class="import-container" x-bind="importContainer">
  308. <div class="import-content">
  309. <div class="import-section">
  310. <textarea
  311. class="import-textarea"
  312. placeholder="Paste your JSON export here..."
  313. x-bind="importTextarea"
  314. ></textarea>
  315. <button
  316. class="import-submit-btn"
  317. x-bind="importSubmitButton"
  318. >
  319. Import
  320. </button>
  321. </div>
  322. </div>
  323. </div>
  324. <!-- Individual playlist view -->
  325. <div class="playlist-view-container" x-bind="playlistViewContainer">
  326. <div class="playlist-full-view">
  327. <template x-for="(video, index) in currentPlaylistVideos" :key="index">
  328. <div
  329. class="video-item"
  330. :title="video.title"
  331. :data-playlist-name="currentPlaylistName"
  332. :data-playlist-index="index"
  333. x-bind="videoItemClass"
  334. >
  335. <a
  336. class="video-title"
  337. :href="video.url"
  338. x-text="video.title"
  339. x-bind="videoPlayLink"
  340. ></a>
  341. <div class="video-actions">
  342. <button
  343. :data-playlist-name="currentPlaylistName"
  344. :data-playlist-index="index"
  345. x-bind="moveUpButton"
  346. class="move-up-btn"
  347. title="Move up"
  348. >
  349. ↑
  350. </button>
  351. <button
  352. :data-playlist-name="currentPlaylistName"
  353. :data-playlist-index="index"
  354. x-bind="moveDownButton"
  355. class="move-down-btn"
  356. title="Move down"
  357. >
  358. ↓
  359. </button>
  360. <div class="more-menu-container">
  361. <button
  362. :data-playlist-name="currentPlaylistName"
  363. :data-playlist-index="index"
  364. x-bind="moreMenuButton"
  365. class="more-btn"
  366. title="More actions"
  367. >
  368. ⋯
  369. </button>
  370. <div
  371. class="more-menu"
  372. :data-playlist-name="currentPlaylistName"
  373. :data-playlist-index="index"
  374. x-bind="moreMenu"
  375. >
  376. <button
  377. :data-playlist-name="currentPlaylistName"
  378. :data-playlist-index="index"
  379. x-bind="moveToTopButton"
  380. class="menu-item move-to-top-item"
  381. >
  382. Move to Top
  383. </button>
  384. <button
  385. :data-playlist-name="currentPlaylistName"
  386. :data-playlist-index="index"
  387. x-bind="moveToBottomButton"
  388. class="menu-item move-to-bottom-item"
  389. >
  390. Move to Bottom
  391. </button>
  392. <button
  393. :data-playlist-name="currentPlaylistName"
  394. :data-playlist-index="index"
  395. x-bind="toggleVideoDoneButton"
  396. class="menu-item done-item"
  397. x-text="video.doneButtonText"
  398. >
  399. </button>
  400. <button
  401. :data-playlist-name="currentPlaylistName"
  402. :data-playlist-index="index"
  403. x-bind="removeVideoButton"
  404. class="menu-item remove-item"
  405. >
  406. Remove
  407. </button>
  408. </div>
  409. </div>
  410. </div>
  411. </div>
  412. </template>
  413. <div x-bind="playlistViewEmptyState" class="empty-playlist">
  414. No videos in this playlist
  415. </div>
  416. </div>
  417. <!-- Add current page button -->
  418. <div class="add-current-page-container">
  419. <button
  420. class="add-current-page-btn"
  421. x-bind="addCurrentPageButton"
  422. x-text="addCurrentPageButtonText"
  423. ></button>
  424. </div>
  425. </div>
  426. <!-- Export/Import/History buttons -->
  427. <div class="export-container" x-bind="exportContainer">
  428. <button class="export-btn" x-bind="exportButton">
  429. Export Playlists
  430. </button>
  431. <button class="import-btn" x-bind="importButton">
  432. Import Playlists
  433. </button>
  434. <button class="history-btn" x-bind="historyButton">
  435. History
  436. </button>
  437. <button class="save-channel-btn" x-bind="saveChannelButton">
  438. Save Channel
  439. </button>
  440. <button class="wiki-insp-btn" x-bind="wikiInspButton">
  441. Wiki/Insp
  442. </button>
  443. </div>
  444. </div>
  445. </body>
  446. </html>