semantic-ui-rails 0.6.5 → 0.7.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -0
  3. data/lib/semantic/ui/rails/version.rb +1 -1
  4. data/vendor/assets/javascripts/semantic-ui/modules/accordion.js +13 -16
  5. data/vendor/assets/javascripts/semantic-ui/modules/behavior/api.js +18 -22
  6. data/vendor/assets/javascripts/semantic-ui/modules/behavior/form.js +18 -24
  7. data/vendor/assets/javascripts/semantic-ui/modules/behavior/state.js +8 -8
  8. data/vendor/assets/javascripts/semantic-ui/modules/chatroom.js +18 -14
  9. data/vendor/assets/javascripts/semantic-ui/modules/checkbox.js +26 -24
  10. data/vendor/assets/javascripts/semantic-ui/modules/dimmer.js +70 -48
  11. data/vendor/assets/javascripts/semantic-ui/modules/dropdown.js +47 -46
  12. data/vendor/assets/javascripts/semantic-ui/modules/modal.js +44 -30
  13. data/vendor/assets/javascripts/semantic-ui/modules/nag.js +13 -16
  14. data/vendor/assets/javascripts/semantic-ui/modules/popup.js +347 -261
  15. data/vendor/assets/javascripts/semantic-ui/modules/rating.js +18 -22
  16. data/vendor/assets/javascripts/semantic-ui/modules/search.js +18 -24
  17. data/vendor/assets/javascripts/semantic-ui/modules/shape.js +182 -173
  18. data/vendor/assets/javascripts/semantic-ui/modules/sidebar.js +65 -42
  19. data/vendor/assets/javascripts/semantic-ui/modules/tab.js +47 -30
  20. data/vendor/assets/javascripts/semantic-ui/modules/transition.js +23 -23
  21. data/vendor/assets/javascripts/semantic-ui/modules/video.js +18 -22
  22. data/vendor/assets/stylesheets/semantic-ui/collections/grid.less +1 -1
  23. data/vendor/assets/stylesheets/semantic-ui/collections/menu.less +8 -3
  24. data/vendor/assets/stylesheets/semantic-ui/collections/message.less +6 -7
  25. data/vendor/assets/stylesheets/semantic-ui/collections/table.less +76 -23
  26. data/vendor/assets/stylesheets/semantic-ui/elements/button.less +163 -167
  27. data/vendor/assets/stylesheets/semantic-ui/elements/header.less +1 -1
  28. data/vendor/assets/stylesheets/semantic-ui/elements/icon.less +8 -10
  29. data/vendor/assets/stylesheets/semantic-ui/elements/input.less +0 -2
  30. data/vendor/assets/stylesheets/semantic-ui/elements/label.less +54 -5
  31. data/vendor/assets/stylesheets/semantic-ui/elements/segment.less +0 -9
  32. data/vendor/assets/stylesheets/semantic-ui/modules/accordion.less +197 -198
  33. data/vendor/assets/stylesheets/semantic-ui/modules/checkbox.less +17 -21
  34. data/vendor/assets/stylesheets/semantic-ui/modules/dimmer.less +4 -27
  35. data/vendor/assets/stylesheets/semantic-ui/modules/dropdown.less +28 -28
  36. data/vendor/assets/stylesheets/semantic-ui/modules/popup.less +255 -255
  37. data/vendor/assets/stylesheets/semantic-ui/modules/rating.less +1 -1
  38. data/vendor/assets/stylesheets/semantic-ui/modules/shape.less +81 -7
  39. data/vendor/assets/stylesheets/semantic-ui/modules/sidebar.less +129 -28
  40. data/vendor/assets/stylesheets/semantic-ui/modules/transition.less +12 -10
  41. data/vendor/assets/stylesheets/semantic-ui/views/list.less +6 -6
  42. metadata +2 -2
