[Frontend][系統監控] 調整為卡片式呈現

This commit is contained in:
dev01 2022-11-21 18:47:47 +08:00
parent bcb07e0054
commit 36e64f8eac
17 changed files with 52996 additions and 357 deletions

View File

@ -14,15 +14,15 @@
<div class="col-sm-12 col-xl-5">
<div class="d-flex mb-4" style="gap:15px">
<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>
</div>
<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>
</div>
<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>
</div>
</div>
@ -49,25 +49,44 @@
$(function () {
getFloDevList();
loadStaLight();
setLightColor();
})
function loadStaLight() {
if (pageAct.sysSubObj.device_normal_color) {
$("#sysNorLight").css("background-color", pageAct.sysSubObj.device_normal_color);
} else {
$("#sysNorLight").addClass("bg-success");
}
if (pageAct.sysSubObj.device_close_color) {
$("#sysCloLight").css("background-color", pageAct.sysSubObj.device_close_color);
} else {
$("#sysCloLight").addClass("bg-secondary");
}
if (pageAct.sysSubObj.device_error_color) {
$("#sysErrLight").css("background-color", pageAct.sysSubObj.device_error_color);
} else {
$("#sysErrLight").addClass("bg-danger");
//function loadStaLight() {
// if (pageAct.sysSubObj.device_normal_color) {
// $("#sysNorLight").css("background-color", pageAct.sysSubObj.device_normal_color);
// } else {
// $("#sysNorLight").addClass("bg-success");
// }
// if (pageAct.sysSubObj.device_close_color) {
// $("#sysCloLight").css("background-color", pageAct.sysSubObj.device_close_color);
// } else {
// $("#sysCloLight").addClass("bg-secondary");
// }
// if (pageAct.sysSubObj.device_error_color) {
// $("#sysErrLight").css("background-color", pageAct.sysSubObj.device_error_color);
// } else {
// $("#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() {
@ -84,15 +103,28 @@
} else {
let strHtml = ``;
$.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>`
$.each(floObj.device_list, (index2, devObj) => {
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="...">
</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>`;
})
strHtml += "</div>"
@ -163,7 +195,11 @@
let devName = $(ele).data("name"); //full_name
$(ele).YTTooltip({
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="position-absolute w-50" style="word-break: break-all;">
<label class="m-0 mt-2">${devName}</label>
</div>

View File

@ -1,4 +1,4 @@
/*
/*
* FileSaver.js
* A saveAs() FileSaver implementation.
*
@ -16,7 +16,7 @@ var _global = typeof window === 'object' && window.window === window
? global
: this
function bom(blob, opts) {
function bom (blob, opts) {
if (typeof opts === 'undefined') opts = { autoBom: false }
else if (typeof opts !== 'object') {
console.warn('Deprecated: Expected third argument to be a object')
@ -31,7 +31,7 @@ function bom(blob, opts) {
return blob
}
function download(url, name, opts) {
function download (url, name, opts) {
var xhr = new XMLHttpRequest()
xhr.open('GET', url)
xhr.responseType = 'blob'
@ -44,18 +44,18 @@ function download(url, name, opts) {
xhr.send()
}
function corsEnabled(url) {
function corsEnabled (url) {
var xhr = new XMLHttpRequest()
// use sync to avoid popup blocker
xhr.open('HEAD', url, false)
try {
xhr.send()
} catch (e) { }
} catch (e) {}
return xhr.status >= 200 && xhr.status <= 299
}
// `a.click()` doesn't work for all browsers (#465)
function click(node) {
function click (node) {
try {
node.dispatchEvent(new MouseEvent('click'))
} catch (e) {
@ -74,11 +74,11 @@ var isMacOSWebView = _global.navigator && /Macintosh/.test(navigator.userAgent)
var saveAs = _global.saveAs || (
// probably in some web worker
(typeof window !== 'object' || window !== _global)
? function saveAs() { /* noop */ }
? function saveAs () { /* noop */ }
// Use download attribute first if possible (#193 Lumia mobile) unless this is a macOS WebView
: ('download' in HTMLAnchorElement.prototype && !isMacOSWebView)
? function saveAs(blob, name, opts) {
? function saveAs (blob, name, opts) {
var URL = _global.URL || _global.webkitURL
var a = document.createElement('a')
name = name || blob.name || 'download'
@ -109,7 +109,7 @@ var saveAs = _global.saveAs || (
// Use msSaveOrOpenBlob as a second approach
: 'msSaveOrOpenBlob' in navigator
? function saveAs(blob, name, opts) {
? function saveAs (blob, name, opts) {
name = name || blob.name || 'download'
if (typeof blob === 'string') {
@ -127,7 +127,7 @@ var saveAs = _global.saveAs || (
}
// Fallback to using FileReader and a popup
: function saveAs(blob, name, opts, popup) {
: function saveAs (blob, name, opts, popup) {
// Open a popup immediately do go around popup blocker
// Mostly only available on user interaction and the fileReader is async so...
popup = popup || open('', '_blank')

View File

@ -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.
* Released under MIT license, https://github.com/requirejs/requirejs/blob/master/LICENSE
*/
@ -558,7 +558,7 @@ var requirejs, require, define;
function takeGlobalQueue() {
//Push all the globalDefQueue items into the context's defQueue
if (globalDefQueue.length) {
each(globalDefQueue, function (queueItem) {
each(globalDefQueue, function(queueItem) {
var id = queueItem[0];
if (typeof id === 'string') {
context.defQueueMap[id] = true;
@ -1145,7 +1145,7 @@ var requirejs, require, define;
// No direct errback on this module, but something
// else is listening for errors, so be sure to
// propagate the error correctly.
on(depMap, 'error', bind(this, function (err) {
on(depMap, 'error', bind(this, function(err) {
this.emit('error', err);
}));
}
@ -1290,7 +1290,7 @@ var requirejs, require, define;
// Convert old style urlArgs string to a function.
if (typeof cfg.urlArgs === 'string') {
var urlArgs = cfg.urlArgs;
cfg.urlArgs = function (id, url) {
cfg.urlArgs = function(id, url) {
return (url.indexOf('?') === -1 ? '?' : '&') + urlArgs;
};
}
@ -1349,7 +1349,7 @@ var requirejs, require, define;
each(cfg.packages, function (pkgObj) {
var location, name;
pkgObj = typeof pkgObj === 'string' ? { name: pkgObj } : pkgObj;
pkgObj = typeof pkgObj === 'string' ? {name: pkgObj} : pkgObj;
name = pkgObj.name;
location = pkgObj.location;
@ -1522,7 +1522,7 @@ var requirejs, require, define;
//Clean queued defines too. Go backwards
//in array so that the splices do not
//mess up the iteration.
eachReverse(defQueue, function (args, i) {
eachReverse(defQueue, function(args, i) {
if (args[0] === id) {
defQueue.splice(i, 1);
}
@ -1725,9 +1725,9 @@ var requirejs, require, define;
var data = getScriptData(evt);
if (!hasPathFallback(data.id)) {
var parents = [];
eachProp(registry, function (value, key) {
eachProp(registry, function(value, key) {
if (key.indexOf('_@r') !== 0) {
each(value.depMaps, function (depMap) {
each(value.depMaps, function(depMap) {
if (depMap.id === data.id) {
parents.push(key);
return true;
@ -1975,7 +1975,7 @@ var requirejs, require, define;
// Post a task to the event loop to work around a bug in WebKit
// where the worker gets garbage-collected after calling
// importScripts(): https://webkit.org/b/153317
setTimeout(function () { }, 0);
setTimeout(function() {}, 0);
importScripts(url);
//Account for anonymous modules

View File

@ -1,18 +1,18 @@
var require = typeof require === 'undefined' ? {} : require;
var require = typeof require === 'undefined' ? {} : require;
require.urlArgs = require.urlArgs || 'version=1496767636459';
require.waitSeconds = 0;
require.config = require.config || {};
require.config.ord = require.config.ord || {};
require.config.ord.useLocalWbRc = false;
require.config.baja = require.config.baja || {};
require.config.baja.webdev = false;
require.config.baja.offline = false;
require.config.lex = require.config.lex || {};
require.config.lex.webdev = false;
require.hbs = require.hbs || {};
require.hbs.i18n = require.hbs.i18n === undefined ? false : require.hbs.i18n;
require.hbs.helpers = require.hbs.helpers === undefined ? false : require.hbs.helpers;
require.urlArgs=require.urlArgs || 'version=1496767636459';
require.waitSeconds=0;
require.config=require.config || {};
require.config.ord=require.config.ord || {};
require.config.ord.useLocalWbRc=false;
require.config.baja=require.config.baja || {};
require.config.baja.webdev=false;
require.config.baja.offline=false;
require.config.lex=require.config.lex || {};
require.config.lex.webdev=false;
require.hbs=require.hbs || {};
require.hbs.i18n=require.hbs.i18n===undefined?false:require.hbs.i18n;
require.hbs.helpers=require.hbs.helpers===undefined?false:require.hbs.helpers;
require.hbs.fetchText = function (uri, callback) {
function unmodularize(href) {
var res;
@ -41,29 +41,30 @@ require.hbs.fetchText = function (uri, callback) {
}
});
};
require.config['nmodule/js/rc/lex/lex'] = { storageId: '1496767636459', lang: 'en-US' };
require.paths = require.paths || {};
require.paths.nmodule = require.paths.nmodule || '/module';
require.paths.Promise = require.paths.Promise || '/module/js/rc/bluebird/bluebird.min';
require.paths.bajaScript = require.paths.bajaScript || '/module/bajaScript/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.config['nmodule/js/rc/lex/lex']={storageId:'1496767636459',lang:'en-US'};
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.Promise=require.paths.Promise || '/module/js/rc/bluebird/bluebird.min';
require.paths.bajaScript=require.paths.bajaScript || '/module/bajaScript/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.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.ord = require.paths.ord || '/module/js/com/tridium/js/require/ord';
require.paths.lex = require.paths.lex || '/module/js/rc/lex/lexplugin';
require.paths.css = require.paths.css || '/module/js/com/tridium/js/ext/require/css';
require.paths.baja = require.paths.baja || '/module/bajaScript/rc/plugin/baja';
require.paths.obix = require.paths.obix || '/module/obixjs/rc/obix.built.min';
require.paths.Handlebars = require.paths.Handlebars || '/module/js/rc/handlebars/handlebars.min-v2.0.0';
require.paths.underscore = require.paths.underscore || '/module/js/rc/underscore/underscore.min';
require.paths.hbs = require.paths.hbs || '/module/js/rc/require-handlebars-plugin/hbs.built.min';
require.paths.moment = require.paths.moment || '/module/js/rc/moment/moment.min';
require.paths.d3 = require.paths.d3 || '/module/js/rc/d3/d3.min';
require.paths.hx = require.paths.hx || '/module/hx/javax/baja/hx/hx';
require.paths.jqueryContextMenu = require.paths.jqueryContextMenu || '/module/js/rc/jquery/contextMenu/jquery.contextMenu';
require.paths.ace = require.paths.ace || '/module/js/rc/ace';
require.shim = require.shim || {};
require.shim.d3 = require.shim.d3 || {};
require.shim.d3.exports = require.shim.d3.exports || 'd3';
require.shim.jqueryContextMenu = require.shim.jqueryContextMenu || { deps: ['jquery'], exports: 'jQuery' };
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.lex=require.paths.lex || '/module/js/rc/lex/lexplugin';
require.paths.css=require.paths.css || '/module/js/com/tridium/js/ext/require/css';
require.paths.baja=require.paths.baja || '/module/bajaScript/rc/plugin/baja';
require.paths.obix=require.paths.obix || '/module/obixjs/rc/obix.built.min';
require.paths.Handlebars=require.paths.Handlebars || '/module/js/rc/handlebars/handlebars.min-v2.0.0';
require.paths.underscore=require.paths.underscore || '/module/js/rc/underscore/underscore.min';
require.paths.hbs=require.paths.hbs || '/module/js/rc/require-handlebars-plugin/hbs.built.min';
require.paths.moment=require.paths.moment || '/module/js/rc/moment/moment.min';
require.paths.d3=require.paths.d3 || '/module/js/rc/d3/d3.min';
require.paths.hx=require.paths.hx || '/module/hx/javax/baja/hx/hx';
require.paths.jqueryContextMenu=require.paths.jqueryContextMenu || '/module/js/rc/jquery/contextMenu/jquery.contextMenu';
require.paths.ace=require.paths.ace || '/module/js/rc/ace';
require.shim=require.shim || {};
require.shim.d3=require.shim.d3 || {};
require.shim.d3.exports=require.shim.d3.exports || 'd3';
//require.shim.jqueryContextMenu=require.shim.jqueryContextMenu || {deps:['jquery'],exports:'jQuery'};

View File

@ -1,10 +1,10 @@
require.config({
require.config({
baseUrl: 'js',
"paths": {
"jquery-ui": "//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui",
"jquery-ui-min": "//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min",
"d3": "https://d3js.org/d3.v4.min"
"d3" : "https://d3js.org/d3.v4.min"
},
shim: {

View File

@ -6,15 +6,6 @@ var varApiUrl = "/api/"; //API路徑
var varPathImg = "/Upload/Images/";
var varPathFile = "/Upload/Files/";
var statusArr = { 1: "啟用", 0: "未啟用", 9: "刪除" };
var common = {
AddSuc:"新增成功",
EditSuc:"編輯成功",
DelSuc:"刪除成功",
AddErr:"新增失敗,",
EditErr:"編輯失敗,",
DelErr: "刪除失敗,",
SysErr: "系統內部發生錯誤,請聯繫系統管理員"
}
var objSendData = { Data: null };
//重新轉址 for Niagara4

10872
Frontend/js/jquery.js vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,8 +1,4 @@

function addzero(num) {
return num < 10 ? '0' + num : num;
}
/**
* 取得異常資料 by baja
* @param {any} startDate_millisecond
@ -19,7 +15,7 @@ function getAlarmByBaja(startDate_millisecond, endDate_millisecond, isRecover, i
var _bfName = "";
var _sourceName = "";
var _index = 0;
var _recoverState = isRecover ? "!= null" : "= null"
var _recoverState = isRecover ? "!= null" : "= null";
var _ackState = isAck ? "= 1" : "!= 1";
require(['baja!'], function (baja) {
@ -54,8 +50,6 @@ function getAlarmByBaja(startDate_millisecond, endDate_millisecond, isRecover, i
function getOneDeviceAlarmTop10ByBaja(devicePath, callback) {
var _result = "";
var _ss = "";
var _occurrenceTime = "";
var _normalTime = "";
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": "燈泡故障" }]}
require(['baja!'], function (baja) {
@ -63,29 +57,16 @@ function getOneDeviceAlarmTop10ByBaja(devicePath, callback) {
.then(function (table) {
return table.cursor({
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)
_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
_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++;
},
after: function () {
_result += '{' + '"count": ' + _index + ', "data":[';
_result += '{' + '"count": ' + _index +', data:[';
_result += _ss + ']';
_result += _ss+']';
_result += '}';
if (typeof callback === 'function') {
callback(_result);

30430
Frontend/js/r.js Normal file

File diff suppressed because one or more lines are too long

View File

@ -19,30 +19,6 @@ $.fn.outerHtml = function () {
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 為下拉選單
* @param {any} menuEle .dropdown-menu element
@ -65,10 +41,6 @@ function setDropdownItem(menuEle) {
})
}
onEvent("click", "[e-prevent]", function (e) {
e.preventDefault();
})
/**
* 預設設備圖像
* @param {any} obj
@ -83,7 +55,6 @@ function dtAjaxResetSendData(table,sendData) {
d = sendData;
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) {
value != null ? attr.value = value : "";
attr = value != null ? attr.value = value : attr;
return creEle("option", text, id, name, cls, data, attr);
}

View File

@ -95,6 +95,8 @@ $.fn.YTTooltip = function (option) {
} else if (obj.direction == "top" || obj.direction == "bottom"){
$(clone).css({ left: offset.left, top: top});
}
event();
} else {
obj.hideTooltipEvent(tooId);
}
@ -108,6 +110,8 @@ $.fn.YTTooltip = function (option) {
obj.hideTooltipEvent(tooId);
})
}
})
if (obj.toggle == "hover") {
@ -130,6 +134,14 @@ $.fn.YTTooltip = function (option) {
//}, 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);
})
@ -139,6 +151,8 @@ $.fn.YTTooltip = function (option) {
return result;
}
function resetYTTooltip() {
$("[id^=yt_tooltip_]").remove();
}

10872
Frontend/lib/jquery/dist/jquery.js vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View 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">&times;</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, '&amp;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#39;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;');
}
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);
}
}));