jquery-qtip2-rails 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. data/README.md +16 -13
  2. data/jquery-qtip2-rails.gemspec +7 -4
  3. data/lib/jquery-qtip2-rails/version.rb +1 -1
  4. data/test/dummy/README.rdoc +261 -0
  5. data/test/dummy/Rakefile +7 -0
  6. data/test/dummy/app/assets/javascripts/application.js +16 -0
  7. data/test/dummy/app/assets/javascripts/home.js +48 -0
  8. data/test/dummy/app/assets/stylesheets/application.css +14 -0
  9. data/test/dummy/app/assets/stylesheets/home.css +4 -0
  10. data/test/dummy/app/controllers/application_controller.rb +3 -0
  11. data/test/dummy/app/controllers/home_controller.rb +5 -0
  12. data/test/dummy/app/helpers/application_helper.rb +2 -0
  13. data/test/dummy/app/helpers/home_helper.rb +2 -0
  14. data/test/dummy/app/mailers/.gitkeep +0 -0
  15. data/test/dummy/app/models/.gitkeep +0 -0
  16. data/test/dummy/app/views/home/index.html.erb +14 -0
  17. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  18. data/test/dummy/config.ru +4 -0
  19. data/test/dummy/config/application.rb +68 -0
  20. data/test/dummy/config/boot.rb +10 -0
  21. data/test/dummy/config/environment.rb +5 -0
  22. data/test/dummy/config/environments/development.rb +31 -0
  23. data/test/dummy/config/environments/production.rb +64 -0
  24. data/test/dummy/config/environments/test.rb +35 -0
  25. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  26. data/test/dummy/config/initializers/inflections.rb +15 -0
  27. data/test/dummy/config/initializers/mime_types.rb +5 -0
  28. data/test/dummy/config/initializers/secret_token.rb +7 -0
  29. data/test/dummy/config/initializers/session_store.rb +8 -0
  30. data/test/dummy/config/initializers/wrap_parameters.rb +10 -0
  31. data/test/dummy/config/locales/en.yml +5 -0
  32. data/test/dummy/config/routes.rb +3 -0
  33. data/test/dummy/lib/assets/.gitkeep +0 -0
  34. data/test/dummy/log/.gitkeep +0 -0
  35. data/test/dummy/public/404.html +26 -0
  36. data/test/dummy/public/422.html +26 -0
  37. data/test/dummy/public/500.html +25 -0
  38. data/test/dummy/public/favicon.ico +0 -0
  39. data/test/dummy/script/rails +6 -0
  40. data/vendor/assets/jquery-qtip/jquery-qtip/src/ajax/ajax.js +3 -2
  41. data/vendor/assets/jquery-qtip/jquery-qtip/src/{styles.css → basic.css} +0 -0
  42. data/vendor/assets/jquery-qtip/jquery-qtip/src/core.css +27 -22
  43. data/vendor/assets/jquery-qtip/jquery-qtip/src/core.js +162 -315
  44. data/vendor/assets/jquery-qtip/jquery-qtip/src/{extra.css → css3.css} +70 -30
  45. data/vendor/assets/jquery-qtip/jquery-qtip/src/imagemap/imagemap.js +59 -45
  46. data/vendor/assets/jquery-qtip/jquery-qtip/src/intro.js +31 -29
  47. data/vendor/assets/jquery-qtip/jquery-qtip/src/modal/modal.js +7 -5
  48. data/vendor/assets/jquery-qtip/jquery-qtip/src/outro.js +2 -2
  49. data/vendor/assets/jquery-qtip/jquery-qtip/src/svg/svg.js +8 -8
  50. data/vendor/assets/jquery-qtip/jquery-qtip/src/tips/tips.css +7 -3
  51. data/vendor/assets/jquery-qtip/jquery-qtip/src/tips/tips.js +159 -147
  52. data/vendor/assets/jquery-qtip/jquery-qtip/src/viewport/viewport.js +112 -0
  53. data/vendor/assets/jquery-qtip/jquery.qtip.basic.css +5 -0
  54. data/vendor/assets/jquery-qtip/jquery.qtip.basic.js +0 -1
  55. data/vendor/assets/jquery-qtip/jquery.qtip.css +3 -4
  56. data/vendor/assets/jquery-qtip/jquery.qtip.js +5 -5
  57. metadata +103 -8
  58. data/vendor/assets/jquery-qtip/jquery-qtip/src/header.txt +0 -14
