1/* Minification failed. Returning unminified contents. 2(562,6): run-time error JS1004: Expected ';' 3(565,21): run-time error JS1004: Expected ';' 4(823,9-12): run-time error JS1009: Expected '}': ... 5(825,7-8): run-time error JS1195: Expected expression: } 6(826,7-11): run-time error JS1010: Expected identifier: this 7(826,32-33): run-time error JS1008: Expected '{': ; 8(1042,11-14): run-time error JS1009: Expected '}': ... 9(1045,9-10): run-time error JS1195: Expected expression: } 10(1045,10-11): run-time error JS1006: Expected ')': ; 11(1058,8-9): run-time error JS1010: Expected identifier: ) 12(1058,9-10): run-time error JS1005: Expected '(': ; 13(1058,9-10): run-time error JS1008: Expected '{': ; 14(1450,11-12): run-time error JS1010: Expected identifier: . 15(1450,11-12): run-time error JS1195: Expected expression: . 16(734,7,736,8): run-time error JS1314: Implicit property name must be identifier: triggerTransitionEnd(element) { 17 $(element).trigger(TRANSITION_END); 18 } 19(738,7,740,8): run-time error JS1314: Implicit property name must be identifier: supportsTransitionEnd() { 20 return Boolean(TRANSITION_END); 21 } 22(747,9,755,10): run-time error JS1314: Implicit property name must be identifier: handle(event) { 23 if ($(event.target).is(this)) { 24 return event 25 .handleObj 26 .handler 27 .apply(this, arguments); // eslint-disable-line prefer-rest-params 28 } 29 return undefined; 30 } 31(1048,11-15): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: data 32(738,7,740,8): run-time error JS1292: Strict-mode does not allow duplicate property names: supportsTransitionEnd() { 33 return Boolean(TRANSITION_END); 34 } 35 */ 36/* 37 * Toastr 38 * Copyright 2012-2015 39 * Authors: John Papa, Hans Fjällemark, and Tim Ferrell. 40 * All Rights Reserved. 41 * Use, reproduction, distribution, and modification of this code is subject to the terms and 42 * conditions of the MIT license, available at http://www.opensource.org/licenses/mit-license.php 43 * 44 * ARIA Support: Greta Krafsig 45 * 46 * Project: https://github.com/CodeSeven/toastr 47 */ 48/* global define */ 49(function (define) { 50 define(['jquery'], function ($) { 51 return (function () { 52 var $container; 53 var listener; 54 var toastId = 0; 55 var toastType = { 56 error: 'error', 57 info: 'info', 58 success: 'success', 59 warning: 'warning' 60 }; 61 62 var toastr = { 63 clear: clear, 64 remove: remove, 65 error: error, 66 getContainer: getContainer, 67 info: info, 68 options: {}, 69 subscribe: subscribe, 70 success: success, 71 version: '2.1.4', 72 warning: warning 73 }; 74 75 var previousToast; 76 77 return toastr; 78
vendor: 12,696 bytes, lines 79-410
79 //////////////// 80 81 function error(message, title, optionsOverride) { 82 return notify({ 83 type: toastType.error, 84 iconClass: getOptions().iconClasses.error, 85 message: message, 86 optionsOverride: optionsOverride, 87 title: title 88 }); 89 } 90 91 function getContainer(options, create) { 92 if (!options) { options = getOptions(); } 93 $container = $('#' + options.containerId); 94 if ($container.length) { 95 return $container; 96 } 97 if (create) { 98 $container = createContainer(options); 99 } 100 return $container; 101 } 102 103 function info(message, title, optionsOverride) { 104 return notify({ 105 type: toastType.info, 106 iconClass: getOptions().iconClasses.info, 107 message: message, 108 optionsOverride: optionsOverride, 109 title: title 110 }); 111 } 112 113 function subscribe(callback) { 114 listener = callback; 115 } 116 117 function success(message, title, optionsOverride) { 118 return notify({ 119 type: toastType.success, 120 iconClass: getOptions().iconClasses.success, 121 message: message, 122 optionsOverride: optionsOverride, 123 title: title 124 }); 125 } 126 127 function warning(message, title, optionsOverride) { 128 return notify({ 129 type: toastType.warning, 130 iconClass: getOptions().iconClasses.warning, 131 message: message, 132 optionsOverride: optionsOverride, 133 title: title 134 }); 135 } 136 137 function clear($toastElement, clearOptions) { 138 var options = getOptions(); 139 if (!$container) { getContainer(options); } 140 if (!clearToast($toastElement, options, clearOptions)) { 141 clearContainer(options); 142 } 143 } 144 145 function remove($toastElement) { 146 var options = getOptions(); 147 if (!$container) { getContainer(options); } 148 if ($toastElement && $(':focus', $toastElement).length === 0) { 149 removeToast($toastElement); 150 return; 151 } 152 if ($container.children().length) { 153 $container.remove(); 154 } 155 } 156 157 // internal functions 158 159 function clearContainer (options) { 160 var toastsToClear = $container.children(); 161 for (var i = toastsToClear.length - 1; i >= 0; i--) { 162 clearToast($(toastsToClear[i]), options); 163 } 164 } 165 166 function clearToast ($toastElement, options, clearOptions) { 167 var force = clearOptions && clearOptions.force ? clearOptions.force : false; 168 if ($toastElement && (force || $(':focus', $toastElement).length === 0)) { 169 $toastElement[options.hideMethod]({ 170 duration: options.hideDuration, 171 easing: options.hideEasing, 172 complete: function () { removeToast($toastElement); } 173 }); 174 return true; 175 } 176 return false; 177 } 178 179 function createContainer(options) { 180 $container = $('<div/>') 181 .attr('id', options.containerId) 182 .addClass(options.positionClass); 183 184 $container.appendTo($(options.target)); 185 return $container; 186 } 187 188 function getDefaults() { 189 return { 190 tapToDismiss: true, 191 toastClass: 'toast', 192 containerId: 'toast-container', 193 debug: false, 194 195 showMethod: 'fadeIn', //fadeIn, slideDown, and show are built into jQuery 196 showDuration: 300, 197 showEasing: 'swing', //swing and linear are built into jQuery 198 onShown: undefined, 199 hideMethod: 'fadeOut', 200 hideDuration: 1000, 201 hideEasing: 'swing', 202 onHidden: undefined, 203 closeMethod: false, 204 closeDuration: false, 205 closeEasing: false, 206 closeOnHover: true, 207 208 extendedTimeOut: 1000, 209 iconClasses: { 210 error: 'toast-error', 211 info: 'toast-info', 212 success: 'toast-success', 213 warning: 'toast-warning' 214 }, 215 iconClass: 'toast-info', 216 positionClass: 'toast-top-right', 217 timeOut: 5000, // Set timeOut and extendedTimeOut to 0 to make it sticky 218 titleClass: 'toast-title', 219 messageClass: 'toast-message', 220 escapeHtml: false, 221 target: 'body', 222 closeHtml: '<button type="button">×</button>', 223 closeClass: 'toast-close-button', 224 newestOnTop: true, 225 preventDuplicates: false, 226 progressBar: false, 227 progressClass: 'toast-progress', 228 rtl: false 229 }; 230 } 231 232 function publish(args) { 233 if (!listener) { return; } 234 listener(args); 235 } 236 237 function notify(map) { 238 var options = getOptions(); 239 var iconClass = map.iconClass || options.iconClass; 240 241 if (typeof (map.optionsOverride) !== 'undefined') { 242 options = $.extend(options, map.optionsOverride); 243 iconClass = map.optionsOverride.iconClass || iconClass; 244 } 245 246 if (shouldExit(options, map)) { return; } 247 248 toastId++; 249 250 $container = getContainer(options, true); 251 252 var intervalId = null; 253 var $toastElement = $('<div/>'); 254 var $titleElement = $('<div/>'); 255 var $messageElement = $('<div/>'); 256 var $progressElement = $('<div/>'); 257 var $closeElement = $(options.closeHtml); 258 var progressBar = { 259 intervalId: null, 260 hideEta: null, 261 maxHideTime: null 262 }; 263 var response = { 264 toastId: toastId, 265 state: 'visible', 266 startTime: new Date(), 267 options: options, 268 map: map 269 }; 270 271 personalizeToast(); 272 273 displayToast(); 274 275 handleEvents(); 276 277 publish(response); 278 279 if (options.debug && console) { 280 console.log(response); 281 } 282 283 return $toastElement; 284 285 function escapeHtml(source) { 286 if (source == null) { 287 source = ''; 288 } 289 290 return source 291 .replace(/&/g, '&') 292 .replace(/"/g, '"') 293 .replace(/'/g, ''') 294 .replace(/</g, '<') 295 .replace(/>/g, '>'); 296 } 297 298 function personalizeToast() { 299 setIcon(); 300 setTitle(); 301 setMessage(); 302 setCloseButton(); 303 setProgressBar(); 304 setRTL(); 305 setSequence(); 306 setAria(); 307 } 308 309 function setAria() { 310 var ariaValue = ''; 311 switch (map.iconClass) { 312 case 'toast-success': 313 case 'toast-info': 314 ariaValue = 'polite'; 315 break; 316 default: 317 ariaValue = 'assertive'; 318 } 319 $toastElement.attr('aria-live', ariaValue); 320 } 321 322 function handleEvents() { 323 if (options.closeOnHover) { 324 $toastElement.hover(stickAround, delayedHideToast); 325 } 326 327 if (!options.onclick && options.tapToDismiss) { 328 $toastElement.click(hideToast); 329 } 330 331 if (options.closeButton && $closeElement) { 332 $closeElement.click(function (event) { 333 if (event.stopPropagation) { 334 event.stopPropagation(); 335 } else if (event.cancelBubble !== undefined && event.cancelBubble !== true) { 336 event.cancelBubble = true; 337 } 338 339 if (options.onCloseClick) { 340 options.onCloseClick(event); 341 } 342 343 hideToast(true); 344 }); 345 } 346 347 if (options.onclick) { 348 $toastElement.click(function (event) { 349 options.onclick(event); 350 hideToast(); 351 }); 352 } 353 } 354 355 function displayToast() { 356 $toastElement.hide(); 357 358 $toastElement[options.showMethod]( 359 {duration: options.showDuration, easing: options.showEasing, complete: options.onShown} 360 ); 361 362 if (options.timeOut > 0) { 363 intervalId = setTimeout(hideToast, options.timeOut); 364 progressBar.maxHideTime = parseFloat(options.timeOut); 365 progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime; 366 if (options.progressBar) { 367 progressBar.intervalId = setInterval(updateProgress, 10); 368 } 369 } 370 } 371 372 function setIcon() { 373 if (map.iconClass) { 374 $toastElement.addClass(options.toastClass).addClass(iconClass); 375 } 376 } 377 378 function setSequence() { 379 if (options.newestOnTop) { 380 $container.prepend($toastElement); 381 } else { 382 $container.append($toastElement); 383 } 384 } 385 386 function setTitle() { 387 if (map.title) { 388 var suffix = map.title; 389 if (options.escapeHtml) { 390 suffix = escapeHtml(map.title); 391 } 392 $titleElement.append(suffix).addClass(options.titleClass); 393 $toastElement.append($titleElement); 394 } 395 } 396 397 function setMessage() { 398 if (map.message) { 399 var suffix = map.message; 400 if (options.escapeHtml) { 401 suffix = escapeHtml(map.message); 402 } 403 $messageElement.append(suffix).addClass(options.messageClass); 404 $toastElement.append($messageElement); 405 } 406 } 407 408 function setCloseButton() { 409 if (options.closeButton) { 410 $closeElement.addClass(options.closeClass).attr('role', 'button');
411 $toastElement.prepend($closeElement); 412 } 413 } 414 415 function setProgressBar() { 416 if (options.progressBar) { 417 $progressElement.addClass(options.progressClass); 418 $toastElement.prepend($progressElement); 419 } 420 } 421 422 function setRTL() { 423 if (options.rtl) { 424 $toastElement.addClass('rtl'); 425 } 426 } 427 428 function shouldExit(options, map) { 429 if (options.preventDuplicates) { 430 if (map.message === previousToast) { 431 return true; 432 } else { 433 previousToast = map.message; 434 } 435 } 436 return false; 437 } 438 439 function hideToast(override) { 440 var method = override && options.closeMethod !== false ? options.closeMethod : options.hideMethod; 441 var duration = override && options.closeDuration !== false ? 442 options.closeDuration : options.hideDuration; 443 var easing = override && options.closeEasing !== false ? options.closeEasing : options.hideEasing; 444 if ($(':focus', $toastElement).length && !override) { 445 return; 446 } 447 clearTimeout(progressBar.intervalId); 448 return $toastElement[method]({ 449 duration: duration, 450 easing: easing, 451 complete: function () { 452 removeToast($toastElement); 453 clearTimeout(intervalId); 454 if (options.onHidden && response.state !== 'hidden') { 455 options.onHidden(); 456 } 457 response.state = 'hidden'; 458 response.endTime = new Date(); 459 publish(response); 460 } 461 }); 462 } 463 464 function delayedHideToast() { 465 if (options.timeOut > 0 || options.extendedTimeOut > 0) { 466 intervalId = setTimeout(hideToast, options.extendedTimeOut); 467 progressBar.maxHideTime = parseFloat(options.extendedTimeOut); 468 progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime; 469 } 470 } 471 472 function stickAround() { 473 clearTimeout(intervalId); 474 progressBar.hideEta = 0; 475 $toastElement.stop(true, true)[options.showMethod]( 476 {duration: options.showDuration, easing: options.showEasing} 477 ); 478 } 479 480 function updateProgress() { 481 var percentage = ((progressBar.hideEta - (new Date().getTime())) / progressBar.maxHideTime) * 100; 482 $progressElement.width(percentage + '%'); 483 } 484 } 485 486 function getOptions() { 487 return $.extend({}, getDefaults(), toastr.options); 488 } 489 490 function removeToast($toastElement) { 491 if (!$container) { $container = getContainer(); } 492 if ($toastElement.is(':visible')) { 493 return; 494 } 495 $toastElement.remove(); 496 $toastElement = null; 497 if ($container.children().length === 0) { 498 $container.remove(); 499 previousToast = undefined; 500 } 501 } 502 503 })(); 504 }); 505}(typeof define === 'function' && define.amd ? define : function (deps, factory) { 506 if (typeof module !== 'undefined' && module.exports) { //Node 507 module.exports = factory(require('jquery')); 508 } else { 509 window.toastr = factory(window.jQuery); 510 } 511})); 512; 513function formatDate(dateToFormat) { 514 if (!dateToFormat) { 515 return; 516 } 517 if (dateToFormat.length > 10) { 518 dateToFormat = dateToFormat.substring(0, 10); 519 dateToFormat = dateToFormat.replace(/-/g, '/'); 520 } 521 dateToFormat = new Date(dateToFormat); 522 if (isNaN(dateToFormat)) { 523 //Do something 524 } 525 return kendo.toString(dateToFormat, "d MMM yyyy"); 526}; 527 528function formatDateTime(dateToFormat) { 529 if (!dateToFormat) { 530 return; 531 } 532 if (dateToFormat.length > 10) { 533 dateToFormat = dateToFormat.substring(0, 10); 534 dateToFormat = dateToFormat.replace(/-/g, '/'); 535 } 536 dateToFormat = new Date(dateToFormat); 537 if (isNaN(dateToFormat)) { 538 //Do something 539 } 540 return kendo.toString(dateToFormat, "d MMM yyyy HH:mm:ss"); 541}; 542 543function emptyGrid(e) { 544 var grid = e.sender; 545 if (grid.dataSource.total() == 0) { 546 var colCount = grid.columns.length; 547 $(e.sender.wrapper) 548 .find('tbody') 549 .append('<tr class="kendo-data-row"><td colspan="' + colCount + '" class="no-data">There is no data available for the current selection criteria.</td></tr>'); 550 } 551 else return; 552}; 553 554 555toastr.options = { 556 "closeButton": true, 557 "debug": false, 558 "newestOnTop": false, 559 "progressBar": false, 560 "positionClass": "toast-top-center", 561 "preventDuplicates": false, 562 "showDuration": "300", 563 "hideDuration": "0", 564 "timeOut": "0", 565 "extendedTimeOut": "0", 566 "showEasing": "swing", 567 "showMethod": "fadeIn" 568} 569 570Date.prototype.addDays = function (days) { 571 var dat = new Date(this.valueOf()); 572 dat.setDate(dat.getDate() + days); 573 return dat; 574} 575 576function DatePickerById(id, previous) { 577 $("#" + id).kendoDatePicker({ 578 format: "dd MMM yyyy", 579 value: previous == null ? new Date() : new Date().addDays(previous) 580 }); 581} 582 583 584function pinMenuToggle() { 585 if (!window.matchMedia('(max-width: 767px)').matches) { 586 if ($("#wrapper").hasClass("pinned")) { 587 //unpin menu 588 unpinMenu(); 589 } else { 590 //pin menu 591 pinMenu(); 592 } 593 refreshPage(); 594 } 595} 596 597async function refreshMenuTree() { 598 kendo.ui.progress($("#sidebar-wrapper"), true); 599 600 var result = await $.ajax({
601 url: "/Menu/RefreshMenuTree" 602 }); 603 604 if (result == "Success") { 605 $.ajax({ 606 url: "/Home/Index" 607 }).done(function (data) { 608 609 $("#treeviewMenu").data("kendoTreeView").dataSource.read(); 610 }) 611 } 612 613} 614 615function changeMenuStyle(style) { 616 617 618 if (!window.matchMedia('(max-width: 767px)').matches) { 619 var claimUpdateUrl = "/Account/UpdateUserAttributes?attributeName=MenuStyle&attributeValue=" + style; 620 $.ajax({ 621 type: "POST", 622 url: claimUpdateUrl 623 }) 624 } 625} 626 627function refreshPage() { 628 if ($("#top").length > 0) { 629 $("#top").data("kendoSplitter").resize(); 630 } 631 if ($("#scheduler").length > 0) { 632 $("#scheduler").data("kendoScheduler").resize(); 633 } 634 refreshKendoCharts(); 635 refreshKendoRadialGauges(); 636 refreshKendoSparkLine(); 637} 638 639function pinMenu() { 640 if (window.matchMedia('(min-width: 768px)').matches) { 641 $("#sidebar-wrapper").unbind("mouseenter"); 642 $("#sidebar-wrapper").unbind("mouseleave"); 643 $("#wrapper").removeClass("active-menu"); 644 $("#wrapper").addClass("pinned"); 645 $("#page-wrapper").css("padding-left", "11%"); 646 $("#pinIcon").removeClass("fa-rotate-90"); 647 refreshPage(); 648 } 649} 650 651function unpinMenu() { 652 if (window.matchMedia('(min-width: 768px)').matches) { 653 654 $("#sidebar-wrapper").bind("mouseenter", mouseEnter); 655 $("#sidebar-wrapper").bind("mouseleave", mouseLeave); 656 $("#wrapper").removeClass("pinned"); 657 $("#page-wrapper").css("padding-left", "0px"); 658 $("#pinIcon").addClass("fa-rotate-90"); 659 660 if ($("#wrapper").hasClass("pinned") == false) { 661 $("#wrapper").toggleClass("active-menu"); 662 } 663 refreshPage(); 664 } 665} 666 667function refreshKendoCharts() { $(".k-chart").each(function (index, element) { $('#' + element.id).data('kendoChart').refresh(); }); } 668function refreshKendoRadialGauges() { $(".k-gauge").each(function (index, element) { $('#' + element.id).data('kendoRadialGauge').redraw(); }); } 669function refreshKendoSparkLine() { $(".k-sparkline").each(function (index, element) { $('#' + element.id).data('kendoSparkline').refresh(); }); } 670function get_browser() { 671 var N = navigator.appName, ua = navigator.userAgent, tem; 672 var M = ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i); 673 if (M && (tem = ua.match(/version\/([\.\d]+)/i)) != null) M[2] = tem[1]; 674 M = M ? [M[1], M[2]] : [N, navigator.appVersion, '-?']; 675 return M[0]; 676}; 677 678 679function get_browser_version() { 680 var N = navigator.appName, ua = navigator.userAgent, tem; 681 var M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*([\d\.]+)/i) || []; 682 683 if (/trident/i.test(M[1])) { 684 tem = /\brv[ :]+(\d+(\.\d+)?)/g.exec(ua) || []; 685 return (tem[1] || ''); 686 } 687 688 if (M && (tem = ua.match(/version\/([\.\d]+)/i)) != null) M[2] = tem[1]; 689 M = M ? [M[1], M[2]] : [N, navigator.appVersion, '-?']; 690 return M[1]; 691}; 692function get_browser_details() { 693 694 var NUM_CHARS_TO_SLICE = 4; 695 var FIREFOX_MINIMUM_VERSION = 55; 696 var CHROME_MINIMUM_VERSION = 77; 697 var MSIE_MINIMUM_VERSION = 12; 698 699 var browser = get_browser(); 700 var unslicedBrowserVersion = get_browser_version(); 701 var browser_version = unslicedBrowserVersion.slice(0, NUM_CHARS_TO_SLICE); 702 var supportedBrowserVersion = false; 703 var supportedBrowser = false; 704 705 var browserDetails = browser + " " + unslicedBrowserVersion; 706 707 if (browser == "Firefox") { 708 supportedBrowser = true; 709 if (browser_version >= FIREFOX_MINIMUM_VERSION) { 710 supportedBrowserVersion = true; 711 } 712 } 713 else 714 if (browser == "Chrome") { 715 supportedBrowser = true; 716 if ((browser_version >= CHROME_MINIMUM_VERSION)) { 717 supportedBrowserVersion = true; 718 } 719 } 720 else 721 if ((browser == "MSIE") || (browser == "Netscape")) { 722 supportedBrowser = true; 723 if ((browser_version >= MSIE_MINIMUM_VERSION)) { 724 supportedBrowserVersion = true; 725 } 726 } 727 728 var supportedBrowsersMsg = "Supported browsers include Internet Explorer " + MSIE_MINIMUM_VERSION + "+<br/>Google Chrome " + CHROME_MINIMUM_VERSION + "+ <br/>& Mozilla Firefox " + FIREFOX_MINIMUM_VERSION + "+"; 729 if ((supportedBrowser == true) && (supportedBrowserVersion == false)) { 730 var errorMessage = 'The version of this browser is not supported. ' + supportedBrowsersMsg; 731 toastr.error(errorMessage); 732 browserDetails = browserDetails + "\<br/> <span style=\"color: #FF0000;\">" + errorMessage + "</span>"; 733 } 734 735 if (supportedBrowser == false) { 736 var errorMessage = 'This browser is not supported. ' + supportedBrowsersMsg; 737 toastr.error(errorMessage); 738 browserDetails = browserDetails + "\<br/> <span style=\"color: #FF0000;\"> This browser is not supported! </span>"; 739 } 740 741 return browserDetails; 742}; 743 744; 745/*! 746* metismenu https://github.com/onokumus/metismenu#readme 747* A collapsible jQuery menu plugin 748* @version 3.0.7 749* @author Osman Nuri Okumus <[email protected]> (https://github.com/onokumus) 750* @license: MIT 751*/ 752(function (global, factory) { 753 typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery')) : 754 typeof define === 'function' && define.amd ? define(['jquery'], factory) : 755 (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.metisMenu = factory(global.$)); 756}(this, (function ($) { 757 'use strict'; 758 759 function _interopDefaultLegacy(e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } 760 761 var $__default = /*#__PURE__*/_interopDefaultLegacy($); 762 763 const Util = (($) => { // eslint-disable-line no-shadow 764 const TRANSITION_END = 'transitionend'; 765 766 const Util = { // eslint-disable-line no-shadow 767 TRANSITION_END: 'mmTransitionEnd', 768 769 triggerTransitionEnd(element) { 770 $(element).trigger(TRANSITION_END); 771 }, 772 773 supportsTransitionEnd() { 774 return Boolean(TRANSITION_END); 775 }, 776 }; 777 778 function getSpecialTransitionEndEvent() { 779 return { 780 bindType: TRANSITION_END, 781 delegateType: TRANSITION_END, 782 handle(event) { 783 if ($(event.target).is(this)) { 784 return event 785 .handleObj 786 .handler 787 .apply(this, arguments); // eslint-disable-line prefer-rest-params 788 } 789 return undefined; 790 }, 791 }; 792 } 793 794 function transitionEndEmulator(duration) { 795 let called = false; 796 797 $(this).one(Util.TRANSITION_END, () => { 798 called = true; 799 }); 800 801 setTimeout(() => { 802 if (!called) { 803 Util.triggerTransitionEnd(this); 804 } 805 }, duration); 806 807 return this; 808 } 809 810 function setTransitionEndSupport() { 811 $.fn.mmEmulateTransitionEnd = transitionEndEmulator; // eslint-disable-line no-param-reassign 812 // eslint-disable-next-line no-param-reassign 813 $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent(); 814 } 815 816 setTransitionEndSupport(); 817 818 return Util; 819 })($__default['default']); 820 821 const NAME = 'metisMenu'; 822 const DATA_KEY = 'metisMenu'; 823 const EVENT_KEY = `.${DATA_KEY}`; 824 const DATA_API_KEY = '.data-api'; 825 const JQUERY_NO_CONFLICT = $__default['default'].fn[NAME]; 826 const TRANSITION_DURATION = 350; 827 828 const Default = { 829 toggle: true, 830 preventDefault: true, 831 triggerElement: 'a', 832 parentTrigger: 'li', 833 subMenu: 'ul', 834 }; 835 836 const Event = { 837 SHOW: `show${EVENT_KEY}`, 838 SHOWN: `shown${EVENT_KEY}`, 839 HIDE: `hide${EVENT_KEY}`, 840 HIDDEN: `hidden${EVENT_KEY}`, 841 CLICK_DATA_API: `click${EVENT_KEY}${DATA_API_KEY}`, 842 }; 843 844 const ClassName = { 845 METIS: 'metismenu', 846 ACTIVE: 'mm-active', 847 SHOW: 'mm-show', 848 COLLAPSE: 'mm-collapse', 849 COLLAPSING: 'mm-collapsing', 850 COLLAPSED: 'mm-collapsed', 851 }; 852 853 class MetisMenu { 854 // eslint-disable-line no-shadow 855 constructor(element, config) { 856 this.element = element; 857 this.config = { 858 ...Default, 859 ...config, 860 }; 861 this.transitioning = null; 862 863 this.init(); 864 } 865 866 init() { 867 const self = this; 868 const conf = this.config; 869 const el = $__default['default'](this.element); 870 871 el.addClass(ClassName.METIS); // add metismenu class to element 872 873 el.find(`${conf.parentTrigger}.${ClassName.ACTIVE}`) 874 .children(conf.triggerElement) 875 .attr('aria-expanded', 'true'); // add attribute aria-expanded=true the trigger element 876 877 el.find(`${conf.parentTrigger}.${ClassName.ACTIVE}`) 878 .parents(conf.parentTrigger) 879 .addClass(ClassName.ACTIVE); 880 881 el.find(`${conf.parentTrigger}.${ClassName.ACTIVE}`) 882 .parents(conf.parentTrigger) 883 .children(conf.triggerElement) 884 .attr('aria-expanded', 'true'); // add attribute aria-expanded=true the triggers of all parents 885 886 el.find(`${conf.parentTrigger}.${ClassName.ACTIVE}`) 887 .has(conf.subMenu) 888 .children(conf.subMenu) 889 .addClass(`${ClassName.COLLAPSE} ${ClassName.SHOW}`); 890 891 el 892 .find(conf.parentTrigger) 893 .not(`.${ClassName.ACTIVE}`) 894 .has(conf.subMenu) 895 .children(conf.subMenu) 896 .addClass(ClassName.COLLAPSE); 897 898 el 899 .find(conf.parentTrigger) 900 // .has(conf.subMenu) 901 .children(conf.triggerElement) 902 .on(Event.CLICK_DATA_API, function (e) { // eslint-disable-line func-names 903 const eTar = $__default['default'](this); 904 905 if (eTar.attr('aria-disabled') === 'true') { 906 return; 907 } 908 909 if (conf.preventDefault && eTar.attr('href') === '#') { 910 e.preventDefault(); 911 } 912 913 const paRent = eTar.parent(conf.parentTrigger); 914 const sibLi = paRent.siblings(conf.parentTrigger); 915 const sibTrigger = sibLi.children(conf.triggerElement); 916 917 if (paRent.hasClass(ClassName.ACTIVE)) { 918 eTar.attr('aria-expanded', 'false'); 919 self.removeActive(paRent); 920 } else { 921 eTar.attr('aria-expanded', 'true'); 922 self.setActive(paRent); 923 if (conf.toggle) { 924 self.removeActive(sibLi); 925 sibTrigger.attr('aria-expanded', 'false'); 926 } 927 } 928 929 if (conf.onTransitionStart) { 930 conf.onTransitionStart(e); 931 } 932 }); 933 } 934 935 setActive(li) { 936 $__default['default'](li).addClass(ClassName.ACTIVE); 937 const ul = $__default['default'](li).children(this.config.subMenu); 938 if (ul.length > 0 && !ul.hasClass(ClassName.SHOW)) { 939 this.show(ul); 940 } 941 } 942 943 removeActive(li) { 944 $__default['default'](li).removeClass(ClassName.ACTIVE); 945 const ul = $__default['default'](li).children(`${this.config.subMenu}.${ClassName.SHOW}`); 946 if (ul.length > 0) { 947 this.hide(ul); 948 } 949 } 950 951 show(element) { 952 if (this.transitioning || $__default['default'](element).hasClass(ClassName.COLLAPSING)) { 953 return; 954 } 955 const elem = $__default['default'](element); 956 957 const startEvent = $__default['default'].Event(Event.SHOW); 958 elem.trigger(startEvent); 959 960 if (startEvent.isDefaultPrevented()) { 961 return; 962 } 963 964 elem.parent(this.config.parentTrigger).addClass(ClassName.ACTIVE); 965 966 if (this.config.toggle) { 967 const toggleElem = elem.parent(this.config.parentTrigger).siblings().children(`${this.config.subMenu}.${ClassName.SHOW}`); 968 this.hide(toggleElem); 969 } 970 971 elem 972 .removeClass(ClassName.COLLAPSE) 973 .addClass(ClassName.COLLAPSING) 974 .height(0); 975 976 this.setTransitioning(true); 977 978 const complete = () => { 979 // check if disposed 980 if (!this.config || !this.element) { 981 return; 982 } 983 elem 984 .removeClass(ClassName.COLLAPSING) 985 .addClass(`${ClassName.COLLAPSE} ${ClassName.SHOW}`) 986 .height(''); 987 988 this.setTransitioning(false); 989 990 elem.trigger(Event.SHOWN); 991 }; 992 993 elem 994 .height(element[0].scrollHeight) 995 .one(Util.TRANSITION_END, complete) 996 .mmEmulateTransitionEnd(TRANSITION_DURATION); 997 } 998 999 hide(element) { 1000 if ( 1001 this.transitioning || !$__default['default'](element).hasClass(ClassName.SHOW) 1002 ) { 1003 return; 1004 } 1005 1006 const elem = $__default['default'](element); 1007 1008 const startEvent = $__default['default'].Event(Event.HIDE); 1009 elem.trigger(startEvent); 1010 1011 if (startEvent.isDefaultPrevented()) { 1012 return; 1013 } 1014 1015 elem.parent(this.config.parentTrigger).removeClass(ClassName.ACTIVE); 1016 // eslint-disable-next-line no-unused-expressions 1017 elem.height(elem.height())[0].offsetHeight; 1018 1019 elem 1020 .addClass(ClassName.COLLAPSING) 1021 .removeClass(ClassName.COLLAPSE) 1022 .removeClass(ClassName.SHOW); 1023 1024 this.setTransitioning(true); 1025 1026 const complete = () => { 1027 // check if disposed 1028 if (!this.config || !this.element) { 1029 return; 1030 } 1031 if (this.transitioning && this.config.onTransitionEnd) { 1032 this.config.onTransitionEnd(); 1033 } 1034 1035 this.setTransitioning(false); 1036 elem.trigger(Event.HIDDEN); 1037 1038 elem 1039 .removeClass(ClassName.COLLAPSING) 1040 .addClass(ClassName.COLLAPSE); 1041 }; 1042 1043 if (elem.height() === 0 || elem.css('display') === 'none') { 1044 complete(); 1045 } else { 1046 elem 1047 .height(0) 1048 .one(Util.TRANSITION_END, complete) 1049 .mmEmulateTransitionEnd(TRANSITION_DURATION); 1050 } 1051 } 1052 1053 setTransitioning(isTransitioning) { 1054 this.transitioning = isTransitioning; 1055 } 1056 1057 dispose() { 1058 $__default['default'].removeData(this.element, DATA_KEY); 1059 1060 $__default['default'](this.element) 1061 .find(this.config.parentTrigger) 1062 // .has(this.config.subMenu) 1063 .children(this.config.triggerElement) 1064 .off(Event.CLICK_DATA_API); 1065 1066 this.transitioning = null; 1067 this.config = null; 1068 this.element = null; 1069 } 1070 1071 static jQueryInterface(config) { 1072 // eslint-disable-next-line func-names 1073 return this.each(function () { 1074 const $this = $__default['default'](this); 1075 let data = $this.data(DATA_KEY); 1076 const conf = { 1077 ...Default, 1078 ...$this.data(), 1079 ...(typeof config === 'object' && config ? config : {}), 1080 }; 1081 1082 if (!data) { 1083 data = new MetisMenu(this, conf); 1084 $this.data(DATA_KEY, data); 1085 } 1086 1087 if (typeof config === 'string') { 1088 if (data[config] === undefined) {
1089 throw new Error(`No method named "${config}"`); 1090 } 1091 data[config](); 1092 } 1093 }); 1094 } 1095 } 1096 /** 1097 * ------------------------------------------------------------------------ 1098 * jQuery 1099 * ------------------------------------------------------------------------ 1100 */ 1101 1102 $__default['default'].fn[NAME] = MetisMenu.jQueryInterface; // eslint-disable-line no-param-reassign 1103 $__default['default'].fn[NAME].Constructor = MetisMenu; // eslint-disable-line no-param-reassign 1104 $__default['default'].fn[NAME].noConflict = () => { 1105 // eslint-disable-line no-param-reassign 1106 $__default['default'].fn[NAME] = JQUERY_NO_CONFLICT; // eslint-disable-line no-param-reassign 1107 return MetisMenu.jQueryInterface; 1108 }; 1109 1110 return MetisMenu; 1111 1112}))); 1113//# sourceMappingURL=metisMenu.js.map 1114; 1115/* 1116 * metismenu - v1.1.3 1117 * Easy menu jQuery plugin for Twitter Bootstrap 3 1118 * https://github.com/onokumus/metisMenu 1119 * 1120 * Made by Osman Nuri Okumus 1121 * Under MIT License 1122 */ 1123; (function ($, window, document, undefined) { 1124 1125 var pluginName = "metisMenuIE", 1126 defaults = { 1127 toggle: true, 1128 doubleTapToGo: false 1129 }; 1130 1131 function Plugin(element, options) { 1132 this.element = $(element); 1133 this.settings = $.extend({}, defaults, options); 1134 this._defaults = defaults; 1135 this._name = pluginName; 1136 this.init(); 1137 } 1138 1139 Plugin.prototype = { 1140 init: function () { 1141 1142 var $this = this.element, 1143 $toggle = this.settings.toggle, 1144 obj = this; 1145 1146 if (this.isIE() <= 9) { 1147 $this.find("li.active").has("ul").children("ul").collapse("show"); 1148 $this.find("li").not(".active").has("ul").children("ul").collapse("hide"); 1149 } else { 1150 $this.find("li.active").has("ul").children("ul").addClass("collapse in"); 1151 $this.find("li").not(".active").has("ul").children("ul").addClass("collapse"); 1152 } 1153 1154 //add the "doubleTapToGo" class to active items if needed 1155 if (obj.settings.doubleTapToGo) { 1156 $this.find("li.active").has("ul").children("a").addClass("doubleTapToGo"); 1157 } 1158 1159 $this.find("li").has("ul").children("a").on("click" + "." + pluginName, function (e) { 1160 e.preventDefault(); 1161 1162 //Do we need to enable the double tap 1163 if (obj.settings.doubleTapToGo) { 1164 1165 //if we hit a second time on the link and the href is valid, navigate to that url 1166 if (obj.doubleTapToGo($(this)) && $(this).attr("href") !== "#" && $(this).attr("href") !== "") { 1167 e.stopPropagation(); 1168 document.location = $(this).attr("href"); 1169 return; 1170 } 1171 } 1172 1173 $(this).parent("li").toggleClass("active").children("ul").collapse("toggle"); 1174 var kids = $(this).parent("li").children("a").children("i"); 1175 if (kids.hasClass("fa-rotate-45")) { 1176 kids.removeClass("fa-rotate-45"); 1177 } else { 1178 kids.addClass("fa-rotate-45"); 1179 } 1180 //$("#sidebar-wrapper li[class*='expandMain']").has(".active").children("a").children("i").toggleClass("fa-rotate-45"); 1181 if ($toggle) { 1182 1183 $(this).parent("li").siblings().removeClass("active").children("ul.in").collapse("hide"); 1184 $(this).parent("li").siblings().not(".active").children("a").children("i").removeClass("fa-rotate-45"); 1185 } 1186 1187 }); 1188 }, 1189 1190 isIE: function () { //https://gist.github.com/padolsey/527683 1191 var undef, 1192 v = 3, 1193 div = document.createElement("div"), 1194 all = div.getElementsByTagName("i"); 1195 1196 while ( 1197 div.innerHTML = "<!--[if gt IE " + (++v) + "]><i></i><![endif]-->", 1198 all[0] 1199 ) { 1200 return v > 4 ? v : undef; 1201 } 1202 }, 1203 1204 //Enable the link on the second click. 1205 doubleTapToGo: function (elem) { 1206 var $this = this.element; 1207 1208 //if the class "doubleTapToGo" exists, remove it and return 1209 if (elem.hasClass("doubleTapToGo")) { 1210 elem.removeClass("doubleTapToGo"); 1211 return true; 1212 } 1213 1214 //does not exists, add a new class and return false 1215 if (elem.parent().children("ul").length) { 1216 //first remove all other class 1217 $this.find(".doubleTapToGo").removeClass("doubleTapToGo"); 1218 //add the class on the current element 1219 elem.addClass("doubleTapToGo"); 1220 return false; 1221 } 1222 }, 1223 1224 remove: function () { 1225 this.element.off("." + pluginName); 1226 this.element.removeData(pluginName); 1227 } 1228 1229 }; 1230 1231 $.fn[pluginName] = function (options) { 1232 this.each(function () { 1233 var el = $(this); 1234 if (el.data(pluginName)) { 1235 el.data(pluginName).remove(); 1236 } 1237 el.data(pluginName, new Plugin(this, options)); 1238 });
1239 return this; 1240 }; 1241 1242})(jQuery, window, document);; 1243$(function () { 1244 try { 1245 $('#sidebar-wrapper').metisMenu(); 1246 } 1247 catch (err) { 1248 $('#sidebar-wrapper').metisMenuIE(); 1249 } 1250}); 1251 1252//Loads the correct sidebar on window load, 1253//collapses the sidebar on window resize. 1254// Sets the min-height of #page-wrapper to window size 1255$(function() { 1256 $(window).bind("load resize", function() { 1257 topOffset = 50; 1258 width = (this.window.innerWidth > 0) ? this.window.innerWidth : this.screen.width; 1259 if (width < 768) { 1260 $('div.navbar-collapse').addClass('collapse'); 1261 topOffset = 100; // 2-row-menu 1262 } else { 1263 $('div.navbar-collapse').removeClass('collapse'); 1264 } 1265 1266 height = ((this.window.innerHeight > 0) ? this.window.innerHeight : this.screen.height) - 1; 1267 height = height - topOffset; 1268 if (height < 1) height = 1; 1269 if (height > topOffset) { 1270 $("#page-wrapper").css("min-height", (height) + "px"); 1271 } 1272 }); 1273 1274 var url = window.location; 1275 $('ul.nav a[href="' + url + '"]').parent().addClass('active'); 1276 var element = $('ul.nav a').filter(function() { 1277 return this.href == url || url.href.indexOf(this.href) == 0; 1278 }).addClass('active').parent().parent().addClass('in').parent(); 1279 if (element.is('li')) { 1280 element.addClass('active'); 1281 } 1282 $('ul.nav a').filter(function () { 1283 return this.href == url; 1284 }).parent().addClass('active'); 1285}); 1286; 1287/* NUGET: BEGIN LICENSE TEXT 1288 * 1289 * Microsoft grants you the right to use these script files for the sole 1290 * purpose of either: (i) interacting through your browser with the Microsoft 1291 * website or online service, subject to the applicable licensing or use 1292 * terms; or (ii) using the files as included with a Microsoft product subject 1293 * to that product's license terms. Microsoft reserves all other rights to the 1294 * files not expressly granted by Microsoft, whether by implication, estoppel 1295 * or otherwise. Insofar as a script file is dual licensed under GPL, 1296 * Microsoft neither took the code under GPL nor distributes it thereunder but 1297 * under the terms set out in this paragraph. All notices and licenses 1298 * below are for informational purposes only. 1299 * 1300 * NUGET: END LICENSE TEXT */ 1301/*! 1302** Unobtrusive Ajax support library for jQuery 1303** Copyright (C) Microsoft Corporation. All rights reserved. 1304*/ 1305 1306/*jslint white: true, browser: true, onevar: true, undef: true, nomen: true, eqeqeq: true, plusplus: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: false */ 1307/*global window: false, jQuery: false */ 1308 1309(function ($) { 1310 var data_click = "unobtrusiveAjaxClick", 1311 data_target = "unobtrusiveAjaxClickTarget", 1312 data_validation = "unobtrusiveValidation"; 1313 1314 function getFunction(code, argNames) { 1315 var fn = window, parts = (code || "").split("."); 1316 while (fn && parts.length) { 1317 fn = fn[parts.shift()]; 1318 } 1319 if (typeof (fn) === "function") { 1320 return fn; 1321 } 1322 argNames.push(code); 1323 return Function.constructor.apply(null, argNames); 1324 } 1325 1326 function isMethodProxySafe(method) { 1327 return method === "GET" || method === "POST"; 1328 } 1329 1330 function asyncOnBeforeSend(xhr, method) { 1331 if (!isMethodProxySafe(method)) { 1332 xhr.setRequestHeader("X-HTTP-Method-Override", method); 1333 } 1334 } 1335 1336 function asyncOnSuccess(element, data, contentType) { 1337 var mode; 1338 1339 if (contentType.indexOf("application/x-javascript") !== -1) { // jQuery already executes JavaScript for us 1340 return; 1341 } 1342 1343 mode = (element.getAttribute("data-ajax-mode") || "").toUpperCase(); 1344 $(element.getAttribute("data-ajax-update")).each(function (i, update) { 1345 var top; 1346 1347 switch (mode) { 1348 case "BEFORE": 1349 top = update.firstChild; 1350 $("<div />").html(data).contents().each(function () { 1351 update.insertBefore(this, top); 1352 }); 1353 break; 1354 case "AFTER": 1355 $("<div />").html(data).contents().each(function () { 1356 update.appendChild(this); 1357 }); 1358 break; 1359 case "REPLACE-WITH": 1360 $(update).replaceWith(data); 1361 break; 1362 default: 1363 $(update).html(data); 1364 break; 1365 } 1366 }); 1367 } 1368 1369 function asyncRequest(element, options) { 1370 var confirm, loading, method, duration; 1371 1372 confirm = element.getAttribute("data-ajax-confirm"); 1373 if (confirm && !window.confirm(confirm)) { 1374 return; 1375 } 1376 1377 loading = $(element.getAttribute("data-ajax-loading")); 1378 duration = parseInt(element.getAttribute("data-ajax-loading-duration"), 10) || 0; 1379 1380 $.extend(options, { 1381 type: element.getAttribute("data-ajax-method") || undefined, 1382 url: element.getAttribute("data-ajax-url") || undefined, 1383 cache: !!element.getAttribute("data-ajax-cache"), 1384 beforeSend: function (xhr) { 1385 var result; 1386 asyncOnBeforeSend(xhr, method); 1387 result = getFunction(element.getAttribute("data-ajax-begin"), ["xhr"]).apply(element, arguments); 1388 if (result !== false) { 1389 loading.show(duration); 1390 } 1391 return result; 1392 }, 1393 complete: function () { 1394 loading.hide(duration); 1395 getFunction(element.getAttribute("data-ajax-complete"), ["xhr", "status"]).apply(element, arguments); 1396 }, 1397 success: function (data, status, xhr) { 1398 asyncOnSuccess(element, data, xhr.getResponseHeader("Content-Type") || "text/html"); 1399 getFunction(element.getAttribute("data-ajax-success"), ["data", "status", "xhr"]).apply(element, arguments); 1400 }, 1401 error: function () { 1402 getFunction(element.getAttribute("data-ajax-failure"), ["xhr", "status", "error"]).apply(element, arguments); 1403 } 1404 }); 1405 1406 options.data.push({ name: "X-Requested-With", value: "XMLHttpRequest" }); 1407 1408 method = options.type.toUpperCase(); 1409 if (!isMethodProxySafe(method)) { 1410 options.type = "POST"; 1411 options.data.push({ name: "X-HTTP-Method-Override", value: method }); 1412 } 1413 1414 $.ajax(options); 1415 } 1416 1417 function validate(form) {
1418 var validationInfo = $(form).data(data_validation); 1419 return !validationInfo || !validationInfo.validate || validationInfo.validate(); 1420 } 1421 1422 $(document).on("click", "a[data-ajax=true]", function (evt) { 1423 evt.preventDefault(); 1424 asyncRequest(this, { 1425 url: this.href, 1426 type: "GET", 1427 data: [] 1428 }); 1429 }); 1430 1431 $(document).on("click", "form[data-ajax=true] input[type=image]", function (evt) { 1432 var name = evt.target.name, 1433 target = $(evt.target), 1434 form = $(target.parents("form")[0]), 1435 offset = target.offset(); 1436 1437 form.data(data_click, [ 1438 { name: name + ".x", value: Math.round(evt.pageX - offset.left) }, 1439 { name: name + ".y", value: Math.round(evt.pageY - offset.top) } 1440 ]); 1441 1442 setTimeout(function () { 1443 form.removeData(data_click); 1444 }, 0); 1445 }); 1446 1447 $(document).on("click", "form[data-ajax=true] :submit", function (evt) { 1448 var name = evt.currentTarget.name, 1449 target = $(evt.target), 1450 form = $(target.parents("form")[0]); 1451 1452 form.data(data_click, name ? [{ name: name, value: evt.currentTarget.value }] : []); 1453 form.data(data_target, target); 1454 1455 setTimeout(function () { 1456 form.removeData(data_click); 1457 form.removeData(data_target); 1458 }, 0); 1459 }); 1460 1461 $(document).on("submit", "form[data-ajax=true]", function (evt) { 1462 var clickInfo = $(this).data(data_click) || [], 1463 clickTarget = $(this).data(data_target), 1464 isCancel = clickTarget && clickTarget.hasClass("cancel"); 1465 evt.preventDefault(); 1466 if (!isCancel && !validate(this)) { 1467 return; 1468 } 1469 asyncRequest(this, { 1470 url: this.action, 1471 type: this.method || "GET", 1472 data: clickInfo.concat($(this).serializeArray()) 1473 }); 1474 }); 1475}(jQuery));; 1476/* 1477* iziToast | v1.3.0 1478* http://izitoast.marcelodolce.com 1479* by Marcelo Dolce. 1480*/ 1481(function (root, factory) { 1482 if (typeof define === 'function' && define.amd) { 1483 define([], factory(root)); 1484 } else if (typeof exports === 'object') { 1485 module.exports = factory(root); 1486 } else { 1487 root.iziToast = factory(root); 1488 } 1489})(typeof global !== 'undefined' ? global : window || this.window || this.global, function (root) { 1490 1491 'use strict'; 1492 1493 // 1494 // Variables 1495 // 1496 var $iziToast = {}, 1497 PLUGIN_NAME = 'iziToast', 1498 BODY = document.querySelector('body'), 1499 ISMOBILE = (/Mobi/.test(navigator.userAgent)) ? true : false, 1500 ISCHROME = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor), 1501 ISFIREFOX = typeof InstallTrigger !== 'undefined', 1502 ACCEPTSTOUCH = 'ontouchstart' in document.documentElement, 1503 POSITIONS = ['bottomRight', 'bottomLeft', 'bottomCenter', 'topRight', 'topLeft', 'topCenter', 'center'], 1504 THEMES = { 1505 info: { 1506 color: 'blue', 1507 icon: 'ico-info' 1508 }, 1509 success: { 1510 color: 'green', 1511 icon: 'ico-success' 1512 }, 1513 warning: { 1514 color: 'orange', 1515 icon: 'ico-warning' 1516 }, 1517 error: { 1518 color: 'red', 1519 icon: 'ico-error'
1520 }, 1521 question: { 1522 color: 'yellow', 1523 icon: 'ico-question' 1524 } 1525 }, 1526 MOBILEWIDTH = 568, 1527 CONFIG = {}; 1528 1529 1530 // Default settings 1531 var defaults = { 1532 id: null, 1533 class: '', 1534 title: '', 1535 titleColor: '', 1536 titleSize: '', 1537 titleLineHeight: '', 1538 message: '', 1539 messageColor: '', 1540 messageSize: '', 1541 messageLineHeight: '', 1542 backgroundColor: '', 1543 theme: 'light', // dark 1544 color: '', // blue, red, green, yellow 1545 icon: '', 1546 iconText: '', 1547 iconColor: '', 1548 image: '', 1549 imageWidth: 50, 1550 maxWidth: null, 1551 zindex: null, 1552 layout: 1, 1553 balloon: false, 1554 overlay: false, 1555 close: true, 1556 closeOnEscape: false, 1557 rtl: false, 1558 position: 'bottomRight', // bottomRight, bottomLeft, topRight, topLeft, topCenter, bottomCenter, center 1559 target: '', 1560 targetFirst: true, 1561 toastOnce: false, 1562 timeout: 5000, 1563 animateInside: true, 1564 drag: true, 1565 pauseOnHover: true, 1566 resetOnHover: false, 1567 progressBar: true, 1568 progressBarColor: '', 1569 progressBarEasing: 'linear', 1570 overlayClose: false, 1571 overlayColor: 'rgba(0, 0, 0, 0.6)', 1572 transitionIn: 'fadeInUp', // bounceInLeft, bounceInRight, bounceInUp, bounceInDown, fadeIn, fadeInDown, fadeInUp, fadeInLeft, fadeInRight, flipInX 1573 transitionOut: 'fadeOut', // fadeOut, fadeOutUp, fadeOutDown, fadeOutLeft, fadeOutRight, flipOutX 1574 transitionInMobile: 'fadeInUp', 1575 transitionOutMobile: 'fadeOutDown', 1576 buttons: {}, 1577 inputs: {}, 1578 onOpening: function () { }, 1579 onOpened: function () { }, 1580 onClosing: function () { }, 1581 onClosed: function () { } 1582 }; 1583 1584 // 1585 // Methods 1586 // 1587 1588 1589 /** 1590 * Polyfill for remove() method 1591 */ 1592 if (!('remove' in Element.prototype)) { 1593 Element.prototype.remove = function () { 1594 if (this.parentNode) { 1595 this.parentNode.removeChild(this); 1596 } 1597 }; 1598 } 1599 1600 /* 1601 * Polyfill for CustomEvent for IE >= 9 1602 * https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill 1603 */ 1604 if (typeof window.CustomEvent !== 'function') { 1605 var CustomEventPolyfill = function (event, params) { 1606 params = params || { bubbles: false, cancelable: false, detail: undefined }; 1607 var evt = document.createEvent('CustomEvent'); 1608 evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail); 1609 return evt; 1610 }; 1611 1612 CustomEventPolyfill.prototype = window.Event.prototype; 1613 1614 window.CustomEvent = CustomEventPolyfill; 1615 } 1616 1617 /** 1618 * A simple forEach() implementation for Arrays, Objects and NodeLists 1619 * @private 1620 * @param {Array|Object|NodeList} collection Collection of items to iterate 1621 * @param {Function} callback Callback function for each iteration 1622 * @param {Array|Object|NodeList} scope Object/NodeList/Array that forEach is iterating over (aka `this`) 1623 */ 1624 var forEach = function (collection, callback, scope) { 1625 if (Object.prototype.toString.call(collection) === '[object Object]') { 1626 for (var prop in collection) { 1627 if (Object.prototype.hasOwnProperty.call(collection, prop
vendor: 4,699 bytes, lines 1627-1808
1627)) { 1628 callback.call(scope, collection[prop], prop, collection); 1629 } 1630 } 1631 } else { 1632 if (collection) { 1633 for (var i = 0, len = collection.length; i < len; i++) { 1634 callback.call(scope, collection[i], i, collection); 1635 } 1636 } 1637 } 1638 }; 1639 1640 /** 1641 * Merge defaults with user options 1642 * @private 1643 * @param {Object} defaults Default settings 1644 * @param {Object} options User options 1645 * @returns {Object} Merged values of defaults and options 1646 */ 1647 var extend = function (defaults, options) { 1648 var extended = {}; 1649 forEach(defaults, function (value, prop) { 1650 extended[prop] = defaults[prop]; 1651 }); 1652 forEach(options, function (value, prop) { 1653 extended[prop] = options[prop]; 1654 }); 1655 return extended; 1656 }; 1657 1658 1659 /** 1660 * Create a fragment DOM elements 1661 * @private 1662 */ 1663 var createFragElem = function (htmlStr) { 1664 var frag = document.createDocumentFragment(), 1665 temp = document.createElement('div'); 1666 temp.innerHTML = htmlStr; 1667 while (temp.firstChild) { 1668 frag.appendChild(temp.firstChild); 1669 } 1670 return frag; 1671 }; 1672 1673 1674 /** 1675 * Check if is a color 1676 * @private 1677 */ 1678 var isColor = function (color) { 1679 if (color.substring(0, 1) == '#' || color.substring(0, 3) == 'rgb' || color.substring(0, 3) == 'hsl') { 1680 return true; 1681 } else { 1682 return false; 1683 } 1684 }; 1685 1686 1687 /** 1688 * Check if is a Base64 string 1689 * @private 1690 */ 1691 var isBase64 = function (str) { 1692 try { 1693 return btoa(atob(str)) == str; 1694 } catch (err) { 1695 return false; 1696 } 1697 }; 1698 1699 1700 /** 1701 * Drag method of toasts 1702 * @private 1703 */ 1704 var drag = function () { 1705 1706 return { 1707 move: function (toast, instance, settings, xpos) { 1708 1709 var opacity, 1710 opacityRange = 0.3, 1711 distance = 180; 1712 1713 if (xpos !== 0) { 1714 1715 toast.classList.add(PLUGIN_NAME + '-dragged'); 1716 1717 toast.style.transform = 'translateX(' + xpos + 'px)'; 1718 1719 if (xpos > 0) { 1720 opacity = (distance - xpos) / distance; 1721 if (opacity < opacityRange) { 1722 instance.hide(extend(settings, { transitionOut: 'fadeOutRight', transitionOutMobile: 'fadeOutRight' }), toast, 'drag'); 1723 } 1724 } else { 1725 opacity = (distance + xpos) / distance; 1726 if (opacity < opacityRange) { 1727 instance.hide(extend(settings, { transitionOut: 'fadeOutLeft', transitionOutMobile: 'fadeOutLeft' }), toast, 'drag'); 1728 } 1729 } 1730 toast.style.opacity = opacity; 1731 1732 if (opacity < opacityRange) { 1733 1734 if (ISCHROME || ISFIREFOX) 1735 toast.style.left = xpos + 'px'; 1736 1737 toast.parentNode.style.opacity = opacityRange; 1738 1739 this.stopMoving(toast, null); 1740 } 1741 } 1742 1743 1744 }, 1745 startMoving: function (toast, instance, settings, e) { 1746 1747 e = e || window.event; 1748 var posX = ((ACCEPTSTOUCH) ? e.touches[0].clientX : e.clientX), 1749 toastLeft = toast.style.transform.replace('px)', ''); 1750 toastLeft = toastLeft.replace('translateX(', ''); 1751 var offsetX = posX - toastLeft; 1752 1753 toast.classList.remove(settings.transitionIn); 1754 toast.classList.remove(settings.transitionInMobile); 1755 toast.style.transition = ''; 1756 1757 if (ACCEPTSTOUCH) { 1758 document.ontouchmove = function (e) { 1759 e.preventDefault(); 1760 e = e || window.event; 1761 var posX = e.touches[0].clientX, 1762 finalX = posX - offsetX; 1763 drag.move(toast, instance, settings, finalX); 1764 }; 1765 } else { 1766 document.onmousemove = function (e) { 1767 e.preventDefault(); 1768 e = e || window.event; 1769 var posX = e.clientX, 1770 finalX = posX - offsetX; 1771 drag.move(toast, instance, settings, finalX); 1772 }; 1773 } 1774 1775 }, 1776 stopMoving: function (toast, e) { 1777 1778 if (ACCEPTSTOUCH) { 1779 document.ontouchmove = function () { }; 1780 } else { 1781 document.onmousemove = function () { }; 1782 } 1783 1784 toast.style.opacity = ''; 1785 toast.style.transform = ''; 1786 1787 if (toast.classList.contains(PLUGIN_NAME + '-dragged')) { 1788 1789 toast.classList.remove(PLUGIN_NAME + '-dragged'); 1790 1791 toast.style.transition = 'transform 0.4s ease, opacity 0.4s ease'; 1792 setTimeout(function () { 1793 toast.style.transition = ''; 1794 }, 400); 1795 } 1796 1797 } 1798 }; 1799 1800 }(); 1801 1802 1803 /** 1804 * Destroy the current initialization. 1805 * @public 1806 */ 1807 $iziToast.destroy = function () { 1808
1809 forEach(document.querySelectorAll('.' + PLUGIN_NAME + '-wrapper'), function (element, index) { 1810 element.remove(); 1811 }); 1812 1813 forEach(document.querySelectorAll('.' + PLUGIN_NAME), function (element, index) { 1814 element.remove(); 1815 }); 1816 1817 // Remove event listeners 1818 document.removeEventListener(PLUGIN_NAME + '-opened', {}, false); 1819 document.removeEventListener(PLUGIN_NAME + '-opening', {}, false); 1820 document.removeEventListener(PLUGIN_NAME + '-closing', {}, false); 1821 document.removeEventListener(PLUGIN_NAME + '-closed', {}, false); 1822 document.removeEventListener('keyup', {}, false); 1823 1824 // Reset variables 1825 CONFIG = {}; 1826 }; 1827 1828 /** 1829 * Initialize Plugin 1830 * @public 1831 * @param {Object} options User settings 1832 */ 1833 $iziToast.settings = function (options) { 1834 1835 // Destroy any existing initializations 1836 $iziToast.destroy(); 1837 1838 CONFIG = options; 1839 defaults = extend(defaults, options || {}); 1840 }; 1841 1842 1843 /** 1844 * Building themes functions. 1845 * @public 1846 * @param {Object} options User settings 1847 */ 1848 forEach(THEMES, function (theme, name) { 1849 1850 $iziToast[name] = function (options) { 1851 1852 var settings = extend(CONFIG, options || {}); 1853 settings = extend(theme, settings || {}); 1854 1855 this.show(settings); 1856 }; 1857 1858 }); 1859 1860 1861 /** 1862 * Do the calculation to move the progress bar 1863 * @private 1864 */ 1865 $iziToast.progress = function (options, $toast, callback) { 1866 1867 var that = this, 1868 settings = extend(that.settings, options || {}), 1869 $elem = $toast.querySelector('.' + PLUGIN_NAME + '-progressbar div'); 1870 1871 return { 1872 start: function () { 1873 1874 if ($elem !== null) { 1875 $elem.style.transition = 'width ' + settings.timeout + 'ms ' + settings.progressBarEasing; 1876 $elem.style.width = '0%'; 1877 } 1878 settings.TIME.START = new Date().getTime(); 1879 settings.TIME.END = settings.TIME.START + settings.timeout; 1880 settings.TIME.TIMER = setTimeout(function () { 1881 1882 clearTimeout(settings.TIME.TIMER); 1883 1884 if (!$toast.classList.contains(PLUGIN_NAME + '-closing')) { 1885 1886 that.hide(settings, $toast, 'timeout'); 1887 1888 if (typeof callback === 'function') { 1889 callback.apply(that); 1890 } 1891 } 1892 1893 }, settings.timeout); 1894 1895 }, 1896 pause: function () { 1897 1898 settings.TIME.REMAINING = settings.TIME.END - new Date().getTime(); 1899 1900 clearTimeout(settings.TIME.TIMER); 1901 1902 if ($elem !== null) { 1903 var computedStyle = window.getComputedStyle($elem), 1904 propertyWidth = computedStyle.getPropertyValue('width'); 1905 1906 $elem.style.transition = 'none'; 1907 $elem.style.width = propertyWidth; 1908 } 1909 1910 if (typeof callback === 'function') { 1911 setTimeout(function () { 1912 callback.apply(that); 1913 }, 10); 1914 } 1915 1916 }, 1917 resume: function () { 1918 1919 if ($elem !== null) { 1920 $elem.style.transition = 'width ' + settings.TIME.REMAINING + 'ms ' + settings.progressBarEasing; 1921 $elem.style.width = '0%'; 1922 } 1923 1924 settings.TIME.END = new Date().getTime() + settings.TIME.REMAINING; 1925 settings.TIME.TIMER = setTimeout(function () { 1926 1927 clearTimeout(settings.TIME.TIMER); 1928 1929 if (!$toast.classList.contains(PLUGIN_NAME + '-closing')) { 1930 1931 that.hide(settings, $toast, 'timeout'); 1932 1933 if (typeof callback === 'function') { 1934 callback.apply(that); 1935 } 1936 } 1937 1938 1939 }, settings.TIME.REMAINING); 1940 1941 }, 1942 reset: function () { 1943 1944 clearTimeout(settings.TIME.TIMER); 1945 1946 if ($elem !== null) { 1947 $elem.style.transition = 'none'; 1948 $elem.style.width = '100%'; 1949 } 1950 1951 if (typeof callback === 'function') { 1952 setTimeout(function () { 1953 callback.apply(that); 1954 }, 10); 1955 } 1956 1957 } 1958 }; 1959 1960 }; 1961 1962 1963 /** 1964 * Close the specific Toast 1965 * @public 1966 * @param {Object} options User settings 1967 */ 1968 $iziToast.hide = function (options, $toast, closedBy) { 1969 1970 var settings = extend(this.settings, options || {}); 1971 closedBy = closedBy || null; 1972 1973 if (typeof $toast != 'object') { 1974 $toast = document.querySelector($toast); 1975 } 1976 1977 $toast.classList.add(PLUGIN_NAME + '-closing'); 1978 1979 settings.closedBy = closedBy; 1980 settings.REF = $toast.getAttribute('data-iziToast-ref'); 1981 1982 // Overlay 1983 (function () { 1984
1985 var $overlay = document.querySelector('.' + PLUGIN_NAME + '-overlay'); 1986 if ($overlay !== null) { 1987 var refs = $overlay.getAttribute('data-iziToast-ref'); 1988 refs = refs.split(','); 1989 var index = refs.indexOf(settings.REF); 1990 1991 if (index !== -1) { 1992 refs.splice(index, 1); 1993 } 1994 $overlay.setAttribute('data-iziToast-ref', refs.join()); 1995 1996 if (refs.length === 0) { 1997 $overlay.classList.remove('fadeIn'); 1998 $overlay.classList.add('fadeOut'); 1999 setTimeout(function () { 2000 $overlay.remove(); 2001 }, 700); 2002 } 2003 } 2004 2005 })(); 2006 2007 if (settings.transitionIn || settings.transitionInMobile) { 2008 $toast.classList.remove(settings.transitionIn); 2009 $toast.classList.remove(settings.transitionInMobile); 2010 } 2011 2012 if (ISMOBILE || window.innerWidth <= MOBILEWIDTH) { 2013 if (settings.transitionOutMobile) 2014 $toast.classList.add(settings.transitionOutMobile); 2015 } else { 2016 if (settings.transitionOut) 2017 $toast.classList.add(settings.transitionOut); 2018 } 2019 var H = $toast.parentNode.offsetHeight; 2020 $toast.parentNode.style.height = H + 'px'; 2021 $toast.style.pointerEvents = 'none'; 2022 2023 if (!ISMOBILE || window.innerWidth > MOBILEWIDTH) { 2024 $toast.parentNode.style.transitionDelay = '0.2s'; 2025 } 2026 2027 try { 2028 settings.closedBy = closedBy; 2029 var event = new CustomEvent(PLUGIN_NAME + '-closing', { detail: settings, bubbles: true, cancelable: true }); 2030 document.dispatchEvent(event); 2031 } catch (ex) { 2032 console.warn(ex); 2033 } 2034 2035 setTimeout(function () { 2036 2037 $toast.parentNode.style.height = '0px'; 2038 $toast.parentNode.style.overflow = ''; 2039 2040 setTimeout(function () { 2041 2042 $toast.parentNode.remove(); 2043 try { 2044 settings.closedBy = closedBy; 2045 var event = new CustomEvent(PLUGIN_NAME + '-closed', { detail: settings, bubbles: true, cancelable: true }); 2046 document.dispatchEvent(event); 2047 } catch (ex) { 2048 console.warn(ex); 2049 } 2050 2051 if (typeof settings.onClosed !== 'undefined') { 2052 settings.onClosed.apply(null, [settings, $toast, closedBy]); 2053 } 2054 2055 }, 1000); 2056 }, 200); 2057 2058 2059 if (typeof settings.onClosing !== 'undefined') { 2060 settings.onClosing.apply(null, [settings, $toast, closedBy]); 2061 } 2062 }; 2063 2064 /** 2065 * Create and show the Toast 2066 * @public 2067 * @param {Object} options User settings 2068 */ 2069 $iziToast.show = function (options) { 2070 2071 var that = this; 2072 2073 // Merge user options with defaults 2074 var settings = extend(CONFIG, options || {}); 2075 settings = extend(defaults, settings); 2076 2077 settings.TIME = {}; 2078 2079 if (settings.toastOnce && settings.id && document.querySelectorAll('.' + PLUGIN_NAME + '#' + settings.id).length > 0) { 2080 return false; 2081 } 2082 2083 settings.REF = new Date().getTime() + Math.floor((Math.random() * 10000000) + 1); 2084 2085 var $DOM = { 2086 body: document.querySelector('body'), 2087 overlay: document.createElement('div'), 2088 toast: document.createElement('div'), 2089 toastBody: document.createElement('div'), 2090 toastTexts: document.createElement('div'), 2091 toastCapsule: document.createElement('div'), 2092 icon: document.createElement('i'), 2093 cover: document.createElement('div'), 2094 buttons: document.createElement('div'), 2095 inputs: document.createElement('div'), 2096 wrapper: null 2097 }; 2098 2099 $DOM.toast.setAttribute('data-iziToast-ref', settings.REF); 2100 $DOM.toast.appendChild($DOM.toastBody); 2101 $DOM.toastCapsule.appendChild($DOM.toast); 2102 2103 // CSS Settings 2104 (function () { 2105 2106 $DOM.toast.classList.add(PLUGIN_NAME); 2107 $DOM.toast.classList.add(PLUGIN_NAME + '-opening'); 2108 $DOM.toastCapsule.classList.add(PLUGIN_NAME + '-capsule'); 2109 $DOM.toastBody.classList.add(PLUGIN_NAME + '-body'); 2110 $DOM.toastTexts.classList.add(PLUGIN_NAME + '-texts'); 2111 2112 if (ISMOBILE || window.innerWidth <= MOBILEWIDTH) { 2113 if (settings.transitionInMobile) 2114 $DOM.toast.classList.add(settings.transitionInMobile); 2115 } else { 2116 if (settings.transitionIn) 2117 $DOM.toast.classList.add(settings.transitionIn); 2118 } 2119 2120 if (settings.class) { 2121 var classes = settings.class.split(' ');
vendor: 5,021 bytes, lines 2122-2277
2122 forEach(classes, function (value, index) { 2123 $DOM.toast.classList.add(value); 2124 }); 2125 } 2126 2127 if (settings.id) { $DOM.toast.id = settings.id; } 2128 2129 if (settings.rtl) { $DOM.toast.classList.add(PLUGIN_NAME + '-rtl'); } 2130 2131 if (settings.layout > 1) { $DOM.toast.classList.add(PLUGIN_NAME + '-layout' + settings.layout); } 2132 2133 if (settings.balloon) { $DOM.toast.classList.add(PLUGIN_NAME + '-balloon'); } 2134 2135 if (settings.maxWidth) { 2136 if (!isNaN(settings.maxWidth)) { 2137 $DOM.toast.style.maxWidth = settings.maxWidth + 'px'; 2138 } else { 2139 $DOM.toast.style.maxWidth = settings.maxWidth; 2140 } 2141 } 2142 2143 if (settings.theme !== '' || settings.theme !== 'light') { 2144 2145 $DOM.toast.classList.add(PLUGIN_NAME + '-theme-' + settings.theme); 2146 } 2147 2148 if (settings.color) { //#, rgb, rgba, hsl 2149 2150 if (isColor(settings.color)) { 2151 $DOM.toast.style.background = settings.color; 2152 } else { 2153 $DOM.toast.classList.add(PLUGIN_NAME + '-color-' + settings.color); 2154 } 2155 } 2156 2157 if (settings.backgroundColor) { 2158 $DOM.toast.style.background = settings.backgroundColor; 2159 if (settings.balloon) { 2160 $DOM.toast.style.borderColor = settings.backgroundColor; 2161 } 2162 } 2163 })(); 2164 2165 // Cover image 2166 (function () { 2167 if (settings.image) { 2168 $DOM.cover.classList.add(PLUGIN_NAME + '-cover'); 2169 $DOM.cover.style.width = settings.imageWidth + 'px'; 2170 2171 if (isBase64(settings.image.replace(/ /g, ''))) { 2172 $DOM.cover.style.backgroundImage = 'url(data:image/png;base64,' + settings.image.replace(/ /g, '') + ')'; 2173 } else { 2174 $DOM.cover.style.backgroundImage = 'url(' + settings.image + ')'; 2175 } 2176 2177 if (settings.rtl) { 2178 $DOM.toastBody.style.marginRight = (settings.imageWidth + 10) + 'px'; 2179 } else { 2180 $DOM.toastBody.style.marginLeft = (settings.imageWidth + 10) + 'px'; 2181 } 2182 $DOM.toast.appendChild($DOM.cover); 2183 } 2184 })(); 2185 2186 // Button close 2187 (function () { 2188 if (settings.close) { 2189 2190 $DOM.buttonClose = document.createElement('button'); 2191 2192 $DOM.buttonClose.classList.add(PLUGIN_NAME + '-close'); 2193 $DOM.buttonClose.addEventListener('click', function (e) { 2194 var button = e.target; 2195 that.hide(settings, $DOM.toast, 'button'); 2196 }); 2197 $DOM.toast.appendChild($DOM.buttonClose); 2198 } else { 2199 if (settings.rtl) { 2200 $DOM.toast.style.paddingLeft = '18px'; 2201 } else { 2202 $DOM.toast.style.paddingRight = '18px'; 2203 } 2204 } 2205 })(); 2206 2207 // Progress Bar & Timeout 2208 (function () { 2209 if (settings.timeout) { 2210 2211 if (settings.progressBar) { 2212 $DOM.progressBar = document.createElement('div'); 2213 $DOM.progressBarDiv = document.createElement('div'); 2214 $DOM.progressBar.classList.add(PLUGIN_NAME + '-progressbar'); 2215 $DOM.progressBarDiv.style.background = settings.progressBarColor; 2216 $DOM.progressBar.appendChild($DOM.progressBarDiv); 2217 $DOM.toast.appendChild($DOM.progressBar); 2218 } 2219 2220 if (settings.pauseOnHover && !settings.resetOnHover) { 2221 2222 $DOM.toast.addEventListener('mouseenter', function (e) { 2223 this.classList.add(PLUGIN_NAME + '-paused'); 2224 2225 that.progress(settings, $DOM.toast).pause(); 2226 }); 2227 $DOM.toast.addEventListener('mouseleave', function (e) { 2228 this.classList.remove(PLUGIN_NAME + '-paused'); 2229 2230 that.progress(settings, $DOM.toast).resume(); 2231 }); 2232 } 2233 2234 if (settings.resetOnHover) { 2235 2236 $DOM.toast.addEventListener('mouseenter', function (e) { 2237 this.classList.add(PLUGIN_NAME + '-reseted'); 2238 2239 that.progress(settings, $DOM.toast).reset(); 2240 }); 2241 $DOM.toast.addEventListener('mouseleave', function (e) { 2242 this.classList.remove(PLUGIN_NAME + '-reseted'); 2243 2244 that.progress(settings, $DOM.toast).start(); 2245 }); 2246 } 2247 } 2248 })(); 2249 2250 // Icon 2251 (function () { 2252 if (settings.icon) { 2253 $DOM.icon.setAttribute('class', PLUGIN_NAME + '-icon ' + settings.icon); 2254 2255 if (settings.iconText) { 2256 $DOM.icon.appendChild(document.createTextNode(settings.iconText)); 2257 } 2258 2259 if (settings.rtl) { 2260 $DOM.toastBody.style.paddingRight = '33px'; 2261 } else { 2262 $DOM.toastBody.style.paddingLeft = '33px'; 2263 } 2264 2265 if (settings.iconColor) { 2266 $DOM.icon.style.color = settings.iconColor; 2267 } 2268 $DOM.toastBody.appendChild($DOM.icon); 2269 } 2270 })(); 2271 2272 // Title 2273 (function () { 2274 if (settings.title.length > 0) { 2275 2276 $DOM.strong = document.createElement('strong'); 2277 $DOM.strong.classList.add(PLUGIN_NAME + '-title');
2278 $DOM.strong.appendChild(createFragElem(settings.title)); 2279 $DOM.toastTexts.appendChild($DOM.strong); 2280 2281 if (settings.titleColor) { 2282 $DOM.strong.style.color = settings.titleColor; 2283 } 2284 if (settings.titleSize) { 2285 if (!isNaN(settings.titleSize)) { 2286 $DOM.strong.style.fontSize = settings.titleSize + 'px'; 2287 } else { 2288 $DOM.strong.style.fontSize = settings.titleSize; 2289 } 2290 } 2291 if (settings.titleLineHeight) { 2292 if (!isNaN(settings.titleSize)) { 2293 $DOM.strong.style.lineHeight = settings.titleLineHeight + 'px'; 2294 } else { 2295 $DOM.strong.style.lineHeight = settings.titleLineHeight; 2296 } 2297 } 2298 } 2299 })(); 2300 2301 // Message 2302 (function () { 2303 if (settings.message.length > 0) { 2304 2305 $DOM.p = document.createElement('p'); 2306 $DOM.p.classList.add(PLUGIN_NAME + '-message'); 2307 $DOM.p.appendChild(createFragElem(settings.message)); 2308 $DOM.toastTexts.appendChild($DOM.p); 2309 2310 if (settings.messageColor) { 2311 $DOM.p.style.color = settings.messageColor; 2312 } 2313 if (settings.messageSize) { 2314 if (!isNaN(settings.titleSize)) { 2315 $DOM.p.style.fontSize = settings.messageSize + 'px'; 2316 } else { 2317 $DOM.p.style.fontSize = settings.messageSize; 2318 } 2319 } 2320 if (settings.messageLineHeight) { 2321 2322 if (!isNaN(settings.titleSize)) { 2323 $DOM.p.style.lineHeight = settings.messageLineHeight + 'px'; 2324 } else { 2325 $DOM.p.style.lineHeight = settings.messageLineHeight; 2326 } 2327 } 2328 } 2329 })(); 2330 2331 if (settings.title.length > 0 && settings.message.length > 0) { 2332 if (settings.rtl) { 2333 $DOM.strong.style.marginLeft = '10px'; 2334 } else if (settings.layout !== 2 && !settings.rtl) { 2335 $DOM.strong.style.marginRight = '10px'; 2336 } 2337 } 2338 2339 $DOM.toastBody.appendChild($DOM.toastTexts); 2340
vendor: 11,702 bytes, lines 2341-2723
2341 // Inputs 2342 var $inputs; 2343 (function () { 2344 if (settings.inputs.length > 0) { 2345 2346 $DOM.inputs.classList.add(PLUGIN_NAME + '-inputs'); 2347 2348 forEach(settings.inputs, function (value, index) { 2349 $DOM.inputs.appendChild(createFragElem(value[0])); 2350 2351 $inputs = $DOM.inputs.childNodes; 2352 2353 $inputs[index].classList.add(PLUGIN_NAME + '-inputs-child'); 2354 2355 if (value[3]) { 2356 setTimeout(function () { 2357 $inputs[index].focus(); 2358 }, 300); 2359 } 2360 2361 $inputs[index].addEventListener(value[1], function (e) { 2362 var ts = value[2]; 2363 return ts(that, $DOM.toast, this, e); 2364 }); 2365 }); 2366 } 2367 $DOM.toastBody.appendChild($DOM.inputs); 2368 })(); 2369 2370 // Buttons 2371 (function () { 2372 if (settings.buttons.length > 0) { 2373 2374 $DOM.buttons.classList.add(PLUGIN_NAME + '-buttons'); 2375 2376 forEach(settings.buttons, function (value, index) { 2377 $DOM.buttons.appendChild(createFragElem(value[0])); 2378 2379 var $btns = $DOM.buttons.childNodes; 2380 2381 $btns[index].classList.add(PLUGIN_NAME + '-buttons-child'); 2382 2383 if (value[2]) { 2384 setTimeout(function () { 2385 $btns[index].focus(); 2386 }, 300); 2387 } 2388 2389 $btns[index].addEventListener('click', function (e) { 2390 e.preventDefault(); 2391 var ts = value[1]; 2392 return ts(that, $DOM.toast, this, e, $inputs); 2393 }); 2394 }); 2395 } 2396 $DOM.toastBody.appendChild($DOM.buttons); 2397 })(); 2398 2399 if (settings.message.length > 0 && (settings.inputs.length > 0 || settings.buttons.length > 0)) { 2400 $DOM.p.style.marginBottom = '0'; 2401 } 2402 2403 if (settings.inputs.length > 0 || settings.buttons.length > 0) { 2404 if (settings.rtl) { 2405 $DOM.toastTexts.style.marginLeft = '10px'; 2406 } else { 2407 $DOM.toastTexts.style.marginRight = '10px'; 2408 } 2409 if (settings.inputs.length > 0 && settings.buttons.length > 0) { 2410 if (settings.rtl) { 2411 $DOM.inputs.style.marginLeft = '8px'; 2412 } else { 2413 $DOM.inputs.style.marginRight = '8px'; 2414 } 2415 } 2416 } 2417 2418 // Target 2419 (function () { 2420 $DOM.toastCapsule.style.visibility = 'hidden'; 2421 setTimeout(function () { 2422 var H = $DOM.toast.offsetHeight; 2423 var style = $DOM.toast.currentStyle || window.getComputedStyle($DOM.toast); 2424 var marginTop = style.marginTop; 2425 marginTop = marginTop.split('px'); 2426 marginTop = parseInt(marginTop[0]); 2427 var marginBottom = style.marginBottom; 2428 marginBottom = marginBottom.split('px'); 2429 marginBottom = parseInt(marginBottom[0]); 2430 2431 $DOM.toastCapsule.style.visibility = ''; 2432 $DOM.toastCapsule.style.height = (H + marginBottom + marginTop) + 'px'; 2433 2434 setTimeout(function () { 2435 $DOM.toastCapsule.style.height = 'auto'; 2436 if (settings.target) { 2437 $DOM.toastCapsule.style.overflow = 'visible'; 2438 } 2439 }, 500); 2440 2441 if (settings.timeout) { 2442 that.progress(settings, $DOM.toast).start(); 2443 } 2444 }, 100); 2445 })(); 2446 2447 // Target 2448 (function () { 2449 var position = settings.position; 2450 2451 if (settings.target) { 2452 2453 $DOM.wrapper = document.querySelector(settings.target); 2454 $DOM.wrapper.classList.add(PLUGIN_NAME + '-target'); 2455 2456 if (settings.targetFirst) { 2457 $DOM.wrapper.insertBefore($DOM.toastCapsule, $DOM.wrapper.firstChild); 2458 } else { 2459 $DOM.wrapper.appendChild($DOM.toastCapsule); 2460 } 2461 2462 } else { 2463 2464 if (POSITIONS.indexOf(settings.position) == -1) { 2465 console.warn('[' + PLUGIN_NAME + '] Incorrect position.\nIt can be ⺠' + POSITIONS); 2466 return; 2467 } 2468 2469 if (ISMOBILE || window.innerWidth <= MOBILEWIDTH) { 2470 if (settings.position == 'bottomLeft' || settings.position == 'bottomRight' || settings.position == 'bottomCenter') { 2471 position = PLUGIN_NAME + '-wrapper-bottomCenter'; 2472 } 2473 else if (settings.position == 'topLeft' || settings.position == 'topRight' || settings.position == 'topCenter') { 2474 position = PLUGIN_NAME + '-wrapper-topCenter'; 2475 } 2476 else { 2477 position = PLUGIN_NAME + '-wrapper-center'; 2478 } 2479 } else { 2480 position = PLUGIN_NAME + '-wrapper-' + position; 2481 } 2482 $DOM.wrapper = document.querySelector('.' + PLUGIN_NAME + '-wrapper.' + position); 2483 2484 if (!$DOM.wrapper) { 2485 $DOM.wrapper = document.createElement('div'); 2486 $DOM.wrapper.classList.add(PLUGIN_NAME + '-wrapper'); 2487 $DOM.wrapper.classList.add(position); 2488 document.body.appendChild($DOM.wrapper); 2489 } 2490 if (settings.position == 'topLeft' || settings.position == 'topCenter' || settings.position == 'topRight') { 2491 $DOM.wrapper.insertBefore($DOM.toastCapsule, $DOM.wrapper.firstChild); 2492 } else { 2493 $DOM.wrapper.appendChild($DOM.toastCapsule); 2494 } 2495 } 2496 2497 if (!isNaN(settings.zindex)) { 2498 $DOM.wrapper.style.zIndex = settings.zindex; 2499 } else { 2500 console.warn('[' + PLUGIN_NAME + '] Invalid zIndex.'); 2501 } 2502 })(); 2503 2504 // Overlay 2505 (function () { 2506 2507 if (settings.overlay) { 2508 2509 if (document.querySelector('.' + PLUGIN_NAME + '-overlay.fadeIn') !== null) { 2510 2511 $DOM.overlay = document.querySelector('.' + PLUGIN_NAME + '-overlay'); 2512 $DOM.overlay.setAttribute('data-iziToast-ref', $DOM.overlay.getAttribute('data-iziToast-ref') + ',' + settings.REF); 2513 2514 if (!isNaN(settings.zindex) && settings.zindex !== null) { 2515 $DOM.overlay.style.zIndex = settings.zindex - 1; 2516 } 2517 } else { 2518 2519 $DOM.overlay.classList.add(PLUGIN_NAME + '-overlay'); 2520 $DOM.overlay.classList.add('fadeIn'); 2521 $DOM.overlay.style.background = settings.overlayColor; 2522 $DOM.overlay.setAttribute('data-iziToast-ref', settings.REF); 2523 if (!isNaN(settings.zindex) && settings.zindex !== null) { 2524 $DOM.overlay.style.zIndex = settings.zindex - 1; 2525 } 2526 document.querySelector('body').appendChild($DOM.overlay); 2527 } 2528 2529 if (settings.overlayClose) { 2530 2531 $DOM.overlay.removeEventListener('click', {}); 2532 $DOM.overlay.addEventListener('click', function (e) { 2533 that.hide(settings, $DOM.toast, 'overlay'); 2534 }); 2535 } else { 2536 $DOM.overlay.removeEventListener('click', {}); 2537 } 2538 2539 } 2540 2541 })(); 2542 2543 // Inside animations 2544 (function () { 2545 if (settings.animateInside) { 2546 $DOM.toast.classList.add(PLUGIN_NAME + '-animateInside'); 2547 2548 var animationTimes = [200, 100, 300]; 2549 if (settings.transitionIn == 'bounceInLeft' || settings.transitionIn == 'bounceInRight') { 2550 animationTimes = [400, 200, 400]; 2551 } 2552 2553 if (settings.title.length > 0) { 2554 setTimeout(function () { 2555 $DOM.strong.classList.add('slideIn'); 2556 }, animationTimes[0]); 2557 } 2558 2559 if (settings.message.length > 0) { 2560 setTimeout(function () { 2561 $DOM.p.classList.add('slideIn'); 2562 }, animationTimes[1]); 2563 } 2564 2565 if (settings.icon) { 2566 setTimeout(function () { 2567 $DOM.icon.classList.add('revealIn'); 2568 }, animationTimes[2]); 2569 } 2570 2571 var counter = 150; 2572 if (settings.buttons.length > 0 && $DOM.buttons) { 2573 2574 setTimeout(function () { 2575 2576 forEach($DOM.buttons.childNodes, function (element, index) { 2577 2578 setTimeout(function () { 2579 element.classList.add('revealIn'); 2580 }, counter); 2581 counter = counter + 150; 2582 }); 2583 2584 }, settings.inputs.length > 0 ? 150 : 0); 2585 } 2586 2587 if (settings.inputs.length > 0 && $DOM.inputs) { 2588 counter = 150; 2589 forEach($DOM.inputs.childNodes, function (element, index) { 2590 2591 setTimeout(function () { 2592 element.classList.add('revealIn'); 2593 }, counter); 2594 counter = counter + 150; 2595 }); 2596 } 2597 } 2598 })(); 2599 2600 settings.onOpening.apply(null, [settings, $DOM.toast]); 2601 2602 try { 2603 var event = new CustomEvent(PLUGIN_NAME + '-opening', { detail: settings, bubbles: true, cancelable: true }); 2604 document.dispatchEvent(event); 2605 } catch (ex) { 2606 console.warn(ex); 2607 } 2608 2609 setTimeout(function () { 2610 2611 $DOM.toast.classList.remove(PLUGIN_NAME + '-opening'); 2612 $DOM.toast.classList.add(PLUGIN_NAME + '-opened'); 2613 2614 try { 2615 var event = new CustomEvent(PLUGIN_NAME + '-opened', { detail: settings, bubbles: true, cancelable: true }); 2616 document.dispatchEvent(event); 2617 } catch (ex) { 2618 console.warn(ex); 2619 } 2620 2621 settings.onOpened.apply(null, [settings, $DOM.toast]); 2622 }, 1000); 2623 2624 if (settings.drag) { 2625 2626 if (ACCEPTSTOUCH) { 2627 2628 $DOM.toast.addEventListener('touchstart', function (e) { 2629 drag.startMoving(this, that, settings, e); 2630 }, false); 2631 2632 $DOM.toast.addEventListener('touchend', function (e) { 2633 drag.stopMoving(this, e); 2634 }, false); 2635 } else { 2636 2637 $DOM.toast.addEventListener('mousedown', function (e) { 2638 e.preventDefault(); 2639 drag.startMoving(this, that, settings, e); 2640 }, false); 2641 2642 $DOM.toast.addEventListener('mouseup', function (e) { 2643 e.preventDefault(); 2644 drag.stopMoving(this, e); 2645 }, false); 2646 } 2647 } 2648 2649 if (settings.closeOnEscape) { 2650 2651 document.addEventListener('keyup', function (evt) { 2652 evt = evt || window.event; 2653 if (evt.keyCode == 27) { 2654 that.hide(settings, $DOM.toast, 'esc'); 2655 } 2656 }); 2657 } 2658 2659 that.toast = $DOM.toast; 2660 }; 2661 2662 2663 return $iziToast; 2664}); 2665 2666/* OVERRIDE TOASTR METHODS */ 2667 2668toastr.error = function (message, title, optionsOverride) { 2669 if (optionsOverride === undefined) { 2670 optionsOverride = { timeOut: false }; 2671 } 2672 2673 toastr.iziToastAlert(message, (title || ''), { 2674 backgroundColor: '#ff7979', 2675 icon: 'ico-success', 2676 timeout: optionsOverride.timeOut 2677 }); 2678} 2679 2680toastr.warning = function (message, title, optionsOverride) { 2681 if (optionsOverride === undefined) { 2682 optionsOverride = { timeOut: false }; 2683 } 2684 2685 toastr.iziToastAlert(message, (title || ''), { 2686 backgroundColor: '#ffbe79', 2687 icon: 'ico-success', 2688 timeout: optionsOverride.timeOut 2689 }); 2690} 2691toastr.info = function (message, title, optionsOverride) { 2692 if (optionsOverride === undefined) { 2693 optionsOverride = { timeOut: false }; 2694 } 2695 2696 toastr.iziToastAlert(message, (title || ''), { 2697 backgroundColor: '#79e5ff', 2698 icon: 'ico-success', 2699 timeout: optionsOverride.timeOut 2700 }); 2701} 2702toastr.success = function (message, title, optionsOverride) { 2703 if (optionsOverride === undefined) { 2704 optionsOverride = { timeOut: false }; 2705 } 2706 2707 toastr.iziToastAlert(message, (title || ''), { 2708 backgroundColor: '#c1f0c1', 2709 icon: 'ico-success', 2710 timeout: optionsOverride.timeOut 2711 }); 2712} 2713 2714 2715toastr.iziToastAlert = function (message, title, options) { 2716 iziToast.show({ 2717 title: title, 2718 message: message, 2719 theme: 'light', 2720 backgroundColor: options.backgroundColor, 2721 icon: options.icon, 2722 close: true, 2723 closeOnEscape: true,
2724 position: 'topCenter', // bottomRight, bottomLeft, topRight, topLeft, topCenter, bottomCenter, center 2725 timeout: options.timeout, 2726 overlay: false, 2727 overlayClose: true 2728 }); 2729};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.