docs-cambiocds-com-jekyll-theme 0.1.2 → 0.1.3

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 (37) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +21 -21
  3. data/README.md +48 -48
  4. data/_layouts/default.html +96 -100
  5. data/assets/css/asciidoctor.css +397 -397
  6. data/assets/css/coderay.css +89 -89
  7. data/assets/css/custom.css +32 -0
  8. data/assets/css/font-awesome.css +1801 -1801
  9. data/assets/css/font-awesome.min.css +3 -3
  10. data/assets/css/foundation.css +8545 -8545
  11. data/assets/css/foundation.min.css +8331 -8331
  12. data/assets/css/normalize.css +427 -427
  13. data/assets/js/foundation.min.js +6069 -6069
  14. data/assets/js/foundation/foundation.abide.js +325 -325
  15. data/assets/js/foundation/foundation.accordion.js +71 -71
  16. data/assets/js/foundation/foundation.alert.js +46 -46
  17. data/assets/js/foundation/foundation.clearing.js +573 -573
  18. data/assets/js/foundation/foundation.dropdown.js +444 -444
  19. data/assets/js/foundation/foundation.equalizer.js +77 -77
  20. data/assets/js/foundation/foundation.interchange.js +349 -349
  21. data/assets/js/foundation/foundation.joyride.js +939 -939
  22. data/assets/js/foundation/foundation.js +691 -691
  23. data/assets/js/foundation/foundation.magellan.js +199 -199
  24. data/assets/js/foundation/foundation.offcanvas.js +154 -154
  25. data/assets/js/foundation/foundation.orbit.js +512 -512
  26. data/assets/js/foundation/foundation.reveal.js +455 -455
  27. data/assets/js/foundation/foundation.slider.js +268 -268
  28. data/assets/js/foundation/foundation.tab.js +221 -221
  29. data/assets/js/foundation/foundation.tooltip.js +301 -301
  30. data/assets/js/foundation/foundation.topbar.js +444 -444
  31. data/assets/js/toc.js +82 -82
  32. data/assets/js/vendor/fastclick.js +169 -169
  33. data/assets/js/vendor/jquery.cookie.js +57 -57
  34. data/assets/js/vendor/jquery.js +2339 -2339
  35. data/assets/js/vendor/modernizr.js +304 -304
  36. data/assets/js/vendor/placeholder.js +75 -75
  37. metadata +12 -11
