1/*! 2 * remark (http://getbootstrapadmin.com/remark) 3 * Copyright 2015 amazingsurge 4 * Licensed under the Themeforest Standard Licenses 5 */ 6(function(window, document, $) { 7 'use strict'; 8 9 var $body = $('body'), 10 $html = $('html'); 11 12 $.site.gridmenu = { 13 opened: false, 14 15 init: function() { 16 this.$instance = $('.site-gridmenu'); 17 18 if (this.$instance.length === 0) { 19 return; 20 } 21 22 this.bind(); 23 }, 24 25 bind: function() { 26 var self = this; 27 28 $(document).on('click', '[data-toggle="gridmenu"]', function() { 29 var $this = $(this); 30 31 if (self.opened) { 32 self.close(); 33 34 $this.removeClass('active') 35 .attr('aria-expanded', false); 36 37 } else { 38 self.open(); 39 40 $this.addClass('active') 41 .attr('aria-expanded', true); 42 } 43 }); 44 }, 45 46 open: function() { 47 var self = this; 48 49 if (this.opened !== true) { 50 this.animate(function() { 51 self.opened = true; 52 53 54 self.$instance.addClass('active'); 55 56 $('[data-toggle="gridmenu"]').addClass('active') 57 .attr('aria-expanded', true); 58 59 $body.addClass('site-gridmenu-active'); 60 $html.addClass('disable-scrolling'); 61 }, function() { 62 this.scrollable.enable(); 63 }); 64 } 65 }, 66 67 close: function() { 68 var self = this; 69 70 if (this.opened === true) { 71 this.animate(function() { 72 self.opened = false; 73 74 self.$instance.removeClass('active'); 75 76 $('[data-toggle="gridmenu"]').addClass('active') 77 .attr('aria-expanded', true); 78 79 $body.removeClass('site-gridmenu-active'); 80 $html.removeClass('disable-scrolling'); 81 }, function() { 82 this.scrollable.disable(); 83 }); 84 } 85 }, 86 87 toggle: function() { 88 if (this.opened) { 89 this.close(); 90 } else { 91 this.open(); 92 } 93 }, 94 95 animate: function(doing, callback) { 96 var self = this; 97 98 doing.call(self); 99 this.$instance.trigger('changing.site.gridmenu'); 100 101 setTimeout(function() { 102 callback.call(self); 103 104 self.$instance.trigger('changed.site.gridmenu'); 105 }, 500); 106 }, 107 108 scrollable: { 109 api: null, 110 init: function() { 111 this.api = $.site.gridmenu.$instance.asScrollable({ 112 namespace: 'scrollable', 113 skin: 'scrollable-inverse', 114 direction: 'vertical', 115 contentSelector: '>', 116 containerSelector: '>' 117 }).data('asScrollable'); 118 }, 119 120 update: function() { 121 if (this.api) { 122 this.api.update(); 123 } 124 }, 125 126 enable: function() { 127 if (!this.api) { 128 this.init(); 129 } 130 if (this.api) { 131 this.api.enable(); 132 } 133 }, 134 135 disable: function() { 136 if (this.api) { 137 this.api.disable(); 138 } 139 } 140 }, 141 }; 142})(window, document, 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.