middleman-wizard-template 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (22) hide show
  1. checksums.yaml +4 -4
  2. data/lib/middleman-wizard-template/template.rb +14 -0
  3. data/lib/middleman-wizard-template/template/bowerjson.tt +7 -0
  4. data/lib/middleman-wizard-template/template/bowerrc.tt +3 -0
  5. data/lib/middleman-wizard-template/template/config.tt +5 -0
  6. data/lib/middleman-wizard-template/template/source/javascripts/site.js +4 -4
  7. data/lib/middleman-wizard-template/version.rb +1 -1
  8. metadata +4 -16
  9. data/lib/middleman-wizard-template/template/source/javascripts/_lib/ww/Matrix.js +0 -449
  10. data/lib/middleman-wizard-template/template/source/javascripts/_lib/ww/PxLoader/PxLoader.js +0 -395
  11. data/lib/middleman-wizard-template/template/source/javascripts/_lib/ww/PxLoader/PxLoaderImage.js +0 -96
  12. data/lib/middleman-wizard-template/template/source/javascripts/_lib/ww/PxLoader/PxLoaderSwiffy.js +0 -68
  13. data/lib/middleman-wizard-template/template/source/javascripts/_lib/ww/RouteRecognizer.js +0 -506
  14. data/lib/middleman-wizard-template/template/source/javascripts/_lib/ww/Slides.js +0 -846
  15. data/lib/middleman-wizard-template/template/source/javascripts/_lib/ww/Transform.js +0 -312
  16. data/lib/middleman-wizard-template/template/source/javascripts/_lib/ww/Tween.js +0 -719
  17. data/lib/middleman-wizard-template/template/source/javascripts/_lib/ww/base.js +0 -8
  18. data/lib/middleman-wizard-template/template/source/javascripts/_lib/ww/raf.js +0 -131
  19. data/lib/middleman-wizard-template/template/source/javascripts/_lib/ww/statemachine.js +0 -1024
  20. data/lib/middleman-wizard-template/template/source/javascripts/_lib/ww/useragent.js +0 -1244
  21. data/lib/middleman-wizard-template/template/source/javascripts/_lib/ww/util.js +0 -282
  22. data/lib/middleman-wizard-template/template/source/javascripts/_lib/ww/viewport.js +0 -89
