This commit is contained in:
root
2020-03-01 15:05:26 +08:00
parent 0865c98a7f
commit 0897f84a04
59 changed files with 13628 additions and 25877 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+6 -6
View File
File diff suppressed because one or more lines are too long
Vendored Executable → Regular
+179 -219
View File
File diff suppressed because one or more lines are too long
+12 -12
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+90 -103
View File
@@ -1,29 +1,34 @@
/*
*
* INSPINIA - Responsive Admin Theme
* version 2.4
* version 2.9.3
*
*/
$(document).ready(function () {
// Fast fix bor position issue with Propper.js
// Will be fixed in Bootstrap 4.1 - https://github.com/twbs/bootstrap/pull/24092
//Popper.Defaults.modifiers.computeStyle.gpuAcceleration = false;
// Add body-small class if window less than 768px
if ($(this).width() < 769) {
if (window.innerWidth < 769) {
$('body').addClass('body-small')
} else {
$('body').removeClass('body-small')
}
// MetsiMenu
// $('#side-menu').metisMenu();
// MetisMenu
//var sideMenu = $('#side-menu').metisMenu();
// Collapse ibox function
$('.collapse-link').click(function () {
$('.collapse-link').on('click', function (e) {
e.preventDefault();
var ibox = $(this).closest('div.ibox');
var button = $(this).find('i');
var content = ibox.find('div.ibox-content');
var content = ibox.children('.ibox-content');
content.slideToggle(200);
button.toggleClass('fa-chevron-up').toggleClass('fa-chevron-down');
ibox.toggleClass('').toggleClass('border-bottom');
@@ -34,13 +39,15 @@ $(document).ready(function () {
});
// Close ibox function
$('.close-link').click(function () {
$('.close-link').on('click', function (e) {
e.preventDefault();
var content = $(this).closest('div.ibox');
content.remove();
});
// Fullscreen ibox function
$('.fullscreen-link').click(function () {
$('.fullscreen-link').on('click', function (e) {
e.preventDefault();
var ibox = $(this).closest('div.ibox');
var button = $(this).find('i');
$('body').toggleClass('fullscreen-ibox-mode');
@@ -52,43 +59,46 @@ $(document).ready(function () {
});
// Close menu in canvas mode
$('.close-canvas-menu').click(function () {
$('.close-canvas-menu').on('click', function (e) {
e.preventDefault();
$("body").toggleClass("mini-navbar");
SmoothlyMenu();
});
// Run menu of canvas
// $('body.canvas-menu .sidebar-collapse').slimScroll({
// height: '100%',
// railOpacity: 0.9
// });
//$('body.canvas-menu .sidebar-collapse').slimScroll({
// height: '100%',
// railOpacity: 0.9
//});
// Open close right sidebar
$('.right-sidebar-toggle').click(function () {
$('.right-sidebar-toggle').on('click', function (e) {
e.preventDefault();
$('#right-sidebar').toggleClass('sidebar-open');
});
// // Initialize slimscroll for right sidebar
// $('.sidebar-container').slimScroll({
// height: '100%',
// railOpacity: 0.4,
// wheelStep: 10
// });
// Initialize slimscroll for right sidebar
//$('.sidebar-container').slimScroll({
// height: '100%',
// railOpacity: 0.4,
// wheelStep: 10
//});
// // Open close small chat
// $('.open-small-chat').click(function () {
// $(this).children().toggleClass('fa-comments').toggleClass('fa-remove');
// $('.small-chat-box').toggleClass('active');
// });
// Open close small chat
$('.open-small-chat').on('click', function (e) {
e.preventDefault();
$(this).children().toggleClass('fa-comments').toggleClass('fa-times');
$('.small-chat-box').toggleClass('active');
});
// // Initialize slimscroll for small chat
// $('.small-chat-box .content').slimScroll({
// height: '234px',
// railOpacity: 0.4
// });
// Initialize slimscroll for small chat
//$('.small-chat-box .content').slimScroll({
// height: '234px',
// railOpacity: 0.4
//});
// Small todo handler
$('.check-link').click(function () {
$('.check-link').on('click', function () {
var button = $(this).find('i');
var label = $(this).next('span');
button.toggleClass('fa-check-square').toggleClass('fa-square-o');
@@ -96,57 +106,27 @@ $(document).ready(function () {
return false;
});
// Append config box / Only for demo purpose
// Uncomment on server mode to enable XHR calls
//$.get("skin-config2.html", function (data) {
// if (!$('body').hasClass('no-skin-config'))
// $('body').append(data);
//});
// Minimalize menu
$('.navbar-minimalize').click(function () {
$('.navbar-minimalize').on('click', function (event) {
event.preventDefault();
$("body").toggleClass("mini-navbar");
SmoothlyMenu();
});
// Tooltips demo
//$('.tooltip-demo').tooltip({
// selector: "[data-toggle=tooltip]",
// container: "body"
//});
// Move modal to body
// Fix Bootstrap backdrop issu with animation.css
$('.modal').appendTo("body");
// Full height of sidebar
function fix_height() {
var heightWithoutNavbar = $("body > #wrapper").height() - 61;
$(".sidebard-panel").css("min-height", heightWithoutNavbar + "px");
var navbarHeigh = $('nav.navbar-default').height();
var wrapperHeigh = $('#page-wrapper').height();
if (navbarHeigh > wrapperHeigh) {
$('#page-wrapper').css("min-height", navbarHeigh + "px");
}
if (navbarHeigh < wrapperHeigh) {
$('#page-wrapper').css("min-height", $(window).height() + "px");
}
if ($('body').hasClass('fixed-nav')) {
if (navbarHeigh > wrapperHeigh) {
$('#page-wrapper').css("min-height", navbarHeigh - 60 + "px");
} else {
$('#page-wrapper').css("min-height", $(window).height() - 60 + "px");
}
}
}
fix_height();
// Fixed Sidebar
$(window).bind("load", function () {
if ($("body").hasClass('fixed-sidebar')) {
$('.sidebar-collapse').slimScroll({
height: '100%',
railOpacity: 0.9
});
}
});
// Move right sidebar top after scroll
$(window).scroll(function () {
@@ -157,32 +137,44 @@ $(document).ready(function () {
}
});
$(window).bind("load resize scroll", function () {
if (!$("body").hasClass('body-small')) {
fix_height();
}
});
$("[data-toggle=popover]")
.popover();
//$("[data-toggle=popover]")
// .popover();
// Add slimscroll to element
//$('.full-height-scroll').slimscroll({
// height: '100%'
//})
});
// Minimalize menu when screen is less than 768px
$(window).bind("resize", function () {
if ($(this).width() < 769) {
if (window.innerWidth < 769) {
$('body').addClass('body-small')
} else {
$('body').removeClass('body-small')
}
});
// Fixed Sidebar
$(window).bind("load", function () {
if ($("body").hasClass('fixed-sidebar')) {
$('.sidebar-collapse').slimScroll({
height: '100%',
railOpacity: 0.9
});
}
});
// check if browser support HTML5 local storage
function localStorageSupport() {
return (('localStorage' in window) && window['localStorage'] !== null)
}
// Local Storage functions
// Set proper body class and plugins based on user configuration
$(document).ready(function () {
if (localStorageSupport) {
if (localStorageSupport()) {
var collapse = localStorage.getItem("collapse_menu");
var fixedsidebar = localStorage.getItem("fixedsidebar");
@@ -228,25 +220,20 @@ $(document).ready(function () {
}
});
// check if browser support HTML5 local storage
function localStorageSupport() {
return (('localStorage' in window) && window['localStorage'] !== null)
}
// For demo purpose - animation css script
function animationHover(element, animation) {
element = $(element);
element.hover(
function () {
element.addClass('animated ' + animation);
},
function () {
//wait for animation to finish before removing classes
window.setTimeout(function () {
element.removeClass('animated ' + animation);
}, 2000);
});
}
//function animationHover(element, animation) {
// element = $(element);
// element.hover(
// function () {
// element.addClass('animated ' + animation);
// },
// function () {
// //wait for animation to finish before removing classes
// window.setTimeout(function () {
// element.removeClass('animated ' + animation);
// }, 2000);
// });
//}
function SmoothlyMenu() {
if (!$('body').hasClass('mini-navbar') || $('body').hasClass('body-small')) {
-4
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
-68
View File
@@ -1,68 +0,0 @@
(function ($) {
$.fn.cloudLang = function (params) {
var defaults = {
file: '/static/page/lang-example.xml',
lang: 'zh'
}
var aTexts = new Array();
if (params) $.extend(defaults, params);
$.ajax({
type: "GET",
url: window.nps.web_base_url + defaults.file,
dataType: "xml",
success: function (xml) {
$(xml).find('text').each(function () {
var textId = $(this).attr("id");
var text = $(this).find(defaults.lang).text();
aTexts[textId] = text;
});
$.each($("*"), function (i, item) {
//alert($(item).attr("langtag"));
if ($(item).attr("langtag") != null)
$(item).fadeOut(150).fadeIn(150).text(aTexts[$(item).attr("langtag")]);
});
}
});
};
})(jQuery);
$(document).ready(function () {
function setCookie(c_name, value, expiredays) {
var exdate = new Date()
exdate.setDate(exdate.getDate() + expiredays)
document.cookie = c_name + "=" + escape(value) +
((expiredays == null) ? "" : ";expires=" + exdate.toGMTString())
}
function getCookie(c_name) {
if (document.cookie.length > 0) {
c_start = document.cookie.indexOf(c_name + "=")
if (c_start != -1) {
c_start = c_start + c_name.length + 1
c_end = document.cookie.indexOf(";", c_start)
if (c_end == -1) c_end = document.cookie.length
return unescape(document.cookie.substring(c_start, c_end))
}
}
return ""
}
if (getCookie("lang") == "en") {
$("body").cloudLang({lang: "en", file: "/static/page/lang-example.xml"});
}
$("#lang-en").click(function () {
setCookie("lang", "en")
$("body").cloudLang({lang: "en", file: "/static/page/lang-example.xml"});
});
$("#langzh").click(function () {
setCookie("lang", "zh")
$("body").cloudLang({lang: "zh", file: "/static/page/lang-example.xml"});
});
});
+186
View File
@@ -0,0 +1,186 @@
(function ($) {
function xml2json(Xml) {
var tempvalue, tempJson = {};
$(Xml).each(function() {
var tagName = ($(this).attr('id') || this.tagName);
tempvalue = (this.childElementCount == 0) ? this.textContent : xml2json($(this).children());
switch ($.type(tempJson[tagName])) {
case 'undefined':
tempJson[tagName] = tempvalue;
break;
case 'object':
tempJson[tagName] = Array(tempJson[tagName]);
case 'array':
tempJson[tagName].push(tempvalue);
}
});
return tempJson;
}
function setCookie (c_name, value, expiredays) {
var exdate = new Date();
exdate.setDate(exdate.getDate() + expiredays);
document.cookie = c_name + '=' + escape(value) + ((expiredays == null) ? '' : ';expires=' + exdate.toGMTString())+ '; path='+window.nps.web_base_url+'/;';
}
function getCookie (c_name) {
if (document.cookie.length > 0) {
c_start = document.cookie.indexOf(c_name + '=');
if (c_start != -1) {
c_start = c_start + c_name.length + 1;
c_end = document.cookie.indexOf(';', c_start);
if (c_end == -1) c_end = document.cookie.length;
return unescape(document.cookie.substring(c_start, c_end));
}
}
return null;
}
function setchartlang (langobj,chartobj) {
if ( $.type (langobj) == 'string' ) return langobj;
if ( $.type (langobj) == 'chartobj' ) return false;
var flag = true;
for (key in langobj) {
var item = key;
children = (chartobj.hasOwnProperty(item)) ? setchartlang (langobj[item],chartobj[item]) : setchartlang (langobj[item],undefined);
switch ($.type(children)) {
case 'string':
if ($.type(chartobj[item]) != 'string' ) continue;
case 'object':
chartobj[item] = (children['value'] || children);
default:
flag = false;
}
}
if (flag) { return {'value':(langobj[languages['current']] || langobj[languages['default']] || 'N/A')}}
}
$.fn.cloudLang = function () {
$.ajax({
type: 'GET',
url: window.nps.web_base_url + '/static/page/languages.xml',
dataType: 'xml',
success: function (xml) {
languages['content'] = xml2json($(xml).children())['content'];
languages['menu'] = languages['content']['languages'];
languages['default'] = languages['content']['default'];
languages['navigator'] = (getCookie ('lang') || navigator.language || navigator.browserLanguage);
for(var key in languages['menu']){
$('#languagemenu').next().append('<li lang="' + key + '"><a><img src="' + window.nps.web_base_url + '/static/img/flag/' + key + '.png"> ' + languages['menu'][key] +'</a></li>');
if ( key == languages['navigator'] ) languages['current'] = key;
}
$('#languagemenu').attr('lang',(languages['current'] || languages['default']));
$('body').setLang ('');
}
});
};
$.fn.setLang = function (dom) {
languages['current'] = $('#languagemenu').attr('lang');
if ( dom == '' ) {
$('#languagemenu span').text(' ' + languages['menu'][languages['current']]);
if (languages['current'] != getCookie('lang')) setCookie('lang', languages['current']);
if($("#table").length>0) $('#table').bootstrapTable('refreshOptions', { 'locale': languages['current']});
}
$.each($(dom + ' [langtag]'), function (i, item) {
var index = $(item).attr('langtag');
string = languages['content'][index.toLowerCase()];
switch ($.type(string)) {
case 'string':
break;
case 'array':
string = string[Math.floor((Math.random()*string.length))];
case 'object':
string = (string[languages['current']] || string[languages['default']] || null);
break;
default:
string = 'Missing language string "' + index + '"';
$(item).css('background-color','#ffeeba');
}
if($.type($(item).attr('placeholder')) == 'undefined') {
$(item).text(string);
} else {
$(item).attr('placeholder', string);
}
});
if ( !$.isEmptyObject(chartdatas) ) {
setchartlang(languages['content']['charts'],chartdatas);
for(var key in chartdatas){
if ($('#'+key).length == 0) continue;
if($.type(chartdatas[key]) == 'object')
charts[key] = echarts.init(document.getElementById(key));
charts[key].setOption(chartdatas[key], true);
}
}
}
})(jQuery);
$(document).ready(function () {
$('body').cloudLang();
$('body').on('click','li[lang]',function(){
$('#languagemenu').attr('lang',$(this).attr('lang'));
$('body').setLang ('');
});
});
var languages = {};
var charts = {};
var chartdatas = {};
var postsubmit;
function langreply(langstr) {
var langobj = languages['content']['reply'][langstr.replace(/[\s,\.\?]*/g,"").toLowerCase()];
if ($.type(langobj) == 'undefined') return langobj
langobj = (langobj[languages['current']] || langobj[languages['default']] || langstr);
return langobj
}
function submitform(action, url, postdata) {
postsubmit = false;
switch (action) {
case 'start':
case 'stop':
case 'delete':
var langobj = languages['content']['confirm'][action];
action = (langobj[languages['current']] || langobj[languages['default']] || 'Are you sure you want to ' + action + ' it?');
if (! confirm(action)) return;
postsubmit = true;
case 'add':
case 'edit':
$.ajax({
type: "POST",
url: url,
data: postdata,
success: function (res) {
alert(langreply(res.msg));
if (res.status) {
if (postsubmit) {document.location.reload();}else{history.back(-1);}
}
}
});
}
}
function changeunit(limit) {
var size = "";
if (limit < 0.1 * 1024) {
size = limit.toFixed(2) + "B";
} else if (limit < 0.1 * 1024 * 1024) {
size = (limit / 1024).toFixed(2) + "KB";
} else if (limit < 0.1 * 1024 * 1024 * 1024) {
size = (limit / (1024 * 1024)).toFixed(2) + "MB";
} else {
size = (limit / (1024 * 1024 * 1024)).toFixed(2) + "GB";
}
var sizeStr = size + "";
var index = sizeStr.indexOf(".");
var dou = sizeStr.substr(index + 1, 2);
if (dou == "00") {
return sizeStr.substring(0, index) + sizeStr.substr(index + 3, 2);
}
return size;
}
-21
View File
@@ -1,21 +0,0 @@
function change(limit) {
var size = "";
if (limit < 0.1 * 1024) {
size = limit.toFixed(2) + "B"
} else if (limit < 0.1 * 1024 * 1024) {
size = (limit / 1024).toFixed(2) + "KB"
} else if (limit < 0.1 * 1024 * 1024 * 1024) {
size = (limit / (1024 * 1024)).toFixed(2) + "MB"
} else {
size = (limit / (1024 * 1024 * 1024)).toFixed(2) + "GB"
}
var sizeStr = size + "";
var index = sizeStr.indexOf(".");
var dou = sizeStr.substr(index + 1, 2)
if (dou == "00") {
return sizeStr.substring(0, index) + sizeStr.substr(index + 3, 2)
}
return size;
}
+5
View File
File diff suppressed because one or more lines are too long