layui.define(['table', 'jquery', 'element'], function (exports) {
"use strict";
var MOD_NAME = 'loading',
$ = layui.jquery,
element = layui.element;
var pearOper = new function () {
this.blockRemove = function(dom,time){
Notiflix.Block.Remove(dom, time);
}
this.block = function(option){
if(option.type==1){
Notiflix.Block.Standard(
option.elem
,option.msg);
}
else if(option.type==2){
Notiflix.Block.Hourglass(
option.elem
,option.msg);
}
else if(option.type==3){
Notiflix.Block.Circle(
option.elem
,option.msg);
}
else if(option.type==4){
Notiflix.Block.Arrows(
option.elem
,option.msg);
}
else if(option.type==5){
Notiflix.Block.Dots(
option.elem
,option.msg);
}
else if(option.type==6){
Notiflix.Block.Pulse(
option.elem
,option.msg);
}
}
this.report = function(option){
if(option.type=="success"){
Notiflix.Report.Success(
option.title,
option.message,'确认');
}else if(option.type=="failure"){
Notiflix.Report.Failure(
option.title,
option.message,'确认');
}else if(option.type=="warning"){
Notiflix.Report.Warning(
option.title,
option.message,'确认');
}else if(option.type=="info"){
Notiflix.Report.Info(
option.title,
option.message,'确认');
}
}
this.notice = function(option){
Notiflix.Notify.Init({
position:option.position?"right-top":option.position,
});
if(option.type=="success"){
Notiflix.Notify.Success(option.title);
}else if(option.type=="failure"){
Notiflix.Notify.Failure(option.title);
}else if(option.type=="warning"){
Notiflix.Notify.Warning(option.title);
}else if(option.type=="info"){
Notiflix.Notify.Info(option.title);
}
}
this.confirm = function(option){
Notiflix.Confirm.Show(
option.title,
option.message,
'确认',
'取消',
option.success,
option.cancle
);
}
this.drawer = function(position,dom,distance){
var _right = new mSlider({
dom: dom,
direction: position,
distance:distance
});
_right.open();
}
this.loadRemove = function(time){
Notiflix.Loading.Remove(time);
}
this.Load = function(type,message){
if(type==1){
Notiflix.Loading.Standard(message);
}else if(type==2){
Notiflix.Loading.Hourglass(message);
}else if(type==3){
Notiflix.Loading.Circle(message);
}else if(type==4){
Notiflix.Loading.Dots(message);
}else if(type==5){
Notiflix.Loading.Pulse(message);
}
}
this.msg = function(option){
if(option.type=="success"){
layer.msg(option.title,{icon:1,time:option.time},option.callback);
}else if(option.type=="failure"){
layer.msg(option.title,{icon:2,time:option.time},option.callback);
}else if(option.type=="warning"){
layer.msg(option.title,{icon:3,time:option.time},option.callback);
}else if(option.type=="info"){
layer.msg(option.title,{icon:4,time:option.time},option.callback);
}
}
};
// Notiflix: Notify Default Settings on
var notifySettings = {
wrapID: 'NotiflixNotifyWrap', // can not customizable
width: '280px',
position: 'right-top', // 'right-top' - 'right-bottom' - 'left-top' - 'left-bottom'
distance: '10px',
opacity: 1,
borderRadius: '5px',
rtl: false,
timeout: 3000,
messageMaxLength: 110,
backOverlay: false,
backOverlayColor: 'rgba(0,0,0,0.5)',
plainText: true,
showOnlyTheLastOne: false,
clickToClose: false,
ID: 'NotiflixNotify',
className: 'notiflix-notify',
zindex: 4001,
useGoogleFont: true,
fontFamily: 'Quicksand',
fontSize: '13px',
cssAnimation: true,
cssAnimationDuration: 400,
cssAnimationStyle: 'fade', // 'fade' - 'zoom' - 'from-right' - 'from-top' - 'from-bottom' - 'from-left'
closeButton: false,
useIcon: true,
useFontAwesome: false,
fontAwesomeIconStyle: 'basic', // 'basic' - 'shadow'
fontAwesomeIconSize: '34px',
success: {
background: '#32c682',
textColor: '#fff',
childClassName: 'success',
notiflixIconColor: 'rgba(0,0,0,0.2)',
fontAwesomeClassName: 'fas fa-check-circle',
fontAwesomeIconColor: 'rgba(0,0,0,0.2)',
},
failure: {
background: '#ff5549',
textColor: '#fff',
childClassName: 'failure',
notiflixIconColor: 'rgba(0,0,0,0.2)',
fontAwesomeClassName: 'fas fa-times-circle',
fontAwesomeIconColor: 'rgba(0,0,0,0.2)',
},
warning: {
background: '#eebf31',
textColor: '#fff',
childClassName: 'warning',
notiflixIconColor: 'rgba(0,0,0,0.2)',
fontAwesomeClassName: 'fas fa-exclamation-circle',
fontAwesomeIconColor: 'rgba(0,0,0,0.2)',
},
info: {
background: '#26c0d3',
textColor: '#fff',
childClassName: 'info',
notiflixIconColor: 'rgba(0,0,0,0.2)',
fontAwesomeClassName: 'fas fa-info-circle',
fontAwesomeIconColor: 'rgba(0,0,0,0.2)',
},
};
// Notiflix: Notify Default Settings off
// Notiflix: Report Default Settings on
var reportSettings = {
ID: 'NotiflixReportWrap', // can not customizable
className: 'notiflix-report',
width: '320px',
backgroundColor: '#f8f8f8',
borderRadius: '25px',
rtl: false,
zindex: 4002,
backOverlay: true,
backOverlayColor: 'rgba(0, 0, 0, 0.5)',
useGoogleFont: true,
fontFamily: 'Quicksand',
svgSize: '110px',
plainText: true,
titleFontSize: '16px',
titleMaxLength: 34,
messageFontSize: '13px',
messageMaxLength: 400,
buttonFontSize: '14px',
buttonMaxLength: 34,
cssAnimation: true,
cssAnimationDuration: 360,
cssAnimationStyle: 'fade', // 'fade' - 'zoom'
success: {
svgColor: '#32c682',
titleColor: '#1e1e1e',
messageColor: '#242424',
buttonBackground: '#32c682',
buttonColor: '#fff',
},
failure: {
svgColor: '#ff5549',
titleColor: '#1e1e1e',
messageColor: '#242424',
buttonBackground: '#ff5549',
buttonColor: '#fff',
},
warning: {
svgColor: '#eebf31',
titleColor: '#1e1e1e',
messageColor: '#242424',
buttonBackground: '#eebf31',
buttonColor: '#fff',
},
info: {
svgColor: '#26c0d3',
titleColor: '#1e1e1e',
messageColor: '#242424',
buttonBackground: '#26c0d3',
buttonColor: '#fff',
},
};
// Notiflix: Report Default Settings off
// Notiflix: Confirm Default Settings on
var confirmSettings = {
ID: 'NotiflixConfirmWrap', // can not customizable
className: 'notiflix-confirm',
width: '300px',
zindex: 4003,
position: 'center', // 'center' - 'center-top' - 'right-top' - 'right-bottom' - 'left-top' - 'left-bottom'
distance: '10px',
backgroundColor: '#f8f8f8',
borderRadius: '25px',
backOverlay: true,
backOverlayColor: 'rgba(0,0,0,0.5)',
rtl: false,
useGoogleFont: true,
fontFamily: 'Quicksand',
cssAnimation: true,
cssAnimationStyle: 'fade', // 'zoom' - 'fade'
cssAnimationDuration: 300,
plainText: true,
titleColor: '#32c682',
titleFontSize: '16px',
titleMaxLength: 34,
messageColor: '#1e1e1e',
messageFontSize: '14px',
messageMaxLength: 110,
buttonsFontSize: '15px',
buttonsMaxLength: 34,
okButtonColor: '#f8f8f8',
okButtonBackground: '#32c682',
cancelButtonColor: '#f8f8f8',
cancelButtonBackground: '#a9a9a9',
};
// Notiflix: Confirm Default Settings off
// Notiflix: Loading Default Settings on
var loadingSettings = {
ID: 'NotiflixLoadingWrap', // can not customizable
className: 'notiflix-loading',
zindex: 4000,
backgroundColor: 'rgba(0,0,0,0.8)',
rtl: false,
useGoogleFont: true,
fontFamily: 'Quicksand',
cssAnimation: true,
cssAnimationDuration: 400,
clickToClose: false,
customSvgUrl: null,
svgSize: '80px',
svgColor: '#32c682',
messageID: 'NotiflixLoadingMessage',
messageFontSize: '15px',
messageMaxLength: 34,
messageColor: '#dcdcdc',
};
// Notiflix: Loading Default Settings off
// Notiflix: Block Default Settings on
var blockSettings = {
ID: 'NotiflixBlockWrap', // can not customizable
querySelectorLimit: 200,
className: 'notiflix-block',
position: 'absolute',
zindex: 1000,
backgroundColor: 'rgba(255,255,255,0.9)',
rtl: false,
useGoogleFont: true,
fontFamily: 'Quicksand',
cssAnimation: true,
cssAnimationDuration: 300,
svgSize: '45px',
svgColor: '#383838',
messageFontSize: '14px',
messageMaxLength: 34,
messageColor: '#383838',
};
// Notiflix: Block Default Settings off
// Notiflix: Extend on
var extendNotiflix = function () {
// variables
var extended = {};
var deep = false;
var i = 0;
// check if a deep merge
if (Object.prototype.toString.call(arguments[0]) === '[object Boolean]') {
deep = arguments[0];
i++;
}
// merge the object into the extended object
var merge = function (obj) {
for (var prop in obj) {
if (Object.prototype.hasOwnProperty.call(obj, prop)) {
// if property is an object, merge properties
if (deep && Object.prototype.toString.call(obj[prop]) === '[object Object]') {
extended[prop] = extendNotiflix(extended[prop], obj[prop]);
} else {
extended[prop] = obj[prop];
}
}
}
};
// loop through each object and conduct a merge
for (; i < arguments.length; i++) {
merge(arguments[i]);
}
return extended;
};
// Notiflix: Extend off
// Notiflix: Plaintext on
var notiflixPlaintext = function (html) {
var htmlPool = document.createElement('div');
htmlPool.innerHTML = html;
return htmlPool.textContent || htmlPool.innerText || '';
};
// Notiflix: Plaintext off
// Notiflix: GoogleFont on
var notiflixGoogleFont = function (use, family) {
if (!document.getElementById('NotiflixQuicksand') && use && (family && typeof family === 'string' && family.toLowerCase() === 'quicksand')) {
// google fonts dns prefetch on
var dns = '';
var dnsRange = document.createRange();
dnsRange.selectNode(document.head);
var dnsFragment = dnsRange.createContextualFragment(dns);
document.head.appendChild(dnsFragment);
// google fonts dns prefetch off
// google fonts style on
var font = '';
var fontRange = document.createRange();
fontRange.selectNode(document.head);
var fontFragment = fontRange.createContextualFragment(font);
document.head.appendChild(fontFragment);
// google fonts style off
}
};
// Notiflix: GoogleFont off
// Notiflix: Console Error on
var notiflixConsoleError = function (title, message) {
return console.error('%c ' + title + ' ', 'padding:2px;border-radius:20px;color:#fff;background:#ff5549', '\n' + message + '\nVisit documentation page to learn more: https://www.notiflix.com/documentation');
};
// Notiflix: Console Error off
// Notiflix: Console Log on
var notiflixConsoleLog = function (title, message) {
return console.log('%c ' + title + ' ', 'padding:2px;border-radius:20px;color:#fff;background:#26c0d3', '\n' + message + '\nVisit documentation page to learn more: https://www.notiflix.com/documentation');
};
// Notiflix: Console Log off
// Notiflix: Main on
var newNotifySettings;
var newReportSettings;
var newConfirmSettings;
var newLoadingSettings;
var newBlockSettings;
var Notiflix = {
// Notify on
Notify: {
// Init
Init: function (userNotifyOpt) {
// extend options
newNotifySettings = extendNotiflix(true, notifySettings, userNotifyOpt);
// use GoogleFonts if "Quicksand"
notiflixGoogleFont(newNotifySettings.useGoogleFont, newNotifySettings.fontFamily);
},
// Merge First Init
Merge: function (userNotifyExtend) {
// if initialized already
if (newNotifySettings) {
newNotifySettings = extendNotiflix(true, newNotifySettings, userNotifyExtend);
}
// initialize first
else {
notiflixConsoleError('Notiflix Error', 'You have to initialize the Notify module before call Merge function.');
return false;
}
},
// Display Notification: Success
Success: function (message, callback) {
// if not initialized pretend like init
if (!newNotifySettings) {
Notiflix.Notify.Init({});
}
var theType = newNotifySettings.success;
NotiflixNotify(message, callback, theType, 'Success');
},
// Display Notification: Failure
Failure: function (message, callback) {
// if not initialized pretend like init
if (!newNotifySettings) {
Notiflix.Notify.Init({});
}
var theType = newNotifySettings.failure;
NotiflixNotify(message, callback, theType, 'Failure');
},
// Display Notification: Warning
Warning: function (message, callback) {
// if not initialized pretend like init
if (!newNotifySettings) {
Notiflix.Notify.Init({});
}
var theType = newNotifySettings.warning;
NotiflixNotify(message, callback, theType, 'Warning');
},
// Display Notification: Info
Info: function (message, callback) {
// if not initialized pretend like init
if (!newNotifySettings) {
Notiflix.Notify.Init({});
}
var theType = newNotifySettings.info;
NotiflixNotify(message, callback, theType, 'Info');
},
},
// Notify off
// Report on
Report: {
// Init
Init: function (userReportOpt) {
// extend options
newReportSettings = extendNotiflix(true, reportSettings, userReportOpt);
// use GoogleFonts if "Quicksand"
notiflixGoogleFont(newReportSettings.useGoogleFont, newReportSettings.fontFamily);
},
// Merge First Init
Merge: function (userReportExtend) {
// if initialized already
if (newReportSettings) {
newReportSettings = extendNotiflix(true, newReportSettings, userReportExtend);
}
// initialize first
else {
notiflixConsoleError('Notiflix Error', 'You have to initialize the Report module before call Merge function.');
return false;
}
},
// Display Report: Success
Success: function (title, message, buttonText, buttonCallback) {
// if not initialized pretend like init
if (!newReportSettings) {
Notiflix.Report.Init({});
}
var theType = newReportSettings.success;
NotiflixReport(title, message, buttonText, buttonCallback, theType, 'Success');
},
// Display Report: Failure
Failure: function (title, message, buttonText, buttonCallback) {
// if not initialized pretend like init
if (!newReportSettings) {
Notiflix.Report.Init({});
}
var theType = newReportSettings.failure;
NotiflixReport(title, message, buttonText, buttonCallback, theType, 'Failure');
},
// Display Report: Warning
Warning: function (title, message, buttonText, buttonCallback) {
// if not initialized pretend like init
if (!newReportSettings) {
Notiflix.Report.Init({});
}
var theType = newReportSettings.warning;
NotiflixReport(title, message, buttonText, buttonCallback, theType, 'Warning');
},
// Display Report: Info
Info: function (title, message, buttonText, buttonCallback) {
// if not initialized pretend like init
if (!newReportSettings) {
Notiflix.Report.Init({});
}
var theType = newReportSettings.info;
NotiflixReport(title, message, buttonText, buttonCallback, theType, 'Info');
},
},
// Report off
// Confirm on
Confirm: {
// Init
Init: function (userConfirmOpt) {
// extend options
newConfirmSettings = extendNotiflix(true, confirmSettings, userConfirmOpt);
// use GoogleFonts if "Quicksand"
notiflixGoogleFont(newConfirmSettings.useGoogleFont, newConfirmSettings.fontFamily);
},
// Merge First Init
Merge: function (userConfirmExtend) {
// if initialized already
if (newConfirmSettings) {
newConfirmSettings = extendNotiflix(true, newConfirmSettings, userConfirmExtend);
}
// initialize first
else {
notiflixConsoleError('Notiflix Error', 'You have to initialize the Confirm module before call Merge function.');
return false;
}
},
// Display Confirm: Show
Show: function (title, message, okText, cancelText, okCallback, cancelCallback) {
if (!title) { title = 'Notiflix Confirm'; }
if (!message) { message = 'Do you agree with me?'; }
if (!okText) { okText = 'Yes'; }
if (!cancelText) { cancelText = 'No'; }
if (!okCallback) { okCallback = undefined; }
if (!cancelCallback) { cancelCallback = undefined; }
NotiflixConfirm(title, message, okText, cancelText, okCallback, cancelCallback);
},
},
// Confirm off
// Loading on
Loading: {
// Init
Init: function (userLoadingOpt) {
// extend options
newLoadingSettings = extendNotiflix(true, loadingSettings, userLoadingOpt);
// use GoogleFonts if "Quicksand"
notiflixGoogleFont(newLoadingSettings.useGoogleFont, newLoadingSettings.fontFamily);
},
// Merge First Init
Merge: function (userLoadingExtend) {
// if initialized already
if (newLoadingSettings) {
newLoadingSettings = extendNotiflix(true, newLoadingSettings, userLoadingExtend);
}
// initialize first
else {
notiflixConsoleError('Notiflix Error', 'You have to initialize the Loading module before call Merge function.');
return false;
}
},
// Display Loading: Standard
Standard: function (message) {
NotiflixLoading(message, 'standard', true, 0); // true => display || 0 => delay
},
// Display Loading: Hourglass
Hourglass: function (message) {
NotiflixLoading(message, 'hourglass', true, 0); // true => display || 0 => delay
},
// Display Loading: Circle
Circle: function (message) {
NotiflixLoading(message, 'circle', true, 0); // true => display || 0 => delay
},
// Display Loading: Arrows
Arrows: function (message) {
NotiflixLoading(message, 'arrows', true, 0); // true => display || 0 => delay
},
// Display Loading: Dots
Dots: function (message) {
NotiflixLoading(message, 'dots', true, 0); // true => display || 0 => delay
},
// Display Loading: Pulse
Pulse: function (message) {
NotiflixLoading(message, 'pulse', true, 0); // true => display || 0 => delay
},
// Display Loading: Custom
Custom: function (message) {
NotiflixLoading(message, 'custom', true, 0); // true => display || 0 => delay
},
// Display Loading: Notiflix
Notiflix: function (message) {
NotiflixLoading(message, 'notiflix', true, 0); // true => display || 0 => delay
},
// Remove Loading
Remove: function (theDelay) {
if (!theDelay) { theDelay = 0; }
NotiflixLoading(false, false, false, theDelay); // false = Remove
},
// Change The Message
Change: function (newMessage) {
NotiflixLoadingChange(newMessage);
},
},
// Loading off
// Block on
Block: {
// Initialize
Init: function (userBlockOpt) {
// extend options
newBlockSettings = extendNotiflix(true, blockSettings, userBlockOpt);
// use GoogleFonts if "Quicksand"
notiflixGoogleFont(newBlockSettings.useGoogleFont, newBlockSettings.fontFamily);
},
// Merge First Initialize
Merge: function (userBlockExtend) {
// if initialized already
if (newBlockSettings) {
newBlockSettings = extendNotiflix(true, newBlockSettings, userBlockExtend);
}
// initialize first
else {
notiflixConsoleError('Notiflix Error', 'You have to initialize the "Notiflix.Block" module before call Merge function.');
return false;
}
},
// Display Block: Standard
Standard: function (selector, message) {
var block = true;
var theIcon = 'standard';
NotiflixBlockUnblockElement(block, selector, theIcon, message);
},
// Display Block: Hourglass
Hourglass: function (selector, message) {
var block = true;
var theIcon = 'hourglass';
NotiflixBlockUnblockElement(block, selector, theIcon, message);
},
// Display Block: Circle
Circle: function (selector, message) {
var block = true;
var theIcon = 'circle';
NotiflixBlockUnblockElement(block, selector, theIcon, message);
},
// Display Block: Arrows
Arrows: function (selector, message) {
var block = true;
var theIcon = 'arrows';
NotiflixBlockUnblockElement(block, selector, theIcon, message);
},
// Display Block: Dots
Dots: function (selector, message) {
var block = true;
var theIcon = 'dots';
NotiflixBlockUnblockElement(block, selector, theIcon, message);
},
// Display Block: Pulse
Pulse: function (selector, message) {
var block = true;
var theIcon = 'pulse';
NotiflixBlockUnblockElement(block, selector, theIcon, message);
},
// Remove Block
Remove: function (selector, delay) {
var block = false;
var theIcon = null;
var message = null;
NotiflixBlockUnblockElement(block, selector, theIcon, message, delay);
},
},
// Block off
};
// Notiflix: Main off
// Notiflix: Notify Single on
var notiflixNotifyCount = 0;
var NotiflixNotify = function (message, callback, theType, staticType) {
if (arguments && arguments.length === 4) {
// notify counter on
notiflixNotifyCount++;
// notify counter off
// if no message on
if (!message) {
message = 'Notiflix ' + staticType;
}
// if no message off
// if plainText true = HTML tags not allowed on
if (newNotifySettings.plainText) {
message = notiflixPlaintext(message); // message plain text
}
// if plainText true = HTML tags not allowed off
// if plainText false but the message length more than messageMaxLength = HTML tags error on
if (!newNotifySettings.plainText && message.length > newNotifySettings.messageMaxLength) {
Notiflix.Notify.Merge({ closeButton: true, plainText: false, });
message = 'HTML Tags Error: Your content length is more than "messageMaxLength" option.'; // message html error
}
// if plainText false but the message length more than messageMaxLength = HTML tags error off
// message max length substring on
if (message.length > newNotifySettings.messageMaxLength) {
message = message.substring(0, newNotifySettings.messageMaxLength) + '...';
}
// message max length substring off
// font awesome icon style on
if (newNotifySettings.fontAwesomeIconStyle === 'shadow') {
theType.fontAwesomeIconColor = theType.background;
}
// font awesome icon style off
// if cssAnimaion false -> duration on
if (!newNotifySettings.cssAnimation) {
newNotifySettings.cssAnimationDuration = 0;
}
// if cssAnimaion false -> duration off
// notify wrap on
var docBody = document.body;
var ntflxNotifyWrap = document.createElement('div');
ntflxNotifyWrap.id = notifySettings.wrapID;
ntflxNotifyWrap.style.width = newNotifySettings.width;
ntflxNotifyWrap.style.zIndex = newNotifySettings.zindex;
ntflxNotifyWrap.style.opacity = newNotifySettings.opacity;
// wrap position on
if (newNotifySettings.position === 'right-bottom') {
ntflxNotifyWrap.style.right = newNotifySettings.distance;
ntflxNotifyWrap.style.bottom = newNotifySettings.distance;
ntflxNotifyWrap.style.top = 'auto';
ntflxNotifyWrap.style.left = 'auto';
} else if (newNotifySettings.position === 'left-top') {
ntflxNotifyWrap.style.left = newNotifySettings.distance;
ntflxNotifyWrap.style.top = newNotifySettings.distance;
ntflxNotifyWrap.style.right = 'auto';
ntflxNotifyWrap.style.bottom = 'auto';
} else if (newNotifySettings.position === 'left-bottom') {
ntflxNotifyWrap.style.left = newNotifySettings.distance;
ntflxNotifyWrap.style.bottom = newNotifySettings.distance;
ntflxNotifyWrap.style.top = 'auto';
ntflxNotifyWrap.style.right = 'auto';
} else { // 'right-top' or else
ntflxNotifyWrap.style.right = newNotifySettings.distance;
ntflxNotifyWrap.style.top = newNotifySettings.distance;
ntflxNotifyWrap.style.left = 'auto';
ntflxNotifyWrap.style.bottom = 'auto';
}
// wrap position off
// if background overlay true on
var notifyOverlay;
if (newNotifySettings.backOverlay) {
notifyOverlay = document.createElement('div');
notifyOverlay.id = newNotifySettings.ID + 'Overlay';
notifyOverlay.style.width = '100%';
notifyOverlay.style.height = '100%';
notifyOverlay.style.position = 'fixed';
notifyOverlay.style.zIndex = newNotifySettings.zindex;
notifyOverlay.style.left = 0;
notifyOverlay.style.top = 0;
notifyOverlay.style.right = 0;
notifyOverlay.style.bottom = 0;
notifyOverlay.style.background = newNotifySettings.backOverlayColor;
notifyOverlay.className = (newNotifySettings.cssAnimation ? 'with-animation' : '');
notifyOverlay.style.animationDuration = (newNotifySettings.cssAnimation) ? newNotifySettings.cssAnimationDuration + 'ms' : '';
if (!document.getElementById(notifyOverlay.id)) {
docBody.appendChild(notifyOverlay);
}
}
// if background overlay true off
if (!document.getElementById(ntflxNotifyWrap.id)) {
docBody.appendChild(ntflxNotifyWrap);
}
// notify wrap off
// notify content on
var ntflxNotify = document.createElement('div');
ntflxNotify.id = newNotifySettings.ID + '-' + notiflixNotifyCount;
ntflxNotify.className = newNotifySettings.className + ' ' + theType.childClassName + ' ' + (newNotifySettings.cssAnimation ? 'with-animation' : '') + ' ' + (newNotifySettings.useIcon ? 'with-icon' : '') + ' nx-' + newNotifySettings.cssAnimationStyle + ' ' + (newNotifySettings.closeButton && !callback ? 'with-close-button' : '') + ' ' + (callback && typeof callback === 'function' ? 'with-callback' : '') + ' ' + (newNotifySettings.clickToClose ? 'click-to-close' : '');
ntflxNotify.style.fontSize = newNotifySettings.fontSize;
ntflxNotify.style.color = theType.textColor;
ntflxNotify.style.background = theType.background;
ntflxNotify.style.borderRadius = newNotifySettings.borderRadius;
// rtl on
if (newNotifySettings.rtl) {
ntflxNotify.setAttribute('dir', 'rtl');
ntflxNotify.classList.add('rtl-on');
}
// rtl off
// font-family on
ntflxNotify.style.fontFamily = '"' + newNotifySettings.fontFamily + '"' + ', sans-serif';
// font-family off
// use css animation on
if (newNotifySettings.cssAnimation) {
ntflxNotify.style.animationDuration = newNotifySettings.cssAnimationDuration + 'ms';
}
// use css animation off
// close button element on
var closeButtonHTML = '';
if (newNotifySettings.closeButton && !callback) {
closeButtonHTML = '';
}
// close buttpon element off
// use icon on
if (newNotifySettings.useIcon) {
// use font awesome
if (newNotifySettings.useFontAwesome) {
ntflxNotify.innerHTML = '
- Albert Einstein';
}
else if (staticType === 'Failure') {
message = '"Failure is simply the opportunity to begin again, this time more intelligently."
- Henry Ford';
}
else if (staticType === 'Warning') {
message = '"The peoples who want to live comfortably without producing and fatigue; they are doomed to lose their dignity, then liberty, and then independence and destiny."
- Mustafa Kemal Ataturk';
}
else if (staticType === 'Info') {
message = '"Knowledge rests not upon truth alone, but upon error also."
- Carl Gustav Jung';
}
}
if (!buttonText) { buttonText = 'Okay'; }
if (!buttonCallback) { buttonCallback = undefined; }
// check the arguments off
// if plainText true = HTML tags not allowed on
if (newReportSettings.plainText) {
title = notiflixPlaintext(title);
message = notiflixPlaintext(message);
buttonText = notiflixPlaintext(buttonText);
}
// if plainText true = HTML tags not allowed off
// if plainText false but the contents length more than *MaxLength = HTML tags error on
if (!newReportSettings.plainText) {
if (title.length > newReportSettings.titleMaxLength) {
title = 'HTML Tags Error'; // title html error
message = 'Your Title content length is more than "titleMaxLength" option.'; // message html error
buttonText = 'Okay'; // button html error
}
if (message.length > newReportSettings.messageMaxLength) {
title = 'HTML Tags Error'; // title html error
message = 'Your Message content length is more than "messageMaxLength" option.'; // message html error
buttonText = 'Okay'; // button html error
}
if (buttonText.length > newReportSettings.buttonMaxLength) {
title = 'HTML Tags Error'; // title html error
message = 'Your Button content length is more than "buttonMaxLength" option.'; // message html error
buttonText = 'Okay'; // button html error
}
}
// if plainText false but the contents length more than *MaxLength = HTML tags error off
// max length on
if (title.length > newReportSettings.titleMaxLength) {
title = title.substring(0, newReportSettings.titleMaxLength) + '...';
}
if (message.length > newReportSettings.messageMaxLength) {
message = message.substring(0, newReportSettings.messageMaxLength) + '...';
}
if (buttonText.length > newReportSettings.buttonMaxLength) {
buttonText = buttonText.substring(0, newReportSettings.buttonMaxLength) + '...';
}
// max length off
// if cssAnimaion false -> duration on
if (!newReportSettings.cssAnimation) {
newReportSettings.cssAnimationDuration = 0;
}
// if cssAnimaion false -> duration off
// report wrap on
var docBody = document.body;
var ntflxReportWrap = document.createElement('div');
ntflxReportWrap.id = reportSettings.ID;
ntflxReportWrap.className = newReportSettings.className;
ntflxReportWrap.style.width = newReportSettings.width;
ntflxReportWrap.style.zIndex = newReportSettings.zindex;
ntflxReportWrap.style.borderRadius = newReportSettings.borderRadius;
ntflxReportWrap.style.fontFamily = '"' + newReportSettings.fontFamily + '"' + ', sans-serif';
// rtl on
if (newReportSettings.rtl) {
ntflxReportWrap.setAttribute('dir', 'rtl');
ntflxReportWrap.classList.add('rtl-on');
}
// rtl off
// overlay on
var reportOverlay = '';
if (newReportSettings.backOverlay) {
reportOverlay = '
' + message + '
' + '