1 2/*! 3 4========================================================= 5* Argon Dashboard PRO - v1.1.0 6========================================================= 7 8* Product Page: https://www.creative-tim.com/product/argon-dashboard 9* Copyright 2019 Creative Tim (https://www.creative-tim.com) 10 11* Coded by www.creative-tim.com 12 13========================================================= 14 15* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 16 17*/ 18 19 20 21// 22// Layout 23// 24 25'use strict'; 26 27var Layout = (function() { 28 29 function pinSidenav() { 30 $('.sidenav-toggler').addClass('active'); 31 $('.sidenav-toggler').data('action', 'sidenav-unpin'); 32 $('body').removeClass('g-sidenav-hidden').addClass('g-sidenav-show g-sidenav-pinned'); 33 $('body').append('<div class="backdrop d-xl-none" data-action="sidenav-unpin" data-target='+$('#sidenav-main').data('target')+' />'); 34 35 // Store the sidenav state in a cookie session 36 Cookies.set('sidenav-state', 'pinned'); 37 } 38 39 function unpinSidenav() { 40 $('.sidenav-toggler').removeClass('active'); 41 $('.sidenav-toggler').data('action', 'sidenav-pin'); 42 $('body').removeClass('g-sidenav-pinned').addClass('g-sidenav-hidden'); 43 $('body').find('.backdrop').remove(); 44 45 // Store the sidenav state in a cookie session 46 Cookies.set('sidenav-state', 'unpinned'); 47 } 48 49 // Set sidenav state from cookie 50 51 var $sidenavState = Cookies.get('sidenav-state') ? Cookies.get('sidenav-state') : 'pinned'; 52 53 if($(window).width() > 1200) { 54 if($sidenavState == 'pinned') { 55 pinSidenav() 56 } 57 58 if(Cookies.get('sidenav-state') == 'unpinned') { 59 unpinSidenav() 60 } 61 } 62 63 $("body").on("click", "[data-action]", function(e) { 64 65 e.preventDefault(); 66 67 var $this = $(this); 68 var action = $this.data('action'); 69 var target = $this.data('target'); 70 71 72 // Manage actions 73 74 switch (action) { 75 case 'sidenav-pin': 76 pinSidenav(); 77 break; 78 79 case 'sidenav-unpin': 80 unpinSidenav(); 81 break; 82 83 case 'search-show': 84 target = $this.data('target'); 85 $('body').removeClass('g-navbar-search-show').addClass('g-navbar-search-showing'); 86 87 setTimeout(function() { 88 $('body').removeClass('g-navbar-search-showing').addClass('g-navbar-search-show'); 89 }, 150); 90 91 setTimeout(function() { 92 $('body').addClass('g-navbar-search-shown'); 93 }, 300) 94 break; 95 96 case 'search-close': 97 target = $this.data('target'); 98 $('body').removeClass('g-navbar-search-shown'); 99 100 setTimeout(function() { 101 $('body').removeClass('g-navbar-search-show').addClass('g-navbar-search-hiding'); 102 }, 150); 103 104 setTimeout(function() { 105 $('body').removeClass('g-navbar-search-hiding').addClass('g-navbar-search-hidden'); 106 }, 300); 107 108 setTimeout(function() { 109 $('body').removeClass('g-navbar-search-hidden'); 110 }, 500); 111 break; 112 } 113 }) 114 115 116 // Add sidenav modifier classes on mouse events 117 118 $('.sidenav').on('mouseenter', function() { 119 if(! $('body').hasClass('g-sidenav-pinned')) { 120 $('body').removeClass('g-sidenav-hide').removeClass('g-sidenav-hidden').addClass('g-sidenav-show'); 121 } 122 }) 123 124 $('.sidenav').on('mouseleave', function() { 125 if(! $('body').hasClass('g-sidenav-pinned')) { 126 $('body').removeClass('g-sidenav-show').addClass('g-sidenav-hide'); 127 128 setTimeout(function() { 129 $('body').removeClass('g-sidenav-hide').addClass('g-sidenav-hidden'); 130 }, 300); 131 } 132 }) 133 134 135 // Make the body full screen size if it has not enough content inside 136 $(window).on('load resize', function() { 137 if($('body').height() < 800) { 138 $('body').css('min-height', '100vh'); 139 $('#footer-main').addClass('footer-auto-bottom') 140 } 141 }) 142 143})(); 144 145// 146// Charts 147// 148 149'use strict'; 150 151var Charts = (function() { 152 153 // Variable 154 155 var $toggle = $('[data-toggle="chart"]'); 156 var mode = 'light';//(themeMode) ? themeMode : 'light'; 157 var fonts = { 158 base: 'Open Sans' 159 } 160 161 // Colors 162 var colors = { 163 gray: { 164 100: '#f6f9fc', 165 200: '#e9ecef', 166 300: '#dee2e6', 167 400: '#ced4da', 168 500: '#adb5bd', 169 600: '#8898aa', 170 700: '#525f7f', 171 800: '#32325d', 172 900: '#212529' 173 }, 174 theme: { 175 'default': '#172b4d', 176 'primary': '#5e72e4', 177 'secondary': '#f4f5f7', 178 'info': '#11cdef', 179 'success': '#2dce89', 180 'danger': '#f5365c', 181 'warning': '#fb6340' 182 }, 183 black: '#12263F', 184 white: '#FFFFFF', 185 transparent: 'transparent', 186 }; 187 188 189 // Methods 190 191 // Chart.js global options 192 function chartOptions() { 193 194 // Options 195 var options = { 196 defaults: { 197 global: { 198 responsive: true, 199 maintainAspectRatio: false, 200 defaultColor: (mode == 'dark') ? colors.gray[700] : colors.gray[600], 201 defaultFontColor: (mode == 'dark') ? colors.gray[700] : colors.gray[600], 202 defaultFontFamily: fonts.base, 203 defaultFontSize: 13, 204 layout: { 205 padding: 0 206 }, 207 legend: { 208 display: false, 209 position: 'bottom', 210 labels: { 211 usePointStyle: true, 212 padding: 16 213 } 214 }, 215 elements: { 216 point: { 217 radius: 0, 218 backgroundColor: colors.theme['primary'] 219 }, 220 line: { 221 tension: .4, 222 borderWidth: 4, 223 borderColor: colors.theme['primary'], 224 backgroundColor: colors.transparent, 225 borderCapStyle: 'rounded' 226 }, 227 rectangle: { 228 backgroundColor: colors.theme['warning'] 229 }, 230 arc: { 231 backgroundColor: colors.theme['primary'], 232 borderColor: (mode == 'dark') ? colors.gray[800] : colors.white, 233 borderWidth: 4 234 } 235 }, 236 tooltips: { 237 enabled: true, 238 mode: 'index', 239 intersect: false, 240 } 241 }, 242 doughnut: { 243 cutoutPercentage: 83,
244 legendCallback: function(chart) { 245 var data = chart.data; 246 var content = ''; 247 248 data.labels.forEach(function(label, index) { 249 var bgColor = data.datasets[0].backgroundColor[index]; 250 251 content += '<span class="chart-legend-item">'; 252 content += '<i class="chart-legend-indicator" style="background-color: ' + bgColor + '"></i>'; 253 content += label; 254 content += '</span>'; 255 }); 256 257 return content; 258 } 259 } 260 } 261 } 262 263 // yAxes 264 Chart.scaleService.updateScaleDefaults('linear', { 265 gridLines: { 266 borderDash: [2], 267 borderDashOffset: [2], 268 color: (mode == 'dark') ? colors.gray[900] : colors.gray[300], 269 drawBorder: false, 270 drawTicks: false, 271 drawOnChartArea: true, 272 zeroLineWidth: 0, 273 zeroLineColor: 'rgba(0,0,0,0)', 274 zeroLineBorderDash: [2], 275 zeroLineBorderDashOffset: [2] 276 }, 277 ticks: { 278 beginAtZero: true, 279 padding: 10, 280 callback: function(value) { 281 if (!(value % 10)) { 282 return value 283 } 284 } 285 } 286 }); 287 288 // xAxes 289 Chart.scaleService.updateScaleDefaults('category', { 290 gridLines: { 291 drawBorder: false, 292 drawOnChartArea: false, 293 drawTicks: false 294 }, 295 ticks: { 296 padding: 20 297 }, 298 maxBarThickness: 10 299 }); 300 301 return options; 302 303 } 304 305 // Parse global options 306 function parseOptions(parent, options) { 307 for (var item in options) { 308 if (typeof options[item] !== 'object') { 309 parent[item] = options[item]; 310 } else { 311 parseOptions(parent[item], options[item]); 312 } 313 } 314 } 315 316 // Push options 317 function pushOptions(parent, options) { 318 for (var item in options) { 319 if (Array.isArray(options[item])) { 320 options[item].forEach(function(data) { 321 parent[item].push(data); 322 }); 323 } else { 324 pushOptions(parent[item], options[item]); 325 } 326 } 327 } 328 329 // Pop options 330 function popOptions(parent, options) { 331 for (var item in options) { 332 if (Array.isArray(options[item])) { 333 options[item].forEach(function(data) { 334 parent[item].pop(); 335 }); 336 } else { 337 popOptions(parent[item], options[item]); 338 } 339 } 340 } 341 342 // Toggle options 343 function toggleOptions(elem) { 344 var options = elem.data('add'); 345 var $target = $(elem.data('target')); 346 var $chart = $target.data('chart'); 347 348 if (elem.is(':checked')) { 349 350 // Add options 351 pushOptions($chart, options); 352 353 // Update chart 354 $chart.update(); 355 } else { 356 357 // Remove options 358 popOptions($chart, options); 359 360 // Update chart 361 $chart.update(); 362 } 363 } 364 365 // Update options 366 function updateOptions(elem) { 367 var options = elem.data('update'); 368 var $target = $(elem.data('target')); 369 var $chart = $target.data('chart'); 370 371 // Parse options 372 parseOptions($chart, options); 373 374 // Toggle ticks 375 toggleTicks(elem, $chart); 376 377 // Update chart 378 $chart.update(); 379 } 380 381 // Toggle ticks 382 function toggleTicks(elem, $chart) { 383 384 if (elem.data('prefix') !== undefined || elem.data('prefix') !== undefined) { 385 var prefix = elem.data('prefix') ? elem.data('prefix') : ''; 386 var suffix = elem.data('suffix') ? elem.data('suffix') : ''; 387 388 // Update ticks 389 $chart.options.scales.yAxes[0].ticks.callback = function(value) { 390 if (!(value % 10)) { 391 return prefix + value + suffix; 392 } 393 } 394 395 // Update tooltips 396 $chart.options.tooltips.callbacks.label = function(item, data) { 397 var label = data.datasets[item.datasetIndex].label || ''; 398 var yLabel = item.yLabel; 399 var content = ''; 400 401 if (data.datasets.length > 1) { 402 content += '<span class="popover-body-label mr-auto">' + label + '</span>'; 403 } 404 405 content += '<span class="popover-body-value">' + prefix + yLabel + suffix + '</span>'; 406 return content; 407 } 408 409 } 410 } 411 412 413 // Events 414 415 // Parse global options 416 if (window.Chart) { 417 parseOptions(Chart, chartOptions()); 418 } 419 420 // Toggle options 421 $toggle.on({ 422 'change': function() { 423 var $this = $(this); 424 425 if ($this.is('[data-add]')) { 426 toggleOptions($this); 427 } 428 }, 429 'click': function() { 430 var $this = $(this); 431 432 if ($this.is('[data-update]')) { 433 updateOptions($this); 434 } 435 } 436 }); 437 438 439 // Return 440 441 return { 442 colors: colors, 443 fonts: fonts, 444 mode: mode 445 }; 446 447})(); 448 449// 450// Icon code copy/paste 451// 452 453'use strict'; 454 455var CopyIcon = (function() { 456 457 // Variables 458 459 var $element = '.btn-icon-clipboard', 460 $btn = $($element); 461 462 463 // Methods 464 465 function init($this) { 466 $this.tooltip().on('mouseleave', function() { 467 // Explicitly hide tooltip, since after clicking it remains 468 // focused (as it's a button), so tooltip would otherwise 469 // remain visible until focus is moved away 470 $this.tooltip('hide'); 471 }); 472 473 var clipboard = new ClipboardJS($element); 474 475 clipboard.on('success', function(e) { 476 $(e.trigger) 477 .attr('title', 'Copied!') 478 .tooltip('_fixTitle') 479 .tooltip('show') 480 .attr('title', 'Copy to clipboard') 481 .tooltip('_fixTitle') 482 483 e.clearSelection() 484 }); 485 } 486 487 488 // Events 489 if ($btn.length) { 490 init($btn); 491 } 492 493})(); 494 495// 496// Navbar 497// 498 499'use strict'; 500 501var Navbar = (function() { 502 503 // Variables 504 505 var $nav = $('.navbar-nav, .navbar-nav .nav'); 506 var $collapse = $('.navbar .collapse'); 507 var $dropdown = $('.navbar .dropdown'); 508 509 // Methods 510 511 function accordion($this) { 512 $this.closest($nav).find($collapse).not($this).collapse('hide'); 513 } 514 515 function closeDropdown($this) { 516 var $dropdownMenu = $this.find('.dropdown-menu'); 517 518 $dropdownMenu.addClass('close'); 519 520 setTimeout(function() { 521 $dropdownMenu.removeClass('close'); 522 }, 200); 523 } 524 525 526 // Events 527 528 $collapse.on({ 529 'show.bs.collapse': function() { 530 accordion($(this)); 531 } 532 }) 533 534 $dropdown.on({ 535 'hide.bs.dropdown': function() { 536 closeDropdown($(this)); 537 } 538 }) 539 540})(); 541 542 543// 544// Navbar collapse 545// 546 547
548var NavbarCollapse = (function() { 549 550 // Variables 551 552 var $nav = $('.navbar-nav'), 553 $collapse = $('.navbar .navbar-custom-collapse'); 554 555 556 // Methods 557 558 function hideNavbarCollapse($this) { 559 $this.addClass('collapsing-out'); 560 } 561 562 function hiddenNavbarCollapse($this) { 563 $this.removeClass('collapsing-out'); 564 } 565 566 567 // Events 568 569 if ($collapse.length) { 570 $collapse.on({ 571 'hide.bs.collapse': function() { 572 hideNavbarCollapse($collapse); 573 } 574 }) 575 576 $collapse.on({ 577 'hidden.bs.collapse': function() { 578 hiddenNavbarCollapse($collapse); 579 } 580 }) 581 } 582 583})(); 584 585// 586// Popover 587// 588 589'use strict'; 590 591var Popover = (function() { 592 593 // Variables 594 595 var $popover = $('[data-toggle="popover"]'), 596 $popoverClass = ''; 597 598 599 // Methods 600 601 function init($this) { 602 if ($this.data('color')) { 603 $popoverClass = 'popover-' + $this.data('color'); 604 } 605 606 var options = { 607 trigger: 'focus', 608 template: '<div class="popover ' + $popoverClass + '" role="tooltip"><div class="arrow"></div><h3 class="popover-header"></h3><div class="popover-body"></div></div>' 609 }; 610 611 $this.popover(options); 612 } 613 614 615 // Events 616 617 if ($popover.length) { 618 $popover.each(function() { 619 init($(this)); 620 }); 621 } 622 623})(); 624 625// 626// Scroll to (anchor links) 627// 628 629'use strict'; 630 631var ScrollTo = (function() { 632 633 // 634 // Variables 635 // 636 637 var $scrollTo = $('.scroll-me, [data-scroll-to], .toc-entry a'); 638 639 640 // 641 // Methods 642 // 643 644 function scrollTo($this) { 645 var $el = $this.attr('href'); 646 var offset = $this.data('scroll-to-offset') ? $this.data('scroll-to-offset') : 0; 647 var options = { 648 scrollTop: $($el).offset().top - offset 649 }; 650 651 // Animate scroll to the selected section 652 $('html, body').stop(true, true).animate(options, 600); 653 654 event.preventDefault(); 655 } 656 657 658 // 659 // Events 660 // 661 662 if ($scrollTo.length) { 663 $scrollTo.on('click', function(event) { 664 scrollTo($(this)); 665 }); 666 } 667 668})(); 669 670// 671// Tooltip 672// 673 674'use strict'; 675 676var Tooltip = (function() { 677 678 // Variables 679 680 var $tooltip = $('[data-toggle="tooltip"]'); 681 682 683 // Methods 684 685 function init() { 686 $tooltip.tooltip(); 687 } 688 689 690 // Events 691 692 if ($tooltip.length) { 693 init(); 694 } 695 696})(); 697 698// 699// Checklist 700// 701 702'use strict'; 703 704var Checklist = (function() { 705 706 // 707 // Variables 708 // 709 710 var $list = $('[data-toggle="checklist"]') 711 712 713 // 714 // Methods 715 // 716 717 // Init 718 function init($this) { 719 var $checkboxes = $this.find('.checklist-entry input[type="checkbox"]'); 720 721 $checkboxes.each(function() { 722 checkEntry($(this)); 723 }); 724 725 } 726 727 function checkEntry($checkbox) { 728 if($checkbox.is(':checked')) { 729 $checkbox.closest('.checklist-item').addClass('checklist-item-checked'); 730 } else { 731 $checkbox.closest('.checklist-item').removeClass('checklist-item-checked'); 732 } 733 } 734 735 736 // 737 // Events 738 // 739 740 // Init 741 if ($list.length) { 742 $list.each(function() { 743 init($(this)); 744 }); 745 746 $list.find('input[type="checkbox"]').on('change', function() { 747 checkEntry($(this)); 748 }); 749 } 750 751})(); 752 753// 754// Form control 755// 756 757'use strict'; 758 759var FormControl = (function() { 760 761 // Variables 762 763 var $input = $('.form-control'); 764 765 766 // Methods 767 768 function init($this) { 769 $this.on('focus blur', function(e) { 770 $(this).parents('.form-group').toggleClass('focused', (e.type === 'focus')); 771 }).trigger('blur'); 772 } 773 774 775 // Events 776 777 if ($input.length) { 778 init($input); 779 } 780 781})(); 782 783// 784// Google maps 785// 786 787var $map = $('#map-default'), 788 map, 789 lat, 790 lng, 791 color = "#5e72e4"; 792 793function initMap() { 794 795 map = document.getElementById('map-default'); 796 lat = map.getAttribute('data-lat'); 797 lng = map.getAttribute('data-lng'); 798 799 var myLatlng = new google.maps.LatLng(lat, lng); 800 var mapOptions = { 801 zoom: 12, 802 scrollwheel: false, 803 center: myLatlng, 804 mapTypeId: google.maps.MapTypeId.ROADMAP, 805 } 806 807 map = new google.maps.Map(map, mapOptions); 808 809 var marker = new google.maps.Marker({ 810 position: myLatlng, 811 map: map, 812 animation: google.maps.Animation.DROP, 813 title: 'Hello World!' 814 }); 815 816 var contentString = '<div class="info-window-content"><h2>Argon Dashboard PRO</h2>' + 817 '<p>A beautiful premium dashboard for Bootstrap 4.</p></div>'; 818 819 var infowindow = new google.maps.InfoWindow({ 820 content: contentString 821 }); 822 823 google.maps.event.addListener(marker, 'click', function() { 824 infowindow.open(map, marker); 825 }); 826} 827 828if($map.length) { 829 google.maps.event.addDomListener(window, 'load', initMap); 830} 831 832// 833// Google maps 834// 835 836var $map = $('#map-custom'), 837 map, 838 lat, 839 lng, 840 color = "#5e72e4"; 841 842function initMap() { 843 844 map = document.getElementById('map-custom'); 845 lat = map.getAttribute('data-lat'); 846 lng = map.getAttribute('data-lng'); 847 848 var myLatlng = new google.maps.LatLng(lat, lng); 849 var mapOptions = { 850 zoom: 12, 851 scrollwheel: false, 852 center: myLatlng, 853 mapTypeId: google.maps.MapTypeId.ROADMAP, 854 styles: [{"featureType":"administrative","elementType":"labels.text.fill","stylers":[{"color":"#444444"}]},{"featureType":"landscape","elementType":"all","stylers":[{"color":"#f2f2f2"}]},{"featureType":"poi","elementType":"all","stylers":[{"visibility":"off"}]},{"featureType":"road","elementType":"all","stylers":[{"saturation":-100},{"lightness":45}]},{"featureType":"road.highway","elementType":"all","stylers":[{"visibility":"simplified"}]},{"featureType":"road.arterial","elementType":"labels.icon","stylers":[{"visibility":"off"}]},{"featureType":"transit","elementType":"all","stylers":[{"visibility":"off"}]},{"featureType":"water","elementType":"all","stylers":[{"color":color},{"visibility":"on"}]}] 855 } 856 857 map = new google.maps.Map(map, mapOptions); 858 859 var marker = new google.maps.Marker({ 860 position: myLatlng, 861 map: map, 862 animation: google.maps.Animation.DROP, 863 title: 'Hello World!' 864 }); 865 866 var contentString = '<div class="info-window-content"><h2>Argon Dashboard PRO</h2>' + 867 '<p>A beautiful premium dashboard for Bootstrap 4.</p></div>'; 868 869 var infowindow = new google.maps.InfoWindow({ 870 content: contentString 871 }); 872 873 google.maps.event.addListener(marker, 'click', function() { 874 infowindow.open(map, marker); 875 }); 876} 877 878if($map.length) { 879 google.maps.event.addDomListener(window, 'load', initMap); 880} 881 882// 883// Charts 884// 885 886'use strict'; 887 888// 889// Doughnut chart 890// 891
892var BarStackedChart = (function() { 893 894 // Variables 895 896 var $chart = $('#chart-bar-stacked'); 897 898 899 // Methods 900 901 function init($this) { 902 903 // Only for demo purposes - return a random number to generate datasets 904 var randomScalingFactor = function() { 905 return Math.round(Math.random() * 100); 906 }; 907 908 909 // Chart data 910 911 var data = { 912 labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'], 913 datasets: [{ 914 label: 'Dataset 1', 915 backgroundColor: Charts.colors.theme['danger'], 916 data: [ 917 randomScalingFactor(), 918 randomScalingFactor(), 919 randomScalingFactor(), 920 randomScalingFactor(), 921 randomScalingFactor(), 922 randomScalingFactor(), 923 randomScalingFactor() 924 ] 925 }, { 926 label: 'Dataset 2', 927 backgroundColor: Charts.colors.theme['primary'], 928 data: [ 929 randomScalingFactor(), 930 randomScalingFactor(), 931 randomScalingFactor(), 932 randomScalingFactor(), 933 randomScalingFactor(), 934 randomScalingFactor(), 935 randomScalingFactor() 936 ] 937 }, { 938 label: 'Dataset 3', 939 backgroundColor: Charts.colors.theme['success'], 940 data: [ 941 randomScalingFactor(), 942 randomScalingFactor(), 943 randomScalingFactor(), 944 randomScalingFactor(), 945 randomScalingFactor(), 946 randomScalingFactor(), 947 randomScalingFactor() 948 ] 949 }] 950 951 }; 952 953 954 // Options 955 956 var options = { 957 tooltips: { 958 mode: 'index', 959 intersect: false 960 }, 961 responsive: true, 962 scales: { 963 xAxes: [{ 964 stacked: true, 965 }], 966 yAxes: [{ 967 stacked: true 968 }] 969 } 970 } 971 972 973 // Init chart 974 975 var barStackedChart = new Chart($this, { 976 type: 'bar', 977 data: data, 978 options: options 979 }); 980 981 // Save to jQuery object 982 983 $this.data('chart', barStackedChart); 984 985 }; 986 987 988 // Events 989 990 if ($chart.length) { 991 init($chart); 992 } 993 994})(); 995 996// 997// Charts 998// 999 1000'use strict'; 1001 1002// 1003// Doughnut chart 1004// 1005 1006var DoughnutChart = (function() { 1007 1008 // Variables 1009 1010 var $chart = $('#chart-doughnut'); 1011 1012 1013 // Methods 1014 1015 function init($this) { 1016 var randomScalingFactor = function() { 1017 return Math.round(Math.random() * 100); 1018 }; 1019 1020 var doughnutChart = new Chart($this, { 1021 type: 'doughnut', 1022 data: { 1023 labels: [ 1024 'Danger', 1025 'Warning', 1026 'Success', 1027 'Primary', 1028 'Info' 1029 ], 1030 datasets: [{ 1031 data: [ 1032 randomScalingFactor(), 1033 randomScalingFactor(), 1034 randomScalingFactor(), 1035 randomScalingFactor(), 1036 randomScalingFactor(), 1037 ], 1038 backgroundColor: [ 1039 Charts.colors.theme['danger'], 1040 Charts.colors.theme['warning'], 1041 Charts.colors.theme['success'], 1042 Charts.colors.theme['primary'], 1043 Charts.colors.theme['info'], 1044 ], 1045 label: 'Dataset 1' 1046 }], 1047 }, 1048 options: { 1049 responsive: true, 1050 legend: { 1051 position: 'top', 1052 }, 1053 animation: { 1054 animateScale: true, 1055 animateRotate: true 1056 } 1057 } 1058 }); 1059 1060 // Save to jQuery object 1061 1062 $this.data('chart', doughnutChart); 1063 1064 }; 1065 1066 1067 // Events 1068 1069 if ($chart.length) { 1070 init($chart); 1071 } 1072 1073})(); 1074 1075// 1076// Charts 1077// 1078 1079'use strict'; 1080 1081// 1082// Doughnut chart 1083// 1084 1085var PieChart = (function() { 1086 1087 // Variables 1088 1089 var $chart = $('#chart-pie'); 1090 1091 1092 // Methods 1093 1094 function init($this) { 1095 var randomScalingFactor = function() { 1096 return Math.round(Math.random() * 100); 1097 }; 1098 1099 var pieChart = new Chart($this, { 1100 type: 'pie', 1101 data: { 1102 labels: [ 1103 'Danger', 1104 'Warning', 1105 'Success', 1106 'Primary', 1107 'Info' 1108 ], 1109 datasets: [{ 1110 data: [ 1111 randomScalingFactor(), 1112 randomScalingFactor(), 1113 randomScalingFactor(), 1114 randomScalingFactor(), 1115 randomScalingFactor(), 1116 ], 1117 backgroundColor: [ 1118 Charts.colors.theme['danger'], 1119 Charts.colors.theme['warning'], 1120 Charts.colors.theme['success'], 1121 Charts.colors.theme['primary'], 1122 Charts.colors.theme['info'], 1123 ], 1124 label: 'Dataset 1' 1125 }], 1126 }, 1127 options: { 1128 responsive: true, 1129 legend: { 1130 position: 'top', 1131 }, 1132 animation: { 1133 animateScale: true, 1134 animateRotate: true 1135 } 1136 } 1137 }); 1138 1139 // Save to jQuery object 1140 1141 $this.data('chart', pieChart); 1142 1143 }; 1144 1145 1146 // Events 1147 1148 if ($chart.length) { 1149 init($chart); 1150 } 1151 1152})(); 1153 1154// 1155// Charts 1156// 1157 1158'use strict'; 1159 1160// 1161// Points chart 1162// 1163 1164var PointsChart = (function() { 1165 1166 // Variables 1167
1168 var $chart = $('#chart-points'); 1169 1170 1171 // Methods 1172 1173 function init($this) { 1174 var salesChart = new Chart($this, { 1175 type: 'line', 1176 options: { 1177 scales: { 1178 yAxes: [{ 1179 gridLines: { 1180 color: Charts.colors.gray[200], 1181 zeroLineColor: Charts.colors.gray[200] 1182 }, 1183 ticks: { 1184 1185 } 1186 }] 1187 } 1188 }, 1189 data: { 1190 labels: ['May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], 1191 datasets: [{ 1192 label: 'Performance', 1193 data: [10, 18, 28, 23, 28, 40, 36, 46, 52], 1194 pointRadius: 10, 1195 pointHoverRadius: 15, 1196 showLine: false 1197 }] 1198 } 1199 }); 1200 1201 // Save to jQuery object 1202 1203 $this.data('chart', salesChart); 1204 1205 }; 1206 1207 1208 // Events 1209 1210 if ($chart.length) { 1211 init($chart); 1212 } 1213 1214})(); 1215 1216// 1217// Charts 1218// 1219 1220'use strict'; 1221 1222// 1223// Sales chart 1224// 1225 1226var SalesChart = (function() { 1227 1228 // Variables 1229 1230 var $chart = $('#chart-sales-dark'); 1231 1232 1233 // Methods 1234 1235 function init($this) { 1236 var salesChart = new Chart($this, { 1237 type: 'line', 1238 options: { 1239 scales: { 1240 yAxes: [{ 1241 gridLines: { 1242 color: Charts.colors.gray[700], 1243 zeroLineColor: Charts.colors.gray[700] 1244 }, 1245 ticks: { 1246 1247 } 1248 }] 1249 } 1250 }, 1251 data: { 1252 labels: ['May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], 1253 datasets: [{ 1254 label: 'Performance', 1255 data: [0, 20, 10, 30, 15, 40, 20, 60, 60] 1256 }] 1257 } 1258 }); 1259 1260 // Save to jQuery object 1261 1262 $this.data('chart', salesChart); 1263 1264 }; 1265 1266 1267 // Events 1268 1269 if ($chart.length) { 1270 init($chart); 1271 } 1272 1273})(); 1274 1275// 1276// Charts 1277// 1278 1279'use strict'; 1280 1281// 1282// Sales chart 1283// 1284 1285var SalesChart = (function() { 1286 1287 // Variables 1288 1289 var $chart = $('#chart-sales'); 1290 1291 1292 // Methods 1293 1294 function init($this) { 1295 var salesChart = new Chart($this, { 1296 type: 'line', 1297 options: { 1298 scales: { 1299 yAxes: [{ 1300 gridLines: { 1301 color: Charts.colors.gray[200], 1302 zeroLineColor: Charts.colors.gray[200] 1303 }, 1304 ticks: { 1305 1306 } 1307 }] 1308 } 1309 }, 1310 data: { 1311 labels: ['May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], 1312 datasets: [{ 1313 label: 'Performance', 1314 data: [0, 20, 10, 30, 15, 40, 20, 60, 60] 1315 }] 1316 } 1317 }); 1318 1319 // Save to jQuery object 1320 1321 $this.data('chart', salesChart); 1322 1323 }; 1324 1325 1326 // Events 1327 1328 if ($chart.length) { 1329 init($chart); 1330 } 1331 1332})(); 1333 1334// 1335// Bars chart 1336// 1337 1338var BarsChart = (function() { 1339 1340 // 1341 // Variables 1342 // 1343 1344 var $chart = $('#chart-bars'); 1345 1346 1347 // 1348 // Methods 1349 // 1350 1351 // Init chart 1352 function initChart($chart) { 1353 1354 // Create chart 1355 var ordersChart = new Chart($chart, { 1356 type: 'bar', 1357 data: { 1358 labels: ['Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], 1359 datasets: [{ 1360 label: 'Sales', 1361 data: [25, 20, 30, 22, 17, 29] 1362 }] 1363 } 1364 }); 1365 1366 // Save to jQuery object 1367 $chart.data('chart', ordersChart); 1368 } 1369 1370 1371 // Init chart 1372 if ($chart.length) { 1373 initChart($chart); 1374 } 1375 1376})(); 1377 1378// 1379// Charts 1380// 1381 1382'use strict'; 1383 1384// 1385// Sales chart 1386// 1387 1388var LineChart = (function() { 1389 1390 // Variables 1391 1392 var $chart = $('#chart-line'); 1393 1394 1395 // Methods 1396 1397 function init($this) { 1398 var salesChart = new Chart($this, { 1399 type: 'line', 1400 options: { 1401 scales: { 1402 yAxes: [{ 1403 gridLines: { 1404 color: Charts.colors.gray[200], 1405 zeroLineColor: Charts.colors.gray[200] 1406 }, 1407 ticks: { 1408 1409 } 1410 }] 1411 } 1412 }, 1413 data: { 1414 labels: ['May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], 1415 datasets: [{ 1416 label: 'Performance', 1417 data: [0, 20, 10, 30, 15, 40, 20, 60, 60] 1418 }] 1419 } 1420 }); 1421 1422 // Save to jQuery object 1423 1424 $this.data('chart', salesChart); 1425 1426 }; 1427 1428 1429 // Events 1430 1431 if ($chart.length) { 1432 init($chart); 1433 } 1434 1435})(); 1436 1437// 1438// Widget Calendar 1439// 1440 1441 1442if($('[data-toggle="widget-calendar"]')[0]) { 1443 $('[data-toggle="widget-calendar"]').fullCalendar({ 1444 contentHeight: 'auto', 1445 theme: false, 1446 buttonIcons: { 1447 prev: ' ni ni-bold-left', 1448 next: ' ni ni-bold-right' 1449 }, 1450 header: { 1451 right: 'next', 1452 center: 'title, ', 1453 left: 'prev' 1454 }, 1455 defaultDate: '2018-12-01', 1456 editable: true, 1457 events: [ 1458 1459 { 1460 title: 'Call with Dave', 1461 start: '2018-11-18', 1462 end: '2018-11-18', 1463 className: 'bg-red' 1464 }, 1465 1466 { 1467 title: 'Lunch meeting', 1468 start: '2018-11-21', 1469 end: '2018-11-22', 1470 className: 'bg-orange' 1471 }, 1472 1473 { 1474 title: 'All day conference', 1475 start: '2018-11-29', 1476 end: '2018-11-29', 1477 className: 'bg-green' 1478 }, 1479 1480 { 1481 title: 'Meeting with Mary', 1482 start: '2018-12-01', 1483 end: '2018-12-01', 1484 className: 'bg-blue' 1485 }, 1486 1487 { 1488 title: 'Winter Hackaton', 1489 start: '2018-12-03', 1490 end: '2018-12-03', 1491 className: 'bg-red' 1492 }, 1493 1494 { 1495 title: 'Digital event', 1496 start: '2018-12-07', 1497 end: '2018-12-09', 1498 className: 'bg-warning' 1499 }, 1500 1501 { 1502 title: 'Marketing event', 1503 start: '2018-12-10', 1504 end: '2018-12-10', 1505 className: 'bg-purple' 1506 }, 1507 1508 { 1509 title: 'Dinner with Family', 1510 start: '2018-12-19', 1511 end: '2018-12-19', 1512 className: 'bg-red' 1513 }, 1514 1515 { 1516 title: 'Black Friday', 1517 start: '2018-12-23', 1518 end: '2018-12-23', 1519 className: 'bg-blue' 1520 }, 1521 1522 { 1523 title: 'Cyber Week', 1524 start: '2018-12-02', 1525 end: '2018-12-02', 1526 className: 'bg-yellow' 1527 }, 1528 1529 ] 1530 }); 1531 1532 //Display Current Date as Calendar widget header 1533 var mYear = moment().format('YYYY'); 1534 var mDay = moment().format('dddd, MMM D'); 1535 $('.widget-calendar-year').html(mYear); 1536 $('.widget-calendar-day').html(mDay); 1537} 1538 1539// 1540// Datatable 1541// 1542 1543'use strict'; 1544 1545var DatatableBasic = (function() { 1546 1547 // Variables 1548 1549 var $dtBasic = $('#datatable-basic'); 1550 1551 1552 // Methods 1553 1554 function init($this) { 1555 1556 // Basic options. For more options check out the Datatables Docs: 1557 // https://datatables.net/manual/options 1558 1559 var options = { 1560 keys: !0, 1561 select: { 1562 style: "multi" 1563 }, 1564 language: { 1565 paginate: { 1566 previous: "<i class='fas fa-angle-left'>", 1567 next: "<i class='fas fa-angle-right'>" 1568 } 1569 }, 1570 }; 1571 1572 // Init the datatable 1573 1574 var table = $this.on( 'init.dt', function () { 1575 $('div.dataTables_length select').removeClass('custom-select custom-select-sm'); 1576 1577 }).DataTable(options); 1578 } 1579 1580 1581 // Events 1582 1583 if ($dtBasic.length) { 1584 init($dtBasic); 1585 } 1586 1587})(); 1588 1589 1590// 1591// Buttons Datatable 1592// 1593 1594var DatatableButtons = (function() { 1595 1596 // Variables 1597 1598 var $dtButtons = $('#datatable-buttons'); 1599 1600 1601 // Methods 1602 1603 function init($this) { 1604 1605 // For more options check out the Datatables Docs: 1606 // https://datatables.net/extensions/buttons/ 1607 1608 var buttons = ["copy", "print"]; 1609 1610 // Basic options. For more options check out the Datatables Docs: 1611 // https://datatables.net/manual/options 1612 1613 var options = { 1614 1615 lengthChange: !1, 1616 dom: 'Bfrtip', 1617 buttons: buttons, 1618 // select: { 1619 // style: "multi" 1620 // }, 1621 language: { 1622 paginate: { 1623 previous: "<i class='fas fa-angle-left'>", 1624 next: "<i class='fas fa-angle-right'>" 1625 } 1626 } 1627 }; 1628 1629 // Init the datatable 1630 1631 var table = $this.on( 'init.dt', function () { 1632 $('.dt-buttons .btn').removeClass('btn-secondary').addClass('btn-sm btn-default'); 1633 }).DataTable(options); 1634 } 1635 1636 1637 // Events 1638 1639 if ($dtButtons.length) { 1640 init($dtButtons); 1641 } 1642 1643})(); 1644 1645// 1646// Dropzone 1647// 1648 1649'use strict'; 1650 1651var Dropzones = (function() { 1652 1653 // 1654 // Variables 1655 // 1656 1657 var $dropzone = $('[data-toggle="dropzone"]'); 1658 var $dropzonePreview = $('.dz-preview'); 1659 1660 // 1661 // Methods 1662 // 1663 1664 function init($this) { 1665 var multiple = ($this.data('dropzone-multiple') !== undefined) ? true : false;
1666 var preview = $this.find($dropzonePreview); 1667 var currentFile = undefined; 1668 1669 // Init options 1670 var options = { 1671 url: $this.data('dropzone-url'), 1672 thumbnailWidth: null, 1673 thumbnailHeight: null, 1674 previewsContainer: preview.get(0), 1675 previewTemplate: preview.html(), 1676 maxFiles: (!multiple) ? 1 : null, 1677 acceptedFiles: (!multiple) ? 'image/*' : null, 1678 init: function() { 1679 this.on("addedfile", function(file) { 1680 if (!multiple && currentFile) { 1681 this.removeFile(currentFile); 1682 } 1683 currentFile = file; 1684 }) 1685 } 1686 } 1687 1688 // Clear preview html 1689 preview.html(''); 1690 1691 // Init dropzone 1692 $this.dropzone(options) 1693 } 1694 1695 function globalOptions() { 1696 Dropzone.autoDiscover = false; 1697 } 1698 1699 1700 // 1701 // Events 1702 // 1703 1704 if ($dropzone.length) { 1705 1706 // Set global options 1707 globalOptions(); 1708 1709 // Init dropzones 1710 $dropzone.each(function() { 1711 init($(this)); 1712 }); 1713 } 1714 1715 1716})(); 1717 1718// 1719// Bootstrap Datepicker 1720// 1721 1722'use strict'; 1723 1724var Datepicker = (function() { 1725 1726 // Variables 1727 1728 var $datepicker = $('.datepicker'); 1729 1730 1731 // Methods 1732 1733 function init($this) { 1734 var options = { 1735 disableTouchKeyboard: true, 1736 autoclose: false 1737 }; 1738 1739 $this.datepicker(options); 1740 } 1741 1742 1743 // Events 1744 1745 if ($datepicker.length) { 1746 $datepicker.each(function() { 1747 init($(this)); 1748 }); 1749 } 1750 1751})(); 1752 1753// 1754// Form control 1755// 1756 1757'use strict'; 1758 1759var noUiSlider = (function() { 1760 1761 // Variables 1762 1763 // var $sliderContainer = $('.input-slider-container'), 1764 // $slider = $('.input-slider'), 1765 // $sliderId = $slider.attr('id'), 1766 // $sliderMinValue = $slider.data('range-value-min'); 1767 // $sliderMaxValue = $slider.data('range-value-max');; 1768 1769 1770 // // Methods 1771 // 1772 // function init($this) { 1773 // $this.on('focus blur', function(e) { 1774 // $this.parents('.form-group').toggleClass('focused', (e.type === 'focus' || this.value.length > 0)); 1775 // }).trigger('blur'); 1776 // } 1777 // 1778 // 1779 // // Events 1780 // 1781 // if ($input.length) { 1782 // init($input); 1783 // } 1784 1785 1786 1787 if ($(".input-slider-container")[0]) { 1788 $('.input-slider-container').each(function() { 1789 1790 var slider = $(this).find('.input-slider'); 1791 var sliderId = slider.attr('id'); 1792 var minValue = slider.data('range-value-min'); 1793 var maxValue = slider.data('range-value-max'); 1794 1795 var sliderValue = $(this).find('.range-slider-value'); 1796 var sliderValueId = sliderValue.attr('id'); 1797 var startValue = sliderValue.data('range-value-low'); 1798 1799 var c = document.getElementById(sliderId), 1800 d = document.getElementById(sliderValueId); 1801 1802 noUiSlider.create(c, { 1803 start: [parseInt(startValue)], 1804 connect: [true, false], 1805 //step: 1000, 1806 range: { 1807 'min': [parseInt(minValue)], 1808 'max': [parseInt(maxValue)] 1809 } 1810 }); 1811 1812 c.noUiSlider.on('update', function(a, b) { 1813 d.textContent = a[b]; 1814 }); 1815 }) 1816 } 1817 1818 if ($("#input-slider-range")[0]) { 1819 var c = document.getElementById("input-slider-range"), 1820 d = document.getElementById("input-slider-range-value-low"), 1821 e = document.getElementById("input-slider-range-value-high"), 1822 f = [d, e]; 1823 1824 noUiSlider.create(c, { 1825 start: [parseInt(d.getAttribute('data-range-value-low')), parseInt(e.getAttribute('data-range-value-high'))], 1826 connect: !0, 1827 range: { 1828 min: parseInt(c.getAttribute('data-range-value-min')), 1829 max: parseInt(c.getAttribute('data-range-value-max')) 1830 } 1831 }), c.noUiSlider.on("update", function(a, b) { 1832 f[b].textContent = a[b] 1833 }) 1834 } 1835 1836})(); 1837 1838// 1839// Scrollbar 1840// 1841 1842'use strict'; 1843 1844var Scrollbar = (function() { 1845 1846 // Variables 1847 1848 var $scrollbar = $('.scrollbar-inner'); 1849 1850 1851 // Methods 1852 1853 function init() { 1854 $scrollbar.scrollbar().scrollLock() 1855 } 1856 1857 1858 // Events 1859 1860 if ($scrollbar.length) { 1861 init(); 1862 } 1863 1864})(); 1865 1866// 1867// Fullcalendar 1868// 1869 1870'use strict'; 1871 1872var Fullcalendar = (function() { 1873 1874 // Variables 1875 1876 var $calendar = $('[data-toggle="calendar"]'); 1877 1878 // 1879 // Methods 1880 // 1881 1882 // Init 1883 function init($this) { 1884 1885 // Calendar events 1886 1887 var events = [ 1888 1889 { 1890 id: 1, 1891 title: 'Call with Dave', 1892 start: '2018-11-18', 1893 allDay: true, 1894 className: 'bg-red', 1895 description: 'Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.' 1896 }, 1897 1898 { 1899 id: 2, 1900 title: 'Lunch meeting', 1901 start: '2018-11-21', 1902 allDay: true, 1903 className: 'bg-orange', 1904 description: 'Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.' 1905 }, 1906 1907 { 1908 id: 3, 1909 title: 'All day conference', 1910 start: '2018-11-29', 1911 allDay: true, 1912 className: 'bg-green', 1913 description: 'Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.' 1914 }, 1915 1916 { 1917 id: 4, 1918 title: 'Meeting with Mary', 1919 start: '2018-12-01', 1920 allDay: true, 1921 className: 'bg-blue', 1922 description: 'Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.' 1923 }, 1924 1925 { 1926 id: 5, 1927 title: 'Winter Hackaton', 1928 start: '2018-12-03', 1929 allDay: true, 1930 className: 'bg-red', 1931 description: 'Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.' 1932 }, 1933 1934 { 1935 id: 6, 1936 title: 'Digital event', 1937 start: '2018-12-07', 1938 allDay: true, 1939 className: 'bg-warning', 1940 description: 'Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.' 1941 }, 1942 1943 { 1944 id: 7, 1945 title: 'Marketing event', 1946 start: '2018-12-10', 1947 allDay: true, 1948 className: 'bg-purple', 1949 description: 'Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.' 1950 }, 1951 1952 { 1953 id: 8, 1954 title: 'Dinner with Family', 1955 start: '2018-12-19', 1956 allDay: true, 1957 className: 'bg-red', 1958 description: 'Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.' 1959 }, 1960 1961 { 1962 id: 9, 1963 title: 'Black Friday', 1964 start: '2018-12-23', 1965 allDay: true, 1966 className: 'bg-blue', 1967 description: 'Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.' 1968 }, 1969 1970 { 1971 id: 10, 1972 title: 'Cyber Week', 1973 start: '2018-12-02', 1974 allDay: true, 1975 className: 'bg-yellow', 1976 description: 'Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.' 1977 }, 1978 1979 ], 1980 1981 1982 // Full calendar options 1983 // For more options read the official docs: https://fullcalendar.io/docs 1984 1985 options = { 1986 header: { 1987 right: '', 1988 center: '', 1989 left: '' 1990 }, 1991 buttonIcons: { 1992 prev: 'calendar--prev', 1993 next: 'calendar--next' 1994 }, 1995 theme: false, 1996 selectable: true, 1997 selectHelper: true, 1998 editable: true, 1999 events: events, 2000 2001 dayClick: function(date) { 2002 var isoDate = moment(date).toISOString(); 2003 $('#new-event').modal('show'); 2004 $('.new-event--title').val(''); 2005 $('.new-event--start').val(isoDate); 2006 $('.new-event--end').val(isoDate); 2007 }, 2008 2009 viewRender: function(view) { 2010 var calendarDate = $this.fullCalendar('getDate'); 2011 var calendarMonth = calendarDate.month(); 2012 2013 //Set data attribute for header. This is used to switch header images using css 2014 // $this.find('.fc-toolbar').attr('data-calendar-month', calendarMonth); 2015 2016 //Set title in page header 2017 $('.fullcalendar-title').html(view.title); 2018 }, 2019 2020 // Edit calendar event action 2021 2022 eventClick: function(event, element) { 2023 $('#edit-event input[value=' + event.className + ']').prop('checked', true); 2024 $('#edit-event').modal('show'); 2025 $('.edit-event--id').val(event.id); 2026 $('.edit-event--title').val(event.title); 2027 $('.edit-event--description').val(event.description); 2028 } 2029 }; 2030 2031 // Initalize the calendar plugin 2032 $this.fullCalendar(options); 2033 2034 2035 // 2036 // Calendar actions 2037 // 2038 2039 2040 //Add new Event 2041 2042 $('body').on('click', '.new-event--add', function() { 2043 var eventTitle = $('.new-event--title').val(); 2044 2045 // Generate ID 2046 var GenRandom = { 2047 Stored: [], 2048 Job: function() { 2049 var newId = Date.now().toString().substr(6); // or use any method that you want to achieve this string 2050 2051 if (!this.Check(newId)) { 2052 this.Stored.push(newId); 2053 return newId; 2054 } 2055 return this.Job(); 2056 }, 2057 Check: function(id) { 2058 for (var i = 0; i < this.Stored.length; i++) { 2059 if (this.Stored[i] == id) return true; 2060 } 2061 return false;
2062 } 2063 }; 2064 2065 if (eventTitle != '') { 2066 $this.fullCalendar('renderEvent', { 2067 id: GenRandom.Job(), 2068 title: eventTitle, 2069 start: $('.new-event--start').val(), 2070 end: $('.new-event--end').val(), 2071 allDay: true, 2072 className: $('.event-tag input:checked').val() 2073 }, true); 2074 2075 $('.new-event--form')[0].reset(); 2076 $('.new-event--title').closest('.form-group').removeClass('has-danger'); 2077 $('#new-event').modal('hide'); 2078 } else { 2079 $('.new-event--title').closest('.form-group').addClass('has-danger'); 2080 $('.new-event--title').focus(); 2081 } 2082 }); 2083 2084 2085 //Update/Delete an Event 2086 $('body').on('click', '[data-calendar]', function() { 2087 var calendarAction = $(this).data('calendar'); 2088 var currentId = $('.edit-event--id').val(); 2089 var currentTitle = $('.edit-event--title').val(); 2090 var currentDesc = $('.edit-event--description').val(); 2091 var currentClass = $('#edit-event .event-tag input:checked').val(); 2092 var currentEvent = $this.fullCalendar('clientEvents', currentId); 2093 2094 //Update 2095 if (calendarAction === 'update') { 2096 if (currentTitle != '') { 2097 currentEvent[0].title = currentTitle; 2098 currentEvent[0].description = currentDesc; 2099 currentEvent[0].className = [currentClass]; 2100 2101 console.log(currentClass); 2102 $this.fullCalendar('updateEvent', currentEvent[0]); 2103 $('#edit-event').modal('hide'); 2104 } else { 2105 $('.edit-event--title').closest('.form-group').addClass('has-error'); 2106 $('.edit-event--title').focus(); 2107 } 2108 } 2109 2110 //Delete 2111 if (calendarAction === 'delete') { 2112 $('#edit-event').modal('hide'); 2113 2114 // Show confirm dialog 2115 setTimeout(function() { 2116 swal({ 2117 title: 'Are you sure?', 2118 text: "You won't be able to revert this!", 2119 type: 'warning', 2120 showCancelButton: true, 2121 buttonsStyling: false, 2122 confirmButtonClass: 'btn btn-danger', 2123 confirmButtonText: 'Yes, delete it!', 2124 cancelButtonClass: 'btn btn-secondary' 2125 }).then((result) => { 2126 if (result.value) { 2127 // Delete event 2128 $this.fullCalendar('removeEvents', currentId); 2129 2130 // Show confirmation 2131 swal({ 2132 title: 'Deleted!', 2133 text: 'The event has been deleted.', 2134 type: 'success', 2135 buttonsStyling: false, 2136 confirmButtonClass: 'btn btn-primary' 2137 }); 2138 } 2139 }) 2140 }, 200); 2141 } 2142 }); 2143 2144 2145 //Calendar views switch 2146 $('body').on('click', '[data-calendar-view]', function(e) { 2147 e.preventDefault(); 2148 2149 $('[data-calendar-view]').removeClass('active'); 2150 $(this).addClass('active'); 2151 2152 var calendarView = $(this).attr('data-calendar-view'); 2153 $this.fullCalendar('changeView', calendarView); 2154 }); 2155 2156 2157 //Calendar Next 2158 $('body').on('click', '.fullcalendar-btn-next', function(e) { 2159 e.preventDefault(); 2160 $this.fullCalendar('next'); 2161 }); 2162 2163 2164 //Calendar Prev 2165 $('body').on('click', '.fullcalendar-btn-prev', function(e) { 2166 e.preventDefault(); 2167 $this.fullCalendar('prev'); 2168 }); 2169 } 2170 2171 2172 // 2173 // Events 2174 // 2175 2176 // Init 2177 if ($calendar.length) { 2178 init($calendar); 2179 } 2180 2181})(); 2182 2183// 2184// Quill.js 2185// 2186 2187'use strict'; 2188 2189var VectorMap = (function() { 2190 2191 // Variables 2192 2193 var $vectormap = $('[data-toggle="vectormap"]'), 2194 colors = { 2195 gray: { 2196 100: '#f6f9fc', 2197 200: '#e9ecef', 2198 300: '#dee2e6', 2199 400: '#ced4da', 2200 500: '#adb5bd', 2201 600: '#8898aa', 2202 700: '#525f7f', 2203 800: '#32325d', 2204 900: '#212529' 2205 }, 2206 theme: { 2207 'default': '#172b4d', 2208 'primary': '#5e72e4', 2209 'secondary': '#f4f5f7', 2210 'info': '#11cdef', 2211 'success': '#2dce89', 2212 'danger': '#f5365c', 2213 'warning': '#fb6340' 2214 }, 2215 black: '#12263F', 2216 white: '#FFFFFF', 2217 transparent: 'transparent', 2218 }; 2219 2220 // Methods 2221 2222 function init($this) { 2223 2224 // Get placeholder 2225 var map = $this.data('map'), 2226 2227 series = { 2228 "AU": 760, 2229 "BR": 550, 2230 "CA": 120, 2231 "DE": 1300, 2232 "FR": 540, 2233 "GB": 690, 2234 "GE": 200, 2235 "IN": 200, 2236 "RO": 600, 2237 "RU": 300, 2238 "US": 2920, 2239 }, 2240 2241 options = { 2242 map: map, 2243 zoomOnScroll: false, 2244 scaleColors: ['#f00', '#0071A4'], 2245 normalizeFunction: 'polynomial', 2246 hoverOpacity: 0.7, 2247 hoverColor: false, 2248 backgroundColor: colors.transparent, 2249 regionStyle: { 2250 initial: { 2251 fill: colors.gray[200], 2252 "fill-opacity": .8,
2253 stroke: 'none', 2254 "stroke-width": 0, 2255 "stroke-opacity": 1 2256 }, 2257 hover: { 2258 fill: colors.gray[300], 2259 "fill-opacity": .8, 2260 cursor: 'pointer' 2261 }, 2262 selected: { 2263 fill: 'yellow' 2264 }, 2265 selectedHover: { 2266 } 2267 }, 2268 markerStyle: { 2269 initial: { 2270 fill: colors.theme.warning, 2271 "stroke-width": 0 2272 }, 2273 hover: { 2274 fill: colors.theme.info, 2275 "stroke-width": 0 2276 }, 2277 }, 2278 markers: [ 2279 { 2280 latLng: [41.90, 12.45], 2281 name: 'Vatican City' 2282 }, 2283 { 2284 latLng: [43.73, 7.41], 2285 name: 'Monaco' 2286 }, 2287 { 2288 latLng: [35.88, 14.5], 2289 name: 'Malta' 2290 }, 2291 { 2292 latLng: [1.3, 103.8], 2293 name: 'Singapore' 2294 }, 2295 { 2296 latLng: [1.46, 173.03], 2297 name: 'Kiribati' 2298 }, 2299 { 2300 latLng: [-21.13, -175.2], 2301 name: 'Tonga' 2302 }, 2303 { 2304 latLng: [15.3, -61.38], 2305 name: 'Dominica' 2306 }, 2307 { 2308 latLng: [-20.2, 57.5], 2309 name: 'Mauritius' 2310 }, 2311 { 2312 latLng: [26.02, 50.55], 2313 name: 'Bahrain' 2314 } 2315 ], 2316 series: { 2317 regions: [{ 2318 values: series, 2319 scale: [colors.gray[400], colors.gray[500]], 2320 normalizeFunction: 'polynomial' 2321 }] 2322 }, 2323 }; 2324 2325 // Init map 2326 $this.vectorMap(options); 2327 2328 // Customize controls 2329 $this.find('.jvectormap-zoomin').addClass('btn btn-sm btn-primary'); 2330 $this.find('.jvectormap-zoomout').addClass('btn btn-sm btn-primary'); 2331 2332 } 2333 2334 // Events 2335 2336 if ($vectormap.length) { 2337 $vectormap.each(function() { 2338 init($(this)); 2339 }); 2340 } 2341 2342})(); 2343 2344// 2345// Lavalamp 2346// 2347 2348'use strict'; 2349 2350var Lavalamp = (function() { 2351 2352 // Variables 2353 2354 var $nav = $('[data-toggle="lavalamp"]'); 2355 2356 2357 // Methods 2358 2359 function init($this) { 2360 var options = { 2361 setOnClick: false, 2362 enableHover: true, 2363 margins: true, 2364 autoUpdate: true, 2365 duration: 200 2366 }; 2367 2368 $this.lavalamp(options); 2369 } 2370 2371 2372 // Events 2373 2374 if ($nav.length) { 2375 $nav.each(function() { 2376 init($(this)); 2377 }); 2378 } 2379 2380})(); 2381 2382// 2383// List.js 2384// 2385 2386'use strict'; 2387 2388var SortList = (function() { 2389 2390 // // 2391 // Variables 2392 // // 2393 2394 var $lists = $('[data-toggle="list"]'); 2395 var $listsSort = $('[data-sort]'); 2396 2397 2398 // 2399 // Methods 2400 // 2401 2402 // Init 2403 function init($list) { 2404 new List($list.get(0), getOptions($list)); 2405 } 2406 2407 // Get options 2408 function getOptions($list) { 2409 var options = { 2410 valueNames: $list.data('list-values'), 2411 listClass: $list.data('list-class') ? $list.data('list-class') : 'list' 2412 } 2413 2414 return options; 2415 } 2416 2417 2418 // 2419 // Events 2420 // 2421 2422 // Init 2423 if ($lists.length) { 2424 $lists.each(function() { 2425 init($(this)); 2426 }); 2427 } 2428 2429 // Sort 2430 $listsSort.on('click', function() { 2431 return false; 2432 }); 2433 2434})(); 2435 2436// 2437// Notify 2438// init of the bootstrap-notify plugin 2439// 2440 2441'use strict'; 2442 2443var Notify = (function() { 2444 2445 // Variables 2446 2447 var $notifyBtn = $('[data-toggle="notify"]'); 2448 2449 2450 // Methods 2451 2452 function notify(placement, align, icon, type, animIn, animOut) { 2453 $.notify({ 2454 icon: icon, 2455 title: ' Bootstrap Notify', 2456 message: 'Turning standard Bootstrap alerts into awesome notifications', 2457 url: '' 2458 }, { 2459 element: 'body', 2460 type: type, 2461 allow_dismiss: true, 2462 placement: { 2463 from: placement, 2464 align: align 2465 }, 2466 offset: { 2467 x: 15, // Keep this as default 2468 y: 15 // Unless there'll be alignment issues as this value is targeted in CSS 2469 }, 2470 spacing: 10, 2471 z_index: 1080, 2472 delay: 2500, 2473 timer: 25000, 2474 url_target: '_blank', 2475 mouse_over: false, 2476 animate: { 2477 // enter: animIn, 2478 // exit: animOut 2479 enter: animIn, 2480 exit: animOut 2481 }, 2482 template: '<div data-notify="container" class="alert alert-dismissible alert-{0} alert-notify" role="alert">' + 2483 '<span class="alert-icon" data-notify="icon"></span> ' + 2484 '<div class="alert-text"</div> ' + 2485 '<span class="alert-title" data-notify="title">{1}</span> ' + 2486 '<span data-notify="message">{2}</span>' + 2487 '</div>' + 2488 // '<div class="progress" data-notify="progressbar">' + 2489 // '<div class="progress-bar progress-bar-{0}" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"></div>' + 2490 // '</div>' + 2491 // '<a href="{3}" target="{4}" data-notify="url"></a>' + 2492 '<button type="button" class="close" data-notify="dismiss" aria-label="Close"><span aria-hidden="true">×</span></button>' + 2493 '</div>' 2494 }); 2495 } 2496 2497 // Events 2498 2499 if ($notifyBtn.length) { 2500 $notifyBtn.on('click', function(e) { 2501 e.preventDefault(); 2502 2503 var placement = $(this).attr('data-placement'); 2504 var align = $(this).attr('data-align'); 2505 var icon = $(this).attr('data-icon'); 2506 var type = $(this).attr('data-type'); 2507 var animIn = $(this).attr('data-animation-in'); 2508 var animOut = $(this).attr('data-animation-out'); 2509 2510 notify(placement, align, icon, type, animIn, animOut); 2511 }) 2512 } 2513 2514})(); 2515 2516// 2517// Onscreen - viewport checker 2518// 2519 2520'use strict'; 2521 2522var OnScreen = (function() { 2523 2524 // Variables 2525 2526 var $onscreen = $('[data-toggle="on-screen"]'); 2527 2528 2529 // Methods 2530 2531 function init($this) { 2532 var options = { 2533 container: window, 2534 direction: 'vertical', 2535 doIn: function() { 2536 //alert(); 2537 }, 2538 doOut: function() { 2539 // Do something to the matched elements as they get off scren 2540 }, 2541 tolerance: 200, 2542 throttle: 50, 2543 toggleClass: 'on-screen', 2544 debug: false 2545 }; 2546 2547 $this.onScreen(options); 2548 } 2549 2550 2551 // Events 2552 2553 if ($onscreen.length) { 2554 init($onscreen); 2555 } 2556 2557})(); 2558 2559// 2560// Quill.js 2561// 2562 2563'use strict'; 2564 2565var QuillEditor = (function() { 2566 2567 // Variables 2568 2569 var $quill = $('[data-toggle="quill"]'); 2570 2571 2572 // Methods 2573 2574 function init($this) { 2575 2576 // Get placeholder 2577 var placeholder = $this.data('quill-placeholder'); 2578 2579 // Init editor 2580 var quill = new Quill($this.get(0), { 2581 modules: { 2582 toolbar: [ 2583 ['bold', 'italic'], 2584 ['link', 'blockquote', 'code', 'image'], 2585 [{ 2586 'list': 'ordered' 2587 }, {
2588 'list': 'bullet' 2589 }] 2590 ] 2591 }, 2592 placeholder: placeholder, 2593 theme: 'snow' 2594 }); 2595 2596 } 2597 2598 // Events 2599 2600 if ($quill.length) { 2601 $quill.each(function() { 2602 init($(this)); 2603 }); 2604 } 2605 2606})(); 2607 2608// 2609// Select2.js 2610// 2611 2612'use strict'; 2613 2614var Select2 = (function() { 2615 2616 // 2617 // Variables 2618 // 2619 2620 var $select = $('[data-toggle="select"]'); 2621 2622 2623 // 2624 // Methods 2625 // 2626 2627 function init($this) { 2628 var options = { 2629 // dropdownParent: $this.closest('.modal').length ? $this.closest('.modal') : $(document.body), 2630 // minimumResultsForSearch: $this.data('minimum-results-for-search'), 2631 // templateResult: formatAvatar 2632 }; 2633 2634 $this.select2(options); 2635 } 2636 2637 2638 // 2639 // Events 2640 // 2641 2642 if ($select.length) { 2643 2644 // Init selects 2645 $select.each(function() { 2646 init($(this)); 2647 }); 2648 } 2649 2650})(); 2651 2652// 2653// Tags input 2654// 2655 2656'use strict'; 2657 2658var Tags = (function() { 2659 2660 // 2661 // Variables 2662 // 2663 2664 var $tags = $('[data-toggle="tags"]'); 2665 2666 2667 // 2668 // Methods 2669 // 2670 2671 function init($this) { 2672 2673 var options = { 2674 tagClass: 'badge badge-primary' 2675 }; 2676 2677 $this.tagsinput(options); 2678 } 2679 2680 2681 // 2682 // Events 2683 // 2684 2685 if ($tags.length) { 2686 2687 // Init selects 2688 $tags.each(function() { 2689 init($(this)); 2690 }); 2691 } 2692 2693})();
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.