1/* 2Name: Theme Admin Extension 3Written by: Okler Themes - (http://www.okler.net) 4Theme Version: 2.0.0 5*/ 6 7window.admin = {}; 8 9// Cards 10(function($) { 11 12 $(function() { 13 $('.card') 14 .on( 'card:toggle', function() { 15 var $this, 16 direction; 17 18 $this = $(this); 19 direction = $this.hasClass( 'card-collapsed' ) ? 'Down' : 'Up'; 20 21 $this.find('.card-body, .card-footer')[ 'slide' + direction ]( 200, function() { 22 $this[ (direction === 'Up' ? 'add' : 'remove') + 'Class' ]( 'card-collapsed' ) 23 }); 24 }) 25 .on( 'card:dismiss', function() { 26 var $this = $(this); 27 28 if ( !!( $this.parent('div').attr('class') || '' ).match( /col-(xs|sm|md|lg)/g ) && $this.siblings().length === 0 ) { 29 $row = $this.closest('.row'); 30 $this.parent('div').remove(); 31 if ( $row.children().length === 0 ) { 32 $row.remove(); 33 } 34 } else { 35 $this.remove(); 36 } 37 }) 38 .on( 'click', '[data-card-toggle]', function( e ) { 39 e.preventDefault(); 40 $(this).closest('.card').trigger( 'card:toggle' ); 41 }) 42 .on( 'click', '[data-card-dismiss]', function( e ) { 43 e.preventDefault(); 44 $(this).closest('.card').trigger( 'card:dismiss' ); 45 }) 46 /* Deprecated */ 47 .on( 'click', '.card-actions a.fa-caret-up', function( e ) { 48 e.preventDefault(); 49 var $this = $( this ); 50 51 $this 52 .removeClass( 'fa-caret-up' ) 53 .addClass( 'fa-caret-down' ); 54 55 $this.closest('.card').trigger( 'card:toggle' ); 56 }) 57 .on( 'click', '.card-actions a.fa-caret-down', function( e ) { 58 e.preventDefault(); 59 var $this = $( this ); 60 61 $this 62 .removeClass( 'fa-caret-down' ) 63 .addClass( 'fa-caret-up' ); 64 65 $this.closest('.card').trigger( 'card:toggle' ); 66 }) 67 .on( 'click', '.card-actions a.fa-times', function( e ) { 68 e.preventDefault(); 69 var $this = $( this ); 70 71 $this.closest('.card').trigger( 'card:dismiss' ); 72 }); 73 }); 74 75})(jQuery); 76 77// Chart Circular 78(function(admin, $) { 79 80 admin = admin || {}; 81 82 var instanceName = '__chartCircular'; 83 84 var PluginChartCircular = function($el, opts) { 85 return this.initialize($el, opts); 86 }; 87 88 PluginChartCircular.defaults = { 89 accX: 0, 90 accY: -150, 91 delay: 1, 92 barColor: '#0088CC', 93 trackColor: '#f2f2f2', 94 scaleColor: false, 95 scaleLength: 5, 96 lineCap: 'round', 97 lineWidth: 13, 98 size: 175, 99 rotate: 0, 100 animate: ({ 101 duration: 2500, 102 enabled: true 103 }) 104 }; 105 106 PluginChartCircular.prototype = { 107 initialize: function($el, opts) { 108 if ( $el.data( instanceName ) ) { 109 return this; 110 } 111 112 this.$el = $el; 113 114 this 115 .setData() 116 .setOptions(opts) 117 .build(); 118 119 return this; 120 }, 121 122 setData: function() { 123 this.$el.data(instanceName, this); 124 125 return this; 126 }, 127 128 setOptions: function(opts) { 129 this.options = $.extend(true, {}, PluginChartCircular.defaults, opts, { 130 wrapper: this.$el 131 }); 132 133 return this; 134 }, 135 136 build: function() { 137 var self = this, 138 $el = this.options.wrapper, 139 value = ($el.attr('data-percent') ? $el.attr('data-percent') : 0), 140 percentEl = $el.find('.percent'), 141 shouldAnimate, 142 data; 143 144 shouldAnimate = $.isFunction($.fn[ 'appear' ]) && ( typeof $.browser !== 'undefined' && !$.browser.mobile ); 145 data = { accX: self.options.accX, accY: self.options.accY }; 146 147 $.extend(true, self.options, { 148 onStep: function(from, to, currentValue) { 149 percentEl.html(parseInt(currentValue)); 150 } 151 }); 152 153 $el.attr('data-percent', (shouldAnimate ? 0 : value) ); 154 155 $el.easyPieChart( this.options ); 156 157 if ( shouldAnimate ) { 158 $el.appear(function() { 159 setTimeout(function() { 160 $el.data('easyPieChart').update(value); 161 $el.attr('data-percent', value); 162 163 }, self.options.delay); 164 }, data); 165 } else { 166 $el.data('easyPieChart').update(value); 167 $el.attr('data-percent', value); 168 } 169 170 return this; 171 } 172 }; 173 174 // expose to scope 175 $.extend(true, admin, { 176 Chart: { 177 PluginChartCircular: PluginChartCircular 178 } 179 }); 180 181 // jquery plugin 182 $.fn.adminPluginChartCircular = function(opts) { 183 return this.map(function() { 184 var $this = $(this); 185 186 if ($this.data(instanceName)) { 187 return $this.data(instanceName); 188 } else { 189 return new PluginChartCircular($this, opts); 190 } 191 192 }); 193 } 194 195}).apply(this, [window.admin, jQuery]); 196 197// Chart Circular 198(function($) { 199 200 'use strict'; 201 202 if ( $.isFunction($.fn[ 'easyPieChart' ]) ) { 203 204 $(function() { 205 $('[data-plugin-chart-circular], .circular-bar-chart:not(.manual)').each(function() { 206 var $this = $( this ), 207 opts = {}; 208 209 var pluginOptions = $this.data('plugin-options'); 210 if (pluginOptions) 211 opts = pluginOptions; 212 213 $this.adminPluginChartCircular(opts); 214 }); 215 }); 216 217 } 218 219}).apply(this, [jQuery]); 220 221// Slider 222(function(admin, $) { 223 224 admin = admin || {}; 225 226 var instanceName = '__slider'; 227 228 var PluginSlider = function($el, opts) { 229 return this.initialize($el, opts); 230 }; 231 232 PluginSlider.defaults = { 233 234 }; 235 236 PluginSlider.prototype = { 237 initialize: function($el, opts) { 238 if ( $el.data( instanceName ) ) { 239 return this; 240 } 241 242 this.$el = $el; 243 244 this 245 .setVars() 246 .setData() 247 .setOptions(opts) 248 .build(); 249 250 return this; 251 }, 252 253 setVars: function() {
254 var $output = $( this.$el.data('plugin-slider-output') ); 255 this.$output = $output.get(0) ? $output : null; 256 257 return this; 258 }, 259 260 setData: function() { 261 this.$el.data(instanceName, this); 262 263 return this; 264 }, 265 266 setOptions: function(opts) { 267 var _self = this; 268 this.options = $.extend( true, {}, PluginSlider.defaults, opts ); 269 270 if ( this.$output ) { 271 $.extend( this.options, { 272 slide: function( event, ui ) { 273 _self.onSlide( event, ui ); 274 } 275 }); 276 } 277 278 return this; 279 }, 280 281 build: function() { 282 this.$el.slider( this.options ); 283 284 return this; 285 }, 286 287 onSlide: function( event, ui ) { 288 if ( !ui.values ) { 289 this.$output.val( ui.value ); 290 } else { 291 this.$output.val( ui.values[ 0 ] + '/' + ui.values[ 1 ] ); 292 } 293 294 this.$output.trigger('change'); 295 } 296 }; 297 298 // expose to scope 299 $.extend(admin, { 300 PluginSlider: PluginSlider 301 }); 302 303 // jquery plugin 304 $.fn.adminPluginSlider = function(opts) { 305 return this.each(function() { 306 var $this = $(this); 307 308 if ($this.data(instanceName)) { 309 return $this.data(instanceName); 310 } else { 311 return new PluginSlider($this, opts); 312 } 313 314 }); 315 } 316 317}).apply(this, [window.admin, jQuery]); 318 319// Slider 320(function($) { 321 322 'use strict'; 323 324 if ( $.isFunction($.fn[ 'slider' ]) ) { 325 326 $(function() { 327 $('[data-plugin-slider]').each(function() { 328 var $this = $( this ), 329 opts = {}; 330 331 var pluginOptions = $this.data('plugin-options'); 332 if (pluginOptions) { 333 opts = pluginOptions; 334 } 335 336 $this.adminPluginSlider(opts); 337 }); 338 }); 339 340 } 341 342}).apply(this, [jQuery]); 343 344// Data Tables - Config 345(function($) { 346 347 'use strict'; 348 349 // we overwrite initialize of all datatables here 350 // because we want to use select2, give search input a bootstrap look 351 // keep in mind if you overwrite this fnInitComplete somewhere, 352 // you should run the code inside this function to keep functionality. 353 // 354 // there's no better way to do this at this time :( 355 if ( $.isFunction( $.fn[ 'dataTable' ] ) ) { 356 357 $.extend(true, $.fn.dataTable.defaults, { 358 oLanguage: { 359 sLengthMenu: '_MENU_ records per page', 360 sProcessing: '<i class="fa fa-spinner fa-spin"></i> Loading', 361 sSearch: '' 362 }, 363 fnInitComplete: function( settings, json ) { 364 // select 2 365 if ( $.isFunction( $.fn[ 'select2' ] ) ) { 366 $('.dataTables_length select', settings.nTableWrapper).select2({ 367 theme: 'bootstrap', 368 minimumResultsForSearch: -1 369 }); 370 } 371 372 var options = $( 'table', settings.nTableWrapper ).data( 'plugin-options' ) || {}; 373 374 // search 375 var $search = $('.dataTables_filter input', settings.nTableWrapper); 376 377 $search 378 .attr({ 379 placeholder: typeof options.searchPlaceholder !== 'undefined' ? options.searchPlaceholder : 'Search...' 380 }) 381 .removeClass('form-control-sm').addClass('form-control pull-right'); 382 383 if ( $.isFunction( $.fn.placeholder ) ) { 384 $search.placeholder(); 385 } 386 387 // tools 388 $('.DTTT_button').addClass('btn btn-default'); 389 } 390 }); 391 392 } 393 394}).apply(this, [jQuery]); 395 396// Codemirror 397(function(admin, $) { 398 399 admin = admin || {}; 400 401 var instanceName = '__codemirror'; 402 403 var PluginCodeMirror = function($el, opts) { 404 return this.initialize($el, opts); 405 }; 406 407 PluginCodeMirror.defaults = { 408 lineNumbers: true, 409 styleActiveLine: true, 410 matchBrackets: true, 411 theme: 'monokai' 412 }; 413 414 PluginCodeMirror.prototype = { 415 initialize: function($el, opts) { 416 if ( $el.data( instanceName ) ) { 417 return this; 418 } 419 420 this.$el = $el; 421 422 this 423 .setData() 424 .setOptions(opts) 425 .build(); 426 427 return this; 428 }, 429 430 setData: function() { 431 this.$el.data(instanceName, this); 432 433 return this; 434 }, 435 436 setOptions: function(opts) { 437 this.options = $.extend( true, {}, PluginCodeMirror.defaults, opts ); 438 439 return this; 440 }, 441 442 build: function() { 443 CodeMirror.fromTextArea( this.$el.get(0), this.options ); 444 445 return this; 446 } 447 }; 448 449 // expose to scope 450 $.extend(admin, { 451 PluginCodeMirror: PluginCodeMirror 452 }); 453 454 // jquery plugin 455 $.fn.adminPluginCodeMirror = function(opts) { 456 return this.each(function() { 457 var $this = $(this); 458 459 if ($this.data(instanceName)) { 460 return $this.data(instanceName); 461 } else { 462 return new PluginCodeMirror($this, opts); 463 } 464 465 }); 466 } 467 468}).apply(this, [window.admin, jQuery]); 469 470// Codemirror 471(function($) { 472 473 'use strict'; 474 475 if ( typeof CodeMirror !== 'undefined' ) { 476 477 $(function() { 478 $('[data-plugin-codemirror]').each(function() { 479 var $this = $( this ), 480 opts = {}; 481 482 var pluginOptions = $this.data('plugin-options'); 483 if (pluginOptions) 484 opts = pluginOptions; 485 486 $this.adminPluginCodeMirror(opts); 487 }); 488 }); 489 490 } 491 492}).apply(this, [jQuery]); 493 494// Colorpicker 495(function(admin, $) { 496 497 admin = admin || {}; 498 499 var instanceName = '__colorpicker'; 500 501 var PluginColorPicker = function($el, opts) { 502 return this.initialize($el, opts); 503 }; 504 505 PluginColorPicker.defaults = { 506 }; 507 508 PluginColorPicker.prototype = { 509 initialize: function($el, opts) { 510 if ( $el.data( instanceName ) ) { 511 return this; 512 } 513 514 this.$el = $el; 515 516 this 517 .setData() 518 .setOptions(opts) 519 .build(); 520 521 return this; 522 }, 523 524 setData: function() { 525 this.$el.data(instanceName, this); 526 527 return this; 528 }, 529 530 setOptions: function(opts) { 531 this.options = $.extend( true, {}, PluginColorPicker.defaults, opts ); 532 533 return this; 534 }, 535 536 build: function() { 537 this.$el.colorpicker( this.options ); 538 539 return this; 540 } 541 }; 542 543 // expose to scope 544 $.extend(admin, { 545 PluginColorPicker: PluginColorPicker 546 }); 547 548 // jquery plugin 549 $.fn.adminPluginColorPicker = function(opts) { 550 return this.each(function() { 551 var $this = $(this); 552 553 if ($this.data(instanceName)) { 554 return $this.data(instanceName); 555 } else { 556 return new PluginColorPicker($this, opts); 557 } 558 559 }); 560 } 561 562}).apply(this, [window.admin, jQuery]); 563 564// Colorpicker 565(function($) { 566 567 'use strict'; 568 569 if ( $.isFunction($.fn[ 'colorpicker' ]) ) { 570 571 $(function() { 572 $('[data-plugin-colorpicker]').each(function() { 573 var $this = $( this ), 574 opts = {}; 575 576 var pluginOptions = $this.data('plugin-options'); 577 if (pluginOptions) 578 opts = pluginOptions; 579 580 $this.adminPluginColorPicker(opts); 581 }); 582 }); 583 584 } 585 586}).apply(this, [jQuery]); 587 588// Datepicker 589(function(admin, $) { 590 591 admin = admin || {}; 592 593 var instanceName = '__datepicker'; 594 595 var PluginDatePicker = function($el, opts) { 596 return this.initialize($el, opts); 597 }; 598 599 PluginDatePicker.defaults = { 600 }; 601 602 PluginDatePicker.prototype = { 603 initialize: function($el, opts) { 604 if ( $el.data( instanceName ) ) { 605 return this; 606 } 607 608 this.$el = $el; 609 610 this 611 .setVars() 612 .setData() 613 .setOptions(opts) 614 .build(); 615 616 return this; 617 }, 618 619 setVars: function() { 620 this.skin = this.$el.data( 'plugin-skin' ); 621 622 return this; 623 }, 624 625 setData: function() { 626 this.$el.data(instanceName, this); 627 628 return this; 629 }, 630 631 setOptions: function(opts) { 632 this.options = $.extend( true, {}, PluginDatePicker.defaults, opts ); 633 634 return this; 635 }, 636 637 build: function() { 638 this.$el.bootstrapDP( this.options ); 639 640 if ( !!this.skin && typeof(this.$el.data('datepicker').picker) != 'undefined') { 641 this.$el.data('datepicker').picker.addClass( 'datepicker-' + this.skin ); 642 } 643 644 return this; 645 } 646 }; 647 648 // expose to scope 649 $.extend(admin, { 650 PluginDatePicker: PluginDatePicker 651 }); 652 653 // jquery plugin 654 $.fn.adminPluginDatePicker = function(opts) { 655 return this.each(function() { 656 var $this = $(this); 657 658 if ($this.data(instanceName)) { 659 return $this.data(instanceName); 660 } else { 661 return new PluginDatePicker($this, opts); 662 } 663 664 }); 665 } 666 667}).apply(this, [window.admin, jQuery]); 668 669// Datepicker 670(function($) { 671 672 'use strict'; 673 674 if ( $.isFunction($.fn[ 'bootstrapDP' ]) ) { 675 676 $(function() { 677 $('[data-plugin-datepicker]').each(function() { 678 var $this = $( this ), 679 opts = {}; 680 681 var pluginOptions = $this.data('plugin-options'); 682 if (pluginOptions) 683 opts = pluginOptions; 684 685 $this.adminPluginDatePicker(opts); 686 }); 687 }); 688 689 } 690 691}).apply(this, [jQuery]); 692
693// iosSwitcher 694(function(admin, $) { 695 696 admin = admin || {}; 697 698 var instanceName = '__IOS7Switch'; 699 700 var PluginIOS7Switch = function($el) { 701 return this.initialize($el); 702 }; 703 704 PluginIOS7Switch.prototype = { 705 initialize: function($el) { 706 if ( $el.data( instanceName ) ) { 707 return this; 708 } 709 710 this.$el = $el; 711 712 this 713 .setData() 714 .build(); 715 716 return this; 717 }, 718 719 setData: function() { 720 this.$el.data(instanceName, this); 721 722 return this; 723 }, 724 725 build: function() { 726 var switcher = new Switch( this.$el.get(0) ); 727 728 $( switcher.el ).on( 'click', function( e ) { 729 e.preventDefault(); 730 switcher.toggle(); 731 }); 732 733 return this; 734 } 735 }; 736 737 // expose to scope 738 $.extend(admin, { 739 PluginIOS7Switch: PluginIOS7Switch 740 }); 741 742 // jquery plugin 743 $.fn.adminPluginIOS7Switch = function(opts) { 744 return this.each(function() { 745 var $this = $(this); 746 747 if ($this.data(instanceName)) { 748 return $this.data(instanceName); 749 } else { 750 return new PluginIOS7Switch($this); 751 } 752 753 }); 754 } 755 756}).apply(this, [window.admin, jQuery]); 757 758// iosSwitcher 759(function($) { 760 761 'use strict'; 762 763 if ( typeof Switch !== 'undefined' && $.isFunction( Switch ) ) { 764 765 $(function() { 766 $('[data-plugin-ios-switch]').each(function() { 767 var $this = $( this ); 768 769 $this.adminPluginIOS7Switch(); 770 }); 771 }); 772 773 } 774 775}).apply(this, [jQuery]); 776 777// Markdown 778(function(admin, $) { 779 780 admin = admin || {}; 781 782 var instanceName = '__markdownEditor'; 783 784 var PluginMarkdownEditor = function($el, opts) { 785 return this.initialize($el, opts); 786 }; 787 788 PluginMarkdownEditor.defaults = { 789 iconlibrary: 'fa' 790 }; 791 792 PluginMarkdownEditor.prototype = { 793 initialize: function($el, opts) { 794 if ( $el.data( instanceName ) ) { 795 return this; 796 } 797 798 this.$el = $el; 799 800 this 801 .setData() 802 .setOptions(opts) 803 .build(); 804 805 return this; 806 }, 807 808 setData: function() { 809 this.$el.data(instanceName, this); 810 811 return this; 812 }, 813 814 setOptions: function(opts) { 815 this.options = $.extend( true, {}, PluginMarkdownEditor.defaults, opts ); 816 817 return this; 818 }, 819 820 build: function() { 821 this.$el.markdown( this.options ); 822 823 return this; 824 } 825 }; 826 827 // expose to scope 828 $.extend(admin, { 829 PluginMarkdownEditor: PluginMarkdownEditor 830 }); 831 832 // jquery plugin 833 $.fn.adminPluginMarkdownEditor = function(opts) { 834 return this.each(function() { 835 var $this = $(this); 836 837 if ($this.data(instanceName)) { 838 return $this.data(instanceName); 839 } else { 840 return new PluginMarkdownEditor($this, opts); 841 } 842 843 }); 844 } 845 846}).apply(this, [window.admin, jQuery]); 847 848// Markdown 849(function($) { 850 851 'use strict'; 852 853 if ( $.isFunction($.fn[ 'markdown' ]) ) { 854 855 $(function() { 856 $('[data-plugin-markdown-editor]').each(function() { 857 var $this = $( this ), 858 opts = {}; 859 860 var pluginOptions = $this.data('plugin-options'); 861 if (pluginOptions) 862 opts = pluginOptions; 863 864 $this.adminPluginMarkdownEditor(opts); 865 }); 866 }); 867 868 } 869 870}).apply(this, [jQuery]); 871 872// Masked Input 873(function(admin, $) { 874 875 admin = admin || {}; 876 877 var instanceName = '__maskedInput'; 878 879 var PluginMaskedInput = function($el, opts) { 880 return this.initialize($el, opts); 881 }; 882 883 PluginMaskedInput.defaults = { 884 }; 885 886 PluginMaskedInput.prototype = { 887 initialize: function($el, opts) { 888 if ( $el.data( instanceName ) ) { 889 return this; 890 } 891 892 this.$el = $el; 893 894 this 895 .setData() 896 .setOptions(opts) 897 .build(); 898 899 return this; 900 }, 901 902 setData: function() { 903 this.$el.data(instanceName, this); 904 905 return this; 906 }, 907 908 setOptions: function(opts) { 909 this.options = $.extend( true, {}, PluginMaskedInput.defaults, opts ); 910 911 return this; 912 }, 913 914 build: function() { 915 this.$el.mask( this.$el.data('input-mask'), this.options ); 916 917 return this; 918 } 919 }; 920 921 // expose to scope 922 $.extend(admin, { 923 PluginMaskedInput: PluginMaskedInput 924 }); 925 926 // jquery plugin 927 $.fn.adminPluginMaskedInput = function(opts) { 928 return this.each(function() { 929 var $this = $(this); 930 931 if ($this.data(instanceName)) { 932 return $this.data(instanceName); 933 } else { 934 return new PluginMaskedInput($this, opts); 935 } 936 937 }); 938 } 939 940}).apply(this, [window.admin, jQuery]); 941 942// Masked Input 943(function($) { 944 945 'use strict'; 946 947 if ( $.isFunction($.fn[ 'mask' ]) ) { 948 949 $(function() { 950 $('[data-plugin-masked-input]').each(function() { 951 var $this = $( this ), 952 opts = {}; 953 954 var pluginOptions = $this.data('plugin-options'); 955 if (pluginOptions) 956 opts = pluginOptions; 957 958 $this.adminPluginMaskedInput(opts); 959 }); 960 }); 961 962 } 963 964}).apply(this, [jQuery]); 965 966// MaxLength 967(function(admin, $) { 968 969 admin = admin || {}; 970 971 var instanceName = '__maxlength'; 972 973 var PluginMaxLength = function($el, opts) { 974 return this.initialize($el, opts); 975 }; 976 977 PluginMaxLength.defaults = { 978 alwaysShow: true, 979 placement: 'bottom-left', 980 warningClass: 'badge badge-success bottom-left', 981 limitReachedClass: 'badge badge-danger bottom-left' 982 }; 983 984 PluginMaxLength.prototype = { 985 initialize: function($el, opts) { 986 if ( $el.data( instanceName ) ) { 987 return this; 988 } 989 990 this.$el = $el; 991 992 this 993 .setData() 994 .setOptions(opts) 995 .build(); 996 997 return this; 998 }, 999 1000 setData: function() { 1001 this.$el.data(instanceName, this); 1002 1003 return this; 1004 }, 1005 1006 setOptions: function(opts) { 1007 this.options = $.extend( true, {}, PluginMaxLength.defaults, opts ); 1008 1009 return this; 1010 }, 1011 1012 build: function() { 1013 this.$el.maxlength( this.options ); 1014 1015 this.$el.on('blur', function() { 1016 $('.bootstrap-maxlength').remove(); 1017 }); 1018 1019 return this; 1020 } 1021 }; 1022 1023 // expose to scope 1024 $.extend(admin, { 1025 PluginMaxLength: PluginMaxLength 1026 }); 1027 1028 // jquery plugin 1029 $.fn.adminPluginMaxLength = function(opts) { 1030 return this.each(function() { 1031 var $this = $(this); 1032 1033 if ($this.data(instanceName)) { 1034 return $this.data(instanceName); 1035 } else { 1036 return new PluginMaxLength($this, opts); 1037 } 1038 1039 }); 1040 } 1041 1042}).apply(this, [window.admin, jQuery]); 1043 1044// MaxLength 1045(function($) { 1046 1047 'use strict'; 1048 1049 if ( $.isFunction( $.fn[ 'maxlength' ]) ) { 1050 1051 $(function() { 1052 $('[data-plugin-maxlength]').each(function() { 1053 var $this = $( this ), 1054 opts = {}; 1055 1056 var pluginOptions = $this.data('plugin-options'); 1057 if (pluginOptions) 1058 opts = pluginOptions; 1059 1060 $this.adminPluginMaxLength(opts); 1061 }); 1062 }); 1063 1064 } 1065 1066}).apply(this, [jQuery]); 1067 1068// MultiSelect 1069(function(admin, $) { 1070 1071 admin = admin || {}; 1072 1073 var instanceName = '__multiselect'; 1074 1075 var PluginMultiSelect = function($el, opts) { 1076 return this.initialize($el, opts); 1077 }; 1078 1079 PluginMultiSelect.defaults = { 1080 templates: { 1081 li: '<li><a class="dropdown-item" tabindex="0"><label style="display: block;"></label></a></li>', 1082 filter: '<div class="input-group"><span class="input-group-addon"><i class="fa fa-search"></i></span><input class="form-control multiselect-search" type="text"></div>' 1083 } 1084 }; 1085 1086 PluginMultiSelect.prototype = { 1087 initialize: function($el, opts) { 1088 if ( $el.data( instanceName ) ) { 1089 return this; 1090 } 1091 1092 this.$el = $el; 1093 1094 this 1095 .setData() 1096 .setOptions(opts) 1097 .build(); 1098 1099 return this; 1100 }, 1101 1102 setData: function() { 1103 this.$el.data(instanceName, this); 1104 1105 return this; 1106 }, 1107 1108 setOptions: function(opts) { 1109 this.options = $.extend( true, {}, PluginMultiSelect.defaults, opts ); 1110 1111 return this; 1112 }, 1113 1114 build: function() { 1115 this.$el.multiselect( this.options ); 1116 1117 return this; 1118 } 1119 }; 1120 1121 // expose to scope 1122 $.extend(admin, { 1123 PluginMultiSelect: PluginMultiSelect 1124 }); 1125 1126 // jquery plugin 1127 $.fn.adminPluginMultiSelect = function(opts) { 1128 return this.each(function() { 1129 var $this = $(this); 1130 1131 if ($this.data(instanceName)) { 1132 return $this.data(instanceName); 1133 } else { 1134 return new PluginMultiSelect($this, opts); 1135 } 1136 1137 }); 1138 } 1139 1140}).apply(this, [window.admin, jQuery]); 1141 1142// MultiSelect 1143(function($) { 1144 1145 'use strict'; 1146 1147 if ( $.isFunction( $.fn[ 'multiselect' ] ) ) { 1148 1149 $(function() { 1150 $( '[data-plugin-multiselect]' ).each(function() { 1151 1152 var $this = $( this ), 1153 opts = {}; 1154 1155 var pluginOptions = $this.data('plugin-options'); 1156 if (pluginOptions) 1157 opts = pluginOptions; 1158 1159 $this.adminPluginMultiSelect(opts); 1160 1161 }); 1162 }); 1163 1164 } 1165 1166}).apply(this, [jQuery]); 1167 1168(function($) { 1169 1170 'use strict'; 1171 1172 if ( $.isFunction( $.fn[ 'placeholder' ]) ) { 1173 1174 $('input[placeholder]').placeholder(); 1175 1176 } 1177 1178}).apply(this, [jQuery]); 1179 1180 1181// Select2 1182(function(admin, $) { 1183 1184 admin = admin || {}; 1185 1186 var instanceName = '__select2'; 1187 1188 var PluginSelect2 = function($el, opts) { 1189 return this.initialize($el, opts); 1190 }; 1191 1192 PluginSelect2.defaults = { 1193 theme: 'bootstrap' 1194 }; 1195 1196 PluginSelect2.prototype = { 1197 initialize: function($el, opts) { 1198 if ( $el.data( instanceName ) ) { 1199 return this; 1200 } 1201 1202 this.$el = $el; 1203 1204 this 1205 .setData() 1206 .setOptions(opts) 1207 .build(); 1208 1209 return this; 1210 }, 1211 1212 setData: function() { 1213 this.$el.data(instanceName, this); 1214 1215 return this; 1216 }, 1217 1218 setOptions: function(opts) { 1219 this.options = $.extend( true, {}, PluginSelect2.defaults, opts ); 1220 1221 return this; 1222 }, 1223 1224 build: function() { 1225 this.$el.select2( this.options ); 1226 1227 return this; 1228 } 1229 }; 1230 1231 // expose to scope 1232 $.extend(admin, { 1233 PluginSelect2: PluginSelect2 1234 }); 1235 1236 // jquery plugin 1237 $.fn.adminPluginSelect2 = function(opts) { 1238 return this.each(function() { 1239 var $this = $(this); 1240 1241 if ($this.data(instanceName)) { 1242 return $this.data(instanceName); 1243 } else { 1244 return new PluginSelect2($this, opts); 1245 } 1246 1247 }); 1248 } 1249 1250}).apply(this, [window.admin, jQuery]); 1251 1252// Select2 1253(function($) { 1254 1255 'use strict'; 1256 1257 if ( $.isFunction($.fn[ 'select2' ]) ) { 1258 1259 $(function() { 1260 $('[data-plugin-selectTwo]').each(function() { 1261 var $this = $( this ), 1262 opts = {}; 1263 1264 var pluginOptions = $this.data('plugin-options'); 1265 if (pluginOptions) 1266 opts = pluginOptions; 1267 1268 $this.adminPluginSelect2(opts); 1269 }); 1270 }); 1271 1272 } 1273 1274}).apply(this, [jQuery]); 1275 1276// Spinner 1277(function(admin, $) { 1278 1279 admin = admin || {}; 1280 1281 var instanceName = '__spinner'; 1282 1283 var PluginSpinner = function($el, opts) { 1284 return this.initialize($el, opts); 1285 }; 1286 1287 PluginSpinner.defaults = { 1288 }; 1289 1290 PluginSpinner.prototype = { 1291 initialize: function($el, opts) { 1292 if ( $el.data( instanceName ) ) { 1293 return this; 1294 } 1295 1296 this.$el = $el; 1297 1298 this 1299 .setData() 1300 .setOptions(opts) 1301 .build(); 1302 1303 return this; 1304 }, 1305 1306 setData: function() { 1307 this.$el.data(instanceName, this); 1308 1309 return this; 1310 }, 1311 1312 setOptions: function(opts) { 1313 this.options = $.extend( true, {}, PluginSpinner.defaults, opts ); 1314 1315 return this; 1316 }, 1317 1318 build: function() { 1319 this.$el.spinner( this.options ); 1320 1321 return this; 1322 } 1323 }; 1324 1325 // expose to scope 1326 $.extend(admin, { 1327 PluginSpinner: PluginSpinner 1328 }); 1329 1330 // jquery plugin 1331 $.fn.adminPluginSpinner = function(opts) { 1332 return this.each(function() { 1333 var $this = $(this); 1334 1335 if ($this.data(instanceName)) { 1336 return $this.data(instanceName); 1337 } else { 1338 return new PluginSpinner($this, opts); 1339 } 1340 1341 }); 1342 } 1343 1344}).apply(this, [window.admin, jQuery]); 1345 1346// Spinner 1347(function($) { 1348 1349 'use strict'; 1350 1351 if ( $.isFunction($.fn[ 'spinner' ]) ) { 1352 1353 $(function() { 1354 $('[data-plugin-spinner]').each(function() { 1355 var $this = $( this ), 1356 opts = {}; 1357 1358 var pluginOptions = $this.data('plugin-options'); 1359 if (pluginOptions) 1360 opts = pluginOptions; 1361 1362 $this.adminPluginSpinner(opts); 1363 }); 1364 }); 1365 1366 } 1367 1368}).apply(this, [jQuery]); 1369
1370// SummerNote 1371(function(admin, $) { 1372 1373 admin = admin || {}; 1374 1375 var instanceName = '__summernote'; 1376 1377 var PluginSummerNote = function($el, opts) { 1378 return this.initialize($el, opts); 1379 }; 1380 1381 PluginSummerNote.defaults = { 1382 onfocus: function() { 1383 $( this ).closest( '.note-editor' ).addClass( 'active' ); 1384 }, 1385 onblur: function() { 1386 $( this ).closest( '.note-editor' ).removeClass( 'active' ); 1387 } 1388 }; 1389 1390 PluginSummerNote.prototype = { 1391 initialize: function($el, opts) { 1392 if ( $el.data( instanceName ) ) { 1393 return this; 1394 } 1395 1396 this.$el = $el; 1397 1398 this 1399 .setData() 1400 .setOptions(opts) 1401 .build(); 1402 1403 return this; 1404 }, 1405 1406 setData: function() { 1407 this.$el.data(instanceName, this); 1408 1409 return this; 1410 }, 1411 1412 setOptions: function(opts) { 1413 this.options = $.extend( true, {}, PluginSummerNote.defaults, opts ); 1414 1415 return this; 1416 }, 1417 1418 build: function() { 1419 this.$el.summernote( this.options ); 1420 1421 return this; 1422 } 1423 }; 1424 1425 // expose to scope 1426 $.extend(admin, { 1427 PluginSummerNote: PluginSummerNote 1428 }); 1429 1430 // jquery plugin 1431 $.fn.adminPluginSummerNote = function(opts) { 1432 return this.each(function() { 1433 var $this = $(this); 1434 1435 if ($this.data(instanceName)) { 1436 return $this.data(instanceName); 1437 } else { 1438 return new PluginSummerNote($this, opts); 1439 } 1440 1441 }); 1442 } 1443 1444}).apply(this, [window.admin, jQuery]); 1445 1446// SummerNote 1447(function($) { 1448 1449 'use strict'; 1450 1451 if ( $.isFunction($.fn[ 'summernote' ]) ) { 1452 1453 $(function() { 1454 $('[data-plugin-summernote]').each(function() { 1455 var $this = $( this ), 1456 opts = {}; 1457 1458 var pluginOptions = $this.data('plugin-options'); 1459 if (pluginOptions) 1460 opts = pluginOptions; 1461 1462 $this.adminPluginSummerNote(opts); 1463 }); 1464 }); 1465 1466 } 1467 1468}).apply(this, [jQuery]); 1469 1470// TextArea AutoSize 1471(function(admin, $) { 1472 1473 admin = admin || {}; 1474 1475 var initialized = false; 1476 var instanceName = '__textareaAutosize'; 1477 1478 var PluginTextAreaAutoSize = function($el, opts) { 1479 return this.initialize($el, opts); 1480 }; 1481 1482 PluginTextAreaAutoSize.defaults = { 1483 }; 1484 1485 PluginTextAreaAutoSize.prototype = { 1486 initialize: function($el, opts) { 1487 if (initialized) { 1488 return this; 1489 } 1490 1491 this.$el = $el; 1492 1493 this 1494 .setData() 1495 .setOptions(opts) 1496 .build(); 1497 1498 return this; 1499 }, 1500 1501 setData: function() { 1502 this.$el.data(instanceName, this); 1503 1504 return this; 1505 }, 1506 1507 setOptions: function(opts) { 1508 this.options = $.extend( true, {}, PluginTextAreaAutoSize.defaults, opts ); 1509 1510 return this; 1511 }, 1512 1513 build: function() { 1514 1515 autosize($(this.$el)); 1516 1517 return this; 1518 } 1519 }; 1520 1521 // expose to scope 1522 $.extend(admin, { 1523 PluginTextAreaAutoSize: PluginTextAreaAutoSize 1524 }); 1525 1526 // jquery plugin 1527 $.fn.adminPluginTextAreaAutoSize = function(opts) { 1528 return this.each(function() { 1529 var $this = $(this); 1530 1531 if ($this.data(instanceName)) { 1532 return $this.data(instanceName); 1533 } else { 1534 return new PluginTextAreaAutoSize($this, opts); 1535 } 1536 1537 }); 1538 } 1539 1540}).apply(this, [window.admin, jQuery]); 1541 1542// TextArea AutoSize 1543(function($) { 1544 1545 'use strict'; 1546 1547 if ( typeof autosize === 'function' ) { 1548 1549 $(function() { 1550 $('[data-plugin-textarea-autosize]').each(function() { 1551 var $this = $( this ), 1552 opts = {}; 1553 1554 var pluginOptions = $this.data('plugin-options'); 1555 if (pluginOptions) 1556 opts = pluginOptions; 1557 1558 $this.adminPluginTextAreaAutoSize(opts); 1559 }); 1560 }); 1561 1562 } 1563 1564}).apply(this, [jQuery]); 1565 1566// TimePicker 1567(function(admin, $) { 1568 1569 admin = admin || {}; 1570 1571 var instanceName = '__timepicker'; 1572 1573 var PluginTimePicker = function($el, opts) { 1574 return this.initialize($el, opts); 1575 }; 1576 1577 PluginTimePicker.defaults = { 1578 disableMousewheel: true, 1579 icons: { 1580 up: 'fa fa-chevron-up', 1581 down: 'fa fa-chevron-down' 1582 } 1583 }; 1584 1585 PluginTimePicker.prototype = { 1586 initialize: function($el, opts) { 1587 if ( $el.data( instanceName ) ) { 1588 return this; 1589 } 1590 1591 this.$el = $el; 1592 1593 this 1594 .setData() 1595 .setOptions(opts) 1596 .build(); 1597 1598 return this; 1599 }, 1600 1601 setData: function() { 1602 this.$el.data(instanceName, this); 1603 1604 return this; 1605 }, 1606 1607 setOptions: function(opts) { 1608 this.options = $.extend( true, {}, PluginTimePicker.defaults, opts ); 1609 1610 return this; 1611 }, 1612 1613 build: function() { 1614 this.$el.timepicker( this.options ); 1615 1616 return this; 1617 } 1618 }; 1619 1620 // expose to scope 1621 $.extend(admin, { 1622 PluginTimePicker: PluginTimePicker 1623 }); 1624 1625 // jquery plugin 1626 $.fn.adminPluginTimePicker = function(opts) { 1627 return this.each(function() { 1628 var $this = $(this); 1629 1630 if ($this.data(instanceName)) { 1631 return $this.data(instanceName); 1632 } else { 1633 return new PluginTimePicker($this, opts); 1634 } 1635 1636 }); 1637 } 1638 1639}).apply(this, [window.admin, jQuery]); 1640 1641// TimePicker 1642(function($) { 1643 1644 'use strict'; 1645 1646 if ( $.isFunction($.fn[ 'timepicker' ]) ) { 1647 1648 $(function() { 1649 $('[data-plugin-timepicker]').each(function() { 1650 var $this = $( this ), 1651 opts = {}; 1652 1653 var pluginOptions = $this.data('plugin-options'); 1654 if (pluginOptions) 1655 opts = pluginOptions; 1656 1657 $this.adminPluginTimePicker(opts); 1658 }); 1659 }); 1660 1661 } 1662 1663}).apply(this, [jQuery]);
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.