$('table').on('mouseenter', 'tr:gt(0)', function() { if (app.ui.currentDropDown || app.ui.freezeItemHightlight) { return; } app.ui.currentHightlightedItem = this; $(this).addClass('hl').find('.op-icon, .op').removeClass('vh'); }) .on('mouseleave', 'tr:gt(0)', function() { if (app.ui.currentDropDown || app.ui.freezeItemHightlight) { return; } app.ui.currentHightlightedItem = null; $(this).removeClass('hl').find('.op-icon, .op').addClass('vh'); }) .on('focus', 'tr:gt(0) *', function(e) { if (app.ui.currentDropDown || app.ui.freezeItemHightlight) { return true; } $('tr.hl').removeClass('hl').find('.op-icon, .op').addClass('vh'); var $tr = $(e.target).closest('tr'); $tr.addClass('hl').find('.op-icon, .op').removeClass('vh'); }); // clear repo enc info when log out $('#logout').on('click', function() { if ('localStorage' in window && window['localStorage'] !== null) { if (localStorage.length > 0) { for (var key in localStorage) { if (key.lastIndexOf('_decrypt_t') == 36 || key.lastIndexOf('_enc_key') == 36 || key.lastIndexOf('_enc_iv') == 36) { // key: {{repo_id}}_xx localStorage.removeItem(key); } } } } }); /* * add confirm to an operation, using a popup * e.g: * e.g: addConfirmTo($('.user-del'), {'title': 'Delete user', 'con':'Really del user %s ?'}); */ function addConfirmTo(op_ele, popup) { op_ele.on('click', function() { var con = ''; if ($(this).data('target') && popup['con'].indexOf('%s') != -1) { con = popup['con'].replace('%s', '' + HTMLescape($(this).data('target')) + ''); } else { con = popup['con']; } $('#confirm-con').html('
' + con + '
'); $('#confirm-popup').modal({appendTo:'#main'}); $('#simplemodal-container').css({'width': 'auto', 'height':'auto'}); $('#confirm-yes').data('url', $(this).data('url')).on('click', function() { if (popup.post) { // use form post $('