@@ -0,0 +1,112 @@
1
+ PLUGINS.viewport = function(api, position, posOptions, targetWidth, targetHeight, elemWidth, elemHeight)
2
+ {
3
+ var target = posOptions.target,
4
+ tooltip = api.elements.tooltip,
5
+ my = posOptions.my,
6
+ at = posOptions.at,
7
+ adjust = posOptions.adjust,
8
+ method = adjust.method.split(' '),
9
+ methodX = method[0],
10
+ methodY = method[1] || method[0],
11
+ viewport = posOptions.viewport,
12
+ container = posOptions.container,
13
+ cache = api.cache,
14
+ tip = api.plugins.tip,
15
+ adjusted = { left: 0, top: 0 },
16
+ fixed, newMy, newClass;
17
+
18
+ // If viewport is not a jQuery element, or it's the window/document or no adjustment method is used... return
19
+ if(!viewport.jquery || target[0] === window || target[0] === document.body || adjust.method === 'none') {
20
+ return adjusted;
21
+ }
22
+
23
+ // Cache our viewport details
24
+ fixed = tooltip.css('position') === 'fixed';
25
+ viewport = {
26
+ elem: viewport,
27
+ height: viewport[ (viewport[0] === window ? 'h' : 'outerH') + 'eight' ](),
28
+ width: viewport[ (viewport[0] === window ? 'w' : 'outerW') + 'idth' ](),
29
+ scrollleft: fixed ? 0 : viewport.scrollLeft(),
30
+ scrolltop: fixed ? 0 : viewport.scrollTop(),
31
+ offset: viewport.offset() || { left: 0, top: 0 }
32
+ };
33
+ container = {
34
+ elem: container,
35
+ scrollLeft: container.scrollLeft(),
36
+ scrollTop: container.scrollTop(),
37
+ offset: container.offset() || { left: 0, top: 0 }
38
+ };
39
+
40
+ // Generic calculation method
41
+ function calculate(side, otherSide, type, adjust, side1, side2, lengthName, targetLength, elemLength) {
42
+ var initialPos = position[side1],
43
+ mySide = my[side], atSide = at[side],
44
+ isShift = type === SHIFT,
45
+ viewportScroll = -container.offset[side1] + viewport.offset[side1] + viewport['scroll'+side1],
46
+ myLength = mySide === side1 ? elemLength : mySide === side2 ? -elemLength : -elemLength / 2,
47
+ atLength = atSide === side1 ? targetLength : atSide === side2 ? -targetLength : -targetLength / 2,
48
+ tipLength = tip && tip.size ? tip.size[lengthName] || 0 : 0,
49
+ tipAdjust = tip && tip.corner && tip.corner.precedance === side && !isShift ? tipLength : 0,
50
+ overflow1 = viewportScroll - initialPos + tipAdjust,
51
+ overflow2 = initialPos + elemLength - viewport[lengthName] - viewportScroll + tipAdjust,
52
+ offset = myLength - (my.precedance === side || mySide === my[otherSide] ? atLength : 0) - (atSide === CENTER ? targetLength / 2 : 0);
53
+
54
+ // shift
55
+ if(isShift) {
56
+ tipAdjust = tip && tip.corner && tip.corner.precedance === otherSide ? tipLength : 0;
57
+ offset = (mySide === side1 ? 1 : -1) * myLength - tipAdjust;
58
+
59
+ // Adjust position but keep it within viewport dimensions
60
+ position[side1] += overflow1 > 0 ? overflow1 : overflow2 > 0 ? -overflow2 : 0;
61
+ position[side1] = Math.max(
62
+ -container.offset[side1] + viewport.offset[side1] + (tipAdjust && tip.corner[side] === CENTER ? tip.offset : 0),
63
+ initialPos - offset,
64
+ Math.min(
65
+ Math.max(-container.offset[side1] + viewport.offset[side1] + viewport[lengthName], initialPos + offset),
66
+ position[side1]
67
+ )
68
+ );
69
+ }
70
+
71
+ // flip/flipinvert
72
+ else {
73
+ // Update adjustment amount depending on if using flipinvert or flip
74
+ adjust *= (type === FLIPINVERT ? 2 : 0);
75
+
76
+ // Check for overflow on the left/top
77
+ if(overflow1 > 0 && (mySide !== side1 || overflow2 > 0)) {
78
+ position[side1] -= offset + adjust;
79
+ newMy['invert'+side](side1);
80
+ }
81
+
82
+ // Check for overflow on the bottom/right
83
+ else if(overflow2 > 0 && (mySide !== side2 || overflow1 > 0) ) {
84
+ position[side1] -= (mySide === CENTER ? -offset : offset) + adjust;
85
+ newMy['invert'+side](side2);
86
+ }
87
+
88
+ // Make sure we haven't made things worse with the adjustment and reset if so
89
+ if(position[side1] < viewportScroll && -position[side1] > overflow2) {
90
+ position[side1] = initialPos; newMy = my.clone();
91
+ }
92
+ }
93
+
94
+ return position[side1] - initialPos;
95
+ }
96
+
97
+ // Set newMy if using flip or flipinvert methods
98
+ if(methodX !== 'shift' || methodY !== 'shift') { newMy = my.clone(); }
99
+
100
+ // Adjust position based onviewport and adjustment options
101
+ adjusted = {
102
+ left: methodX !== 'none' ? calculate( X, Y, methodX, adjust.x, LEFT, RIGHT, WIDTH, targetWidth, elemWidth ) : 0,
103
+ top: methodY !== 'none' ? calculate( Y, X, methodY, adjust.y, TOP, BOTTOM, HEIGHT, targetHeight, elemHeight ) : 0
104
+ };
105
+
106
+ // Set tooltip position class if it's changed
107
+ if(newMy && cache.lastClass !== (newClass = uitooltip + '-pos-' + newMy.abbrev())) {
108
+ tooltip.removeClass(api.cache.lastClass).addClass( (api.cache.lastClass = newClass) );
109
+ }
110
+
111
+ return adjusted;
112
+ };
@@ -0,0 +1,5 @@
1
+ /*
2
+ *= include jquery-qtip/src/core.css
3
+ *= include jquery-qtip/src/basic.css
4
+ *= include jquery-qtip/src/css3.css
5
+ */
@@ -1,4 +1,3 @@
1
- //= include jquery-qtip/src/header.txt
2
1
  //= include jquery-qtip/src/intro.js
