mirror of
https://github.com/myvesta/vesta.git
synced 2025-03-12 04:35:23 -07:00
110 lines
4.1 KiB
HTML
110 lines
4.1 KiB
HTML
</div>
|
|
<script src="/js/jquery.finder.js"></script>
|
|
<script type="text/javascript">
|
|
lastScrollTop = 0;
|
|
|
|
$(document).ready(function() {
|
|
|
|
hover_menu();
|
|
$(window).scroll(function(){hover_menu()});
|
|
|
|
$('.l-sort-toolbar .sort-by').click(function(){
|
|
$('.context-menu.sort-order').toggle().css({left: $(this).position().left - 10});
|
|
});
|
|
|
|
|
|
|
|
// SORTING
|
|
|
|
V = {
|
|
sort_par: 'sort-name',
|
|
sort_direction: -1,
|
|
sort_as_int: 0
|
|
};
|
|
|
|
$('.sort-order span').click(function(){
|
|
$('.context-menu.sort-order').toggle();
|
|
if($(this).hasClass('active'))
|
|
return;
|
|
|
|
$('.sort-order span').removeClass('active');
|
|
$(this).addClass('active');
|
|
V.sort_par = $(this).parent('li').attr('entity');
|
|
V.sort_as_int = $(this).parent('li').attr('sort_as_int');
|
|
V.sort_direction = $(this).hasClass('up')*1 || -1;
|
|
|
|
$('.l-sort .sort-by span b').html($(this).parent('li').find('.name').html());
|
|
$('.l-sort .sort-by i').removeClass('l-icon-up-arrow l-icon-down-arrow');
|
|
$(this).hasClass('up') ? $('.l-sort .sort-by i').addClass('l-icon-up-arrow') : $('.l-sort .sort-by i').addClass('l-icon-down-arrow');
|
|
|
|
|
|
$('.l-unit').sort(function (a, b) {
|
|
if(V.sort_as_int)
|
|
return parseInt($(a).attr(V.sort_par)) >= parseInt($(b).attr(V.sort_par)) ? V.sort_direction : V.sort_direction * -1;
|
|
else
|
|
return $(a).attr(V.sort_par) <= $(b).attr(V.sort_par) ? V.sort_direction : V.sort_direction * -1;
|
|
}).appendTo(".l-center.units");
|
|
});
|
|
|
|
|
|
|
|
// STARS
|
|
|
|
$('.l-unit .l-icon-star').click(function(){
|
|
var l_unit = $(this).parents('.l-unit');
|
|
|
|
if(l_unit.hasClass('l-unit--starred')){
|
|
// removing star
|
|
$.removeCookie(l_unit.attr('uniq-id'));
|
|
l_unit.removeClass('l-unit--starred');
|
|
}
|
|
else{
|
|
$.cookie(l_unit.attr('uniq-id'), 1, {expires: 3650});
|
|
l_unit.addClass('l-unit--starred');
|
|
}
|
|
});
|
|
|
|
|
|
|
|
/*jQuery('.ch-toggle').bind('change', function(evt) {
|
|
evt.stopImmediatePropagation();
|
|
console.log(123);
|
|
});*/
|
|
|
|
VE.core.register();
|
|
if (location.href.search(/list/) != -1) {
|
|
var shift_select_ref = $('body').finderSelect({children: '.l-unit',
|
|
'onFinish': function(evt) {
|
|
/*var ref = $(evt.target);
|
|
$('.l-content').find('.l-unit .ch-toggle').attr('checked', false);
|
|
$('.l-content').find('.l-unit.selected .ch-toggle').attr('checked', true);
|
|
|
|
|
|
if ($('.l-content').find('.l-unit.selected').length == $('.l-content').find('.l-unit').length) {
|
|
$('.toggle-all').addClass('clicked-on');
|
|
}*/
|
|
|
|
},
|
|
'toggleAllHook': function() {
|
|
/*if ($('.l-unit').length == $('.ch-toggle:checked').length) {
|
|
$('.l-unit.selected').removeClass('selected');
|
|
$('.ch-toggle').attr('checked', false);
|
|
$('#toggle-all').attr('checked', false);
|
|
}
|
|
else {
|
|
$('.ch-toggle').attr('checked', true);
|
|
$('#toggle-all').attr('checked', true);
|
|
}*/
|
|
}
|
|
});
|
|
$('table').on('mousedown', 'td', function(e) {
|
|
if (e.ctrlKey) {
|
|
e.preventDefault();
|
|
}
|
|
});
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|