compass-jquery-plugin 0.3.2.3 → 0.3.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (235) hide show
  1. data/README.md +54 -37
  2. data/VERSION.yml +1 -1
  3. data/lib/handle_attributes.rb +4 -4
  4. data/lib/handle_js_files.rb +5 -5
  5. data/lib/jqtouch_theme.rb +2 -2
  6. data/lib/jquery/dynatree.rb +2 -2
  7. data/lib/jquery/emulators.rb +1 -1
  8. data/lib/jquery/flash_messages.rb +6 -6
  9. data/lib/jquery/graphics.rb +5 -0
  10. data/lib/jquery/gridify/assertions.rb +1 -1
  11. data/lib/jquery/gridify/grid.rb +76 -59
  12. data/lib/jquery/gridify/grid_column.rb +73 -67
  13. data/lib/jquery/gridify/grid_finder.rb +79 -79
  14. data/lib/jquery/gridify/grid_options.rb +154 -149
  15. data/lib/jquery/gridify/grid_view.rb +143 -143
  16. data/lib/jquery/gridify.rb +25 -25
  17. data/lib/jquery/ical/calendar.rb +2 -2
  18. data/lib/jquery/ical/event.rb +48 -44
  19. data/lib/jquery/ical/helpers/ui_event_helper.rb +3 -3
  20. data/lib/jquery/jqgrid/jqgrid.rb +58 -58
  21. data/lib/jquery/jqgrid.rb +1 -1
  22. data/lib/jquery/jqtouch.rb +1 -1
  23. data/lib/jquery/jquery.rb +117 -117
  24. data/lib/jquery/jquery_auto_complete.rb +9 -9
  25. data/lib/jquery/jquery_json_response.rb +12 -12
  26. data/lib/jquery/jquery_selector_assertions.rb +55 -53
  27. data/lib/jquery/jstree.rb +2 -2
  28. data/lib/jquery/mobile.rb +1 -1
  29. data/lib/jquery/ribbon.rb +2 -2
  30. data/lib/jquery/secret_sauce/controller/ui_dialog_controls.rb +5 -5
  31. data/lib/jquery/secret_sauce/controller/ui_grid_controls.rb +5 -5
  32. data/lib/jquery/secret_sauce/helpers/ui_dialog_helper.rb +1 -1
  33. data/lib/jquery/secret_sauce/helpers/ui_form_helper.rb +39 -39
  34. data/lib/jquery/secret_sauce/helpers/ui_grid_helper.rb +74 -74
  35. data/lib/jquery/secret_sauce/model/find_for_grid.rb +21 -21
  36. data/lib/jquery/secret_sauce.rb +1 -1
  37. data/lib/jquery/tools.rb +1 -1
  38. data/lib/jquery_mobile_theme.rb +2 -2
  39. data/lib/jquery_ui_theme.rb +12 -12
  40. data/templates/dynatree/config/initializers/dynatree.rb +3 -3
  41. data/templates/dynatree/jquery/dynatree/aero.scss +16 -16
  42. data/templates/dynatree/jquery/dynatree/aqua.scss +16 -16
  43. data/templates/dynatree/jquery/dynatree/crystal.scss +16 -16
  44. data/templates/dynatree/jquery/dynatree/xp.scss +17 -17
  45. data/templates/dynatree/jquery.dynatree.js +2926 -2912
  46. data/templates/emulators/config/initializers/emulators.rb +6 -6
  47. data/templates/graphics/config/initializers/graphics.rb +5 -0
  48. data/templates/graphics/jquery/ganttView.scss +89 -0
  49. data/templates/graphics/jquery.ganttView.js +1669 -0
  50. data/templates/graphics/jquery.ganttView.min.js +70 -0
  51. data/templates/{jquery → graphics}/jquery.sparkline.js +466 -438
  52. data/templates/{jquery → graphics}/jquery.sparkline.min.js +0 -0
  53. data/templates/graphics/manifest.rb +9 -0
  54. data/templates/jqgrid/config/initializers/jqgrid.rb +1 -1
  55. data/templates/jqgrid/i18n/jqgrid/locale-ar.js +131 -125
  56. data/templates/jqgrid/i18n/jqgrid/locale-bg.js +135 -131
  57. data/templates/jqgrid/i18n/jqgrid/locale-bg1251.js +135 -131
  58. data/templates/jqgrid/i18n/jqgrid/locale-cat.js +132 -126
  59. data/templates/jqgrid/i18n/jqgrid/locale-cn.js +137 -131
  60. data/templates/jqgrid/i18n/jqgrid/locale-cs.js +133 -127
  61. data/templates/jqgrid/i18n/jqgrid/locale-da.js +132 -126
  62. data/templates/jqgrid/i18n/jqgrid/locale-de.js +138 -132
  63. data/templates/jqgrid/i18n/jqgrid/locale-el.js +131 -125
  64. data/templates/jqgrid/i18n/jqgrid/locale-en.js +133 -127
  65. data/templates/jqgrid/i18n/jqgrid/locale-es.js +133 -127
  66. data/templates/jqgrid/i18n/jqgrid/locale-fa.js +19 -16
  67. data/templates/jqgrid/i18n/jqgrid/locale-fi.js +132 -126
  68. data/templates/jqgrid/i18n/jqgrid/locale-fr.js +131 -125
  69. data/templates/jqgrid/i18n/jqgrid/locale-gl.js +131 -125
  70. data/templates/jqgrid/i18n/jqgrid/locale-he.js +132 -126
  71. data/templates/jqgrid/i18n/jqgrid/locale-hu.js +133 -127
  72. data/templates/jqgrid/i18n/jqgrid/locale-is.js +131 -125
  73. data/templates/jqgrid/i18n/jqgrid/locale-it.js +8 -1
  74. data/templates/jqgrid/i18n/jqgrid/locale-ja.js +139 -136
  75. data/templates/jqgrid/i18n/jqgrid/locale-nl.js +4 -1
  76. data/templates/jqgrid/i18n/jqgrid/locale-no.js +14 -1
  77. data/templates/jqgrid/i18n/jqgrid/locale-pl.js +132 -126
  78. data/templates/jqgrid/i18n/jqgrid/locale-pt-br.js +132 -126
  79. data/templates/jqgrid/i18n/jqgrid/locale-pt.js +130 -124
  80. data/templates/jqgrid/i18n/jqgrid/locale-ro.js +144 -138
  81. data/templates/jqgrid/i18n/jqgrid/locale-ru.js +132 -126
  82. data/templates/jqgrid/i18n/jqgrid/locale-sk.js +132 -126
  83. data/templates/jqgrid/i18n/jqgrid/locale-sr.js +133 -127
  84. data/templates/jqgrid/i18n/jqgrid/locale-sv.js +132 -126
  85. data/templates/jqgrid/i18n/jqgrid/locale-tr.js +131 -125
  86. data/templates/jqgrid/i18n/jqgrid/locale-ua.js +132 -126
  87. data/templates/jqgrid/jquery.jqGrid.js +12735 -10444
  88. data/templates/jqgrid/jquery.jqGrid.min.js +477 -469
  89. data/templates/jqgrid/public/stylesheets/ellipsis-xbl.xml +12 -10
  90. data/templates/jqtouch/config/initializers/jqtouch.rb +3 -3
  91. data/templates/jqtouch/jquery/touch/jqtouch.scss +1 -1
  92. data/templates/jqtouch/jquery.jqtouch.js +10025 -10043
  93. data/templates/jquery/config/initializers/jquery.rb +2 -4
  94. data/templates/jquery/history.adapter.jquery.js +71 -0
  95. data/templates/jquery/history.adapter.jquery.min.js +4 -0
  96. data/templates/jquery/history.html4.js +690 -0
  97. data/templates/jquery/history.html4.min.js +21 -0
  98. data/templates/jquery/history.js +1297 -0
  99. data/templates/jquery/history.min.js +29 -0
  100. data/templates/jquery/i18n/jquery.ui/datepicker-af.js +20 -20
  101. data/templates/jquery/i18n/jquery.ui/datepicker-ar-DZ.js +19 -19
  102. data/templates/jquery/i18n/jquery.ui/datepicker-ar.js +19 -19
  103. data/templates/jquery/i18n/jquery.ui/datepicker-az.js +19 -19
  104. data/templates/jquery/i18n/jquery.ui/datepicker-bg.js +8 -8
  105. data/templates/jquery/i18n/jquery.ui/datepicker-bs.js +20 -20
  106. data/templates/jquery/i18n/jquery.ui/datepicker-ca.js +20 -20
  107. data/templates/jquery/i18n/jquery.ui/datepicker-cs.js +20 -20
  108. data/templates/jquery/i18n/jquery.ui/datepicker-da.js +14 -14
  109. data/templates/jquery/i18n/jquery.ui/datepicker-de.js +20 -20
  110. data/templates/jquery/i18n/jquery.ui/datepicker-el.js +20 -20
  111. data/templates/jquery/i18n/jquery.ui/datepicker-en-AU.js +20 -20
  112. data/templates/jquery/i18n/jquery.ui/datepicker-en-GB.js +20 -20
  113. data/templates/jquery/i18n/jquery.ui/datepicker-en-NZ.js +20 -20
  114. data/templates/jquery/i18n/jquery.ui/datepicker-eo.js +20 -20
  115. data/templates/jquery/i18n/jquery.ui/datepicker-es.js +20 -20
  116. data/templates/jquery/i18n/jquery.ui/datepicker-et.js +20 -20
  117. data/templates/jquery/i18n/jquery.ui/datepicker-eu.js +20 -20
  118. data/templates/jquery/i18n/jquery.ui/datepicker-fa.js +18 -18
  119. data/templates/jquery/i18n/jquery.ui/datepicker-fi.js +15 -15
  120. data/templates/jquery/i18n/jquery.ui/datepicker-fo.js +20 -20
  121. data/templates/jquery/i18n/jquery.ui/datepicker-fr-CH.js +20 -20
  122. data/templates/jquery/i18n/jquery.ui/datepicker-fr.js +22 -22
  123. data/templates/jquery/i18n/jquery.ui/datepicker-gl.js +20 -20
  124. data/templates/jquery/i18n/jquery.ui/datepicker-he.js +20 -20
  125. data/templates/jquery/i18n/jquery.ui/datepicker-hr.js +20 -20
  126. data/templates/jquery/i18n/jquery.ui/datepicker-hu.js +20 -20
  127. data/templates/jquery/i18n/jquery.ui/datepicker-hu.min.js +1 -1
  128. data/templates/jquery/i18n/jquery.ui/datepicker-hy.js +20 -20
  129. data/templates/jquery/i18n/jquery.ui/datepicker-id.js +20 -20
  130. data/templates/jquery/i18n/jquery.ui/datepicker-is.js +20 -20
  131. data/templates/jquery/i18n/jquery.ui/datepicker-it.js +20 -20
  132. data/templates/jquery/i18n/jquery.ui/datepicker-ja.js +20 -20
  133. data/templates/jquery/i18n/jquery.ui/datepicker-ko.js +20 -20
  134. data/templates/jquery/i18n/jquery.ui/datepicker-kz.js +20 -20
  135. data/templates/jquery/i18n/jquery.ui/datepicker-lt.js +20 -20
  136. data/templates/jquery/i18n/jquery.ui/datepicker-lv.js +20 -20
  137. data/templates/jquery/i18n/jquery.ui/datepicker-ml.js +20 -20
  138. data/templates/jquery/i18n/jquery.ui/datepicker-ms.js +20 -20
  139. data/templates/jquery/i18n/jquery.ui/datepicker-nl.js +20 -20
  140. data/templates/jquery/i18n/jquery.ui/datepicker-no.js +16 -16
  141. data/templates/jquery/i18n/jquery.ui/datepicker-no.min.js +2 -2
  142. data/templates/jquery/i18n/jquery.ui/datepicker-pl.js +20 -20
  143. data/templates/jquery/i18n/jquery.ui/datepicker-pt-BR.js +20 -20
  144. data/templates/jquery/i18n/jquery.ui/datepicker-pt.js +20 -20
  145. data/templates/jquery/i18n/jquery.ui/datepicker-rm.js +18 -18
  146. data/templates/jquery/i18n/jquery.ui/datepicker-ro.js +20 -20
  147. data/templates/jquery/i18n/jquery.ui/datepicker-ru.js +20 -20
  148. data/templates/jquery/i18n/jquery.ui/datepicker-sk.js +20 -20
  149. data/templates/jquery/i18n/jquery.ui/datepicker-sl.js +20 -20
  150. data/templates/jquery/i18n/jquery.ui/datepicker-sq.js +20 -20
  151. data/templates/jquery/i18n/jquery.ui/datepicker-sr-SR.js +20 -20
  152. data/templates/jquery/i18n/jquery.ui/datepicker-sr.js +20 -20
  153. data/templates/jquery/i18n/jquery.ui/datepicker-sv.js +14 -14
  154. data/templates/jquery/i18n/jquery.ui/datepicker-ta.js +20 -20
  155. data/templates/jquery/i18n/jquery.ui/datepicker-th.js +20 -20
  156. data/templates/jquery/i18n/jquery.ui/datepicker-tr.js +20 -20
  157. data/templates/jquery/i18n/jquery.ui/datepicker-uk.js +20 -20
  158. data/templates/jquery/i18n/jquery.ui/datepicker-vi.js +20 -20
  159. data/templates/jquery/i18n/jquery.ui/datepicker-zh-CN.js +20 -20
  160. data/templates/jquery/i18n/jquery.ui/datepicker-zh-HK.js +20 -20
  161. data/templates/jquery/i18n/jquery.ui/datepicker-zh-TW.js +20 -20
  162. data/templates/jquery/{partials → jquery/ui}/_flash_messages.scss +0 -0
  163. data/templates/jquery/jquery/ui/_theme.scss +14 -13
  164. data/templates/jquery/jquery/ui/contextMenu/configure.png +0 -0
  165. data/templates/jquery/jquery/ui/contextMenu/copy.png +0 -0
  166. data/templates/jquery/jquery/ui/contextMenu/cut.png +0 -0
  167. data/templates/jquery/jquery/ui/contextMenu/delete.png +0 -0
  168. data/templates/jquery/jquery/ui/contextMenu/edit.png +0 -0
  169. data/templates/jquery/jquery/ui/contextMenu/exit.png +0 -0
  170. data/templates/jquery/jquery/ui/contextMenu/new.png +0 -0
  171. data/templates/jquery/jquery/ui/contextMenu/paste.png +0 -0
  172. data/templates/jquery/jquery/ui/contextMenu/rename.png +0 -0
  173. data/templates/jquery/jquery/ui/contextMenu/show.png +0 -0
  174. data/templates/jquery/jquery/ui/contextMenu/trash.png +0 -0
  175. data/templates/jquery/jquery/ui/contextMenu.scss +16 -10
  176. data/templates/jquery/jquery-ui.js +11839 -23066
  177. data/templates/jquery/jquery-ui.min.js +401 -795
  178. data/templates/jquery/jquery.bgiframe.js +27 -25
  179. data/templates/jquery/jquery.contextMenu.js +209 -196
  180. data/templates/jquery/jquery.cookie.js +3 -1
  181. data/templates/jquery/jquery.dotimeout.js +236 -228
  182. data/templates/jquery/jquery.dst.js +154 -151
  183. data/templates/jquery/jquery.farbtastic.js +293 -293
  184. data/templates/jquery/jquery.flashMessages.js +26 -0
  185. data/templates/jquery/jquery.flashMessages.min.js +1 -0
  186. data/templates/jquery/jquery.form.js +803 -786
  187. data/templates/jquery/jquery.haml.js +248 -247
  188. data/templates/jquery/jquery.hotkeys.js +89 -89
  189. data/templates/jquery/jquery.js +8141 -8106
  190. data/templates/jquery/jquery.layout.js +2451 -2415
  191. data/templates/jquery/jquery.min.js +167 -166
  192. data/templates/jquery/jquery.mousewheel.js +62 -54
  193. data/templates/jquery/jquery.offline.js +171 -171
  194. data/templates/jquery/jquery.pngFix.js +76 -76
  195. data/templates/jquery/jquery.replacetext.js +83 -83
  196. data/templates/jquery/jquery.themeswitchertool.js +202 -177
  197. data/templates/jquery/jquery.tmpl.js +478 -473
  198. data/templates/jquery/jquery.tmplPlus.js +82 -81
  199. data/templates/jquery/jrails.js +178 -175
  200. data/templates/jquery/json.js +77 -7
  201. data/templates/jquery/json2.js +480 -0
  202. data/templates/jquery/json2.min.js +7 -0
  203. data/templates/jquery/lib/tasks/haml.rake +2 -2
  204. data/templates/jquery/manifest.rb +21 -17
  205. data/templates/jstree/jquery.jstree.js +5967 -4536
  206. data/templates/mobile/config/initializers/mobile.rb +1 -1
  207. data/templates/mobile/jquery/mobile/_base.scss +944 -927
  208. data/templates/mobile/jquery/mobile/default.scss +61 -48
  209. data/templates/mobile/jquery/mobile/valencia.scss +56 -42
  210. data/templates/mobile/jquery.mobile.js +4461 -4347
  211. data/templates/mobile/jquery.mobile.min.js +11 -2
  212. data/templates/mobile/lib/tasks/jquery.mobile.rake +12 -12
  213. data/templates/ribbon/config/initializers/ribbon.rb +2 -2
  214. data/templates/ribbon/jquery.ribbon.js +50 -29
  215. data/templates/secret_sauce/secret_sauce.js +8 -8
  216. data/templates/tools/flowplayer.js +945 -1
  217. data/templates/tools/jquery.tools.js +4645 -4335
  218. data/templates/tools/jquery.tools.min.js +37 -37
  219. data/templates/tools/lib/tasks/jquery.tools.rake +4 -4
  220. data/templates/tools/swfobject.js +813 -773
  221. metadata +33 -21
  222. data/templates/jquery/haml.js +0 -506
  223. data/templates/jquery/haml.min.js +0 -5
  224. data/templates/jquery/jquery/ui/contextMenu/door.png +0 -0
  225. data/templates/jquery/jquery/ui/contextMenu/page_white_copy.png +0 -0
  226. data/templates/jquery/jquery/ui/contextMenu/page_white_delete.png +0 -0
  227. data/templates/jquery/jquery/ui/contextMenu/page_white_edit.png +0 -0
  228. data/templates/jquery/jquery/ui/contextMenu/page_white_new.png +0 -0
  229. data/templates/jquery/jquery/ui/contextMenu/page_white_paste.png +0 -0
  230. data/templates/jquery/jquery.compat-1.3.js +0 -291
  231. data/templates/jquery/jquery.compat-1.3.min.js +0 -6
  232. data/templates/jquery/jquery.flash_messages.js +0 -5
  233. data/templates/jquery/jquery.flash_messages.min.js +0 -1
  234. data/templates/jquery/jquery.history.js +0 -194
  235. data/templates/jquery/jquery.history.min.js +0 -5