3
2
  //= include jquery-qtip/src/core.js
4
3
  //= include jquery-qtip/src/outro.js
@@ -1,8 +1,7 @@
1
1
  /*
2
- *= include jquery-qtip/src/header.txt
3
2
  *= include jquery-qtip/src/core.css
4
- *= include jquery-qtip/src/modal/modal.css
3
+ *= include jquery-qtip/src/basic.css
4
+ *= include jquery-qtip/src/css3.css
5
5
  *= include jquery-qtip/src/tips/tips.css
6
- *= include jquery-qtip/src/styles.css
7
- *= include jquery-qtip/src/extra.css
6
+ *= include jquery-qtip/src/modal/modal.css
8
7
  */
@@ -1,10 +1,10 @@
1
- //= include jquery-qtip/src/header.txt
2
1
  //= include jquery-qtip/src/intro.js
3
2
  //= include jquery-qtip/src/core.js
4
- //= include jquery-qtip/src/ajax/ajax.js
5
- //= include jquery-qtip/src/bgiframe/bgiframe.js
6
- //= include jquery-qtip/src/imagemap/imagemap.js
7
- //= include jquery-qtip/src/modal/modal.js
8
3
  //= include jquery-qtip/src/svg/svg.js
4
+ //= include jquery-qtip/src/ajax/ajax.js
9
5
  //= include jquery-qtip/src/tips/tips.js
