[Frontend][系統監控] 調整為卡片式呈現
This commit is contained in:
parent
bcb07e0054
commit
36e64f8eac
@ -14,15 +14,15 @@
|
|||||||
<div class="col-sm-12 col-xl-5">
|
<div class="col-sm-12 col-xl-5">
|
||||||
<div class="d-flex mb-4" style="gap:15px">
|
<div class="d-flex mb-4" style="gap:15px">
|
||||||
<div class="row m-0 align-items-center">
|
<div class="row m-0 align-items-center">
|
||||||
<span id="sysNorLight" class="circle-light mr-2"></span>
|
<span id="sysNorLight" class="circle-light mr-2 " data-light-type="normal"></span>
|
||||||
<label class="mb-0">正常</label>
|
<label class="mb-0">正常</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="row m-0 align-items-center">
|
<div class="row m-0 align-items-center">
|
||||||
<span id="sysCloLight" class="circle-light mr-2"></span>
|
<span id="sysCloLight" class="circle-light mr-2" data-light-type="close"></span>
|
||||||
<label class="mb-0">關機</label>
|
<label class="mb-0">關機</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="row m-0 align-items-center">
|
<div class="row m-0 align-items-center">
|
||||||
<span id="sysErrLight" class="circle-light mr-2"></span>
|
<span id="sysErrLight" class="circle-light mr-2" data-light-type="error"></span>
|
||||||
<label class="mb-0">異常</label>
|
<label class="mb-0">異常</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -49,25 +49,44 @@
|
|||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
getFloDevList();
|
getFloDevList();
|
||||||
loadStaLight();
|
setLightColor();
|
||||||
})
|
})
|
||||||
|
|
||||||
function loadStaLight() {
|
//function loadStaLight() {
|
||||||
if (pageAct.sysSubObj.device_normal_color) {
|
// if (pageAct.sysSubObj.device_normal_color) {
|
||||||
$("#sysNorLight").css("background-color", pageAct.sysSubObj.device_normal_color);
|
// $("#sysNorLight").css("background-color", pageAct.sysSubObj.device_normal_color);
|
||||||
} else {
|
// } else {
|
||||||
$("#sysNorLight").addClass("bg-success");
|
// $("#sysNorLight").addClass("bg-success");
|
||||||
}
|
// }
|
||||||
if (pageAct.sysSubObj.device_close_color) {
|
// if (pageAct.sysSubObj.device_close_color) {
|
||||||
$("#sysCloLight").css("background-color", pageAct.sysSubObj.device_close_color);
|
// $("#sysCloLight").css("background-color", pageAct.sysSubObj.device_close_color);
|
||||||
} else {
|
// } else {
|
||||||
$("#sysCloLight").addClass("bg-secondary");
|
// $("#sysCloLight").addClass("bg-secondary");
|
||||||
}
|
// }
|
||||||
if (pageAct.sysSubObj.device_error_color) {
|
// if (pageAct.sysSubObj.device_error_color) {
|
||||||
$("#sysErrLight").css("background-color", pageAct.sysSubObj.device_error_color);
|
// $("#sysErrLight").css("background-color", pageAct.sysSubObj.device_error_color);
|
||||||
} else {
|
// } else {
|
||||||
$("#sysErrLight").addClass("bg-danger");
|
// $("#sysErrLight").addClass("bg-danger");
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
function setLightColor() {
|
||||||
|
$("[data-light-type]").each((index, ele) => {
|
||||||
|
let type = $(ele).data("light-type");
|
||||||
|
let color = "#000";
|
||||||
|
switch (type) {
|
||||||
|
case "normal":
|
||||||
|
color = pageAct.sysSubObj.device_normal_color ?? "var(--theme-success)";
|
||||||
|
break;
|
||||||
|
case "close":
|
||||||
|
color = pageAct.sysSubObj.device_close_color ?? "var(--theme-secondary)";
|
||||||
|
break;
|
||||||
|
case "error":
|
||||||
|
color = pageAct.sysSubObj.device_error_color ?? "var(--theme-danger)";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
$(ele).css("background-color", color);
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFloDevList() {
|
function getFloDevList() {
|
||||||
@ -84,15 +103,28 @@
|
|||||||
} else {
|
} else {
|
||||||
let strHtml = ``;
|
let strHtml = ``;
|
||||||
$.each(res.data, (index, floObj) => {
|
$.each(res.data, (index, floObj) => {
|
||||||
strHtml += `<div class='d-flex justify-content-start mb-5' style="height:60px">`
|
strHtml += `<div class='d-flex justify-content-start mb-5' style="">`
|
||||||
strHtml += `<button id="floItemBtn${floObj.full_name}" type="button" class="btn btn-primary waves-effect waves-themed mr-5 align-self-center" >${floObj.full_name}</button>`
|
strHtml += `<button id="floItemBtn${floObj.full_name}" type="button" class="btn btn-primary waves-effect waves-themed mr-5 align-self-center" >${floObj.full_name}</button>`
|
||||||
|
|
||||||
$.each(floObj.device_list, (index2, devObj) => {
|
$.each(floObj.device_list, (index2, devObj) => {
|
||||||
console.log(">>>> url: " + baseImgUrl + " , img: " + varPathImg + ", icon: " + devObj.device_master_icon);
|
console.log(">>>> url: " + baseImgUrl + " , img: " + varPathImg + ", icon: " + devObj.device_master_icon);
|
||||||
strHtml += `<div name="devItem" data-id="${devObj.device_guid}" data-number="${devObj.device_number}" data-name="${devObj.full_name}" class="mr-5 cur-poi">
|
|
||||||
<span class="status status-success d-inline-block">
|
strHtml += `<div class="card m-1 border device-wrap" style="width:300px">
|
||||||
|
<div class="card-body p-2">
|
||||||
|
<div class="d-flex mb-2">
|
||||||
|
<div class="mr-5 cur-poi">
|
||||||
|
<span class="d-inline-block mr-3">
|
||||||
<img src="${baseImgUrl + varPathImg + devObj.device_master_icon}" class="profile-image rounded-circle" onerror="defDev(this)" alt="...">
|
<img src="${baseImgUrl + varPathImg + devObj.device_master_icon}" class="profile-image rounded-circle" onerror="defDev(this)" alt="...">
|
||||||
</span> ${devObj.full_name}
|
</span>
|
||||||
|
<a href="javascript:;">${devObj.full_name}</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="d-flex mb-0 mt-2 align-items-center">
|
||||||
|
<span id="${devObj.device_number}_status" class="circle-light" data-light-type="normal"></span>
|
||||||
|
<span class="d-none">即時功率:</span>
|
||||||
|
<a href="javascript:;" name="devItem" data-id="${devObj.device_guid}" data-number="${devObj.device_number}" data-name="${devObj.full_name}" class=" ml-2 mb-0 ">詳細資料</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>`;
|
</div>`;
|
||||||
})
|
})
|
||||||
strHtml += "</div>"
|
strHtml += "</div>"
|
||||||
@ -163,7 +195,11 @@
|
|||||||
let devName = $(ele).data("name"); //full_name
|
let devName = $(ele).data("name"); //full_name
|
||||||
$(ele).YTTooltip({
|
$(ele).YTTooltip({
|
||||||
html: `<div class="card m-1 border device-wrap">
|
html: `<div class="card m-1 border device-wrap">
|
||||||
|
<div class="col-12 p-0 row justify-content-end m-0">
|
||||||
|
<button class="btn p-2"><i class="fas fa-times fs-1 text-white-50" data-close="yttooltip"></i></button>
|
||||||
|
</div>
|
||||||
<div class="card-header p-2 px-3">
|
<div class="card-header p-2 px-3">
|
||||||
|
|
||||||
<div class="position-absolute w-50" style="word-break: break-all;">
|
<div class="position-absolute w-50" style="word-break: break-all;">
|
||||||
<label class="m-0 mt-2">${devName}</label>
|
<label class="m-0 mt-2">${devName}</label>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* FileSaver.js
|
* FileSaver.js
|
||||||
* A saveAs() FileSaver implementation.
|
* A saveAs() FileSaver implementation.
|
||||||
*
|
*
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/** vim: et:ts=4:sw=4:sts=4
|
/** vim: et:ts=4:sw=4:sts=4
|
||||||
* @license RequireJS 2.3.3 Copyright jQuery Foundation and other contributors.
|
* @license RequireJS 2.3.3 Copyright jQuery Foundation and other contributors.
|
||||||
* Released under MIT license, https://github.com/requirejs/requirejs/blob/master/LICENSE
|
* Released under MIT license, https://github.com/requirejs/requirejs/blob/master/LICENSE
|
||||||
*/
|
*/
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
var require = typeof require === 'undefined' ? {} : require;
|
var require = typeof require === 'undefined' ? {} : require;
|
||||||
|
|
||||||
require.urlArgs=require.urlArgs || 'version=1496767636459';
|
require.urlArgs=require.urlArgs || 'version=1496767636459';
|
||||||
require.waitSeconds=0;
|
require.waitSeconds=0;
|
||||||
@ -43,11 +43,12 @@ require.hbs.fetchText = function (uri, callback) {
|
|||||||
};
|
};
|
||||||
require.config['nmodule/js/rc/lex/lex']={storageId:'1496767636459',lang:'en-US'};
|
require.config['nmodule/js/rc/lex/lex']={storageId:'1496767636459',lang:'en-US'};
|
||||||
require.paths=require.paths || {};
|
require.paths=require.paths || {};
|
||||||
|
//require.paths.jquery=require.paths.jquery || '/module/js/rc/jquery/jquery-3.1.1.min'; //add
|
||||||
require.paths.nmodule=require.paths.nmodule || '/module';
|
require.paths.nmodule=require.paths.nmodule || '/module';
|
||||||
require.paths.Promise=require.paths.Promise || '/module/js/rc/bluebird/bluebird.min';
|
require.paths.Promise=require.paths.Promise || '/module/js/rc/bluebird/bluebird.min';
|
||||||
require.paths.bajaScript=require.paths.bajaScript || '/module/bajaScript/rc';
|
require.paths.bajaScript=require.paths.bajaScript || '/module/bajaScript/rc';
|
||||||
require.paths.bajaux=require.paths.bajaux || '/module/bajaux/rc';
|
require.paths.bajaux=require.paths.bajaux || '/module/bajaux/rc';
|
||||||
require.paths.jquery = require.paths.jquery || '/module/js/rc/jquery/jquery-3.1.1.min';
|
//require.paths.jquery=require.paths.jquery || '/module/js/rc/jquery/jquery-3.1.1.min';
|
||||||
//require.paths.jqueryUI=require.paths.jqueryUI || 'file:^html/js/jquery-ui.min';
|
//require.paths.jqueryUI=require.paths.jqueryUI || 'file:^html/js/jquery-ui.min';
|
||||||
require.paths.dialogs=require.paths.dialogs || '/module/js/rc/dialogs/dialogs.built.min';
|
require.paths.dialogs=require.paths.dialogs || '/module/js/rc/dialogs/dialogs.built.min';
|
||||||
require.paths.ord=require.paths.ord || '/module/js/com/tridium/js/require/ord';
|
require.paths.ord=require.paths.ord || '/module/js/com/tridium/js/require/ord';
|
||||||
@ -66,4 +67,4 @@ require.paths.ace = require.paths.ace || '/module/js/rc/ace';
|
|||||||
require.shim=require.shim || {};
|
require.shim=require.shim || {};
|
||||||
require.shim.d3=require.shim.d3 || {};
|
require.shim.d3=require.shim.d3 || {};
|
||||||
require.shim.d3.exports=require.shim.d3.exports || 'd3';
|
require.shim.d3.exports=require.shim.d3.exports || 'd3';
|
||||||
require.shim.jqueryContextMenu = require.shim.jqueryContextMenu || { deps: ['jquery'], exports: 'jQuery' };
|
//require.shim.jqueryContextMenu=require.shim.jqueryContextMenu || {deps:['jquery'],exports:'jQuery'};
|
@ -1,4 +1,4 @@
|
|||||||
require.config({
|
require.config({
|
||||||
baseUrl: 'js',
|
baseUrl: 'js',
|
||||||
|
|
||||||
"paths": {
|
"paths": {
|
||||||
|
@ -6,15 +6,6 @@ var varApiUrl = "/api/"; //API路徑
|
|||||||
var varPathImg = "/Upload/Images/";
|
var varPathImg = "/Upload/Images/";
|
||||||
var varPathFile = "/Upload/Files/";
|
var varPathFile = "/Upload/Files/";
|
||||||
var statusArr = { 1: "啟用", 0: "未啟用", 9: "刪除" };
|
var statusArr = { 1: "啟用", 0: "未啟用", 9: "刪除" };
|
||||||
var common = {
|
|
||||||
AddSuc:"新增成功",
|
|
||||||
EditSuc:"編輯成功",
|
|
||||||
DelSuc:"刪除成功",
|
|
||||||
AddErr:"新增失敗,",
|
|
||||||
EditErr:"編輯失敗,",
|
|
||||||
DelErr: "刪除失敗,",
|
|
||||||
SysErr: "系統內部發生錯誤,請聯繫系統管理員"
|
|
||||||
}
|
|
||||||
var objSendData = { Data: null };
|
var objSendData = { Data: null };
|
||||||
|
|
||||||
//重新轉址 for Niagara4
|
//重新轉址 for Niagara4
|
||||||
|
10872
Frontend/js/jquery.js
vendored
Normal file
10872
Frontend/js/jquery.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2
Frontend/js/jquery.keyframes.min.js
vendored
2
Frontend/js/jquery.keyframes.min.js
vendored
File diff suppressed because one or more lines are too long
16
Frontend/js/jquery.min.js
vendored
16
Frontend/js/jquery.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,8 +1,4 @@
|
|||||||
|
|
||||||
function addzero(num) {
|
|
||||||
return num < 10 ? '0' + num : num;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 取得異常資料 by baja
|
* 取得異常資料 by baja
|
||||||
* @param {any} startDate_millisecond
|
* @param {any} startDate_millisecond
|
||||||
@ -19,7 +15,7 @@ function getAlarmByBaja(startDate_millisecond, endDate_millisecond, isRecover, i
|
|||||||
var _bfName = "";
|
var _bfName = "";
|
||||||
var _sourceName = "";
|
var _sourceName = "";
|
||||||
var _index = 0;
|
var _index = 0;
|
||||||
var _recoverState = isRecover ? "!= null" : "= null"
|
var _recoverState = isRecover ? "!= null" : "= null";
|
||||||
var _ackState = isAck ? "= 1" : "!= 1";
|
var _ackState = isAck ? "= 1" : "!= 1";
|
||||||
|
|
||||||
require(['baja!'], function (baja) {
|
require(['baja!'], function (baja) {
|
||||||
@ -54,8 +50,6 @@ function getAlarmByBaja(startDate_millisecond, endDate_millisecond, isRecover, i
|
|||||||
function getOneDeviceAlarmTop10ByBaja(devicePath, callback) {
|
function getOneDeviceAlarmTop10ByBaja(devicePath, callback) {
|
||||||
var _result = "";
|
var _result = "";
|
||||||
var _ss = "";
|
var _ss = "";
|
||||||
var _occurrenceTime = "";
|
|
||||||
var _normalTime = "";
|
|
||||||
var _index = 0;
|
var _index = 0;
|
||||||
//{ "count":2,"data": [{ "time": "2022/11/14 15:00:00", "errId": "0001", "ackCheck": "未確認", "errReason": "燈泡故障" }, { "time": "2022/11/14 15:00:00", "errId": "0002", "ackCheck": "未確認", "errReason": "燈泡故障" }]}
|
//{ "count":2,"data": [{ "time": "2022/11/14 15:00:00", "errId": "0001", "ackCheck": "未確認", "errReason": "燈泡故障" }, { "time": "2022/11/14 15:00:00", "errId": "0002", "ackCheck": "未確認", "errReason": "燈泡故障" }]}
|
||||||
require(['baja!'], function (baja) {
|
require(['baja!'], function (baja) {
|
||||||
@ -63,27 +57,14 @@ function getOneDeviceAlarmTop10ByBaja(devicePath, callback) {
|
|||||||
.then(function (table) {
|
.then(function (table) {
|
||||||
return table.cursor({
|
return table.cursor({
|
||||||
each: function (record) {
|
each: function (record) {
|
||||||
_occurrenceTime = "";
|
|
||||||
_normalTime = "";
|
|
||||||
var _resultUuid = record.get('uuid').toString().split("-");//43dc7846-bd96-4be2-ab35-f11aec729c60
|
|
||||||
|
|
||||||
var _timestampTemp = new Date(record.get('timestamp').toString());
|
|
||||||
_occurrenceTime += _timestampTemp.getFullYear().toString() + "-" + addzero(_timestampTemp.getMonth() + 1).toString() + "-" + addzero(_timestampTemp.getDate()).toString() + " " + addzero(_timestampTemp.getHours()).toString() + ":" + addzero(_timestampTemp.getMinutes()).toString() + ":" + addzero(_timestampTemp.getSeconds()).toString();
|
|
||||||
|
|
||||||
//var _occurrenceTime = _timestamp.format("yyyy-MM-dd hh:mm:ss");//.toLocaleString();
|
|
||||||
var _normaltime = new Date(record.get('normalTime').toString());
|
|
||||||
_normalTime += _normaltime.getFullYear().toString() + "-" + addzero(_normaltime.getMonth() + 1).toString() + "-" + addzero(_normaltime.getDate()).toString() + " " + addzero(_normaltime.getHours()).toString() + ":" + addzero(_normaltime.getMinutes()).toString() + ":" + addzero(_normaltime.getSeconds()).toString();
|
|
||||||
|
|
||||||
var _msgText = record.get('alarmData').get('msgText') == 1 ? _occurrenceTime : "未確認";
|
|
||||||
|
|
||||||
if (_index == 0)
|
if (_index == 0)
|
||||||
_ss += '{"uuid":"' + _resultUuid[0] + '", "msgText":"' + _msgText + '", "ackState":"' + record.get('ackState') + '", "timestamp":"' + _occurrenceTime + '", "normalTime":"' + _normalTime + '"}';
|
_ss += '{"uuid":"' + record.get('uuid') + '", "msgText":"' + record.get('alarmData').get('msgText') + '", "ackState":"' + record.get('ackState') + '", "timestamp":"' + record.get('timestamp') + '"}';
|
||||||
else
|
else
|
||||||
_ss += ',{"uuid":"' + _resultUuid[0] + '", "msgText":"' + _msgText + '", "ackState":"' + record.get('ackState') + '", "timestamp":"' + _occurrenceTime + '", "normalTime":"' + _normalTime + '"}';
|
_ss += ',{"uuid":"' + record.get('uuid') + '", "msgText":"' + record.get('alarmData').get('msgText') + '", "ackState":"' + record.get('ackState') + '", "timestamp":"' + record.get('timestamp') + '"}';
|
||||||
_index++;
|
_index++;
|
||||||
},
|
},
|
||||||
after: function () {
|
after: function () {
|
||||||
_result += '{' + '"count": ' + _index + ', "data":[';
|
_result += '{' + '"count": ' + _index +', data:[';
|
||||||
|
|
||||||
_result += _ss+']';
|
_result += _ss+']';
|
||||||
_result += '}';
|
_result += '}';
|
||||||
|
30430
Frontend/js/r.js
Normal file
30430
Frontend/js/r.js
Normal file
File diff suppressed because one or more lines are too long
@ -19,30 +19,6 @@ $.fn.outerHtml = function () {
|
|||||||
return $(this).prop("outerHTML");
|
return $(this).prop("outerHTML");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* jquery validate 初始設定 | 輸出含原元素 html
|
|
||||||
*/
|
|
||||||
$.validator.setDefaults({
|
|
||||||
onkeyup: function (element, event) {
|
|
||||||
$(element).valid();
|
|
||||||
},
|
|
||||||
//errorPlacement: function (error, element) {
|
|
||||||
// if (element.hasClass("removedTitle"))
|
|
||||||
// error.insertAfter(element.next("img"));
|
|
||||||
// else
|
|
||||||
// error.insertAfter(element);
|
|
||||||
//}
|
|
||||||
});
|
|
||||||
|
|
||||||
jQuery.validator.addMethod("phone", function (phoneNumber, element) {
|
|
||||||
phoneNumber = phoneNumber.replace(/\s+/g, "");
|
|
||||||
return phoneNumber.match(/^[0-9]{9,10}$/);
|
|
||||||
}, "請輸入正確電話號碼格式");
|
|
||||||
|
|
||||||
jQuery.validator.addMethod("dbLimit", function (value, element,param) {
|
|
||||||
return value.length > param;
|
|
||||||
}, "超出輸入限制");
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 設置 bootstrap dropdown 為下拉選單
|
* 設置 bootstrap dropdown 為下拉選單
|
||||||
* @param {any} menuEle .dropdown-menu element
|
* @param {any} menuEle .dropdown-menu element
|
||||||
@ -65,10 +41,6 @@ function setDropdownItem(menuEle) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
onEvent("click", "[e-prevent]", function (e) {
|
|
||||||
e.preventDefault();
|
|
||||||
})
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 預設設備圖像
|
* 預設設備圖像
|
||||||
* @param {any} obj
|
* @param {any} obj
|
||||||
@ -83,7 +55,6 @@ function dtAjaxResetSendData(table,sendData) {
|
|||||||
d = sendData;
|
d = sendData;
|
||||||
return JSON.stringify(d)
|
return JSON.stringify(d)
|
||||||
}
|
}
|
||||||
table.ajax.reload();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -131,6 +102,6 @@ function creSelect(id = null, cls = [], name = null, data = {}, attr = {}, text
|
|||||||
}
|
}
|
||||||
|
|
||||||
function creOption(text = null, value = null, data = {}, attr = {}, cls = [], name = null, id = null) {
|
function creOption(text = null, value = null, data = {}, attr = {}, cls = [], name = null, id = null) {
|
||||||
value != null ? attr.value = value : "";
|
attr = value != null ? attr.value = value : attr;
|
||||||
return creEle("option", text, id, name, cls, data, attr);
|
return creEle("option", text, id, name, cls, data, attr);
|
||||||
}
|
}
|
@ -95,6 +95,8 @@ $.fn.YTTooltip = function (option) {
|
|||||||
} else if (obj.direction == "top" || obj.direction == "bottom"){
|
} else if (obj.direction == "top" || obj.direction == "bottom"){
|
||||||
$(clone).css({ left: offset.left, top: top});
|
$(clone).css({ left: offset.left, top: top});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
event();
|
||||||
} else {
|
} else {
|
||||||
obj.hideTooltipEvent(tooId);
|
obj.hideTooltipEvent(tooId);
|
||||||
}
|
}
|
||||||
@ -108,6 +110,8 @@ $.fn.YTTooltip = function (option) {
|
|||||||
obj.hideTooltipEvent(tooId);
|
obj.hideTooltipEvent(tooId);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
if (obj.toggle == "hover") {
|
if (obj.toggle == "hover") {
|
||||||
@ -130,6 +134,14 @@ $.fn.YTTooltip = function (option) {
|
|||||||
//}, 100)
|
//}, 100)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function event() {
|
||||||
|
let tooId = $(obj.ele).data("yttooltipid");
|
||||||
|
$("#yt_tooltip_" + tooId).off("click", "[data-close='yttooltip']");
|
||||||
|
$("#yt_tooltip_" + tooId).on("click", "[data-close='yttooltip']", function () {
|
||||||
|
hideTooltipEvent(tooId);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
eleArr.push(obj);
|
eleArr.push(obj);
|
||||||
})
|
})
|
||||||
@ -139,6 +151,8 @@ $.fn.YTTooltip = function (option) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function resetYTTooltip() {
|
function resetYTTooltip() {
|
||||||
$("[id^=yt_tooltip_]").remove();
|
$("[id^=yt_tooltip_]").remove();
|
||||||
}
|
}
|
10872
Frontend/lib/jquery/dist/jquery.js
vendored
Normal file
10872
Frontend/lib/jquery/dist/jquery.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2
Frontend/lib/jquery/dist/jquery.min.js
vendored
Normal file
2
Frontend/lib/jquery/dist/jquery.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
Frontend/lib/jquery/dist/jquery.min.map
vendored
Normal file
1
Frontend/lib/jquery/dist/jquery.min.map
vendored
Normal file
File diff suppressed because one or more lines are too long
476
Frontend/lib/notifications/toastr/toastr.js
Normal file
476
Frontend/lib/notifications/toastr/toastr.js
Normal file
@ -0,0 +1,476 @@
|
|||||||
|
/*
|
||||||
|
* Toastr
|
||||||
|
* Copyright 2012-2015
|
||||||
|
* Authors: John Papa, Hans Fjällemark, and Tim Ferrell.
|
||||||
|
* All Rights Reserved.
|
||||||
|
* Use, reproduction, distribution, and modification of this code is subject to the terms and
|
||||||
|
* conditions of the MIT license, available at http://www.opensource.org/licenses/mit-license.php
|
||||||
|
*
|
||||||
|
* ARIA Support: Greta Krafsig
|
||||||
|
*
|
||||||
|
* Project: https://github.com/CodeSeven/toastr
|
||||||
|
*/
|
||||||
|
/* global define */
|
||||||
|
(function (define) {
|
||||||
|
define(['jquery'], function ($) {
|
||||||
|
return (function () {
|
||||||
|
var $container;
|
||||||
|
var listener;
|
||||||
|
var toastId = 0;
|
||||||
|
var toastType = {
|
||||||
|
error: 'error',
|
||||||
|
info: 'info',
|
||||||
|
success: 'success',
|
||||||
|
warning: 'warning'
|
||||||
|
};
|
||||||
|
|
||||||
|
var toastr = {
|
||||||
|
clear: clear,
|
||||||
|
remove: remove,
|
||||||
|
error: error,
|
||||||
|
getContainer: getContainer,
|
||||||
|
info: info,
|
||||||
|
options: {},
|
||||||
|
subscribe: subscribe,
|
||||||
|
success: success,
|
||||||
|
version: '2.1.4',
|
||||||
|
warning: warning
|
||||||
|
};
|
||||||
|
|
||||||
|
var previousToast;
|
||||||
|
|
||||||
|
return toastr;
|
||||||
|
|
||||||
|
////////////////
|
||||||
|
|
||||||
|
function error(message, title, optionsOverride) {
|
||||||
|
return notify({
|
||||||
|
type: toastType.error,
|
||||||
|
iconClass: getOptions().iconClasses.error,
|
||||||
|
message: message,
|
||||||
|
optionsOverride: optionsOverride,
|
||||||
|
title: title
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function getContainer(options, create) {
|
||||||
|
if (!options) { options = getOptions(); }
|
||||||
|
$container = $('#' + options.containerId);
|
||||||
|
if ($container.length) {
|
||||||
|
return $container;
|
||||||
|
}
|
||||||
|
if (create) {
|
||||||
|
$container = createContainer(options);
|
||||||
|
}
|
||||||
|
return $container;
|
||||||
|
}
|
||||||
|
|
||||||
|
function info(message, title, optionsOverride) {
|
||||||
|
return notify({
|
||||||
|
type: toastType.info,
|
||||||
|
iconClass: getOptions().iconClasses.info,
|
||||||
|
message: message,
|
||||||
|
optionsOverride: optionsOverride,
|
||||||
|
title: title
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function subscribe(callback) {
|
||||||
|
listener = callback;
|
||||||
|
}
|
||||||
|
|
||||||
|
function success(message, title, optionsOverride) {
|
||||||
|
return notify({
|
||||||
|
type: toastType.success,
|
||||||
|
iconClass: getOptions().iconClasses.success,
|
||||||
|
message: message,
|
||||||
|
optionsOverride: optionsOverride,
|
||||||
|
title: title
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function warning(message, title, optionsOverride) {
|
||||||
|
return notify({
|
||||||
|
type: toastType.warning,
|
||||||
|
iconClass: getOptions().iconClasses.warning,
|
||||||
|
message: message,
|
||||||
|
optionsOverride: optionsOverride,
|
||||||
|
title: title
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function clear($toastElement, clearOptions) {
|
||||||
|
var options = getOptions();
|
||||||
|
if (!$container) { getContainer(options); }
|
||||||
|
if (!clearToast($toastElement, options, clearOptions)) {
|
||||||
|
clearContainer(options);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function remove($toastElement) {
|
||||||
|
var options = getOptions();
|
||||||
|
if (!$container) { getContainer(options); }
|
||||||
|
if ($toastElement && $(':focus', $toastElement).length === 0) {
|
||||||
|
removeToast($toastElement);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ($container.children().length) {
|
||||||
|
$container.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// internal functions
|
||||||
|
|
||||||
|
function clearContainer (options) {
|
||||||
|
var toastsToClear = $container.children();
|
||||||
|
for (var i = toastsToClear.length - 1; i >= 0; i--) {
|
||||||
|
clearToast($(toastsToClear[i]), options);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearToast ($toastElement, options, clearOptions) {
|
||||||
|
var force = clearOptions && clearOptions.force ? clearOptions.force : false;
|
||||||
|
if ($toastElement && (force || $(':focus', $toastElement).length === 0)) {
|
||||||
|
$toastElement[options.hideMethod]({
|
||||||
|
duration: options.hideDuration,
|
||||||
|
easing: options.hideEasing,
|
||||||
|
complete: function () { removeToast($toastElement); }
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function createContainer(options) {
|
||||||
|
$container = $('<div/>')
|
||||||
|
.attr('id', options.containerId)
|
||||||
|
.addClass(options.positionClass);
|
||||||
|
|
||||||
|
$container.appendTo($(options.target));
|
||||||
|
return $container;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getDefaults() {
|
||||||
|
return {
|
||||||
|
tapToDismiss: true,
|
||||||
|
toastClass: 'toast',
|
||||||
|
containerId: 'toast-container',
|
||||||
|
debug: false,
|
||||||
|
|
||||||
|
showMethod: 'fadeIn', //fadeIn, slideDown, and show are built into jQuery
|
||||||
|
showDuration: 300,
|
||||||
|
showEasing: 'swing', //swing and linear are built into jQuery
|
||||||
|
onShown: undefined,
|
||||||
|
hideMethod: 'fadeOut',
|
||||||
|
hideDuration: 1000,
|
||||||
|
hideEasing: 'swing',
|
||||||
|
onHidden: undefined,
|
||||||
|
closeMethod: false,
|
||||||
|
closeDuration: false,
|
||||||
|
closeEasing: false,
|
||||||
|
closeOnHover: true,
|
||||||
|
|
||||||
|
extendedTimeOut: 1000,
|
||||||
|
iconClasses: {
|
||||||
|
error: 'toast-error',
|
||||||
|
info: 'toast-info',
|
||||||
|
success: 'toast-success',
|
||||||
|
warning: 'toast-warning'
|
||||||
|
},
|
||||||
|
iconClass: 'toast-info',
|
||||||
|
positionClass: 'toast-top-right',
|
||||||
|
timeOut: 5000, // Set timeOut and extendedTimeOut to 0 to make it sticky
|
||||||
|
titleClass: 'toast-title',
|
||||||
|
messageClass: 'toast-message',
|
||||||
|
escapeHtml: false,
|
||||||
|
target: 'body',
|
||||||
|
closeHtml: '<button type="button">×</button>',
|
||||||
|
closeClass: 'toast-close-button',
|
||||||
|
newestOnTop: true,
|
||||||
|
preventDuplicates: false,
|
||||||
|
progressBar: false,
|
||||||
|
progressClass: 'toast-progress',
|
||||||
|
rtl: false
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function publish(args) {
|
||||||
|
if (!listener) { return; }
|
||||||
|
listener(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
function notify(map) {
|
||||||
|
var options = getOptions();
|
||||||
|
var iconClass = map.iconClass || options.iconClass;
|
||||||
|
|
||||||
|
if (typeof (map.optionsOverride) !== 'undefined') {
|
||||||
|
options = $.extend(options, map.optionsOverride);
|
||||||
|
iconClass = map.optionsOverride.iconClass || iconClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shouldExit(options, map)) { return; }
|
||||||
|
|
||||||
|
toastId++;
|
||||||
|
|
||||||
|
$container = getContainer(options, true);
|
||||||
|
|
||||||
|
var intervalId = null;
|
||||||
|
var $toastElement = $('<div/>');
|
||||||
|
var $titleElement = $('<div/>');
|
||||||
|
var $messageElement = $('<div/>');
|
||||||
|
var $progressElement = $('<div/>');
|
||||||
|
var $closeElement = $(options.closeHtml);
|
||||||
|
var progressBar = {
|
||||||
|
intervalId: null,
|
||||||
|
hideEta: null,
|
||||||
|
maxHideTime: null
|
||||||
|
};
|
||||||
|
var response = {
|
||||||
|
toastId: toastId,
|
||||||
|
state: 'visible',
|
||||||
|
startTime: new Date(),
|
||||||
|
options: options,
|
||||||
|
map: map
|
||||||
|
};
|
||||||
|
|
||||||
|
personalizeToast();
|
||||||
|
|
||||||
|
displayToast();
|
||||||
|
|
||||||
|
handleEvents();
|
||||||
|
|
||||||
|
publish(response);
|
||||||
|
|
||||||
|
if (options.debug && console) {
|
||||||
|
console.log(response);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $toastElement;
|
||||||
|
|
||||||
|
function escapeHtml(source) {
|
||||||
|
if (source == null) {
|
||||||
|
source = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return source
|
||||||
|
.replace(/&/g, '&')
|
||||||
|
.replace(/"/g, '"')
|
||||||
|
.replace(/'/g, ''')
|
||||||
|
.replace(/</g, '<')
|
||||||
|
.replace(/>/g, '>');
|
||||||
|
}
|
||||||
|
|
||||||
|
function personalizeToast() {
|
||||||
|
setIcon();
|
||||||
|
setTitle();
|
||||||
|
setMessage();
|
||||||
|
setCloseButton();
|
||||||
|
setProgressBar();
|
||||||
|
setRTL();
|
||||||
|
setSequence();
|
||||||
|
setAria();
|
||||||
|
}
|
||||||
|
|
||||||
|
function setAria() {
|
||||||
|
var ariaValue = '';
|
||||||
|
switch (map.iconClass) {
|
||||||
|
case 'toast-success':
|
||||||
|
case 'toast-info':
|
||||||
|
ariaValue = 'polite';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ariaValue = 'assertive';
|
||||||
|
}
|
||||||
|
$toastElement.attr('aria-live', ariaValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleEvents() {
|
||||||
|
if (options.closeOnHover) {
|
||||||
|
$toastElement.hover(stickAround, delayedHideToast);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!options.onclick && options.tapToDismiss) {
|
||||||
|
$toastElement.click(hideToast);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options.closeButton && $closeElement) {
|
||||||
|
$closeElement.click(function (event) {
|
||||||
|
if (event.stopPropagation) {
|
||||||
|
event.stopPropagation();
|
||||||
|
} else if (event.cancelBubble !== undefined && event.cancelBubble !== true) {
|
||||||
|
event.cancelBubble = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options.onCloseClick) {
|
||||||
|
options.onCloseClick(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
hideToast(true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options.onclick) {
|
||||||
|
$toastElement.click(function (event) {
|
||||||
|
options.onclick(event);
|
||||||
|
hideToast();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function displayToast() {
|
||||||
|
$toastElement.hide();
|
||||||
|
|
||||||
|
$toastElement[options.showMethod](
|
||||||
|
{duration: options.showDuration, easing: options.showEasing, complete: options.onShown}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (options.timeOut > 0) {
|
||||||
|
intervalId = setTimeout(hideToast, options.timeOut);
|
||||||
|
progressBar.maxHideTime = parseFloat(options.timeOut);
|
||||||
|
progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
|
||||||
|
if (options.progressBar) {
|
||||||
|
progressBar.intervalId = setInterval(updateProgress, 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setIcon() {
|
||||||
|
if (map.iconClass) {
|
||||||
|
$toastElement.addClass(options.toastClass).addClass(iconClass);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setSequence() {
|
||||||
|
if (options.newestOnTop) {
|
||||||
|
$container.prepend($toastElement);
|
||||||
|
} else {
|
||||||
|
$container.append($toastElement);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setTitle() {
|
||||||
|
if (map.title) {
|
||||||
|
var suffix = map.title;
|
||||||
|
if (options.escapeHtml) {
|
||||||
|
suffix = escapeHtml(map.title);
|
||||||
|
}
|
||||||
|
$titleElement.append(suffix).addClass(options.titleClass);
|
||||||
|
$toastElement.append($titleElement);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setMessage() {
|
||||||
|
if (map.message) {
|
||||||
|
var suffix = map.message;
|
||||||
|
if (options.escapeHtml) {
|
||||||
|
suffix = escapeHtml(map.message);
|
||||||
|
}
|
||||||
|
$messageElement.append(suffix).addClass(options.messageClass);
|
||||||
|
$toastElement.append($messageElement);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setCloseButton() {
|
||||||
|
if (options.closeButton) {
|
||||||
|
$closeElement.addClass(options.closeClass).attr('role', 'button');
|
||||||
|
$toastElement.prepend($closeElement);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setProgressBar() {
|
||||||
|
if (options.progressBar) {
|
||||||
|
$progressElement.addClass(options.progressClass);
|
||||||
|
$toastElement.prepend($progressElement);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setRTL() {
|
||||||
|
if (options.rtl) {
|
||||||
|
$toastElement.addClass('rtl');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function shouldExit(options, map) {
|
||||||
|
if (options.preventDuplicates) {
|
||||||
|
if (map.message === previousToast) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
previousToast = map.message;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function hideToast(override) {
|
||||||
|
var method = override && options.closeMethod !== false ? options.closeMethod : options.hideMethod;
|
||||||
|
var duration = override && options.closeDuration !== false ?
|
||||||
|
options.closeDuration : options.hideDuration;
|
||||||
|
var easing = override && options.closeEasing !== false ? options.closeEasing : options.hideEasing;
|
||||||
|
if ($(':focus', $toastElement).length && !override) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
clearTimeout(progressBar.intervalId);
|
||||||
|
return $toastElement[method]({
|
||||||
|
duration: duration,
|
||||||
|
easing: easing,
|
||||||
|
complete: function () {
|
||||||
|
removeToast($toastElement);
|
||||||
|
clearTimeout(intervalId);
|
||||||
|
if (options.onHidden && response.state !== 'hidden') {
|
||||||
|
options.onHidden();
|
||||||
|
}
|
||||||
|
response.state = 'hidden';
|
||||||
|
response.endTime = new Date();
|
||||||
|
publish(response);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function delayedHideToast() {
|
||||||
|
if (options.timeOut > 0 || options.extendedTimeOut > 0) {
|
||||||
|
intervalId = setTimeout(hideToast, options.extendedTimeOut);
|
||||||
|
progressBar.maxHideTime = parseFloat(options.extendedTimeOut);
|
||||||
|
progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function stickAround() {
|
||||||
|
clearTimeout(intervalId);
|
||||||
|
progressBar.hideEta = 0;
|
||||||
|
$toastElement.stop(true, true)[options.showMethod](
|
||||||
|
{duration: options.showDuration, easing: options.showEasing}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateProgress() {
|
||||||
|
var percentage = ((progressBar.hideEta - (new Date().getTime())) / progressBar.maxHideTime) * 100;
|
||||||
|
$progressElement.width(percentage + '%');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getOptions() {
|
||||||
|
return $.extend({}, getDefaults(), toastr.options);
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeToast($toastElement) {
|
||||||
|
if (!$container) { $container = getContainer(); }
|
||||||
|
if ($toastElement.is(':visible')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$toastElement.remove();
|
||||||
|
$toastElement = null;
|
||||||
|
if ($container.children().length === 0) {
|
||||||
|
$container.remove();
|
||||||
|
previousToast = undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
})();
|
||||||
|
});
|
||||||
|
}(typeof define === 'function' && define.amd ? define : function (deps, factory) {
|
||||||
|
if (typeof module !== 'undefined' && module.exports) { //Node
|
||||||
|
module.exports = factory(require('jquery'));
|
||||||
|
} else {
|
||||||
|
window.toastr = factory(window.jQuery);
|
||||||
|
}
|
||||||
|
}));
|
Loading…
Reference in New Issue
Block a user