@@ -22,7 +22,7 @@ $.fn.nag = function(parameters) {
22
22
  query = arguments[0],
23
23
  methodInvoked = (typeof query == 'string'),
24
24
  queryArguments = [].slice.call(arguments, 1),
25
- invokedResponse
25
+ returnedValue
26
26
  ;
27
27
  $(this)
28
28
  .each(function() {
@@ -299,14 +299,11 @@ $.fn.nag = function(parameters) {
299
299
  }
300
300
  },
301
301
  setting: function(name, value) {
302
- module.debug('Changing setting', name, value);
303
- if(value !== undefined) {
304
- if( $.isPlainObject(name) ) {
305
- $.extend(true, settings, name);
306
- }
307
- else {
308
- settings[name] = value;
309
- }
302
+ if( $.isPlainObject(name) ) {
303
+ $.extend(true, settings, name);
304
+ }
305
+ else if(value !== undefined) {
306
+ settings[name] = value;
310
307
  }
311
308
  else {
312
309
  return settings[name];
@@ -448,14 +445,14 @@ $.fn.nag = function(parameters) {
448
445
  else if(found !== undefined) {
449
446
  response = found;
450
447
  }
451
- if($.isArray(invokedResponse)) {
452
- invokedResponse.push(response);
448
+ if($.isArray(returnedValue)) {
449
+ returnedValue.push(response);
453
450
  }
454
- else if(typeof invokedResponse == 'string') {
455
- invokedResponse = [invokedResponse, response];
451
+ else if(returnedValue !== undefined) {
452
+ returnedValue = [returnedValue, response];
456
453
  }
457
454
  else if(response !== undefined) {
458
- invokedResponse = response;
455
+ returnedValue = response;
459
456
  }
460
457
  return found;
461
458
  }
@@ -475,8 +472,8 @@ $.fn.nag = function(parameters) {
475
472
 
476
473
  })
477
474
  ;
478
- return (invokedResponse !== undefined)
479
- ? invokedResponse
475
+ return (returnedValue !== undefined)
476
+ ? returnedValue
480
477
  : this
481
478
  ;
482
479
  };
@@ -15,6 +15,7 @@ $.fn.popup = function(parameters) {
15
15
  var
16
16
  $allModules = $(this),
17
17
  $document = $(document),
18
+ $body = $('body'),
18
19
 
19
20
  moduleSelector = $allModules.selector || '',
20
21
 
@@ -25,7 +26,7 @@ $.fn.popup = function(parameters) {
25
26
  methodInvoked = (typeof query == 'string'),
26
27
  queryArguments = [].slice.call(arguments, 1),
27
28
 
28
- invokedResponse
29
+ returnedValue
29
30
  ;
30
31
  $allModules
31
32
  .each(function() {
@@ -44,11 +45,17 @@ $.fn.popup = function(parameters) {
44
45
  moduleNamespace = 'module-' + namespace,
45
46
 
46
47
  $module = $(this),
48
+ $target = (settings.target)
49
+ ? $(settings.target)
50
+ : $module,
47
51
 
48
52
  $window = $(window),
49
- $offsetParent = $module.offsetParent(),
53
+
54
+ $offsetParent = (settings.inline)
55
+ ? $target.offsetParent()
56
+ : $window,
50
57
  $popup = (settings.inline)
51
- ? $module.next(settings.selector.popup)
58
+ ? $target.next(settings.selector.popup)
52
59
  : $window.children(settings.selector.popup).last(),
53
60
 
54
61
  searchDepth = 0,
@@ -63,17 +70,20 @@ $.fn.popup = function(parameters) {
63
70
  // binds events
64
71
  initialize: function() {
65
72
  module.debug('Initializing module', $module);
66
- if(settings.on == 'hover') {
73
+ if(settings.on == 'click') {
67
74
  $module
68
- .on('mouseenter' + eventNamespace, module.event.mouseenter)
69
- .on('mouseleave' + eventNamespace, module.event.mouseleave)
75
+ .on('click', module.toggle)
70
76
  ;
71
77
  }
72
78
  else {
73
79
  $module
74
- .on(settings.on + '' + eventNamespace, module.event[settings.on])
80
+ .on(module.get.startEvent() + eventNamespace, module.event.start)
81
+ .on(module.get.endEvent() + eventNamespace, module.event.end)
75
82
  ;
76
83
  }
84
+ if(settings.target) {
85
+ module.debug('Target set to element', $target);
86
+ }
77
87
  $window
78
88
  .on('resize' + eventNamespace, module.event.resize)
79
89
  ;
@@ -89,11 +99,14 @@ $.fn.popup = function(parameters) {
89
99
  },
90
100
 
91
101
  refresh: function() {
92
- $popup = (settings.inline)
93
- ? $module.next(selector.popup)
94
- : $window.children(selector.popup).last()
95
- ;
96
- $offsetParent = $module.offsetParent();
102
+ if(settings.inline) {
103
+ $popup = $target.next(selector.popup);
104
+ $offsetParent = $target.offsetParent();
105
+ }
106
+ else {
107
+ console.log('found by refresh');
108
+ $popup = $window.children(selector.popup).last();
109
+ }
97
110
  },
98
111
 
99
112
  destroy: function() {
@@ -101,6 +114,9 @@ $.fn.popup = function(parameters) {
101
114
  $window
102
115
  .off(eventNamespace)
103
116
  ;
117
+ $popup
118
+ .remove()
119
+ ;
104
120
  $module
105
121
  .off(eventNamespace)
106
122
  .removeData(moduleNamespace)
@@ -108,30 +124,22 @@ $.fn.popup = function(parameters) {
108
124
  },
109
125
 
110
126
  event: {
111
- mouseenter: function(event) {
112
- var element = this;
127
+ start: function(event) {
113
128
  module.timer = setTimeout(function() {
114
- $.proxy(module.toggle, element)();
115
- if( $(element).hasClass(className.visible) ) {
116
- event.stopPropagation();
129
+ if( module.is.hidden() ) {
130
+ module.show();
117
131
  }
118
132
  }, settings.delay);
119
133
  },
120
- mouseleave: function() {
134
+ end: function() {
121
135
  clearTimeout(module.timer);
122
- if( $module.is(':visible') ) {
136
+ if( module.is.visible() ) {
123
137
  module.hide();
124
138
  }
125
139
  },
126
- click: function(event) {
127
- $.proxy(module.toggle, this)();
128
- if( $(this).hasClass(className.visible) ) {
129
- event.stopPropagation();
130
- }
131
- },
132
140
  resize: function() {
133
- if( $popup.is(':visible') ) {
134
- module.position();
141
+ if( module.is.visible() ) {
142
+ module.set.position();
135
143
  }
136
144
  }
137
145
  },
@@ -166,7 +174,7 @@ $.fn.popup = function(parameters) {
166
174
  else {
167
175
  module.verbose('Appending popup element to body', $popup);
168
176
  $popup
169
- .appendTo( $('body') )
177
+ .appendTo( $body )
170
178
  ;
171
179
  }
172
180
  $.proxy(settings.onCreate, $popup)();
@@ -176,6 +184,66 @@ $.fn.popup = function(parameters) {
176
184
  }
177
185
  },
178
186
 
187
+ // determines popup state
188
+ toggle: function() {
189
+ module.debug('Toggling pop-up');
190
+ if( module.is.hidden() ) {
191
+ module.hideAll();
192
+ module.show();
193
+ }
194
+ else {
195
+ module.hide();
196
+ }
197
+ },
198
+
199
+ show: function(callback) {
200
+ callback = callback || function(){};
201
+ module.debug('Showing pop-up', settings.transition);
202
+ if(!settings.preserve) {
203
+ module.refresh();
204
+ }
205
+ if( !module.exists() ) {
206
+ module.create();
207
+ }
208
+ module.set.position();
209
+ module.animate.show(callback);
210
+ },
211
+
212
+
213
+ hide: function(callback) {
214
+ callback = callback || function(){};
215
+ $module
216
+ .removeClass(className.visible)
217
+ ;
218
+ module.unbind.close();
219
+ if( module.is.visible() ) {
220
+ module.animate.hide(callback);
221
+ }
222
+ },
223
+
224
+ hideAll: function() {
225
+ $(selector.popup)
226
+ .filter(':visible')
227
+ .popup('hide')
228
+ ;
229
+ },
230
+
231
+ hideGracefully: function(event) {
232
+ // don't close on clicks inside popup
233
+ if( $(event.target).closest(selector.popup).size() === 0) {
234
+ module.hide();
235
+ }
236
+ },
237
+
238
+ exists: function() {
239
+ if(settings.inline) {
240
+ return ( $popup.size() !== 0 );
241
+ }
242
+ else {
243
+ return ( $popup.parent($body).size() );
244
+ }
245
+ },
246
+
179
247
  remove: function() {
180
248
  module.debug('Removing popup');
181
249
  $popup
@@ -183,7 +251,72 @@ $.fn.popup = function(parameters) {
183
251
  ;
184
252
  },
185
253
 
254
+ animate: {
255
+ show: function(callback) {
256
+ callback = callback || function(){};
257
+ $module
258
+ .addClass(className.visible)
259
+ ;
260
+ if(settings.transition && $.fn.transition !== undefined) {
261
+ $popup
262
+ .transition(settings.transition + ' in', settings.duration, function() {
263
+ module.bind.close();
264
+ $.proxy(callback, element)();
265
+ })
266
+ ;
267
+ }
268
+ else {
269
+ $popup
270
+ .stop()
271
+ .fadeIn(settings.duration, settings.easing, function() {
272
+ module.bind.close();
273
+ $.proxy(callback, element)();
274
+ })
275
+ ;
276
+ }
277
+ $.proxy(settings.onShow, element)();
278
+ },
279
+ hide: function(callback) {
280
+ callback = callback || function(){};
281
+ module.debug('Hiding pop-up');
282
+ if(settings.transition && $.fn.transition !== undefined) {
283
+ $popup
284
+ .transition(settings.transition + ' out', settings.duration, function() {
285
+ module.reset();
286
+ callback();
287
+ })
288
+ ;
289
+ }
290
+ else {
291
+ $popup
292
+ .stop()
293
+ .fadeOut(settings.duration, settings.easing, function() {
294
+ module.reset();
295
+ callback();
296
+ })
297
+ ;
298
+ }
299
+ $.proxy(settings.onHide, element)();
300
+ }
301
+ },
302
+
186
303
  get: {
304
+ startEvent: function() {
305
+ if(settings.on == 'hover') {
306
+ return 'mouseenter';
307
+ }
308
+ else if(settings.on == 'focus') {
309
+ return 'focus';
310
+ }
311
+ },
312
+ endEvent: function() {
313
+ if(settings.on == 'hover') {
314
+ return 'mouseleave';
315
+ }
316
+ else if(settings.on == 'focus') {
317
+ return 'blur';
318
+ }
319
+ },
187
320
  offstagePosition: function() {
188
321
  var
189
322
  boundary = {
@@ -251,250 +384,201 @@ $.fn.popup = function(parameters) {
251
384
  }
252
385
  },
253
386
 
254
- // determines popup state
255
- toggle: function() {
256
- $module = $(this);
257
- module.debug('Toggling pop-up');
258
- // refresh state of module
259
- module.refresh();
260
- if( !$module.hasClass(className.visible) ) {
261
- if(settings.on == 'click') {
262
- module.hideAll();
263
- }
264
- module.show();
265
- }
266
- else {
267
- // module.hide();
268
- }
269
- },
387
+ set: {
388
+ position: function(position, arrowOffset) {
389
+ var
390
+ windowWidth = $(window).width(),
391
+ windowHeight = $(window).height(),
270
392
 
271
- position: function(position, arrowOffset) {
272
- var
273
- windowWidth = $(window).width(),
274
- windowHeight = $(window).height(),
275
- width = $module.outerWidth(),
276
- height = $module.outerHeight(),
277
- popupWidth = $popup.width(),
278
- popupHeight = $popup.outerHeight(),
279
-
280
- offset = (settings.inline)
281
- ? $module.position()
282
- : $module.offset(),
283
- parentWidth = (settings.inline)
284
- ? $offsetParent.outerWidth()
285
- : $window.outerWidth(),
286
- parentHeight = (settings.inline)
287
- ? $offsetParent.outerHeight()
288
- : $window.outerHeight(),
289
-
290
- positioning,
291
- offstagePosition
292
- ;
293
- position = position || $module.data(metadata.position) || settings.position;
294
- arrowOffset = arrowOffset || $module.data(metadata.arrowOffset) || settings.arrowOffset;
295
- module.debug('Calculating offset for position', position);
296
- switch(position) {
297
- case 'top left':
298
- positioning = {
299
- bottom : parentHeight - offset.top + settings.distanceAway,
300
- right : parentWidth - offset.left - width - arrowOffset,
301
- top : 'auto',
302
- left : 'auto'
303
- };
304
- break;
305
- case 'top center':
306
- positioning = {
307
- bottom : parentHeight - offset.top + settings.distanceAway,
308
- left : offset.left + (width / 2) - (popupWidth / 2) + arrowOffset,
309
- top : 'auto',
310
- right : 'auto'
311
- };
312
- break;
313
- case 'top right':
314
- positioning = {
315
- top : 'auto',
316
- bottom : parentHeight - offset.top + settings.distanceAway,
317
- left : offset.left + arrowOffset
318
- };
319
- break;
320
- case 'left center':
321
- positioning = {
322
- top : offset.top + (height / 2) - (popupHeight / 2),
323
- right : parentWidth - offset.left + settings.distanceAway - arrowOffset,
324
- left : 'auto',
325
- bottom : 'auto'
326
- };
327
- break;
328
- case 'right center':
329
- positioning = {
330
- top : offset.top + (height / 2) - (popupHeight / 2),
331
- left : offset.left + width + settings.distanceAway + arrowOffset,
332
- bottom : 'auto',
333
- right : 'auto'
334
- };
335
- break;
336
- case 'bottom left':
337
- positioning = {
338
- top : offset.top + height + settings.distanceAway,
339
- right : parentWidth - offset.left - width - arrowOffset,
340
- left : 'auto',
341
- bottom : 'auto'
342
- };
343
- break;
344
- case 'bottom center':
345
- positioning = {
346
- top : offset.top + height + settings.distanceAway,
347
- left : offset.left + (width / 2) - (popupWidth / 2) + arrowOffset,
348
- bottom : 'auto',
349
- right : 'auto'
350
- };
351
- break;
352
- case 'bottom right':
353
- positioning = {
354
- top : offset.top + height + settings.distanceAway,
355
- left : offset.left + arrowOffset,
356
- bottom : 'auto',
357
- right : 'auto'
358
- };
359
- break;
360
- }
361
- // true width on popup, avoid rounding error
362
- $.extend(positioning, {
363
- width: $popup.width() + 1
364
- });
365
- // tentatively place on stage
366
- $popup
367
- .css(positioning)
368
- .removeClass(className.position)
369
- .addClass(position)
370
- ;
371
- // check if is offstage
372
- offstagePosition = module.get.offstagePosition();
373
- // recursively find new positioning
374
- if(offstagePosition) {
375
- module.debug('Element is outside boundaries ', offstagePosition);
376
- if(searchDepth < settings.maxSearchDepth) {
377
- position = module.get.nextPosition(position);
378
- searchDepth++;
379
- module.debug('Trying new position: ', position);
380
- return module.position(position);
381
- }
382
- else {
383
- module.error(error.recursion);
384
- searchDepth = 0;
385
- return false;
386
- }
387
- }
388
- else {
389
- module.debug('Position is on stage', position);
390
- searchDepth = 0;
391
- return true;
392
- }
393
- },
393
+ width = $target.outerWidth(),
394
+ height = $target.outerHeight(),
394
395
 
395
- show: function() {
396
- module.debug('Showing pop-up', settings.transition);
397
- if($popup.size() === 0) {
398
- module.create();
399
- }
400
- module.position();
401
- $module
402
- .addClass(className.visible)
403
- ;
404
- if(settings.transition && $.fn.transition !== undefined) {
405
- $popup
406
- .transition(settings.transition + ' in', settings.duration)
396
+ popupWidth = $popup.width(),
397
+ popupHeight = $popup.outerHeight(),
398
+
399
+ parentWidth = $offsetParent.outerWidth(),
400
+ parentHeight = $offsetParent.outerHeight(),
401
+
402
+ distanceAway = settings.distanceAway,
403
+
404
+ offset = (settings.inline)
405
+ ? $target.position()
406
+ : $target.offset(),
407
+
408
+ positioning,
409
+ offstagePosition
407
410
  ;
408
- }
409
- else {
411
+ position = position || $module.data(metadata.position) || settings.position;
412
+ arrowOffset = arrowOffset || $module.data(metadata.offset) || settings.offset;
413
+ // adjust for margin when inline
414
+ if(settings.inline) {
415
+ if(position == 'left center' || position == 'right center') {
416
+ arrowOffset += parseInt( window.getComputedStyle(element).getPropertyValue('margin-top'), 10);
417
+ distanceAway += -parseInt( window.getComputedStyle(element).getPropertyValue('margin-left'), 10);
418
+ }
419
+ else {
420
+ arrowOffset += parseInt( window.getComputedStyle(element).getPropertyValue('margin-left'), 10);
421
+ distanceAway += parseInt( window.getComputedStyle(element).getPropertyValue('margin-top'), 10);
422
+ }
423
+ }
424
+ module.debug('Calculating offset for position', position);
425
+ switch(position) {
426
+ case 'top left':
427
+ positioning = {
428
+ bottom : parentHeight - offset.top + distanceAway,
429
+ right : parentWidth - offset.left - arrowOffset,
430
+ top : 'auto',
431
+ left : 'auto'
432
+ };
433
+ break;
434
+ case 'top center':
435
+ positioning = {
436
+ bottom : parentHeight - offset.top + distanceAway,
437
+ left : offset.left + (width / 2) - (popupWidth / 2) + arrowOffset,
438
+ top : 'auto',
439
+ right : 'auto'
440
+ };
441
+ break;
442
+ case 'top right':
443
+ positioning = {
444
+ top : 'auto',
445
+ bottom : parentHeight - offset.top + distanceAway,
446
+ left : offset.left + width + arrowOffset,
447
+ right : 'auto'
448
+ };
449
+ break;
450
+ case 'left center':
451
+ positioning = {
452
+ top : offset.top + (height / 2) - (popupHeight / 2) + arrowOffset,
453
+ right : parentWidth - offset.left + distanceAway,
454
+ left : 'auto',
455
+ bottom : 'auto'
456
+ };
457
+ break;
458
+ case 'right center':
459
+ positioning = {
460
+ top : offset.top + (height / 2) - (popupHeight / 2) + arrowOffset,
461
+ left : offset.left + width + distanceAway,
462
+ bottom : 'auto',
463
+ right : 'auto'
464
+ };
465
+ break;
466
+ case 'bottom left':
467
+ positioning = {
468
+ top : offset.top + height + distanceAway,
469
+ right : parentWidth - offset.left - arrowOffset,
470
+ left : 'auto',
471
+ bottom : 'auto'
472
+ };
473
+ break;
474
+ case 'bottom center':
475
+ positioning = {
476
+ top : offset.top + height + distanceAway,
477
+ left : offset.left + (width / 2) - (popupWidth / 2) + arrowOffset,
478
+ bottom : 'auto',
479
+ right : 'auto'
480
+ };
481
+ break;
482
+ case 'bottom right':
483
+ positioning = {
484
+ top : offset.top + height + distanceAway,
485
+ left : offset.left + width + arrowOffset,
486
+ bottom : 'auto',
487
+ right : 'auto'
488
+ };
489
+ break;
490
+ }
491
+ // tentatively place on stage
410
492
  $popup
411
- .stop()
412
- .fadeIn(settings.duration, settings.easing)
413
- ;
414
- }
415
- if(settings.on == 'click' && settings.clicktoClose) {
416
- module.debug('Binding popup close event');
417
- $document
418
- .on('click.' + namespace, module.gracefully.hide)
493
+ .css(positioning)
494
+ .removeClass(className.position)
495
+ .addClass(position)
419
496
  ;
497
+ // check if is offstage
498
+ offstagePosition = module.get.offstagePosition();
499
+
500
+ // recursively find new positioning
501
+ if(offstagePosition) {
502
+ module.debug('Element is outside boundaries', offstagePosition);
503
+ if(searchDepth < settings.maxSearchDepth) {
504
+ position = module.get.nextPosition(position);
505
+ searchDepth++;
506
+ module.debug('Trying new position', position);
507
+ return module.set.position(position);
508
+ }
509
+ else {
510
+ module.error(error.recursion);
511
+ searchDepth = 0;
512
+ return false;
513
+ }
514
+ }
515
+ else {
516
+ module.debug('Position is on stage', position);
517
+ searchDepth = 0;
518
+ return true;
519
+ }
420
520
  }
421
- $.proxy(settings.onShow, $popup)();
422
- },
423
521
 
424
- hideAll: function() {
425
- $(selector.popup)
426
- .filter(':visible')
427
- .popup('hide')
428
- ;
429
522
  },
430
523
 
431
- hide: function() {
432
- $module
433
- .removeClass(className.visible)
434
- ;
435
- if($popup.is(':visible') ) {
436
- module.debug('Hiding pop-up');
437
- if(settings.transition && $.fn.transition !== undefined) {
438
- $popup
439
- .transition(settings.transition + ' out', settings.duration, module.reset)
524
+ bind: {
525
+ close:function() {
526
+ if(settings.on == 'click' && settings.closable) {
527
+ module.verbose('Binding popup close event to document');
528
+ $document
529
+ .on('click' + eventNamespace, module.hideGracefully)
440
530
  ;
441
531
  }
442
- else {
443
- $popup
444
- .stop()
445
- .fadeOut(settings.duration, settings.easing, module.reset)
532
+ }
533
+ },
534
+
535
+ unbind: {
536
+ close: function() {
537
+ if(settings.on == 'click' && settings.closable) {
538
+ module.verbose('Removing close event from document');
539
+ $document
540
+ .off('click' + eventNamespace)
446
541
  ;
447
542
  }
448
543
  }
449
- if(settings.on == 'click' && settings.clicktoClose) {
450
- $document
451
- .off('click.' + namespace)
452
- ;
544
+ },
545
+
546
+ is: {
547
+ visible: function() {
548
+ return $popup.is(':visible');
549
+ },
550
+ hidden: function() {
551
+ return !module.is.visible();
453
552
  }
454
- $.proxy(settings.onHide, $popup)();
455
553
  },
456
554
 
457
555
  reset: function() {
458
- module.verbose('Resetting inline styles');
459
556
  $popup
460
557
  .attr('style', '')
461
558
  .removeAttr('style')
462
559
  ;
463
- if(!settings.inline) {
560
+ if(!settings.preserve) {
464
561
  module.remove();
465
562
  }
466
563
  },
467
564
 
468
- gracefully: {
469
- hide: function(event) {
470
- // don't close on clicks inside popup
471
- if( $(event.target).closest(selector.popup).size() === 0) {
472
- module.hide();
473
- }
474
- }
475
- },
476
-
477
565
  setting: function(name, value) {
478
- if(value !== undefined) {
479
- if( $.isPlainObject(name) ) {
480
- $.extend(true, settings, name);
481
- }
482
- else {
483
- settings[name] = value;
484
- }
566
+ if( $.isPlainObject(name) ) {
567
+ $.extend(true, settings, name);
568
+ }
569
+ else if(value !== undefined) {
570
+ settings[name] = value;
485
571
  }
486
572
  else {
487
573
  return settings[name];
488
574
  }
489
575
  },
490
576
  internal: function(name, value) {
491
- if(value !== undefined) {
492
- if( $.isPlainObject(name) ) {
493
- $.extend(true, module, name);
494
- }
495
- else {
496
- module[name] = value;
497
- }
577
+ if( $.isPlainObject(name) ) {
578
+ $.extend(true, module, name);
579
+ }
580
+ else if(value !== undefined) {
581
+ module[name] = value;
498
582
  }
499
583
  else {
500
584
  return module[name];
@@ -608,7 +692,7 @@ $.fn.popup = function(parameters) {
608
692
  return false;
609
693
  }
610
694
  else {
611
- module.error(error.method);
695
+ module.error(error.method, query);
612
696
  return false;
613
697
  }
614
698
  });
@@ -619,14 +703,14 @@ $.fn.popup = function(parameters) {
619
703
  else if(found !== undefined) {
620
704
  response = found;
621
705
  }
622
- if($.isArray(invokedResponse)) {
623
- invokedResponse.push(response);
706
+ if($.isArray(returnedValue)) {
707
+ returnedValue.push(response);
624
708
  }
625
- else if(typeof invokedResponse == 'string') {
626
- invokedResponse = [invokedResponse, response];
709
+ else if(returnedValue !== undefined) {
710
+ returnedValue = [returnedValue, response];
627
711
  }
628
712
  else if(response !== undefined) {
629
- invokedResponse = response;
713
+ returnedValue = response;
630
714
  }
631
715
  return found;
632
716
  }
@@ -647,8 +731,8 @@ $.fn.popup = function(parameters) {
647
731
  })
648
732
  ;
649
733
 
650
- return (invokedResponse !== undefined)
651
- ? invokedResponse
734
+ return (returnedValue !== undefined)
735
+ ? returnedValue
652
736
  : this
653
737
  ;
654
738
  };
@@ -661,7 +745,7 @@ $.fn.popup.settings = {
661
745
  performance : true,
662
746
  namespace : 'popup',
663
747
 
664
- onCreate : function(){},
748
+ onCreate : function(){},
665
749
  onShow : function(){},
666
750
  onHide : function(){},
667
751
 
@@ -671,18 +755,20 @@ $.fn.popup.settings = {
671
755
  title : false,
672
756
 
673
757
  on : 'hover',
674
- clicktoClose : true,
758
+ target : false,
759
+ closable : true,
675
760
 
676
761
  position : 'top center',
677
762
  delay : 150,
678
- inline : true,
763
+ inline : false,
764
+ preserve : false,
679
765
 
680
- duration : 150,
766
+ duration : 250,
681
767
  easing : 'easeOutQuint',
682
768
  transition : 'scale',
683
769
 
684
770
  distanceAway : 0,
685
- arrowOffset : 0,
771
+ offset : 0,
686
772
  maxSearchDepth : 10,
687
773
 
688
774
  error: {
@@ -692,19 +778,19 @@ $.fn.popup.settings = {
692
778
  },
693
779
 
694
780
  metadata: {
695
- arrowOffset : 'arrowOffset',
696
- content : 'content',
697
- html : 'html',
698
- position : 'position',
699
- title : 'title',
700
- variation : 'variation'
781
+ content : 'content',
782
+ html : 'html',
783
+ offset : 'offset',
784
+ position : 'position',
785
+ title : 'title',
786
+ variation : 'variation'
701
787
  },
702
788
 
703
789
  className : {
704
- popup : 'ui popup',
705
- visible : 'visible',
706
790
  loading : 'loading',
707
- position : 'top left center bottom right'
791
+ popup : 'ui popup',
792
+ position : 'top left center bottom right',
793
+ visible : 'visible'
708
794
  },
709
795
 
710
796
  selector : {