1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-12-18 02:16:03 +01:00
vichan/js/catalog.js

49 lines
1.3 KiB
JavaScript
Raw Normal View History

if (active_page == 'catalog') $(function(){
if (localStorage.catalog !== undefined) {
var catalog = JSON.parse(localStorage.catalog);
} else {
var catalog = {};
localStorage.catalog = JSON.stringify(catalog);
}
2014-08-08 22:48:38 +02:00
$("#sort_by").change(function(){
var value = this.value;
2015-03-06 11:01:53 +01:00
$('#Grid').mixItUp('sort', (value == "random" ? value : "sticky:desc " + value));
catalog.sort_by = value;
localStorage.catalog = JSON.stringify(catalog);
});
2014-08-08 22:48:38 +02:00
$("#image_size").change(function(){
var value = this.value, old;
$(".grid-li").removeClass("grid-size-vsmall");
$(".grid-li").removeClass("grid-size-small");
$(".grid-li").removeClass("grid-size-large");
2014-08-08 22:48:38 +02:00
$(".grid-li").addClass("grid-size-"+value);
catalog.image_size = value;
localStorage.catalog = JSON.stringify(catalog);
});
$('#Grid').mixItUp({
animation: {
enable: false
2015-03-06 11:01:53 +01:00
}
});
if (catalog.sort_by !== undefined) {
$('#sort_by').val(catalog.sort_by).trigger('change');
}
if (catalog.image_size !== undefined) {
$('#image_size').val(catalog.image_size).trigger('change');
}
2015-05-10 06:51:35 +02:00
$('div.thread').on('click', function(e) {
if ($(this).css('overflow-y') === 'hidden') {
$(this).css('overflow-y', 'auto');
$(this).css('width', '100%');
} else {
$(this).css('overflow-y', 'hidden');
$(this).css('width', 'auto');
}
});
});