1/* 2 * Foundation Responsive Library 3 * http://foundation.zurb.com 4 * Copyright 2013, ZURB 5 * Free to use under the MIT license. 6 * http://www.opensource.org/licenses/mit-license.php 7*/ 8 9(function ($, window, document, undefined) { 10 'use strict'; 11 12 // Used to retrieve Foundation media queries from CSS. 13 if($('head').has('.foundation-mq-small').length === 0) { 14 $('head').append('<meta class="foundation-mq-small">'); 15 } 16 17 if($('head').has('.foundation-mq-medium').length === 0) { 18 $('head').append('<meta class="foundation-mq-medium">'); 19 } 20 21 if($('head').has('.foundation-mq-large').length === 0) { 22 $('head').append('<meta class="foundation-mq-large">'); 23 } 24 25 if($('head').has('.foundation-mq-xlarge').length === 0) { 26 $('head').append('<meta class="foundation-mq-xlarge">'); 27 } 28 29 if($('head').has('.foundation-mq-xxlarge').length === 0) { 30 $('head').append('<meta class="foundation-mq-xxlarge">'); 31 } 32 33 // Embed FastClick (this should be removed later) 34 function FastClick(layer){'use strict';var oldOnClick,self=this;this.trackingClick=false;this.trackingClickStart=0;this.targetElement=null;this.touchStartX=0;this.touchStartY=0;this.lastTouchIdentifier=0;this.touchBoundary=10;this.layer=layer;if(!layer||!layer.nodeType){throw new TypeError('Layer must be a document node');}this.onClick=function(){return FastClick.prototype.onClick.apply(self,arguments)};this.onMouse=function(){return FastClick.prototype.onMouse.apply(self,arguments)};this.onTouchStart=function(){return FastClick.prototype.onTouchStart.apply(self,arguments)};this.onTouchMove=function(){return FastClick.prototype.onTouchMove.apply(self,arguments)};this.onTouchEnd=function(){return FastClick.prototype.onTouchEnd.apply(self,arguments)};this.onTouchCancel=function(){return FastClick.prototype.onTouchCancel.apply(self,arguments)};if(FastClick.notNeeded(layer)){return}if(this.deviceIsAndroid){layer.addEventListener('mouseover',this.onMouse,true);layer.addEventListener('mousedown',this.onMouse,true);layer.addEventListener('mouseup',this.onMouse,true)}layer.addEventListener('click',this.onClick,true);layer.addEventListener('touchstart',this.onTouchStart,false);layer.addEventListener('touchmove',this.onTouchMove,false);layer.addEventListener('touchend',this.onTouchEnd,false);layer.addEventListener('touchcancel',this.onTouchCancel,false);if(!Event.prototype.stopImmediatePropagation){layer.removeEventListener=function(type,callback,capture){var rmv=Node.prototype.removeEventListener;if(type==='click'){rmv.call(layer,type,callback.hijacked||callback,capture)}else{rmv.call(layer,type,callback,capture)}};layer.addEventListener=function(type,callback,capture){var adv=Node.prototype.addEventListener;if(type==='click'){adv.call(layer,type,callback.hijacked||(callback.hijacked=function(event){if(!event.propagationStopped){callback(event)}}),capture)}else{adv.call(layer,type,callback,capture)}}}if(typeof layer.onclick==='function'){oldOnClick=layer.onclick;layer.addEventListener('click',function(event){oldOnClick(event)},false);layer.onclick=null}}FastClick.prototype.deviceIsAndroid=navigator.userAgent.indexOf('Android')>0;FastClick.prototype.deviceIsIOS=/iP(ad|hone|od)/.test(navigator.userAgent);FastClick.prototype.deviceIsIOS4=FastClick.prototype.deviceIsIOS&&(/OS 4_\d(_\d)?/).test(navigator.userAgent);FastClick.prototype.deviceIsIOSWithBadTarget=FastClick.prototype.deviceIsIOS&&(/OS ([6-9]|\d{2})_\d/).test(navigator.userAgent);FastClick.prototype.needsClick=function(target){'use strict';switch(target.nodeName.toLowerCase()){case'button':case'select':case'textarea':if(target.disabled){return true}break;case'input':if((this.deviceIsIOS&&target.type==='file')||target.disabled){return true}break;case'label':case'video':return true}return(/\bneedsclick\b/).test(target.className)};FastClick.prototype.needsFocus=function(target){'use strict';switch(target.nodeName.toLowerCase()){case'textarea':case'select':return true;case'input':switch(target.type){case'button':case'checkbox':case'file':case'image':case'radio':case'submit':return false}return!target.disabled&&!target.readOnly;default:return(/\bneedsfocus\b/).test(target.className)}};FastClick.prototype.sendClick=function(targetElement,event){'use strict';var clickEvent,touch;if(document.activeElement&&document.activeElement!==targetElement){document.activeElement.blur()}touch=event.changedTouches[0];clickEvent=document.createEvent('MouseEvents');clickEvent.initMouseEvent('click',true,true,window,1,touch.screenX,touch.screenY,touch.clientX,touch.clientY,false,false,false,false,0,null);clickEvent.forwardedTouchEvent=true;targetElement.dispatchEvent(clickEvent)};
vendor: 5,736 bytes, line 34
34FastClick.prototype.focus=function(targetElement){'use strict';var length;if(this.deviceIsIOS&&targetElement.setSelectionRange){length=targetElement.value.length;targetElement.setSelectionRange(length,length)}else{targetElement.focus()}};FastClick.prototype.updateScrollParent=function(targetElement){'use strict';var scrollParent,parentElement;scrollParent=targetElement.fastClickScrollParent;if(!scrollParent||!scrollParent.contains(targetElement)){parentElement=targetElement;do{if(parentElement.scrollHeight>parentElement.offsetHeight){scrollParent=parentElement;targetElement.fastClickScrollParent=parentElement;break}parentElement=parentElement.parentElement}while(parentElement)}if(scrollParent){scrollParent.fastClickLastScrollTop=scrollParent.scrollTop}};FastClick.prototype.getTargetElementFromEventTarget=function(eventTarget){'use strict';if(eventTarget.nodeType===Node.TEXT_NODE){return eventTarget.parentNode}return eventTarget};FastClick.prototype.onTouchStart=function(event){'use strict';var targetElement,touch,selection;if(event.targetTouches.length>1){return true}targetElement=this.getTargetElementFromEventTarget(event.target);touch=event.targetTouches[0];if(this.deviceIsIOS){selection=window.getSelection();if(selection.rangeCount&&!selection.isCollapsed){return true}if(!this.deviceIsIOS4){if(touch.identifier===this.lastTouchIdentifier){event.preventDefault();return false}this.lastTouchIdentifier=touch.identifier;this.updateScrollParent(targetElement)}}this.trackingClick=true;this.trackingClickStart=event.timeStamp;this.targetElement=targetElement;this.touchStartX=touch.pageX;this.touchStartY=touch.pageY;if((event.timeStamp-this.lastClickTime)<200){event.preventDefault()}return true};FastClick.prototype.touchHasMoved=function(event){'use strict';var touch=event.changedTouches[0],boundary=this.touchBoundary;if(Math.abs(touch.pageX-this.touchStartX)>boundary||Math.abs(touch.pageY-this.touchStartY)>boundary){return true}return false};FastClick.prototype.onTouchMove=function(event){'use strict';if(!this.trackingClick){return true}if(this.targetElement!==this.getTargetElementFromEventTarget(event.target)||this.touchHasMoved(event)){this.trackingClick=false;this.targetElement=null}return true};FastClick.prototype.findControl=function(labelElement){'use strict';if(labelElement.control!==undefined){return labelElement.control}if(labelElement.htmlFor){return document.getElementById(labelElement.htmlFor)}return labelElement.querySelector('button, input:not([type=hidden]), keygen, meter, output, progress, select, textarea')};FastClick.prototype.onTouchEnd=function(event){'use strict';var forElement,trackingClickStart,targetTagName,scrollParent,touch,targetElement=this.targetElement;if(!this.trackingClick){return true}if((event.timeStamp-this.lastClickTime)<200){this.cancelNextClick=true;return true}this.lastClickTime=event.timeStamp;trackingClickStart=this.trackingClickStart;this.trackingClick=false;this.trackingClickStart=0;if(this.deviceIsIOSWithBadTarget){touch=event.changedTouches[0];targetElement=document.elementFromPoint(touch.pageX-window.pageXOffset,touch.pageY-window.pageYOffset)||targetElement;targetElement.fastClickScrollParent=this.targetElement.fastClickScrollParent}targetTagName=targetElement.tagName.toLowerCase();if(targetTagName==='label'){forElement=this.findControl(targetElement);if(forElement){this.focus(targetElement);if(this.deviceIsAndroid){return false}targetElement=forElement}}else if(this.needsFocus(targetElement)){if((event.timeStamp-trackingClickStart)>100||(this.deviceIsIOS&&window.top!==window&&targetTagName==='input')){this.targetElement=null;return false}this.focus(targetElement);if(!this.deviceIsIOS4||targetTagName!=='select'){this.targetElement=null;event.preventDefault()}return false}if(this.deviceIsIOS&&!this.deviceIsIOS4){scrollParent=targetElement.fastClickScrollParent;if(scrollParent&&scrollParent.fastClickLastScrollTop!==scrollParent.scrollTop){return true}}if(!this.needsClick(targetElement)){event.preventDefault();this.sendClick(targetElement,event)}return false};FastClick.prototype.onTouchCancel=function(){'use strict';this.trackingClick=false;this.targetElement=null};FastClick.prototype.onMouse=function(event){'use strict';if(!this.targetElement){return true}if(event.forwardedTouchEvent){return true}if(!event.cancelable){return true}if(!this.needsClick(this.targetElement)||this.cancelNextClick){if(event.stopImmediatePropagation){event.stopImmediatePropagation()}else{event.propagationStopped=true}event.stopPropagation();event.preventDefault();return false}return true};FastClick.prototype.onClick=function(event){'use strict';var permitted;if(this.trackingClick){this.targetElement=null;this.trackingClick=false;return true}if(event.target.type==='submit'&&event.detail===0){return true}permitted=this.onMouse(event);if(!permitted){this.targetElement=null}return permitted};FastClick.prototype.destroy=function(){'use strict';var layer=this.layer;if(this.deviceIsAndroid){layer.removeEventListener('mouseover',this.onMouse,true);layer.removeEventListener('mousedown',this.onMouse,true);layer.removeEventListener('mouseup',this.onMouse,true)}layer.removeEventListener('click',this.onClick,true);layer.removeEventListener('touchstart',this.onTouchStart,false);layer.removeEventListener('touchmove',this.onTouchMove,false);layer.removeEventListener('touchend',this.onTouchEnd,false);layer.removeEventListener('touchcancel',this.onTouchCancel,false)};FastClick.notNeeded=function(layer){'use strict';var metaViewport;if(typeof window.ontouchstart==='undefined'){return true}if((/Chrome\/[0-9]+/).test(navigator.userAgent)){if(FastClick.prototype.deviceIsAndroid){metaViewport=document.querySelector('meta[name=viewport]');
34if(metaViewport&&metaViewport.content.indexOf('user-scalable=no')!==-1){return true}}else{return true}}if(layer.style.msTouchAction==='none'){return true}return false};FastClick.attach=function(layer){'use strict';return new FastClick(layer)};if(typeof define!=='undefined'&&define.amd){define(function(){'use strict';return FastClick})}else if(typeof module!=='undefined'&&module.exports){module.exports=FastClick.attach;module.exports.FastClick=FastClick}else{window.FastClick=FastClick} 35 36 37 // Enable FastClick 38 if(typeof FastClick !== 'undefined') { 39 FastClick.attach(document.body); 40 } 41 42 // private Fast Selector wrapper, 43 // returns jQuery object. Only use where 44 // getElementById is not available. 45 var S = function (selector, context) { 46 if (typeof selector === 'string') { 47 if (context) { 48 return $(context.querySelectorAll(selector)); 49 } 50 51 return $(document.querySelectorAll(selector)); 52 } 53 54 return $(selector, context); 55 }; 56 57 /* 58 https://github.com/paulirish/matchMedia.js 59 */ 60 61 window.matchMedia = window.matchMedia || (function( doc, undefined ) { 62 63 "use strict"; 64 65 var bool, 66 docElem = doc.documentElement, 67 refNode = docElem.firstElementChild || docElem.firstChild, 68 // fakeBody required for <FF4 when executed in <head> 69 fakeBody = doc.createElement( "body" ), 70 div = doc.createElement( "div" ); 71 72 div.id = "mq-test-1"; 73 div.style.cssText = "position:absolute;top:-100em"; 74 fakeBody.style.background = "none"; 75 fakeBody.appendChild(div); 76 77 return function(q){ 78 79 div.innerHTML = "­<style media=\"" + q + "\"> #mq-test-1 { width: 42px; }</style>"; 80 81 docElem.insertBefore( fakeBody, refNode ); 82 bool = div.offsetWidth === 42; 83 docElem.removeChild( fakeBody ); 84 85 return { 86 matches: bool, 87 media: q 88 }; 89 90 }; 91 92 }( document )); 93 94 /* 95 * jquery.requestAnimationFrame 96 * https://github.com/gnarf37/jquery-requestAnimationFrame 97 * Requires jQuery 1.8+ 98 * 99 * Copyright (c) 2012 Corey Frang 100 * Licensed under the MIT license. 101 */ 102 103 (function( $ ) { 104 105 // requestAnimationFrame polyfill adapted from Erik Möller 106 // fixes from Paul Irish and Tino Zijdel 107 // http://paulirish.com/2011/requestanimationframe-for-smart-animating/ 108 // http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating 109 110 111 var animating, 112 lastTime = 0, 113 vendors = ['webkit', 'moz'], 114 requestAnimationFrame = window.requestAnimationFrame, 115 cancelAnimationFrame = window.cancelAnimationFrame; 116 117 for(; lastTime < vendors.length && !requestAnimationFrame; lastTime++) { 118 requestAnimationFrame = window[ vendors[lastTime] + "RequestAnimationFrame" ]; 119 cancelAnimationFrame = cancelAnimationFrame || 120 window[ vendors[lastTime] + "CancelAnimationFrame" ] || 121 window[ vendors[lastTime] + "CancelRequestAnimationFrame" ]; 122 } 123 124 function raf() { 125 if ( animating ) { 126 requestAnimationFrame( raf ); 127 jQuery.fx.tick(); 128 } 129 } 130 131 if ( requestAnimationFrame ) { 132 // use rAF 133 window.requestAnimationFrame = requestAnimationFrame; 134 window.cancelAnimationFrame = cancelAnimationFrame; 135 jQuery.fx.timer = function( timer ) { 136 if ( timer() && jQuery.timers.push( timer ) && !animating ) { 137 animating = true; 138 raf(); 139 } 140 }; 141 142 jQuery.fx.stop = function() { 143 animating = false; 144 }; 145 } else { 146 // polyfill 147 window.requestAnimationFrame = function( callback, element ) { 148 var currTime = new Date().getTime(), 149 timeToCall = Math.max( 0, 16 - ( currTime - lastTime ) ), 150 id = window.setTimeout( function() { 151 callback( currTime + timeToCall ); 152 }, timeToCall ); 153 lastTime = currTime + timeToCall; 154 return id; 155 }; 156 157 window.cancelAnimationFrame = function(id) { 158 clearTimeout(id); 159 }; 160 161 } 162 163 }( jQuery )); 164 165 166 function removeQuotes (string) { 167 if (typeof string === 'string' || string instanceof String) { 168 string = string.replace(/^[\\/'"]+|(;\s?})+|[\\/'"]+$/g, ''); 169 } 170 171 return string; 172 } 173 174 window.Foundation = { 175 name : 'Foundation', 176 177 version : '5.0.0', 178 179 media_queries : { 180 small : S('.foundation-mq-small').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
181 medium : S('.foundation-mq-medium').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''), 182 large : S('.foundation-mq-large').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''), 183 xlarge: S('.foundation-mq-xlarge').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''), 184 xxlarge: S('.foundation-mq-xxlarge').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, '') 185 }, 186 187 stylesheet : $('<style></style>').appendTo('head')[0].sheet, 188 189 init : function (scope, libraries, method, options, response) { 190 var library_arr, 191 args = [scope, method, options, response], 192 responses = []; 193 194 // check RTL 195 this.rtl = /rtl/i.test(S('html').attr('dir')); 196 197 // set foundation global scope 198 this.scope = scope || this.scope; 199 200 if (libraries && typeof libraries === 'string' && !/reflow/i.test(libraries)) { 201 if (this.libs.hasOwnProperty(libraries)) { 202 responses.push(this.init_lib(libraries, args)); 203 } 204 } else { 205 for (var lib in this.libs) { 206 responses.push(this.init_lib(lib, libraries)); 207 } 208 } 209 210 return scope; 211 }, 212 213 init_lib : function (lib, args) { 214 if (this.libs.hasOwnProperty(lib)) { 215 this.patch(this.libs[lib]); 216 217 if (args && args.hasOwnProperty(lib)) { 218 return this.libs[lib].init.apply(this.libs[lib], [this.scope, args[lib]]); 219 } 220 221 return this.libs[lib].init.apply(this.libs[lib], args); 222 } 223 224 return function () {}; 225 }, 226 227 patch : function (lib) { 228 lib.scope = this.scope; 229 lib['data_options'] = this.lib_methods.data_options; 230 lib['bindings'] = this.lib_methods.bindings; 231 lib['S'] = S; 232 lib.rtl = this.rtl; 233 }, 234 235 inherit : function (scope, methods) { 236 var methods_arr = methods.split(' '); 237 238 for (var i = methods_arr.length - 1; i >= 0; i--) { 239 if (this.lib_methods.hasOwnProperty(methods_arr[i])) { 240 this.libs[scope.name][methods_arr[i]] = this.lib_methods[methods_arr[i]]; 241 } 242 } 243 }, 244 245 random_str : function (length) { 246 var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split(''); 247 248 if (!length) { 249 length = Math.floor(Math.random() * chars.length); 250 } 251 252 var str = ''; 253 for (var i = 0; i < length; i++) { 254 str += chars[Math.floor(Math.random() * chars.length)]; 255 } 256 return str; 257 }, 258 259 libs : {}, 260 261 // methods that can be inherited in libraries 262 lib_methods : { 263 throttle : function(fun, delay) { 264 var timer = null; 265 266 return function () { 267 var context = this, args = arguments; 268 269 clearTimeout(timer); 270 timer = setTimeout(function () { 271 fun.apply(context, args); 272 }, delay); 273 }; 274 }, 275 276 // parses data-options attribute 277 data_options : function (el) { 278 var opts = {}, ii, p, opts_arr, opts_len, 279 data_options = el.data('options'); 280 281 if (typeof data_options === 'object') { 282 return data_options; 283 } 284 285 opts_arr = (data_options || ':').split(';'), 286 opts_len = opts_arr.length; 287 288 function isNumber (o) { 289 return ! isNaN (o-0) && o !== null && o !== "" && o !== false && o !== true; 290 } 291 292 function trim(str) { 293 if (typeof str === 'string') return $.trim(str); 294 return str; 295 } 296 297 // parse options 298 for (ii = opts_len - 1; ii >= 0; ii--) { 299 p = opts_arr[ii].split(':'); 300 301 if (/true/i.test(p[1])) p[1] = true; 302 if (/false/i.test(p[1])) p[1] = false; 303 if (isNumber(p[1])) p[1] = parseInt(p[1], 10); 304 305 if (p.length === 2 && p[0].length > 0) { 306 opts[trim(p[0])] = trim(p[1]); 307 } 308 } 309 310 return opts; 311 }, 312 313 delay : function (fun, delay) { 314 return setTimeout(fun, delay); 315 }, 316 317 // test for empty object or array 318 empty : function (obj) { 319 if (obj.length && obj.length > 0) return false;
320 if (obj.length && obj.length === 0) return true; 321 322 for (var key in obj) { 323 if (hasOwnProperty.call(obj, key)) return false; 324 } 325 326 return true; 327 }, 328 329 register_media : function(media, media_class) { 330 if(Foundation.media_queries[media] === undefined) { 331 $('head').append('<meta class="' + media_class + '">'); 332 Foundation.media_queries[media] = removeQuotes($('.' + media_class).css('font-family')); 333 } 334 }, 335 336 addCustomRule : function(rule, media) { 337 if(media === undefined) { 338 Foundation.stylesheet.insertRule(rule, Foundation.stylesheet.cssRules.length); 339 } else { 340 var query = Foundation.media_queries[media]; 341 if(query !== undefined) { 342 Foundation.stylesheet.insertRule('@media ' + 343 Foundation.media_queries[media] + '{ ' + rule + ' }'); 344 } 345 } 346 }, 347 348 loaded : function (image, callback) { 349 function loaded () { 350 callback(image[0]); 351 } 352 353 function bindLoad () { 354 this.one('load', loaded); 355 356 if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) { 357 var src = this.attr( 'src' ), 358 param = src.match( /\?/ ) ? '&' : '?'; 359 360 param += 'random=' + (new Date()).getTime(); 361 this.attr('src', src + param); 362 } 363 } 364 365 if (!image.attr('src')) { 366 loaded(); 367 return; 368 } 369 370 if (image[0].complete || image[0].readyState === 4) { 371 loaded(); 372 } else { 373 bindLoad.call(image); 374 } 375 }, 376 377 bindings : function (method, options) { 378 var self = this, 379 should_bind_events = !S(this).data(this.name + '-init'); 380 381 if (typeof method === 'string') { 382 return this[method].call(this); 383 } 384 385 if (S(this.scope).is('[data-' + this.name +']')) { 386 S(this.scope).data(this.name + '-init', $.extend({}, this.settings, (options || method), this.data_options(S(this.scope)))); 387 388 if (should_bind_events) { 389 this.events(this.scope); 390 } 391 392 } else { 393 S('[data-' + this.name + ']', this.scope).each(function () { 394 var should_bind_events = !S(this).data(self.name + '-init'); 395 396 S(this).data(self.name + '-init', $.extend({}, self.settings, (options || method), self.data_options(S(this)))); 397 398 if (should_bind_events) { 399 self.events(this); 400 } 401 }); 402 } 403 } 404 } 405 }; 406 407 $.fn.foundation = function () { 408 var args = Array.prototype.slice.call(arguments, 0); 409 410 return this.each(function () { 411 Foundation.init.apply(Foundation, [this].concat(args)); 412 return this; 413 }); 414 }; 415 416}(jQuery, this, this.document));
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.