ニジカもんすたぁ!! トップ・ページ https://nizika.monster
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

56 lines
1.1 KiB

  1. class
  2. Script
  3. {
  4. static
  5. main ()
  6. {
  7. $ ('#filter-date-start').datepicker ();
  8. $ ('#filter-date-end').datepicker ();
  9. const url = new URL (window.location.href);
  10. const orderAsc = document.getElementById ('order-asc');
  11. const filterKeyword = document.getElementById ('filter-keyword');
  12. const btnFilter = document.getElementById ('btn-filter');
  13. const filter = (
  14. function (e)
  15. {
  16. url.searchParams.delete ('p');
  17. url.searchParams.delete ('asc');
  18. url.searchParams.append ('asc', orderAsc.checked ? '1' : '0');
  19. url.searchParams.delete ('q');
  20. url.searchParams.append ('q', filterKeyword.value);
  21. window.location.href = url;
  22. });
  23. filterKeyword.addEventListener ('keydown',
  24. function (e)
  25. {
  26. if (e.key === 'Enter')
  27. filter (e);
  28. });
  29. btnFilter.addEventListener ('click', filter);
  30. }
  31. static
  32. jumpTo (page)
  33. {
  34. const url = new URL (window.location.href);
  35. url.searchParams.delete ('p');
  36. url.searchParams.append ('p', page);
  37. window.location.href = url;
  38. }
  39. }
  40. Script.main ();