foundation-rails 5.0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +29 -0
  6. data/Rakefile +1 -0
  7. data/app/controllers/foundation/rails/styleguide_controller.rb +10 -0
  8. data/app/views/foundation/rails/styleguide/show.html.erb +134 -0
  9. data/config/routes.rb +3 -0
  10. data/foundation-rails.gemspec +25 -0
  11. data/lib/foundation-rails.rb +1 -0
  12. data/lib/foundation/rails.rb +3 -0
  13. data/lib/foundation/rails/engine.rb +7 -0
  14. data/lib/foundation/rails/generators/install_generator.rb +56 -0
  15. data/lib/foundation/rails/templates/application.html.erb +19 -0
  16. data/lib/foundation/rails/templates/application.html.haml +18 -0
  17. data/lib/foundation/rails/templates/application.html.slim +17 -0
  18. data/lib/foundation/rails/version.rb +5 -0
  19. data/test/dummy/.gitignore +16 -0
  20. data/test/dummy/Gemfile +47 -0
  21. data/test/dummy/README.rdoc +28 -0
  22. data/test/dummy/Rakefile +6 -0
  23. data/test/dummy/app/assets/images/.keep +0 -0
  24. data/test/dummy/app/assets/javascripts/application.js +8 -0
  25. data/test/dummy/app/assets/stylesheets/application.css +4 -0
  26. data/test/dummy/app/assets/stylesheets/foundation_and_overrides.scss +4 -0
  27. data/test/dummy/app/controllers/application_controller.rb +5 -0
  28. data/test/dummy/app/controllers/concerns/.keep +0 -0
  29. data/test/dummy/app/controllers/styleguide_controller.rb +4 -0
  30. data/test/dummy/app/helpers/application_helper.rb +2 -0
  31. data/test/dummy/app/helpers/styleguide_helper.rb +2 -0
  32. data/test/dummy/app/mailers/.keep +0 -0
  33. data/test/dummy/app/models/.keep +0 -0
  34. data/test/dummy/app/models/concerns/.keep +0 -0
  35. data/test/dummy/app/views/layouts/application.html.erb +19 -0
  36. data/test/dummy/app/views/styleguide/show.html.erb +109 -0
  37. data/test/dummy/bin/bundle +3 -0
  38. data/test/dummy/bin/rails +4 -0
  39. data/test/dummy/bin/rake +4 -0
  40. data/test/dummy/config.ru +4 -0
  41. data/test/dummy/config/application.rb +23 -0
  42. data/test/dummy/config/boot.rb +4 -0
  43. data/test/dummy/config/database.yml +25 -0
  44. data/test/dummy/config/environment.rb +5 -0
  45. data/test/dummy/config/environments/development.rb +29 -0
  46. data/test/dummy/config/environments/production.rb +80 -0
  47. data/test/dummy/config/environments/test.rb +36 -0
  48. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  49. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  50. data/test/dummy/config/initializers/inflections.rb +16 -0
  51. data/test/dummy/config/initializers/mime_types.rb +5 -0
  52. data/test/dummy/config/initializers/secret_token.rb +12 -0
  53. data/test/dummy/config/initializers/session_store.rb +3 -0
  54. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  55. data/test/dummy/config/locales/en.yml +23 -0
  56. data/test/dummy/config/routes.rb +3 -0
  57. data/test/dummy/db/seeds.rb +7 -0
  58. data/test/dummy/lib/assets/.keep +0 -0
  59. data/test/dummy/lib/tasks/.keep +0 -0
  60. data/test/dummy/log/.keep +0 -0
  61. data/test/dummy/public/404.html +58 -0
  62. data/test/dummy/public/422.html +58 -0
  63. data/test/dummy/public/500.html +57 -0
  64. data/test/dummy/public/favicon.ico +0 -0
  65. data/test/dummy/public/robots.txt +5 -0
  66. data/test/dummy/test/controllers/.keep +0 -0
  67. data/test/dummy/test/controllers/styleguide_controller_test.rb +9 -0
  68. data/test/dummy/test/fixtures/.keep +0 -0
  69. data/test/dummy/test/helpers/.keep +0 -0
  70. data/test/dummy/test/helpers/styleguide_helper_test.rb +4 -0
  71. data/test/dummy/test/integration/.keep +0 -0
  72. data/test/dummy/test/mailers/.keep +0 -0
  73. data/test/dummy/test/models/.keep +0 -0
  74. data/test/dummy/test/test_helper.rb +15 -0
  75. data/test/dummy/vendor/assets/javascripts/.keep +0 -0
  76. data/test/dummy/vendor/assets/stylesheets/.keep +0 -0
  77. data/vendor/_settings.scss +992 -0
  78. data/vendor/assets/javascripts/foundation.js +15 -0
  79. data/vendor/assets/javascripts/foundation/foundation.abide.js +201 -0
  80. data/vendor/assets/javascripts/foundation/foundation.accordion.js +41 -0
  81. data/vendor/assets/javascripts/foundation/foundation.alert.js +34 -0
  82. data/vendor/assets/javascripts/foundation/foundation.clearing.js +450 -0
  83. data/vendor/assets/javascripts/foundation/foundation.dropdown.js +184 -0
  84. data/vendor/assets/javascripts/foundation/foundation.interchange.js +304 -0
  85. data/vendor/assets/javascripts/foundation/foundation.joyride.js +839 -0
  86. data/vendor/assets/javascripts/foundation/foundation.js +416 -0
  87. data/vendor/assets/javascripts/foundation/foundation.magellan.js +118 -0
  88. data/vendor/assets/javascripts/foundation/foundation.offcanvas.js +37 -0
  89. data/vendor/assets/javascripts/foundation/foundation.orbit.js +434 -0
  90. data/vendor/assets/javascripts/foundation/foundation.reveal.js +347 -0
  91. data/vendor/assets/javascripts/foundation/foundation.tab.js +37 -0
  92. data/vendor/assets/javascripts/foundation/foundation.tooltip.js +202 -0
  93. data/vendor/assets/javascripts/foundation/foundation.topbar.js +380 -0
  94. data/vendor/assets/javascripts/vendor/modernizr.js +4 -0
  95. data/vendor/assets/stylesheets/foundation.scss +38 -0
  96. data/vendor/assets/stylesheets/foundation/_functions.scss +75 -0
  97. data/vendor/assets/stylesheets/foundation/_settings.scss +992 -0
  98. data/vendor/assets/stylesheets/foundation/components/_accordion.scss +49 -0
  99. data/vendor/assets/stylesheets/foundation/components/_alert-boxes.scss +113 -0
  100. data/vendor/assets/stylesheets/foundation/components/_block-grid.scss +83 -0
  101. data/vendor/assets/stylesheets/foundation/components/_breadcrumbs.scss +123 -0
  102. data/vendor/assets/stylesheets/foundation/components/_button-groups.scss +97 -0
  103. data/vendor/assets/stylesheets/foundation/components/_buttons.scss +234 -0
  104. data/vendor/assets/stylesheets/foundation/components/_clearing.scss +233 -0
  105. data/vendor/assets/stylesheets/foundation/components/_dropdown-buttons.scss +125 -0
  106. data/vendor/assets/stylesheets/foundation/components/_dropdown.scss +159 -0
  107. data/vendor/assets/stylesheets/foundation/components/_flex-video.scss +47 -0
  108. data/vendor/assets/stylesheets/foundation/components/_forms.scss +472 -0
  109. data/vendor/assets/stylesheets/foundation/components/_functions.scss +70 -0
  110. data/vendor/assets/stylesheets/foundation/components/_global.scss +387 -0
  111. data/vendor/assets/stylesheets/foundation/components/_grid.scss +234 -0
  112. data/vendor/assets/stylesheets/foundation/components/_inline-lists.scss +52 -0
  113. data/vendor/assets/stylesheets/foundation/components/_joyride.scss +220 -0
  114. data/vendor/assets/stylesheets/foundation/components/_keystrokes.scss +57 -0
  115. data/vendor/assets/stylesheets/foundation/components/_labels.scss +100 -0
  116. data/vendor/assets/stylesheets/foundation/components/_magellan.scss +30 -0
  117. data/vendor/assets/stylesheets/foundation/components/_offcanvas.scss +360 -0
  118. data/vendor/assets/stylesheets/foundation/components/_orbit.scss +353 -0
  119. data/vendor/assets/stylesheets/foundation/components/_pagination.scss +145 -0
  120. data/vendor/assets/stylesheets/foundation/components/_panels.scss +87 -0
  121. data/vendor/assets/stylesheets/foundation/components/_pricing-tables.scss +146 -0
  122. data/vendor/assets/stylesheets/foundation/components/_progress-bars.scss +75 -0
  123. data/vendor/assets/stylesheets/foundation/components/_reveal.scss +165 -0
  124. data/vendor/assets/stylesheets/foundation/components/_side-nav.scss +83 -0
  125. data/vendor/assets/stylesheets/foundation/components/_split-buttons.scss +187 -0
  126. data/vendor/assets/stylesheets/foundation/components/_sub-nav.scss +118 -0
  127. data/vendor/assets/stylesheets/foundation/components/_switch.scss +314 -0
  128. data/vendor/assets/stylesheets/foundation/components/_tables.scss +93 -0
  129. data/vendor/assets/stylesheets/foundation/components/_tabs.scss +95 -0
  130. data/vendor/assets/stylesheets/foundation/components/_thumbs.scss +71 -0
  131. data/vendor/assets/stylesheets/foundation/components/_tooltips.scss +121 -0
  132. data/vendor/assets/stylesheets/foundation/components/_top-bar.scss +590 -0
  133. data/vendor/assets/stylesheets/foundation/components/_type.scss +447 -0
  134. data/vendor/assets/stylesheets/foundation/components/_visibility.scss +661 -0
  135. data/vendor/assets/stylesheets/normalize.scss +410 -0
  136. metadata +292 -0