@@ -1,221 +1,221 @@
1
- ;
2
- (function ($, window, document, undefined) {
3
- 'use strict';
4
-
5
- Foundation.libs.tab = {
6
- name: 'tab',
7
-
8
- version: '5.5.0',
9
-
10
- settings: {
11
- active_class: 'active',
12
- callback: function () {
13
- },
14
- deep_linking: false,
15
- scroll_to_content: true,
16
- is_hover: false
17
- },
18
-
19
- default_tab_hashes: [],
20
-
21
- init: function (scope, method, options) {
22
- var self = this,
23
- S = this.S;
24
-
25
- this.bindings(method, options);
26
- this.handle_location_hash_change();
27
-
28
- // Store the default active tabs which will be referenced when the
29
- // location hash is absent, as in the case of navigating the tabs and
30
- // returning to the first viewing via the browser Back button.
31
- S('[' + this.attr_name() + '] > .active > a', this.scope).each(function () {
32
- self.default_tab_hashes.push(this.hash);
33
- });
34
- },
35
-
36
- events: function () {
37
- var self = this,
38
- S = this.S;
39
-
40
- var usual_tab_behavior = function (e) {
41
- var settings = S(this).closest('[' + self.attr_name() + ']').data(self.attr_name(true) + '-init');
42
- if (!settings.is_hover || Modernizr.touch) {
43
- e.preventDefault();
44
- e.stopPropagation();
45
- self.toggle_active_tab(S(this).parent());
46
- }
47
- };
48
-
49
- S(this.scope)
50
- .off('.tab')
51
- // Click event: tab title
52
- .on('focus.fndtn.tab', '[' + this.attr_name() + '] > * > a', usual_tab_behavior)
53
- .on('click.fndtn.tab', '[' + this.attr_name() + '] > * > a', usual_tab_behavior)
54
- // Hover event: tab title
55
- .on('mouseenter.fndtn.tab', '[' + this.attr_name() + '] > * > a', function (e) {
56
- var settings = S(this).closest('[' + self.attr_name() + ']').data(self.attr_name(true) + '-init');
57
- if (settings.is_hover) self.toggle_active_tab(S(this).parent());
58
- });
59
-
60
- // Location hash change event
61
- S(window).on('hashchange.fndtn.tab', function (e) {
62
- e.preventDefault();
63
- self.handle_location_hash_change();
64
- });
65
- },
66
-
67
- handle_location_hash_change: function () {
68
-
69
- var self = this,
70
- S = this.S;
71
-
72
- S('[' + this.attr_name() + ']', this.scope).each(function () {
73
- var settings = S(this).data(self.attr_name(true) + '-init');
74
- if (settings.deep_linking) {
75
- // Match the location hash to a label
76
- var hash;
77
- if (settings.scroll_to_content) {
78
- hash = self.scope.location.hash;
79
- } else {
80
- // prefix the hash to prevent anchor scrolling
81
- hash = self.scope.location.hash.replace('fndtn-', '');
82
- }
83
- if (hash != '') {
84
- // Check whether the location hash references a tab content div or
85
- // another element on the page (inside or outside the tab content div)
86
- var hash_element = S(hash);
87
- if (hash_element.hasClass('content') && hash_element.parent().hasClass('tabs-content')) {
88
- // Tab content div
89
- self.toggle_active_tab($('[' + self.attr_name() + '] > * > a[href=' + hash + ']').parent());
90
- } else {
91
- // Not the tab content div. If inside the tab content, find the
92
- // containing tab and toggle it as active.
93
- var hash_tab_container_id = hash_element.closest('.content').attr('id');
94
- if (hash_tab_container_id != undefined) {
95
- self.toggle_active_tab($('[' + self.attr_name() + '] > * > a[href=#' + hash_tab_container_id + ']').parent(), hash);
96
- }
97
- }
98
- } else {
99
- // Reference the default tab hashes which were initialized in the init function
100
- for (var ind = 0; ind < self.default_tab_hashes.length; ind++) {
101
- self.toggle_active_tab($('[' + self.attr_name() + '] > * > a[href=' + self.default_tab_hashes[ind] + ']').parent());
102
- }
103
- }
104
- }
105
- });
106
- },
107
-
108
- toggle_active_tab: function (tab, location_hash) {
109
- var S = this.S,
110
- tabs = tab.closest('[' + this.attr_name() + ']'),
111
- tab_link = tab.find('a'),
112
- anchor = tab.children('a').first(),
113
- target_hash = '#' + anchor.attr('href').split('#')[1],
114
- target = S(target_hash),
115
- siblings = tab.siblings(),
116
- settings = tabs.data(this.attr_name(true) + '-init'),
117
- interpret_keyup_action = function (e) {
118
- // Light modification of Heydon Pickering's Practical ARIA Examples: http://heydonworks.com/practical_aria_examples/js/a11y.js
119
-
120
- // define current, previous and next (possible) tabs
121
-
122
- var $original = $(this);
123
- var $prev = $(this).parents('li').prev().children('[role="tab"]');
124
- var $next = $(this).parents('li').next().children('[role="tab"]');
125
- var $target;
126
-
127
- // find the direction (prev or next)
128
-
129
- switch (e.keyCode) {
130
- case 37:
131
- $target = $prev;
132
- break;
133
- case 39:
134
- $target = $next;
135
- break;
136
- default:
137
- $target = false
138
- break;
139
- }
140
-
141
- if ($target.length) {
142
- $original.attr({
143
- 'tabindex': '-1',
144
- 'aria-selected': null
145
- });
146
- $target.attr({
147
- 'tabindex': '0',
148
- 'aria-selected': true
149
- }).focus();
150
- }
151
-
152
- // Hide panels
153
-
154
- $('[role="tabpanel"]')
155
- .attr('aria-hidden', 'true');
156
-
157
- // Show panel which corresponds to target
158
-
159
- $('#' + $(document.activeElement).attr('href').substring(1))
160
- .attr('aria-hidden', null);
161
-
162
- };
163
-
164
- // allow usage of data-tab-content attribute instead of href
165
- if (S(this).data(this.data_attr('tab-content'))) {
166
- target_hash = '#' + S(this).data(this.data_attr('tab-content')).split('#')[1];
167
- target = S(target_hash);
168
- }
169
-
170
- if (settings.deep_linking) {
171
-
172
- if (settings.scroll_to_content) {
173
- // retain current hash to scroll to content
174
- window.location.hash = location_hash || target_hash;
175
- if (location_hash == undefined || location_hash == target_hash) {
176
- tab.parent()[0].scrollIntoView();
177
- } else {
178
- S(target_hash)[0].scrollIntoView();
179
- }
180
- } else {
181
- // prefix the hashes so that the browser doesn't scroll down
182
- if (location_hash != undefined) {
183
- window.location.hash = 'fndtn-' + location_hash.replace('#', '');
184
- } else {
185
- window.location.hash = 'fndtn-' + target_hash.replace('#', '');
186
- }
187
- }
188
- }
189
-
190
- // WARNING: The activation and deactivation of the tab content must
191
- // occur after the deep linking in order to properly refresh the browser
192
- // window (notably in Chrome).
193
- // Clean up multiple attr instances to done once
194
- tab.addClass(settings.active_class).triggerHandler('opened');
195
- tab_link.attr({'aria-selected': 'true', tabindex: 0});
196
- siblings.removeClass(settings.active_class)
197
- siblings.find('a').attr({'aria-selected': 'false', tabindex: -1});
198
- target.siblings().removeClass(settings.active_class).attr({'aria-hidden': 'true', tabindex: -1});
199
- target.addClass(settings.active_class).attr('aria-hidden', 'false').removeAttr('tabindex');
200
- settings.callback(tab);
201
- target.triggerHandler('toggled', [tab]);
202
- tabs.triggerHandler('toggled', [target]);
203
-
204
- tab_link.off('keydown').on('keydown', interpret_keyup_action);
205
- },
206
-
207
- data_attr: function (str) {
208
- if (this.namespace.length > 0) {
209
- return this.namespace + '-' + str;
210
- }
211
-
212
- return str;
213
- },
214
-
215
- off: function () {
216
- },
217
-
218
- reflow: function () {
219
- }
220
- };
221
- }(jQuery, window, window.document));
1
+ ;
2
+ (function ($, window, document, undefined) {
3
+ 'use strict';
4
+
5
+ Foundation.libs.tab = {
6
+ name: 'tab',
7
+
8
+ version: '5.5.0',
9
+
10
+ settings: {
11
+ active_class: 'active',
12
+ callback: function () {
13
+ },
14
+ deep_linking: false,
15
+ scroll_to_content: true,
16
+ is_hover: false
17
+ },
18
+
19
+ default_tab_hashes: [],
20
+
21
+ init: function (scope, method, options) {
22
+ var self = this,
23
+ S = this.S;
24
+
25
+ this.bindings(method, options);
26
+ this.handle_location_hash_change();
27
+
28
+ // Store the default active tabs which will be referenced when the
29
+ // location hash is absent, as in the case of navigating the tabs and
30
+ // returning to the first viewing via the browser Back button.
31
+ S('[' + this.attr_name() + '] > .active > a', this.scope).each(function () {
32
+ self.default_tab_hashes.push(this.hash);
33
+ });
34
+ },
35
+
36
+ events: function () {
37
+ var self = this,
38
+ S = this.S;
39
+
40
+ var usual_tab_behavior = function (e) {
41
+ var settings = S(this).closest('[' + self.attr_name() + ']').data(self.attr_name(true) + '-init');
42
+ if (!settings.is_hover || Modernizr.touch) {
43
+ e.preventDefault();
44
+ e.stopPropagation();
45
+ self.toggle_active_tab(S(this).parent());
46
+ }
47
+ };
48
+
49
+ S(this.scope)
50
+ .off('.tab')
51
+ // Click event: tab title
52
+ .on('focus.fndtn.tab', '[' + this.attr_name() + '] > * > a', usual_tab_behavior)
53
+ .on('click.fndtn.tab', '[' + this.attr_name() + '] > * > a', usual_tab_behavior)
54
+ // Hover event: tab title
55
+ .on('mouseenter.fndtn.tab', '[' + this.attr_name() + '] > * > a', function (e) {
56
+ var settings = S(this).closest('[' + self.attr_name() + ']').data(self.attr_name(true) + '-init');
57
+ if (settings.is_hover) self.toggle_active_tab(S(this).parent());
58
+ });
59
+
60
+ // Location hash change event
61
+ S(window).on('hashchange.fndtn.tab', function (e) {
62
+ e.preventDefault();
63
+ self.handle_location_hash_change();
64
+ });
65
+ },
66
+
67
+ handle_location_hash_change: function () {
68
+
69
+ var self = this,
70
+ S = this.S;
71
+
72
+ S('[' + this.attr_name() + ']', this.scope).each(function () {
73
+ var settings = S(this).data(self.attr_name(true) + '-init');
74
+ if (settings.deep_linking) {
75
+ // Match the location hash to a label
76
+ var hash;
77
+ if (settings.scroll_to_content) {
78
+ hash = self.scope.location.hash;
79
+ } else {
80
+ // prefix the hash to prevent anchor scrolling
81
+ hash = self.scope.location.hash.replace('fndtn-', '');
82
+ }
83
+ if (hash != '') {
84
+ // Check whether the location hash references a tab content div or
85
+ // another element on the page (inside or outside the tab content div)
86
+ var hash_element = S(hash);
87
+ if (hash_element.hasClass('content') && hash_element.parent().hasClass('tabs-content')) {
88
+ // Tab content div
89
+ self.toggle_active_tab($('[' + self.attr_name() + '] > * > a[href=' + hash + ']').parent());
90
+ } else {
91
+ // Not the tab content div. If inside the tab content, find the
92
+ // containing tab and toggle it as active.
93
+ var hash_tab_container_id = hash_element.closest('.content').attr('id');
94
+ if (hash_tab_container_id != undefined) {
95
+ self.toggle_active_tab($('[' + self.attr_name() + '] > * > a[href=#' + hash_tab_container_id + ']').parent(), hash);
96
+ }
97
+ }
98
+ } else {
99
+ // Reference the default tab hashes which were initialized in the init function
100
+ for (var ind = 0; ind < self.default_tab_hashes.length; ind++) {
101
+ self.toggle_active_tab($('[' + self.attr_name() + '] > * > a[href=' + self.default_tab_hashes[ind] + ']').parent());
102
+ }
103
+ }
104
+ }
105
+ });
106
+ },
107
+
108
+ toggle_active_tab: function (tab, location_hash) {
109
+ var S = this.S,
110
+ tabs = tab.closest('[' + this.attr_name() + ']'),
111
+ tab_link = tab.find('a'),
112
+ anchor = tab.children('a').first(),
113
+ target_hash = '#' + anchor.attr('href').split('#')[1],
114
+ target = S(target_hash),
115
+ siblings = tab.siblings(),
116
+ settings = tabs.data(this.attr_name(true) + '-init'),
117
+ interpret_keyup_action = function (e) {
118
+ // Light modification of Heydon Pickering's Practical ARIA Examples: http://heydonworks.com/practical_aria_examples/js/a11y.js
119
+
120
+ // define current, previous and next (possible) tabs
121
+
122
+ var $original = $(this);
123
+ var $prev = $(this).parents('li').prev().children('[role="tab"]');
124
+ var $next = $(this).parents('li').next().children('[role="tab"]');
125
+ var $target;
126
+
127
+ // find the direction (prev or next)
128
+
129
+ switch (e.keyCode) {
130
+ case 37:
131
+ $target = $prev;
132
+ break;
133
+ case 39:
134
+ $target = $next;
135
+ break;
136
+ default:
137
+ $target = false
138
+ break;
139
+ }
140
+
141
+ if ($target.length) {
142
+ $original.attr({
143
+ 'tabindex': '-1',
144
+ 'aria-selected': null
145
+ });
146
+ $target.attr({
147
+ 'tabindex': '0',
148
+ 'aria-selected': true
149
+ }).focus();
150
+ }
151
+
152
+ // Hide panels
153
+
154
+ $('[role="tabpanel"]')
155
+ .attr('aria-hidden', 'true');
156
+
157
+ // Show panel which corresponds to target
158
+
159
+ $('#' + $(document.activeElement).attr('href').substring(1))
160
+ .attr('aria-hidden', null);
161
+
162
+ };
163
+
164
+ // allow usage of data-tab-content attribute instead of href
165
+ if (S(this).data(this.data_attr('tab-content'))) {
166
+ target_hash = '#' + S(this).data(this.data_attr('tab-content')).split('#')[1];
167
+ target = S(target_hash);
168
+ }
169
+
170
+ if (settings.deep_linking) {
171
+
172
+ if (settings.scroll_to_content) {
173
+ // retain current hash to scroll to content
174
+ window.location.hash = location_hash || target_hash;
175
+ if (location_hash == undefined || location_hash == target_hash) {
176
+ tab.parent()[0].scrollIntoView();
177
+ } else {
178
+ S(target_hash)[0].scrollIntoView();
179
+ }
180
+ } else {
181
+ // prefix the hashes so that the browser doesn't scroll down
182
+ if (location_hash != undefined) {
183
+ window.location.hash = 'fndtn-' + location_hash.replace('#', '');
184
+ } else {
185
+ window.location.hash = 'fndtn-' + target_hash.replace('#', '');
186
+ }
187
+ }
188
+ }
189
+
190
+ // WARNING: The activation and deactivation of the tab content must
191
+ // occur after the deep linking in order to properly refresh the browser
192
+ // window (notably in Chrome).
193
+ // Clean up multiple attr instances to done once
194
+ tab.addClass(settings.active_class).triggerHandler('opened');
195
+ tab_link.attr({'aria-selected': 'true', tabindex: 0});
196
+ siblings.removeClass(settings.active_class)
197
+ siblings.find('a').attr({'aria-selected': 'false', tabindex: -1});
198
+ target.siblings().removeClass(settings.active_class).attr({'aria-hidden': 'true', tabindex: -1});
199
+ target.addClass(settings.active_class).attr('aria-hidden', 'false').removeAttr('tabindex');
200
+ settings.callback(tab);
201
+ target.triggerHandler('toggled', [tab]);
202
+ tabs.triggerHandler('toggled', [target]);
203
+
204
+ tab_link.off('keydown').on('keydown', interpret_keyup_action);
205
+ },
206
+
207
+ data_attr: function (str) {
208
+ if (this.namespace.length > 0) {
209
+ return this.namespace + '-' + str;
210
+ }
211
+
212
+ return str;
213
+ },
214
+
215
+ off: function () {
216
+ },
217
+
218
+ reflow: function () {
219
+ }
220
+ };
221
+ }(jQuery, window, window.document));
@@ -1,301 +1,301 @@
1
- ;
2
- (function ($, window, document, undefined) {
3
- 'use strict';
4
-
5
- Foundation.libs.tooltip = {
6
- name: 'tooltip',
7
-
8
- version: '5.5.0',
9
-
10
- settings: {
11
- additional_inheritable_classes: [],
12
- tooltip_class: '.tooltip',
13
- append_to: 'body',
14
- touch_close_text: 'Tap To Close',
15
- disable_for_touch: false,
16
- hover_delay: 200,
17
- show_on: 'all',
18
- tip_template: function (selector, content) {
19
- return '<span data-selector="' + selector + '" id="' + selector + '" class="'
20
- + Foundation.libs.tooltip.settings.tooltip_class.substring(1)
21
- + '" role="tooltip">' + content + '<span class="nub"></span></span>';
22
- }
23
- },
24
-
25
- cache: {},
26
-
27
- init: function (scope, method, options) {
28
- Foundation.inherit(this, 'random_str');
29
- this.bindings(method, options);
30
- },
31
-
32
- should_show: function (target, tip) {
33
- var settings = $.extend({}, this.settings, this.data_options(target));
34
-
35
- if (settings.show_on === 'all') {
36
- return true;
37
- } else if (this.small() && settings.show_on === 'small') {
38
- return true;
39
- } else if (this.medium() && settings.show_on === 'medium') {
40
- return true;
41
- } else if (this.large() && settings.show_on === 'large') {
42
- return true;
43
- }
44
- return false;
45
- },
46
-
47
- medium: function () {
48
- return matchMedia(Foundation.media_queries['medium']).matches;
49
- },
50
-
51
- large: function () {
52
- return matchMedia(Foundation.media_queries['large']).matches;
53
- },
54
-
55
- events: function (instance) {
56
- var self = this,
57
- S = self.S;
58
-
59
- self.create(this.S(instance));
60
-
61
- $(this.scope)
62
- .off('.tooltip')
63
- .on('mouseenter.fndtn.tooltip mouseleave.fndtn.tooltip touchstart.fndtn.tooltip MSPointerDown.fndtn.tooltip',
64
- '[' + this.attr_name() + ']', function (e) {
65
- var $this = S(this),
66
- settings = $.extend({}, self.settings, self.data_options($this)),
67
- is_touch = false;
68
-
69
- if (Modernizr.touch && /touchstart|MSPointerDown/i.test(e.type) && S(e.target).is('a')) {
70
- return false;
71
- }
72
-
73
- if (/mouse/i.test(e.type) && self.ie_touch(e)) return false;
74
-
75
- if ($this.hasClass('open')) {
76
- if (Modernizr.touch && /touchstart|MSPointerDown/i.test(e.type)) e.preventDefault();
77
- self.hide($this);
78
- } else {
79
- if (settings.disable_for_touch && Modernizr.touch && /touchstart|MSPointerDown/i.test(e.type)) {
80
- return;
81
- } else if (!settings.disable_for_touch && Modernizr.touch && /touchstart|MSPointerDown/i.test(e.type)) {
82
- e.preventDefault();
83
- S(settings.tooltip_class + '.open').hide();
84
- is_touch = true;
85
- }
86
-
87
- if (/enter|over/i.test(e.type)) {
88
- this.timer = setTimeout(function () {
89
- var tip = self.showTip($this);
90
- }.bind(this), self.settings.hover_delay);
91
- } else if (e.type === 'mouseout' || e.type === 'mouseleave') {
92
- clearTimeout(this.timer);
93
- self.hide($this);
94
- } else {
95
- self.showTip($this);
96
- }
97
- }
98
- })
99
- .on('mouseleave.fndtn.tooltip touchstart.fndtn.tooltip MSPointerDown.fndtn.tooltip', '[' + this.attr_name() + '].open', function (e) {
100
- if (/mouse/i.test(e.type) && self.ie_touch(e)) return false;
101
-
102
- if ($(this).data('tooltip-open-event-type') == 'touch' && e.type == 'mouseleave') {
103
- return;
104
- }
105
- else if ($(this).data('tooltip-open-event-type') == 'mouse' && /MSPointerDown|touchstart/i.test(e.type)) {
106
- self.convert_to_touch($(this));
107
- } else {
108
- self.hide($(this));
109
- }
110
- })
111
- .on('DOMNodeRemoved DOMAttrModified', '[' + this.attr_name() + ']:not(a)', function (e) {
112
- self.hide(S(this));
113
- });
114
- },
115
-
116
- ie_touch: function (e) {
117
- // How do I distinguish between IE11 and Windows Phone 8?????
118
- return false;
119
- },
120
-
121
- showTip: function ($target) {
122
- var $tip = this.getTip($target);
123
- if (this.should_show($target, $tip)) {
124
- return this.show($target);
125
- }
126
- return;
127
- },
128
-
129
- getTip: function ($target) {
130
- var selector = this.selector($target),
131
- settings = $.extend({}, this.settings, this.data_options($target)),
132
- tip = null;
133
-
134
- if (selector) {
135
- tip = this.S('span[data-selector="' + selector + '"]' + settings.tooltip_class);
136
- }
137
-
138
- return (typeof tip === 'object') ? tip : false;
139
- },
140
-
141
- selector: function ($target) {
142
- var id = $target.attr('id'),
143
- dataSelector = $target.attr(this.attr_name()) || $target.attr('data-selector');
144
-
145
- if ((id && id.length < 1 || !id) && typeof dataSelector != 'string') {
146
- dataSelector = this.random_str(6);
147
- $target
148
- .attr('data-selector', dataSelector)
149
- .attr('aria-describedby', dataSelector);
150
- }
151
-
152
- return (id && id.length > 0) ? id : dataSelector;
153
- },
154
-
155
- create: function ($target) {
156
- var self = this,
157
- settings = $.extend({}, this.settings, this.data_options($target)),
158
- tip_template = this.settings.tip_template;
159
-
160
- if (typeof settings.tip_template === 'string' && window.hasOwnProperty(settings.tip_template)) {
161
- tip_template = window[settings.tip_template];
162
- }
163
-
164
- var $tip = $(tip_template(this.selector($target), $('<div></div>').html($target.attr('title')).html())),
165
- classes = this.inheritable_classes($target);
166
-
167
- $tip.addClass(classes).appendTo(settings.append_to);
168
-
169
- if (Modernizr.touch) {
170
- $tip.append('<span class="tap-to-close">' + settings.touch_close_text + '</span>');
171
- $tip.on('touchstart.fndtn.tooltip MSPointerDown.fndtn.tooltip', function (e) {
172
- self.hide($target);
173
- });
174
- }
175
-
176
- $target.removeAttr('title').attr('title', '');
177
- },
178
-
179
- reposition: function (target, tip, classes) {
180
- var width, nub, nubHeight, nubWidth, column, objPos;
181
-
182
- tip.css('visibility', 'hidden').show();
183
-
184
- width = target.data('width');
185
- nub = tip.children('.nub');
186
- nubHeight = nub.outerHeight();
187
- nubWidth = nub.outerHeight();
188
-
189
- if (this.small()) {
190
- tip.css({'width': '100%'});
191
- } else {
192
- tip.css({'width': (width) ? width : 'auto'});
193
- }
194
-
195
- objPos = function (obj, top, right, bottom, left, width) {
196
- return obj.css({
197
- 'top': (top) ? top : 'auto',
198
- 'bottom': (bottom) ? bottom : 'auto',
199
- 'left': (left) ? left : 'auto',
200
- 'right': (right) ? right : 'auto'
201
- }).end();
202
- };
203
-
204
- objPos(tip, (target.offset().top + target.outerHeight() + 10), 'auto', 'auto', target.offset().left);
205
-
206
- if (this.small()) {
207
- objPos(tip, (target.offset().top + target.outerHeight() + 10), 'auto', 'auto', 12.5, $(this.scope).width());
208
- tip.addClass('tip-override');
209
- objPos(nub, -nubHeight, 'auto', 'auto', target.offset().left);
210
- } else {
211
- var left = target.offset().left;
212
- if (Foundation.rtl) {
213
- nub.addClass('rtl');
214
- left = target.offset().left + target.outerWidth() - tip.outerWidth();
215
- }
216
- objPos(tip, (target.offset().top + target.outerHeight() + 10), 'auto', 'auto', left);
217
- tip.removeClass('tip-override');
218
- if (classes && classes.indexOf('tip-top') > -1) {
219
- if (Foundation.rtl) nub.addClass('rtl');
220
- objPos(tip, (target.offset().top - tip.outerHeight()), 'auto', 'auto', left)
221
- .removeClass('tip-override');
222
- } else if (classes && classes.indexOf('tip-left') > -1) {
223
- objPos(tip, (target.offset().top + (target.outerHeight() / 2) - (tip.outerHeight() / 2)), 'auto', 'auto', (target.offset().left - tip.outerWidth() - nubHeight))
224
- .removeClass('tip-override');
225
- nub.removeClass('rtl');
226
- } else if (classes && classes.indexOf('tip-right') > -1) {
227
- objPos(tip, (target.offset().top + (target.outerHeight() / 2) - (tip.outerHeight() / 2)), 'auto', 'auto', (target.offset().left + target.outerWidth() + nubHeight))
228
- .removeClass('tip-override');
229
- nub.removeClass('rtl');
230
- }
231
- }
232
-
233
- tip.css('visibility', 'visible').hide();
234
- },
235
-
236
- small: function () {
237
- return matchMedia(Foundation.media_queries.small).matches && !matchMedia(Foundation.media_queries.medium).matches;
238
- },
239
-
240
- inheritable_classes: function ($target) {
241
- var settings = $.extend({}, this.settings, this.data_options($target)),
242
- inheritables = ['tip-top', 'tip-left', 'tip-bottom', 'tip-right', 'radius', 'round'].concat(settings.additional_inheritable_classes),
243
- classes = $target.attr('class'),
244
- filtered = classes ? $.map(classes.split(' '), function (el, i) {
245
- if ($.inArray(el, inheritables) !== -1) {
246
- return el;
247
- }
248
- }).join(' ') : '';
249
-
250
- return $.trim(filtered);
251
- },
252
-
253
- convert_to_touch: function ($target) {
254
- var self = this,
255
- $tip = self.getTip($target),
256
- settings = $.extend({}, self.settings, self.data_options($target));
257
-
258
- if ($tip.find('.tap-to-close').length === 0) {
259
- $tip.append('<span class="tap-to-close">' + settings.touch_close_text + '</span>');
260
- $tip.on('click.fndtn.tooltip.tapclose touchstart.fndtn.tooltip.tapclose MSPointerDown.fndtn.tooltip.tapclose', function (e) {
261
- self.hide($target);
262
- });
263
- }
264
-
265
- $target.data('tooltip-open-event-type', 'touch');
266
- },
267
-
268
- show: function ($target) {
269
- var $tip = this.getTip($target);
270
-
271
- if ($target.data('tooltip-open-event-type') == 'touch') {
272
- this.convert_to_touch($target);
273
- }
274
-
275
- this.reposition($target, $tip, $target.attr('class'));
276
- $target.addClass('open');
277
- $tip.fadeIn(150);
278
- },
279
-
280
- hide: function ($target) {
281
- var $tip = this.getTip($target);
282
-
283
- $tip.fadeOut(150, function () {
284
- $tip.find('.tap-to-close').remove();
285
- $tip.off('click.fndtn.tooltip.tapclose MSPointerDown.fndtn.tapclose');
286
- $target.removeClass('open');
287
- });
288
- },
289
-
290
- off: function () {
291
- var self = this;
292
- this.S(this.scope).off('.fndtn.tooltip');
293
- this.S(this.settings.tooltip_class).each(function (i) {
294
- $('[' + self.attr_name() + ']').eq(i).attr('title', $(this).text());
295
- }).remove();
296
- },
297
-
298
- reflow: function () {
299
- }
300
- };
301
- }(jQuery, window, window.document));
1
+ ;
2
+ (function ($, window, document, undefined) {
3
+ 'use strict';
4
+
5
+ Foundation.libs.tooltip = {
6
+ name: 'tooltip',
7
+
8
+ version: '5.5.0',
9
+
10
+ settings: {
11
+ additional_inheritable_classes: [],
12
+ tooltip_class: '.tooltip',
13
+ append_to: 'body',
14
+ touch_close_text: 'Tap To Close',
15
+ disable_for_touch: false,
16
+ hover_delay: 200,
17
+ show_on: 'all',
18
+ tip_template: function (selector, content) {
19
+ return '<span data-selector="' + selector + '" id="' + selector + '" class="'
20
+ + Foundation.libs.tooltip.settings.tooltip_class.substring(1)
21
+ + '" role="tooltip">' + content + '<span class="nub"></span></span>';
22
+ }
23
+ },
24
+
25
+ cache: {},
26
+
27
+ init: function (scope, method, options) {
28
+ Foundation.inherit(this, 'random_str');
29
+ this.bindings(method, options);
30
+ },
31
+
32
+ should_show: function (target, tip) {
33
+ var settings = $.extend({}, this.settings, this.data_options(target));
34
+
35
+ if (settings.show_on === 'all') {
36
+ return true;
37
+ } else if (this.small() && settings.show_on === 'small') {
38
+ return true;
39
+ } else if (this.medium() && settings.show_on === 'medium') {
40
+ return true;
41
+ } else if (this.large() && settings.show_on === 'large') {
42
+ return true;
43
+ }
44
+ return false;
45
+ },
46
+
47
+ medium: function () {
48
+ return matchMedia(Foundation.media_queries['medium']).matches;
49
+ },
50
+
51
+ large: function () {
52
+ return matchMedia(Foundation.media_queries['large']).matches;
53
+ },
54
+
55
+ events: function (instance) {
56
+ var self = this,
57
+ S = self.S;
58
+
59
+ self.create(this.S(instance));
60
+
61
+ $(this.scope)
62
+ .off('.tooltip')
63
+ .on('mouseenter.fndtn.tooltip mouseleave.fndtn.tooltip touchstart.fndtn.tooltip MSPointerDown.fndtn.tooltip',
64
+ '[' + this.attr_name() + ']', function (e) {
65
+ var $this = S(this),
66
+ settings = $.extend({}, self.settings, self.data_options($this)),
67
+ is_touch = false;
68
+
69
+ if (Modernizr.touch && /touchstart|MSPointerDown/i.test(e.type) && S(e.target).is('a')) {
70
+ return false;
71
+ }
72
+
73
+ if (/mouse/i.test(e.type) && self.ie_touch(e)) return false;
74
+
75
+ if ($this.hasClass('open')) {
76
+ if (Modernizr.touch && /touchstart|MSPointerDown/i.test(e.type)) e.preventDefault();
77
+ self.hide($this);
78
+ } else {
79
+ if (settings.disable_for_touch && Modernizr.touch && /touchstart|MSPointerDown/i.test(e.type)) {
80
+ return;
81
+ } else if (!settings.disable_for_touch && Modernizr.touch && /touchstart|MSPointerDown/i.test(e.type)) {
82
+ e.preventDefault();
83
+ S(settings.tooltip_class + '.open').hide();
84
+ is_touch = true;
85
+ }
86
+
87
+ if (/enter|over/i.test(e.type)) {
88
+ this.timer = setTimeout(function () {
89
+ var tip = self.showTip($this);
90
+ }.bind(this), self.settings.hover_delay);
91
+ } else if (e.type === 'mouseout' || e.type === 'mouseleave') {
92
+ clearTimeout(this.timer);
93
+ self.hide($this);
94
+ } else {
95
+ self.showTip($this);
96
+ }
97
+ }
98
+ })
99
+ .on('mouseleave.fndtn.tooltip touchstart.fndtn.tooltip MSPointerDown.fndtn.tooltip', '[' + this.attr_name() + '].open', function (e) {
100
+ if (/mouse/i.test(e.type) && self.ie_touch(e)) return false;
101
+
102
+ if ($(this).data('tooltip-open-event-type') == 'touch' && e.type == 'mouseleave') {
103
+ return;
104
+ }
105
+ else if ($(this).data('tooltip-open-event-type') == 'mouse' && /MSPointerDown|touchstart/i.test(e.type)) {
106
+ self.convert_to_touch($(this));
107
+ } else {
108
+ self.hide($(this));
109
+ }
110
+ })
111
+ .on('DOMNodeRemoved DOMAttrModified', '[' + this.attr_name() + ']:not(a)', function (e) {
112
+ self.hide(S(this));
113
+ });
114
+ },
115
+
116
+ ie_touch: function (e) {
117
+ // How do I distinguish between IE11 and Windows Phone 8?????
118
+ return false;
119
+ },
120
+
121
+ showTip: function ($target) {
122
+ var $tip = this.getTip($target);
123
+ if (this.should_show($target, $tip)) {
124
+ return this.show($target);
125
+ }
126
+ return;
127
+ },
128
+
129
+ getTip: function ($target) {
130
+ var selector = this.selector($target),
131
+ settings = $.extend({}, this.settings, this.data_options($target)),
132
+ tip = null;
133
+
134
+ if (selector) {
135
+ tip = this.S('span[data-selector="' + selector + '"]' + settings.tooltip_class);
136
+ }
137
+
138
+ return (typeof tip === 'object') ? tip : false;
139
+ },
140
+
141
+ selector: function ($target) {
142
+ var id = $target.attr('id'),
143
+ dataSelector = $target.attr(this.attr_name()) || $target.attr('data-selector');
144
+
145
+ if ((id && id.length < 1 || !id) && typeof dataSelector != 'string') {
146
+ dataSelector = this.random_str(6);
147
+ $target
148
+ .attr('data-selector', dataSelector)
149
+ .attr('aria-describedby', dataSelector);
150
+ }
151
+
152
+ return (id && id.length > 0) ? id : dataSelector;
153
+ },
154
+
155
+ create: function ($target) {
156
+ var self = this,
157
+ settings = $.extend({}, this.settings, this.data_options($target)),
158
+ tip_template = this.settings.tip_template;
159
+
160
+ if (typeof settings.tip_template === 'string' && window.hasOwnProperty(settings.tip_template)) {
161
+ tip_template = window[settings.tip_template];
162
+ }
163
+
164
+ var $tip = $(tip_template(this.selector($target), $('<div></div>').html($target.attr('title')).html())),
165
+ classes = this.inheritable_classes($target);
166
+
167
+ $tip.addClass(classes).appendTo(settings.append_to);
168
+
169
+ if (Modernizr.touch) {
170
+ $tip.append('<span class="tap-to-close">' + settings.touch_close_text + '</span>');
171
+ $tip.on('touchstart.fndtn.tooltip MSPointerDown.fndtn.tooltip', function (e) {
172
+ self.hide($target);
173
+ });
174
+ }
175
+
176
+ $target.removeAttr('title').attr('title', '');
177
+ },
178
+
179
+ reposition: function (target, tip, classes) {
180
+ var width, nub, nubHeight, nubWidth, column, objPos;
181
+
182
+ tip.css('visibility', 'hidden').show();
183
+
184
+ width = target.data('width');
185
+ nub = tip.children('.nub');
186
+ nubHeight = nub.outerHeight();
187
+ nubWidth = nub.outerHeight();
188
+
189
+ if (this.small()) {
190
+ tip.css({'width': '100%'});
191
+ } else {
192
+ tip.css({'width': (width) ? width : 'auto'});
193
+ }
194
+
195
+ objPos = function (obj, top, right, bottom, left, width) {
196
+ return obj.css({
197
+ 'top': (top) ? top : 'auto',
198
+ 'bottom': (bottom) ? bottom : 'auto',
199
+ 'left': (left) ? left : 'auto',
200
+ 'right': (right) ? right : 'auto'
201
+ }).end();
202
+ };
203
+
204
+ objPos(tip, (target.offset().top + target.outerHeight() + 10), 'auto', 'auto', target.offset().left);
205
+
206
+ if (this.small()) {
207
+ objPos(tip, (target.offset().top + target.outerHeight() + 10), 'auto', 'auto', 12.5, $(this.scope).width());
208
+ tip.addClass('tip-override');
209
+ objPos(nub, -nubHeight, 'auto', 'auto', target.offset().left);
210
+ } else {
211
+ var left = target.offset().left;
212
+ if (Foundation.rtl) {
213
+ nub.addClass('rtl');
214
+ left = target.offset().left + target.outerWidth() - tip.outerWidth();
215
+ }
216
+ objPos(tip, (target.offset().top + target.outerHeight() + 10), 'auto', 'auto', left);
217
+ tip.removeClass('tip-override');
218
+ if (classes && classes.indexOf('tip-top') > -1) {
219
+ if (Foundation.rtl) nub.addClass('rtl');
220
+ objPos(tip, (target.offset().top - tip.outerHeight()), 'auto', 'auto', left)
221
+ .removeClass('tip-override');
222
+ } else if (classes && classes.indexOf('tip-left') > -1) {
223
+ objPos(tip, (target.offset().top + (target.outerHeight() / 2) - (tip.outerHeight() / 2)), 'auto', 'auto', (target.offset().left - tip.outerWidth() - nubHeight))
224
+ .removeClass('tip-override');
225
+ nub.removeClass('rtl');
226
+ } else if (classes && classes.indexOf('tip-right') > -1) {
227
+ objPos(tip, (target.offset().top + (target.outerHeight() / 2) - (tip.outerHeight() / 2)), 'auto', 'auto', (target.offset().left + target.outerWidth() + nubHeight))
228
+ .removeClass('tip-override');
229
+ nub.removeClass('rtl');
230
+ }
231
+ }
232
+
233
+ tip.css('visibility', 'visible').hide();
234
+ },
235
+
236
+ small: function () {
237
+ return matchMedia(Foundation.media_queries.small).matches && !matchMedia(Foundation.media_queries.medium).matches;
238
+ },
239
+
240
+ inheritable_classes: function ($target) {
241
+ var settings = $.extend({}, this.settings, this.data_options($target)),
242
+ inheritables = ['tip-top', 'tip-left', 'tip-bottom', 'tip-right', 'radius', 'round'].concat(settings.additional_inheritable_classes),
243
+ classes = $target.attr('class'),
244
+ filtered = classes ? $.map(classes.split(' '), function (el, i) {
245
+ if ($.inArray(el, inheritables) !== -1) {
246
+ return el;
247
+ }
248
+ }).join(' ') : '';
249
+
250
+ return $.trim(filtered);
251
+ },
252
+
253
+ convert_to_touch: function ($target) {
254
+ var self = this,
255
+ $tip = self.getTip($target),
256
+ settings = $.extend({}, self.settings, self.data_options($target));
257
+
258
+ if ($tip.find('.tap-to-close').length === 0) {
259
+ $tip.append('<span class="tap-to-close">' + settings.touch_close_text + '</span>');
260
+ $tip.on('click.fndtn.tooltip.tapclose touchstart.fndtn.tooltip.tapclose MSPointerDown.fndtn.tooltip.tapclose', function (e) {
261
+ self.hide($target);
262
+ });
263
+ }
264
+
265
+ $target.data('tooltip-open-event-type', 'touch');
266
+ },
267
+
268
+ show: function ($target) {
269
+ var $tip = this.getTip($target);
270
+
271
+ if ($target.data('tooltip-open-event-type') == 'touch') {
272
+ this.convert_to_touch($target);
273
+ }
274
+
275
+ this.reposition($target, $tip, $target.attr('class'));
276
+ $target.addClass('open');
277
+ $tip.fadeIn(150);
278
+ },
279
+
280
+ hide: function ($target) {
281
+ var $tip = this.getTip($target);
282
+
283
+ $tip.fadeOut(150, function () {
284
+ $tip.find('.tap-to-close').remove();
285
+ $tip.off('click.fndtn.tooltip.tapclose MSPointerDown.fndtn.tapclose');
286
+ $target.removeClass('open');
287
+ });
288
+ },
289
+
290
+ off: function () {
291
+ var self = this;
292
+ this.S(this.scope).off('.fndtn.tooltip');
293
+ this.S(this.settings.tooltip_class).each(function (i) {
294
+ $('[' + self.attr_name() + ']').eq(i).attr('title', $(this).text());
295
+ }).remove();
296
+ },
297
+
298
+ reflow: function () {
299
+ }
300
+ };
301
+ }(jQuery, window, window.document));