izimodal 1.3.3 → 1.4.0

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: b65e27c4e6a2c0da7b9aa16ba27aa25e2bd53d17
4
- data.tar.gz: a96e48dd4a352b29755abd758e0eb47457bbf2b9
3
+ metadata.gz: d95aab4cf9d16b84cdd34145cf0aba5a6336f259
4
+ data.tar.gz: bcced28d3b61c473d488f5c2c4f9bba62aaecfef
5
5
  SHA512:
6
- metadata.gz: b8a5642ff491d5456ba77c056348889acea37f4b8236ac2f5c0feecff438ff30361eb0072be2bcde12cb7cc2396b245da858d915cd4e6191d8dfb6a954e3428e
7
- data.tar.gz: 6c5b9a67f8aafd5e7d947ebc86113060ef46487bb636d68f9a750e098bd1455e567e598566a5fc71226f026c28fa8d49727d3900165ec395da9763aa11449d42
6
+ metadata.gz: 6143fdb47f665c1e19ccf55a60bc50512300f3c8aa8ffd100e8c23361fa17f4a9146098545708bc0b0aaa592387a88fcddbdcb8c10c1ec39d95f80f40505aa68
7
+ data.tar.gz: 6d102a3f162829821358a768e4f358e92f2ee4ccd81c86db5315bb9a5631d962ddb22d2e92253b2d54df6d37bb01d1bdc62cccd8be3dbb76294fe4bf73c91e5e
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/izimodal`. To experiment with that code, run `bin/console` for an interactive prompt.
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ For further reading about assets, goto JS github repo: https://github.com/elitenomad/izimodal.git
6
6
 
7
7
  ## Installation
8
8
 
@@ -1,3 +1,3 @@
1
1
  module Izimodal
2
- VERSION = "1.3.3"
2
+ VERSION = "1.4.0"
3
3
  end
@@ -1,5 +1,5 @@
1
1
  /*
2
- * iziModal | v1.3.3
2
+ * iziModal | v1.4.0
3
3
  * http://izimodal.marcelodolce.com
4
4
  * by Marcelo Dolce.
5
5
  */
@@ -73,7 +73,12 @@
73
73
  ids: []
74
74
  };
75
75
  this.$element.attr('aria-hidden', 'true');
76
+ this.$element.attr('aria-labelledby', this.id);
77
+ this.$element.attr('role', 'dialog');
76
78
 
79
+ if( !this.$element.hasClass('iziModal') ){
80
+ this.$element.addClass('iziModal');
81
+ }
77
82
  if(this.group.name === undefined && options.group !== ""){
78
83
  this.group.name = options.group;
79
84
  this.$element.attr('data-'+PLUGIN_NAME+'-group', options.group);
@@ -98,7 +103,12 @@
98
103
 
99
104
  if (options.fullscreen === true) {
100
105
  this.$header.append('<a href="javascript:void(0)" class="'+PLUGIN_NAME+'-button '+PLUGIN_NAME+'-button-fullscreen" data-'+PLUGIN_NAME+'-fullscreen></a>');
101
- this.$header.css('padding-right', '76px');
106
+
107
+ if (options.rtl === true) {
108
+ this.$header.css('padding-left', '76px');
109
+ } else {
110
+ this.$header.css('padding-right', '76px');
111
+ }
102
112
  }
103
113
 
104
114
  if (options.timeoutProgressbar === true && !isNaN(parseInt(options.timeout)) && options.timeout !== false && options.timeout !== 0) {
@@ -155,7 +165,7 @@
155
165
 
156
166
  if(options.theme !== ""){
157
167
  if(options.theme === "light"){
158
- this.$element.addClass(PLUGIN_NAME+"-light");
168
+ this.$element.addClass(PLUGIN_NAME+'-light');
159
169
  } else {
160
170
  this.$element.addClass(options.theme);
161
171
  }
@@ -166,6 +176,10 @@
166
176
  this.$element.addClass('isFullscreen');
167
177
  }
168
178
 
179
+ if(options.rtl === true) {
180
+ this.$element.addClass(PLUGIN_NAME+'-rtl');
181
+ }
182
+
169
183
  if(options.attached === 'top' || this.$element.attr('data-'+PLUGIN_NAME+'-attached') == 'top' ){
170
184
  this.$element.addClass('isAttachedTop');
171
185
  }
@@ -200,7 +214,11 @@
200
214
 
201
215
  that.width = that.$element.outerWidth();
202
216
 
203
- that.mediaQueries = '<style rel="' + that.id + '">@media handheld, only screen and (max-width: ' + that.width + 'px) { #' + that.id + '{ width: 100% !important; max-width: 100% !important; margin-left: 0 !important; left: 0 !important; border-radius:0!important} #' + that.id + ' .'+PLUGIN_NAME+'-header{border-radius:0!important} }</style>';
217
+ if(parseInt(wClear) > that.width){
218
+ that.width = parseInt(wClear);
219
+ }
220
+
221
+ that.mediaQueries = '<style rel="' + that.id + '">@media handheld, only screen and (max-width: ' + that.width + 'px) { #' + that.id + '{ width:100% !important; max-width:100% !important; margin-left:0 !important; left:0 !important; right:0 !important; border-radius:0!important} #' + that.id + ' .'+PLUGIN_NAME+'-header{border-radius:0!important} }</style>';
204
222
 
205
223
  $(document.body).append(that.mediaQueries);
206
224
 
@@ -346,6 +364,9 @@
346
364
 
347
365
  if (this.options.bodyOverflow || isMobile){
348
366
  $('html').addClass(PLUGIN_NAME+'-isOverflow');
367
+ if(isMobile){
368
+ $('body').css('overflow', 'hidden');
369
+ }
349
370
  }
350
371
 
351
372
  if (this.options.onOpening && typeof(this.options.onOpening) === "function") {
@@ -516,21 +537,22 @@
516
537
  var that = this;
517
538
 
518
539
  function closed(){
540
+
541
+ // console.info('[ '+PLUGIN_NAME+' | '+that.id+' ] Closed.');
542
+ that.state = STATES.CLOSED;
543
+ that.$element.trigger(STATES.CLOSED);
544
+
519
545
  if (that.options.iframe === true) {
520
546
  that.$element.find('.'+PLUGIN_NAME+'-iframe').attr('src', "");
521
547
  }
522
548
 
523
549
  if (that.options.bodyOverflow || isMobile){
524
550
  $('html').removeClass(PLUGIN_NAME+'-isOverflow');
525
- }
526
-
527
- $('html').removeClass(PLUGIN_NAME+'-isAttached');
528
-
529
- that.state = STATES.CLOSED;
530
- that.$element.trigger(STATES.CLOSED);
531
-
532
- // console.info('[ '+PLUGIN_NAME+' | '+that.id+' ] Closed.');
533
-
551
+ if(isMobile){
552
+ $('body').css('overflow','auto');
553
+ }
554
+ }
555
+
534
556
  if (that.options.onClosed && typeof(that.options.onClosed) === "function") {
535
557
  that.options.onClosed(that);
536
558
  }
@@ -538,6 +560,10 @@
538
560
  if(that.options.restoreDefaultContent === true){
539
561
  that.$element.find('.'+PLUGIN_NAME+'-content').html( that.content );
540
562
  }
563
+
564
+ if( $('.'+PLUGIN_NAME+':visible').attr('id') === undefined){
565
+ $('html').removeClass(PLUGIN_NAME+'-isAttached');
566
+ }
541
567
  }
542
568
 
543
569
  if(this.state == STATES.OPENED || this.state == STATES.OPENING){
@@ -567,7 +593,7 @@
567
593
 
568
594
  if (transitionOut !== '') {
569
595
 
570
- this.$element.attr('class', PLUGIN_NAME + " transitionOut " + transitionOut + " " + this.options.theme + " " + String((this.isFullscreen === true) ? 'isFullscreen' : '') + " " + String((this.options.attached === 'top') ? 'isAttachedTop' : '') + " " + String((this.options.attached === 'bottom') ? 'isAttachedBottom' : ''));
596
+ this.$element.attr('class', PLUGIN_NAME + " transitionOut " + transitionOut + " " + this.options.theme + " " + String((this.isFullscreen === true) ? 'isFullscreen' : '') + " " + String(this.$element.hasClass('isAttached') ? "isAttached" : "") + " " + String((this.options.attached === 'top') ? 'isAttachedTop' : '') + " " + String((this.options.attached === 'bottom') ? 'isAttachedBottom' : '') + (this.options.rtl ? PLUGIN_NAME+'-rtl' : ''));
571
597
  this.$overlay.attr('class', PLUGIN_NAME + "-overlay " + this.options.transitionOutOverlay);
572
598
  this.$navigate.attr('class', PLUGIN_NAME + "-navigate " + this.options.transitionOutOverlay);
573
599
 
@@ -618,17 +644,34 @@
618
644
  setTimeout(function(){
619
645
 
620
646
  var loop = $('.'+PLUGIN_NAME+'[data-'+PLUGIN_NAME+'-group="'+that.group.name+'"][data-'+PLUGIN_NAME+'-loop]').length;
647
+ for (var i = that.group.index+1; i <= that.group.ids.length; i++) {
621
648
 
622
- if((loop > 0 || that.options.loop === true) && (that.group.index+1) === that.group.ids.length){
649
+ try {
650
+ modals.in = $("#"+that.group.ids[i]).data().iziModal;
651
+ } catch(log) {
652
+ console.warn("No next modal");
653
+ }
654
+ if(typeof modals.in !== 'undefined'){
655
+
656
+ $("#"+that.group.ids[i]).iziModal('open', { transition: transitionIn });
657
+ break;
658
+
659
+ } else {
623
660
 
624
- $("#"+that.group.ids[0]).iziModal('open', { transition: transitionIn });
625
- modals.in = $("#"+that.group.ids[0]).data().iziModal;
661
+ if(i == that.group.ids.length && loop > 0 || that.options.loop === true){
626
662
 
627
- } else if(that.group.index+1 < that.group.ids.length){
663
+ for (var index = 0; index <= that.group.ids.length; index++) {
628
664
 
629
- $("#"+that.group.ids[that.group.index+1]).iziModal('open', { transition: transitionIn });
630
- modals.in = $("#"+that.group.ids[that.group.index+1]).data().iziModal;
665
+ modals.in = $("#"+that.group.ids[index]).data().iziModal;
666
+ if(typeof modals.in !== 'undefined'){
667
+ $("#"+that.group.ids[index]).iziModal('open', { transition: transitionIn });
668
+ break;
669
+ }
670
+ }
671
+ }
672
+ }
631
673
  }
674
+
632
675
  }, 200);
633
676
 
634
677
  $(document).trigger( PLUGIN_NAME + "-group-change", modals );
@@ -647,7 +690,9 @@
647
690
  modal = $(e.currentTarget);
648
691
  transitionIn = modal.attr('data-'+PLUGIN_NAME+'-transitionIn');
649
692
  transitionOut = modal.attr('data-'+PLUGIN_NAME+'-transitionOut');
693
+
650
694
  } else if(e !== undefined){
695
+
651
696
  if(e.transitionIn !== undefined){
652
697
  transitionIn = e.transitionIn;
653
698
  }
@@ -659,18 +704,37 @@
659
704
  this.close({transition:transitionOut});
660
705
 
661
706
  setTimeout(function(){
707
+
662
708
  var loop = $('.'+PLUGIN_NAME+'[data-'+PLUGIN_NAME+'-group="'+that.group.name+'"][data-'+PLUGIN_NAME+'-loop]').length;
663
709
 
664
- if( (loop > 0 || that.options.loop === true) && that.group.index === 0){
710
+ for (var i = that.group.index; i >= 0; i--) {
665
711
 
666
- $("#"+that.group.ids[that.group.ids.length-1]).iziModal('open', { transition: transitionIn });
667
- modals.in = $("#"+that.group.ids[that.group.ids.length-1]).data().iziModal;
712
+ try {
713
+ modals.in = $("#"+that.group.ids[i-1]).data().iziModal;
714
+ } catch(log) {
715
+ console.warn("No previous modal");
716
+ }
717
+ if(typeof modals.in !== 'undefined'){
668
718
 
669
- } else if(that.group.index > 0){
719
+ $("#"+that.group.ids[i-1]).iziModal('open', { transition: transitionIn });
720
+ break;
670
721
 
671
- $("#"+that.group.ids[that.group.index-1]).iziModal('open', { transition: transitionIn });
672
- modals.in = $("#"+that.group.ids[that.group.index-1]).data().iziModal;
722
+ } else {
723
+
724
+ if(i === 0 && loop > 0 || that.options.loop === true){
725
+
726
+ for (var index = that.group.ids.length-1; index >= 0; index--) {
727
+
728
+ modals.in = $("#"+that.group.ids[index]).data().iziModal;
729
+ if(typeof modals.in !== 'undefined'){
730
+ $("#"+that.group.ids[index]).iziModal('open', { transition: transitionIn });
731
+ break;
732
+ }
733
+ }
734
+ }
735
+ }
673
736
  }
737
+
674
738
  }, 200);
675
739
 
676
740
  $(document).trigger( PLUGIN_NAME + "-group-change", modals );
@@ -735,8 +799,6 @@
735
799
 
736
800
  setIcon: function(icon){
737
801
 
738
- console.log(this.$header.find('.'+PLUGIN_NAME+'-header-icon').length);
739
-
740
802
  if( this.$header.find('.'+PLUGIN_NAME+'-header-icon').length === 0 ){
741
803
  this.$header.prepend('<i class="'+PLUGIN_NAME+'-header-icon"></i>');
742
804
  }
@@ -819,6 +881,7 @@
819
881
  if(windowHeight < (this.options.iframeHeight + this.headerHeight) || this.isFullscreen === true){
820
882
 
821
883
  $('html').addClass(PLUGIN_NAME+'-isAttached');
884
+ this.$element.addClass('isAttached');
822
885
 
823
886
  this.$element.find('.'+PLUGIN_NAME+'-iframe').css({
824
887
  'height': parseInt(windowHeight - this.headerHeight) + 'px',
@@ -826,6 +889,7 @@
826
889
 
827
890
  } else {
828
891
  $('html').removeClass(PLUGIN_NAME+'-isAttached');
892
+ this.$element.removeClass('isAttached');
829
893
 
830
894
  this.$element.find('.'+PLUGIN_NAME+'-iframe').css({
831
895
  'height': parseInt(this.options.iframeHeight) + 'px',
@@ -836,6 +900,7 @@
836
900
 
837
901
  if (windowHeight > (contentHeight + this.headerHeight) && this.isFullscreen !== true) {
838
902
  $('html').removeClass(PLUGIN_NAME+'-isAttached');
903
+ this.$element.removeClass('isAttached');
839
904
  this.$element.find('.'+PLUGIN_NAME+'-wrap').css({'height': 'auto'});
840
905
  }
841
906
 
@@ -845,6 +910,7 @@
845
910
 
846
911
  if( !$('html').hasClass(PLUGIN_NAME+'-isAttached') ){
847
912
  $('html').addClass(PLUGIN_NAME+'-isAttached');
913
+ this.$element.addClass('isAttached');
848
914
  }
849
915
 
850
916
  this.$element.find('.'+PLUGIN_NAME+'-wrap').css({
@@ -866,7 +932,7 @@
866
932
  }
867
933
 
868
934
  // Corrige margin-top caso o modal sofra alterações na altura de seu conteúdo
869
- if (this.$element.css('margin-top') != modalMargin && this.$element.css('margin-top') != "0px") {
935
+ if (this.$element.css('margin-top') != modalMargin && this.$element.css('margin-top') != "0px" && !$('html').hasClass(PLUGIN_NAME+'-isAttached')) {
870
936
  this.$element.css('margin-top', modalMargin);
871
937
  }
872
938
  }
@@ -891,16 +957,21 @@
891
957
  }
892
958
  });
893
959
 
894
- var data = $(modalHash).data();
895
-
896
- if(e.type === 'load'){
897
- if(data.iziModal.options.autoOpen !== false){
898
- $(modalHash).iziModal("open");
960
+ try {
961
+ var data = $(modalHash).data();
962
+ if(typeof data !== 'undefined'){
963
+ if(e.type === 'load'){
964
+ if(data.iziModal.options.autoOpen !== false){
965
+ $(modalHash).iziModal("open");
966
+ }
967
+ } else {
968
+ setTimeout(function(){
969
+ $(modalHash).iziModal("open");
970
+ },200);
971
+ }
899
972
  }
900
- } else {
901
- setTimeout(function(){
902
- $(modalHash).iziModal("open");
903
- },200);
973
+ } catch(log) {
974
+ console.info(log);
904
975
  }
905
976
 
906
977
  } else {
@@ -1012,6 +1083,7 @@
1012
1083
  icon: null,
1013
1084
  iconText: null,
1014
1085
  iconColor: '',
1086
+ rtl: false,
1015
1087
  width: 600,
1016
1088
  padding: 0,
1017
1089
  radius: 3,
@@ -1,5 +1,5 @@
1
1
  /*
2
- * iziModal | v1.3.3
2
+ * iziModal | v1.4.0
3
3
  * http://izimodal.marcelodolce.com
4
4
  * by Marcelo Dolce.
5
5
  */
@@ -92,6 +92,8 @@
92
92
  border-radius: 50%;
93
93
  transition: transform 0.5s cubic-bezier(.16,.81,.32,1), opacity 0.5s ease;
94
94
  background-size: 67% !important;
95
+ -webkit-tap-highlight-color: rgba(0,0,0,0);
96
+ -webkit-tap-highlight-color: transparent; /* For some Androids */
95
97
  }
96
98
  .iziModal .iziModal-button-close{
97
99
  right: 10px;
@@ -113,7 +115,7 @@
113
115
  .iziModal .iziModal-header {
114
116
  background: #88A0B9;
115
117
  padding: 14px 40px 15px 18px;
116
- box-shadow: inset 0 -10px 15px -12px rgba(0, 0, 0, 0.3);
118
+ box-shadow: inset 0 -10px 15px -12px rgba(0, 0, 0, 0.3), 0 0 0px #555;
117
119
  overflow: hidden;
118
120
  position: relative;
119
121
  z-index: 10;
@@ -164,6 +166,33 @@
164
166
  top: 6px;
165
167
  }
166
168
 
169
+ /* RTL */
170
+
171
+ .iziModal-rtl {
172
+ direction: rtl;
173
+ }
174
+ .iziModal-rtl .iziModal-header {
175
+ padding: 14px 18px 15px 40px;
176
+ }
177
+ .iziModal-rtl .iziModal-header-icon {
178
+ float: right;
179
+ padding: 0 0 0 15px;
180
+ }
181
+ .iziModal-rtl .iziModal-button-close {
182
+ left: 10px;
183
+ right: initial;
184
+ }
185
+ .iziModal-rtl .iziModal-button-fullscreen {
186
+ right: initial;
187
+ left: 44px;
188
+ }
189
+ .iziModal-rtl .iziModal-header.iziModal-noSubtitle {
190
+ padding: 10px 15px 12px 40px;
191
+ }
192
+ .iziModal-rtl .iziModal-header.iziModal-noSubtitle .iziModal-header-icon {
193
+ padding: 0 0 0 13px;
194
+ }
195
+
167
196
  /* LIGHT THEME */
168
197
 
169
198
  .iziModal.iziModal-light .iziModal-header-icon{
@@ -203,7 +232,7 @@
203
232
  .iziModal .iziModal-content:before,
204
233
  .iziModal .iziModal-content:after { content:''; display:table }
205
234
  .iziModal .iziModal-content:after { clear:both }
206
- .iziModal .iziModal-content{ zoom:1 }
235
+ .iziModal .iziModal-content{ zoom:1; width: 100%; }
207
236
  .iziModal .iziModal-wrap{
208
237
  width: 100%;
209
238
  position: relative;
@@ -225,7 +254,6 @@
225
254
  width: 100%;
226
255
  }
227
256
 
228
-
229
257
  .iziModal-navigate{
230
258
  position: fixed;
231
259
  left: 0;
@@ -307,13 +335,17 @@ html.iziModal-isOverflow body, html.iziModal-isAttached body{
307
335
  html.iziModal-isAttached{
308
336
  overflow: hidden;
309
337
  }
310
- html.iziModal-isAttached .iziModal{
338
+ .iziModal.isAttached{
311
339
  border-radius: 0 !important;
340
+ margin-top: 0 !important;
341
+ top: 0 !important;
342
+ bottom: 0;
343
+ transition: none !important;
312
344
  }
313
- html.iziModal-isAttached .iziModal-header{
345
+ .iziModal.isAttached .iziModal-header{
314
346
  border-radius: 0;
315
347
  }
316
- html.iziModal-isAttached .iziModal-wrap{
348
+ .iziModal.isAttached .iziModal-wrap{
317
349
  overflow-y: auto;
318
350
  overflow-x: hidden;
319
351
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: izimodal
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.3
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - elitenomad
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-09-06 00:00:00.000000000 Z
11
+ date: 2016-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -90,9 +90,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
90
  version: '0'
91
91
  requirements: []
92
92
  rubyforge_project:
93
- rubygems_version: 2.4.5.1
93
+ rubygems_version: 2.4.3
94
94
  signing_key:
95
95
  specification_version: 4
96
96
  summary: Rails gem for Elegant, responsive, flexible and lightweight modal plugin
97
97
  with jQuery Library.
98
98
  test_files: []
99
+ has_rdoc: