The version of vichan running on lainchan.org
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.

49 lines
1.3KB

  1. if (active_page == 'catalog') $(function(){
  2. if (localStorage.catalog !== undefined) {
  3. var catalog = JSON.parse(localStorage.catalog);
  4. } else {
  5. var catalog = {};
  6. localStorage.catalog = JSON.stringify(catalog);
  7. }
  8. $("#sort_by").change(function(){
  9. var value = this.value;
  10. $('#Grid').mixItUp('sort', (value == "random" ? value : "sticky:desc " + value));
  11. catalog.sort_by = value;
  12. localStorage.catalog = JSON.stringify(catalog);
  13. });
  14. $("#image_size").change(function(){
  15. var value = this.value, old;
  16. $(".grid-li").removeClass("grid-size-vsmall");
  17. $(".grid-li").removeClass("grid-size-small");
  18. $(".grid-li").removeClass("grid-size-large");
  19. $(".grid-li").addClass("grid-size-"+value);
  20. catalog.image_size = value;
  21. localStorage.catalog = JSON.stringify(catalog);
  22. });
  23. $('#Grid').mixItUp({
  24. animation: {
  25. enable: false
  26. }
  27. });
  28. if (catalog.sort_by !== undefined) {
  29. $('#sort_by').val(catalog.sort_by).trigger('change');
  30. }
  31. if (catalog.image_size !== undefined) {
  32. $('#image_size').val(catalog.image_size).trigger('change');
  33. }
  34. $('div.thread').on('click', function(e) {
  35. if ($(this).css('overflow-y') === 'hidden') {
  36. $(this).css('overflow-y', 'auto');
  37. $(this).css('width', '100%');
  38. } else {
  39. $(this).css('overflow-y', 'hidden');
  40. $(this).css('width', 'auto');
  41. }
  42. });
  43. });