6
+ //= include jquery-qtip/src/modal/modal.js
7
+ //= include jquery-qtip/src/viewport/viewport.js
8
+ //= include jquery-qtip/src/imagemap/imagemap.js
9
+ //= include jquery-qtip/src/bgiframe/bgiframe.js
10
10
  //= include jquery-qtip/src/outro.js
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jquery-qtip2-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-08 00:00:00.000000000 Z
12
+ date: 2012-09-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
16
- requirement: &70320569829180 !ruby/object:Gem::Requirement
16
+ requirement: &70169318666520 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,29 @@ dependencies:
21
21
  version: 3.1.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70320569829180
24
+ version_requirements: *70169318666520
25
+ - !ruby/object:Gem::Dependency
26
+ name: rails
27
+ requirement: &70169318666100 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *70169318666100
36
+ - !ruby/object:Gem::Dependency
37
+ name: jquery-rails
38
+ requirement: &70169318665640 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *70169318665640
25
47
  description: qTip2 jQuery plugin
26
48
  email:
27
49
  - tkrotoff@gmail.com
@@ -37,21 +59,58 @@ files:
37
59
  - jquery-qtip2-rails.gemspec
38
60
  - lib/jquery-qtip2-rails.rb
39
61
  - lib/jquery-qtip2-rails/version.rb
62
+ - test/dummy/README.rdoc
63
+ - test/dummy/Rakefile
64
+ - test/dummy/app/assets/javascripts/application.js
65
+ - test/dummy/app/assets/javascripts/home.js
66
+ - test/dummy/app/assets/stylesheets/application.css
67
+ - test/dummy/app/assets/stylesheets/home.css
68
+ - test/dummy/app/controllers/application_controller.rb
69
+ - test/dummy/app/controllers/home_controller.rb
70
+ - test/dummy/app/helpers/application_helper.rb
71
+ - test/dummy/app/helpers/home_helper.rb
72
+ - test/dummy/app/mailers/.gitkeep
73
+ - test/dummy/app/models/.gitkeep
74
+ - test/dummy/app/views/home/index.html.erb
75
+ - test/dummy/app/views/layouts/application.html.erb
76
+ - test/dummy/config.ru
77
+ - test/dummy/config/application.rb
78
+ - test/dummy/config/boot.rb
79
+ - test/dummy/config/environment.rb
80
+ - test/dummy/config/environments/development.rb
81
+ - test/dummy/config/environments/production.rb
82
+ - test/dummy/config/environments/test.rb
83
+ - test/dummy/config/initializers/backtrace_silencers.rb
84
+ - test/dummy/config/initializers/inflections.rb
85
+ - test/dummy/config/initializers/mime_types.rb
86
+ - test/dummy/config/initializers/secret_token.rb
87
+ - test/dummy/config/initializers/session_store.rb
88
+ - test/dummy/config/initializers/wrap_parameters.rb
89
+ - test/dummy/config/locales/en.yml
90
+ - test/dummy/config/routes.rb
91
+ - test/dummy/lib/assets/.gitkeep
92
+ - test/dummy/log/.gitkeep
93
+ - test/dummy/public/404.html
94
+ - test/dummy/public/422.html
95
+ - test/dummy/public/500.html
96
+ - test/dummy/public/favicon.ico
97
+ - test/dummy/script/rails
40
98
  - vendor/assets/jquery-qtip/jquery-qtip/src/ajax/ajax.js
99
+ - vendor/assets/jquery-qtip/jquery-qtip/src/basic.css
41
100
  - vendor/assets/jquery-qtip/jquery-qtip/src/bgiframe/bgiframe.js
42
101
  - vendor/assets/jquery-qtip/jquery-qtip/src/core.css
43
102
  - vendor/assets/jquery-qtip/jquery-qtip/src/core.js
44
- - vendor/assets/jquery-qtip/jquery-qtip/src/extra.css
45
- - vendor/assets/jquery-qtip/jquery-qtip/src/header.txt
103
+ - vendor/assets/jquery-qtip/jquery-qtip/src/css3.css
46
104
  - vendor/assets/jquery-qtip/jquery-qtip/src/imagemap/imagemap.js
