base.html 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  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-primary visually-hidden" id="unTubeSearchBtn" data-bs-toggle="modal" data-bs-target="#unTubeSearchBarResultsModal">
  74. Launches search model
  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="unTubeSearchBar" type="text"
  96. name="search" placeholder="Search UnTube"
  97. hx-post="{% url 'search_UnTube' %}"
  98. hx-trigger="keyup changed delay:500ms"
  99. hx-target="#untube-searchbar-results"
  100. hx-include="[id='searchbar-radio-form']"
  101. hx-indicator=".htmx-indicator" autofocus>
  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>
  201. <!-- for htmx to send csrf_token with every post request -->
  202. document.body.addEventListener('htmx:configRequest', (event) => {
  203. event.detail.headers['X-CSRFToken'] = '{{ csrf_token }}';
  204. })
  205. var clipboard = new ClipboardJS('.copy-btn');
  206. // Get the input field
  207. var input = document.getElementById("unTubeSearchBar");
  208. // Execute a function when the user releases a key on the keyboard
  209. input.addEventListener("click", function(event) {
  210. document.getElementById("unTubeSearchBtn").click();
  211. });
  212. document.getElementById('select-all-btn').onclick = function() {
  213. document.getElementById('select-all-btn').style.display = "none";
  214. document.getElementById('deselect-all-btn').style.display = "block";
  215. var checkboxes = document.getElementsByClassName('video-checkboxes');
  216. for (var checkbox of checkboxes) {
  217. checkbox.checked = true;
  218. }
  219. }
  220. document.getElementById('deselect-all-btn').onclick = function() {
  221. document.getElementById('deselect-all-btn').style.display = "none";
  222. document.getElementById('select-all-btn').style.display = "block";
  223. var checkboxes = document.getElementsByClassName('video-checkboxes');
  224. for (var checkbox of checkboxes) {
  225. checkbox.checked = false;
  226. }
  227. }
  228. function row1_hide() {
  229. document.getElementById("row1").style.display = "none";
  230. 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.
  231. for(var i=0, len=checkboxes.length; i<len; i++)
  232. {
  233. checkboxes[i].style.display = "block";
  234. }
  235. document.getElementById("row2").style.display = "block";
  236. }
  237. function row1_show() {
  238. document.getElementById("row1").style.display = "block";
  239. 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.
  240. for(var i=0, len=checkboxes.length; i<len; i++)
  241. {
  242. checkboxes[i].style.display = "none";
  243. }
  244. document.getElementById("row2").style.display = "none";
  245. }
  246. function select_all_checkboxes(source) {
  247. checkboxes = document.getElementsByClassName('big-checkbox');
  248. for(var i=0, n=checkboxes.length;i<n;i++) {
  249. checkboxes[i].checked = source.checked;
  250. }
  251. }
  252. //Get the button
  253. let mybutton = document.getElementById("btn-back-to-top");
  254. // When the user scrolls down 20px from the top of the document, show the button
  255. window.onscroll = function () {
  256. scrollFunction();
  257. };
  258. function scrollFunction() {
  259. if (
  260. document.body.scrollTop > 550 ||
  261. document.documentElement.scrollTop > 550
  262. ) {
  263. mybutton.style.display = "block";
  264. } else {
  265. mybutton.style.display = "none";
  266. }
  267. }
  268. // When the user clicks on the button, scroll to the top of the document
  269. mybutton.addEventListener("click", backToTop);
  270. function backToTop() {
  271. document.body.scrollTop = 0;
  272. document.documentElement.scrollTop = 0;
  273. }
  274. </script>
  275. <script src="{% static 'htmx/htmx.min.js' %}"></script>
  276. <script src="{% static 'htmx/extensions/class-tools.js' %}"></script>
  277. <script src="{% static 'jquery3.6.0/js/jquery-3.6.0.min.js' %}"></script>
  278. <script src="{% static 'bootstrap5.0.1/js/bootstrap.bundle.js' %}"></script>
  279. <!--
  280. <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>
  281. <script src="https://cdn.jsdelivr.net/npm/feather-icons@4.28.0/dist/feather.min.js" integrity="sha384-uO3SXW5IuS1ZpFPKugNNWqTZRRglnUJK6UAZ/gxOX80nxEkN9NcGZTftn6RzhGWE" crossorigin="anonymous"></script>
  282. <script src="https://cdn.jsdelivr.net/npm/chart.js@2.9.4/dist/Chart.min.js" integrity="sha384-zNy6FEbO50N+Cg5wap8IKA4M/ZnLJgzc6w2NqACZaK0u0FXfOWRRJOnQtpZun8ha" crossorigin="anonymous"></script>
  283. -->
  284. </body>
  285. </html>