@@ -4,36 +4,38 @@
4
4
  * Version 2.1.2
5
5
  */
6
6
 
7
- (function($){
7
+ (function($) {
8
8
 
9
- $.fn.bgiframe = ($.browser.msie && /msie 6\.0/i.test(navigator.userAgent) ? function(s) {
10
- s = $.extend({
11
- top : 'auto', // auto == .currentStyle.borderTopWidth
12
- left : 'auto', // auto == .currentStyle.borderLeftWidth
13
- width : 'auto', // auto == offsetWidth
14
- height : 'auto', // auto == offsetHeight
15
- opacity : true,
16
- src : 'javascript:false;'
17
- }, s);
18
- var html = '<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+s.src+'"'+
19
- 'style="display:block;position:absolute;z-index:-1;'+
20
- (s.opacity !== false?'filter:Alpha(Opacity=\'0\');':'')+
21
- 'top:'+(s.top=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')':prop(s.top))+';'+
22
- 'left:'+(s.left=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')':prop(s.left))+';'+
23
- 'width:'+(s.width=='auto'?'expression(this.parentNode.offsetWidth+\'px\')':prop(s.width))+';'+
24
- 'height:'+(s.height=='auto'?'expression(this.parentNode.offsetHeight+\'px\')':prop(s.height))+';'+
9
+ $.fn.bgiframe = ($.browser.msie && /msie 6\.0/i.test(navigator.userAgent) ? function(s) {
10
+ s = $.extend({
11
+ top : 'auto', // auto == .currentStyle.borderTopWidth
12
+ left : 'auto', // auto == .currentStyle.borderLeftWidth
13
+ width : 'auto', // auto == offsetWidth
14
+ height : 'auto', // auto == offsetHeight
15
+ opacity : true,
16
+ src : 'javascript:false;'
17
+ }, s);
18
+ var html = '<iframe class="bgiframe"frameborder="0"tabindex="-1"src="' + s.src + '"' +
19
+ 'style="display:block;position:absolute;z-index:-1;' +
20
+ (s.opacity !== false ? 'filter:Alpha(Opacity=\'0\');' : '') +
21
+ 'top:' + (s.top == 'auto' ? 'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')' : prop(s.top)) + ';' +
22
+ 'left:' + (s.left == 'auto' ? 'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')' : prop(s.left)) + ';' +
23
+ 'width:' + (s.width == 'auto' ? 'expression(this.parentNode.offsetWidth+\'px\')' : prop(s.width)) + ';' +
24
+ 'height:' + (s.height == 'auto' ? 'expression(this.parentNode.offsetHeight+\'px\')' : prop(s.height)) + ';' +
25
25
  '"/>';
26
- return this.each(function() {
27
- if ( $(this).children('iframe.bgiframe').length === 0 )
28
- this.insertBefore( document.createElement(html), this.firstChild );
26
+ return this.each(function() {
27
+ if ($(this).children('iframe.bgiframe').length === 0)
28
+ this.insertBefore(document.createElement(html), this.firstChild);
29
+ });
30
+ } : function() {
31
+ return this;
29
32
  });
30
- } : function() { return this; });
31
33
 
32
34
  // old alias
33
- $.fn.bgIframe = $.fn.bgiframe;
35
+ $.fn.bgIframe = $.fn.bgiframe;
34
36
 
35
- function prop(n) {
36
- return n && n.constructor === Number ? n + 'px' : n;
37
- }
37
+ function prop(n) {
38
+ return n && n.constructor === Number ? n + 'px' : n;
39
+ }
38
40
 
39
41
  })(jQuery);
@@ -12,200 +12,213 @@
12
12
  // This plugin is dual-licensed under the GNU General Public License
13
13
  // and the MIT License and is copyright A Beautiful Site, LLC.
14
14
  //
15
- if(jQuery)( function() {
16
- $.extend($.fn, {
17
-
18
- contextMenu: function(o, callback) {
19
- // Defaults
20
- if( o.menu == undefined ) return false;
21
- if( o.inSpeed == undefined ) o.inSpeed = 150;
22
- if( o.outSpeed == undefined ) o.outSpeed = 75;
23
- // 0 needs to be -1 for expected results (no fade)
24
- if( o.inSpeed == 0 ) o.inSpeed = -1;
25
- if( o.outSpeed == 0 ) o.outSpeed = -1;
26
- // Loop each context menu
27
- $(this).each( function() {
28
- var el = $(this);
29
- var offset = $(el).offset();
30
- // Add contextMenu class
31
- $('#' + o.menu).addClass('contextMenu');
32
- // Simulate a true right click
33
- $(this).mousedown( function(e) {
34
- var evt = e;
35
- evt.stopPropagation();
36
- $(this).mouseup( function(e) {
37
- e.stopPropagation();
38
- var srcElement = $(this);
39
- $(this).unbind('mouseup');
40
- if( evt.button == 2 ) {
41
- // Hide context menus that may be showing
42
- $(".contextMenu").hide();
43
- // Get this context menu
44
- var menu = $('#' + o.menu);
45
-
46
- if( $(el).hasClass('disabled') ) return false;
47
-
48
- // Detect mouse position
49
- var d = {}, x, y;
50
- if( self.innerHeight ) {
51
- d.pageYOffset = self.pageYOffset;
52
- d.pageXOffset = self.pageXOffset;
53
- d.innerHeight = self.innerHeight;
54
- d.innerWidth = self.innerWidth;
55
- } else if( document.documentElement &&
56
- document.documentElement.clientHeight ) {
57
- d.pageYOffset = document.documentElement.scrollTop;
58
- d.pageXOffset = document.documentElement.scrollLeft;
59
- d.innerHeight = document.documentElement.clientHeight;
60
- d.innerWidth = document.documentElement.clientWidth;
61
- } else if( document.body ) {
62
- d.pageYOffset = document.body.scrollTop;
63
- d.pageXOffset = document.body.scrollLeft;
64
- d.innerHeight = document.body.clientHeight;
65
- d.innerWidth = document.body.clientWidth;
66
- }
67
- (e.pageX) ? x = e.pageX : x = e.clientX + d.scrollLeft;
68
- (e.pageY) ? y = e.pageY : y = e.clientY + d.scrollTop;
69
-
70
- // Show the menu
71
- $(document).unbind('click');
72
- $(menu).css({ top: y, left: x }).fadeIn(o.inSpeed);
73
- // Hover events
74
- $(menu).find('A').mouseover( function() {
75
- $(menu).find('LI.hover').removeClass('hover');
76
- $(this).parent().addClass('hover');
77
- }).mouseout( function() {
78
- $(menu).find('LI.hover').removeClass('hover');
79
- });
80
-
81
- // Keyboard
82
- $(document).keypress( function(e) {
83
- switch( e.keyCode ) {
84
- case 38: // up
85
- if( $(menu).find('LI.hover').size() == 0 ) {
86
- $(menu).find('LI:last').addClass('hover');
87
- } else {
88
- $(menu).find('LI.hover').removeClass('hover').prevAll('LI:not(.disabled)').eq(0).addClass('hover');
89
- if( $(menu).find('LI.hover').size() == 0 ) $(menu).find('LI:last').addClass('hover');
90
- }
91
- break;
92
- case 40: // down
93
- if( $(menu).find('LI.hover').size() == 0 ) {
94
- $(menu).find('LI:first').addClass('hover');
95
- } else {
96
- $(menu).find('LI.hover').removeClass('hover').nextAll('LI:not(.disabled)').eq(0).addClass('hover');
97
- if( $(menu).find('LI.hover').size() == 0 ) $(menu).find('LI:first').addClass('hover');
98
- }
99
- break;
100
- case 13: // enter
101
- $(menu).find('LI.hover A').trigger('click');
102
- break;
103
- case 27: // esc
104
- $(document).trigger('click');
105
- break
106
- }
107
- });
108
-
109
- // When items are selected
110
- $('#' + o.menu).find('A').unbind('click');
111
- $('#' + o.menu).find('LI:not(.disabled) A').click( function() {
112
- $(document).unbind('click').unbind('keypress');
113
- $(".contextMenu").hide();
114
- // Callback
115
- if( callback ) callback( $(this).attr('href').substr(1), $(srcElement), {x: x - offset.left, y: y - offset.top, docX: x, docY: y} );
116
- return false;
117
- });
118
-
119
- // Hide bindings
120
- setTimeout( function() { // Delay for Mozilla
121
- $(document).click( function() {
122
- $(document).unbind('click').unbind('keypress');
123
- $(menu).fadeOut(o.outSpeed);
124
- return false;
125
- });
126
- }, 0);
127
- }
128
- });
129
- });
130
-
131
- // Disable text selection
132
- if( $.browser.mozilla ) {
133
- $('#' + o.menu).each( function() { $(this).css({ 'MozUserSelect' : 'none' }); });
134
- } else if( $.browser.msie ) {
135
- $('#' + o.menu).each( function() { $(this).bind('selectstart.disableTextSelect', function() { return false; }); });
136
- } else {
137
- $('#' + o.menu).each(function() { $(this).bind('mousedown.disableTextSelect', function() { return false; }); });
138
- }
139
- // Disable browser context menu (requires both selectors to work in IE/Safari + FF/Chrome)
140
- $(el).add($('UL.contextMenu')).bind('contextmenu', function() { return false; });
141
-
142
- });
143
- return $(this);
144
- },
145
-
146
- // Disable context menu items on the fly
147
- disableContextMenuItems: function(o) {
148
- if( o == undefined ) {
149
- // Disable all
150
- $(this).find('LI').addClass('disabled');
151
- return( $(this) );
152
- }
153
- $(this).each( function() {
154
- if( o != undefined ) {
155
- var d = o.split(',');
156
- for( var i = 0; i < d.length; i++ ) {
157
- $(this).find('A[href="' + d[i] + '"]').parent().addClass('disabled');
158
-
159
- }
160
- }
161
- });
162
- return( $(this) );
163
- },
164
-
165
- // Enable context menu items on the fly
166
- enableContextMenuItems: function(o) {
167
- if( o == undefined ) {
168
- // Enable all
169
- $(this).find('LI.disabled').removeClass('disabled');
170
- return( $(this) );
171
- }
172
- $(this).each( function() {
173
- if( o != undefined ) {
174
- var d = o.split(',');
175
- for( var i = 0; i < d.length; i++ ) {
176
- $(this).find('A[href="' + d[i] + '"]').parent().removeClass('disabled');
177
-
178
- }
179
- }
180
- });
181
- return( $(this) );
182
- },
183
-
184
- // Disable context menu(s)
185
- disableContextMenu: function() {
186
- $(this).each( function() {
187
- $(this).addClass('disabled');
188
- });
189
- return( $(this) );
190
- },
191
-
192
- // Enable context menu(s)
193
- enableContextMenu: function() {
194
- $(this).each( function() {
195
- $(this).removeClass('disabled');
196
- });
197
- return( $(this) );
198
- },
199
-
200
- // Destroy context menu(s)
201
- destroyContextMenu: function() {
202
- // Destroy specified context menus
203
- $(this).each( function() {
204
- // Disable action
205
- $(this).unbind('mousedown').unbind('mouseup');
206
- });
207
- return( $(this) );
208
- }
209
-
210
- });
15
+ if (jQuery)( function() {
16
+ $.extend($.fn, {
17
+
18
+ contextMenu: function(o, callback) {
19
+ // Defaults
20
+ if (o.menu == undefined) return false;
21
+ if (o.inSpeed == undefined) o.inSpeed = 150;
22
+ if (o.outSpeed == undefined) o.outSpeed = 75;
23
+ // 0 needs to be -1 for expected results (no fade)
24
+ if (o.inSpeed == 0) o.inSpeed = -1;
25
+ if (o.outSpeed == 0) o.outSpeed = -1;
26
+ // Loop each context menu
27
+ $(this).each(function() {
28
+ var el = $(this);
29
+ var offset = $(el).offset();
30
+ // Add contextMenu class
31
+ $('#' + o.menu).addClass('contextMenu');
32
+ // Simulate a true right click
33
+ $(this).mousedown(function(e) {
34
+ var evt = e;
35
+ evt.stopPropagation();
36
+ $(this).mouseup(function(e) {
37
+ e.stopPropagation();
38
+ var srcElement = $(this);
39
+ $(this).unbind('mouseup');
40
+ if (evt.button == 2) {
41
+ // Hide context menus that may be showing
42
+ $(".contextMenu").hide();
43
+ // Get this context menu
44
+ var menu = $('#' + o.menu);
45
+
46
+ if ($(el).hasClass('disabled')) return false;
47
+
48
+ // Detect mouse position
49
+ var d = {}, x, y;
50
+ if (self.innerHeight) {
51
+ d.pageYOffset = self.pageYOffset;
52
+ d.pageXOffset = self.pageXOffset;
53
+ d.innerHeight = self.innerHeight;
54
+ d.innerWidth = self.innerWidth;
55
+ } else if (document.documentElement &&
56
+ document.documentElement.clientHeight) {
57
+ d.pageYOffset = document.documentElement.scrollTop;
58
+ d.pageXOffset = document.documentElement.scrollLeft;
59
+ d.innerHeight = document.documentElement.clientHeight;
60
+ d.innerWidth = document.documentElement.clientWidth;
61
+ } else if (document.body) {
62
+ d.pageYOffset = document.body.scrollTop;
63
+ d.pageXOffset = document.body.scrollLeft;
64
+ d.innerHeight = document.body.clientHeight;
65
+ d.innerWidth = document.body.clientWidth;
66
+ }
67
+ (e.pageX) ? x = e.pageX : x = e.clientX + d.scrollLeft;
68
+ (e.pageY) ? y = e.pageY : y = e.clientY + d.scrollTop;
69
+
70
+ // Show the menu
71
+ $(document).unbind('click');
72
+ $(menu).css({ top: y, left: x }).fadeIn(o.inSpeed);
73
+ // Hover events
74
+ $(menu).find('A').mouseover(
75
+ function() {
76
+ $(menu).find('LI.hover').removeClass('hover');
77
+ $(this).parent().addClass('hover');
78
+ }).mouseout(function() {
79
+ $(menu).find('LI.hover').removeClass('hover');
80
+ });
81
+
82
+ // Keyboard
83
+ $(document).keypress(function(e) {
84
+ switch (e.keyCode) {
85
+ case 38: // up
86
+ if ($(menu).find('LI.hover').size() == 0) {
87
+ $(menu).find('LI:last').addClass('hover');
88
+ } else {
89
+ $(menu).find('LI.hover').removeClass('hover').prevAll('LI:not(.disabled)').eq(0).addClass('hover');
90
+ if ($(menu).find('LI.hover').size() == 0) $(menu).find('LI:last').addClass('hover');
91
+ }
92
+ break;
93
+ case 40: // down
94
+ if ($(menu).find('LI.hover').size() == 0) {
95
+ $(menu).find('LI:first').addClass('hover');
96
+ } else {
97
+ $(menu).find('LI.hover').removeClass('hover').nextAll('LI:not(.disabled)').eq(0).addClass('hover');
98
+ if ($(menu).find('LI.hover').size() == 0) $(menu).find('LI:first').addClass('hover');
99
+ }
100
+ break;
101
+ case 13: // enter
102
+ $(menu).find('LI.hover A').trigger('click');
103
+ break;
104
+ case 27: // esc
105
+ $(document).trigger('click');
106
+ break
107
+ }
108
+ });
109
+
110
+ // When items are selected
111
+ $('#' + o.menu).find('A').unbind('click');
112
+ $('#' + o.menu).find('LI:not(.disabled) A').click(function() {
113
+ $(document).unbind('click').unbind('keypress');
114
+ $(".contextMenu").hide();
115
+ // Callback
116
+ if (callback) callback($(this).attr('href').substr(1), $(srcElement), {x: x - offset.left, y: y - offset.top, docX: x, docY: y});
117
+ return false;
118
+ });
119
+
120
+ // Hide bindings
121
+ setTimeout(function() { // Delay for Mozilla
122
+ $(document).click(function() {
123
+ $(document).unbind('click').unbind('keypress');
124
+ $(menu).fadeOut(o.outSpeed);
125
+ return false;
126
+ });
127
+ }, 0);
128
+ }
129
+ });
130
+ });
131
+
132
+ // Disable text selection
133
+ if ($.browser.mozilla) {
134
+ $('#' + o.menu).each(function() {
135
+ $(this).css({ 'MozUserSelect' : 'none' });
136
+ });
137
+ } else if ($.browser.msie) {
138
+ $('#' + o.menu).each(function() {
139
+ $(this).bind('selectstart.disableTextSelect', function() {
140
+ return false;
141
+ });
142
+ });
143
+ } else {
144
+ $('#' + o.menu).each(function() {
145
+ $(this).bind('mousedown.disableTextSelect', function() {
146
+ return false;
147
+ });
148
+ });
149
+ }
150
+ // Disable browser context menu (requires both selectors to work in IE/Safari + FF/Chrome)
151
+ $(el).add($('UL.contextMenu')).bind('contextmenu', function() {
152
+ return false;
153
+ });
154
+
155
+ });
156
+ return $(this);
157
+ },
158
+
159
+ // Disable context menu items on the fly
160
+ disableContextMenuItems: function(o) {
161
+ if (o == undefined) {
162
+ // Disable all
163
+ $(this).find('LI').addClass('disabled');
164
+ return( $(this) );
165
+ }
166
+ $(this).each(function() {
167
+ if (o != undefined) {
168
+ var d = o.split(',');
169
+ for (var i = 0; i < d.length; i++) {
170
+ $(this).find('A[href="' + d[i] + '"]').parent().addClass('disabled');
171
+
172
+ }
173
+ }
174
+ });
175
+ return( $(this) );
176
+ },
177
+
178
+ // Enable context menu items on the fly
179
+ enableContextMenuItems: function(o) {
180
+ if (o == undefined) {
181
+ // Enable all
182
+ $(this).find('LI.disabled').removeClass('disabled');
183
+ return( $(this) );
184
+ }
185
+ $(this).each(function() {
186
+ if (o != undefined) {
187
+ var d = o.split(',');
188
+ for (var i = 0; i < d.length; i++) {
189
+ $(this).find('A[href="' + d[i] + '"]').parent().removeClass('disabled');
190
+
191
+ }
192
+ }
193
+ });
194
+ return( $(this) );
195
+ },
196
+
197
+ // Disable context menu(s)
198
+ disableContextMenu: function() {
199
+ $(this).each(function() {
200
+ $(this).addClass('disabled');
201
+ });
202
+ return( $(this) );
203
+ },
204
+
205
+ // Enable context menu(s)
206
+ enableContextMenu: function() {
207
+ $(this).each(function() {
208
+ $(this).removeClass('disabled');
209
+ });
210
+ return( $(this) );
211
+ },
212
+
213
+ // Destroy context menu(s)
214
+ destroyContextMenu: function() {
215
+ // Destroy specified context menus
216
+ $(this).each(function() {
217
+ // Disable action
218
+ $(this).unbind('mousedown').unbind('mouseup');
219
+ });
220
+ return( $(this) );
221
+ }
222
+
223
+ });
211
224
  })(jQuery);