47
105
  - vendor/assets/jquery-qtip/jquery-qtip/src/intro.js
48
106
  - vendor/assets/jquery-qtip/jquery-qtip/src/modal/modal.css
49
107
  - vendor/assets/jquery-qtip/jquery-qtip/src/modal/modal.js
50
108
  - vendor/assets/jquery-qtip/jquery-qtip/src/outro.js
51
- - vendor/assets/jquery-qtip/jquery-qtip/src/styles.css
52
109
  - vendor/assets/jquery-qtip/jquery-qtip/src/svg/svg.js
53
110
  - vendor/assets/jquery-qtip/jquery-qtip/src/tips/tips.css
54
111
  - vendor/assets/jquery-qtip/jquery-qtip/src/tips/tips.js
112
+ - vendor/assets/jquery-qtip/jquery-qtip/src/viewport/viewport.js
113
+ - vendor/assets/jquery-qtip/jquery.qtip.basic.css
55
114
  - vendor/assets/jquery-qtip/jquery.qtip.basic.js
56
115
  - vendor/assets/jquery-qtip/jquery.qtip.css
57
116
  - vendor/assets/jquery-qtip/jquery.qtip.js
@@ -79,4 +138,40 @@ rubygems_version: 1.8.15
79
138
  signing_key:
80
139
  specification_version: 3
81
140
  summary: qTip2 packaged for the Rails 3.1+ asset pipeline
82
- test_files: []
141
+ test_files:
142
+ - test/dummy/README.rdoc
143
+ - test/dummy/Rakefile
144
+ - test/dummy/app/assets/javascripts/application.js
145
+ - test/dummy/app/assets/javascripts/home.js
146
+ - test/dummy/app/assets/stylesheets/application.css
147
+ - test/dummy/app/assets/stylesheets/home.css
148
+ - test/dummy/app/controllers/application_controller.rb
149
+ - test/dummy/app/controllers/home_controller.rb
150
+ - test/dummy/app/helpers/application_helper.rb
151
+ - test/dummy/app/helpers/home_helper.rb
152
+ - test/dummy/app/mailers/.gitkeep
153
+ - test/dummy/app/models/.gitkeep
154
+ - test/dummy/app/views/home/index.html.erb
155
+ - test/dummy/app/views/layouts/application.html.erb
156
+ - test/dummy/config.ru
157
+ - test/dummy/config/application.rb
158
+ - test/dummy/config/boot.rb
159
+ - test/dummy/config/environment.rb
160
+ - test/dummy/config/environments/development.rb
161
+ - test/dummy/config/environments/production.rb
162
+ - test/dummy/config/environments/test.rb
163
+ - test/dummy/config/initializers/backtrace_silencers.rb
164
+ - test/dummy/config/initializers/inflections.rb
165
+ - test/dummy/config/initializers/mime_types.rb
166
+ - test/dummy/config/initializers/secret_token.rb
167
+ - test/dummy/config/initializers/session_store.rb
168
+ - test/dummy/config/initializers/wrap_parameters.rb
169
+ - test/dummy/config/locales/en.yml
170
+ - test/dummy/config/routes.rb
171
+ - test/dummy/lib/assets/.gitkeep
172
+ - test/dummy/log/.gitkeep
173
+ - test/dummy/public/404.html
174
+ - test/dummy/public/422.html
175
+ - test/dummy/public/500.html
176
+ - test/dummy/public/favicon.ico
177
+ - test/dummy/script/rails
@@ -1,14 +0,0 @@
1
- /*!
2
- * qTip2 - Pretty powerful tooltips
3
- * http://craigsworks.com/projects/qtip2/
4
- *
5
- * Version: @VERSION
6
- * Copyright 2009-2010 Craig Michael Thompson - http://craigsworks.com
7
- *
8
- * Dual licensed under MIT or GPLv2 licenses
9
- * http://en.wikipedia.org/wiki/MIT_License
10
- * http://en.wikipedia.org/wiki/GNU_General_Public_License
11
- *
12
- * Date:
13
- */
14
-