kea-rails 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/lib/kea-rails/version.rb +1 -1
  3. data/vendor/assets/components/Keypress/LICENSE +191 -0
  4. data/vendor/assets/components/Keypress/README.md +78 -0
  5. data/vendor/assets/components/Keypress/bower.json +28 -0
  6. data/vendor/assets/components/Keypress/keypress-2.1.0.min.js +33 -0
  7. data/vendor/assets/components/Keypress/keypress.coffee +921 -0
  8. data/vendor/assets/components/Keypress/keypress.js +1132 -0
  9. data/vendor/assets/components/Keypress/package.json +15 -0
  10. data/vendor/assets/components/attachejs/attache-jquery.js +47 -0
  11. data/vendor/assets/components/attachejs/attache-knockout.js +56 -0
  12. data/vendor/assets/components/attachejs/attache.css +10 -0
  13. data/vendor/assets/components/attachejs/attache.js +589 -0
  14. data/vendor/assets/components/attachejs/bower.json +36 -0
  15. data/vendor/assets/components/humane-js/bower.json +8 -0
  16. data/vendor/assets/components/humane-js/changelog.md +165 -0
  17. data/vendor/assets/components/humane-js/humane.js +238 -0
  18. data/vendor/assets/components/humane-js/humane.min.js +11 -0
  19. data/vendor/assets/components/humane-js/index.html +190 -0
  20. data/vendor/assets/components/humane-js/package.json +25 -0
  21. data/vendor/assets/components/humane-js/readme.md +85 -0
  22. data/vendor/assets/components/humane-js/test/issue23.html +11 -0
  23. data/vendor/assets/components/humane-js/test/issue36.html +9 -0
  24. data/vendor/assets/components/humane-js/test/issue38.html +15 -0
  25. data/vendor/assets/components/humane-js/test/issue49.html +9 -0
  26. data/vendor/assets/components/humane-js/theme-src/bigbox.styl +65 -0
  27. data/vendor/assets/components/humane-js/theme-src/boldlight.styl +64 -0
  28. data/vendor/assets/components/humane-js/theme-src/jackedup.styl +69 -0
  29. data/vendor/assets/components/humane-js/theme-src/libnotify.styl +61 -0
  30. data/vendor/assets/components/humane-js/theme-src/original.styl +51 -0
  31. data/vendor/assets/components/humane-js/themes/bigbox.css +123 -0
  32. data/vendor/assets/components/humane-js/themes/boldlight.css +122 -0
  33. data/vendor/assets/components/humane-js/themes/flatty.css +94 -0
  34. data/vendor/assets/components/humane-js/themes/jackedup.css +123 -0
  35. data/vendor/assets/components/humane-js/themes/libnotify.css +115 -0
  36. data/vendor/assets/components/humane-js/themes/original.css +72 -0
  37. data/vendor/assets/components/knockout-sortable/README.md +129 -0
  38. data/vendor/assets/components/knockout-sortable/bower.json +15 -0
  39. data/vendor/assets/components/knockout-sortable/build/knockout-sortable.js +358 -0
  40. data/vendor/assets/components/knockout-sortable/build/knockout-sortable.min.js +2 -0
  41. data/vendor/assets/components/uri.js/README.md +437 -0
  42. data/vendor/assets/components/uri.js/URI.jquery.json +38 -0
  43. data/vendor/assets/components/uri.js/about-uris.html +156 -0
  44. data/vendor/assets/components/uri.js/build.html +66 -0
  45. data/vendor/assets/components/uri.js/build.js +78 -0
  46. data/vendor/assets/components/uri.js/component.json +15 -0
  47. data/vendor/assets/components/uri.js/contribute.md +11 -0
  48. data/vendor/assets/components/uri.js/docs.html +1280 -0
  49. data/vendor/assets/components/uri.js/index.html +173 -0
  50. data/vendor/assets/components/uri.js/jquery-1.10.2.min.js +6 -0
  51. data/vendor/assets/components/uri.js/jquery-1.7.2.min.js +4 -0
  52. data/vendor/assets/components/uri.js/jquery-1.8.2.min.js +2 -0
  53. data/vendor/assets/components/uri.js/jquery-1.9.1.min.js +5 -0
  54. data/vendor/assets/components/uri.js/jquery-uri-plugin.html +203 -0
  55. data/vendor/assets/components/uri.js/package.json +75 -0
  56. data/vendor/assets/components/uri.js/prettify/lang-apollo.js +2 -0
  57. data/vendor/assets/components/uri.js/prettify/lang-clj.js +18 -0
  58. data/vendor/assets/components/uri.js/prettify/lang-css.js +2 -0
  59. data/vendor/assets/components/uri.js/prettify/lang-go.js +1 -0
  60. data/vendor/assets/components/uri.js/prettify/lang-hs.js +2 -0
  61. data/vendor/assets/components/uri.js/prettify/lang-lisp.js +3 -0
  62. data/vendor/assets/components/uri.js/prettify/lang-lua.js +2 -0
  63. data/vendor/assets/components/uri.js/prettify/lang-ml.js +2 -0
  64. data/vendor/assets/components/uri.js/prettify/lang-n.js +4 -0
  65. data/vendor/assets/components/uri.js/prettify/lang-proto.js +1 -0
  66. data/vendor/assets/components/uri.js/prettify/lang-scala.js +2 -0
  67. data/vendor/assets/components/uri.js/prettify/lang-sql.js +2 -0
  68. data/vendor/assets/components/uri.js/prettify/lang-tex.js +1 -0
  69. data/vendor/assets/components/uri.js/prettify/lang-vb.js +2 -0
  70. data/vendor/assets/components/uri.js/prettify/lang-vhdl.js +3 -0
  71. data/vendor/assets/components/uri.js/prettify/lang-wiki.js +2 -0
  72. data/vendor/assets/components/uri.js/prettify/lang-xq.js +3 -0
  73. data/vendor/assets/components/uri.js/prettify/lang-yaml.js +2 -0
  74. data/vendor/assets/components/uri.js/prettify/prettify.css +1 -0
  75. data/vendor/assets/components/uri.js/prettify/prettify.js +28 -0
  76. data/vendor/assets/components/uri.js/prettify/prettify.sunburst.css +52 -0
  77. data/vendor/assets/components/uri.js/screen.css +167 -0
  78. data/vendor/assets/components/uri.js/screen.js +39 -0
  79. data/vendor/assets/components/uri.js/src/IPv6.js +185 -0
  80. data/vendor/assets/components/uri.js/src/SecondLevelDomains.js +220 -0
  81. data/vendor/assets/components/uri.js/src/URI.fragmentQuery.js +103 -0
  82. data/vendor/assets/components/uri.js/src/URI.fragmentURI.js +96 -0
  83. data/vendor/assets/components/uri.js/src/URI.js +1938 -0
  84. data/vendor/assets/components/uri.js/src/URI.min.js +81 -0
  85. data/vendor/assets/components/uri.js/src/URITemplate.js +494 -0
  86. data/vendor/assets/components/uri.js/src/jquery.URI.js +232 -0
  87. data/vendor/assets/components/uri.js/src/jquery.URI.min.js +7 -0
  88. data/vendor/assets/components/uri.js/src/punycode.js +508 -0
  89. data/vendor/assets/components/uri.js/test/index.html +26 -0
  90. data/vendor/assets/components/uri.js/test/pre_libs.js +4 -0
  91. data/vendor/assets/components/uri.js/test/qunit/qunit-composite.css +13 -0
  92. data/vendor/assets/components/uri.js/test/qunit/qunit-composite.js +167 -0
  93. data/vendor/assets/components/uri.js/test/qunit/qunit.css +244 -0
  94. data/vendor/assets/components/uri.js/test/qunit/qunit.js +2212 -0
  95. data/vendor/assets/components/uri.js/test/test.URI.html +26 -0
  96. data/vendor/assets/components/uri.js/test/test.fragmentQuery.html +31 -0
  97. data/vendor/assets/components/uri.js/test/test.fragmentURI.html +31 -0
  98. data/vendor/assets/components/uri.js/test/test.jQuery-1.10.html +31 -0
  99. data/vendor/assets/components/uri.js/test/test.jQuery-1.7.html +31 -0
  100. data/vendor/assets/components/uri.js/test/test.jQuery-1.8.html +31 -0
  101. data/vendor/assets/components/uri.js/test/test.jQuery-1.9.html +31 -0
  102. data/vendor/assets/components/uri.js/test/test.js +1409 -0
  103. data/vendor/assets/components/uri.js/test/test_fragmentQuery.js +57 -0
  104. data/vendor/assets/components/uri.js/test/test_fragmentURI.js +59 -0
  105. data/vendor/assets/components/uri.js/test/test_jim.js +143 -0
  106. data/vendor/assets/components/uri.js/test/test_jquery.js +138 -0
  107. data/vendor/assets/components/uri.js/test/test_template.js +385 -0
  108. data/vendor/assets/components/uri.js/test/urls.js +1236 -0
  109. data/vendor/assets/components/uri.js/uri-template.html +234 -0
  110. data/vendor/assets/components/uri.js/utils/SLDs.php +37 -0
  111. data/vendor/assets/components/uri.js/utils/sld.js +101 -0
  112. data/vendor/assets/components/veiljs/bower.json +36 -0
  113. data/vendor/assets/components/veiljs/veil-jquery.js +47 -0
  114. data/vendor/assets/components/veiljs/veil-knockout.js +55 -0
  115. data/vendor/assets/components/veiljs/veil.js +465 -0
  116. data/vendor/assets/javascripts/fuse.js +472 -0
  117. data/vendor/assets/javascripts/jquery-ui.js +3844 -0
  118. data/vendor/assets/javascripts/knockout-3.2.0-debug.js +5299 -0
  119. data/vendor/assets/javascripts/moment.js +1902 -0
  120. data/vendor/assets/javascripts/pikaday.js +896 -0
  121. data/vendor/assets/stylesheets/pikaday.css +171 -0
  122. metadata +120 -1
