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,173 @@
1
+ ;(function ($, window, document, undefined) {
2
+ 'use strict';
3
+
4
+ Foundation.libs['magellan-expedition'] = {
5
+ name : 'magellan-expedition',
6
+
7
+ version : '5.2.2',
8
+
9
+ settings : {
10
+ active_class: 'active',
11
+ threshold: 0, // pixels from the top of the expedition for it to become fixes
12
+ destination_threshold: 20, // pixels from the top of destination for it to be considered active
13
+ throttle_delay: 30 // calculation throttling to increase framerate
14
+ },
15
+
16
+ init : function (scope, method, options) {
17
+ Foundation.inherit(this, 'throttle');
18
+ this.bindings(method, options);
19
+ },
20
+
21
+ events : function () {
22
+ var self = this,
23
+ S = self.S,
24
+ settings = self.settings;
25
+
26
+ // initialize expedition offset
27
+ self.set_expedition_position();
28
+
29
+ S(self.scope)
30
+ .off('.magellan')
31
+ .on('click.fndtn.magellan', '[' + self.add_namespace('data-magellan-arrival') + '] a[href^="#"]', function (e) {
32
+ e.preventDefault();
33
+ var expedition = $(this).closest('[' + self.attr_name() + ']'),
34
+ settings = expedition.data('magellan-expedition-init');
35
+
36
+ var hash = this.hash.split('#').join(''),
37
+ target = $("a[name='"+hash+"']");
38
+ if (target.length === 0) target = $('#'+hash);
39
+
40
+ // Account for expedition height if fixed position
41
+ var scroll_top = target.offset().top;
42
+ scroll_top = scroll_top - expedition.outerHeight();
43
+
44
+ $('html, body').stop().animate({
45
+ 'scrollTop': scroll_top
46
+ }, 700, 'swing', function () {
47
+ if(history.pushState) {
48
+ history.pushState(null, null, '#'+hash);
49
+ }
50
+ else {
51
+ location.hash = '#'+hash;
52
+ }
53
+ });
54
+ })
55
+ .on('scroll.fndtn.magellan', self.throttle(this.check_for_arrivals.bind(this), settings.throttle_delay))
56
+ $(window).on('resize.fndtn.magellan', self.throttle(this.set_expedition_position.bind(this), settings.throttle_delay));
57
+ },
58
+
59
+ check_for_arrivals : function() {
60
+ var self = this;
61
+ self.update_arrivals();
62
+ self.update_expedition_positions();
63
+ },
64
+
65
+ set_expedition_position : function() {
66
+ var self = this;
67
+ $('[' + this.attr_name() + '=fixed]', self.scope).each(function(idx, el) {
68
+ var expedition = $(this),
69
+ styles = expedition.attr('styles'), // save styles
70
+ top_offset;
71
+
72
+ expedition.attr('style', '');
73
+ top_offset = expedition.offset().top;
74
+
75
+ expedition.data(self.data_attr('magellan-top-offset'), top_offset);
76
+ expedition.attr('style', styles);
77
+ });
78
+ },
79
+
80
+ update_expedition_positions : function() {
81
+ var self = this,
82
+ window_top_offset = $(window).scrollTop();
83
+
84
+ $('[' + this.attr_name() + '=fixed]', self.scope).each(function() {
85
+ var expedition = $(this),
86
+ top_offset = expedition.data('magellan-top-offset');
87
+
88
+ if (window_top_offset >= top_offset) {
89
+ // Placeholder allows height calculations to be consistent even when
90
+ // appearing to switch between fixed/non-fixed placement
91
+ var placeholder = expedition.prev('[' + self.add_namespace('data-magellan-expedition-clone') + ']');
92
+ if (placeholder.length === 0) {
93
+ placeholder = expedition.clone();
94
+ placeholder.removeAttr(self.attr_name());
95
+ placeholder.attr(self.add_namespace('data-magellan-expedition-clone'),'');
96
+ expedition.before(placeholder);
97
+ }
98
+ expedition.css({position:'fixed', top: 0});
99
+ } else {
100
+ expedition.prev('[' + self.add_namespace('data-magellan-expedition-clone') + ']').remove();
101
+ expedition.attr('style','');
102
+ }
103
+ });
104
+ },
105
+
106
+ update_arrivals : function() {
107
+ var self = this,
108
+ window_top_offset = $(window).scrollTop();
109
+
110
+ $('[' + this.attr_name() + ']', self.scope).each(function() {
111
+ var expedition = $(this),
112
+ settings = settings = expedition.data(self.attr_name(true) + '-init'),
113
+ offsets = self.offsets(expedition, window_top_offset),
114
+ arrivals = expedition.find('[' + self.add_namespace('data-magellan-arrival') + ']'),
115
+ active_item = false;
116
+ offsets.each(function(idx, item) {
117
+ if (item.viewport_offset >= item.top_offset) {
118
+ var arrivals = expedition.find('[' + self.add_namespace('data-magellan-arrival') + ']');
119
+ arrivals.not(item.arrival).removeClass(settings.active_class);
120
+ item.arrival.addClass(settings.active_class);
121
+ active_item = true;
122
+ return true;
123
+ }
124
+ });
125
+
126
+ if (!active_item) arrivals.removeClass(settings.active_class);
127
+ });
128
+ },
129
+
130
+ offsets : function(expedition, window_offset) {
131
+ var self = this,
132
+ settings = expedition.data(self.attr_name(true) + '-init'),
133
+ viewport_offset = window_offset;
134
+
135
+ return expedition.find('[' + self.add_namespace('data-magellan-arrival') + ']').map(function(idx, el) {
136
+ var name = $(this).data(self.data_attr('magellan-arrival')),
137
+ dest = $('[' + self.add_namespace('data-magellan-destination') + '=' + name + ']');
138
+ if (dest.length > 0) {
139
+ var top_offset = dest.offset().top - settings.destination_threshold - expedition.outerHeight();
140
+ return {
141
+ destination : dest,
142
+ arrival : $(this),
143
+ top_offset : top_offset,
144
+ viewport_offset : viewport_offset
145
+ }
146
+ }
147
+ }).sort(function(a, b) {
148
+ if (a.top_offset < b.top_offset) return -1;
149
+ if (a.top_offset > b.top_offset) return 1;
150
+ return 0;
151
+ });
152
+ },
153
+
154
+ data_attr: function (str) {
155
+ if (this.namespace.length > 0) {
156
+ return this.namespace + '-' + str;
157
+ }
158
+
159
+ return str;
160
+ },
161
+
162
+ off : function () {
163
+ this.S(this.scope).off('.magellan');
164
+ this.S(window).off('.magellan');
165
+ },
166
+
167
+ reflow : function () {
168
+ var self = this;
169
+ // remove placeholder expeditions used for height calculation purposes
170
+ $('[' + self.add_namespace('data-magellan-expedition-clone') + ']', self.scope).remove();
171
+ }
172
+ };
173
+ }(jQuery, this, this.document));
@@ -0,0 +1,50 @@
1
+ ;(function ($, window, document, undefined) {
2
+ 'use strict';
3
+
4
+ Foundation.libs.offcanvas = {
5
+ name : 'offcanvas',
6
+
7
+ version : '5.2.2',
8
+
9
+ settings : {},
10
+
11
+ init : function (scope, method, options) {
12
+ this.events();
13
+ },
14
+
15
+ events : function () {
16
+ var self = this,
17
+ S = self.S;
18
+
19
+ S(this.scope).off('.offcanvas')
20
+ .on('click.fndtn.offcanvas', '.left-off-canvas-toggle', function (e) {
21
+ self.click_toggle_class(e, 'move-right');
22
+ })
23
+ .on('click.fndtn.offcanvas', '.left-off-canvas-menu a', function (e) {
24
+ S(".off-canvas-wrap").removeClass("move-right");
25
+ })
26
+ .on('click.fndtn.offcanvas', '.right-off-canvas-toggle', function (e) {
27
+ self.click_toggle_class(e, 'move-left');
28
+ })
29
+ .on('click.fndtn.offcanvas', '.right-off-canvas-menu a', function (e) {
30
+ S(".off-canvas-wrap").removeClass("move-left");
31
+ })
32
+ .on('click.fndtn.offcanvas', '.exit-off-canvas', function (e) {
33
+ self.click_remove_class(e, 'move-left');
34
+ self.click_remove_class(e, 'move-right');
35
+ })
36
+ },
37
+
38
+ click_toggle_class: function(e, class_name) {
39
+ e.preventDefault();
40
+ this.S(e.target).closest('.off-canvas-wrap').toggleClass(class_name);
41
+ },
42
+
43
+ click_remove_class: function(e, class_name) {
44
+ e.preventDefault();
45
+ this.S('.off-canvas-wrap').removeClass(class_name);
46
+ },
47
+
48
+ reflow : function () {}
49
+ };
50
+ }(jQuery, this, this.document));