(function($,sr){ // debouncing function from John Hann // http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/ var debounce = function (func, threshold, execAsap) { var timeout; return function debounced () { var obj = this, args = arguments; function delayed () { if (!execAsap) func.apply(obj, args); timeout = null; } if (timeout) clearTimeout(timeout); else if (execAsap) func.apply(obj, args); timeout = setTimeout(delayed, threshold || 100); }; }; // smartresize jQuery.fn[sr] = function(fn){ return fn ? this.bind('resize', debounce(fn)) : this.trigger(sr); }; })(jQuery,'smartresize'); // Panel toolbox $(document).ready(function() { $('.collapse-link').on('click', function() { var $BOX_PANEL = $(this).closest('.x_panel'), $ICON = $(this).find('i'), $BOX_CONTENT = $BOX_PANEL.find('.x_content'); // fix for some div with hardcoded fix class if ($BOX_PANEL.attr('style')) { $BOX_CONTENT.slideToggle(200, function(){ $BOX_PANEL.removeAttr('style'); }); } else { $BOX_CONTENT.slideToggle(200); $BOX_PANEL.css('height', 'auto'); } $ICON.toggleClass('fa-chevron-up fa-chevron-down'); }); $('.close-link').click(function () { var $BOX_PANEL = $(this).closest('.x_panel'); $BOX_PANEL.remove(); }); }); // /Panel toolbox // Tooltip $(document).ready(function() { $('[data-toggle="tooltip"]').tooltip({ container: 'body' }); }); // /Tooltip // iCheck $(document).ready(function() { if ($("input.flat")[0]) { $(document).ready(function () { $('input.flat').iCheck({ checkboxClass: 'icheckbox_flat-blue', radioClass: 'iradio_flat-blue' }); }); } }); // /iCheck