mirror of
https://gitlab.science.ru.nl/technicie/MarietjeDjango.git
synced 2025-12-09 18:42:21 +01:00
Save number of songs in the search table to a cookie.
This commit is contained in:
2
marietje/marietje/static/js/js.cookie-2.1.3.min.js
vendored
Normal file
2
marietje/marietje/static/js/js.cookie-2.1.3.min.js
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
/*! js-cookie v2.1.3 | MIT */
|
||||
!function(a){var b=!1;if("function"==typeof define&&define.amd&&(define(a),b=!0),"object"==typeof exports&&(module.exports=a(),b=!0),!b){var c=window.Cookies,d=window.Cookies=a();d.noConflict=function(){return window.Cookies=c,d}}}(function(){function a(){for(var a=0,b={};a<arguments.length;a++){var c=arguments[a];for(var d in c)b[d]=c[d]}return b}function b(c){function d(b,e,f){var g;if("undefined"!=typeof document){if(arguments.length>1){if(f=a({path:"/"},d.defaults,f),"number"==typeof f.expires){var h=new Date;h.setMilliseconds(h.getMilliseconds()+864e5*f.expires),f.expires=h}try{g=JSON.stringify(e),/^[\{\[]/.test(g)&&(e=g)}catch(i){}return e=c.write?c.write(e,b):encodeURIComponent(e+"").replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),b=encodeURIComponent(b+""),b=b.replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent),b=b.replace(/[\(\)]/g,escape),document.cookie=b+"="+e+(f.expires?"; expires="+f.expires.toUTCString():"")+(f.path?"; path="+f.path:"")+(f.domain?"; domain="+f.domain:"")+(f.secure?"; secure":"")}b||(g={});for(var j=document.cookie?document.cookie.split("; "):[],k=/(%[0-9A-Z]{2})+/g,l=0;l<j.length;l++){var m=j[l].split("="),n=m.slice(1).join("=");'"'===n.charAt(0)&&(n=n.slice(1,-1));try{var o=m[0].replace(k,decodeURIComponent);if(n=c.read?c.read(n,o):c(n,o)||n.replace(k,decodeURIComponent),this.json)try{n=JSON.parse(n)}catch(i){}if(b===o){g=n;break}b||(g[o]=n)}catch(i){}}return g}}return d.set=d,d.get=function(a){return d.call(d,a)},d.getJSON=function(){return d.apply({json:!0},[].slice.call(arguments))},d.defaults={},d.remove=function(b,c){d(b,"",a(c,{expires:-1}))},d.withConverter=b,d}return b(function(){})});
|
||||
@ -1,15 +1,22 @@
|
||||
$(function () {
|
||||
$('.pagesize').val(Cookies.get('pagesize'));
|
||||
$(document).on('click', '[data-song-id]', function () {
|
||||
var songId = $(this).data('song-id');
|
||||
window.location.href = "/songs/edit/" + songId;
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.pagenum').change(function(){
|
||||
getSongs();
|
||||
});
|
||||
|
||||
$('#search-artist, #search-title, #search-uploader, .pagenum').change(function(){
|
||||
$('#search-artist, #search-title, #search-uploader').change(function(){
|
||||
$('.pagenum').val(1);
|
||||
getSongs();
|
||||
});
|
||||
|
||||
$('.pagesize').change(function(){
|
||||
Cookies.set('pagesize', $(this).val());
|
||||
$('.pagenum').val(1);
|
||||
getSongs();
|
||||
});
|
||||
|
||||
@ -10,6 +10,7 @@ var iteration = 0;
|
||||
var requestViewOpen = false;
|
||||
|
||||
$(function () {
|
||||
$('.pagesize').val(Cookies.get('pagesize'));
|
||||
refreshQueue();
|
||||
setInterval(updateTime, 1000);
|
||||
|
||||
@ -38,14 +39,16 @@ $(function () {
|
||||
});
|
||||
|
||||
$('.pagenum').change(function(){
|
||||
console.log('Page: ' + $(this).val());
|
||||
});
|
||||
|
||||
$('#search-all, #search-uploader, .pagenum').change(function(){
|
||||
getSongs();
|
||||
});
|
||||
|
||||
$('#search-all, #search-uploader').change(function(){
|
||||
$('.pagenum').val(1);
|
||||
getSongs();
|
||||
});
|
||||
|
||||
$('.pagesize').change(function(){
|
||||
Cookies.set('pagesize', $(this).val());
|
||||
$('.pagenum').val(1);
|
||||
getSongs();
|
||||
});
|
||||
|
||||
@ -90,6 +90,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="{% static 'js/js.cookie-2.1.3.min.js' %}"></script>
|
||||
<script type="text/javascript" src="{% static 'js/queue.js' %}"></script>
|
||||
<script type="text/javascript">
|
||||
var csrf_token = "{{ csrf_token }}";
|
||||
|
||||
@ -39,6 +39,7 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<script type="text/javascript" src="{% static 'js/js.cookie-2.1.3.min.js' %}"></script>
|
||||
<script type="text/javascript" src="{% static 'js/manage.js' %}"></script>
|
||||
<script type="text/javascript">
|
||||
var csrf_token = "{{ csrf_token }}";
|
||||
|
||||
Reference in New Issue
Block a user