base.html 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  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' 'watching' %}">On Hold</a></li>
  57. <li><a class="dropdown-item" href="{% url 'all_playlists' 'watching' %}">YouTube</a></li>
  58. <li><a class="dropdown-item" href="{% url 'all_playlists' 'watching' %}">UnTube</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 'all_playlists' 'home' %}">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. <!--
  86. <nav class="col-md-3 ms-sm-auto col-lg-2 px-md-4">
  87. <div class="position-sticky pt-3">
  88. <ul class="nav flex-column">
  89. <li class="nav-item">
  90. <a class="nav-link" href="{% url 'all_playlists' 'home' %}">
  91. Library
  92. </a>
  93. </li>
  94. <li class="nav-item">
  95. <a class="nav-link active" aria-current="page" href="#">
  96. Add a playlist
  97. </a>
  98. </li>
  99. <li class="nav-item">
  100. <a class="nav-link" href="#">
  101. Create a playlist
  102. </a>
  103. </li>
  104. </ul>
  105. <h6 class="sidebar-heading d-flex justify-content-between align-items-center px-3 mt-4 mb-1">
  106. <span>Top 3 Playlists</span>
  107. <a class="link-secondary" href="#collapseExample" aria-label="Add a new report" data-bs-toggle="collapse" role="button" aria-expanded="false" aria-controls="collapseExample">
  108. </a>
  109. </h6>
  110. <ul class="nav flex-column mb-2">
  111. <li class="nav-item">
  112. {% for pl in user_playlists|slice:"0:3" %}
  113. <a class="nav-link" href="{% url 'playlist' pl.playlist_id %}">
  114. {{ pl.name }}
  115. </a>
  116. {% if forloop.last %}
  117. {% endif %}
  118. {% empty %}
  119. <span class="nav-link link-secondary">
  120. None
  121. </span>
  122. {% endfor %}
  123. </li>
  124. </ul>
  125. <h6 class="sidebar-heading d-flex justify-content-between align-items-center px-3 mt-4 mb-1">
  126. <span>Watching</span>
  127. </h6>
  128. <ul class="nav flex-column mb-2">
  129. <li class="nav-item">
  130. {% for pl in playlist_watching|slice:"0:3" %}
  131. <a class="nav-link" href="{% url 'playlist' pl.playlist_id %}">
  132. <span data-feather="file-text"></span>
  133. {{ pl.name }}
  134. </a>
  135. {% empty %}
  136. <span class="nav-link link-secondary">
  137. None. Add some!
  138. </span>
  139. {% endfor %}
  140. </li>
  141. </ul>
  142. <h6 class="sidebar-heading d-flex justify-content-between align-items-center px-3 mt-4 mb-1">
  143. <span>Logged in as <b>{{ user.username }}</b></span>
  144. </h6>
  145. </div>
  146. </nav>
  147. -->
  148. <!-- <main class="col-md-9 ms-sm-auto col-lg-10 px-md-4">-->
  149. <main class="ms-lg-auto px-lg-5">
  150. {% block content %}
  151. {% endblock %}
  152. <!-- Button trigger modal -->
  153. <!-- Modal -->
  154. <div class="modal fade bg-dark" id="unTubeSearchBarResultsModal" tabindex="-1" aria-labelledby="unTubeSearchBarResultsModalLabel" aria-hidden="true">
  155. <div class="modal-dialog modal-xl modal-dialog-scrollable bg-dark">
  156. <div class="modal-content bg-dark">
  157. <div class="modal-body bg-dark">
  158. <div id="untube-searchbar-results">
  159. <input class="form-control me-lg-2 bg-dark text-white" id="unTubeSearchBar" type="text"
  160. name="search" placeholder="Search UnTube"
  161. hx-post="{% url 'search_UnTube' %}"
  162. hx-trigger="keyup changed delay:500ms"
  163. hx-target="#untube-searchbar-results"
  164. hx-include="[id='searchbar-radio-form']"
  165. hx-indicator=".htmx-indicator" autofocus>
  166. <br>
  167. <div id="searchbar-radio-form">
  168. <div class="d-flex justify-content-center">
  169. <div class="form-check me-5">
  170. <input class="form-check-input" type="radio" name="search-settings" value="starts-with" id="starts-with-cb" checked>
  171. <label class="form-check-label" for="starts-with-cb">
  172. Starts with
  173. </label>
  174. </div>
  175. <div class="form-check">
  176. <input class="form-check-input" type="radio" name="search-settings" value="contains" id="contains-cb">
  177. <label class="form-check-label" for="contains-cb">
  178. Contains
  179. </label>
  180. </div>
  181. </div>
  182. </div>
  183. </div>
  184. </div>
  185. </div>
  186. </div>
  187. </div>
  188. </main>
  189. </div>
  190. </div>
  191. <div class="offcanvas offcanvas-end text-white-50" style="background-color: #181A1B" tabindex="-1" id="offcanvasExample" aria-labelledby="offcanvasExampleLabel">
  192. <div class="offcanvas-header text-white">
  193. <h2 class="offcanvas-title" id="offcanvasExampleLabel">Settings</h2>
  194. <button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
  195. </div>
  196. <div class="offcanvas-body">
  197. <div id="settings-status-div" class="text-dark">
  198. </div>
  199. <div id="settings-form">
  200. <div class="mb-3">
  201. <label for="username" class="form-label">Username</label>
  202. <input type="text" class="form-control" name="username" id="username" value="{{ user.username }}">
  203. </div>
  204. <fieldset disabled>
  205. <div class="mb-3">
  206. <label for="email" class="form-label">Email Address</label>
  207. <input type="email" class="form-control" id="email" aria-describedby="emailHelp" value="{{ user.email }}">
  208. <div id="emailHelp" class="form-text">This is the google account you logged in with.</div>
  209. </div>
  210. <div class="mb-3">
  211. <label for="fullname" class="form-label">Full Name</label>
  212. <input type="text" class="form-control" id="fullname" value="{{ user.get_full_name }}">
  213. </div>
  214. <div class="mb-3">
  215. <label for="ytchannelid" class="form-label">YouTube Channel ID</label>
  216. <input type="text" class="form-control" id="ytchannelid" aria-describedby="emailHelp" value="{{ user.profile.yt_channel_id }}">
  217. </div>
  218. <div class="mb-3">
  219. <label for="accesstoken" class="form-label">Access Token</label>
  220. <input type="text" class="form-control" id="accesstoken" value="{{ user.profile.access_token }}">
  221. </div>
  222. <div class="mb-3">
  223. <label for="refreshtoken" class="form-label">Refresh Token</label>
  224. <input type="text" class="form-control" id="refreshtoken" value="{{ user.profile.refresh_token }}">
  225. </div>
  226. <div class="mb-3">
  227. <label for="expiresat" class="form-label">Expires At</label>
  228. <input type="datetime-local" class="form-control" id="expiresat" value="{{ user.profile.expires_at }}">
  229. </div>
  230. </fieldset>
  231. <div class="mb-3 form-check form-switch">
  232. <input class="form-check-input" name="auto refresh playlists" type="checkbox" id="flexSwitchCheckDefault">
  233. <label class="form-check-label" for="flexSwitchCheckDefault">Automatically refresh playlists on visit</label>
  234. </div>
  235. <div class="mb-3 form-check form-switch">
  236. <input class="form-check-input" name="hide videos" type="checkbox" id="flexSwitchCheckChecked" checked>
  237. <label class="form-check-label" for="flexSwitchCheckChecked">Hide deleted/private videos</label>
  238. </div>
  239. <div class="mb-3 form-check form-switch">
  240. <input class="form-check-input" name="confirm before deleting" type="checkbox" id="flexSwitchCheckChecked" checked>
  241. <label class="form-check-label" for="flexSwitchCheckChecked">Confirm before deleting</label>
  242. </div>
  243. </div>
  244. <button type="button" hx-post="{% url 'update_settings' %}" hx-include="[id='settings-form']" hx-target="#settings-status-div" class="btn btn-success">Save</button>
  245. <a class="btn btn-outline-danger" href="{% url 'delete_account' %}">Delete account</a>
  246. <br>
  247. </div>
  248. </div>
  249. <div class="offcanvas offcanvas-start" style="background-color: #181A1B" tabindex="-1" id="offcanvasForVideoNotes" aria-labelledby="offcanvasForVideoNotes">
  250. <div id="video-notes">
  251. </div>
  252. </div>
  253. <button
  254. type="button"
  255. class="btn btn-danger btn-floating btn-lg"
  256. id="btn-back-to-top"
  257. >
  258. </button>
  259. <br>
  260. <script>
  261. <!-- for htmx to send csrf_token with every post request -->
  262. document.body.addEventListener('htmx:configRequest', (event) => {
  263. event.detail.headers['X-CSRFToken'] = '{{ csrf_token }}';
  264. })
  265. var clipboard = new ClipboardJS('.copy-btn');
  266. // Get the input field
  267. var input = document.getElementById("unTubeSearchBar");
  268. // Execute a function when the user releases a key on the keyboard
  269. input.addEventListener("click", function(event) {
  270. document.getElementById("unTubeSearchBtn").click();
  271. });
  272. document.getElementById('select-all-btn').onclick = function() {
  273. document.getElementById('select-all-btn').style.display = "none";
  274. document.getElementById('deselect-all-btn').style.display = "block";
  275. var checkboxes = document.getElementsByClassName('video-checkboxes');
  276. for (var checkbox of checkboxes) {
  277. checkbox.checked = true;
  278. }
  279. }
  280. document.getElementById('deselect-all-btn').onclick = function() {
  281. document.getElementById('deselect-all-btn').style.display = "none";
  282. document.getElementById('select-all-btn').style.display = "block";
  283. var checkboxes = document.getElementsByClassName('video-checkboxes');
  284. for (var checkbox of checkboxes) {
  285. checkbox.checked = false;
  286. }
  287. }
  288. function row1_hide() {
  289. document.getElementById("row1").style.display = "none";
  290. 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.
  291. for(var i=0, len=checkboxes.length; i<len; i++)
  292. {
  293. checkboxes[i].style.display = "block";
  294. }
  295. document.getElementById("row2").style.display = "block";
  296. }
  297. function row1_show() {
  298. document.getElementById("row1").style.display = "block";
  299. 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.
  300. for(var i=0, len=checkboxes.length; i<len; i++)
  301. {
  302. checkboxes[i].style.display = "none";
  303. }
  304. document.getElementById("row2").style.display = "none";
  305. }
  306. function select_all_checkboxes(source) {
  307. checkboxes = document.getElementsByClassName('big-checkbox');
  308. for(var i=0, n=checkboxes.length;i<n;i++) {
  309. checkboxes[i].checked = source.checked;
  310. }
  311. }
  312. //Get the button
  313. let mybutton = document.getElementById("btn-back-to-top");
  314. // When the user scrolls down 20px from the top of the document, show the button
  315. window.onscroll = function () {
  316. scrollFunction();
  317. };
  318. function scrollFunction() {
  319. if (
  320. document.body.scrollTop > 550 ||
  321. document.documentElement.scrollTop > 550
  322. ) {
  323. mybutton.style.display = "block";
  324. } else {
  325. mybutton.style.display = "none";
  326. }
  327. }
  328. // When the user clicks on the button, scroll to the top of the document
  329. mybutton.addEventListener("click", backToTop);
  330. function backToTop() {
  331. document.body.scrollTop = 0;
  332. document.documentElement.scrollTop = 0;
  333. }
  334. </script>
  335. <script src="{% static 'htmx/htmx.min.js' %}"></script>
  336. <script src="{% static 'htmx/extensions/class-tools.js' %}"></script>
  337. <script src="{% static 'jquery3.6.0/js/jquery-3.6.0.min.js' %}"></script>
  338. <script src="{% static 'bootstrap5.0.1/js/bootstrap.bundle.js' %}"></script>
  339. <!--
  340. <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>
  341. <script src="https://cdn.jsdelivr.net/npm/feather-icons@4.28.0/dist/feather.min.js" integrity="sha384-uO3SXW5IuS1ZpFPKugNNWqTZRRglnUJK6UAZ/gxOX80nxEkN9NcGZTftn6RzhGWE" crossorigin="anonymous"></script>
  342. <script src="https://cdn.jsdelivr.net/npm/chart.js@2.9.4/dist/Chart.min.js" integrity="sha384-zNy6FEbO50N+Cg5wap8IKA4M/ZnLJgzc6w2NqACZaK0u0FXfOWRRJOnQtpZun8ha" crossorigin="anonymous"></script>
  343. -->
  344. </body>
  345. </html>