1$(document).ready(function() { 2 3 /*-----------------------------------/ 4 /* TOP NAVIGATION AND LAYOUT 5 /*----------------------------------*/ 6 7 $('.btn-toggle-fullwidth').on('click', function() { 8 if(!$('body').hasClass('layout-fullwidth')) { 9 $('body').addClass('layout-fullwidth'); 10 11 } else { 12 $('body').removeClass('layout-fullwidth'); 13 $('body').removeClass('layout-default'); // also remove default behaviour if set 14 } 15 16 $(this).find('.lnr').toggleClass('lnr-arrow-left-circle lnr-arrow-right-circle'); 17 18 if($(window).innerWidth() < 1025) { 19 if(!$('body').hasClass('offcanvas-active')) { 20 $('body').addClass('offcanvas-active'); 21 } else { 22 $('body').removeClass('offcanvas-active'); 23 } 24 } 25 }); 26 27 $(window).on('load', function() { 28 if($(window).innerWidth() < 1025) { 29 $('.btn-toggle-fullwidth').find('.icon-arrows') 30 .removeClass('icon-arrows-move-left') 31 .addClass('icon-arrows-move-right'); 32 } 33 34 // adjust right sidebar top position 35 $('.right-sidebar').css('top', $('.navbar').innerHeight()); 36 37 // if page has content-menu, set top padding of main-content 38 if($('.has-content-menu').length > 0) { 39 $('.navbar + .main-content').css('padding-top', $('.navbar').innerHeight()); 40 } 41 42 // for shorter main content 43 if($('.main').height() < $('#sidebar-nav').height()) { 44 $('.main').css('min-height', $('#sidebar-nav').height()); 45 } 46 }); 47 48 49 /*-----------------------------------/ 50 /* SIDEBAR NAVIGATION 51 /*----------------------------------*/ 52 53 $('.sidebar a[data-toggle="collapse"]').on('click', function() { 54 if($(this).hasClass('collapsed')) { 55 $(this).addClass('active'); 56 } else { 57 $(this).removeClass('active'); 58 } 59 }); 60 61 if( $('.sidebar-scroll').length > 0 ) { 62 $('.sidebar-scroll').slimScroll({ 63 height: '95%', 64 wheelStep: 2, 65 }); 66 } 67 68 69 /*-----------------------------------/ 70 /* PANEL FUNCTIONS 71 /*----------------------------------*/ 72 73 // panel hide 74 $('.panel .btn-hide').click(function(e){ 75 76 e.preventDefault(); 77 $(this).parents('.panel').fadeOut(300, function(){ 78 $(this).addClass('hide').css('display', ''); 79 }); 80 }); 81 82 // panel remove 83 $('.panel .btn-remove').click(function(e){ 84 85 e.preventDefault(); 86 $(this).parents('.panel').fadeOut(300, function(){ 87 $(this).remove(); 88 }); 89 }); 90 91 // panel collapse/expand 92 var affectedElement = $('.panel-body'); 93 94 $('.panel .btn-toggle-collapse').clickToggle( 95 function(e) { 96 e.preventDefault(); 97 98 // if has scroll 99 if( $(this).parents('.panel').find('.slimScrollDiv').length > 0 ) { 100 affectedElement = $('.slimScrollDiv'); 101 } 102 103 $(this).parents('.panel').find(affectedElement).slideUp(300); 104 $(this).find('i.lnr-chevron-up').toggleClass('lnr-chevron-down'); 105 }, 106 function(e) { 107 e.preventDefault(); 108 109 // if has scroll 110 if( $(this).parents('.panel').find('.slimScrollDiv').length > 0 ) { 111 affectedElement = $('.slimScrollDiv'); 112 } 113 114 $(this).parents('.panel').find(affectedElement).slideDown(300); 115 $(this).find('i.lnr-chevron-up').toggleClass('lnr-chevron-down'); 116 } 117 ); 118 119 120 /*-----------------------------------/ 121 /* PANEL SCROLLING 122 /*----------------------------------*/ 123 124 if( $('.panel-scrolling').length > 0) { 125 $('.panel-scrolling .panel-body').slimScroll({ 126 height: '430px', 127 wheelStep: 2, 128 }); 129 } 130 131 if( $('#panel-scrolling-demo').length > 0) { 132 $('#panel-scrolling-demo .panel-body').slimScroll({ 133 height: '175px', 134 wheelStep: 2, 135 }); 136 } 137 138 /*-----------------------------------/ 139 /* TODO LIST 140 /*----------------------------------*/ 141 142 $('.todo-list input').change( function() { 143 if( $(this).prop('checked') ) { 144 $(this).parents('li').addClass('completed'); 145 }else { 146 $(this).parents('li').removeClass('completed'); 147 } 148 }); 149 150 151 /*-----------------------------------/ 152 /* TOASTR NOTIFICATION 153 /*----------------------------------*/ 154 155 if($('#toastr-demo').length > 0) { 156 toastr.options.timeOut = "false"; 157 toastr.options.closeButton = true; 158 toastr['info']('Hi there, this is notification demo with HTML support. So, you can add HTML elements like <a href="#">this link</a>'); 159 160 $('.btn-toastr').on('click', function() { 161 $context = $(this).data('context'); 162 $message = $(this).data('message'); 163 $position = $(this).data('position'); 164 165 if($context == '') { 166 $context = 'info'; 167 } 168 169 if($position == '') { 170 $positionClass = 'toast-left-top'; 171 } else { 172 $positionClass = 'toast-' + $position; 173 } 174 175 toastr.remove(); 176 toastr[$context]($message, '' , { positionClass: $positionClass }); 177 }); 178 179 $('#toastr-callback1').on('click', function() { 180 $message = $(this).data('message'); 181 182 toastr.options = { 183 "timeOut": "300", 184 "onShown": function() { alert('onShown callback'); }, 185 "onHidden": function() { alert('onHidden callback'); } 186 } 187 188 toastr['info']($message); 189 }); 190 191 $('#toastr-callback2').on('click', function() { 192 $message = $(this).data('message'); 193 194 toastr.options = { 195 "timeOut": "10000", 196 "onclick": function() { alert('onclick callback'); }, 197 } 198 199 toastr['info']($message); 200 201 }); 202 203 $('#toastr-callback3').on('click', function() { 204 $message = $(this).data('message'); 205 206 toastr.options = { 207 "timeOut": "10000", 208 "closeButton": true, 209 "onCloseClick": function() { alert('onCloseClick callback'); } 210 } 211 212 toastr['info']($message); 213 }); 214 } 215}); 216 217// toggle function 218$.fn.clickToggle = function( f1, f2 ) { 219 return this.each( function() { 220 var clicked = false;
221 $(this).bind('click', function() { 222 if(clicked) { 223 clicked = false; 224 return f2.apply(this, arguments); 225 } 226 227 clicked = true; 228 return f1.apply(this, arguments); 229 }); 230 }); 231 232} 233 234
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.