base.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. {% load static %}
  2. {% with domain="http://127.0.0.1:8000/" %}
  3. <!doctype html>
  4. <html lang="en">
  5. <head>
  6. <link rel="icon" href="{% static 'fontawesome-free-5.15.3-web/svgs/solid/underline.svg' %}">
  7. <meta charset="utf-8">
  8. <meta name="keywords" content="youtube, playlists, videos, delete videos, delete playlists, delete multiple videos, move multiple videos, merge playlists, video manager, playlist manager, youtube playlists, untube, google">
  9. <meta name="viewport" content="width=device-width, initial-scale=1">
  10. <meta name="description" content="UnTube is a simple Youtube playlist manager. Modify and keep track of your YouTube playlists with ease.">
  11. <meta name="author" content="Mohammed Abu Bakar Khan">
  12. <title>UnTube - A Youtube Playlist Manager</title>
  13. <style type="text/css">
  14. body {
  15. background: linear-gradient(-45deg, #e2b968, #68af5b, #8a97bc, #d69ab2);
  16. //background: linear-gradient(-45deg, #B2A3FF, #84bcf3, #AE876B, #B0E7AE);
  17. //background: linear-gradient(-45deg, #0645a4, #2480cd, #84bcf3, #b7d6f7);
  18. //background: linear-gradient(-45deg, #AE876B, #ABA27B, #A7BC8A, #A3D69A);
  19. background-size: 400% 400%;
  20. animation: gradient 10s ease infinite;
  21. }
  22. @keyframes gradient {
  23. 0% {
  24. background-position: 0% 50%;
  25. }
  26. 50% {
  27. background-position: 100% 50%;
  28. }
  29. 100% {
  30. background-position: 0% 50%;
  31. }
  32. }
  33. #btn-back-to-top {
  34. position: fixed;
  35. bottom: 20px;
  36. right: 20px;
  37. display: none;
  38. }
  39. .big-checkbox {width: 30px; height: 30px;}
  40. </style>
  41. <link href="https://fonts.googleapis.com/css2?family=Fredoka+One&family=Open+Sans&display=swap" rel="stylesheet">
  42. <link href="{% static 'fontawesome-free-5.15.3-web/css/all.min.css' %}" rel="stylesheet">
  43. <link href="{% static 'bootstrap5.0.1/css/bootstrap.min.css' %}" rel="stylesheet">
  44. <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/bbbootstrap/libraries@main/choices.min.css">
  45. </head>
  46. <body class="text-dark" style="font-family: 'Fredoka One', monospace; filter: contrast(80%);">
  47. {% if user.profile.show_import_page %}
  48. <meta http-equiv="refresh" content="0;url={{ domain }}import/init" />
  49. {% endif %}
  50. <nav class="navbar navbar-expand-lg navbar-light" id="navbar">
  51. <div class="container-fluid">
  52. <a class="navbar-brand" href="{% url 'home' %}"><h3><kbd>UnTube</kbd></h3></a>
  53. <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
  54. <span class="navbar-toggler-icon"></span>
  55. </button>
  56. <div class="collapse navbar-collapse" id="navbarSupportedContent">
  57. <ul class="navbar-nav me-auto mb-2 mb-lg-0">
  58. <li class="nav-item">
  59. <a class="nav-link" aria-current="page" href="{% url 'home' %}">Dashboard</a>
  60. </li>
  61. <li class="nav-item dropdown">
  62. <a class="nav-link dropdown-toggle" href="#" id="libraryDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
  63. Library
  64. </a>
  65. <ul class="dropdown-menu" aria-labelledby="libraryDropdown" style="z-index: 1021;">
  66. <li><a class="dropdown-item" href="{% url 'all_playlists' 'home' %}">Playlists</a></li>
  67. <li><a class="dropdown-item" href="{% url 'all_videos' 'home' %}">Videos</a></li>
  68. </ul>
  69. </li>
  70. <li class="nav-item dropdown">
  71. <a class="nav-link dropdown-toggle" href="#" id="quickViewDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
  72. Quick View
  73. </a>
  74. <ul class="dropdown-menu" aria-labelledby="quickViewDropdown" style="z-index: 1021;">
  75. <li><a class="dropdown-item" href="{% url 'all_playlists' 'favorites' %}">Favorites</a></li>
  76. <li><a class="dropdown-item" href="{% url 'all_playlists' 'watching' %}">Watching</a></li>
  77. <li><a class="dropdown-item" href="{% url 'all_playlists' 'plan-to-watch' %}">Plan to Watch</a></li>
  78. <li><a class="dropdown-item" href="{% url 'all_playlists' 'user-owned' %}">Your YT Playlists</a></li>
  79. <li><a class="dropdown-item" href="{% url 'all_playlists' 'imported' %}">Imported</a></li>
  80. <li><hr class="dropdown-divider"></li>
  81. <li><a class="dropdown-item" href="{% url 'all_playlists' 'all' %}">View all</a></li>
  82. </ul>
  83. </li>
  84. <li class="nav-item">
  85. <a class="nav-link" href="{% url 'manage_playlists' %}">Manage</a>
  86. </li>
  87. <!--
  88. <li class="nav-item">
  89. <a class="nav-link" href="{% url 'settings' %}">Settings</a>
  90. </li>
  91. -->
  92. </ul>
  93. <div class="navbar-nav justify-content-end">
  94. <!--
  95. <input class="form-control border border-secondary bg-dark text-white-50 me-lg-2 bg-dark mb-1" id="unTubeSearchBar" type="text" placeholder="Search UnTube">
  96. -->
  97. <a class="nav-link btn-lg me-1 mt-1" href="{% url 'search' %}" {% if user.profile.open_search_new_tab %}target="_blank"{% endif %}>
  98. <i class="fas fa-search"></i>
  99. </a>
  100. <a href="{% url 'profile' %}" class="mt-1">
  101. <img src="https://robohash.org/{{ user.username }}.png?set=set{{ user.profile.robohash_set }}" alt="{{ user.username }}" class="border border-3 border-primary rounded-circle me-2" width="42" height="42">
  102. </a>
  103. </div>
  104. <a class="btn btn-outline-danger" href="{% url 'log_out' %}">
  105. Log out
  106. </a>
  107. </div>
  108. </div>
  109. </nav>
  110. <div class="container-fluid text-dark">
  111. <div class="row">
  112. <main class="ms-lg-auto px-lg-5">
  113. {% if messages %}
  114. {% for message in messages %}
  115. <div class="alert alert-success alert-dismissible fade show" role="alert">
  116. {{ message }}
  117. <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
  118. </div>
  119. {% endfor %}
  120. {% endif %}
  121. {% block content %}
  122. {% endblock %}
  123. </main>
  124. </div>
  125. </div>
  126. <br>
  127. <script src="{% static 'htmx/htmx.min.js' %}" type="application/javascript"></script>
  128. <script src="{% static 'clipboard.js/clipboard.min.js' %}" type="application/javascript"></script>
  129. <script src="{% static 'jquery3.6.0/js/jquery-3.6.0.min.js' %}" type="application/javascript"></script>
  130. <script src="{% static 'bootstrap5.0.1/js/bootstrap.bundle.min.js' %}" type="application/javascript"></script>
  131. <script src="https://cdn.jsdelivr.net/gh/bbbootstrap/libraries@main/choices.min.js"></script>
  132. <!-- <script src="{% static 'htmx/extensions/class-tools.js' %}" type="application/javascript"></script> -->
  133. <script type="application/javascript">
  134. $(document).ready(function(){
  135. var multipleCancelButton = new Choices('#choices-multiple-remove-button', {
  136. removeItemButton: true,
  137. });
  138. });
  139. function selectVideo(video) {
  140. console.log(video.id);
  141. console.log("video-" + video.id);
  142. var videoCB = document.getElementById("video-" + video.id);
  143. videoCB.checked = !videoCB.checked; // uncheck video if check and vice versa
  144. }
  145. function triggerSubmit() {
  146. var startsWithCB = document.getElementById("starts-with-cb");
  147. var containsCB = document.getElementById("contains-cb");
  148. if (startsWithCB.checked) {
  149. startsWithCB.click();
  150. } else {
  151. containsCB.click();
  152. }
  153. }
  154. document.body.addEventListener('htmx:configRequest', (event) => {
  155. event.detail.headers['X-CSRFToken'] = '{{ csrf_token }}';
  156. })
  157. // window.onbeforeunload = function() {
  158. //return "Dude, are you sure you want to leave? Think of the kittens!";
  159. //}
  160. var moveCopyBtn = document.getElementById('move-copy-vids-btn');
  161. var moveCopyCollapse = document.getElementById('moveItemsToCollapse');
  162. var bsMoveCopyCollapse = new bootstrap.Collapse(moveCopyCollapse, {
  163. toggle: false
  164. });
  165. var deleteBtn = document.getElementById('delete-vids-btn');
  166. var deleteCollapse = document.getElementById('deleteItemsCollapse');
  167. var bsDeleteCollapse = new bootstrap.Collapse(deleteCollapse, {
  168. toggle: false
  169. });
  170. document.getElementById('manageBtn').addEventListener('click', function () { document.getElementById("delete-videos-confirm-box").innerHTML = "";
  171. document.getElementById("delete-videos-confirm-box").innerHTML = "";
  172. bsMoveCopyCollapse.hide();
  173. bsDeleteCollapse.hide();
  174. });
  175. moveCopyCollapse.addEventListener('show.bs.collapse', function () {
  176. bsDeleteCollapse.hide();
  177. });
  178. deleteCollapse.addEventListener('show.bs.collapse', function () {
  179. bsMoveCopyCollapse.hide();
  180. });
  181. <!-- end -->
  182. document.getElementById('select-all-btn').onclick = function() {
  183. document.getElementById('select-all-btn').style.display = "none";
  184. document.getElementById('deselect-all-btn').style.display = "block";
  185. var checkboxes = document.getElementsByClassName('video-checkboxes');
  186. for (var checkbox of checkboxes) {
  187. checkbox.checked = true;
  188. }
  189. }
  190. document.getElementById('deselect-all-btn').onclick = function() {
  191. document.getElementById('deselect-all-btn').style.display = "none";
  192. document.getElementById('select-all-btn').style.display = "block";
  193. var checkboxes = document.getElementsByClassName('video-checkboxes');
  194. for (var checkbox of checkboxes) {
  195. checkbox.checked = false;
  196. }
  197. }
  198. function row1_hide() {
  199. document.getElementById("row1").style.display = "none";
  200. 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.
  201. for(var i=0, len=checkboxes.length; i<len; i++)
  202. {
  203. checkboxes[i].style.display = "block";
  204. checkboxes[i].checked = false;
  205. }
  206. document.getElementById("row2").style.display = "block";
  207. }
  208. function row1_show() {
  209. document.getElementById("row1").style.display = "block";
  210. 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.
  211. for(var i=0, len=checkboxes.length; i<len; i++)
  212. {
  213. checkboxes[i].style.display = "none";
  214. }
  215. document.getElementById("row2").style.display = "none";
  216. }
  217. function select_all_checkboxes(source) {
  218. checkboxes = document.getElementsByClassName('big-checkbox');
  219. for(var i=0, n=checkboxes.length;i<n;i++) {
  220. checkboxes[i].checked = source.checked;
  221. }
  222. }
  223. var clipboard = new ClipboardJS('.copy-btn');
  224. //Get the button
  225. let mybutton = document.getElementById("btn-back-to-top");
  226. // When the user scrolls down 20px from the top of the document, show the button
  227. window.onscroll = function () {
  228. scrollFunction();
  229. };
  230. function scrollFunction() {
  231. if (
  232. document.body.scrollTop > 150 ||
  233. document.documentElement.scrollTop > 150
  234. ) {
  235. mybutton.style.display = "block";
  236. } else {
  237. mybutton.style.display = "none";
  238. }
  239. }
  240. // When the user clicks on the button, scroll to the top of the document
  241. mybutton.addEventListener("click", backToTop);
  242. function backToTop() {
  243. document.body.scrollTop = 0;
  244. document.documentElement.scrollTop = 0;
  245. }
  246. </script>
  247. <!--
  248. <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>
  249. <script src="https://cdn.jsdelivr.net/npm/feather-icons@4.28.0/dist/feather.min.js" integrity="sha384-uO3SXW5IuS1ZpFPKugNNWqTZRRglnUJK6UAZ/gxOX80nxEkN9NcGZTftn6RzhGWE" crossorigin="anonymous"></script>
  250. <script src="https://cdn.jsdelivr.net/npm/chart.js@2.9.4/dist/Chart.min.js" integrity="sha384-zNy6FEbO50N+Cg5wap8IKA4M/ZnLJgzc6w2NqACZaK0u0FXfOWRRJOnQtpZun8ha" crossorigin="anonymous"></script>
  251. -->
  252. </body>
  253. </html>
  254. {% endwith %}