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