@@ -1,282 +0,0 @@
1
- goog.provide('ww.util');
2
-
3
- /**
4
- * Pre-calculated PI to 180 ratio.
5
- * @type {Float}
6
- */
7
- ww.util.piDiv180 = Math.PI / 180;
8
-
9
- /**
10
- * Convert degrees to radians.
11
- * @param {Number} num Number of degrees.
12
- * @return {Float} Degrees in radians.
13
- */
14
- ww.util.toRad = function toRad(num) {
15
- return num * ww.util.piDiv180;
16
- };
17
-
18
- /**
19
- * Search the global namespace for a path.
20
- * @param {String} path Full path to search for.
21
- * @param {Object} root The current root object.
22
- * @return {Object} Resulting object.
23
- */
24
- ww.util.traversePath = function traversePath(path, root) {
25
- root = root || window;
26
-
27
- if (!goog.isArray(path) && goog.isObject(path)) { return path; }
28
-
29
- if (goog.isString(path)) {
30
- path = path.split('.');
31
- }
32
-
33
- if (path.length === 1) {
34
- return root[path];
35
- } else {
36
- var loc = path.shift();
37
- return ww.util.traversePath(path, root[loc]);
38
- }
39
- };
40
-
41
- /**
42
- * Add an event listener which works for mouse and touch events.
43
- * @param {Element} element The element to watch.
44
- * @param {Function} callback The method to run on event.
45
- * @param {Boolean} cancelEvents Whether to preventDefault();.
46
- * @return {Number} Param for unlistenByKey.
47
- */
48
- ww.util.onClickish = function onClickish(element, callback, cancelEvents) {
49
- var startEvent, endEvent;
50
-
51
- if (Modernizr['touch']) {
52
- startEvent = goog.events.EventType.TOUCHSTART;
53
- endEvent = goog.events.EventType.TOUCHEND;
54
- } else {
55
- startEvent = goog.events.EventType.MOUSEDOWN;
56
- endEvent = goog.events.EventType.MOUSEUP;
57
- }
58
-
59
- if (cancelEvents) {
60
- goog.events.listen(element, 'click', function(e) { e.preventDefault(); });
61
- }
62
-
63
- return goog.events.listen(
64
- element,
65
- startEvent,
66
- function(e) {
67
- if (!Modernizr['touch'] &&
68
- (e.button !== goog.events.BrowserEvent.MouseButton.LEFT)) {
69
- return;
70
- }
71
-
72
- var listenKey = goog.events.listen(
73
- element,
74
- endEvent,
75
- function clicked(e2) {
76
- goog.events.unlistenByKey(listenKey);
77
- callback(e2, element);
78
- },
79
- true
80
- );
81
-
82
- goog.events.listenOnce(
83
- document,
84
- endEvent,
85
- function() {
86
- goog.events.unlistenByKey(listenKey);
87
- },
88
- false
89
- );
90
- },
91
- true
92
- );
93
- };
94
-
95
- /**
96
- * Dynamic JS loader.
97
- * @param {String} url URL to load.
98
- * @param {Function} callback Function to call on complete.
99
- */
100
- ww.util.loadScript = function(url, callback) {console.log('in loadScript');
101
- var script = document.createElement('script');
102
- script.type = 'text/javascript';
103
-
104
- if (script.readyState) { //IE
105
- script.onreadystatechange = function() {
106
- if (script.readyState == 'loaded' || script.readyState == 'complete') {
107
- script.onreadystatechange = null;
108
- callback();
109
- }
110
- };
111
- } else { //Others
112
- script.onload = function() {
113
- callback();
114
- };
115
- }
116
-
117
- script.src = url;
118
- document.getElementsByTagName('head')[0].appendChild(script);
119
- };
120
-
121
- /**
122
- * Get the current time, depending on the browser's level of support.
123
- * @return {Number} The current time stamp.
124
- */
125
- ww.util.rightNow = function() {
126
- if (window['performance'] && window['performance']['now']) {
127
- return window['performance']['now']();
128
- } else {
129
- return +(new Date());
130
- }
131
- };
132
-
133
- /**
134
- * Point events for binding.
135
- * @param {String} evt Type of event.
136
- * @param {String} name Namespace of event.
137
- * @return {String} The resulting events.
138
- */
139
- ww.util.getPointerEventNames = function(evt, name) {
140
- var evts = [],
141
- touchEvt,
142
- mouseEvt,
143
- msEvent;
144
-
145
- if (evt === 'up') {
146
- touchEvt = 'touchend';
147
- mouseEvt = 'mouseup';
148
- msEvent = 'MSPointerUp';
149
- } else if (evt === 'move') {
150
- touchEvt = 'touchmove';
151
- mouseEvt = 'mousemove';
152
- msEvent = 'MSPointerMove';
153
- } else if (evt === 'down') {
154
- touchEvt = 'touchstart';
155
- mouseEvt = 'mousedown';
156
- msEvent = 'MSPointerDown';
157
- }
158
-
159
- var isWindows = navigator.userAgent.match(/(Windows)/i) ? true : false;
160
- var isIETouch = navigator.userAgent.match(/(Touch)/i) ? true : false;
161
-
162
- // var iOS = navigator.userAgent.match(/(iPad|iPhone|iPod)/i) ? true : false;
163
- // var android = navigator.userAgent.match(/Android/) ? true : false;
164
-
165
- if (isWindows) {
166
- if (Modernizr.touch || isIETouch) {
167
- evts.push(touchEvt + '.' + name);
168
- }
169
-
170
- evts.push(mouseEvt + '.' + name);
171
- } else {
172
- if (Modernizr.touch) {
173
- evts.push(touchEvt + '.' + name);
174
- } else {
175
- evts.push(mouseEvt + '.' + name);
176
- }
177
- }
178
-
179
- return evts.join(' ');
180
- };
181
-
182
- /**
183
- * Send an event to Google Analytics
184
- * @param {String} category Category of the action.
185
- * @param {String} action Name of the action.
186
- * @param {Object} value Value of the action.
187
- */
188
- ww.util.trackEvent = function(category, action, value) {
189
- if ('undefined' !== typeof ga) {
190
- ga('send', 'event', category, action, null, value);
191
- }
192
- };
193
-
194
- /**
195
- * Throttling function will limit callbacks to once every wait window.
196
- * @param {Function} func Function to throttle.
197
- * @param {Number} wait Wait window.
198
- * @return {Function} Throttled function.
199
- */
200
- ww.util.throttle = function(func, wait) {
201
- var context, args, timeout, result;
202
- var previous = 0;
203
- var later = function() {
204
- previous = ww.util.rightNow();
205
- timeout = null;
206
- result = func.apply(context, args);
207
- };
208
- return function() {
209
- var now = ww.util.rightNow();
210
- var remaining = wait - (now - previous);
211
- context = this;
212
- args = arguments;
213
- if (remaining <= 0) {
214
- clearTimeout(timeout);
215
- timeout = null;
216
- previous = now;
217
- result = func.apply(context, args);
218
- } else if (!timeout) {
219
- timeout = setTimeout(later, remaining);
220
- }
221
- return result;
222
- };
223
- };
224
-
225
- /**
226
- * Returns a function, that, as long as it continues to be invoked, will not
227
- * be triggered. The function will be called after it stops being called for
228
- * N milliseconds. If `immediate` is passed, trigger the function on the
229
- * leading edge, instead of the trailing.
230
- *
231
- * @param {Function} func Function to throttle.
232
- * @param {Number} wait Wait window.
233
- * @param {Boolean} immediate Whether to run immediately.
234
- * @return {Function} Debounced function.
235
- */
236
- ww.util.debounce = function(func, wait, immediate) {
237
- var result;
238
- var timeout = null;
239
- return function() {
240
- var context = this, args = arguments;
241
- var later = function() {
242
- timeout = null;
243
- if (!immediate) result = func.apply(context, args);
244
- };
245
- var callNow = immediate && !timeout;
246
- clearTimeout(timeout);
247
- timeout = setTimeout(later, wait);
248
- if (callNow) result = func.apply(context, args);
249
- return result;
250
- };
251
- }
252
-
253
- /**
254
- * Add a 'hoverable' body class when :hover events should
255
- * be attached (eg not scrolling or on touch device).
256
- * @private
257
- * @param String clsName Name of the class to apply. Default: hoverable
258
- */
259
- ww.util.applyBodyClassWhenNotScrolling = function(clsName) {
260
- // FIXME: How to handle devices with both?
261
- if (Modernizr.touch) { return; }
262
-
263
- clsName = clsName || 'hoverable';
264
-
265
- goog.dom.classes.add(document.body, clsName);
266
-
267
- var isScrolling = false;
268
-
269
- var debouncedOnScroll = ww.util.debounce(function() {
270
- isScrolling = false;
271
- goog.dom.classes.add(document.body, clsName);
272
- }, 200);
273
-
274
- goog.events.listen(window, 'scroll', function() {
275
- if (!isScrolling) {
276
- isScrolling = true;
277
- goog.dom.classes.remove(document.body, clsName);
278
- }
279
-
280
- debouncedOnScroll();
281
- });
282
- };
@@ -1,89 +0,0 @@
1
- goog.provide('ww.viewport');
2
- goog.require('goog.async.Throttle');
3
- goog.require('goog.events');
4
-
5
- /**
6
- * List of callbacks that care about windows resizes.
7
- * @type {Array}
8
- * @private
9
- */
10
- ww.viewport.watchers_ = [];
11
-
12
- /**
13
- * @private
14
- */
15
- ww.viewport.recalc_ = function recalc_() {
16
- var phoneMQ = 'only screen and (max-device-width: 767px)';
17
- ww.viewport.isPhone = Modernizr['mq'](phoneMQ);
18
-
19
- var tabMQ = 'only screen and (max-width: 1024px) ';
20
- ww.viewport.isTablet = !ww.viewport.isPhone && Modernizr['mq'](tabMQ);
21
-
22
- ww.viewport.isDesktop = !ww.viewport.isPhone && !ww.viewport.isTablet;
23
-
24
- var portraitMQ = 'only screen and (orientation: portrait)';
25
- ww.viewport.isPortrait = Modernizr['mq'](portraitMQ);
26
-
27
- ww.viewport.isLandscape = !ww.viewport.isPortrait;
28
-
29
- var removeBodyClasses = [
30
- 'tablet',
31
- 'phone',
32
- 'desktop',
33
- 'portrait',
34
- 'landscape'
35
- ];
36
- var addBodyClasses = [];
37
- if (ww.viewport.isPhone) { addBodyClasses.push('phone'); }
38
- if (ww.viewport.isTablet) { addBodyClasses.push('tablet'); }
39
- if (ww.viewport.isDesktop) { addBodyClasses.push('desktop'); }
40
- if (ww.viewport.isPortrait) { addBodyClasses.push('portrait'); }
41
- if (ww.viewport.isLandscape) { addBodyClasses.push('landscape'); }
42
-
43
- goog.dom.classes.addRemove(document.body, removeBodyClasses, addBodyClasses);
44
-
45
- for (var i = 0; i < ww.viewport.watchers_.length; i++) {
46
- ww.viewport.watchers_[i]();
47
- }
48
- };
49
-
50
- /**
51
- * Watch the resize event.
52
- * @param {Function} cb Callback.
53
- * @param {Number} debounce Ms to throttle events.
54
- */
55
- ww.viewport.watchResize = function watchResize(cb, debounce) {
56
- if (goog.isFunction(cb)) {
57
- ww.viewport.addWatcher(cb);
58
- }
59
-
60
- var throttled = new goog.async.Throttle(
61
- ww.viewport.recalc_,
62
- ('undefined' !== typeof debounce) ? debounce : 50
63
- );
64
-
65
- goog.events.listen(
66
- window,
67
- goog.events.EventType.RESIZE,
68
- function() { throttled.fire(); },
69
- false
70
- );
71
-
72
- // Mobile rotate
73
- goog.events.listen(
74
- window,
75
- 'orientationchange',
76
- ww.viewport.recalc_,
77
- false
78
- );
79
-
80
- throttled.fire();
81
- };
82
-
83
- /**
84
- * Watch the resize event.
85
- * @param {Function} cb Callback.
86
- */
87
- ww.viewport.addWatcher = function addWatcher(cb) {
88
- ww.viewport.watchers_.push(cb);
89
- };