@@ -0,0 +1,416 @@
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)};FastClick.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]');if(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 = "&shy;<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));
@@ -0,0 +1,118 @@
1
+ ;(function ($, window, document, undefined) {
2
+ 'use strict';
3
+
4
+ Foundation.libs.magellan = {
5
+ name : 'magellan',
6
+
7
+ version : '5.0.0',
8
+
9
+ settings : {
10
+ active_class: 'active',
11
+ threshold: 0
12
+ },
13
+
14
+ init : function (scope, method, options) {
15
+ this.fixed_magellan = $("[data-magellan-expedition]");
16
+ this.set_threshold();
17
+ this.last_destination = $('[data-magellan-destination]').last();
18
+ this.events();
19
+ },
20
+
21
+ events : function () {
22
+ var self = this;
23
+
24
+ $(this.scope)
25
+ .off('.magellan')
26
+ .on('arrival.fndtn.magellan', '[data-magellan-arrival]', function (e) {
27
+ var $destination = $(this),
28
+ $expedition = $destination.closest('[data-magellan-expedition]'),
29
+ active_class = $expedition.attr('data-magellan-active-class')
30
+ || self.settings.active_class;
31
+
32
+ $destination
33
+ .closest('[data-magellan-expedition]')
34
+ .find('[data-magellan-arrival]')
35
+ .not($destination)
36
+ .removeClass(active_class);
37
+ $destination.addClass(active_class);
38
+ });
39
+
40
+ this.fixed_magellan
41
+ .off('.magellan')
42
+ .on('update-position.fndtn.magellan', function() {
43
+ var $el = $(this);
44
+ })
45
+ .trigger('update-position');
46
+
47
+ $(window)
48
+ .off('.magellan')
49
+ .on('resize.fndtn.magellan', function() {
50
+ this.fixed_magellan.trigger('update-position');
51
+ }.bind(this))
52
+ .on('scroll.fndtn.magellan', function() {
53
+ var windowScrollTop = $(window).scrollTop();
54
+ self.fixed_magellan.each(function() {
55
+ var $expedition = $(this);
56
+ if (typeof $expedition.data('magellan-top-offset') === 'undefined') {
57
+ $expedition.data('magellan-top-offset', $expedition.offset().top);
58
+ }
59
+ if (typeof $expedition.data('magellan-fixed-position') === 'undefined') {
60
+ $expedition.data('magellan-fixed-position', false);
61
+ }
62
+ var fixed_position = (windowScrollTop + self.settings.threshold) > $expedition.data("magellan-top-offset");
63
+ var attr = $expedition.attr('data-magellan-top-offset');
64
+
65
+ if ($expedition.data("magellan-fixed-position") != fixed_position) {
66
+ $expedition.data("magellan-fixed-position", fixed_position);
67
+ if (fixed_position) {
68
+ $expedition.addClass('fixed');
69
+ $expedition.css({position:"fixed", top:0});
70
+ } else {
71
+ $expedition.removeClass('fixed');
72
+ $expedition.css({position:"", top:""});
73
+ }
74
+ if (fixed_position && typeof attr != 'undefined' && attr != false) {
75
+ $expedition.css({position:"fixed", top:attr + "px"});
76
+ }
77
+ }
78
+ });
79
+ });
80
+
81
+
82
+ if (this.last_destination.length > 0) {
83
+ $(window).on('scroll.fndtn.magellan', function (e) {
84
+ var windowScrollTop = $(window).scrollTop(),
85
+ scrolltopPlusHeight = windowScrollTop + $(window).height(),
86
+ lastDestinationTop = Math.ceil(self.last_destination.offset().top);
87
+
88
+ $('[data-magellan-destination]').each(function () {
89
+ var $destination = $(this),
90
+ destination_name = $destination.attr('data-magellan-destination'),
91
+ topOffset = $destination.offset().top - $destination.outerHeight(true) - windowScrollTop;
92
+ if (topOffset <= self.settings.threshold) {
93
+ $("[data-magellan-arrival='" + destination_name + "']").trigger('arrival');
94
+ }
95
+ // In large screens we may hit the bottom of the page and dont reach the top of the last magellan-destination, so lets force it
96
+ if (scrolltopPlusHeight >= $(self.scope).height() && lastDestinationTop > windowScrollTop && lastDestinationTop < scrolltopPlusHeight) {
97
+ $('[data-magellan-arrival]').last().trigger('arrival');
98
+ }
99
+ });
100
+ });
101
+ }
102
+ },
103
+
104
+ set_threshold : function () {
105
+ if (typeof this.settings.threshold !== 'number') {
106
+ this.settings.threshold = (this.fixed_magellan.length > 0) ?
107
+ this.fixed_magellan.outerHeight(true) : 0;
108
+ }
109
+ },
110
+
111
+ off : function () {
112
+ $(this.scope).off('.fndtn.magellan');
113
+ $(window).off('.fndtn.magellan');
114
+ },
115
+
116
+ reflow : function () {}
117
+ };
118
+ }(jQuery, this, this.document));