jquery-colorbox-rails 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5273c0e3496877a90a147bff25dde32a44ce3984
4
- data.tar.gz: 6d1e51582522cad5c03467236f9e418163b72301
3
+ metadata.gz: c5299ce0b6899e3d0f5d632d1ca99ede7e60f474
4
+ data.tar.gz: 0dbd3557de15a95bdd2c7e87af92710ba7ec36a5
5
5
  SHA512:
6
- metadata.gz: 2109502face762d5f83482e9bdc21f313ecc32006f97e498a527699015886f78f57b41289b2a66d674a6fa1dcee27c09a9b4f7fcf06e2416568a895702089678
7
- data.tar.gz: f57564400f388f5b2d51a52700f3a47abe7c699cb0656aebfb51486f095efc4b64bc5bfd0f26112f548197bd1006d9af68ccb2a9c266b001b813fc8e73186d18
6
+ metadata.gz: 1e5ad1f0f94e8193ef0c87c3784b34039d4685c63d90b95c1cbe11c51d836acefbdcba6dae624dc4f87c1e979eb8b622f1358ee4706ce809312baad085668c4c
7
+ data.tar.gz: aef61fbfa5c1e3e889e42edf71b20fb1c0fa170d6a4b9bc8ed1cb89c40a6a467e390faba30f402be804d4ac86d289e7415796cef94a42aab46251202edaa6bf6
data/Rakefile CHANGED
@@ -3,6 +3,8 @@ require 'bundler/setup'
3
3
  require 'bundler/gem_tasks'
4
4
 
5
5
  task :update do
6
+ Dir['*.gem'].each{ |f| FileUtils.rm(f) }
7
+
6
8
  js_dir = 'vendor/assets/javascripts'
7
9
  css_dir = 'vendor/assets/stylesheets'
8
10
  img_dir = 'vendor/assets/images'
@@ -1,3 +1,3 @@
1
1
  module JqueryColorboxRails
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
@@ -92,7 +92,7 @@
92
92
  colorbox = 'colorbox',
93
93
  prefix = 'cbox',
94
94
  boxElement = prefix + 'Element',
95
-
95
+
96
96
  // Events
97
97
  event_open = prefix + '_open',
98
98
  event_load = prefix + '_load',
@@ -123,7 +123,7 @@
123
123
  $close,
124
124
  $groupControls,
125
125
  $events = $('<a/>'), // $({}) would be prefered, but there is an issue with jQuery 1.4.2
126
-
126
+
127
127
  // Variables for cached values or use across multiple functions
128
128
  settings,
129
129
  interfaceHeight,
@@ -145,7 +145,7 @@
145
145
  // ****************
146
146
  // HELPER FUNCTIONS
147
147
  // ****************
148
-
148
+
149
149
  // Convenience function for creating new jQuery objects
150
150
  function $tag(tag, id, css) {
151
151
  var element = document.createElement(tag);
@@ -160,7 +160,7 @@
160
160
 
161
161
  return $(element);
162
162
  }
163
-
163
+
164
164
  // Get the window height using innerHeight when available to avoid an issue with iOS
165
165
  // http://bugs.jquery.com/ticket/6724
166
166
  function winheight() {
@@ -204,7 +204,7 @@
204
204
  var
205
205
  max = $related.length,
206
206
  newIndex = (index + increment) % max;
207
-
207
+
208
208
  return (newIndex < 0) ? max + newIndex : newIndex;
209
209
  }
210
210
 
@@ -212,7 +212,7 @@
212
212
  function setSize(size, dimension) {
213
213
  return Math.round((/%/.test(size) ? ((dimension === 'x' ? $window.width() : winheight()) / 100) : 1) * parseInt(size, 10));
214
214
  }
215
-
215
+
216
216
  // Checks an href to see if it is a photo.
217
217
  // There is a force photo option (photo: true) for hrefs that cannot be matched by the regex.