@@ -0,0 +1,589 @@
1
+ // Expose plugin as an AMD module if AMD loader is present:
2
+ (function (factory) {
3
+ 'use strict';
4
+
5
+ if (typeof define === 'function' && define.amd) {
6
+ define(['jquery'], factory);
7
+ } else {
8
+ window.Attache = factory(jQuery);
9
+ }
10
+
11
+ }(function ($) {
12
+ 'use strict';
13
+
14
+ /**
15
+ * Attache
16
+ *
17
+ * @class
18
+ * @global
19
+ * @param {jQuery} anchorElement - The DOM element Attaché will be anchored to
20
+ * @param {Object} [options]
21
+ * @param {String} [options.trigger=hover] - An event type to trigger Attaché. Allowed are "hover", "click" or "none"
22
+ * @param {String} [options.cssTransitionSupport=true] - see README for information
23
+ * @param {String} [options.position=right center] - the popover position, relative to the anchor: left|center|right top|center|bottom
24
+ * @param {String[]} [options.alternativePositions=] - an array list of alternative position strings, in case the default position leads
25
+ * to the popover being off-screen
26
+ * @param {Number} [options.offsetX=10] - the horizontal distance between anchor and popover in px
27
+ * @param {Number} [options.offsetY=10] - the vertical distance between anchor and popover in px
28
+ * @param {String} [options.popoverClass] - additional CSS class(es) to apply to the popover markup
29
+ * @param {Boolean} [options.debug=false] - provide debug information and error handling in the console
30
+ *
31
+ * @param {Object} [callbacks] - callbacks to be triggered at various lifecycle moments
32
+ * @param {afterCreateCallback} [callbacks.afterCreate] - called after the popover markup has been created
33
+ * @param {afterShowCallback} [callbacks.afterShow] - called each time after the popover is shown
34
+ *
35
+ * @example
36
+ * var popover = new Attache(document.getElementById('popover-link'), {popoverClass: 'info-tooltip'});
37
+ *
38
+ * @example
39
+ * // show a tooltip to the bottom right of #popover-link, with fallback positions 'right center'
40
+ * // or 'left center' if the tooltip cannot fit at bottom right
41
+ * var popover = new Attache($('#popover-link'), {position: 'right bottom', alternativePositions: ['right center', 'left center']});
42
+ */
43
+ function Attache(anchorElement, options, callbacks) {
44
+ var noop = function () {},
45
+ that = this;
46
+
47
+ this.options = $.extend({}, this.defaults, options);
48
+
49
+ this.$anchorElement = $(anchorElement);
50
+ this.$popover;
51
+ this.currentPositionLabel = this.options.position;
52
+ this.content;
53
+ this.callbacks = {
54
+ 'afterCreate': [],
55
+ 'beforeShow': [],
56
+ 'afterShow': [],
57
+ 'groupMemberBeforeShow': [],
58
+ 'groupMemberAfterShow': []
59
+ };
60
+
61
+ if (typeof callbacks !== 'undefined') {
62
+ for(var callbackName in callbacks){
63
+ if (callbacks.hasOwnProperty(callbackName)) {
64
+ this.addCallback(callbackName, callbacks[callbackName]);
65
+ }
66
+ }
67
+ }
68
+
69
+ if (!this.options.allowParallelUse) {
70
+
71
+ if (!this.options.group) {
72
+ this.options.group = 'default';
73
+ }
74
+
75
+ this.addCallback('groupMemberBeforeShow', function() { this.hide(); });
76
+ }
77
+
78
+ this.initialize();
79
+ }
80
+
81
+ Attache.groups = {
82
+ default: []
83
+ };
84
+
85
+ Attache.registerGroupMember = function registerGroupMember(instance) {
86
+ var groupName = instance.options.group;
87
+
88
+ if (typeof Attache.groups[groupName] === 'undefined') {
89
+ Attache.groups[groupName] = [];
90
+ }
91
+
92
+ if (Attache.groups[groupName].indexOf(instance) !== -1) {
93
+ return;
94
+ }
95
+
96
+ Attache.groups[groupName].push(instance);
97
+ };
98
+
99
+ Attache.unregisterGroupMember = function unregisterGroupMember(instance) {
100
+ var group = Attache.groups[instance.options.group],
101
+ index;
102
+
103
+ if (typeof group === 'undefined') {
104
+ return;
105
+ }
106
+
107
+ index = group.indexOf(instance);
108
+
109
+ if (index !== -1) {
110
+ group.splice(index, 1);
111
+ }
112
+ };
113
+
114
+ Attache.notifyGroupMembers = function notifyGroupMembers(trigger, instance) {
115
+ var group = Attache.groups[instance.options.group];
116
+
117
+ if (!group || group.length < 2) {
118
+ return;
119
+ }
120
+
121
+ group.forEach(function(member) {
122
+ if (member === instance) {
123
+ return;
124
+ }
125
+
126
+ member.executeGroupCallbacksFor(trigger, instance);
127
+ });
128
+ };
129
+
130
+ Attache.prototype = (function() {
131
+
132
+ var defaults,
133
+ initialize,
134
+ show,
135
+ hide,
136
+ popover,
137
+ setContent,
138
+ positionPopover,
139
+ destroy,
140
+ exists,
141
+ isActive,
142
+ addCallback,
143
+ executeGroupCallbacksFor,
144
+ _hasCallbackFor,
145
+ _executeCallbacksFor,
146
+ _createPopover,
147
+ _getAnchorPosition,
148
+ _setPopoverPosition,
149
+ _setPositionLabel,
150
+ _popoverIsWithinViewport,
151
+ _debug;
152
+
153
+ defaults = {
154
+ trigger: "hover",
155
+ position: "right center",
156
+ alternativePositions: [],
157
+ offsetX: 10,
158
+ offsetY: 10,
159
+ popoverClass: "",
160
+ cssTransitionSupport: true,
161
+ allowParallelUse: true,
162
+ debug: true
163
+ };
164
+
165
+ initialize = function initialize() {
166
+ if (this.$anchorElement.length === 0) {
167
+ if (this.options.debug) {
168
+ console.error("Attache: missing anchor element");
169
+ }
170
+
171
+ return;
172
+ }
173
+
174
+ if (typeof this.options.group !== 'undefined') {
175
+ Attache.registerGroupMember(this);
176
+ }
177
+ };
178
+
179
+ /**
180
+ * Show the popover. Create the markup first if it does not exist yet
181
+ *
182
+ * @memberOf Attache
183
+ * @public
184
+ */
185
+ show = function show() {
186
+ var that = this;
187
+
188
+ if ( !this.exists() ) {
189
+ _createPopover.call(this);
190
+ }
191
+
192
+ _executeCallbacksFor.call(this, 'beforeShow', this.$anchorElement, this.$popover);
193
+
194
+ this.$popover.addClass('activating');
195
+
196
+ // use a timeout to make sure adding and removing .activating is not
197
+ // coalesced into a single step
198
+ setTimeout(function(){
199
+ that.$popover.removeClass('activating').addClass('active');
200
+
201
+ that.positionPopover();
202
+
203
+ _executeCallbacksFor.call(this, 'afterShow', this.$anchorElement, this.$popover);
204
+ }.bind(this), 1);
205
+ };
206
+
207
+ hide = function hide() {
208
+ var that = this;
209
+
210
+ if (!this.isActive()) {
211
+ return false;
212
+ }
213
+
214
+ this.$popover.removeClass('active');
215
+
216
+ if (this.options.cssTransitionSupport) {
217
+ this.$popover.addClass('deactivating');
218
+
219
+ this.$popover.one('transitionEnd webkitTransitionEnd', function() {
220
+ that.$popover.removeClass('deactivating');
221
+ });
222
+ }
223
+ };
224
+
225
+ /**
226
+ * Create the popover markup in the DOM
227
+ *
228
+ * @memberOf Attache
229
+ * @private
230
+ */
231
+ _createPopover = function _createPopover() {
232
+ this.$popover = $('<div class="attache-popover"></div>').addClass(this.options.popoverClass);
233
+
234
+ this.$popover.html(this.content);
235
+
236
+ $('body').append(this.$popover);
237
+ _executeCallbacksFor.call(this, 'afterCreate', this.$anchorElement, this.$popover);
238
+ };
239
+
240
+ /**
241
+ * Position or reposition the popover. If positioning fails, i.e. the popover is off-viewport, retry with options.alternativePositions
242
+ *
243
+ * @memberOf Attache
244
+ * @public
245
+ * @param {String} positionLabel Where to position the popover. One of either "{left|center|right} {top|center|bottom}", e.g. "right bottom"
246
+ *
247
+ * @example
248
+ * popover.positionPopover('left top');
249
+ */
250
+ positionPopover = function positionPopover(positionLabel) {
251
+ var that = this,
252
+ success = false,
253
+ position;
254
+
255
+ if (typeof positionLabel === 'undefined') {
256
+ positionLabel = this.currentPositionLabel;
257
+ }
258
+
259
+ _setPopoverPosition.call(this, positionLabel);
260
+
261
+ if (_popoverIsWithinViewport.call(this) || this.options.alternativePositions.length === 0) {
262
+ return;
263
+ }
264
+
265
+ this.options.alternativePositions.every(function(alternativePositionLabel) {
266
+ _debug.call(that, "trying alternative position %s", alternativePositionLabel);
267
+
268
+ _setPopoverPosition.call(that, alternativePositionLabel);
269
+
270
+ // cancel the loop when we found a position that fits
271
+ if ( _popoverIsWithinViewport.call(that) ) {
272
+ success = true;
273
+ return false;
274
+ }
275
+
276
+ return true;
277
+ });
278
+
279
+ if (this.options.debug && !success) {
280
+ console.warn("Attache failed to position popover within viewport. Giving up.");
281
+ }
282
+
283
+ };
284
+
285
+ _setPositionLabel = function _setPositionLabel(newPositionLabel) {
286
+ var oldHorizontalLabel = "horizontal-" + this.currentPositionLabel.split(' ')[0],
287
+ oldVerticalLabel = "vertical-" + this.currentPositionLabel.split(' ')[1],
288
+ newHorizontalLabel = "horizontal-" + newPositionLabel.split(' ')[0],
289
+ newVerticalLabel = "vertical-" + newPositionLabel.split(' ')[1];
290
+
291
+ this.$popover.removeClass( oldHorizontalLabel + " " + oldVerticalLabel )
292
+ .addClass( newHorizontalLabel + " " + newVerticalLabel );
293
+
294
+ this.currentPositionLabel = newPositionLabel;
295
+ };
296
+
297
+ /**
298
+ * The top left and bottom right coordinates of the anchor element. Relative to the document, ignores element margin.
299
+ *
300
+ * @memberOf Attache
301
+ * @private
302
+ * @returns {Object} - {
303
+ * topleft: { x: x, y: y},
304
+ * bottomright: { x: x, y: y}
305
+ * }
306
+ */
307
+ _getAnchorPosition = function _getAnchorPosition() {
308
+ var a = this.$anchorElement,
309
+ offset = a.offset(),
310
+ width = a.outerWidth(false),
311
+ height = a.outerHeight(false);
312
+
313
+ return {
314
+ topleft: {
315
+ x: offset.left,
316
+ y: offset.top
317
+ },
318
+ bottomright: {
319
+ x: offset.left + width,
320
+ y: offset.top + height
321
+ }
322
+ };
323
+ };
324
+
325
+ /**
326
+ * Calculate the popovers' desired offset and set it
327
+ *
328
+ * @memberOf Attache
329
+ * @private
330
+ * @param {String} positionLabel Where to position the popover. One of either "{left|center|right} {top|center|bottom}", e.g. "right bottom"
331
+ */
332
+ _setPopoverPosition = function _setPopoverPosition(positionLabel) {
333
+ var horizontalPosition = positionLabel.split(" ")[0],
334
+ verticalPosition = positionLabel.split(" ")[1],
335
+ anchorPosition = _getAnchorPosition.call(this),
336
+ popoverWidth = this.$popover.outerWidth(false),
337
+ popoverHeight = this.$popover.outerHeight(false),
338
+ x,
339
+ y;
340
+
341
+ switch (horizontalPosition) {
342
+ case 'left':
343
+ x = anchorPosition.topleft.x - popoverWidth - this.options.offsetX;
344
+ break;
345
+
346
+ case 'center':
347
+ var anchorHalfWidth = Math.round( (anchorPosition.bottomright.x - anchorPosition.topleft.x) / 2 ),
348
+ popoverHalfWidth = Math.round(popoverWidth / 2);
349
+
350
+ x = anchorPosition.topleft.x + anchorHalfWidth - popoverHalfWidth;
351
+ break;
352
+
353
+ case 'right':
354
+ x = anchorPosition.bottomright.x + this.options.offsetX;
355
+ break;
356
+ }
357
+
358
+ switch (verticalPosition) {
359
+ case 'top':
360
+ y = anchorPosition.topleft.y - this.options.offsetY - popoverHeight;
361
+ break;
362
+
363
+ case 'center':
364
+ var anchorHalfHeight = Math.round( (anchorPosition.bottomright.y - anchorPosition.topleft.y) / 2 ),
365
+ popoverHalfHeight = Math.round(popoverHeight / 2);
366
+
367
+ y = anchorPosition.topleft.y + anchorHalfHeight - popoverHalfHeight;
368
+ break;
369
+
370
+ case 'bottom':
371
+ y = anchorPosition.bottomright.y + this.options.offsetY;
372
+ break;
373
+ }
374
+
375
+ _debug.call(this, "Positioning popover to %s - x: %s y: %s", positionLabel, x, y);
376
+
377
+ this.$popover.css({ top: y, left: x });
378
+ _setPositionLabel.call(this, positionLabel);
379
+ };
380
+
381
+ /**
382
+ * checks whether the popover is currently completely visible within the viewport
383
+ *
384
+ * @memberOf Attache
385
+ * @private
386
+ * @returns {Boolean}
387
+ */
388
+ _popoverIsWithinViewport = function _popoverIsWithinViewport() {
389
+ var rect = this.$popover.get(0).getBoundingClientRect();
390
+
391
+ return (
392
+ rect.top >= 0 &&
393
+ rect.left >= 0 &&
394
+ rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
395
+ rect.right <= (window.innerWidth || document.documentElement.clientWidth)
396
+ );
397
+ };
398
+
399
+ /**
400
+ * Write a debug message to console if debugging is enabled
401
+ *
402
+ * @memberOf Attache
403
+ * @private
404
+ * @param {...mixed} - all arguments are handed to console.log
405
+ */
406
+ _debug = function _debug() {
407
+ if (this.options.debug) {
408
+ console.log.apply( console, Array.prototype.slice.call(arguments) );
409
+ }
410
+ };
411
+
412
+ /**
413
+ * A jQuery object of the popover markup in the DOM
414
+ *
415
+ * @memberOf Attache
416
+ * @public
417
+ * @returns {jQuery}
418
+ */
419
+ popover = function popover() {
420
+ if ( !this.exists() ) {
421
+ _createPopover.call(this);
422
+ }
423
+
424
+ return this.$popover;
425
+ };
426
+
427
+ /**
428
+ * Does the popover markup exist in the DOM?
429
+ *
430
+ * @memberOf Attache
431
+ * @public
432
+ * @returns {Boolean}
433
+ */
434
+ exists = function exists() {
435
+ return typeof this.$popover !== 'undefined' && this.$popover.length === 1;
436
+ };
437
+
438
+ /**
439
+ * Is this popover currently active?
440
+ *
441
+ * @memberOf Attache
442
+ * @public
443
+ * @returns {Boolean}
444
+ */
445
+ isActive = function isActive() {
446
+ return this.exists() && this.$popover.hasClass('active');
447
+ };
448
+
449
+ /**
450
+ * Modifies the content markup of the popover
451
+ *
452
+ * @memberOf Attache
453
+ * @public
454
+ * @param {String} content
455
+ */
456
+ setContent = function setContent(content) {
457
+ this.content = content;
458
+
459
+ if (this.exists()) {
460
+ this.$popover.html(this.content);
461
+ }
462
+ };
463
+
464
+ /**
465
+ * Hide the popover, remove it from DOM and remove event handlers from the anchor element
466
+ *
467
+ * @memberOf Attache
468
+ * @public
469
+ */
470
+ destroy = function destroy() {
471
+ Attache.unregisterGroupMember(this);
472
+
473
+ if ( !this.exists() ) {
474
+ return false;
475
+ }
476
+
477
+ this.$popover.remove();
478
+ };
479
+
480
+ /**
481
+ * Add a callback that is executed at trigger
482
+ *
483
+ * @memberOf Attache
484
+ * @public
485
+ * @param {String} trigger - at what point in the lifecycle to trigger the callback
486
+ * @param {Function} callback
487
+ */
488
+ addCallback = function addCallback(trigger, callback) {
489
+ if (typeof this.callbacks[trigger] === 'undefined') {
490
+ _debug.call(this, "Warning: unknown callback %s will never be triggered", trigger);
491
+ return false;
492
+ }
493
+
494
+ this.callbacks[trigger].push(callback);
495
+ };
496
+
497
+ /**
498
+ * Tests whether one or more callbacks are available for the given trigger
499
+ *
500
+ * @memberOf Attache
501
+ * @private
502
+ * @param {String} trigger
503
+ * @returns {Boolean}
504
+ */
505
+ _hasCallbackFor = function _hasCallbackFor(trigger) {
506
+ return typeof this.callbacks[trigger] !== 'undefined' && this.callbacks[trigger].length > 0;
507
+ };
508
+
509
+ /**
510
+ * Execute all callbacks for a given trigger
511
+ *
512
+ * @memberOf Attache
513
+ * @private
514
+ * @param {String} trigger
515
+ * @param {...mixed} arguments - arguments to be handed to the callbacks
516
+ */
517
+ _executeCallbacksFor = function _executeCallbacksFor(trigger) {
518
+ var that = this,
519
+ callbackArguments = Array.prototype.slice.call(arguments);
520
+
521
+ // remove the trigger name
522
+ callbackArguments.shift();
523
+
524
+ if (_hasCallbackFor.call(this, trigger)) {
525
+ this.callbacks[trigger].forEach(function(cb) { cb.apply(that, callbackArguments); });
526
+ }
527
+
528
+ if (typeof this.options.group !== 'undefined') {
529
+ Attache.notifyGroupMembers(trigger, this);
530
+ }
531
+ };
532
+
533
+ /**
534
+ * Execute callbacks triggered by other group members
535
+ *
536
+ * @memberOf Attache
537
+ * @public
538
+ * @param {String} trigger
539
+ * @param {Attache} instance The group member that triggered the callback
540
+ */
541
+ executeGroupCallbacksFor = function executeGroupCallbacksFor(trigger, instance) {
542
+ var that = this;
543
+
544
+ // "beforeShow" -> "groupMemberBeforeShow"
545
+ trigger = "groupMember" + trigger.charAt(0).toUpperCase() + trigger.slice(1);
546
+
547
+ if (_hasCallbackFor.call(this, trigger)) {
548
+ this.callbacks[trigger].forEach(function(cb) { cb.call(that, instance); });
549
+ }
550
+ };
551
+
552
+ return {
553
+ defaults: defaults,
554
+ initialize: initialize,
555
+ show: show,
556
+ hide: hide,
557
+ popover: popover,
558
+ exists: exists,
559
+ isActive: isActive,
560
+ setContent: setContent,
561
+ positionPopover: positionPopover,
562
+ destroy: destroy,
563
+ addCallback: addCallback,
564
+ executeGroupCallbacksFor: executeGroupCallbacksFor
565
+ };
566
+ })();
567
+
568
+ return Attache;
569
+ }));
570
+
571
+ /**
572
+ * Callback called after the popover markup has been created
573
+ *
574
+ * @callback afterCreateCallback
575
+ * @this Attache
576
+ *
577
+ * @param {jQuery} anchorElement
578
+ * @param {jQuery} popoverElement
579
+ */
580
+
581
+ /**
582
+ * Callback called after a popover has been displayed
583
+ *
584
+ * @callback afterShowCallback
585
+ * @this Attache
586
+ *
587
+ * @param {jQuery} anchorElement
588
+ * @param {jQuery} popoverElement
589
+ */
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "attachejs",
3
+ "version": "0.1.8",
4
+ "homepage": "https://github.com/janfoeh/attachejs",
5
+ "authors": [
6
+ "Jan-Christian Foeh <jan@programmanstalt.de>"
7
+ ],
8
+ "description": "Attaché is a JS library for tooltips and palette UI elements",
9
+ "main": [
10
+ "attache.js",
11
+ "attache-jquery.js",
12
+ "attache-knockout.js",
13
+ "attache.css"
14
+ ],
15
+ "keywords": [
16
+ "tooltip",
17
+ "popover",
18
+ "palette"
19
+ ],
20
+ "license": "MIT",
21
+ "ignore": [
22
+ "**/.*",
23
+ "node_modules",
24
+ "bower_components",
25
+ "Gemfile*",
26
+ "Gruntfile.js",
27
+ "package.json",
28
+ "attache.sublime-project",
29
+ "LICENSE",
30
+ "README.md",
31
+ "test",
32
+ "tests",
33
+ "doc",
34
+ "sass"
35
+ ]
36
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "humane-js",
3
+ "version": "3.2.2",
4
+ "author": "Marc Harter <@wavded> (wavded.com)",
5
+ "description": "A simple, modern, browser notification system",
6
+ "keywords": [ "notification", "alert" ],
7
+ "main":"./humane.min.js"
8
+ }