switch_access-rails 1.1.4 → 1.1.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  module SwitchAccess
2
2
  module Rails
3
- VERSION = '1.1.4'
3
+ VERSION = '1.1.5'
4
4
  end
5
5
  end
@@ -37,9 +37,9 @@ module SwitchAccess
37
37
  #
38
38
  def sw_element_end_group
39
39
  ret = sw_element_sci().end_group()
40
- if (ret < 0)
41
- sw_element_fini()
42
- end
40
+ # if (ret < 0)
41
+ # sw_element_fini()
42
+ # end
43
43
  ret
44
44
  end
45
45
 
@@ -80,27 +80,29 @@ module SwitchAccess
80
80
 
81
81
  def begin_group
82
82
  @parent_next_element_id = @next_element_id + 1
83
- @next_element_id = 1
84
- @level += 1
83
+ @next_element_id = 0
84
+ @level += 1
85
85
  "#{@options[:element_class_name]}#{@parent_next_element_id}"
86
86
  end
87
87
 
88
88
  def end_group
89
89
  @level -= 1
90
90
  @next_element_id = @parent_next_element_id
91
+ nil
91
92
  end
92
93
 
93
94
  #
94
95
  # Get the next switch element class
95
96
  #
96
97
  def next_element_class
97
- "#{@options[:element_class_name]}#{increase_next_id()}"
98
+ "#{@options[:element_class_name]}#{increase_next_id()}"
98
99
  end
99
100
  #
100
101
  # Increase the switch element id and return it
101
102
  #
102
- def increase_next_id
103
- @next_element_id += 1
103
+ def increase_next_id
104
+ @next_element_id = @next_element_id + 1
105
+ @next_element_id
104
106
  end
105
107
  end # class SwitchElements
106
108
 
@@ -3,7 +3,7 @@ Switch Access for webpages
3
3
  (c) 2012 Leif Ringstad
4
4
  Dual-licensed under GPL or commercial license (LICENSE and LICENSE.GPL)
5
5
  Source: http://github.com/leifcr/switch_access
6
- v 1.1.4
6
+ v 1.1.5
7
7
  ###
8
8
 
9
9
  SwitchAccessCommon =
@@ -78,6 +78,13 @@ SwitchAccessCommon =
78
78
  Default: "sw-highlighter-holder"
79
79
  ###
80
80
  holder_id: "sw-highlighter-holder"
81
+
82
+ ###
83
+ Read out the z-index for the element to be highlighted and set to 1 less than the value specified
84
+ on the element.
85
+ If it's set to inherit or auto it will create set z-index 5371 on the element and 5370 on the highlighter
86
+ ###
87
+ auto_z_index: true
81
88
 
82
89
  ###
83
90
  Options specific to highlighting
@@ -763,10 +770,12 @@ class SwitchAccessElement
763
770
  parent: parent # the parent switch-element of this element
764
771
  children: children # the child switch-elements of this element
765
772
  highlight_holder: null # the highlight holder from SwitchAccess
773
+ element_zidx: jq_element.css('z-index') # the z-index on the element before modifying it
766
774
 
767
775
  @options.debug = SwitchAccessCommon.options.debug
768
776
  @logger = logger if (@options.debug)
769
777
 
778
+
770
779
  @runtime.highlight_holder = if highlight_holder == null then $('body') else highlight_holder
771
780
 
772
781
  @init(@runtime.highlight_holder)
@@ -832,6 +841,15 @@ class SwitchAccessElement
832
841
  @runtime.jq_element.addClass(SwitchAccessCommon.options.highlight.element.current_class)
833
842
  return unless SwitchAccessCommon.options.highlighter.use
834
843
  @runtime.jq_highlighter.addClass(SwitchAccessCommon.options.highlighter.current_class)
844
+
845
+ # read element z-index if required
846
+ if SwitchAccessCommon.options.highlighter.auto_z_index == true
847
+ if (isNaN(@runtime.element_zidx) == true)
848
+ @runtime.jq_element.css('z-index', 5371);
849
+ @runtime.jq_highlighter.css('z-index', 5370)
850
+ else
851
+ @runtime.jq_highlighter.css('z-index', @runtime.element_zidx - 1);
852
+
835
853
  @runtime.jq_highlighter.show()
836
854
  # Must show the element before moving, else the offset will not be correct
837
855
  @setHighlighterSizeAndPosition()
@@ -856,6 +874,10 @@ class SwitchAccessElement
856
874
  @runtime.jq_highlighter.removeClass(SwitchAccessCommon.options.highlighter.current_class)
857
875
  @runtime.jq_highlighter.removeClass(SwitchAccessCommon.options.highlighter.activate_class)
858
876
  @runtime.jq_highlighter.hide()
877
+
878
+ if SwitchAccessCommon.options.highlighter.auto_z_index == true
879
+ @runtime.jq_element.css('z-index', @runtime.element_zidx);
880
+
859
881
  if SwitchAccessCommon.options.highlighter.watch_for_resize
860
882
  @disableCSSWatch()
861
883
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: switch_access-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.1.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-11 00:00:00.000000000 Z
12
+ date: 2012-12-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack