woyo-server 0.0.1 → 0.0.2

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 (48) hide show
  1. checksums.yaml +4 -4
  2. data/lib/woyo/runner.rb +49 -13
  3. data/lib/woyo/server/server.rb +4 -2
  4. data/lib/woyo/server/version.rb +1 -1
  5. data/public/server/default.html +42 -0
  6. data/public/server/foundation-5.2.2/css/foundation.css +5263 -0
  7. data/public/server/foundation-5.2.2/css/foundation.min.css +1 -0
  8. data/public/server/foundation-5.2.2/css/normalize.css +423 -0
  9. data/public/server/foundation-5.2.2/humans.txt +8 -0
  10. data/public/server/foundation-5.2.2/img/.gitkeep +1 -0
  11. data/public/server/foundation-5.2.2/index.html +166 -0
  12. data/public/server/foundation-5.2.2/js/foundation/foundation.abide.js +299 -0
  13. data/public/server/foundation-5.2.2/js/foundation/foundation.accordion.js +54 -0
  14. data/public/server/foundation-5.2.2/js/foundation/foundation.alert.js +43 -0
  15. data/public/server/foundation-5.2.2/js/foundation/foundation.clearing.js +531 -0
  16. data/public/server/foundation-5.2.2/js/foundation/foundation.dropdown.js +306 -0
  17. data/public/server/foundation-5.2.2/js/foundation/foundation.equalizer.js +68 -0
  18. data/public/server/foundation-5.2.2/js/foundation/foundation.interchange.js +331 -0
  19. data/public/server/foundation-5.2.2/js/foundation/foundation.joyride.js +849 -0
  20. data/public/server/foundation-5.2.2/js/foundation/foundation.js +609 -0
  21. data/public/server/foundation-5.2.2/js/foundation/foundation.magellan.js +173 -0
  22. data/public/server/foundation-5.2.2/js/foundation/foundation.offcanvas.js +50 -0
  23. data/public/server/foundation-5.2.2/js/foundation/foundation.orbit.js +606 -0
  24. data/public/server/foundation-5.2.2/js/foundation/foundation.reveal.js +427 -0
  25. data/public/server/foundation-5.2.2/js/foundation/foundation.slider.js +200 -0
  26. data/public/server/foundation-5.2.2/js/foundation/foundation.tab.js +168 -0
  27. data/public/server/foundation-5.2.2/js/foundation/foundation.tooltip.js +272 -0
  28. data/public/server/foundation-5.2.2/js/foundation/foundation.topbar.js +422 -0
  29. data/public/server/foundation-5.2.2/js/foundation.min.js +10 -0
  30. data/public/server/foundation-5.2.2/js/vendor/fastclick.js +9 -0
  31. data/public/server/foundation-5.2.2/js/vendor/jquery.cookie.js +8 -0
  32. data/public/server/foundation-5.2.2/js/vendor/jquery.js +26 -0
  33. data/public/server/foundation-5.2.2/js/vendor/modernizr.js +8 -0
  34. data/public/server/foundation-5.2.2/js/vendor/placeholder.js +2 -0
  35. data/public/server/foundation-5.2.2/robots.txt +4 -0
  36. data/public/server/jquery-2.1.1/jquery.js +9190 -0
  37. data/public/server/jquery-2.1.1/jquery.min.js +4 -0
  38. data/public/server/jquery-2.1.1/jquery.min.map +1 -0
  39. data/spec/spec_helper.rb +1 -0
  40. data/spec/woyo/server/1_server_spec.rb +30 -6
  41. data/spec/woyo/server/runner_spec.rb +153 -23
  42. data/views/server/layout.haml +17 -0
  43. data/views/{location.haml → server/location.haml} +0 -0
  44. data/woyo-server.gemspec +1 -1
  45. metadata +42 -10
  46. data/public/default.html +0 -15
  47. data/views/layout.haml +0 -6
  48. data/world/default.rb +0 -76
@@ -0,0 +1,168 @@
1
+ /*jslint unparam: true, browser: true, indent: 2 */
2
+ ;(function ($, window, document, undefined) {
3
+ 'use strict';
4
+
5
+ Foundation.libs.tab = {
6
+ name : 'tab',
7
+
8
+ version : '5.2.2',
9
+
10
+ settings : {
11
+ active_class: 'active',
12
+ callback : function () {},
13
+ deep_linking: false,
14
+ scroll_to_content: true,
15
+ is_hover: false
16
+ },
17
+
18
+ default_tab_hashes: [],
19
+
20
+ init : function (scope, method, options) {
21
+ var self = this,
22
+ S = this.S;
23
+
24
+ this.bindings(method, options);
25
+ this.handle_location_hash_change();
26
+
27
+ // Store the default active tabs which will be referenced when the
28
+ // location hash is absent, as in the case of navigating the tabs and
29
+ // returning to the first viewing via the browser Back button.
30
+ S('[' + this.attr_name() + '] > dd.active > a', this.scope).each(function () {
31
+ self.default_tab_hashes.push(this.hash);
32
+ });
33
+ },
34
+
35
+ events : function () {
36
+ var self = this,
37
+ S = this.S;
38
+
39
+ S(this.scope)
40
+ .off('.tab')
41
+ // Click event: tab title
42
+ .on('click.fndtn.tab', '[' + this.attr_name() + '] > dd > a', function (e) {
43
+ var settings = S(this).closest('[' + self.attr_name() +']').data(self.attr_name(true) + '-init');
44
+ if (!settings.is_hover || Modernizr.touch) {
45
+ e.preventDefault();
46
+ e.stopPropagation();
47
+ self.toggle_active_tab(S(this).parent());
48
+ }
49
+ })
50
+ // Hover event: tab title
51
+ .on('mouseenter.fndtn.tab', '[' + this.attr_name() + '] > dd > a', function (e) {
52
+ var settings = S(this).closest('[' + self.attr_name() +']').data(self.attr_name(true) + '-init');
53
+ if (settings.is_hover) self.toggle_active_tab(S(this).parent());
54
+ });
55
+
56
+ // Location hash change event
57
+ S(window).on('hashchange.fndtn.tab', function (e) {
58
+ e.preventDefault();
59
+ self.handle_location_hash_change();
60
+ });
61
+ },
62
+
63
+ handle_location_hash_change : function () {
64
+ var self = this,
65
+ S = this.S;
66
+
67
+ S('[' + this.attr_name() + ']', this.scope).each(function () {
68
+ var settings = S(this).data(self.attr_name(true) + '-init');
69
+ if (settings.deep_linking) {
70
+ // Match the location hash to a label
71
+ var hash = self.scope.location.hash;
72
+ if (hash != '') {
73
+ // Check whether the location hash references a tab content div or
74
+ // another element on the page (inside or outside the tab content div)
75
+ var hash_element = S(hash);
76
+ if (hash_element.hasClass('content') && hash_element.parent().hasClass('tab-content')) {
77
+ // Tab content div
78
+ self.toggle_active_tab($('[' + self.attr_name() + '] > dd > a[href=' + hash + ']').parent());
79
+ } else {
80
+ // Not the tab content div. If inside the tab content, find the
81
+ // containing tab and toggle it as active.
82
+ var hash_tab_container_id = hash_element.closest('.content').attr('id');
83
+ if (hash_tab_container_id != undefined) {
84
+ self.toggle_active_tab($('[' + self.attr_name() + '] > dd > a[href=#' + hash_tab_container_id + ']').parent(), hash);
85
+ }
86
+ }
87
+ } else {
88
+ // Reference the default tab hashes which were initialized in the init function
89
+ for (var ind in self.default_tab_hashes) {
90
+ self.toggle_active_tab($('[' + self.attr_name() + '] > dd > a[href=' + self.default_tab_hashes[ind] + ']').parent());
91
+ }
92
+ }
93
+ }
94
+ });
95
+ },
96
+
97
+ toggle_active_tab: function (tab, location_hash) {
98
+ var S = this.S,
99
+ tabs = tab.closest('[' + this.attr_name() + ']'),
100
+ anchor = tab.children('a').first(),
101
+ target_hash = '#' + anchor.attr('href').split('#')[1],
102
+ target = S(target_hash),
103
+ siblings = tab.siblings(),
104
+ settings = tabs.data(this.attr_name(true) + '-init');
105
+
106
+ // allow usage of data-tab-content attribute instead of href
107
+ if (S(this).data(this.data_attr('tab-content'))) {
108
+ target_hash = '#' + S(this).data(this.data_attr('tab-content')).split('#')[1];
109
+ target = S(target_hash);
110
+ }
111
+
112
+ if (settings.deep_linking) {
113
+ // Get the scroll Y position prior to moving to the hash ID
114
+ var cur_ypos = $('body,html').scrollTop();
115
+
116
+ // Update the location hash to preserve browser history
117
+ // Note that the hash does not need to correspond to the
118
+ // tab content ID anchor; it can be an ID inside or outside of the tab
119
+ // content div.
120
+ if (location_hash != undefined) {
121
+ window.location.hash = location_hash;
122
+ } else {
123
+ window.location.hash = target_hash;
124
+ }
125
+
126
+ if (settings.scroll_to_content) {
127
+ // If the user is requesting the content of a tab, then scroll to the
128
+ // top of the title area; otherwise, scroll to the element within
129
+ // the content area as defined by the hash value.
130
+ if (location_hash == undefined || location_hash == target_hash) {
131
+ tab.parent()[0].scrollIntoView();
132
+ } else {
133
+ S(target_hash)[0].scrollIntoView();
134
+ }
135
+ } else {
136
+ // Adjust the scrollbar to the Y position prior to setting the hash
137
+ // Only do this for the tab content anchor, otherwise there will be
138
+ // conflicts with in-tab anchor links nested in the tab-content div
139
+ if (location_hash == undefined || location_hash == target_hash) {
140
+ $('body,html').scrollTop(cur_ypos);
141
+ }
142
+ }
143
+ }
144
+
145
+ // WARNING: The activation and deactivation of the tab content must
146
+ // occur after the deep linking in order to properly refresh the browser
147
+ // window (notably in Chrome).
148
+ tab.addClass(settings.active_class).triggerHandler('opened');
149
+ siblings.removeClass(settings.active_class);
150
+ target.siblings().removeClass(settings.active_class).end().addClass(settings.active_class);
151
+ settings.callback(tab);
152
+ target.triggerHandler('toggled', [tab]);
153
+ tabs.triggerHandler('toggled', [target]);
154
+ },
155
+
156
+ data_attr: function (str) {
157
+ if (this.namespace.length > 0) {
158
+ return this.namespace + '-' + str;
159
+ }
160
+
161
+ return str;
162
+ },
163
+
164
+ off : function () {},
165
+
166
+ reflow : function () {}
167
+ };
168
+ }(jQuery, this, this.document));
@@ -0,0 +1,272 @@
1
+ ;(function ($, window, document, undefined) {
2
+ 'use strict';
3
+
4
+ Foundation.libs.tooltip = {
5
+ name : 'tooltip',
6
+
7
+ version : '5.2.2',
8
+
9
+ settings : {
10
+ additional_inheritable_classes : [],
11
+ tooltip_class : '.tooltip',
12
+ append_to: 'body',
13
+ touch_close_text: 'Tap To Close',
14
+ disable_for_touch: false,
15
+ hover_delay: 200,
16
+ tip_template : function (selector, content) {
17
+ return '<span data-selector="' + selector + '" class="'
18
+ + Foundation.libs.tooltip.settings.tooltip_class.substring(1)
19
+ + '">' + content + '<span class="nub"></span></span>';
20
+ }
21
+ },
22
+
23
+ cache : {},
24
+
25
+ init : function (scope, method, options) {
26
+ Foundation.inherit(this, 'random_str');
27
+ this.bindings(method, options);
28
+ },
29
+
30
+ events : function (instance) {
31
+ var self = this,
32
+ S = self.S;
33
+
34
+ self.create(this.S(instance));
35
+
36
+ $(this.scope)
37
+ .off('.tooltip')
38
+ .on('mouseenter.fndtn.tooltip mouseleave.fndtn.tooltip touchstart.fndtn.tooltip MSPointerDown.fndtn.tooltip',
39
+ '[' + this.attr_name() + ']', function (e) {
40
+ var $this = S(this),
41
+ settings = $.extend({}, self.settings, self.data_options($this)),
42
+ is_touch = false;
43
+
44
+ if (Modernizr.touch && /touchstart|MSPointerDown/i.test(e.type) && S(e.target).is('a')) {
45
+ return false;
46
+ }
47
+
48
+ if (/mouse/i.test(e.type) && self.ie_touch(e)) return false;
49
+
50
+ if ($this.hasClass('open')) {
51
+ if (Modernizr.touch && /touchstart|MSPointerDown/i.test(e.type)) e.preventDefault();
52
+ self.hide($this);
53
+ } else {
54
+ if (settings.disable_for_touch && Modernizr.touch && /touchstart|MSPointerDown/i.test(e.type)) {
55
+ return;
56
+ } else if(!settings.disable_for_touch && Modernizr.touch && /touchstart|MSPointerDown/i.test(e.type)) {
57
+ e.preventDefault();
58
+ S(settings.tooltip_class + '.open').hide();
59
+ is_touch = true;
60
+ }
61
+
62
+ if (/enter|over/i.test(e.type)) {
63
+ this.timer = setTimeout(function () {
64
+ var tip = self.showTip($this);
65
+ }.bind(this), self.settings.hover_delay);
66
+ } else if (e.type === 'mouseout' || e.type === 'mouseleave') {
67
+ clearTimeout(this.timer);
68
+ self.hide($this);
69
+ } else {
70
+ self.showTip($this);
71
+ }
72
+ }
73
+ })
74
+ .on('mouseleave.fndtn.tooltip touchstart.fndtn.tooltip MSPointerDown.fndtn.tooltip', '[' + this.attr_name() + '].open', function (e) {
75
+ if (/mouse/i.test(e.type) && self.ie_touch(e)) return false;
76
+
77
+ if($(this).data('tooltip-open-event-type') == 'touch' && e.type == 'mouseleave') {
78
+ return;
79
+ }
80
+ else if($(this).data('tooltip-open-event-type') == 'mouse' && /MSPointerDown|touchstart/i.test(e.type)) {
81
+ self.convert_to_touch($(this));
82
+ } else {
83
+ self.hide($(this));
84
+ }
85
+ })
86
+ .on('DOMNodeRemoved DOMAttrModified', '[' + this.attr_name() + ']:not(a)', function (e) {
87
+ self.hide(S(this));
88
+ });
89
+ },
90
+
91
+ ie_touch : function (e) {
92
+ // How do I distinguish between IE11 and Windows Phone 8?????
93
+ return false;
94
+ },
95
+
96
+ showTip : function ($target) {
97
+ var $tip = this.getTip($target);
98
+
99
+ return this.show($target);
100
+ },
101
+
102
+ getTip : function ($target) {
103
+ var selector = this.selector($target),
104
+ settings = $.extend({}, this.settings, this.data_options($target)),
105
+ tip = null;
106
+
107
+ if (selector) {
108
+ tip = this.S('span[data-selector="' + selector + '"]' + settings.tooltip_class);
109
+ }
110
+
111
+ return (typeof tip === 'object') ? tip : false;
112
+ },
113
+
114
+ selector : function ($target) {
115
+ var id = $target.attr('id'),
116
+ dataSelector = $target.attr(this.attr_name()) || $target.attr('data-selector');
117
+
118
+ if ((id && id.length < 1 || !id) && typeof dataSelector != 'string') {
119
+ dataSelector = this.random_str(6);
120
+ $target.attr('data-selector', dataSelector);
121
+ }
122
+
123
+ return (id && id.length > 0) ? id : dataSelector;
124
+ },
125
+
126
+ create : function ($target) {
127
+ var self = this,
128
+ settings = $.extend({}, this.settings, this.data_options($target)),
129
+ tip_template = this.settings.tip_template;
130
+
131
+ if (typeof settings.tip_template === 'string' && window.hasOwnProperty(settings.tip_template)) {
132
+ tip_template = window[settings.tip_template];
133
+ }
134
+
135
+ var $tip = $(tip_template(this.selector($target), $('<div></div>').html($target.attr('title')).html())),
136
+ classes = this.inheritable_classes($target);
137
+
138
+ $tip.addClass(classes).appendTo(settings.append_to);
139
+
140
+ if (Modernizr.touch) {
141
+ $tip.append('<span class="tap-to-close">'+settings.touch_close_text+'</span>');
142
+ $tip.on('touchstart.fndtn.tooltip MSPointerDown.fndtn.tooltip', function(e) {
143
+ self.hide($target);
144
+ });
145
+ }
146
+
147
+ $target.removeAttr('title').attr('title','');
148
+ },
149
+
150
+ reposition : function (target, tip, classes) {
151
+ var width, nub, nubHeight, nubWidth, column, objPos;
152
+
153
+ tip.css('visibility', 'hidden').show();
154
+
155
+ width = target.data('width');
156
+ nub = tip.children('.nub');
157
+ nubHeight = nub.outerHeight();
158
+ nubWidth = nub.outerHeight();
159
+
160
+ if (this.small()) {
161
+ tip.css({'width' : '100%' });
162
+ } else {
163
+ tip.css({'width' : (width) ? width : 'auto'});
164
+ }
165
+
166
+ objPos = function (obj, top, right, bottom, left, width) {
167
+ return obj.css({
168
+ 'top' : (top) ? top : 'auto',
169
+ 'bottom' : (bottom) ? bottom : 'auto',
170
+ 'left' : (left) ? left : 'auto',
171
+ 'right' : (right) ? right : 'auto'
172
+ }).end();
173
+ };
174
+
175
+ objPos(tip, (target.offset().top + target.outerHeight() + 10), 'auto', 'auto', target.offset().left);
176
+
177
+ if (this.small()) {
178
+ objPos(tip, (target.offset().top + target.outerHeight() + 10), 'auto', 'auto', 12.5, $(this.scope).width());
179
+ tip.addClass('tip-override');
180
+ objPos(nub, -nubHeight, 'auto', 'auto', target.offset().left);
181
+ } else {
182
+ var left = target.offset().left;
183
+ if (Foundation.rtl) {
184
+ nub.addClass('rtl');
185
+ left = target.offset().left + target.outerWidth() - tip.outerWidth();
186
+ }
187
+ objPos(tip, (target.offset().top + target.outerHeight() + 10), 'auto', 'auto', left);
188
+ tip.removeClass('tip-override');
189
+ if (classes && classes.indexOf('tip-top') > -1) {
190
+ if (Foundation.rtl) nub.addClass('rtl');
191
+ objPos(tip, (target.offset().top - tip.outerHeight()), 'auto', 'auto', left)
192
+ .removeClass('tip-override');
193
+ } else if (classes && classes.indexOf('tip-left') > -1) {
194
+ objPos(tip, (target.offset().top + (target.outerHeight() / 2) - (tip.outerHeight() / 2)), 'auto', 'auto', (target.offset().left - tip.outerWidth() - nubHeight))
195
+ .removeClass('tip-override');
196
+ nub.removeClass('rtl');
197
+ } else if (classes && classes.indexOf('tip-right') > -1) {
198
+ objPos(tip, (target.offset().top + (target.outerHeight() / 2) - (tip.outerHeight() / 2)), 'auto', 'auto', (target.offset().left + target.outerWidth() + nubHeight))
199
+ .removeClass('tip-override');
200
+ nub.removeClass('rtl');
201
+ }
202
+ }
203
+
204
+ tip.css('visibility', 'visible').hide();
205
+ },
206
+
207
+ small : function () {
208
+ return matchMedia(Foundation.media_queries.small).matches &&
209
+ !matchMedia(Foundation.media_queries.medium).matches;
210
+ },
211
+
212
+ inheritable_classes : function ($target) {
213
+ var settings = $.extend({}, this.settings, this.data_options($target)),
214
+ inheritables = ['tip-top', 'tip-left', 'tip-bottom', 'tip-right', 'radius', 'round'].concat(settings.additional_inheritable_classes),
215
+ classes = $target.attr('class'),
216
+ filtered = classes ? $.map(classes.split(' '), function (el, i) {
217
+ if ($.inArray(el, inheritables) !== -1) {
218
+ return el;
219
+ }
220
+ }).join(' ') : '';
221
+
222
+ return $.trim(filtered);
223
+ },
224
+
225
+ convert_to_touch : function($target) {
226
+ var self = this,
227
+ $tip = self.getTip($target),
228
+ settings = $.extend({}, self.settings, self.data_options($target));
229
+
230
+ if ($tip.find('.tap-to-close').length === 0) {
231
+ $tip.append('<span class="tap-to-close">'+settings.touch_close_text+'</span>');
232
+ $tip.on('click.fndtn.tooltip.tapclose touchstart.fndtn.tooltip.tapclose MSPointerDown.fndtn.tooltip.tapclose', function(e) {
233
+ self.hide($target);
234
+ });
235
+ }
236
+
237
+ $target.data('tooltip-open-event-type', 'touch');
238
+ },
239
+
240
+ show : function ($target) {
241
+ var $tip = this.getTip($target);
242
+
243
+ if ($target.data('tooltip-open-event-type') == 'touch') {
244
+ this.convert_to_touch($target);
245
+ }
246
+
247
+ this.reposition($target, $tip, $target.attr('class'));
248
+ $target.addClass('open');
249
+ $tip.fadeIn(150);
250
+ },
251
+
252
+ hide : function ($target) {
253
+ var $tip = this.getTip($target);
254
+
255
+ $tip.fadeOut(150, function() {
256
+ $tip.find('.tap-to-close').remove();
257
+ $tip.off('click.fndtn.tooltip.tapclose touchstart.fndtn.tooltip.tapclose MSPointerDown.fndtn.tapclose');
258
+ $target.removeClass('open');
259
+ });
260
+ },
261
+
262
+ off : function () {
263
+ var self = this;
264
+ this.S(this.scope).off('.fndtn.tooltip');
265
+ this.S(this.settings.tooltip_class).each(function (i) {
266
+ $('[' + self.attr_name() + ']').eq(i).attr('title', $(this).text());
267
+ }).remove();
268
+ },
269
+
270
+ reflow : function () {}
271
+ };
272
+ }(jQuery, this, this.document));