base.html 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  1. {% load static %}
  2. <!doctype html>
  3. <html lang="en">
  4. <head>
  5. <meta charset="utf-8">
  6. <meta name="viewport" content="width=device-width, initial-scale=1">
  7. <meta name="description" content="">
  8. <meta name="author" content="Mark Otto, Jacob Thornton, and Bootstrap contributors">
  9. <meta name="generator" content="Hugo 0.83.1">
  10. <title>UnTube</title>
  11. <style type="text/css">
  12. #btn-back-to-top {
  13. position: fixed;
  14. bottom: 20px;
  15. right: 20px;
  16. display: none;
  17. z-index: 4;
  18. }
  19. .big-checkbox {width: 30px; height: 30px;}
  20. </style>
  21. <!--
  22. <script src="https://unpkg.com/htmx.org@1.4.1"></script>
  23. <script src="https://unpkg.com/htmx.org/dist/ext/class-tools.js"></script>
  24. <script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.8/dist/clipboard.min.js"></script>
  25. -->
  26. <script src="{% static 'clipboard.js/clipboard.min.js' %}"></script>
  27. <link href="https://fonts.googleapis.com/css2?family=Fredoka+One&family=Open+Sans&display=swap" rel="stylesheet">
  28. <script src="https://kit.fontawesome.com/5baac7e9b7.js" crossorigin="anonymous"></script>
  29. <!-- Bootstrap core CSS
  30. <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous">
  31. -->
  32. <link href="{% static 'bootstrap5.0.1/css/bootstrap.min.css' %}" rel="stylesheet">
  33. </head>
  34. <body class="bg-dark text-white" style="font-family: 'Fredoka One'">
  35. <nav class="navbar navbar-expand-lg navbar-dark bg-dark sticky-top">
  36. <div class="container-fluid">
  37. <a class="navbar-brand" href="{% url 'home' %}"><h3>UnTube</h3></a>
  38. <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
  39. <span class="navbar-toggler-icon"></span>
  40. </button>
  41. <div class="collapse navbar-collapse" id="navbarSupportedContent">
  42. <ul class="navbar-nav me-auto mb-2 mb-lg-0">
  43. <li class="nav-item">
  44. <a class="nav-link" aria-current="page" href="{% url 'home' %}">Dashboard</a>
  45. </li>
  46. <li class="nav-item">
  47. <a class="nav-link" href="{% url 'all_playlists' 'home' %}">Library</a>
  48. </li>
  49. <li class="nav-item dropdown">
  50. <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
  51. Quick View
  52. </a>
  53. <ul class="dropdown-menu" aria-labelledby="navbarDropdown">
  54. <li><a class="dropdown-item" href="{% url 'all_playlists' 'favorites' %}">Favorites</a></li>
  55. <li><a class="dropdown-item" href="{% url 'all_playlists' 'watching' %}">Watching</a></li>
  56. <li><a class="dropdown-item" href="{% url 'all_playlists' 'plan-to-watch' %}">Plan to Watch</a></li>
  57. <li><a class="dropdown-item" href="{% url 'all_playlists' 'user-owned' %}">Your YT Playlists</a></li>
  58. <li><a class="dropdown-item" href="{% url 'all_playlists' 'imported' %}">Imported</a></li>
  59. <li><hr class="dropdown-divider"></li>
  60. <li><a class="dropdown-item" href="{% url 'all_playlists' 'all' %}">View all</a></li>
  61. </ul>
  62. </li>
  63. <li class="nav-item">
  64. <a class="nav-link" href="{% url 'manage_playlists' %}">Manage</a>
  65. </li>
  66. <li class="nav-item">
  67. <a class="nav-link" data-bs-toggle="offcanvas" href="#offcanvasExample" role="button" aria-controls="offcanvasExample">
  68. Settings </a>
  69. </li>
  70. </ul>
  71. <div class="navbar-nav justify-content-end">
  72. <input class="form-control me-lg-2 bg-dark mb-1" id="unTubeSearchBar" type="text" placeholder="Search UnTube">
  73. <button type="button" class="btn btn-outline-secondary" id="unTubeSearchBtn" data-bs-toggle="modal" data-bs-target="#unTubeSearchBarResultsModal">
  74. <i class="fas fa-search"></i>
  75. </button>
  76. </div>
  77. <a class="btn btn-outline-danger mb-1" href="{% url 'log_out' %}">
  78. Log out
  79. </a>
  80. </div>
  81. </div>
  82. </nav>
  83. <div class="container-fluid">
  84. <div class="row">
  85. <main class="ms-lg-auto px-lg-5">
  86. {% block content %}
  87. {% endblock %}
  88. <!-- Button trigger modal -->
  89. <!-- Modal -->
  90. <div class="modal fade bg-dark" id="unTubeSearchBarResultsModal" tabindex="-1" aria-labelledby="unTubeSearchBarResultsModalLabel" aria-hidden="true">
  91. <div class="modal-dialog modal-xl modal-dialog-scrollable bg-dark">
  92. <div class="modal-content bg-dark">
  93. <div class="modal-body bg-dark">
  94. <div id="untube-searchbar-results">
  95. <input class="form-control me-lg-2 bg-dark text-white" id="unTubeSearchBarModal" type="text"
  96. name="search" placeholder="Search UnTube"
  97. hx-post="{% url 'search_UnTube' %}"
  98. hx-trigger="keyup changed delay:1s"
  99. hx-target="#untube-searchbar-results"
  100. hx-include="[id='searchbar-radio-form']"
  101. hx-indicator=".htmx-indicator">
  102. <br>
  103. <div id="searchbar-radio-form">
  104. <div class="d-flex justify-content-center">
  105. <div class="form-check me-5">
  106. <input class="form-check-input" type="radio" name="search-settings" value="starts-with" id="starts-with-cb" checked>
  107. <label class="form-check-label" for="starts-with-cb">
  108. Starts with
  109. </label>
  110. </div>
  111. <div class="form-check">
  112. <input class="form-check-input" type="radio" name="search-settings" value="contains" id="contains-cb">
  113. <label class="form-check-label" for="contains-cb">
  114. Contains
  115. </label>
  116. </div>
  117. </div>
  118. </div>
  119. </div>
  120. <div id="spinner" class="htmx-indicator d-flex justify-content-center">
  121. <div class="spinner-border text-light" role="status">
  122. </div>
  123. </div>
  124. </div>
  125. </div>
  126. </div>
  127. </div>
  128. </main>
  129. </div>
  130. </div>
  131. <div class="offcanvas offcanvas-end text-white-50" style="background-color: #181A1B" tabindex="-1" id="offcanvasExample" aria-labelledby="offcanvasExampleLabel">
  132. <div class="offcanvas-header text-white">
  133. <h2 class="offcanvas-title" id="offcanvasExampleLabel">Settings</h2>
  134. <button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
  135. </div>
  136. <div class="offcanvas-body">
  137. <div id="settings-status-div" class="text-dark">
  138. </div>
  139. <div id="settings-form">
  140. <div class="mb-3">
  141. <label for="username" class="form-label">Username</label>
  142. <input type="text" class="form-control" name="username" id="username" value="{{ user.username }}">
  143. </div>
  144. <fieldset disabled>
  145. <div class="mb-3">
  146. <label for="email" class="form-label">Email Address</label>
  147. <input type="email" class="form-control" id="email" aria-describedby="emailHelp" value="{{ user.email }}">
  148. <div id="emailHelp" class="form-text">This is the google account you logged in with.</div>
  149. </div>
  150. <div class="mb-3">
  151. <label for="fullname" class="form-label">Full Name</label>
  152. <input type="text" class="form-control" id="fullname" value="{{ user.get_full_name }}">
  153. </div>
  154. <div class="mb-3">
  155. <label for="ytchannelid" class="form-label">YouTube Channel ID</label>
  156. <input type="text" class="form-control" id="ytchannelid" aria-describedby="emailHelp" value="{{ user.profile.yt_channel_id }}">
  157. </div>
  158. <div class="mb-3">
  159. <label for="accesstoken" class="form-label">Access Token</label>
  160. <input type="text" class="form-control" id="accesstoken" value="{{ user.profile.access_token }}">
  161. </div>
  162. <div class="mb-3">
  163. <label for="refreshtoken" class="form-label">Refresh Token</label>
  164. <input type="text" class="form-control" id="refreshtoken" value="{{ user.profile.refresh_token }}">
  165. </div>
  166. <div class="mb-3">
  167. <label for="expiresat" class="form-label">Expires At</label>
  168. <input type="datetime-local" class="form-control" id="expiresat" value="{{ user.profile.expires_at }}">
  169. </div>
  170. </fieldset>
  171. <div class="mb-3 form-check form-switch">
  172. <input class="form-check-input" name="auto refresh playlists" type="checkbox" id="flexSwitchCheckDefault">
  173. <label class="form-check-label" for="flexSwitchCheckDefault">Automatically refresh playlists on visit</label>
  174. </div>
  175. <div class="mb-3 form-check form-switch">
  176. <input class="form-check-input" name="hide videos" type="checkbox" id="flexSwitchCheckChecked" checked>
  177. <label class="form-check-label" for="flexSwitchCheckChecked">Hide deleted/private videos</label>
  178. </div>
  179. <div class="mb-3 form-check form-switch">
  180. <input class="form-check-input" name="confirm before deleting" type="checkbox" id="flexSwitchCheckChecked" checked>
  181. <label class="form-check-label" for="flexSwitchCheckChecked">Confirm before deleting</label>
  182. </div>
  183. </div>
  184. <button type="button" hx-post="{% url 'update_settings' %}" hx-include="[id='settings-form']" hx-target="#settings-status-div" class="btn btn-success">Save</button>
  185. <a class="btn btn-outline-danger" href="{% url 'delete_account' %}">Delete account</a>
  186. <br>
  187. </div>
  188. </div>
  189. <div class="offcanvas offcanvas-start" style="background-color: #181A1B" tabindex="-1" id="offcanvasForVideoNotes" aria-labelledby="offcanvasForVideoNotes">
  190. <div id="video-notes">
  191. </div>
  192. </div>
  193. <button
  194. type="button"
  195. class="btn btn-danger btn-floating btn-lg"
  196. id="btn-back-to-top"
  197. >
  198. </button>
  199. <br>
  200. <script src="{% static 'htmx/htmx.min.js' %}"></script>
  201. <script src="{% static 'htmx/extensions/class-tools.js' %}"></script>
  202. <script src="{% static 'jquery3.6.0/js/jquery-3.6.0.min.js' %}"></script>
  203. <script src="{% static 'bootstrap5.0.1/js/bootstrap.bundle.js' %}"></script>
  204. <script>
  205. <!-- for htmx to send csrf_token with every post request -->
  206. document.body.addEventListener('htmx:configRequest', (event) => {
  207. event.detail.headers['X-CSRFToken'] = '{{ csrf_token }}';
  208. })
  209. var clipboard = new ClipboardJS('.copy-btn');
  210. <!-- for view_playlist.html -->
  211. var moveCopyBtn = document.getElementById('move-copy-vids-btn');
  212. var moveCopyCollapse = document.getElementById('moveItemsToCollapse');
  213. var bsMoveCopyCollapse = new bootstrap.Collapse(moveCopyCollapse, {
  214. toggle: false
  215. });
  216. var deleteBtn = document.getElementById('delete-vids-btn');
  217. var deleteCollapse = document.getElementById('deleteItemsCollapse');
  218. var bsDeleteCollapse = new bootstrap.Collapse(deleteCollapse, {
  219. toggle: false
  220. });
  221. document.getElementById('manageBtn').addEventListener('click', function () {
  222. bsMoveCopyCollapse.hide();
  223. bsDeleteCollapse.hide();
  224. });
  225. moveCopyCollapse.addEventListener('show.bs.collapse', function () {
  226. moveCopyBtn.classList = "btn btn-success";
  227. bsDeleteCollapse.hide();
  228. });
  229. moveCopyCollapse.addEventListener('hide.bs.collapse', function () {
  230. moveCopyBtn.classList = "btn btn-outline-success";
  231. });
  232. deleteCollapse.addEventListener('show.bs.collapse', function () {
  233. deleteBtn.classList = "btn btn-danger";
  234. bsMoveCopyCollapse.hide();
  235. });
  236. deleteCollapse.addEventListener('hide.bs.collapse', function () {
  237. deleteBtn.classList = "btn btn-outline-danger";
  238. });
  239. <!-- end -->
  240. // Get the input field
  241. var input = document.getElementById("unTubeSearchBar");
  242. // Execute a function when the user releases a key on the keyboard
  243. input.addEventListener("click", function(event) {
  244. document.getElementById("unTubeSearchBtn").click();
  245. document.getElementById("unTubeSearchBarModal").focus();
  246. });
  247. document.getElementById('select-all-btn').onclick = function() {
  248. document.getElementById('select-all-btn').style.display = "none";
  249. document.getElementById('deselect-all-btn').style.display = "block";
  250. var checkboxes = document.getElementsByClassName('video-checkboxes');
  251. for (var checkbox of checkboxes) {
  252. checkbox.checked = true;
  253. }
  254. }
  255. document.getElementById('deselect-all-btn').onclick = function() {
  256. document.getElementById('deselect-all-btn').style.display = "none";
  257. document.getElementById('select-all-btn').style.display = "block";
  258. var checkboxes = document.getElementsByClassName('video-checkboxes');
  259. for (var checkbox of checkboxes) {
  260. checkbox.checked = false;
  261. }
  262. }
  263. function row1_hide() {
  264. document.getElementById("row1").style.display = "none";
  265. var checkboxes = document.getElementsByClassName('video-checkboxes'); //Cache the collection here, so that even a new element added with the same class later we can avoid querying this again by using the cached collection.
  266. for(var i=0, len=checkboxes.length; i<len; i++)
  267. {
  268. checkboxes[i].style.display = "block";
  269. }
  270. document.getElementById("row2").style.display = "block";
  271. }
  272. function row1_show() {
  273. document.getElementById("row1").style.display = "block";
  274. var checkboxes = document.getElementsByClassName('video-checkboxes'); //Cache the collection here, so that even a new element added with the same class later we can avoid querying this again by using the cached collection.
  275. for(var i=0, len=checkboxes.length; i<len; i++)
  276. {
  277. checkboxes[i].style.display = "none";
  278. }
  279. document.getElementById("row2").style.display = "none";
  280. }
  281. function select_all_checkboxes(source) {
  282. checkboxes = document.getElementsByClassName('big-checkbox');
  283. for(var i=0, n=checkboxes.length;i<n;i++) {
  284. checkboxes[i].checked = source.checked;
  285. }
  286. }
  287. //Get the button
  288. let mybutton = document.getElementById("btn-back-to-top");
  289. // When the user scrolls down 20px from the top of the document, show the button
  290. window.onscroll = function () {
  291. scrollFunction();
  292. };
  293. function scrollFunction() {
  294. if (
  295. document.body.scrollTop > 550 ||
  296. document.documentElement.scrollTop > 550
  297. ) {
  298. mybutton.style.display = "block";
  299. } else {
  300. mybutton.style.display = "none";
  301. }
  302. }
  303. // When the user clicks on the button, scroll to the top of the document
  304. mybutton.addEventListener("click", backToTop);
  305. function backToTop() {
  306. document.body.scrollTop = 0;
  307. document.documentElement.scrollTop = 0;
  308. }
  309. </script>
  310. <!--
  311. <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-gtEjrD/SeCtmISkJkNUaaKMoLD0//ElJ19smozuHV6z3Iehds+3Ulb9Bn9Plx0x4" crossorigin="anonymous"></script>
  312. <script src="https://cdn.jsdelivr.net/npm/feather-icons@4.28.0/dist/feather.min.js" integrity="sha384-uO3SXW5IuS1ZpFPKugNNWqTZRRglnUJK6UAZ/gxOX80nxEkN9NcGZTftn6RzhGWE" crossorigin="anonymous"></script>
  313. <script src="https://cdn.jsdelivr.net/npm/chart.js@2.9.4/dist/Chart.min.js" integrity="sha384-zNy6FEbO50N+Cg5wap8IKA4M/ZnLJgzc6w2NqACZaK0u0FXfOWRRJOnQtpZun8ha" crossorigin="anonymous"></script>
  314. -->
  315. </body>
  316. </html>