97 lines
3.7 KiB
JavaScript
Executable file
97 lines
3.7 KiB
JavaScript
Executable file
url = window.location.href;
|
|
folder_name = $('body').data('folder');
|
|
debugging = ($('body').data('debugging') == 'n' ? false : true);
|
|
|
|
|
|
|
|
$(document).ready(function () {
|
|
|
|
|
|
var current_time = new Date();
|
|
year = current_time.getFullYear();
|
|
month = ((current_time.getMonth() + 1) < 10 ? '0' : '') + (current_time.getMonth() + 1);
|
|
day = (current_time.getDate() < 10 ? '0' : '') + current_time.getDate();
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function open_newtab(n) { var o = window.open(n, "_blank"); o.focus() }
|
|
function format_number(digits,decimal=0){return $.number(digits,decimal,',',' ')}
|
|
function select_firstfield() { $("input").each(function () { if ("" === this.value) return this.select(), !1 }) }
|
|
|
|
function msg(string, type, class_el) {
|
|
var arr_types = {
|
|
'error': {
|
|
'icon': svgicon('msg-warning'),
|
|
'color': 'red'
|
|
},
|
|
'info': {
|
|
'icon': svgicon('msg-information'),
|
|
'color': 'blue'
|
|
},
|
|
'wait': {
|
|
'icon': svgicon('msg-waiting'),
|
|
'color': 'blue'
|
|
},
|
|
'done': {
|
|
'icon': svgicon('msg-done'),
|
|
'color': 'green'
|
|
}
|
|
};
|
|
|
|
|
|
|
|
if($('.msg > div').length == 0) {
|
|
d = document.createElement('div');
|
|
$(d).appendTo('.msg');
|
|
}
|
|
|
|
$('.msg').show();
|
|
$('.msg' + (class_el == null ? '' : '.' + class_el) + ' > div').html(arr_types[type]['icon'] + string).removeClass('color-blue').removeClass('color-red').removeClass('color-green').addClass('color-' + arr_types[type]['color']);
|
|
|
|
$('input').blur();
|
|
|
|
$('html,body').animate({
|
|
scrollTop: ($((class_el == null ? '.msg' : '.msg.' + class_el)).offset().top - (is_portable == true ? (70 + 10) : 15))
|
|
}, 50);
|
|
|
|
if(type == 'wait') {
|
|
cursor('wait');
|
|
} else {
|
|
cursor('default');
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function svgicon($string) {
|
|
arr = {
|
|
'msg-warning': '<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-exclamation-mark" width="24" height="24" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M12 19v.01"></path><path d="M12 15v-10"></path></svg>',
|
|
'msg-done': '<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-check" width="24" height="24" viewBox="0 0 24 24" stroke-width="1.25" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M5 12l5 5l10 -10"></path></svg>',
|
|
'msg-information': '<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-info-circle-filled" width="24" height="24" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M12 2c5.523 0 10 4.477 10 10a10 10 0 0 1 -19.995 .324l-.005 -.324l.004 -.28c.148 -5.393 4.566 -9.72 9.996 -9.72zm0 9h-1l-.117 .007a1 1 0 0 0 0 1.986l.117 .007v3l.007 .117a1 1 0 0 0 .876 .876l.117 .007h1l.117 -.007a1 1 0 0 0 .876 -.876l.007 -.117l-.007 -.117a1 1 0 0 0 -.764 -.857l-.112 -.02l-.117 -.006v-3l-.007 -.117a1 1 0 0 0 -.876 -.876l-.117 -.007zm.01 -3l-.127 .007a1 1 0 0 0 0 1.986l.117 .007l.127 -.007a1 1 0 0 0 0 -1.986l-.117 -.007z" stroke-width="0" fill="currentColor"></path></svg>',
|
|
'msg-waiting': '<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-loader-2" width="24" height="24" viewBox="0 0 24 24" stroke-width="1.25" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M12 3a9 9 0 1 0 9 9"></path></svg>',
|
|
};
|
|
|
|
return arr[$string];
|
|
}
|
|
|
|
|
|
|
|
function cursor(type) {
|
|
if(type == 'wait') {
|
|
$('html,body').css({ 'cursor': 'wait' });
|
|
} else if(type == 'default') {
|
|
$('html,body').css({ 'cursor': 'auto' });
|
|
}
|
|
}
|