popup.html 14 KB

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