1/*! 2 * jQuery resizeend - A jQuery plugin that allows for window resize-end event handling. 3 * 4 * Copyright (c) 2015 Erik Nielsen 5 * 6 * Licensed under the MIT license: 7 * http://www.opensource.org/licenses/mit-license.php 8 * 9 * Project home: 10 * http://312development.com 11 * 12 * Version: 0.2.0 13 * 14 */ 15 16(function(plugin) { 17 var chicago = window.Chicago || { 18 utils: { 19 now: Date.now || function() { 20 return new Date().getTime(); 21 }, 22 uid: function(prefix) { 23 return(prefix || "id") + chicago.utils.now() + "RAND" + Math.ceil(Math.random() * 1e5); 24 }, 25 is: { 26 number: function(obj) { 27 return !isNaN(parseFloat(obj)) && isFinite(obj); 28 }, 29 fn: function(obj) { 30 return typeof obj === "function"; 31 }, 32 object: function(obj) { 33 return Object.prototype.toString.call(obj) === "[object Object]"; 34 } 35 }, 36 debounce: function(fn, wait, immediate) { 37 var timeout; 38 return function() { 39 var context = this, 40 args = arguments, 41 later = function() { 42 timeout = null; 43 if(!immediate) { 44 fn.apply(context, args); 45 } 46 }, 47 callNow = immediate && !timeout; 48 if(timeout) { 49 clearTimeout(timeout); 50 } 51 timeout = setTimeout(later, wait); 52 if(callNow) { 53 fn.apply(context, args); 54 } 55 }; 56 } 57 }, 58 $: window.jQuery || null 59 }; 60 if(typeof define === "function" && define.amd) { 61 define("chicago", function() { 62 chicago.load = function(res, req, onload, config) { 63 var resources = res.split(","), 64 load = []; 65 var base = (config.config && config.config.chicago && config.config.chicago.base ? config.config.chicago.base : "").replace(/\/+$/g, ""); 66 if(!base) { 67 throw new Error("Please define base path to jQuery resize.end in the requirejs config."); 68 } 69 var i = 0; 70 while(i < resources.length) { 71 var resource = resources[i].replace(/\./g, "/"); 72 load.push(base + "/" + resource); 73 i += 1; 74 } 75 req(load, function() { 76 onload(chicago); 77 }); 78 }; 79 return chicago; 80 }); 81 } 82 if(window && window.jQuery) { 83 return plugin(chicago, window, window.document); 84 } else { 85 if(!window.jQuery) { 86 throw new Error("jQuery resize.end requires jQuery"); 87 } 88 } 89})(function(_c, win, doc) { 90 _c.$win = _c.$(win); 91 _c.$doc = _c.$(doc); 92 if(!_c.events) { 93 _c.events = {}; 94 } 95 _c.events.resizeend = { 96 defaults: { 97 delay: 250 98 }, 99 setup: function() { 100 var args = arguments, 101 options = { 102 delay: _c.$.event.special.resizeend.defaults.delay 103 }, 104 fn; 105 if(_c.utils.is.fn(args[0])) { 106 fn = args[0]; 107 } else { 108 if(_c.utils.is.number(args[0])) { 109 options.delay = args[0]; 110 } else { 111 if(_c.utils.is.object(args[0])) { 112 options = _c.$.extend({}, options, args[0]); 113 } 114 } 115 } 116 var uid = _c.utils.uid("resizeend"), 117 _data = _c.$.extend({ 118 delay: _c.$.event.special.resizeend.defaults.delay 119 }, options), 120 timer = _data, 121 handler = function(e) { 122 if(timer) { 123 clearTimeout(timer); 124 } 125 timer = setTimeout(function() { 126 timer = null; 127 e.type = "resizeend.chicago.dom"; 128 return _c.$(e.target).trigger("resizeend", e); 129 }, _data.delay); 130 }; 131 _c.$(this).data("chicago.event.resizeend.uid", uid); 132 return _c.$(this).on("resize", _c.utils.debounce(handler, 100)).data(uid, handler); 133 }, 134 teardown: function() { 135 var uid = _c.$(this).data("chicago.event.resizeend.uid"); 136 _c.$(this).off("resize", _c.$(this).data(uid)); 137 _c.$(this).removeData(uid); 138 return _c.$(this).removeData("chicago.event.resizeend.uid"); 139 } 140 }; 141 (function() { 142 _c.$.event.special.resizeend = _c.events.resizeend; 143 _c.$.fn.resizeend = function(options, callback) { 144 return this.each(function() { 145 _c.$(this).on("resizeend", options, callback); 146 }); 147 }; 148 })(); 149});
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.