1/* 2 * debouncedresize: special jQuery event that happens once after a window resize 3 * 4 * latest version and complete README available on Github: 5 * https://github.com/louisremi/jquery-smartresize 6 * 7 * Copyright 2012 @louis_remi 8 * Licensed under the MIT license. 9 * 10 * This saved you an hour of work? 11 * Send me music http://www.amazon.co.uk/wishlist/HNTU0468LQON 12 */ 13 14(function($) { 15 16 var $event = $.event, 17 $special, 18 resizeTimeout; 19 20 $special = $event.special.debouncedresize = { 21 setup: function() { 22 $( this ).on( "resize", $special.handler ); 23 }, 24 teardown: function() { 25 $( this ).off( "resize", $special.handler ); 26 }, 27 handler: function( event, execAsap ) { 28 // Save the context 29 var context = this, 30 args = arguments, 31 dispatch = function() { 32 // set correct event type 33 event.type = "debouncedresize"; 34 $event.dispatch.apply( context, args ); 35 }; 36 37 if ( resizeTimeout ) { 38 clearTimeout( resizeTimeout ); 39 } 40 41 execAsap ? 42 dispatch() : 43 resizeTimeout = setTimeout( dispatch, $special.threshold ); 44 }, 45 threshold: 150 46 }; 47 48})(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.