218
218
  function isImage(settings, url) {
@@ -239,7 +239,7 @@
239
239
 
240
240
  function getRelated(rel) {
241
241
  index = 0;
242
-
242
+
243
243
  if (rel && rel !== false && rel !== 'nofollow') {
244
244
  $related = $('.' + boxElement).filter(function () {
245
245
  var options = $.data(this, colorbox);
@@ -247,7 +247,7 @@
247
247
  return (settings.get('rel') === rel);
248
248
  });
249
249
  index = $related.index(settings.el);
250
-
250
+
251
251
  // Check direct calls to Colorbox.
252
252
  if (index === -1) {
253
253
  $related = $related.add(settings.el);
@@ -297,7 +297,7 @@
297
297
 
298
298
  function stop() {
299
299
  clear();
300
-
300
+
301
301
  $events
302
302
  .unbind(event_complete, set)
303
303
  .unbind(event_load, clear);
@@ -354,17 +354,17 @@
354
354
  options = $(element).data(colorbox);
355
355
 
356
356
  settings = new Settings(element, options);
357
-
357
+
358
358
  getRelated(settings.get('rel'));
359
359
 
360
360
  if (!open) {
361
361
  open = active = true; // Prevents the page-change action from queuing up if the visitor holds down the left or right keys.
362
362
 
363
363
  setClass(settings.get('className'));
364
-
364
+
365
365
  // Show colorbox so the sizes can be calculated in older versions of jQuery
366
366
  $box.css({visibility:'hidden', display:'block', opacity:''});
367
-
367
+
368
368
  $loaded = $tag(div, 'LoadedContent', 'width:0; height:0; overflow:hidden; visibility:hidden');
369
369
  $content.css({width:'', height:''}).append($loaded);
370
370
 
@@ -392,14 +392,14 @@
392
392
  $groupControls.add($title).hide();
393
393
 
394
394
  $box.focus();
395
-
395
+
396
396
  if (settings.get('trapFocus')) {
397
397
  // Confine focus to the modal
398
398
  // Uses event capturing that is not supported in IE8-
399
399
  if (document.addEventListener) {
400
400
 
401
401
  document.addEventListener('focus', trapFocus, true);
402
-
402
+
403
403
  $events.one(event_closed, function () {
404
404
  document.removeEventListener('focus', trapFocus, true);
405
405
  });
@@ -420,7 +420,7 @@
420
420
  cursor: settings.get('overlayClose') ? 'pointer' : '',
421
421
  visibility: 'visible'
422
422
  }).show();
423
-
423
+
424
424
  if (settings.get('closeButton')) {
425
425
  $close.html(settings.get('close')).appendTo($content);
426
426
  } else {
@@ -456,7 +456,7 @@
456
456
  );
457
457
 
458
458
  $close = $('<button type="button"/>').attr({id:prefix+'Close'});
459
-
459
+
460
460
  $wrap.append( // The 3x3 Grid that makes up Colorbox
461
461
  $tag(div).append(
462
462
  $tag(div, "TopLeft"),
@@ -474,9 +474,9 @@
474
474
  $tag(div, "BottomRight")
475
475
  )
476
476
  ).find('div div').css({'float': 'left'});
477
-
477
+
478
478
  $loadingBay = $tag(div, false, 'position:absolute; width:9999px; visibility:hidden; display:none; max-width:none;');
479
-
479
+
480
480
  $groupControls = $next.add($prev).add($current).add($slideshow);
481
481
  }
482
482
  if (document.body && !$box.parent().length) {
@@ -514,7 +514,7 @@
514
514
  publicMethod.close();
515
515
  }
516
516
  });
517
-
517
+
518
518
  // Key Bindings
519
519
  $(document).bind('keydown.' + prefix, function (e) {
520
520
  var key = e.keyCode;
@@ -562,7 +562,7 @@
562
562
  // Usage format: $.colorbox.close();
563
563
  // Usage from within an iframe: parent.jQuery.colorbox.close();
564
564
  // ****************
565
-
565
+
566
566
  publicMethod = $.fn[colorbox] = $[colorbox] = function (options, callback) {
567
567
  var settings;
568
568
  var $obj = this;
@@ -572,15 +572,12 @@
572
572
  if ($.isFunction($obj)) { // assume a call to $.colorbox
573
573
  $obj = $('<a/>');
574
574
  options.open = true;
575
- } else if (!$obj[0]) { // colorbox being applied to empty collection
576
- return $obj;
577
575
  }
578
576
 
579
-
580
577
  if (!$obj[0]) { // colorbox being applied to empty collection
581
578
  return $obj;
582
579
  }
583
-
580
+
584
581
  appendHTML();
585
582
 
586
583
  if (addBindings()) {
@@ -595,12 +592,12 @@
595
592
  }).addClass(boxElement);
596
593
 
597
594
  settings = new Settings($obj[0], options);
598
-
595
+
599
596
  if (settings.get('open')) {
600
597
  launch($obj[0]);
601
598
  }
602
599
  }
603
-
600
+
604
601
  return $obj;
605
602
  };
606
603
 
@@ -612,7 +609,7 @@
612
609
  offset = $box.offset(),
613
610
  scrollTop,
614
611
  scrollLeft;
615
-
612
+
616
613
  $window.unbind('resize.' + prefix);
617
614
 
618
615
  // remove the modal so that it doesn't influence the document width/height
@@ -639,7 +636,7 @@
639
636
  } else {
640
637
  left += Math.round(Math.max($window.width() - settings.w - loadedWidth - interfaceWidth, 0) / 2);
641
638
  }
642
-
639
+
643
640
  if (settings.get('bottom') !== false) {
644
641
  top += Math.max(winheight() - settings.h - loadedHeight - interfaceHeight - setSize(settings.get('bottom'), 'y'), 0);
645
642
  } else if (settings.get('top') !== false) {
@@ -649,12 +646,12 @@
649
646
  }
650
647
 
651
648
  $box.css({top: offset.top, left: offset.left, visibility:'visible'});
652
-
649
+
653
650
  // this gives the wrapper plenty of breathing room so it's floated contents can move around smoothly,
654
651
  // but it has to be shrank down around the size of div#colorbox when it's done. If not,
655
652
  // it can invoke an obscure IE bug when using iframes.
656
653
  $wrap[0].style.width = $wrap[0].style.height = "9999px";
657
-
654
+
658
655
  function modalDimensions() {
659
656
  $topBorder[0].style.width = $bottomBorder[0].style.width = $content[0].style.width = (parseInt($box[0].style.width,10) - interfaceWidth)+'px';
660
657
  $content[0].style.height = $leftBorder[0].style.height = $rightBorder[0].style.height = (parseInt($box[0].style.height,10) - interfaceHeight)+'px';
@@ -684,13 +681,13 @@
684
681
  duration: speed || 0,
685
682
  complete: function () {
686
683
  modalDimensions();
687
-
684
+
688
685
  active = false;
689
-
686
+
690
687
  // shrink the wrapper down to exactly the size of colorbox to avoid a bug in IE's iframe implementation.
691
688
  $wrap[0].style.width = (settings.w + loadedWidth + interfaceWidth) + "px";
692
689
  $wrap[0].style.height = (settings.h + loadedHeight + interfaceHeight) + "px";
693
-
690
+
694
691
  if (settings.get('reposition')) {
695
692
  setTimeout(function () { // small delay before binding onresize due to an IE8 bug.
696
693
  $window.bind('resize.' + prefix, publicMethod.position);
@@ -707,10 +704,10 @@
707
704
 
708
705
  publicMethod.resize = function (options) {
709
706
  var scrolltop;
710
-
707
+
711
708
  if (open) {
712
709
  options = options || {};
713
-
710
+
714
711
  if (options.width) {
715
712
  settings.w = setSize(options.width, 'x') - loadedWidth - interfaceWidth;
716
713
  }
@@ -720,7 +717,7 @@
720
717
  }
721
718
 
722
719
  $loaded.css({width: settings.w});
723
-
720
+
724
721
  if (options.height) {
725
722
  settings.h = setSize(options.height, 'y') - loadedHeight - interfaceHeight;
726
723
  }
@@ -740,7 +737,7 @@
740
737
  if(scrolltop) {
741
738
  $loaded.scrollTop(scrolltop);
742
739
  }
743
-
740
+
744
741
  publicMethod.position(settings.get('transition') === "none" ? 0 : settings.get('speed'));
745
742
  }
746
743
  };
@@ -749,13 +746,13 @@
749
746
  if (!open) {
750
747
  return;
751
748
  }
752
-
749
+
753
750
  var callback, speed = settings.get('transition') === "none" ? 0 : settings.get('speed');
754
751
 
755
752
  $loaded.remove();
756
753
 
757
754
  $loaded = $tag(div, 'LoadedContent').append(object);
758
-
755
+
759
756
  function getWidth() {
760
757
  settings.w = settings.w || $loaded.width();
761
758
  settings.w = settings.mw && settings.mw < settings.w ? settings.mw : settings.w;
@@ -766,17 +763,17 @@
766
763
  settings.h = settings.mh && settings.mh < settings.h ? settings.mh : settings.h;
767
764
  return settings.h;
768
765
  }
769
-
766
+
770
767
  $loaded.hide()
771
768
  .appendTo($loadingBay.show())// content has to be appended to the DOM for accurate size calculations.
772
769
  .css({width: getWidth(), overflow: settings.get('scrolling') ? 'auto' : 'hidden'})
773
770
  .css({height: getHeight()})// sets the height independently from the width in case the new width influences the value of height.
774
771
  .prependTo($content);
775
-
772
+
776
773
  $loadingBay.hide();
777
-
774
+
778
775
  // floating the IMG removes the bottom line-height and fixed a problem where IE miscalculates the width of the parent element as 100% of the document width.
779
-
776
+
780
777
  $(photo).css({'float': 'none'});
781
778
 
782
779
  setClass(settings.get('className'));
@@ -785,17 +782,17 @@
785
782
  var total = $related.length,
786
783
  iframe,
787
784
  complete;
788
-
785
+
789
786
  if (!open) {
790
787
  return;
791
788
  }
792
-
789
+
793
790
  function removeFilter() { // Needed for IE8 in versions of jQuery prior to 1.7.2
794
791
  if ($.support.opacity === false) {
795
792
  $box[0].style.removeAttribute('filter');
796
793
  }
797
794
  }
798
-
795
+
799
796
  complete = function () {
800
797
  clearTimeout(loadingTimer);
801
798
  $loadingOverlay.hide();
@@ -803,20 +800,20 @@
803
800
  settings.get('onComplete');
804
801
  };
805
802
 
806
-
803
+
807
804
  $title.html(settings.get('title')).show();
808
805
  $loaded.show();
809
-
806
+
810
807
  if (total > 1) { // handle grouping
811
808
  if (typeof settings.get('current') === "string") {
812
809
  $current.html(settings.get('current').replace('{current}', index + 1).replace('{total}', total)).show();
813
810
  }
814
-
811
+
815
812
  $next[(settings.get('loop') || index < total - 1) ? "show" : "hide"]().html(settings.get('next'));
816
813
  $prev[(settings.get('loop') || index) ? "show" : "hide"]().html(settings.get('previous'));
817
-
814
+
818
815
  slideshow();
819
-
816
+
820
817
  // Preloads images within a rel group
821
818
  if (settings.get('preloading')) {
822
819
  $.each([getIndex(-1), getIndex(1)], function(){
@@ -835,14 +832,14 @@
835
832
  } else {
836
833
  $groupControls.hide();
837
834
  }
838
-
835
+
839
836
  if (settings.get('iframe')) {
840
837
  iframe = document.createElement('iframe');
841
-
838
+
842
839
  if ('frameBorder' in iframe) {
843
840
  iframe.frameBorder = 0;
844
841
  }
845
-
842
+
846
843
  if ('allowTransparency' in iframe) {
847
844
  iframe.allowTransparency = "true";
848
845
  }
@@ -850,7 +847,7 @@
850
847
  if (!settings.get('scrolling')) {
851
848
  iframe.scrolling = "no";
852
849
  }
853
-
850
+
854
851
  $(iframe)
855
852
  .attr({
856
853
  src: settings.get('href'),
@@ -860,7 +857,7 @@
860
857
  })
861
858
  .one('load', complete)
862
859
  .appendTo($loaded);
863
-
860
+
864
861
  $events.one(event_purge, function () {
865
862
  iframe.src = "//about:blank";
866
863
  });
@@ -871,14 +868,14 @@
871
868
  } else {
872
869
  complete();
873
870
  }
874
-
871
+
875
872
  if (settings.get('transition') === 'fade') {
876
873
  $box.fadeTo(speed, 1, removeFilter);
877
874
  } else {
878
875
  removeFilter();
879
876
  }
880
877
  };
881
-
878
+
882
879
  if (settings.get('transition') === 'fade') {
883
880
  $box.fadeTo(speed, 0, function () {
884
881
  publicMethod.position(0, callback);
@@ -890,27 +887,27 @@
890
887
 
891
888
  function load () {
892
889
  var href, setResize, prep = publicMethod.prep, $inline, request = ++requests;
893
-
890
+
894
891
  active = true;
895
-
892
+
896
893
  photo = false;
897
-
894
+
898
895
  trigger(event_purge);
899
896
  trigger(event_load);
900
897
  settings.get('onLoad');
901
-
898
+
902
899
  settings.h = settings.get('height') ?
903
900
  setSize(settings.get('height'), 'y') - loadedHeight - interfaceHeight :
904
901
  settings.get('innerHeight') && setSize(settings.get('innerHeight'), 'y');
905
-
902
+
906
903
  settings.w = settings.get('width') ?
907
904
  setSize(settings.get('width'), 'x') - loadedWidth - interfaceWidth :
908
905
  settings.get('innerWidth') && setSize(settings.get('innerWidth'), 'x');
909
-
906
+
910
907
  // Sets the minimum dimensions for use in image scaling
911
908
  settings.mw = settings.w;
912
909
  settings.mh = settings.h;
913
-
910
+
914
911
  // Re-evaluate the minimum width and height based on maxWidth and maxHeight values.
915
912
  // If the width or height exceed the maxWidth or maxHeight, use the maximum values instead.
916
913
  if (settings.get('maxWidth')) {
@@ -921,13 +918,13 @@
921
918
  settings.mh = setSize(settings.get('maxHeight'), 'y') - loadedHeight - interfaceHeight;
922
919
  settings.mh = settings.h && settings.h < settings.mh ? settings.h : settings.mh;
923
920
  }
924
-
921
+
925
922
  href = settings.get('href');
926
-
923
+
927
924
  loadingTimer = setTimeout(function () {
928
925
  $loadingOverlay.show();
929
926
  }, 100);
930
-
927
+
931
928
  if (settings.get('inline')) {
932
929
  var $target = $(href);
933
930
  // Inserts an empty placeholder where inline content is being pulled from.
@@ -961,7 +958,7 @@
961
958
  return;
962
959
  }
963
960
 
964
- // A small pause because some browsers will occassionaly report a
961
+ // A small pause because some browsers will occassionaly report a
965
962
  // img.width and img.height of zero immediately after the img.onload fires
966
963
  setTimeout(function(){
967
964
  var percent;
@@ -992,11 +989,11 @@
992
989
  setResize();
993
990
  }
994
991
  }
995
-
992
+
996
993
  if (settings.h) {
997
994
  photo.style.marginTop = Math.max(settings.mh - photo.height, 0) / 2 + 'px';
998
995
  }
999
-
996
+
1000
997
  if ($related[1] && (settings.get('loop') || $related[index + 1])) {
1001
998
  photo.style.cursor = 'pointer';
1002
999
  photo.onclick = function () {
@@ -1009,7 +1006,7 @@
1009
1006
  prep(photo);
1010
1007
  }, 1);
1011
1008
  });
1012
-
1009
+
1013
1010
  photo.src = href;
1014
1011
 
1015
1012
  } else if (href) {
@@ -1020,7 +1017,7 @@
1020
1017
  });
1021
1018
  }
1022
1019
  }
1023
-
1020
+
1024
1021
  // Navigates to the next page/image in a set.
1025
1022
  publicMethod.next = function () {
1026
1023
  if (!active && $related[1] && (settings.get('loop') || $related[index + 1])) {
@@ -1028,7 +1025,7 @@
1028
1025
  launch($related[index]);
1029
1026
  }
1030
1027
  };
1031
-
1028
+
1032
1029
  publicMethod.prev = function () {
1033
1030
  if (!active && $related[1] && (settings.get('loop') || index)) {
1034
1031
  index = getIndex(-1);
@@ -1039,20 +1036,20 @@
1039
1036
  // Note: to use this within an iframe use the following format: parent.jQuery.colorbox.close();
1040
1037
  publicMethod.close = function () {
1041
1038
  if (open && !closing) {
1042
-
1039
+
1043
1040
  closing = true;
1044
1041
  open = false;
1045
1042
  trigger(event_cleanup);
1046
1043
  settings.get('onCleanup');
1047
1044
  $window.unbind('.' + prefix);
1048
1045
  $overlay.fadeTo(settings.get('fadeOut') || 0, 0);
1049
-
1046
+
1050
1047
  $box.stop().fadeTo(settings.get('fadeOut') || 0, 0, function () {
1051
1048
  $box.hide();
1052
1049
  $overlay.hide();
1053
1050
  trigger(event_purge);
1054
1051
  $loaded.remove();
1055
-
1052
+
1056
1053
  setTimeout(function () {
1057
1054
  closing = false;
1058
1055
  trigger(event_closed);
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jquery-colorbox-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Krzysztof Knapik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-23 00:00:00.000000000 Z
11
+ date: 2015-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties