myvesta/web/templates/footer.html
2015-11-06 00:43:32 +02:00

494 lines
19 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});
});
// CREATE BUTTON
$('.l-sort__create-btn').hover(function(){
$(".l-sort__create-btn").append("<div id='add-icon'></div>");
$(".l-sort__create-btn").append("<div id='tooltip'>"+$('.l-sort__create-btn').attr('title').replace(' ','&nbsp;')+"</div>");
}, function(){
$("#add-icon").remove();
$("#tooltip").remove();
});
// SEARCH BOX
$('.l-sort-toolbar__search, .l-sort-toolbar__search-box .search-input').hover(function(){
clearTimeout(VE.tmp.search_display_interval);
clearTimeout(VE.tmp.search_hover_interval);
VE.tmp.search_display_interval = setTimeout(function(){$('.search-input').addClass('activated');}, 150);
}, function(){
clearTimeout(VE.tmp.search_display_interval);
clearTimeout(VE.tmp.search_hover_interval);
VE.tmp.search_hover_interval = setTimeout(function(){
if(!VE.tmp.search_activated && !$(".search-input").val().length){
$(".search-input").removeClass('activated');
}
}, 600);
});
$('.search-input').focus(function(){
VE.tmp.search_activated = 1;
clearTimeout(VE.tmp.search_hover_interval);
});
$('.search-input').blur(function(){
VE.tmp.search_activated = 0;
clearTimeout(VE.tmp.search_hover_interval);
VE.tmp.search_hover_interval = setTimeout(function(){
if(!$(".search-input").val().length){
$(".search-input").removeClass('activated');
}
}, 600);
});
// TIMER
if($('.movement.left').length){
VE.helpers.refresh_timer.right = $('.movement.right');
VE.helpers.refresh_timer.left = $('.movement.left');
VE.helpers.refresh_timer.start();
$('.pause').click(function(){
VE.helpers.refresh_timer.stop();
$('.pause').addClass('hidden');
$('.play').removeClass('hidden');
$('.refresh-timer').addClass('paused');
});
$('.play').click(function(){
VE.helpers.refresh_timer.start();
$('.pause').removeClass('hidden');
$('.play').addClass('hidden');
$('.refresh-timer').removeClass('paused');
});
}
// SORTING
$('#vstobjects input, #vstobjects select, #vstobjects textarea').change(function(){VE.tmp.form_changed=1});
$('.sort-order span').click(function(){
$('.context-menu.sort-order').toggle();
if($(this).hasClass('active'))
return;
$('.sort-order span').removeClass('active');
$(this).addClass('active');
VE.tmp.sort_par = $(this).parent('li').attr('entity');
VE.tmp.sort_as_int = $(this).parent('li').attr('sort_as_int');
VE.tmp.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');
$('.units .l-unit').sort(function (a, b) {
if(VE.tmp.sort_as_int)
return parseInt($(a).attr(VE.tmp.sort_par)) >= parseInt($(b).attr(VE.tmp.sort_par)) ? VE.tmp.sort_direction : VE.tmp.sort_direction * -1;
else
return $(a).attr(VE.tmp.sort_par) <= $(b).attr(VE.tmp.sort_par) ? VE.tmp.sort_direction : VE.tmp.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
$.ajax({
method: "POST",
url: "/delete/favorite/index.php",
data: { v_section: l_unit.attr('v_section'), v_unit_id: l_unit.attr('v_unit_id') }
});
l_unit.attr({'sort-star': 0});
l_unit.removeClass('l-unit--starred');
}
else{
$.ajax({
method: "POST",
url: "/add/favorite/index.php",
data: { v_unit_id: l_unit.attr('v_unit_id'), v_section: l_unit.attr('v_section') }
});
l_unit.attr({'sort-star': 1});
l_unit.addClass('l-unit--starred');
}
});
// Shortcuts
shortcut.add("Ctrl+Enter", function(){
$('form#vstobjects').submit();
}, {
'type': 'keydown',
'propagate': false,
'disable_in_input': false,
'target': document
}
);
shortcut.add("Backspace", function(){
if(VE.tmp.form_changed && $('form#vstobjects .button.cancel')[0]){
VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', $('form#vstobjects input.cancel').attr('onclick').replace("location.href='", "").replace("'",""));
} else if($('form#vstobjects .button.cancel')[0]){
location.href=$('form#vstobjects input.cancel').attr('onclick').replace("location.href='", "").replace("'","");
}
}, {
'type': 'keydown',
'propagate': false,
'disable_in_input': true,
'target': document
}
);
shortcut.add("f", function(){
$('.search-input').addClass('activated').focus();
}, {
'type': 'keydown',
'propagate': false,
'disable_in_input': true,
'target': document
}
);
$(window).bind('keypress', function(evt) {
var tag = evt.target.tagName.toLowerCase();
if (evt.charCode == 97 && tag != 'input' && tag != 'textarea' && tag != 'selectbox') {
evt.preventDefault();
if (!evt.ctrlKey && !evt.shiftKey) {
if ($('.l-sort__create-btn')[0]) {
location.href=$('.l-sort__create-btn').attr('href');
}
}
else {
if ($('.l-unit .ch-toggle:eq(0)').attr('checked')) {
$('.l-unit').removeClass('selected');
$('.l-unit .ch-toggle').attr('checked', false);
}
else {
$('.l-unit').addClass('selected');
$('.l-unit .ch-toggle').attr('checked', true);
}
}
}
});
shortcut.add("n", function(evt){
if (!evt.ctrlKey && !evt.shiftKey) {
if ($('.l-sort__create-btn')[0]) {
location.href=$('.l-sort__create-btn').attr('href');
}
}
}, {
'type': 'keyup',
'propagate': false,
'disable_in_input': true,
'target': document
}
);
shortcut.add("a+1", function(){
location.href='/add/user/';
}, {
'type': 'keydown',
'propagate': false,
'disable_in_input': true,
'target': document
}
);
shortcut.add("1", function(){
if(VE.tmp.form_changed){
VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', $('.l-stat .l-stat__col:nth-of-type(1) a').attr('href'));
} else {
location.href=$('.l-stat .l-stat__col:nth-of-type(1) a').attr('href');
}
}, {
'type': 'keydown',
'propagate': false,
'disable_in_input': true,
'target': document
}
);
shortcut.add("2", function(){
if(VE.tmp.form_changed){
VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', $('.l-stat .l-stat__col:nth-of-type(2) a').attr('href'));
} else {
location.href=$('.l-stat .l-stat__col:nth-of-type(2) a').attr('href');
}
}, {
'type': 'keydown',
'propagate': false,
'disable_in_input': true,
'target': document
}
);
shortcut.add("3", function(){
if(VE.tmp.form_changed){
VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', $('.l-stat .l-stat__col:nth-of-type(3) a').attr('href'));
} else {
location.href=$('.l-stat .l-stat__col:nth-of-type(3) a').attr('href');
}
}, {
'type': 'keydown',
'propagate': false,
'disable_in_input': true,
'target': document
}
);
shortcut.add("4", function(){
if(VE.tmp.form_changed){
VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', $('.l-stat .l-stat__col:nth-of-type(4) a').attr('href'));
} else {
location.href=$('.l-stat .l-stat__col:nth-of-type(4) a').attr('href');
}
}, {
'type': 'keydown',
'propagate': false,
'disable_in_input': true,
'target': document
}
);
shortcut.add("5", function(){
if(VE.tmp.form_changed){
VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', $('.l-stat .l-stat__col:nth-of-type(5) a').attr('href'));
} else {
location.href=$('.l-stat .l-stat__col:nth-of-type(5) a').attr('href');
}
}, {
'type': 'keydown',
'propagate': false,
'disable_in_input': true,
'target': document
}
);
shortcut.add("6", function(){
if(VE.tmp.form_changed){
VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', $('.l-stat .l-stat__col:nth-of-type(6) a').attr('href'));
} else {
location.href=$('.l-stat .l-stat__col:nth-of-type(6) a').attr('href');
}
}, {
'type': 'keydown',
'propagate': false,
'disable_in_input': true,
'target': document
}
);
shortcut.add("7", function(){
if(VE.tmp.form_changed){
VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', $('.l-stat .l-stat__col:nth-of-type(7) a').attr('href'));
} else {
location.href=$('.l-stat .l-stat__col:nth-of-type(7) a').attr('href');
}
}, {
'type': 'keydown',
'propagate': false,
'disable_in_input': true,
'target': document
}
);
shortcut.add("h", function(){
$('.shortcuts').toggle();
}, {
'type': 'keydown',
'propagate': false,
'disable_in_input': true,
'target': document
}
);
shortcut.add("Esc", function(){
$('.shortcuts').hide();
}, {
'type': 'keydown',
'propagate': false,
'disable_in_input': true,
'target': document
}
);
shortcut.add("Left", function(){
VE.navigation.move_focus_left();
}, {
'type': 'keydown',
'propagate': false,
'disable_in_input': true,
'target': document
}
);
shortcut.add("Right", function(){
VE.navigation.move_focus_right();
}, {
'type': 'keydown',
'propagate': false,
'disable_in_input': true,
'target': document
}
);
shortcut.add("Enter", function(){
if(VE.tmp.form_changed){
VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', $(VE.navigation.state.menu_selector + '.focus a').attr('href'));
} else {
VE.navigation.enter_focused();
}
}, {
'type': 'keydown',
'propagate': false,
'disable_in_input': true,
'target': document
}
);
$('.shortcuts .close').click(function(){
$('.shortcuts').hide();
});
$('.to-shortcuts').click(function(){
$('.shortcuts').toggle();
});
$(document).click(function(evt){
//close notification popup
if(!$(evt.target).hasClass('l-profile__notifications') && $(evt.target).parents('ul.notification-container').length == 0){
$('.notification-container').hide();
$('.l-profile__notifications').removeClass('active');
}
});
// focusing on the first input at form
if(location.href.indexOf('lead=') == -1){
$('#vstobjects .vst-input:not([disabled]), #vstobjects .vst-list:not([disabled])').first().focus();
}
$('.l-profile__notifications').click(function(){
if(!$('.l-profile__notifications').hasClass('active')){
VE.notifications.get_list();
$('.l-profile__notifications').addClass('active');
left = $('.l-profile__notifications').offset().left - $('.notification-container').outerWidth() + 28;
$('.notification-container').css({left: left+'px'});
} else {
$('.notification-container').hide();
$('.l-profile__notifications').removeClass('active');
}
});
VE.navigation.init();
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();
}
});
}
//
$('form#objects').bind('submit', function(evt) {
$('.l-unit.selected').find('.ch-toggle').attr('checked', true);
});
});
</script>
<div title="Confirmation" class="confirmation-text-redirect hidden">
<p class="confirmation"><?=__('LEAVE_PAGE_CONFIRMATION')?></p>
</div>
<div class="shortcuts" style="display:none">
<div class="header">
<div class="title">Shortcuts</div>
<div class="close"></div>
</div>
<ul>
<li><span class="key">n</span><?=__('Add New object')?></li>
<li><span class="key">Ctrl + Enter</span><?=__('Save Form')?></li>
<li><span class="key">Backspace</span><?=__('Cancel saving form')?></li>
<li class="step-top"><span class="key">1</span><?=__('Go to USER list')?></li>
<li><span class="key">2</span><?=__('Go to WEB list')?></li>
<li><span class="key">3</span><?=__('Go to DNS list')?></li>
<li><span class="key">4</span><?=__('Go to MAIL list')?></li>
<li><span class="key">5</span><?=__('Go to DB list')?></li>
<li><span class="key">6</span><?=__('Go to CRON list')?></li>
<li><span class="key">7</span><?=__('Go to BACKUP list')?></li>
</ul>
<ul>
<li><span class="key">f</span><?=__('Focus on search')?></li>
<li class="step-top"><span class="key">h</span><?=__('Display/Close shortcuts')?></li>
<li class="step-top"><span class="key bigger">&larr;</span><?=__('Move backward through top menu')?></li>
<li><span class="key bigger">&rarr;</span><?=__('Move forward through top menu')?></li>
<li><span class="key">Enter</span><?=__('Enter focused element')?></li>
</ul>
</div>
</body>
</html>