dta_rapid 0.3.0 → 0.3.1

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 (3) hide show
  1. checksums.yaml +4 -4
  2. data/assets/js/bundle.js +421 -0
  3. metadata +2 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e92d67d7dc83d6af078d91df24f06443e0549a42
4
- data.tar.gz: 9c3254517ca9d42065f8513724c99bd03e685f17
3
+ metadata.gz: 84b4457f2d286144bac33b8fa34a47f19604ffc7
4
+ data.tar.gz: 312cc01ea7f34ab628561281ec3c8399d0d51d61
5
5
  SHA512:
6
- metadata.gz: e3c16811eea223db73c443bb0b0d277035b844c1179e6226790277d8f42cc09b8baf8879124f6fee5df4ef7a32447e0a87417bda6a17222196f159aa822d916c
7
- data.tar.gz: 77ee895a880759d622c3075d84eb40569cc5a04bc9ac0a6abc30fd6b0470e1fd213451b15fe640c9faf0ed909e17b2039f7ed6c7bbb4b4ccaf7d74af4693088e
6
+ metadata.gz: 5a1443184f6f4473f750e8563bc3adf5e2c9c83e2d8d5f88415a62d3f195d2bb929996864d11c16e07382788c63970afd61c087c285136bd016b65223544d026
7
+ data.tar.gz: 03b09a5bd7859692c1e3437d79850aa436a634c422172b923552700b98b52eb089572a3c9835945b9dd5a4f50dd967d59e5dcefee017437a916469c01f132d18
@@ -0,0 +1,421 @@
1
+ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.technologic = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
2
+ var scrollForm = require('./scroll-form');
3
+
4
+ scrollForm.init();
5
+
6
+ module.exports = scrollForm;
7
+
8
+ },{"./scroll-form":3}],2:[function(require,module,exports){
9
+ var questions = function () {
10
+
11
+ var CONTAINER_ID = "container",
12
+ CLASS_NAME = "scroll-form__questionset",
13
+ ACTIVE_CLASS = "scroll-form__questionset--active";
14
+
15
+ return {
16
+ getContainer: function () { return document.getElementById(CONTAINER_ID); },
17
+ getQuestion: function (index) {
18
+ return document.getElementsByClassName(CLASS_NAME)[index];
19
+ },
20
+ setActiveQuestion: function(index) {
21
+ var questionList = [].slice.call(document.getElementsByClassName(CLASS_NAME));
22
+
23
+ questionList.forEach(function(elm) {
24
+ elm.classList.remove(ACTIVE_CLASS);
25
+ });
26
+
27
+ this.getQuestion(index).classList.add(ACTIVE_CLASS);
28
+ }
29
+ };
30
+
31
+ };
32
+
33
+ module.exports = questions();
34
+
35
+ },{}],3:[function(require,module,exports){
36
+ var scrolling = require('./scrolling');
37
+ var questions = require('./questions');
38
+
39
+ var scrollForm = function () {
40
+
41
+ // TODO index() = function () {}
42
+ // TODO: Can haz ES6?
43
+
44
+ var scroller,
45
+ currentPosition = 0,
46
+ speed = 400;
47
+
48
+ var init = function () {
49
+ var container = questions.getContainer();
50
+ var firstQuestion = questions.getQuestion(0);
51
+
52
+ scroller = scrolling.createScroller(container, 0, 0)
53
+
54
+ scrolling.scrollTo(scroller, firstQuestion, speed, function() {
55
+ questions.setActiveQuestion(0);
56
+ });
57
+ };
58
+
59
+ var next = function () {
60
+ var nextPosition = currentPosition + 1;
61
+ var newTarget = questions.getQuestion(nextPosition);
62
+
63
+ if (newTarget) {
64
+ scrolling.scrollTo(scroller, newTarget, speed, function() {
65
+ questions.setActiveQuestion(nextPosition);
66
+ });
67
+
68
+ currentPosition += 1;
69
+ }
70
+ };
71
+
72
+ var prev = function () {
73
+ var prevPosition = currentPosition - 1;
74
+ var newTarget = questions.getQuestion(prevPosition);
75
+
76
+ if (newTarget) {
77
+ scrolling.scrollTo(scroller, newTarget, speed, function() {
78
+ questions.setActiveQuestion(prevPosition);
79
+ });
80
+
81
+ currentPosition -= 1;
82
+ }
83
+ };
84
+
85
+ return {
86
+ init: init,
87
+ next: next,
88
+ prev: prev
89
+ };
90
+
91
+ };
92
+
93
+ module.exports = scrollForm();
94
+
95
+ },{"./questions":2,"./scrolling":4}],4:[function(require,module,exports){
96
+ var zenscroll = require('zenscroll');
97
+
98
+ var scrolling = function () {
99
+
100
+ var createScroller = function (container, speed, offset) {
101
+ return zenscroll.createScroller(container, speed, offset);
102
+ }
103
+
104
+ var scrollTo = function(scroller, element, speed, callback) {
105
+ scroller.center(element, speed, 0, callback)
106
+ };
107
+
108
+ return {
109
+ scrollTo: scrollTo,
110
+ createScroller: createScroller
111
+ };
112
+
113
+ };
114
+
115
+ module.exports = scrolling();
116
+
117
+ },{"zenscroll":5}],5:[function(require,module,exports){
118
+ /**
119
+ * Zenscroll 3.3.0
120
+ * https://github.com/zengabor/zenscroll/
121
+ *
122
+ * Copyright 2015–2016 Gabor Lenard
123
+ *
124
+ * This is free and unencumbered software released into the public domain.
125
+ *
126
+ * Anyone is free to copy, modify, publish, use, compile, sell, or
127
+ * distribute this software, either in source code form or as a compiled
128
+ * binary, for any purpose, commercial or non-commercial, and by any
129
+ * means.
130
+ *
131
+ * In jurisdictions that recognize copyright laws, the author or authors
132
+ * of this software dedicate any and all copyright interest in the
133
+ * software to the public domain. We make this dedication for the benefit
134
+ * of the public at large and to the detriment of our heirs and
135
+ * successors. We intend this dedication to be an overt act of
136
+ * relinquishment in perpetuity of all present and future rights to this
137
+ * software under copyright law.
138
+ *
139
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
140
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
141
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
142
+ * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
143
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
144
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
145
+ * OTHER DEALINGS IN THE SOFTWARE.
146
+ *
147
+ * For more information, please refer to <http://unlicense.org>
148
+ *
149
+ */
150
+
151
+ /*jshint devel:true, asi:true */
152
+
153
+ /*global define, module */
154
+
155
+
156
+ (function (root, factory) {
157
+ if (typeof define === "function" && define.amd) {
158
+ define([], factory())
159
+ } else if (typeof module === "object" && module.exports) {
160
+ module.exports = factory()
161
+ } else {
162
+ root.zenscroll = factory()
163
+ }
164
+ }(this, function () {
165
+ "use strict"
166
+
167
+ // Detect if the browser already supports native smooth scrolling (e.g., Firefox 36+ and Chrome 49+) and it is enabled:
168
+ var isNativeSmoothScrollEnabledOn = function (elem) {
169
+ return ("getComputedStyle" in window) &&
170
+ window.getComputedStyle(elem)["scroll-behavior"] === "smooth"
171
+ }
172
+
173
+ // Exit if it’s not a browser environment:
174
+ if (typeof window === "undefined" || !("document" in window)) {
175
+ return {}
176
+ }
177
+
178
+ var createScroller = function (scrollContainer, defaultDuration, edgeOffset) {
179
+
180
+ defaultDuration = defaultDuration || 999 //ms
181
+ if (!edgeOffset && edgeOffset !== 0) {
182
+ // When scrolling, this amount of distance is kept from the edges of the scrollContainer:
183
+ edgeOffset = 9 //px
184
+ }
185
+
186
+ var scrollTimeoutId
187
+ var setScrollTimeoutId = function (newValue) {
188
+ scrollTimeoutId = newValue
189
+ }
190
+ var docElem = document.documentElement
191
+
192
+ var getScrollTop = function () {
193
+ if (scrollContainer) {
194
+ return scrollContainer.scrollTop
195
+ } else {
196
+ return window.scrollY || docElem.scrollTop
197
+ }
198
+ }
199
+
200
+ var getViewHeight = function () {
201
+ if (scrollContainer) {
202
+ return Math.min(scrollContainer.offsetHeight, window.innerHeight)
203
+ } else {
204
+ return window.innerHeight || docElem.clientHeight
205
+ }
206
+ }
207
+
208
+ var getRelativeTopOf = function (elem) {
209
+ if (scrollContainer) {
210
+ return elem.offsetTop
211
+ } else {
212
+ return elem.getBoundingClientRect().top + getScrollTop() - docElem.offsetTop
213
+ }
214
+ }
215
+
216
+ /**
217
+ * Immediately stops the current smooth scroll operation
218
+ */
219
+ var stopScroll = function () {
220
+ clearTimeout(scrollTimeoutId)
221
+ setScrollTimeoutId(0)
222
+ }
223
+
224
+ /**
225
+ * Scrolls to a specific vertical position in the document.
226
+ *
227
+ * @param {endY} The vertical position within the document.
228
+ * @param {duration} Optionally the duration of the scroll operation.
229
+ * If 0 or not provided it is automatically calculated based on the
230
+ * distance and the default duration.
231
+ * @param {onDone} Callback function to be invoken once the scroll finishes.
232
+ */
233
+ var scrollToY = function (endY, duration, onDone) {
234
+ stopScroll()
235
+ if (isNativeSmoothScrollEnabledOn(scrollContainer ? scrollContainer : document.body)) {
236
+ (scrollContainer || window).scrollTo(0, endY)
237
+ if (onDone) {
238
+ onDone()
239
+ }
240
+ } else {
241
+ var startY = getScrollTop()
242
+ var distance = Math.max(endY,0) - startY
243
+ duration = duration || Math.min(Math.abs(distance), defaultDuration)
244
+ var startTime = new Date().getTime();
245
+ (function loopScroll() {
246
+ setScrollTimeoutId(setTimeout(function () {
247
+ var p = Math.min((new Date().getTime() - startTime) / duration, 1) // percentage
248
+ var y = Math.max(Math.floor(startY + distance*(p < 0.5 ? 2*p*p : p*(4 - p*2)-1)), 0)
249
+ if (scrollContainer) {
250
+ scrollContainer.scrollTop = y
251
+ } else {
252
+ window.scrollTo(0, y)
253
+ }
254
+ if (p < 1 && (getViewHeight() + y) < (scrollContainer || docElem).scrollHeight) {
255
+ loopScroll()
256
+ } else {
257
+ setTimeout(stopScroll, 99) // with cooldown time
258
+ if (onDone) {
259
+ onDone()
260
+ }
261
+ }
262
+ }, 9))
263
+ })()
264
+ }
265
+ }
266
+
267
+ /**
268
+ * Scrolls to the top of a specific element.
269
+ *
270
+ * @param {elem} The element.
271
+ * @param {duration} Optionally the duration of the scroll operation.
272
+ * A value of 0 is ignored.
273
+ * @param {onDone} Callback function to be invoken once the scroll finishes.
274
+ * @returns {endY} The new vertical scoll position that will be valid once the scroll finishes.
275
+ */
276
+ var scrollToElem = function (elem, duration, onDone) {
277
+ var endY = getRelativeTopOf(elem) - edgeOffset
278
+ scrollToY(endY, duration, onDone)
279
+ return endY
280
+ }
281
+
282
+ /**
283
+ * Scrolls an element into view if necessary.
284
+ *
285
+ * @param {elem} The element.
286
+ * @param {duration} Optionally the duration of the scroll operation.
287
+ * A value of 0 is ignored.
288
+ * @param {onDone} Callback function to be invoken once the scroll finishes.
289
+ */
290
+ var scrollIntoView = function (elem, duration, onDone) {
291
+ var elemHeight = elem.getBoundingClientRect().height
292
+ var elemTop = getRelativeTopOf(elem)
293
+ var elemBottom = elemTop + elemHeight
294
+ var containerHeight = getViewHeight()
295
+ var containerTop = getScrollTop()
296
+ var containerBottom = containerTop + containerHeight
297
+ if ((elemTop - edgeOffset) < containerTop || (elemHeight + edgeOffset) > containerHeight) {
298
+ // Element is clipped at top or is higher than screen.
299
+ scrollToElem(elem, duration, onDone)
300
+ } else if ((elemBottom + edgeOffset) > containerBottom) {
301
+ // Element is clipped at the bottom.
302
+ scrollToY(elemBottom - containerHeight + edgeOffset, duration, onDone)
303
+ } else if (onDone) {
304
+ onDone()
305
+ }
306
+ }
307
+
308
+ /**
309
+ * Scrolls to the center of an element.
310
+ *
311
+ * @param {elem} The element.
312
+ * @param {duration} Optionally the duration of the scroll operation.
313
+ * @param {offset} Optionally the offset of the top of the element from the center of the screen.
314
+ * A value of 0 is ignored.
315
+ * @param {onDone} Callback function to be invoken once the scroll finishes.
316
+ */
317
+ var scrollToCenterOf = function (elem, duration, offset, onDone) {
318
+ scrollToY(
319
+ Math.max(
320
+ getRelativeTopOf(elem) - getViewHeight()/2 + (offset || elem.getBoundingClientRect().height/2),
321
+ 0
322
+ ),
323
+ duration,
324
+ onDone
325
+ )
326
+ }
327
+
328
+ /**
329
+ * Changes default settings for this scroller.
330
+ *
331
+ * @param {newDefaultDuration} New value for default duration, used for each scroll method by default.
332
+ * Ignored if 0 or falsy.
333
+ * @param {newEdgeOffset} New value for the edge offset, used by each scroll method by default.
334
+ */
335
+ var setup = function (newDefaultDuration, newEdgeOffset) {
336
+ if (newDefaultDuration) {
337
+ defaultDuration = newDefaultDuration
338
+ }
339
+ if (newEdgeOffset === 0 || newEdgeOffset) {
340
+ edgeOffset = newEdgeOffset
341
+ }
342
+ }
343
+
344
+ return {
345
+ setup: setup,
346
+ to: scrollToElem,
347
+ toY: scrollToY,
348
+ intoView: scrollIntoView,
349
+ center: scrollToCenterOf,
350
+ stop: stopScroll,
351
+ moving: function () { return !!scrollTimeoutId },
352
+ getY: getScrollTop
353
+ }
354
+
355
+ }
356
+
357
+ // Create a scroller for the browser window, omitting parameters:
358
+ var defaultScroller = createScroller()
359
+
360
+ // Create listeners for the documentElement only & exclude IE8-
361
+ if ("addEventListener" in window && !(isNativeSmoothScrollEnabledOn(document.body) || window.noZensmooth)) {
362
+ if ("scrollRestoration" in history) {
363
+ history.scrollRestoration = "manual"
364
+ window.addEventListener("popstate", function (event) {
365
+ if (event.state && "scrollY" in event.state) {
366
+ defaultScroller.toY(event.state.scrollY)
367
+ }
368
+ }, false)
369
+ }
370
+ var replaceUrl = function (hash, newY) {
371
+ try {
372
+ history.replaceState({scrollY:defaultScroller.getY()}, "") // remember the scroll position before scrolling
373
+ history.pushState({scrollY:newY}, "", window.location.href.split("#")[0] + hash) // remember the new scroll position (which will be after scrolling)
374
+ } catch (e) {
375
+ // To avoid the Security exception in Chrome when the page was opened via the file protocol, e.g., file://index.html
376
+ }
377
+ }
378
+ window.addEventListener("click", function (event) {
379
+ var anchor = event.target
380
+ while (anchor && anchor.tagName !== "A") {
381
+ anchor = anchor.parentNode
382
+ }
383
+ // Only handle links that were clicked with the primary button, without modifier keys:
384
+ if (!anchor || event.which !== 1 || event.shiftKey || event.metaKey || event.ctrlKey || event.altKey) {
385
+ return
386
+ }
387
+ var href = anchor.getAttribute("href") || ""
388
+ if (href.indexOf("#") === 0) {
389
+ if (href === "#") {
390
+ event.preventDefault()
391
+ defaultScroller.toY(0)
392
+ replaceUrl("", 0)
393
+ } else {
394
+ var targetId = anchor.hash.substring(1)
395
+ var targetElem = document.getElementById(targetId)
396
+ if (targetElem) {
397
+ event.preventDefault()
398
+ replaceUrl("#" + targetId, defaultScroller.to(targetElem))
399
+ }
400
+ }
401
+ }
402
+ }, false)
403
+ }
404
+
405
+ return {
406
+ // Expose the "constructor" that can create a new scroller:
407
+ createScroller: createScroller,
408
+ // Surface the methods of the default scroller:
409
+ setup: defaultScroller.setup,
410
+ to: defaultScroller.to,
411
+ toY: defaultScroller.toY,
412
+ intoView: defaultScroller.intoView,
413
+ center: defaultScroller.center,
414
+ stop: defaultScroller.stop,
415
+ moving: defaultScroller.moving
416
+ }
417
+
418
+ }));
419
+
420
+ },{}]},{},[1])(1)
421
+ });
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dta_rapid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gareth Rogers
@@ -205,6 +205,7 @@ files:
205
205
  - _sass/vendor/neat/settings/_disable-warnings.scss
206
206
  - _sass/vendor/neat/settings/_grid.scss
207
207
  - _sass/vendor/neat/settings/_visual-grid.scss
208
+ - assets/js/bundle.js
208
209
  - assets/js/main.js
209
210
  - assets/js/questions.js
210
211
  - assets/js/scroll-form.js