maglev-webtools 0.2.1 → 1.0

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 (296) hide show
  1. data/README.rdoc +38 -29
  2. data/bin/webtools +22 -1
  3. data/lib/web_tools/code_browser.rb +156 -0
  4. data/lib/web_tools/debugger.rb +96 -199
  5. data/lib/web_tools/info.rb +1 -3
  6. data/lib/web_tools/method_list.rb +67 -0
  7. data/lib/web_tools/middleware/debugger.rb +10 -16
  8. data/lib/web_tools/object_log.rb +24 -0
  9. data/lib/web_tools/session_list.rb +119 -0
  10. data/lib/web_tools/shared_page_cache.rb +30 -0
  11. data/lib/web_tools/stat_process.rb +24 -0
  12. data/lib/web_tools/statistics.rb +14 -0
  13. data/lib/web_tools/support/app_model.rb +66 -101
  14. data/lib/web_tools/support/code_browser.rb +88 -86
  15. data/lib/web_tools/support/debugger.rb +303 -0
  16. data/lib/web_tools/support/error_log.rb +33 -0
  17. data/lib/web_tools/support/ruby.rb +60 -121
  18. data/lib/web_tools/support/service_helper.rb +38 -10
  19. data/lib/web_tools/support/smalltalk_extensions.rb +12 -0
  20. data/lib/web_tools/tool.rb +48 -0
  21. data/lib/web_tools/ui.rb +14 -53
  22. data/lib/web_tools/version_report.rb +29 -0
  23. data/lib/web_tools/workspace.rb +77 -0
  24. data/lib/web_tools.rb +14 -4
  25. data/public/CodeBrowser.html +51 -0
  26. data/public/CodeMirror/LICENSE +19 -0
  27. data/public/CodeMirror/css/codemirror.css +67 -0
  28. data/public/CodeMirror/css/default.css +18 -0
  29. data/public/CodeMirror/js/codemirror.js +2131 -0
  30. data/public/CodeMirror/js/ruby.js +195 -0
  31. data/public/CodeMirror/js/smalltalk.js +139 -0
  32. data/public/Debugger.html +28 -0
  33. data/public/MethodList.html +20 -0
  34. data/public/ObjectLog.html +20 -0
  35. data/public/SessionList.html +31 -0
  36. data/public/SharedPageCache.html +78 -0
  37. data/public/Statistics.html +64 -0
  38. data/public/VersionReport.html +50 -0
  39. data/public/Workspace.html +39 -0
  40. data/public/css/CodeBrowser.css +24 -0
  41. data/public/css/Debugger.css +32 -0
  42. data/public/css/MethodList.css +8 -0
  43. data/public/css/ObjectLog.css +5 -0
  44. data/public/css/SessionList.css +9 -0
  45. data/public/css/Statistics.css +24 -0
  46. data/public/{stylesheets → css}/base/images/ui-anim_basic_16x16.gif +0 -0
  47. data/public/{stylesheets → css}/base/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  48. data/public/{stylesheets → css}/base/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  49. data/public/{stylesheets → css}/base/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  50. data/public/{stylesheets → css}/base/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  51. data/public/{stylesheets → css}/base/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  52. data/public/{stylesheets → css}/base/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  53. data/public/{stylesheets → css}/base/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  54. data/public/{stylesheets → css}/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  55. data/public/{stylesheets → css}/base/images/ui-icons_222222_256x240.png +0 -0
  56. data/public/{stylesheets → css}/base/images/ui-icons_2e83ff_256x240.png +0 -0
  57. data/public/{stylesheets → css}/base/images/ui-icons_454545_256x240.png +0 -0
  58. data/public/{stylesheets → css}/base/images/ui-icons_888888_256x240.png +0 -0
  59. data/public/{stylesheets → css}/base/images/ui-icons_cd0a0a_256x240.png +0 -0
  60. data/public/{stylesheets → css}/base/jquery.ui.accordion.css +0 -0
  61. data/public/{stylesheets → css}/base/jquery.ui.all.css +0 -0
  62. data/public/{stylesheets → css}/base/jquery.ui.autocomplete.css +0 -0
  63. data/public/{stylesheets → css}/base/jquery.ui.base.css +0 -0
  64. data/public/{stylesheets → css}/base/jquery.ui.button.css +0 -0
  65. data/public/{stylesheets → css}/base/jquery.ui.core.css +0 -0
  66. data/public/{stylesheets → css}/base/jquery.ui.datepicker.css +0 -0
  67. data/public/{stylesheets → css}/base/jquery.ui.dialog.css +0 -0
  68. data/public/{stylesheets → css}/base/jquery.ui.progressbar.css +0 -0
  69. data/public/{stylesheets → css}/base/jquery.ui.resizable.css +0 -0
  70. data/public/{stylesheets → css}/base/jquery.ui.selectable.css +0 -0
  71. data/public/{stylesheets → css}/base/jquery.ui.slider.css +0 -0
  72. data/public/{stylesheets → css}/base/jquery.ui.tabs.css +0 -0
  73. data/public/{stylesheets → css}/base/jquery.ui.theme.css +0 -0
  74. data/public/css/editor.css +25 -0
  75. data/public/css/jjmenu.css +33 -0
  76. data/public/css/menuitem.gif +0 -0
  77. data/public/css/more.gif +0 -0
  78. data/public/{stylesheets → css}/reset.css +1 -1
  79. data/public/css/smoothness/images/ui-anim_basic_16x16.gif +0 -0
  80. data/public/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  81. data/public/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  82. data/public/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  83. data/public/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  84. data/public/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  85. data/public/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  86. data/public/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  87. data/public/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  88. data/public/css/smoothness/images/ui-icons_222222_256x240.png +0 -0
  89. data/public/css/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  90. data/public/css/smoothness/images/ui-icons_454545_256x240.png +0 -0
  91. data/public/css/smoothness/images/ui-icons_888888_256x240.png +0 -0
  92. data/public/css/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  93. data/public/css/smoothness/jquery-ui.css +489 -0
  94. data/public/css/ui-lightness/images/ui-anim_basic_16x16.gif +0 -0
  95. data/public/css/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
  96. data/public/css/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
  97. data/public/css/ui-lightness/images/ui-bg_flat_10_000000_40x100.png +0 -0
  98. data/public/css/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
  99. data/public/css/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
  100. data/public/css/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  101. data/public/css/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
  102. data/public/css/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  103. data/public/css/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  104. data/public/css/ui-lightness/images/ui-icons_222222_256x240.png +0 -0
  105. data/public/css/ui-lightness/images/ui-icons_228ef1_256x240.png +0 -0
  106. data/public/css/ui-lightness/images/ui-icons_ef8c08_256x240.png +0 -0
  107. data/public/css/ui-lightness/images/ui-icons_ffd27a_256x240.png +0 -0
  108. data/public/css/ui-lightness/images/ui-icons_ffffff_256x240.png +0 -0
  109. data/public/css/ui-lightness/jquery-ui.css +489 -0
  110. data/public/css/webtools.css +65 -0
  111. data/public/favicon.ico +0 -0
  112. data/public/flot/API.txt +1201 -0
  113. data/public/flot/FAQ.txt +76 -0
  114. data/public/flot/LICENSE.txt +22 -0
  115. data/public/flot/Makefile +9 -0
  116. data/public/flot/NEWS.txt +508 -0
  117. data/public/flot/PLUGINS.txt +137 -0
  118. data/public/flot/README.txt +90 -0
  119. data/public/flot/examples/ajax.html +143 -0
  120. data/public/flot/examples/annotating.html +75 -0
  121. data/public/flot/examples/arrow-down.gif +0 -0
  122. data/public/flot/examples/arrow-left.gif +0 -0
  123. data/public/flot/examples/arrow-right.gif +0 -0
  124. data/public/flot/examples/arrow-up.gif +0 -0
  125. data/public/flot/examples/basic.html +38 -0
  126. data/public/flot/examples/data-eu-gdp-growth-1.json +4 -0
  127. data/public/flot/examples/data-eu-gdp-growth-2.json +4 -0
  128. data/public/flot/examples/data-eu-gdp-growth-3.json +4 -0
  129. data/public/flot/examples/data-eu-gdp-growth-4.json +4 -0
  130. data/public/flot/examples/data-eu-gdp-growth-5.json +4 -0
  131. data/public/flot/examples/data-eu-gdp-growth.json +4 -0
  132. data/public/flot/examples/data-japan-gdp-growth.json +4 -0
  133. data/public/flot/examples/data-usa-gdp-growth.json +4 -0
  134. data/public/flot/examples/graph-types.html +75 -0
  135. data/public/flot/examples/hs-2004-27-a-large_web.jpg +0 -0
  136. data/public/flot/examples/image.html +45 -0
  137. data/public/flot/examples/index.html +44 -0
  138. data/public/flot/examples/interacting-axes.html +97 -0
  139. data/public/flot/examples/interacting.html +93 -0
  140. data/public/flot/examples/layout.css +6 -0
  141. data/public/flot/examples/multiple-axes.html +60 -0
  142. data/public/flot/examples/navigate.html +118 -0
  143. data/public/flot/examples/percentiles.html +57 -0
  144. data/public/flot/examples/pie.html +756 -0
  145. data/public/flot/examples/realtime.html +83 -0
  146. data/public/flot/examples/resize.html +61 -0
  147. data/public/flot/examples/selection.html +114 -0
  148. data/public/flot/examples/setting-options.html +61 -0
  149. data/public/flot/examples/stacking.html +77 -0
  150. data/public/flot/examples/symbols.html +49 -0
  151. data/public/flot/examples/thresholding.html +54 -0
  152. data/public/flot/examples/time.html +71 -0
  153. data/public/flot/examples/tracking.html +95 -0
  154. data/public/flot/examples/turning-series.html +98 -0
  155. data/public/flot/examples/visitors.html +90 -0
  156. data/public/flot/examples/zooming.html +98 -0
  157. data/public/flot/excanvas.js +1427 -0
  158. data/public/flot/excanvas.min.js +1 -0
  159. data/public/flot/jquery.colorhelpers.js +179 -0
  160. data/public/flot/jquery.colorhelpers.min.js +1 -0
  161. data/public/flot/jquery.flot.crosshair.js +167 -0
  162. data/public/flot/jquery.flot.crosshair.min.js +1 -0
  163. data/public/flot/jquery.flot.fillbetween.js +183 -0
  164. data/public/flot/jquery.flot.fillbetween.min.js +1 -0
  165. data/public/flot/jquery.flot.image.js +238 -0
  166. data/public/flot/jquery.flot.image.min.js +1 -0
  167. data/public/flot/jquery.flot.js +2599 -0
  168. data/public/flot/jquery.flot.min.js +6 -0
  169. data/public/flot/jquery.flot.navigate.js +336 -0
  170. data/public/flot/jquery.flot.navigate.min.js +1 -0
  171. data/public/flot/jquery.flot.pie.js +750 -0
  172. data/public/flot/jquery.flot.pie.min.js +1 -0
  173. data/public/flot/jquery.flot.resize.js +60 -0
  174. data/public/flot/jquery.flot.resize.min.js +1 -0
  175. data/public/flot/jquery.flot.selection.js +344 -0
  176. data/public/flot/jquery.flot.selection.min.js +1 -0
  177. data/public/flot/jquery.flot.stack.js +184 -0
  178. data/public/flot/jquery.flot.stack.min.js +1 -0
  179. data/public/flot/jquery.flot.symbol.js +70 -0
  180. data/public/flot/jquery.flot.symbol.min.js +1 -0
  181. data/public/flot/jquery.flot.threshold.js +103 -0
  182. data/public/flot/jquery.flot.threshold.min.js +1 -0
  183. data/public/flot/jquery.js +8316 -0
  184. data/public/flot/jquery.min.js +23 -0
  185. data/public/genPacking.pl +30 -0
  186. data/public/index.html +28 -0
  187. data/public/install.tpz +66 -0
  188. data/public/installAndRun.tpz +5 -0
  189. data/public/jsTree/jquery.jstree.js +3510 -0
  190. data/public/jsTree/themes/default/d.gif +0 -0
  191. data/public/jsTree/themes/default/d.png +0 -0
  192. data/public/jsTree/themes/default/style.css +73 -0
  193. data/public/jsTree/themes/default/throbber.gif +0 -0
  194. data/public/readMe.txt +9 -0
  195. data/public/scripts/CodeBrowser.js +645 -0
  196. data/public/scripts/Debugger.js +134 -0
  197. data/public/scripts/MethodList.js +72 -0
  198. data/public/scripts/ObjectLog.js +59 -0
  199. data/public/scripts/SessionList.js +164 -0
  200. data/public/scripts/Statistics.js +266 -0
  201. data/public/scripts/editor.js +430 -0
  202. data/public/scripts/jjmenu.js +375 -0
  203. data/public/scripts/jquery-ui.js +1012 -0
  204. data/public/scripts/jquery.js +154 -0
  205. data/public/scripts/webtools.js +374 -0
  206. data/public/src/CodeBrowser.gs +416 -0
  207. data/public/src/Debugger.gs +132 -0
  208. data/public/src/MethodList.gs +130 -0
  209. data/public/src/ObjectLog.gs +73 -0
  210. data/public/src/Server.gs +544 -0
  211. data/public/src/SessionList.gs +172 -0
  212. data/public/src/SharedPageCache.gs +66 -0
  213. data/public/src/StatProcess.gs +280 -0
  214. data/public/src/StatProcessType.gs +242 -0
  215. data/public/src/StatStatistic.gs +381 -0
  216. data/public/src/Statistics.gs +222 -0
  217. data/public/src/Statmonitor.gs +490 -0
  218. data/public/src/Tool.gs +86 -0
  219. data/public/src/VersionReport.gs +52 -0
  220. data/public/src/Workspace.gs +163 -0
  221. data/views/debugger.rhtml +6 -9
  222. metadata +344 -243
  223. data/lib/web_tools/#debugger.rb# +0 -212
  224. data/lib/web_tools/browser.rb +0 -45
  225. data/public/images/favicon.ico +0 -0
  226. data/public/javascript/CodeMirror/LICENSE +0 -23
  227. data/public/javascript/CodeMirror/css/Smalltalk.css +0 -34
  228. data/public/javascript/CodeMirror/js/codemirror.js +0 -582
  229. data/public/javascript/CodeMirror/js/editor.js +0 -1671
  230. data/public/javascript/CodeMirror/js/highlight.js +0 -68
  231. data/public/javascript/CodeMirror/js/parseSmalltalk.js +0 -126
  232. data/public/javascript/CodeMirror/js/parsedummy.js +0 -32
  233. data/public/javascript/CodeMirror/js/select.js +0 -699
  234. data/public/javascript/CodeMirror/js/stringstream.js +0 -159
  235. data/public/javascript/CodeMirror/js/tokenize.js +0 -57
  236. data/public/javascript/CodeMirror/js/undo.js +0 -413
  237. data/public/javascript/CodeMirror/js/util.js +0 -133
  238. data/public/javascript/CodeMirror/testSmalltalkParser.html +0 -116
  239. data/public/javascript/ace/ace-uncompressed.js +0 -17299
  240. data/public/javascript/ace/ace.js +0 -1
  241. data/public/javascript/ace/keybinding-emacs.js +0 -1
  242. data/public/javascript/ace/keybinding-vim.js +0 -1
  243. data/public/javascript/ace/mode-c_cpp.js +0 -1
  244. data/public/javascript/ace/mode-clojure.js +0 -1
  245. data/public/javascript/ace/mode-coffee.js +0 -1
  246. data/public/javascript/ace/mode-csharp.js +0 -1
  247. data/public/javascript/ace/mode-css.js +0 -1
  248. data/public/javascript/ace/mode-groovy.js +0 -1
  249. data/public/javascript/ace/mode-html.js +0 -1
  250. data/public/javascript/ace/mode-java.js +0 -1
  251. data/public/javascript/ace/mode-javascript.js +0 -1
  252. data/public/javascript/ace/mode-json.js +0 -1
  253. data/public/javascript/ace/mode-lua.js +0 -1
  254. data/public/javascript/ace/mode-markdown.js +0 -1
  255. data/public/javascript/ace/mode-ocaml.js +0 -1
  256. data/public/javascript/ace/mode-perl.js +0 -1
  257. data/public/javascript/ace/mode-php.js +0 -1
  258. data/public/javascript/ace/mode-python.js +0 -1
  259. data/public/javascript/ace/mode-ruby.js +0 -1
  260. data/public/javascript/ace/mode-scad.js +0 -1
  261. data/public/javascript/ace/mode-scala.js +0 -1
  262. data/public/javascript/ace/mode-scss.js +0 -1
  263. data/public/javascript/ace/mode-svg.js +0 -1
  264. data/public/javascript/ace/mode-textile.js +0 -1
  265. data/public/javascript/ace/mode-xml.js +0 -1
  266. data/public/javascript/ace/theme-clouds.js +0 -1
  267. data/public/javascript/ace/theme-clouds_midnight.js +0 -1
  268. data/public/javascript/ace/theme-cobalt.js +0 -1
  269. data/public/javascript/ace/theme-crimson_editor.js +0 -1
  270. data/public/javascript/ace/theme-dawn.js +0 -1
  271. data/public/javascript/ace/theme-eclipse.js +0 -1
  272. data/public/javascript/ace/theme-idle_fingers.js +0 -1
  273. data/public/javascript/ace/theme-kr_theme.js +0 -1
  274. data/public/javascript/ace/theme-merbivore.js +0 -1
  275. data/public/javascript/ace/theme-merbivore_soft.js +0 -1
  276. data/public/javascript/ace/theme-mono_industrial.js +0 -1
  277. data/public/javascript/ace/theme-monokai.js +0 -1
  278. data/public/javascript/ace/theme-pastel_on_dark.js +0 -1
  279. data/public/javascript/ace/theme-solarized_dark.js +0 -1
  280. data/public/javascript/ace/theme-solarized_light.js +0 -1
  281. data/public/javascript/ace/theme-textmate.js +0 -1
  282. data/public/javascript/ace/theme-twilight.js +0 -1
  283. data/public/javascript/ace/theme-vibrant_ink.js +0 -1
  284. data/public/javascript/ace/worker-coffee.js +0 -1
  285. data/public/javascript/ace/worker-css.js +0 -1
  286. data/public/javascript/ace/worker-javascript.js +0 -1
  287. data/public/javascript/webtools/browser.js +0 -260
  288. data/public/javascript/webtools/debugger.coffee +0 -286
  289. data/public/javascript/webtools/debugger.js +0 -366
  290. data/public/javascript/webtools/sessions.coffee +0 -17
  291. data/public/javascript/webtools/sessions.js +0 -27
  292. data/public/javascript/webtools/version.coffee +0 -14
  293. data/public/javascript/webtools/version.js +0 -20
  294. data/public/stylesheets/jquery.contextMenu.css +0 -62
  295. data/public/stylesheets/webtools.css +0 -53
  296. data/public/test.html +0 -47
@@ -0,0 +1,23 @@
1
+ /*
2
+ * jQuery JavaScript Library v1.5.1
3
+ * http://jquery.com/
4
+ *
5
+ * Copyright 2011, John Resig
6
+ * Dual licensed under the MIT or GPL Version 2 licenses.
7
+ * http://jquery.org/license
8
+ *
9
+ * Includes Sizzle.js
10
+ * http://sizzlejs.com/
11
+ * Copyright 2011, The Dojo Foundation
12
+ * Released under the MIT, BSD, and GPL Licenses.
13
+ *
14
+ * Date: Wed Feb 23 13:55:29 2011 -0500
15
+ */
16
+ (function(aY,H){var al=aY.document;var a=(function(){var bn=function(bI,bJ){return new bn.fn.init(bI,bJ,bl)},bD=aY.jQuery,bp=aY.$,bl,bH=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,bv=/\S/,br=/^\s+/,bm=/\s+$/,bq=/\d/,bj=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,bw=/^[\],:{}\s]*$/,bF=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,by=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,bs=/(?:^|:|,)(?:\s*\[)+/g,bh=/(webkit)[ \/]([\w.]+)/,bA=/(opera)(?:.*version)?[ \/]([\w.]+)/,bz=/(msie) ([\w.]+)/,bB=/(mozilla)(?:.*? rv:([\w.]+))?/,bG=navigator.userAgent,bE,bC=false,bk,e="then done fail isResolved isRejected promise".split(" "),bd,bu=Object.prototype.toString,bo=Object.prototype.hasOwnProperty,bi=Array.prototype.push,bt=Array.prototype.slice,bx=String.prototype.trim,be=Array.prototype.indexOf,bg={};bn.fn=bn.prototype={constructor:bn,init:function(bI,bM,bL){var bK,bN,bJ,bO;if(!bI){return this}if(bI.nodeType){this.context=this[0]=bI;this.length=1;return this}if(bI==="body"&&!bM&&al.body){this.context=al;this[0]=al.body;this.selector="body";this.length=1;return this}if(typeof bI==="string"){bK=bH.exec(bI);if(bK&&(bK[1]||!bM)){if(bK[1]){bM=bM instanceof bn?bM[0]:bM;bO=(bM?bM.ownerDocument||bM:al);bJ=bj.exec(bI);if(bJ){if(bn.isPlainObject(bM)){bI=[al.createElement(bJ[1])];bn.fn.attr.call(bI,bM,true)}else{bI=[bO.createElement(bJ[1])]}}else{bJ=bn.buildFragment([bK[1]],[bO]);bI=(bJ.cacheable?bn.clone(bJ.fragment):bJ.fragment).childNodes}return bn.merge(this,bI)}else{bN=al.getElementById(bK[2]);if(bN&&bN.parentNode){if(bN.id!==bK[2]){return bL.find(bI)}this.length=1;this[0]=bN}this.context=al;this.selector=bI;return this}}else{if(!bM||bM.jquery){return(bM||bL).find(bI)}else{return this.constructor(bM).find(bI)}}}else{if(bn.isFunction(bI)){return bL.ready(bI)}}if(bI.selector!==H){this.selector=bI.selector;this.context=bI.context}return bn.makeArray(bI,this)},selector:"",jquery:"1.5.1",length:0,size:function(){return this.length},toArray:function(){return bt.call(this,0)},get:function(bI){return bI==null?this.toArray():(bI<0?this[this.length+bI]:this[bI])},pushStack:function(bJ,bL,bI){var bK=this.constructor();if(bn.isArray(bJ)){bi.apply(bK,bJ)}else{bn.merge(bK,bJ)}bK.prevObject=this;bK.context=this.context;if(bL==="find"){bK.selector=this.selector+(this.selector?" ":"")+bI}else{if(bL){bK.selector=this.selector+"."+bL+"("+bI+")"}}return bK},each:function(bJ,bI){return bn.each(this,bJ,bI)},ready:function(bI){bn.bindReady();bk.done(bI);return this},eq:function(bI){return bI===-1?this.slice(bI):this.slice(bI,+bI+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(bt.apply(this,arguments),"slice",bt.call(arguments).join(","))},map:function(bI){return this.pushStack(bn.map(this,function(bK,bJ){return bI.call(bK,bJ,bK)}))},end:function(){return this.prevObject||this.constructor(null)},push:bi,sort:[].sort,splice:[].splice};bn.fn.init.prototype=bn.fn;bn.extend=bn.fn.extend=function(){var bR,bK,bI,bJ,bO,bP,bN=arguments[0]||{},bM=1,bL=arguments.length,bQ=false;if(typeof bN==="boolean"){bQ=bN;bN=arguments[1]||{};bM=2}if(typeof bN!=="object"&&!bn.isFunction(bN)){bN={}}if(bL===bM){bN=this;--bM}for(;bM<bL;bM++){if((bR=arguments[bM])!=null){for(bK in bR){bI=bN[bK];bJ=bR[bK];if(bN===bJ){continue}if(bQ&&bJ&&(bn.isPlainObject(bJ)||(bO=bn.isArray(bJ)))){if(bO){bO=false;bP=bI&&bn.isArray(bI)?bI:[]}else{bP=bI&&bn.isPlainObject(bI)?bI:{}}bN[bK]=bn.extend(bQ,bP,bJ)}else{if(bJ!==H){bN[bK]=bJ}}}}}return bN};bn.extend({noConflict:function(bI){aY.$=bp;if(bI){aY.jQuery=bD}return bn},isReady:false,readyWait:1,ready:function(bI){if(bI===true){bn.readyWait--}if(!bn.readyWait||(bI!==true&&!bn.isReady)){if(!al.body){return setTimeout(bn.ready,1)}bn.isReady=true;if(bI!==true&&--bn.readyWait>0){return}bk.resolveWith(al,[bn]);if(bn.fn.trigger){bn(al).trigger("ready").unbind("ready")}}},bindReady:function(){if(bC){return}bC=true;if(al.readyState==="complete"){return setTimeout(bn.ready,1)}if(al.addEventListener){al.addEventListener("DOMContentLoaded",bd,false);aY.addEventListener("load",bn.ready,false)}else{if(al.attachEvent){al.attachEvent("onreadystatechange",bd);aY.attachEvent("onload",bn.ready);var bI=false;try{bI=aY.frameElement==null}catch(bJ){}if(al.documentElement.doScroll&&bI){bf()}}}},isFunction:function(bI){return bn.type(bI)==="function"},isArray:Array.isArray||function(bI){return bn.type(bI)==="array"},isWindow:function(bI){return bI&&typeof bI==="object"&&"setInterval" in bI},isNaN:function(bI){return bI==null||!bq.test(bI)||isNaN(bI)},type:function(bI){return bI==null?String(bI):bg[bu.call(bI)]||"object"},isPlainObject:function(bJ){if(!bJ||bn.type(bJ)!=="object"||bJ.nodeType||bn.isWindow(bJ)){return false}if(bJ.constructor&&!bo.call(bJ,"constructor")&&!bo.call(bJ.constructor.prototype,"isPrototypeOf")){return false}var bI;for(bI in bJ){}return bI===H||bo.call(bJ,bI)},isEmptyObject:function(bJ){for(var bI in bJ){return false}return true},error:function(bI){throw bI},parseJSON:function(bI){if(typeof bI!=="string"||!bI){return null}bI=bn.trim(bI);if(bw.test(bI.replace(bF,"@").replace(by,"]").replace(bs,""))){return aY.JSON&&aY.JSON.parse?aY.JSON.parse(bI):(new Function("return "+bI))()}else{bn.error("Invalid JSON: "+bI)}},parseXML:function(bK,bI,bJ){if(aY.DOMParser){bJ=new DOMParser();bI=bJ.parseFromString(bK,"text/xml")}else{bI=new ActiveXObject("Microsoft.XMLDOM");bI.async="false";bI.loadXML(bK)}bJ=bI.documentElement;if(!bJ||!bJ.nodeName||bJ.nodeName==="parsererror"){bn.error("Invalid XML: "+bK)}return bI},noop:function(){},globalEval:function(bK){if(bK&&bv.test(bK)){var bJ=al.head||al.getElementsByTagName("head")[0]||al.documentElement,bI=al.createElement("script");if(bn.support.scriptEval()){bI.appendChild(al.createTextNode(bK))}else{bI.text=bK}bJ.insertBefore(bI,bJ.firstChild);bJ.removeChild(bI)}},nodeName:function(bJ,bI){return bJ.nodeName&&bJ.nodeName.toUpperCase()===bI.toUpperCase()},each:function(bL,bP,bK){var bJ,bM=0,bN=bL.length,bI=bN===H||bn.isFunction(bL);if(bK){if(bI){for(bJ in bL){if(bP.apply(bL[bJ],bK)===false){break}}}else{for(;bM<bN;){if(bP.apply(bL[bM++],bK)===false){break}}}}else{if(bI){for(bJ in bL){if(bP.call(bL[bJ],bJ,bL[bJ])===false){break}}}else{for(var bO=bL[0];bM<bN&&bP.call(bO,bM,bO)!==false;bO=bL[++bM]){}}}return bL},trim:bx?function(bI){return bI==null?"":bx.call(bI)}:function(bI){return bI==null?"":bI.toString().replace(br,"").replace(bm,"")},makeArray:function(bL,bJ){var bI=bJ||[];if(bL!=null){var bK=bn.type(bL);if(bL.length==null||bK==="string"||bK==="function"||bK==="regexp"||bn.isWindow(bL)){bi.call(bI,bL)}else{bn.merge(bI,bL)}}return bI},inArray:function(bK,bL){if(bL.indexOf){return bL.indexOf(bK)}for(var bI=0,bJ=bL.length;bI<bJ;bI++){if(bL[bI]===bK){return bI}}return -1},merge:function(bM,bK){var bL=bM.length,bJ=0;if(typeof bK.length==="number"){for(var bI=bK.length;bJ<bI;bJ++){bM[bL++]=bK[bJ]}}else{while(bK[bJ]!==H){bM[bL++]=bK[bJ++]}}bM.length=bL;return bM},grep:function(bJ,bO,bI){var bK=[],bN;bI=!!bI;for(var bL=0,bM=bJ.length;bL<bM;bL++){bN=!!bO(bJ[bL],bL);if(bI!==bN){bK.push(bJ[bL])}}return bK},map:function(bJ,bO,bI){var bK=[],bN;for(var bL=0,bM=bJ.length;bL<bM;bL++){bN=bO(bJ[bL],bL,bI);if(bN!=null){bK[bK.length]=bN}}return bK.concat.apply([],bK)},guid:1,proxy:function(bK,bJ,bI){if(arguments.length===2){if(typeof bJ==="string"){bI=bK;bK=bI[bJ];bJ=H}else{if(bJ&&!bn.isFunction(bJ)){bI=bJ;bJ=H}}}if(!bJ&&bK){bJ=function(){return bK.apply(bI||this,arguments)}}if(bK){bJ.guid=bK.guid=bK.guid||bJ.guid||bn.guid++}return bJ},access:function(bI,bQ,bO,bK,bN,bP){var bJ=bI.length;if(typeof bQ==="object"){for(var bL in bQ){bn.access(bI,bL,bQ[bL],bK,bN,bO)}return bI}if(bO!==H){bK=!bP&&bK&&bn.isFunction(bO);for(var bM=0;bM<bJ;bM++){bN(bI[bM],bQ,bK?bO.call(bI[bM],bM,bN(bI[bM],bQ)):bO,bP)}return bI}return bJ?bN(bI[0],bQ):H},now:function(){return(new Date()).getTime()},_Deferred:function(){var bL=[],bM,bJ,bK,bI={done:function(){if(!bK){var bO=arguments,bP,bS,bR,bQ,bN;if(bM){bN=bM;bM=0}for(bP=0,bS=bO.length;bP<bS;bP++){bR=bO[bP];bQ=bn.type(bR);if(bQ==="array"){bI.done.apply(bI,bR)}else{if(bQ==="function"){bL.push(bR)}}}if(bN){bI.resolveWith(bN[0],bN[1])}}return this},resolveWith:function(bO,bN){if(!bK&&!bM&&!bJ){bJ=1;try{while(bL[0]){bL.shift().apply(bO,bN)}}catch(bP){throw bP}finally{bM=[bO,bN];bJ=0}}return this},resolve:function(){bI.resolveWith(bn.isFunction(this.promise)?this.promise():this,arguments);return this},isResolved:function(){return !!(bJ||bM)},cancel:function(){bK=1;bL=[];return this}};return bI},Deferred:function(bJ){var bI=bn._Deferred(),bL=bn._Deferred(),bK;bn.extend(bI,{then:function(bN,bM){bI.done(bN).fail(bM);return this},fail:bL.done,rejectWith:bL.resolveWith,reject:bL.resolve,isRejected:bL.isResolved,promise:function(bN){if(bN==null){if(bK){return bK}bK=bN={}}var bM=e.length;while(bM--){bN[e[bM]]=bI[e[bM]]}return bN}});bI.done(bL.cancel).fail(bI.cancel);delete bI.cancel;if(bJ){bJ.call(bI,bI)}return bI},when:function(bJ){var bO=arguments.length,bI=bO<=1&&bJ&&bn.isFunction(bJ.promise)?bJ:bn.Deferred(),bM=bI.promise();if(bO>1){var bN=bt.call(arguments,0),bL=bO,bK=function(bP){return function(bQ){bN[bP]=arguments.length>1?bt.call(arguments,0):bQ;if(!(--bL)){bI.resolveWith(bM,bN)}}};while((bO--)){bJ=bN[bO];if(bJ&&bn.isFunction(bJ.promise)){bJ.promise().then(bK(bO),bI.reject)}else{--bL}}if(!bL){bI.resolveWith(bM,bN)}}else{if(bI!==bJ){bI.resolve(bJ)}}return bM},uaMatch:function(bJ){bJ=bJ.toLowerCase();var bI=bh.exec(bJ)||bA.exec(bJ)||bz.exec(bJ)||bJ.indexOf("compatible")<0&&bB.exec(bJ)||[];return{browser:bI[1]||"",version:bI[2]||"0"}},sub:function(){function bJ(bL,bM){return new bJ.fn.init(bL,bM)}bn.extend(true,bJ,this);bJ.superclass=this;bJ.fn=bJ.prototype=this();bJ.fn.constructor=bJ;bJ.subclass=this.subclass;bJ.fn.init=function bK(bL,bM){if(bM&&bM instanceof bn&&!(bM instanceof bJ)){bM=bJ(bM)}return bn.fn.init.call(this,bL,bM,bI)};bJ.fn.init.prototype=bJ.fn;var bI=bJ(al);return bJ},browser:{}});bk=bn._Deferred();bn.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(bJ,bI){bg["[object "+bI+"]"]=bI.toLowerCase()});bE=bn.uaMatch(bG);if(bE.browser){bn.browser[bE.browser]=true;bn.browser.version=bE.version}if(bn.browser.webkit){bn.browser.safari=true}if(be){bn.inArray=function(bI,bJ){return be.call(bJ,bI)}}if(bv.test("\xA0")){br=/^[\s\xA0]+/;bm=/[\s\xA0]+$/}bl=bn(al);if(al.addEventListener){bd=function(){al.removeEventListener("DOMContentLoaded",bd,false);bn.ready()}}else{if(al.attachEvent){bd=function(){if(al.readyState==="complete"){al.detachEvent("onreadystatechange",bd);bn.ready()}}}}function bf(){if(bn.isReady){return}try{al.documentElement.doScroll("left")}catch(bI){setTimeout(bf,1);return}bn.ready()}return bn})();(function(){a.support={};var bd=al.createElement("div");bd.style.display="none";bd.innerHTML=" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";var bm=bd.getElementsByTagName("*"),bk=bd.getElementsByTagName("a")[0],bl=al.createElement("select"),be=bl.appendChild(al.createElement("option")),bj=bd.getElementsByTagName("input")[0];if(!bm||!bm.length||!bk){return}a.support={leadingWhitespace:bd.firstChild.nodeType===3,tbody:!bd.getElementsByTagName("tbody").length,htmlSerialize:!!bd.getElementsByTagName("link").length,style:/red/.test(bk.getAttribute("style")),hrefNormalized:bk.getAttribute("href")==="/a",opacity:/^0.55$/.test(bk.style.opacity),cssFloat:!!bk.style.cssFloat,checkOn:bj.value==="on",optSelected:be.selected,deleteExpando:true,optDisabled:false,checkClone:false,noCloneEvent:true,noCloneChecked:true,boxModel:null,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableHiddenOffsets:true};bj.checked=true;a.support.noCloneChecked=bj.cloneNode(true).checked;bl.disabled=true;a.support.optDisabled=!be.disabled;var bf=null;a.support.scriptEval=function(){if(bf===null){var bo=al.documentElement,bp=al.createElement("script"),br="script"+a.now();try{bp.appendChild(al.createTextNode("window."+br+"=1;"))}catch(bq){}bo.insertBefore(bp,bo.firstChild);if(aY[br]){bf=true;delete aY[br]}else{bf=false}bo.removeChild(bp);bo=bp=br=null}return bf};try{delete bd.test}catch(bh){a.support.deleteExpando=false}if(!bd.addEventListener&&bd.attachEvent&&bd.fireEvent){bd.attachEvent("onclick",function bn(){a.support.noCloneEvent=false;bd.detachEvent("onclick",bn)});bd.cloneNode(true).fireEvent("onclick")}bd=al.createElement("div");bd.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";var bg=al.createDocumentFragment();bg.appendChild(bd.firstChild);a.support.checkClone=bg.cloneNode(true).cloneNode(true).lastChild.checked;a(function(){var bp=al.createElement("div"),e=al.getElementsByTagName("body")[0];if(!e){return}bp.style.width=bp.style.paddingLeft="1px";e.appendChild(bp);a.boxModel=a.support.boxModel=bp.offsetWidth===2;if("zoom" in bp.style){bp.style.display="inline";bp.style.zoom=1;a.support.inlineBlockNeedsLayout=bp.offsetWidth===2;bp.style.display="";bp.innerHTML="<div style='width:4px;'></div>";a.support.shrinkWrapBlocks=bp.offsetWidth!==2}bp.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";var bo=bp.getElementsByTagName("td");a.support.reliableHiddenOffsets=bo[0].offsetHeight===0;bo[0].style.display="";bo[1].style.display="none";a.support.reliableHiddenOffsets=a.support.reliableHiddenOffsets&&bo[0].offsetHeight===0;bp.innerHTML="";e.removeChild(bp).style.display="none";bp=bo=null});var bi=function(e){var bp=al.createElement("div");e="on"+e;if(!bp.attachEvent){return true}var bo=(e in bp);if(!bo){bp.setAttribute(e,"return;");bo=typeof bp[e]==="function"}bp=null;return bo};a.support.submitBubbles=bi("submit");a.support.changeBubbles=bi("change");bd=bm=bk=null})();var aE=/^(?:\{.*\}|\[.*\])$/;a.extend({cache:{},uuid:0,expando:"jQuery"+(a.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:true,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},hasData:function(e){e=e.nodeType?a.cache[e[a.expando]]:e[a.expando];return !!e&&!P(e)},data:function(bf,bd,bh,bg){if(!a.acceptData(bf)){return}var bk=a.expando,bj=typeof bd==="string",bi,bl=bf.nodeType,e=bl?a.cache:bf,be=bl?bf[a.expando]:bf[a.expando]&&a.expando;if((!be||(bg&&be&&!e[be][bk]))&&bj&&bh===H){return}if(!be){if(bl){bf[a.expando]=be=++a.uuid}else{be=a.expando}}if(!e[be]){e[be]={};if(!bl){e[be].toJSON=a.noop}}if(typeof bd==="object"||typeof bd==="function"){if(bg){e[be][bk]=a.extend(e[be][bk],bd)}else{e[be]=a.extend(e[be],bd)}}bi=e[be];if(bg){if(!bi[bk]){bi[bk]={}}bi=bi[bk]}if(bh!==H){bi[bd]=bh}if(bd==="events"&&!bi[bd]){return bi[bk]&&bi[bk].events}return bj?bi[bd]:bi},removeData:function(bg,be,bh){if(!a.acceptData(bg)){return}var bj=a.expando,bk=bg.nodeType,bd=bk?a.cache:bg,bf=bk?bg[a.expando]:a.expando;if(!bd[bf]){return}if(be){var bi=bh?bd[bf][bj]:bd[bf];if(bi){delete bi[be];if(!P(bi)){return}}}if(bh){delete bd[bf][bj];if(!P(bd[bf])){return}}var e=bd[bf][bj];if(a.support.deleteExpando||bd!=aY){delete bd[bf]}else{bd[bf]=null}if(e){bd[bf]={};if(!bk){bd[bf].toJSON=a.noop}bd[bf][bj]=e}else{if(bk){if(a.support.deleteExpando){delete bg[a.expando]}else{if(bg.removeAttribute){bg.removeAttribute(a.expando)}else{bg[a.expando]=null}}}}},_data:function(bd,e,be){return a.data(bd,e,be,true)},acceptData:function(bd){if(bd.nodeName){var e=a.noData[bd.nodeName.toLowerCase()];if(e){return !(e===true||bd.getAttribute("classid")!==e)}}return true}});a.fn.extend({data:function(bg,bi){var bh=null;if(typeof bg==="undefined"){if(this.length){bh=a.data(this[0]);if(this[0].nodeType===1){var e=this[0].attributes,be;for(var bf=0,bd=e.length;bf<bd;bf++){be=e[bf].name;if(be.indexOf("data-")===0){be=be.substr(5);aT(this[0],be,bh[be])}}}}return bh}else{if(typeof bg==="object"){return this.each(function(){a.data(this,bg)})}}var bj=bg.split(".");bj[1]=bj[1]?"."+bj[1]:"";if(bi===H){bh=this.triggerHandler("getData"+bj[1]+"!",[bj[0]]);if(bh===H&&this.length){bh=a.data(this[0],bg);bh=aT(this[0],bg,bh)}return bh===H&&bj[1]?this.data(bj[0]):bh}else{return this.each(function(){var bl=a(this),bk=[bj[0],bi];bl.triggerHandler("setData"+bj[1]+"!",bk);a.data(this,bg,bi);bl.triggerHandler("changeData"+bj[1]+"!",bk)})}},removeData:function(e){return this.each(function(){a.removeData(this,e)})}});function aT(be,bd,bf){if(bf===H&&be.nodeType===1){bf=be.getAttribute("data-"+bd);if(typeof bf==="string"){try{bf=bf==="true"?true:bf==="false"?false:bf==="null"?null:!a.isNaN(bf)?parseFloat(bf):aE.test(bf)?a.parseJSON(bf):bf}catch(bg){}a.data(be,bd,bf)}else{bf=H}}return bf}function P(bd){for(var e in bd){if(e!=="toJSON"){return false}}return true}a.extend({queue:function(bd,e,bf){if(!bd){return}e=(e||"fx")+"queue";var be=a._data(bd,e);if(!bf){return be||[]}if(!be||a.isArray(bf)){be=a._data(bd,e,a.makeArray(bf))}else{be.push(bf)}return be},dequeue:function(bf,be){be=be||"fx";var e=a.queue(bf,be),bd=e.shift();if(bd==="inprogress"){bd=e.shift()}if(bd){if(be==="fx"){e.unshift("inprogress")}bd.call(bf,function(){a.dequeue(bf,be)})}if(!e.length){a.removeData(bf,be+"queue",true)}}});a.fn.extend({queue:function(e,bd){if(typeof e!=="string"){bd=e;e="fx"}if(bd===H){return a.queue(this[0],e)}return this.each(function(bf){var be=a.queue(this,e,bd);if(e==="fx"&&be[0]!=="inprogress"){a.dequeue(this,e)}})},dequeue:function(e){return this.each(function(){a.dequeue(this,e)})},delay:function(bd,e){bd=a.fx?a.fx.speeds[bd]||bd:bd;e=e||"fx";return this.queue(e,function(){var be=this;setTimeout(function(){a.dequeue(be,e)},bd)})},clearQueue:function(e){return this.queue(e||"fx",[])}});var aC=/[\n\t\r]/g,a3=/\s+/,aG=/\r/g,a2=/^(?:href|src|style)$/,f=/^(?:button|input)$/i,C=/^(?:button|input|object|select|textarea)$/i,k=/^a(?:rea)?$/i,Q=/^(?:radio|checkbox)$/i;a.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};a.fn.extend({attr:function(e,bd){return a.access(this,e,bd,true,a.attr)},removeAttr:function(e,bd){return this.each(function(){a.attr(this,e,"");if(this.nodeType===1){this.removeAttribute(e)}})},addClass:function(bj){if(a.isFunction(bj)){return this.each(function(bm){var bl=a(this);bl.addClass(bj.call(this,bm,bl.attr("class")))})}if(bj&&typeof bj==="string"){var e=(bj||"").split(a3);for(var bf=0,be=this.length;bf<be;bf++){var bd=this[bf];if(bd.nodeType===1){if(!bd.className){bd.className=bj}else{var bg=" "+bd.className+" ",bi=bd.className;for(var bh=0,bk=e.length;bh<bk;bh++){if(bg.indexOf(" "+e[bh]+" ")<0){bi+=" "+e[bh]}}bd.className=a.trim(bi)}}}}return this},removeClass:function(bh){if(a.isFunction(bh)){return this.each(function(bl){var bk=a(this);bk.removeClass(bh.call(this,bl,bk.attr("class")))})}if((bh&&typeof bh==="string")||bh===H){var bi=(bh||"").split(a3);for(var be=0,bd=this.length;be<bd;be++){var bg=this[be];if(bg.nodeType===1&&bg.className){if(bh){var bf=(" "+bg.className+" ").replace(aC," ");for(var bj=0,e=bi.length;bj<e;bj++){bf=bf.replace(" "+bi[bj]+" "," ")}bg.className=a.trim(bf)}else{bg.className=""}}}}return this},toggleClass:function(bf,bd){var be=typeof bf,e=typeof bd==="boolean";if(a.isFunction(bf)){return this.each(function(bh){var bg=a(this);bg.toggleClass(bf.call(this,bh,bg.attr("class"),bd),bd)})}return this.each(function(){if(be==="string"){var bi,bh=0,bg=a(this),bj=bd,bk=bf.split(a3);while((bi=bk[bh++])){bj=e?bj:!bg.hasClass(bi);bg[bj?"addClass":"removeClass"](bi)}}else{if(be==="undefined"||be==="boolean"){if(this.className){a._data(this,"__className__",this.className)}this.className=this.className||bf===false?"":a._data(this,"__className__")||""}}})},hasClass:function(e){var bf=" "+e+" ";for(var be=0,bd=this.length;be<bd;be++){if((" "+this[be].className+" ").replace(aC," ").indexOf(bf)>-1){return true}}return false},val:function(bk){if(!arguments.length){var be=this[0];if(be){if(a.nodeName(be,"option")){var bd=be.attributes.value;return !bd||bd.specified?be.value:be.text}if(a.nodeName(be,"select")){var bi=be.selectedIndex,bl=[],bm=be.options,bh=be.type==="select-one";if(bi<0){return null}for(var bf=bh?bi:0,bj=bh?bi+1:bm.length;bf<bj;bf++){var bg=bm[bf];if(bg.selected&&(a.support.optDisabled?!bg.disabled:bg.getAttribute("disabled")===null)&&(!bg.parentNode.disabled||!a.nodeName(bg.parentNode,"optgroup"))){bk=a(bg).val();if(bh){return bk}bl.push(bk)}}if(bh&&!bl.length&&bm.length){return a(bm[bi]).val()}return bl}if(Q.test(be.type)&&!a.support.checkOn){return be.getAttribute("value")===null?"on":be.value}return(be.value||"").replace(aG,"")}return H}var e=a.isFunction(bk);return this.each(function(bp){var bo=a(this),bq=bk;if(this.nodeType!==1){return}if(e){bq=bk.call(this,bp,bo.val())}if(bq==null){bq=""}else{if(typeof bq==="number"){bq+=""}else{if(a.isArray(bq)){bq=a.map(bq,function(br){return br==null?"":br+""})}}}if(a.isArray(bq)&&Q.test(this.type)){this.checked=a.inArray(bo.val(),bq)>=0}else{if(a.nodeName(this,"select")){var bn=a.makeArray(bq);a("option",this).each(function(){this.selected=a.inArray(a(this).val(),bn)>=0});if(!bn.length){this.selectedIndex=-1}}else{this.value=bq}}})}});a.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(bd,e,bi,bl){if(!bd||bd.nodeType===3||bd.nodeType===8||bd.nodeType===2){return H}if(bl&&e in a.attrFn){return a(bd)[e](bi)}var be=bd.nodeType!==1||!a.isXMLDoc(bd),bh=bi!==H;e=be&&a.props[e]||e;if(bd.nodeType===1){var bg=a2.test(e);if(e==="selected"&&!a.support.optSelected){var bj=bd.parentNode;if(bj){bj.selectedIndex;if(bj.parentNode){bj.parentNode.selectedIndex}}}if((e in bd||bd[e]!==H)&&be&&!bg){if(bh){if(e==="type"&&f.test(bd.nodeName)&&bd.parentNode){a.error("type property can't be changed")}if(bi===null){if(bd.nodeType===1){bd.removeAttribute(e)}}else{bd[e]=bi}}if(a.nodeName(bd,"form")&&bd.getAttributeNode(e)){return bd.getAttributeNode(e).nodeValue}if(e==="tabIndex"){var bk=bd.getAttributeNode("tabIndex");return bk&&bk.specified?bk.value:C.test(bd.nodeName)||k.test(bd.nodeName)&&bd.href?0:H}return bd[e]}if(!a.support.style&&be&&e==="style"){if(bh){bd.style.cssText=""+bi}return bd.style.cssText}if(bh){bd.setAttribute(e,""+bi)}if(!bd.attributes[e]&&(bd.hasAttribute&&!bd.hasAttribute(e))){return H}var bf=!a.support.hrefNormalized&&be&&bg?bd.getAttribute(e,2):bd.getAttribute(e);return bf===null?H:bf}if(bh){bd[e]=bi}return bd[e]}});var aP=/\.(.*)$/,a0=/^(?:textarea|input|select)$/i,K=/\./g,aa=/ /g,aw=/[^\w\s.|`]/g,E=function(e){return e.replace(aw,"\\$&")};a.event={add:function(bg,bk,br,bi){if(bg.nodeType===3||bg.nodeType===8){return}try{if(a.isWindow(bg)&&(bg!==aY&&!bg.frameElement)){bg=aY}}catch(bl){}if(br===false){br=a5}else{if(!br){return}}var be,bp;if(br.handler){be=br;br=be.handler}if(!br.guid){br.guid=a.guid++}var bm=a._data(bg);if(!bm){return}var bq=bm.events,bj=bm.handle;if(!bq){bm.events=bq={}}if(!bj){bm.handle=bj=function(){return typeof a!=="undefined"&&!a.event.triggered?a.event.handle.apply(bj.elem,arguments):H}}bj.elem=bg;bk=bk.split(" ");var bo,bh=0,bd;while((bo=bk[bh++])){bp=be?a.extend({},be):{handler:br,data:bi};if(bo.indexOf(".")>-1){bd=bo.split(".");bo=bd.shift();bp.namespace=bd.slice(0).sort().join(".")}else{bd=[];bp.namespace=""}bp.type=bo;if(!bp.guid){bp.guid=br.guid}var bf=bq[bo],bn=a.event.special[bo]||{};if(!bf){bf=bq[bo]=[];if(!bn.setup||bn.setup.call(bg,bi,bd,bj)===false){if(bg.addEventListener){bg.addEventListener(bo,bj,false)}else{if(bg.attachEvent){bg.attachEvent("on"+bo,bj)}}}}if(bn.add){bn.add.call(bg,bp);if(!bp.handler.guid){bp.handler.guid=br.guid}}bf.push(bp);a.event.global[bo]=true}bg=null},global:{},remove:function(br,bm,be,bi){if(br.nodeType===3||br.nodeType===8){return}if(be===false){be=a5}var bu,bh,bj,bo,bp=0,bf,bk,bn,bg,bl,e,bt,bq=a.hasData(br)&&a._data(br),bd=bq&&bq.events;if(!bq||!bd){return}if(bm&&bm.type){be=bm.handler;bm=bm.type}if(!bm||typeof bm==="string"&&bm.charAt(0)==="."){bm=bm||"";for(bh in bd){a.event.remove(br,bh+bm)}return}bm=bm.split(" ");while((bh=bm[bp++])){bt=bh;e=null;bf=bh.indexOf(".")<0;bk=[];if(!bf){bk=bh.split(".");bh=bk.shift();bn=new RegExp("(^|\\.)"+a.map(bk.slice(0).sort(),E).join("\\.(?:.*\\.)?")+"(\\.|$)")}bl=bd[bh];if(!bl){continue}if(!be){for(bo=0;bo<bl.length;bo++){e=bl[bo];if(bf||bn.test(e.namespace)){a.event.remove(br,bt,e.handler,bo);bl.splice(bo--,1)}}continue}bg=a.event.special[bh]||{};for(bo=bi||0;bo<bl.length;bo++){e=bl[bo];if(be.guid===e.guid){if(bf||bn.test(e.namespace)){if(bi==null){bl.splice(bo--,1)}if(bg.remove){bg.remove.call(br,e)}}if(bi!=null){break}}}if(bl.length===0||bi!=null&&bl.length===1){if(!bg.teardown||bg.teardown.call(br,bk)===false){a.removeEvent(br,bh,bq.handle)}bu=null;delete bd[bh]}}if(a.isEmptyObject(bd)){var bs=bq.handle;if(bs){bs.elem=null}delete bq.events;delete bq.handle;if(a.isEmptyObject(bq)){a.removeData(br,H,true)}}},trigger:function(bd,bi,bf){var bm=bd.type||bd,bh=arguments[3];if(!bh){bd=typeof bd==="object"?bd[a.expando]?bd:a.extend(a.Event(bm),bd):a.Event(bm);if(bm.indexOf("!")>=0){bd.type=bm=bm.slice(0,-1);bd.exclusive=true}if(!bf){bd.stopPropagation();if(a.event.global[bm]){a.each(a.cache,function(){var br=a.expando,bq=this[br];if(bq&&bq.events&&bq.events[bm]){a.event.trigger(bd,bi,bq.handle.elem)}})}}if(!bf||bf.nodeType===3||bf.nodeType===8){return H}bd.result=H;bd.target=bf;bi=a.makeArray(bi);bi.unshift(bd)}bd.currentTarget=bf;var bj=a._data(bf,"handle");if(bj){bj.apply(bf,bi)}var bo=bf.parentNode||bf.ownerDocument;try{if(!(bf&&bf.nodeName&&a.noData[bf.nodeName.toLowerCase()])){if(bf["on"+bm]&&bf["on"+bm].apply(bf,bi)===false){bd.result=false;bd.preventDefault()}}}catch(bn){}if(!bd.isPropagationStopped()&&bo){a.event.trigger(bd,bi,bo,true)}else{if(!bd.isDefaultPrevented()){var be,bk=bd.target,e=bm.replace(aP,""),bp=a.nodeName(bk,"a")&&e==="click",bl=a.event.special[e]||{};if((!bl._default||bl._default.call(bf,bd)===false)&&!bp&&!(bk&&bk.nodeName&&a.noData[bk.nodeName.toLowerCase()])){try{if(bk[e]){be=bk["on"+e];if(be){bk["on"+e]=null}a.event.triggered=true;bk[e]()}}catch(bg){}if(be){bk["on"+e]=be}a.event.triggered=false}}}},handle:function(e){var bl,be,bd,bn,bm,bh=[],bj=a.makeArray(arguments);e=bj[0]=a.event.fix(e||aY.event);e.currentTarget=this;bl=e.type.indexOf(".")<0&&!e.exclusive;if(!bl){bd=e.type.split(".");e.type=bd.shift();bh=bd.slice(0).sort();bn=new RegExp("(^|\\.)"+bh.join("\\.(?:.*\\.)?")+"(\\.|$)")}e.namespace=e.namespace||bh.join(".");bm=a._data(this,"events");be=(bm||{})[e.type];if(bm&&be){be=be.slice(0);for(var bg=0,bf=be.length;bg<bf;bg++){var bk=be[bg];if(bl||bn.test(bk.namespace)){e.handler=bk.handler;e.data=bk.data;e.handleObj=bk;var bi=bk.handler.apply(this,bj);if(bi!==H){e.result=bi;if(bi===false){e.preventDefault();e.stopPropagation()}}if(e.isImmediatePropagationStopped()){break}}}}return e.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(bf){if(bf[a.expando]){return bf}var bd=bf;bf=a.Event(bd);for(var be=this.props.length,bh;be;){bh=this.props[--be];bf[bh]=bd[bh]}if(!bf.target){bf.target=bf.srcElement||al}if(bf.target.nodeType===3){bf.target=bf.target.parentNode}if(!bf.relatedTarget&&bf.fromElement){bf.relatedTarget=bf.fromElement===bf.target?bf.toElement:bf.fromElement}if(bf.pageX==null&&bf.clientX!=null){var bg=al.documentElement,e=al.body;bf.pageX=bf.clientX+(bg&&bg.scrollLeft||e&&e.scrollLeft||0)-(bg&&bg.clientLeft||e&&e.clientLeft||0);bf.pageY=bf.clientY+(bg&&bg.scrollTop||e&&e.scrollTop||0)-(bg&&bg.clientTop||e&&e.clientTop||0)}if(bf.which==null&&(bf.charCode!=null||bf.keyCode!=null)){bf.which=bf.charCode!=null?bf.charCode:bf.keyCode}if(!bf.metaKey&&bf.ctrlKey){bf.metaKey=bf.ctrlKey}if(!bf.which&&bf.button!==H){bf.which=(bf.button&1?1:(bf.button&2?3:(bf.button&4?2:0)))}return bf},guid:100000000,proxy:a.proxy,special:{ready:{setup:a.bindReady,teardown:a.noop},live:{add:function(e){a.event.add(this,n(e.origType,e.selector),a.extend({},e,{handler:af,guid:e.handler.guid}))},remove:function(e){a.event.remove(this,n(e.origType,e.selector),e)}},beforeunload:{setup:function(be,bd,e){if(a.isWindow(this)){this.onbeforeunload=e}},teardown:function(bd,e){if(this.onbeforeunload===e){this.onbeforeunload=null}}}}};a.removeEvent=al.removeEventListener?function(bd,e,be){if(bd.removeEventListener){bd.removeEventListener(e,be,false)}}:function(bd,e,be){if(bd.detachEvent){bd.detachEvent("on"+e,be)}};a.Event=function(e){if(!this.preventDefault){return new a.Event(e)}if(e&&e.type){this.originalEvent=e;this.type=e.type;this.isDefaultPrevented=(e.defaultPrevented||e.returnValue===false||e.getPreventDefault&&e.getPreventDefault())?h:a5}else{this.type=e}this.timeStamp=a.now();this[a.expando]=true};function a5(){return false}function h(){return true}a.Event.prototype={preventDefault:function(){this.isDefaultPrevented=h;var bd=this.originalEvent;if(!bd){return}if(bd.preventDefault){bd.preventDefault()}else{bd.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=h;var bd=this.originalEvent;if(!bd){return}if(bd.stopPropagation){bd.stopPropagation()}bd.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=h;this.stopPropagation()},isDefaultPrevented:a5,isPropagationStopped:a5,isImmediatePropagationStopped:a5};var Z=function(be){var bd=be.relatedTarget;try{if(bd!==al&&!bd.parentNode){return}while(bd&&bd!==this){bd=bd.parentNode}if(bd!==this){be.type=be.data;a.event.handle.apply(this,arguments)}}catch(bf){}},aK=function(e){e.type=e.data;a.event.handle.apply(this,arguments)};a.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(bd,e){a.event.special[bd]={setup:function(be){a.event.add(this,e,be&&be.selector?aK:Z,bd)},teardown:function(be){a.event.remove(this,e,be&&be.selector?aK:Z)}}});if(!a.support.submitBubbles){a.event.special.submit={setup:function(bd,e){if(this.nodeName&&this.nodeName.toLowerCase()!=="form"){a.event.add(this,"click.specialSubmit",function(bg){var bf=bg.target,be=bf.type;if((be==="submit"||be==="image")&&a(bf).closest("form").length){aN("submit",this,arguments)}});a.event.add(this,"keypress.specialSubmit",function(bg){var bf=bg.target,be=bf.type;if((be==="text"||be==="password")&&a(bf).closest("form").length&&bg.keyCode===13){aN("submit",this,arguments)}})}else{return false}},teardown:function(e){a.event.remove(this,".specialSubmit")}}}if(!a.support.changeBubbles){var a6,j=function(bd){var e=bd.type,be=bd.value;if(e==="radio"||e==="checkbox"){be=bd.checked}else{if(e==="select-multiple"){be=bd.selectedIndex>-1?a.map(bd.options,function(bf){return bf.selected}).join("-"):""}else{if(bd.nodeName.toLowerCase()==="select"){be=bd.selectedIndex}}}return be},X=function X(bf){var bd=bf.target,be,bg;if(!a0.test(bd.nodeName)||bd.readOnly){return}be=a._data(bd,"_change_data");bg=j(bd);if(bf.type!=="focusout"||bd.type!=="radio"){a._data(bd,"_change_data",bg)}if(be===H||bg===be){return}if(be!=null||bg){bf.type="change";bf.liveFired=H;a.event.trigger(bf,arguments[1],bd)}};a.event.special.change={filters:{focusout:X,beforedeactivate:X,click:function(bf){var be=bf.target,bd=be.type;if(bd==="radio"||bd==="checkbox"||be.nodeName.toLowerCase()==="select"){X.call(this,bf)}},keydown:function(bf){var be=bf.target,bd=be.type;if((bf.keyCode===13&&be.nodeName.toLowerCase()!=="textarea")||(bf.keyCode===32&&(bd==="checkbox"||bd==="radio"))||bd==="select-multiple"){X.call(this,bf)}},beforeactivate:function(be){var bd=be.target;a._data(bd,"_change_data",j(bd))}},setup:function(be,bd){if(this.type==="file"){return false}for(var e in a6){a.event.add(this,e+".specialChange",a6[e])}return a0.test(this.nodeName)},teardown:function(e){a.event.remove(this,".specialChange");return a0.test(this.nodeName)}};a6=a.event.special.change.filters;a6.focus=a6.beforeactivate}function aN(bd,bf,e){var be=a.extend({},e[0]);be.type=bd;be.originalEvent={};be.liveFired=H;a.event.handle.call(bf,be);if(be.isDefaultPrevented()){e[0].preventDefault()}}if(al.addEventListener){a.each({focus:"focusin",blur:"focusout"},function(be,e){a.event.special[e]={setup:function(){this.addEventListener(be,bd,true)},teardown:function(){this.removeEventListener(be,bd,true)}};function bd(bf){bf=a.event.fix(bf);bf.type=e;return a.event.handle.call(this,bf)}})}a.each(["bind","one"],function(bd,e){a.fn[e]=function(bj,bk,bi){if(typeof bj==="object"){for(var bg in bj){this[e](bg,bk,bj[bg],bi)}return this}if(a.isFunction(bk)||bk===false){bi=bk;bk=H}var bh=e==="one"?a.proxy(bi,function(bl){a(this).unbind(bl,bh);return bi.apply(this,arguments)}):bi;if(bj==="unload"&&e!=="one"){this.one(bj,bk,bi)}else{for(var bf=0,be=this.length;bf<be;bf++){a.event.add(this[bf],bj,bh,bk)}}return this}});a.fn.extend({unbind:function(bg,bf){if(typeof bg==="object"&&!bg.preventDefault){for(var be in bg){this.unbind(be,bg[be])}}else{for(var bd=0,e=this.length;bd<e;bd++){a.event.remove(this[bd],bg,bf)}}return this},delegate:function(e,bd,bf,be){return this.live(bd,bf,be,e)},undelegate:function(e,bd,be){if(arguments.length===0){return this.unbind("live")}else{return this.die(bd,null,be,e)}},trigger:function(e,bd){return this.each(function(){a.event.trigger(e,bd,this)})},triggerHandler:function(e,be){if(this[0]){var bd=a.Event(e);bd.preventDefault();bd.stopPropagation();a.event.trigger(bd,be,this[0]);return bd.result}},toggle:function(be){var e=arguments,bd=1;while(bd<e.length){a.proxy(be,e[bd++])}return this.click(a.proxy(be,function(bf){var bg=(a._data(this,"lastToggle"+be.guid)||0)%bd;a._data(this,"lastToggle"+be.guid,bg+1);bf.preventDefault();return e[bg].apply(this,arguments)||false}))},hover:function(e,bd){return this.mouseenter(e).mouseleave(bd||e)}});var aH={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};a.each(["live","die"],function(bd,e){a.fn[e]=function(bn,bk,bp,bg){var bo,bl=0,bm,bf,br,bi=bg||this.selector,be=bg?this:a(this.context);if(typeof bn==="object"&&!bn.preventDefault){for(var bq in bn){be[e](bq,bk,bn[bq],bi)}return this}if(a.isFunction(bk)){bp=bk;bk=H}bn=(bn||"").split(" ");while((bo=bn[bl++])!=null){bm=aP.exec(bo);bf="";if(bm){bf=bm[0];bo=bo.replace(aP,"")}if(bo==="hover"){bn.push("mouseenter"+bf,"mouseleave"+bf);continue}br=bo;if(bo==="focus"||bo==="blur"){bn.push(aH[bo]+bf);bo=bo+bf}else{bo=(aH[bo]||bo)+bf}if(e==="live"){for(var bj=0,bh=be.length;bj<bh;bj++){a.event.add(be[bj],"live."+n(bo,bi),{data:bk,selector:bi,handler:bp,origType:bo,origHandler:bp,preType:br})}}else{be.unbind("live."+n(bo,bi),bp)}}return this}});function af(bn){var bk,bf,bt,bh,e,bp,bm,bo,bl,bs,bj,bi,br,bq=[],bg=[],bd=a._data(this,"events");if(bn.liveFired===this||!bd||!bd.live||bn.target.disabled||bn.button&&bn.type==="click"){return}if(bn.namespace){bi=new RegExp("(^|\\.)"+bn.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")}bn.liveFired=this;var be=bd.live.slice(0);for(bm=0;bm<be.length;bm++){e=be[bm];if(e.origType.replace(aP,"")===bn.type){bg.push(e.selector)}else{be.splice(bm--,1)}}bh=a(bn.target).closest(bg,bn.currentTarget);for(bo=0,bl=bh.length;bo<bl;bo++){bj=bh[bo];for(bm=0;bm<be.length;bm++){e=be[bm];if(bj.selector===e.selector&&(!bi||bi.test(e.namespace))&&!bj.elem.disabled){bp=bj.elem;bt=null;if(e.preType==="mouseenter"||e.preType==="mouseleave"){bn.type=e.preType;bt=a(bn.relatedTarget).closest(e.selector)[0]}if(!bt||bt!==bp){bq.push({elem:bp,handleObj:e,level:bj.level})}}}}for(bo=0,bl=bq.length;bo<bl;bo++){bh=bq[bo];if(bf&&bh.level>bf){break}bn.currentTarget=bh.elem;bn.data=bh.handleObj.data;bn.handleObj=bh.handleObj;br=bh.handleObj.origHandler.apply(bh.elem,arguments);if(br===false||bn.isPropagationStopped()){bf=bh.level;if(br===false){bk=false}if(bn.isImmediatePropagationStopped()){break}}}return bk}function n(bd,e){return(bd&&bd!=="*"?bd+".":"")+e.replace(K,"`").replace(aa,"&")}a.each(("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error").split(" "),function(bd,e){a.fn[e]=function(bf,be){if(be==null){be=bf;bf=null}return arguments.length>0?this.bind(e,bf,be):this.trigger(e)};if(a.attrFn){a.attrFn[e]=true}});
17
+ /*
18
+ * Sizzle CSS Selector Engine
19
+ * Copyright 2011, The Dojo Foundation
20
+ * Released under the MIT, BSD, and GPL Licenses.
21
+ * More information: http://sizzlejs.com/
22
+ */
23
+ (function(){var bn=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,bo=0,br=Object.prototype.toString,bi=false,bh=true,bp=/\\/g,bv=/\W/;[0,0].sort(function(){bh=false;return 0});var bf=function(bA,e,bD,bE){bD=bD||[];e=e||al;var bG=e;if(e.nodeType!==1&&e.nodeType!==9){return[]}if(!bA||typeof bA!=="string"){return bD}var bx,bI,bL,bw,bH,bK,bJ,bC,bz=true,by=bf.isXML(e),bB=[],bF=bA;do{bn.exec("");bx=bn.exec(bF);if(bx){bF=bx[3];bB.push(bx[1]);if(bx[2]){bw=bx[3];break}}}while(bx);if(bB.length>1&&bj.exec(bA)){if(bB.length===2&&bk.relative[bB[0]]){bI=bs(bB[0]+bB[1],e)}else{bI=bk.relative[bB[0]]?[e]:bf(bB.shift(),e);while(bB.length){bA=bB.shift();if(bk.relative[bA]){bA+=bB.shift()}bI=bs(bA,bI)}}}else{if(!bE&&bB.length>1&&e.nodeType===9&&!by&&bk.match.ID.test(bB[0])&&!bk.match.ID.test(bB[bB.length-1])){bH=bf.find(bB.shift(),e,by);e=bH.expr?bf.filter(bH.expr,bH.set)[0]:bH.set[0]}if(e){bH=bE?{expr:bB.pop(),set:bl(bE)}:bf.find(bB.pop(),bB.length===1&&(bB[0]==="~"||bB[0]==="+")&&e.parentNode?e.parentNode:e,by);bI=bH.expr?bf.filter(bH.expr,bH.set):bH.set;if(bB.length>0){bL=bl(bI)}else{bz=false}while(bB.length){bK=bB.pop();bJ=bK;if(!bk.relative[bK]){bK=""}else{bJ=bB.pop()}if(bJ==null){bJ=e}bk.relative[bK](bL,bJ,by)}}else{bL=bB=[]}}if(!bL){bL=bI}if(!bL){bf.error(bK||bA)}if(br.call(bL)==="[object Array]"){if(!bz){bD.push.apply(bD,bL)}else{if(e&&e.nodeType===1){for(bC=0;bL[bC]!=null;bC++){if(bL[bC]&&(bL[bC]===true||bL[bC].nodeType===1&&bf.contains(e,bL[bC]))){bD.push(bI[bC])}}}else{for(bC=0;bL[bC]!=null;bC++){if(bL[bC]&&bL[bC].nodeType===1){bD.push(bI[bC])}}}}}else{bl(bL,bD)}if(bw){bf(bw,bG,bD,bE);bf.uniqueSort(bD)}return bD};bf.uniqueSort=function(bw){if(bq){bi=bh;bw.sort(bq);if(bi){for(var e=1;e<bw.length;e++){if(bw[e]===bw[e-1]){bw.splice(e--,1)}}}}return bw};bf.matches=function(e,bw){return bf(e,null,null,bw)};bf.matchesSelector=function(e,bw){return bf(bw,null,null,[e]).length>0};bf.find=function(bC,e,bD){var bB;if(!bC){return[]}for(var by=0,bx=bk.order.length;by<bx;by++){var bz,bA=bk.order[by];if((bz=bk.leftMatch[bA].exec(bC))){var bw=bz[1];bz.splice(1,1);if(bw.substr(bw.length-1)!=="\\"){bz[1]=(bz[1]||"").replace(bp,"");bB=bk.find[bA](bz,e,bD);if(bB!=null){bC=bC.replace(bk.match[bA],"");break}}}}if(!bB){bB=typeof e.getElementsByTagName!=="undefined"?e.getElementsByTagName("*"):[]}return{set:bB,expr:bC}};bf.filter=function(bG,bF,bJ,bz){var bB,e,bx=bG,bL=[],bD=bF,bC=bF&&bF[0]&&bf.isXML(bF[0]);while(bG&&bF.length){for(var bE in bk.filter){if((bB=bk.leftMatch[bE].exec(bG))!=null&&bB[2]){var bK,bI,bw=bk.filter[bE],by=bB[1];e=false;bB.splice(1,1);if(by.substr(by.length-1)==="\\"){continue}if(bD===bL){bL=[]}if(bk.preFilter[bE]){bB=bk.preFilter[bE](bB,bD,bJ,bL,bz,bC);if(!bB){e=bK=true}else{if(bB===true){continue}}}if(bB){for(var bA=0;(bI=bD[bA])!=null;bA++){if(bI){bK=bw(bI,bB,bA,bD);var bH=bz^!!bK;if(bJ&&bK!=null){if(bH){e=true}else{bD[bA]=false}}else{if(bH){bL.push(bI);e=true}}}}}if(bK!==H){if(!bJ){bD=bL}bG=bG.replace(bk.match[bE],"");if(!e){return[]}break}}}if(bG===bx){if(e==null){bf.error(bG)}else{break}}bx=bG}return bD};bf.error=function(e){throw"Syntax error, unrecognized expression: "+e};var bk=bf.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(e){return e.getAttribute("href")},type:function(e){return e.getAttribute("type")}},relative:{"+":function(bB,bw){var by=typeof bw==="string",bA=by&&!bv.test(bw),bC=by&&!bA;if(bA){bw=bw.toLowerCase()}for(var bx=0,e=bB.length,bz;bx<e;bx++){if((bz=bB[bx])){while((bz=bz.previousSibling)&&bz.nodeType!==1){}bB[bx]=bC||bz&&bz.nodeName.toLowerCase()===bw?bz||false:bz===bw}}if(bC){bf.filter(bw,bB,true)}},">":function(bB,bw){var bA,bz=typeof bw==="string",bx=0,e=bB.length;if(bz&&!bv.test(bw)){bw=bw.toLowerCase();for(;bx<e;bx++){bA=bB[bx];if(bA){var by=bA.parentNode;bB[bx]=by.nodeName.toLowerCase()===bw?by:false}}}else{for(;bx<e;bx++){bA=bB[bx];if(bA){bB[bx]=bz?bA.parentNode:bA.parentNode===bw}}if(bz){bf.filter(bw,bB,true)}}},"":function(by,bw,bA){var bz,bx=bo++,e=bt;if(typeof bw==="string"&&!bv.test(bw)){bw=bw.toLowerCase();bz=bw;e=bd}e("parentNode",bw,bx,by,bz,bA)},"~":function(by,bw,bA){var bz,bx=bo++,e=bt;if(typeof bw==="string"&&!bv.test(bw)){bw=bw.toLowerCase();bz=bw;e=bd}e("previousSibling",bw,bx,by,bz,bA)}},find:{ID:function(bw,bx,by){if(typeof bx.getElementById!=="undefined"&&!by){var e=bx.getElementById(bw[1]);return e&&e.parentNode?[e]:[]}},NAME:function(bx,bA){if(typeof bA.getElementsByName!=="undefined"){var bw=[],bz=bA.getElementsByName(bx[1]);for(var by=0,e=bz.length;by<e;by++){if(bz[by].getAttribute("name")===bx[1]){bw.push(bz[by])}}return bw.length===0?null:bw}},TAG:function(e,bw){if(typeof bw.getElementsByTagName!=="undefined"){return bw.getElementsByTagName(e[1])}}},preFilter:{CLASS:function(by,bw,bx,e,bB,bC){by=" "+by[1].replace(bp,"")+" ";if(bC){return by}for(var bz=0,bA;(bA=bw[bz])!=null;bz++){if(bA){if(bB^(bA.className&&(" "+bA.className+" ").replace(/[\t\n\r]/g," ").indexOf(by)>=0)){if(!bx){e.push(bA)}}else{if(bx){bw[bz]=false}}}}return false},ID:function(e){return e[1].replace(bp,"")},TAG:function(bw,e){return bw[1].replace(bp,"").toLowerCase()},CHILD:function(e){if(e[1]==="nth"){if(!e[2]){bf.error(e[0])}e[2]=e[2].replace(/^\+|\s*/g,"");var bw=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(e[2]==="even"&&"2n"||e[2]==="odd"&&"2n+1"||!/\D/.test(e[2])&&"0n+"+e[2]||e[2]);e[2]=(bw[1]+(bw[2]||1))-0;e[3]=bw[3]-0}else{if(e[2]){bf.error(e[0])}}e[0]=bo++;return e},ATTR:function(bz,bw,bx,e,bA,bB){var by=bz[1]=bz[1].replace(bp,"");if(!bB&&bk.attrMap[by]){bz[1]=bk.attrMap[by]}bz[4]=(bz[4]||bz[5]||"").replace(bp,"");if(bz[2]==="~="){bz[4]=" "+bz[4]+" "}return bz},PSEUDO:function(bz,bw,bx,e,bA){if(bz[1]==="not"){if((bn.exec(bz[3])||"").length>1||/^\w/.test(bz[3])){bz[3]=bf(bz[3],null,null,bw)}else{var by=bf.filter(bz[3],bw,bx,true^bA);if(!bx){e.push.apply(e,by)}return false}}else{if(bk.match.POS.test(bz[0])||bk.match.CHILD.test(bz[0])){return true}}return bz},POS:function(e){e.unshift(true);return e}},filters:{enabled:function(e){return e.disabled===false&&e.type!=="hidden"},disabled:function(e){return e.disabled===true},checked:function(e){return e.checked===true},selected:function(e){if(e.parentNode){e.parentNode.selectedIndex}return e.selected===true},parent:function(e){return !!e.firstChild},empty:function(e){return !e.firstChild},has:function(bx,bw,e){return !!bf(e[3],bx).length},header:function(e){return(/h\d/i).test(e.nodeName)},text:function(e){return"text"===e.getAttribute("type")},radio:function(e){return"radio"===e.type},checkbox:function(e){return"checkbox"===e.type},file:function(e){return"file"===e.type},password:function(e){return"password"===e.type},submit:function(e){return"submit"===e.type},image:function(e){return"image"===e.type},reset:function(e){return"reset"===e.type},button:function(e){return"button"===e.type||e.nodeName.toLowerCase()==="button"},input:function(e){return(/input|select|textarea|button/i).test(e.nodeName)}},setFilters:{first:function(bw,e){return e===0},last:function(bx,bw,e,by){return bw===by.length-1},even:function(bw,e){return e%2===0},odd:function(bw,e){return e%2===1},lt:function(bx,bw,e){return bw<e[3]-0},gt:function(bx,bw,e){return bw>e[3]-0},nth:function(bx,bw,e){return e[3]-0===bw},eq:function(bx,bw,e){return e[3]-0===bw}},filter:{PSEUDO:function(bx,bC,bB,bD){var e=bC[1],bw=bk.filters[e];if(bw){return bw(bx,bB,bC,bD)}else{if(e==="contains"){return(bx.textContent||bx.innerText||bf.getText([bx])||"").indexOf(bC[3])>=0}else{if(e==="not"){var by=bC[3];for(var bA=0,bz=by.length;bA<bz;bA++){if(by[bA]===bx){return false}}return true}else{bf.error(e)}}}},CHILD:function(e,by){var bB=by[1],bw=e;switch(bB){case"only":case"first":while((bw=bw.previousSibling)){if(bw.nodeType===1){return false}}if(bB==="first"){return true}bw=e;case"last":while((bw=bw.nextSibling)){if(bw.nodeType===1){return false}}return true;case"nth":var bx=by[2],bE=by[3];if(bx===1&&bE===0){return true}var bA=by[0],bD=e.parentNode;if(bD&&(bD.sizcache!==bA||!e.nodeIndex)){var bz=0;for(bw=bD.firstChild;bw;bw=bw.nextSibling){if(bw.nodeType===1){bw.nodeIndex=++bz}}bD.sizcache=bA}var bC=e.nodeIndex-bE;if(bx===0){return bC===0}else{return(bC%bx===0&&bC/bx>=0)}}},ID:function(bw,e){return bw.nodeType===1&&bw.getAttribute("id")===e},TAG:function(bw,e){return(e==="*"&&bw.nodeType===1)||bw.nodeName.toLowerCase()===e},CLASS:function(bw,e){return(" "+(bw.className||bw.getAttribute("class"))+" ").indexOf(e)>-1},ATTR:function(bA,by){var bx=by[1],e=bk.attrHandle[bx]?bk.attrHandle[bx](bA):bA[bx]!=null?bA[bx]:bA.getAttribute(bx),bB=e+"",bz=by[2],bw=by[4];return e==null?bz==="!=":bz==="="?bB===bw:bz==="*="?bB.indexOf(bw)>=0:bz==="~="?(" "+bB+" ").indexOf(bw)>=0:!bw?bB&&e!==false:bz==="!="?bB!==bw:bz==="^="?bB.indexOf(bw)===0:bz==="$="?bB.substr(bB.length-bw.length)===bw:bz==="|="?bB===bw||bB.substr(0,bw.length+1)===bw+"-":false},POS:function(bz,bw,bx,bA){var e=bw[2],by=bk.setFilters[e];if(by){return by(bz,bx,bw,bA)}}}};var bj=bk.match.POS,be=function(bw,e){return"\\"+(e-0+1)};for(var bg in bk.match){bk.match[bg]=new RegExp(bk.match[bg].source+(/(?![^\[]*\])(?![^\(]*\))/.source));bk.leftMatch[bg]=new RegExp(/(^(?:.|\r|\n)*?)/.source+bk.match[bg].source.replace(/\\(\d+)/g,be))}var bl=function(bw,e){bw=Array.prototype.slice.call(bw,0);if(e){e.push.apply(e,bw);return e}return bw};try{Array.prototype.slice.call(al.documentElement.childNodes,0)[0].nodeType}catch(bu){bl=function(bz,by){var bx=0,bw=by||[];if(br.call(bz)==="[object Array]"){Array.prototype.push.apply(bw,bz)}else{if(typeof bz.length==="number"){for(var e=bz.length;bx<e;bx++){bw.push(bz[bx])}}else{for(;bz[bx];bx++){bw.push(bz[bx])}}}return bw}}var bq,bm;if(al.documentElement.compareDocumentPosition){bq=function(bw,e){if(bw===e){bi=true;return 0}if(!bw.compareDocumentPosition||!e.compareDocumentPosition){return bw.compareDocumentPosition?-1:1}return bw.compareDocumentPosition(e)&4?-1:1}}else{bq=function(bD,bC){var bA,bw,bx=[],e=[],bz=bD.parentNode,bB=bC.parentNode,bE=bz;if(bD===bC){bi=true;return 0}else{if(bz===bB){return bm(bD,bC)}else{if(!bz){return -1}else{if(!bB){return 1}}}}while(bE){bx.unshift(bE);bE=bE.parentNode}bE=bB;while(bE){e.unshift(bE);bE=bE.parentNode}bA=bx.length;bw=e.length;for(var by=0;by<bA&&by<bw;by++){if(bx[by]!==e[by]){return bm(bx[by],e[by])}}return by===bA?bm(bD,e[by],-1):bm(bx[by],bC,1)};bm=function(bw,e,bx){if(bw===e){return bx}var by=bw.nextSibling;while(by){if(by===e){return -1}by=by.nextSibling}return 1}}bf.getText=function(e){var bw="",by;for(var bx=0;e[bx];bx++){by=e[bx];if(by.nodeType===3||by.nodeType===4){bw+=by.nodeValue}else{if(by.nodeType!==8){bw+=bf.getText(by.childNodes)}}}return bw};(function(){var bw=al.createElement("div"),bx="script"+(new Date()).getTime(),e=al.documentElement;bw.innerHTML="<a name='"+bx+"'/>";e.insertBefore(bw,e.firstChild);if(al.getElementById(bx)){bk.find.ID=function(bz,bA,bB){if(typeof bA.getElementById!=="undefined"&&!bB){var by=bA.getElementById(bz[1]);return by?by.id===bz[1]||typeof by.getAttributeNode!=="undefined"&&by.getAttributeNode("id").nodeValue===bz[1]?[by]:H:[]}};bk.filter.ID=function(bA,by){var bz=typeof bA.getAttributeNode!=="undefined"&&bA.getAttributeNode("id");return bA.nodeType===1&&bz&&bz.nodeValue===by}}e.removeChild(bw);e=bw=null})();(function(){var e=al.createElement("div");e.appendChild(al.createComment(""));if(e.getElementsByTagName("*").length>0){bk.find.TAG=function(bw,bA){var bz=bA.getElementsByTagName(bw[1]);if(bw[1]==="*"){var by=[];for(var bx=0;bz[bx];bx++){if(bz[bx].nodeType===1){by.push(bz[bx])}}bz=by}return bz}}e.innerHTML="<a href='#'></a>";if(e.firstChild&&typeof e.firstChild.getAttribute!=="undefined"&&e.firstChild.getAttribute("href")!=="#"){bk.attrHandle.href=function(bw){return bw.getAttribute("href",2)}}e=null})();if(al.querySelectorAll){(function(){var e=bf,by=al.createElement("div"),bx="__sizzle__";by.innerHTML="<p class='TEST'></p>";if(by.querySelectorAll&&by.querySelectorAll(".TEST").length===0){return}bf=function(bJ,bA,bE,bI){bA=bA||al;if(!bI&&!bf.isXML(bA)){var bH=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(bJ);if(bH&&(bA.nodeType===1||bA.nodeType===9)){if(bH[1]){return bl(bA.getElementsByTagName(bJ),bE)}else{if(bH[2]&&bk.find.CLASS&&bA.getElementsByClassName){return bl(bA.getElementsByClassName(bH[2]),bE)}}}if(bA.nodeType===9){if(bJ==="body"&&bA.body){return bl([bA.body],bE)}else{if(bH&&bH[3]){var bD=bA.getElementById(bH[3]);if(bD&&bD.parentNode){if(bD.id===bH[3]){return bl([bD],bE)}}else{return bl([],bE)}}}try{return bl(bA.querySelectorAll(bJ),bE)}catch(bF){}}else{if(bA.nodeType===1&&bA.nodeName.toLowerCase()!=="object"){var bB=bA,bC=bA.getAttribute("id"),bz=bC||bx,bL=bA.parentNode,bK=/^\s*[+~]/.test(bJ);if(!bC){bA.setAttribute("id",bz)}else{bz=bz.replace(/'/g,"\\$&")}if(bK&&bL){bA=bA.parentNode}try{if(!bK||bL){return bl(bA.querySelectorAll("[id='"+bz+"'] "+bJ),bE)}}catch(bG){}finally{if(!bC){bB.removeAttribute("id")}}}}}return e(bJ,bA,bE,bI)};for(var bw in e){bf[bw]=e[bw]}by=null})()}(function(){var e=al.documentElement,bx=e.matchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.msMatchesSelector,bw=false;try{bx.call(al.documentElement,"[test!='']:sizzle")}catch(by){bw=true}if(bx){bf.matchesSelector=function(bz,bB){bB=bB.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!bf.isXML(bz)){try{if(bw||!bk.match.PSEUDO.test(bB)&&!/!=/.test(bB)){return bx.call(bz,bB)}}catch(bA){}}return bf(bB,null,null,[bz]).length>0}}})();(function(){var e=al.createElement("div");e.innerHTML="<div class='test e'></div><div class='test'></div>";if(!e.getElementsByClassName||e.getElementsByClassName("e").length===0){return}e.lastChild.className="e";if(e.getElementsByClassName("e").length===1){return}bk.order.splice(1,0,"CLASS");bk.find.CLASS=function(bw,bx,by){if(typeof bx.getElementsByClassName!=="undefined"&&!by){return bx.getElementsByClassName(bw[1])}};e=null})();function bd(bw,bB,bA,bE,bC,bD){for(var by=0,bx=bE.length;by<bx;by++){var e=bE[by];if(e){var bz=false;e=e[bw];while(e){if(e.sizcache===bA){bz=bE[e.sizset];break}if(e.nodeType===1&&!bD){e.sizcache=bA;e.sizset=by}if(e.nodeName.toLowerCase()===bB){bz=e;break}e=e[bw]}bE[by]=bz}}}function bt(bw,bB,bA,bE,bC,bD){for(var by=0,bx=bE.length;by<bx;by++){var e=bE[by];if(e){var bz=false;e=e[bw];while(e){if(e.sizcache===bA){bz=bE[e.sizset];break}if(e.nodeType===1){if(!bD){e.sizcache=bA;e.sizset=by}if(typeof bB!=="string"){if(e===bB){bz=true;break}}else{if(bf.filter(bB,[e]).length>0){bz=e;break}}}e=e[bw]}bE[by]=bz}}}if(al.documentElement.contains){bf.contains=function(bw,e){return bw!==e&&(bw.contains?bw.contains(e):true)}}else{if(al.documentElement.compareDocumentPosition){bf.contains=function(bw,e){return !!(bw.compareDocumentPosition(e)&16)}}else{bf.contains=function(){return false}}}bf.isXML=function(e){var bw=(e?e.ownerDocument||e:0).documentElement;return bw?bw.nodeName!=="HTML":false};var bs=function(e,bC){var bA,by=[],bz="",bx=bC.nodeType?[bC]:bC;while((bA=bk.match.PSEUDO.exec(e))){bz+=bA[0];e=e.replace(bk.match.PSEUDO,"")}e=bk.relative[e]?e+"*":e;for(var bB=0,bw=bx.length;bB<bw;bB++){bf(e,bx[bB],by)}return bf.filter(bz,by)};a.find=bf;a.expr=bf.selectors;a.expr[":"]=a.expr.filters;a.unique=bf.uniqueSort;a.text=bf.getText;a.isXMLDoc=bf.isXML;a.contains=bf.contains})();var W=/Until$/,ai=/^(?:parents|prevUntil|prevAll)/,aW=/,/,a9=/^.[^:#\[\.,]*$/,M=Array.prototype.slice,F=a.expr.match.POS,ao={children:true,contents:true,next:true,prev:true};a.fn.extend({find:function(e){var be=this.pushStack("","find",e),bh=0;for(var bf=0,bd=this.length;bf<bd;bf++){bh=be.length;a.find(e,this[bf],be);if(bf>0){for(var bi=bh;bi<be.length;bi++){for(var bg=0;bg<bh;bg++){if(be[bg]===be[bi]){be.splice(bi--,1);break}}}}}return be},has:function(bd){var e=a(bd);return this.filter(function(){for(var bf=0,be=e.length;bf<be;bf++){if(a.contains(this,e[bf])){return true}}})},not:function(e){return this.pushStack(av(this,e,false),"not",e)},filter:function(e){return this.pushStack(av(this,e,true),"filter",e)},is:function(e){return !!e&&a.filter(e,this).length>0},closest:function(bm,bd){var bj=[],bg,be,bl=this[0];if(a.isArray(bm)){var bi,bf,bh={},e=1;if(bl&&bm.length){for(bg=0,be=bm.length;bg<be;bg++){bf=bm[bg];if(!bh[bf]){bh[bf]=a.expr.match.POS.test(bf)?a(bf,bd||this.context):bf}}while(bl&&bl.ownerDocument&&bl!==bd){for(bf in bh){bi=bh[bf];if(bi.jquery?bi.index(bl)>-1:a(bl).is(bi)){bj.push({selector:bf,elem:bl,level:e})}}bl=bl.parentNode;e++}}return bj}var bk=F.test(bm)?a(bm,bd||this.context):null;for(bg=0,be=this.length;bg<be;bg++){bl=this[bg];while(bl){if(bk?bk.index(bl)>-1:a.find.matchesSelector(bl,bm)){bj.push(bl);break}else{bl=bl.parentNode;if(!bl||!bl.ownerDocument||bl===bd){break}}}}bj=bj.length>1?a.unique(bj):bj;return this.pushStack(bj,"closest",bm)},index:function(e){if(!e||typeof e==="string"){return a.inArray(this[0],e?a(e):this.parent().children())}return a.inArray(e.jquery?e[0]:e,this)},add:function(e,bd){var bf=typeof e==="string"?a(e,bd):a.makeArray(e),be=a.merge(this.get(),bf);return this.pushStack(B(bf[0])||B(be[0])?be:a.unique(be))},andSelf:function(){return this.add(this.prevObject)}});function B(e){return !e||!e.parentNode||e.parentNode.nodeType===11}a.each({parent:function(bd){var e=bd.parentNode;return e&&e.nodeType!==11?e:null},parents:function(e){return a.dir(e,"parentNode")},parentsUntil:function(bd,e,be){return a.dir(bd,"parentNode",be)},next:function(e){return a.nth(e,2,"nextSibling")},prev:function(e){return a.nth(e,2,"previousSibling")},nextAll:function(e){return a.dir(e,"nextSibling")},prevAll:function(e){return a.dir(e,"previousSibling")},nextUntil:function(bd,e,be){return a.dir(bd,"nextSibling",be)},prevUntil:function(bd,e,be){return a.dir(bd,"previousSibling",be)},siblings:function(e){return a.sibling(e.parentNode.firstChild,e)},children:function(e){return a.sibling(e.firstChild)},contents:function(e){return a.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:a.makeArray(e.childNodes)}},function(e,bd){a.fn[e]=function(bh,be){var bg=a.map(this,bd,bh),bf=M.call(arguments);if(!W.test(e)){be=bh}if(be&&typeof be==="string"){bg=a.filter(be,bg)}bg=this.length>1&&!ao[e]?a.unique(bg):bg;if((this.length>1||aW.test(be))&&ai.test(e)){bg=bg.reverse()}return this.pushStack(bg,e,bf.join(","))}});a.extend({filter:function(be,e,bd){if(bd){be=":not("+be+")"}return e.length===1?a.find.matchesSelector(e[0],be)?[e[0]]:[]:a.find.matches(be,e)},dir:function(be,bd,bg){var e=[],bf=be[bd];while(bf&&bf.nodeType!==9&&(bg===H||bf.nodeType!==1||!a(bf).is(bg))){if(bf.nodeType===1){e.push(bf)}bf=bf[bd]}return e},nth:function(bg,e,be,bf){e=e||1;var bd=0;for(;bg;bg=bg[be]){if(bg.nodeType===1&&++bd===e){break}}return bg},sibling:function(be,bd){var e=[];for(;be;be=be.nextSibling){if(be.nodeType===1&&be!==bd){e.push(be)}}return e}});function av(bf,be,e){if(a.isFunction(be)){return a.grep(bf,function(bh,bg){var bi=!!be.call(bh,bg,bh);return bi===e})}else{if(be.nodeType){return a.grep(bf,function(bh,bg){return(bh===be)===e})}else{if(typeof be==="string"){var bd=a.grep(bf,function(bg){return bg.nodeType===1});if(a9.test(be)){return a.filter(be,bd,!e)}else{be=a.filter(be,bd)}}}}return a.grep(bf,function(bh,bg){return(a.inArray(bh,be)>=0)===e})}var ab=/ jQuery\d+="(?:\d+|null)"/g,aj=/^\s+/,O=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,c=/<([\w:]+)/,v=/<tbody/i,T=/<|&#?\w+;/,L=/<(?:script|object|embed|option|style)/i,m=/checked\s*(?:[^=]|=\s*.checked.)/i,an={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};an.optgroup=an.option;an.tbody=an.tfoot=an.colgroup=an.caption=an.thead;an.th=an.td;if(!a.support.htmlSerialize){an._default=[1,"div<div>","</div>"]}a.fn.extend({text:function(e){if(a.isFunction(e)){return this.each(function(be){var bd=a(this);bd.text(e.call(this,be,bd.text()))})}if(typeof e!=="object"&&e!==H){return this.empty().append((this[0]&&this[0].ownerDocument||al).createTextNode(e))}return a.text(this)},wrapAll:function(e){if(a.isFunction(e)){return this.each(function(be){a(this).wrapAll(e.call(this,be))})}if(this[0]){var bd=a(e,this[0].ownerDocument).eq(0).clone(true);if(this[0].parentNode){bd.insertBefore(this[0])}bd.map(function(){var be=this;while(be.firstChild&&be.firstChild.nodeType===1){be=be.firstChild}return be}).append(this)}return this},wrapInner:function(e){if(a.isFunction(e)){return this.each(function(bd){a(this).wrapInner(e.call(this,bd))})}return this.each(function(){var bd=a(this),be=bd.contents();if(be.length){be.wrapAll(e)}else{bd.append(e)}})},wrap:function(e){return this.each(function(){a(this).wrapAll(e)})},unwrap:function(){return this.parent().each(function(){if(!a.nodeName(this,"body")){a(this).replaceWith(this.childNodes)}}).end()},append:function(){return this.domManip(arguments,true,function(e){if(this.nodeType===1){this.appendChild(e)}})},prepend:function(){return this.domManip(arguments,true,function(e){if(this.nodeType===1){this.insertBefore(e,this.firstChild)}})},before:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(bd){this.parentNode.insertBefore(bd,this)})}else{if(arguments.length){var e=a(arguments[0]);e.push.apply(e,this.toArray());return this.pushStack(e,"before",arguments)}}},after:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(bd){this.parentNode.insertBefore(bd,this.nextSibling)})}else{if(arguments.length){var e=this.pushStack(this,"after",arguments);e.push.apply(e,a(arguments[0]).toArray());return e}}},remove:function(e,bf){for(var bd=0,be;(be=this[bd])!=null;bd++){if(!e||a.filter(e,[be]).length){if(!bf&&be.nodeType===1){a.cleanData(be.getElementsByTagName("*"));a.cleanData([be])}if(be.parentNode){be.parentNode.removeChild(be)}}}return this},empty:function(){for(var e=0,bd;(bd=this[e])!=null;e++){if(bd.nodeType===1){a.cleanData(bd.getElementsByTagName("*"))}while(bd.firstChild){bd.removeChild(bd.firstChild)}}return this},clone:function(bd,e){bd=bd==null?false:bd;e=e==null?bd:e;return this.map(function(){return a.clone(this,bd,e)})},html:function(bf){if(bf===H){return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(ab,""):null}else{if(typeof bf==="string"&&!L.test(bf)&&(a.support.leadingWhitespace||!aj.test(bf))&&!an[(c.exec(bf)||["",""])[1].toLowerCase()]){bf=bf.replace(O,"<$1></$2>");try{for(var be=0,bd=this.length;be<bd;be++){if(this[be].nodeType===1){a.cleanData(this[be].getElementsByTagName("*"));this[be].innerHTML=bf}}}catch(bg){this.empty().append(bf)}}else{if(a.isFunction(bf)){this.each(function(bh){var e=a(this);e.html(bf.call(this,bh,e.html()))})}else{this.empty().append(bf)}}}return this},replaceWith:function(e){if(this[0]&&this[0].parentNode){if(a.isFunction(e)){return this.each(function(bf){var be=a(this),bd=be.html();be.replaceWith(e.call(this,bf,bd))})}if(typeof e!=="string"){e=a(e).detach()}return this.each(function(){var be=this.nextSibling,bd=this.parentNode;a(this).remove();if(be){a(be).before(e)}else{a(bd).append(e)}})}else{return this.pushStack(a(a.isFunction(e)?e():e),"replaceWith",e)}},detach:function(e){return this.remove(e,true)},domManip:function(bj,bn,bm){var bf,bg,bi,bl,bk=bj[0],bd=[];if(!a.support.checkClone&&arguments.length===3&&typeof bk==="string"&&m.test(bk)){return this.each(function(){a(this).domManip(bj,bn,bm,true)})}if(a.isFunction(bk)){return this.each(function(bp){var bo=a(this);bj[0]=bk.call(this,bp,bn?bo.html():H);bo.domManip(bj,bn,bm)})}if(this[0]){bl=bk&&bk.parentNode;if(a.support.parentNode&&bl&&bl.nodeType===11&&bl.childNodes.length===this.length){bf={fragment:bl}}else{bf=a.buildFragment(bj,this,bd)}bi=bf.fragment;if(bi.childNodes.length===1){bg=bi=bi.firstChild}else{bg=bi.firstChild}if(bg){bn=bn&&a.nodeName(bg,"tr");for(var be=0,e=this.length,bh=e-1;be<e;be++){bm.call(bn?aX(this[be],bg):this[be],bf.cacheable||(e>1&&be<bh)?a.clone(bi,true,true):bi)}}if(bd.length){a.each(bd,a8)}}return this}});function aX(e,bd){return a.nodeName(e,"table")?(e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody"))):e}function s(e,bj){if(bj.nodeType!==1||!a.hasData(e)){return}var bi=a.expando,bf=a.data(e),bg=a.data(bj,bf);if((bf=bf[bi])){var bk=bf.events;bg=bg[bi]=a.extend({},bf);if(bk){delete bg.handle;bg.events={};for(var bh in bk){for(var be=0,bd=bk[bh].length;be<bd;be++){a.event.add(bj,bh+(bk[bh][be].namespace?".":"")+bk[bh][be].namespace,bk[bh][be],bk[bh][be].data)}}}}}function ac(bd,e){if(e.nodeType!==1){return}var be=e.nodeName.toLowerCase();e.clearAttributes();e.mergeAttributes(bd);if(be==="object"){e.outerHTML=bd.outerHTML}else{if(be==="input"&&(bd.type==="checkbox"||bd.type==="radio")){if(bd.checked){e.defaultChecked=e.checked=bd.checked}if(e.value!==bd.value){e.value=bd.value}}else{if(be==="option"){e.selected=bd.defaultSelected}else{if(be==="input"||be==="textarea"){e.defaultValue=bd.defaultValue}}}}e.removeAttribute(a.expando)}a.buildFragment=function(bh,bf,bd){var bg,e,be,bi=(bf&&bf[0]?bf[0].ownerDocument||bf[0]:al);if(bh.length===1&&typeof bh[0]==="string"&&bh[0].length<512&&bi===al&&bh[0].charAt(0)==="<"&&!L.test(bh[0])&&(a.support.checkClone||!m.test(bh[0]))){e=true;be=a.fragments[bh[0]];if(be){if(be!==1){bg=be}}}if(!bg){bg=bi.createDocumentFragment();a.clean(bh,bi,bg,bd)}if(e){a.fragments[bh[0]]=be?bg:1}return{fragment:bg,cacheable:e}};a.fragments={};a.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,bd){a.fn[e]=function(be){var bh=[],bk=a(be),bj=this.length===1&&this[0].parentNode;if(bj&&bj.nodeType===11&&bj.childNodes.length===1&&bk.length===1){bk[bd](this[0]);return this}else{for(var bi=0,bf=bk.length;bi<bf;bi++){var bg=(bi>0?this.clone(true):this).get();a(bk[bi])[bd](bg);bh=bh.concat(bg)}return this.pushStack(bh,e,bk.selector)}}});function a1(e){if("getElementsByTagName" in e){return e.getElementsByTagName("*")}else{if("querySelectorAll" in e){return e.querySelectorAll("*")}else{return[]}}}a.extend({clone:function(bg,bi,be){var bh=bg.cloneNode(true),e,bd,bf;if((!a.support.noCloneEvent||!a.support.noCloneChecked)&&(bg.nodeType===1||bg.nodeType===11)&&!a.isXMLDoc(bg)){ac(bg,bh);e=a1(bg);bd=a1(bh);for(bf=0;e[bf];++bf){ac(e[bf],bd[bf])}}if(bi){s(bg,bh);if(be){e=a1(bg);bd=a1(bh);for(bf=0;e[bf];++bf){s(e[bf],bd[bf])}}}return bh},clean:function(be,bg,bn,bi){bg=bg||al;if(typeof bg.createElement==="undefined"){bg=bg.ownerDocument||bg[0]&&bg[0].ownerDocument||al}var bo=[];for(var bm=0,bh;(bh=be[bm])!=null;bm++){if(typeof bh==="number"){bh+=""}if(!bh){continue}if(typeof bh==="string"&&!T.test(bh)){bh=bg.createTextNode(bh)}else{if(typeof bh==="string"){bh=bh.replace(O,"<$1></$2>");var bp=(c.exec(bh)||["",""])[1].toLowerCase(),bf=an[bp]||an._default,bl=bf[0],bd=bg.createElement("div");bd.innerHTML=bf[1]+bh+bf[2];while(bl--){bd=bd.lastChild}if(!a.support.tbody){var e=v.test(bh),bk=bp==="table"&&!e?bd.firstChild&&bd.firstChild.childNodes:bf[1]==="<table>"&&!e?bd.childNodes:[];for(var bj=bk.length-1;bj>=0;--bj){if(a.nodeName(bk[bj],"tbody")&&!bk[bj].childNodes.length){bk[bj].parentNode.removeChild(bk[bj])}}}if(!a.support.leadingWhitespace&&aj.test(bh)){bd.insertBefore(bg.createTextNode(aj.exec(bh)[0]),bd.firstChild)}bh=bd.childNodes}}if(bh.nodeType){bo.push(bh)}else{bo=a.merge(bo,bh)}}if(bn){for(bm=0;bo[bm];bm++){if(bi&&a.nodeName(bo[bm],"script")&&(!bo[bm].type||bo[bm].type.toLowerCase()==="text/javascript")){bi.push(bo[bm].parentNode?bo[bm].parentNode.removeChild(bo[bm]):bo[bm])}else{if(bo[bm].nodeType===1){bo.splice.apply(bo,[bm+1,0].concat(a.makeArray(bo[bm].getElementsByTagName("script"))))}bn.appendChild(bo[bm])}}}return bo},cleanData:function(bd){var bg,be,e=a.cache,bl=a.expando,bj=a.event.special,bi=a.support.deleteExpando;for(var bh=0,bf;(bf=bd[bh])!=null;bh++){if(bf.nodeName&&a.noData[bf.nodeName.toLowerCase()]){continue}be=bf[a.expando];if(be){bg=e[be]&&e[be][bl];if(bg&&bg.events){for(var bk in bg.events){if(bj[bk]){a.event.remove(bf,bk)}else{a.removeEvent(bf,bk,bg.handle)}}if(bg.handle){bg.handle.elem=null}}if(bi){delete bf[a.expando]}else{if(bf.removeAttribute){bf.removeAttribute(a.expando)}}delete e[be]}}}});function a8(e,bd){if(bd.src){a.ajax({url:bd.src,async:false,dataType:"script"})}else{a.globalEval(bd.text||bd.textContent||bd.innerHTML||"")}if(bd.parentNode){bd.parentNode.removeChild(bd)}}var ae=/alpha\([^)]*\)/i,ak=/opacity=([^)]*)/,aM=/-([a-z])/ig,y=/([A-Z])/g,aZ=/^-?\d+(?:px)?$/i,a7=/^-?\d/,aV={position:"absolute",visibility:"hidden",display:"block"},ag=["Left","Right"],aR=["Top","Bottom"],U,ay,aL,l=function(e,bd){return bd.toUpperCase()};a.fn.css=function(e,bd){if(arguments.length===2&&bd===H){return this}return a.access(this,e,bd,true,function(bf,be,bg){return bg!==H?a.style(bf,be,bg):a.css(bf,be)})};a.extend({cssHooks:{opacity:{get:function(be,bd){if(bd){var e=U(be,"opacity","opacity");return e===""?"1":e}else{return be.style.opacity}}}},cssNumber:{zIndex:true,fontWeight:true,opacity:true,zoom:true,lineHeight:true},cssProps:{"float":a.support.cssFloat?"cssFloat":"styleFloat"},style:function(bf,be,bk,bg){if(!bf||bf.nodeType===3||bf.nodeType===8||!bf.style){return}var bj,bh=a.camelCase(be),bd=bf.style,bl=a.cssHooks[bh];be=a.cssProps[bh]||bh;if(bk!==H){if(typeof bk==="number"&&isNaN(bk)||bk==null){return}if(typeof bk==="number"&&!a.cssNumber[bh]){bk+="px"}if(!bl||!("set" in bl)||(bk=bl.set(bf,bk))!==H){try{bd[be]=bk}catch(bi){}}}else{if(bl&&"get" in bl&&(bj=bl.get(bf,false,bg))!==H){return bj}return bd[be]}},css:function(bh,bg,bd){var bf,be=a.camelCase(bg),e=a.cssHooks[be];bg=a.cssProps[be]||be;if(e&&"get" in e&&(bf=e.get(bh,true,bd))!==H){return bf}else{if(U){return U(bh,bg,be)}}},swap:function(bf,be,bg){var e={};for(var bd in be){e[bd]=bf.style[bd];bf.style[bd]=be[bd]}bg.call(bf);for(bd in be){bf.style[bd]=e[bd]}},camelCase:function(e){return e.replace(aM,l)}});a.curCSS=a.css;a.each(["height","width"],function(bd,e){a.cssHooks[e]={get:function(bg,bf,be){var bh;if(bf){if(bg.offsetWidth!==0){bh=o(bg,e,be)}else{a.swap(bg,aV,function(){bh=o(bg,e,be)})}if(bh<=0){bh=U(bg,e,e);if(bh==="0px"&&aL){bh=aL(bg,e,e)}if(bh!=null){return bh===""||bh==="auto"?"0px":bh}}if(bh<0||bh==null){bh=bg.style[e];return bh===""||bh==="auto"?"0px":bh}return typeof bh==="string"?bh:bh+"px"}},set:function(be,bf){if(aZ.test(bf)){bf=parseFloat(bf);if(bf>=0){return bf+"px"}}else{return bf}}}});if(!a.support.opacity){a.cssHooks.opacity={get:function(bd,e){return ak.test((e&&bd.currentStyle?bd.currentStyle.filter:bd.style.filter)||"")?(parseFloat(RegExp.$1)/100)+"":e?"1":""},set:function(bf,bg){var be=bf.style;be.zoom=1;var e=a.isNaN(bg)?"":"alpha(opacity="+bg*100+")",bd=be.filter||"";be.filter=ae.test(bd)?bd.replace(ae,e):be.filter+" "+e}}}if(al.defaultView&&al.defaultView.getComputedStyle){ay=function(bh,e,bf){var be,bg,bd;bf=bf.replace(y,"-$1").toLowerCase();if(!(bg=bh.ownerDocument.defaultView)){return H}if((bd=bg.getComputedStyle(bh,null))){be=bd.getPropertyValue(bf);if(be===""&&!a.contains(bh.ownerDocument.documentElement,bh)){be=a.style(bh,bf)}}return be}}if(al.documentElement.currentStyle){aL=function(bg,be){var bh,bd=bg.currentStyle&&bg.currentStyle[be],e=bg.runtimeStyle&&bg.runtimeStyle[be],bf=bg.style;if(!aZ.test(bd)&&a7.test(bd)){bh=bf.left;if(e){bg.runtimeStyle.left=bg.currentStyle.left}bf.left=be==="fontSize"?"1em":(bd||0);bd=bf.pixelLeft+"px";bf.left=bh;if(e){bg.runtimeStyle.left=e}}return bd===""?"auto":bd}}U=ay||aL;function o(be,bd,e){var bg=bd==="width"?ag:aR,bf=bd==="width"?be.offsetWidth:be.offsetHeight;if(e==="border"){return bf}a.each(bg,function(){if(!e){bf-=parseFloat(a.css(be,"padding"+this))||0}if(e==="margin"){bf+=parseFloat(a.css(be,"margin"+this))||0}else{bf-=parseFloat(a.css(be,"border"+this+"Width"))||0}});return bf}if(a.expr&&a.expr.filters){a.expr.filters.hidden=function(be){var bd=be.offsetWidth,e=be.offsetHeight;return(bd===0&&e===0)||(!a.support.reliableHiddenOffsets&&(be.style.display||a.css(be,"display"))==="none")};a.expr.filters.visible=function(e){return !a.expr.filters.hidden(e)}}var i=/%20/g,ah=/\[\]$/,bc=/\r?\n/g,ba=/#.*$/,ar=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,aO=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,aB=/(?:^file|^widget|\-extension):$/,aD=/^(?:GET|HEAD)$/,b=/^\/\//,I=/\?/,aU=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,p=/^(?:select|textarea)/i,g=/\s+/,bb=/([?&])_=[^&]*/,R=/(^|\-)([a-z])/g,aJ=function(bd,e,be){return e+be.toUpperCase()},G=/^([\w\+\.\-]+:)\/\/([^\/?#:]*)(?::(\d+))?/,z=a.fn.load,V={},q={},au,r;try{au=al.location.href}catch(am){au=al.createElement("a");au.href="";au=au.href}r=G.exec(au.toLowerCase());function d(e){return function(bg,bi){if(typeof bg!=="string"){bi=bg;bg="*"}if(a.isFunction(bi)){var bf=bg.toLowerCase().split(g),be=0,bh=bf.length,bd,bj,bk;for(;be<bh;be++){bd=bf[be];bk=/^\+/.test(bd);if(bk){bd=bd.substr(1)||"*"}bj=e[bd]=e[bd]||[];bj[bk?"unshift":"push"](bi)}}}}function aI(bd,bm,bh,bl,bj,bf){bj=bj||bm.dataTypes[0];bf=bf||{};bf[bj]=true;var bi=bd[bj],be=0,e=bi?bi.length:0,bg=(bd===V),bk;for(;be<e&&(bg||!bk);be++){bk=bi[be](bm,bh,bl);if(typeof bk==="string"){if(!bg||bf[bk]){bk=H}else{bm.dataTypes.unshift(bk);bk=aI(bd,bm,bh,bl,bk,bf)}}}if((bg||!bk)&&!bf["*"]){bk=aI(bd,bm,bh,bl,"*",bf)}return bk}a.fn.extend({load:function(be,bh,bi){if(typeof be!=="string"&&z){return z.apply(this,arguments)}else{if(!this.length){return this}}var bg=be.indexOf(" ");if(bg>=0){var e=be.slice(bg,be.length);be=be.slice(0,bg)}var bf="GET";if(bh){if(a.isFunction(bh)){bi=bh;bh=H}else{if(typeof bh==="object"){bh=a.param(bh,a.ajaxSettings.traditional);bf="POST"}}}var bd=this;a.ajax({url:be,type:bf,dataType:"html",data:bh,complete:function(bk,bj,bl){bl=bk.responseText;if(bk.isResolved()){bk.done(function(bm){bl=bm});bd.html(e?a("<div>").append(bl.replace(aU,"")).find(e):bl)}if(bi){bd.each(bi,[bl,bj,bk])}}});return this},serialize:function(){return a.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?a.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||p.test(this.nodeName)||aO.test(this.type))}).map(function(e,bd){var be=a(this).val();return be==null?null:a.isArray(be)?a.map(be,function(bg,bf){return{name:bd.name,value:bg.replace(bc,"\r\n")}}):{name:bd.name,value:be.replace(bc,"\r\n")}}).get()}});a.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,bd){a.fn[bd]=function(be){return this.bind(bd,be)}});a.each(["get","post"],function(e,bd){a[bd]=function(be,bg,bh,bf){if(a.isFunction(bg)){bf=bf||bh;bh=bg;bg=H}return a.ajax({type:bd,url:be,data:bg,success:bh,dataType:bf})}});a.extend({getScript:function(e,bd){return a.get(e,H,bd,"script")},getJSON:function(e,bd,be){return a.get(e,bd,be,"json")},ajaxSetup:function(be,e){if(!e){e=be;be=a.extend(true,a.ajaxSettings,e)}else{a.extend(true,be,a.ajaxSettings,e)}for(var bd in {context:1,url:1}){if(bd in e){be[bd]=e[bd]}else{if(bd in a.ajaxSettings){be[bd]=a.ajaxSettings[bd]}}}return be},ajaxSettings:{url:au,isLocal:aB.test(r[1]),global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":aY.String,"text html":true,"text json":a.parseJSON,"text xml":a.parseXML}},ajaxPrefilter:d(V),ajaxTransport:d(q),ajax:function(bh,bf){if(typeof bh==="object"){bf=bh;bh=H}bf=bf||{};var bl=a.ajaxSetup({},bf),bz=bl.context||bl,bo=bz!==bl&&(bz.nodeType||bz instanceof a)?a(bz):a.event,by=a.Deferred(),bv=a._Deferred(),bj=bl.statusCode||{},bk,bp={},bx,bg,bt,bm,bq,bi=0,be,bs,br={readyState:0,setRequestHeader:function(e,bA){if(!bi){bp[e.toLowerCase().replace(R,aJ)]=bA}return this},getAllResponseHeaders:function(){return bi===2?bx:null},getResponseHeader:function(bA){var e;if(bi===2){if(!bg){bg={};while((e=ar.exec(bx))){bg[e[1].toLowerCase()]=e[2]}}e=bg[bA.toLowerCase()]}return e===H?null:e},overrideMimeType:function(e){if(!bi){bl.mimeType=e}return this},abort:function(e){e=e||"abort";if(bt){bt.abort(e)}bn(0,e);return this}};function bn(bF,bD,bG,bC){if(bi===2){return}bi=2;if(bm){clearTimeout(bm)}bt=H;bx=bC||"";br.readyState=bF?4:0;var bA,bK,bJ,bE=bG?a4(bl,br,bG):H,bB,bI;if(bF>=200&&bF<300||bF===304){if(bl.ifModified){if((bB=br.getResponseHeader("Last-Modified"))){a.lastModified[bk]=bB}if((bI=br.getResponseHeader("Etag"))){a.etag[bk]=bI}}if(bF===304){bD="notmodified";bA=true}else{try{bK=D(bl,bE);bD="success";bA=true}catch(bH){bD="parsererror";bJ=bH}}}else{bJ=bD;if(!bD||bF){bD="error";if(bF<0){bF=0}}}br.status=bF;br.statusText=bD;if(bA){by.resolveWith(bz,[bK,bD,br])}else{by.rejectWith(bz,[br,bD,bJ])}br.statusCode(bj);bj=H;if(be){bo.trigger("ajax"+(bA?"Success":"Error"),[br,bl,bA?bK:bJ])}bv.resolveWith(bz,[br,bD]);if(be){bo.trigger("ajaxComplete",[br,bl]);if(!(--a.active)){a.event.trigger("ajaxStop")}}}by.promise(br);br.success=br.done;br.error=br.fail;br.complete=bv.done;br.statusCode=function(bA){if(bA){var e;if(bi<2){for(e in bA){bj[e]=[bj[e],bA[e]]}}else{e=bA[br.status];br.then(e,e)}}return this};bl.url=((bh||bl.url)+"").replace(ba,"").replace(b,r[1]+"//");bl.dataTypes=a.trim(bl.dataType||"*").toLowerCase().split(g);if(!bl.crossDomain){bq=G.exec(bl.url.toLowerCase());bl.crossDomain=!!(bq&&(bq[1]!=r[1]||bq[2]!=r[2]||(bq[3]||(bq[1]==="http:"?80:443))!=(r[3]||(r[1]==="http:"?80:443))))}if(bl.data&&bl.processData&&typeof bl.data!=="string"){bl.data=a.param(bl.data,bl.traditional)}aI(V,bl,bf,br);if(bi===2){return false}be=bl.global;bl.type=bl.type.toUpperCase();bl.hasContent=!aD.test(bl.type);if(be&&a.active++===0){a.event.trigger("ajaxStart")}if(!bl.hasContent){if(bl.data){bl.url+=(I.test(bl.url)?"&":"?")+bl.data}bk=bl.url;if(bl.cache===false){var bd=a.now(),bw=bl.url.replace(bb,"$1_="+bd);bl.url=bw+((bw===bl.url)?(I.test(bl.url)?"&":"?")+"_="+bd:"")}}if(bl.data&&bl.hasContent&&bl.contentType!==false||bf.contentType){bp["Content-Type"]=bl.contentType}if(bl.ifModified){bk=bk||bl.url;if(a.lastModified[bk]){bp["If-Modified-Since"]=a.lastModified[bk]}if(a.etag[bk]){bp["If-None-Match"]=a.etag[bk]}}bp.Accept=bl.dataTypes[0]&&bl.accepts[bl.dataTypes[0]]?bl.accepts[bl.dataTypes[0]]+(bl.dataTypes[0]!=="*"?", */*; q=0.01":""):bl.accepts["*"];for(bs in bl.headers){br.setRequestHeader(bs,bl.headers[bs])}if(bl.beforeSend&&(bl.beforeSend.call(bz,br,bl)===false||bi===2)){br.abort();return false}for(bs in {success:1,error:1,complete:1}){br[bs](bl[bs])}bt=aI(q,bl,bf,br);if(!bt){bn(-1,"No Transport")}else{br.readyState=1;if(be){bo.trigger("ajaxSend",[br,bl])}if(bl.async&&bl.timeout>0){bm=setTimeout(function(){br.abort("timeout")},bl.timeout)}try{bi=1;bt.send(bp,bn)}catch(bu){if(status<2){bn(-1,bu)}else{a.error(bu)}}}return br},param:function(e,be){var bd=[],bg=function(bh,bi){bi=a.isFunction(bi)?bi():bi;bd[bd.length]=encodeURIComponent(bh)+"="+encodeURIComponent(bi)};if(be===H){be=a.ajaxSettings.traditional}if(a.isArray(e)||(e.jquery&&!a.isPlainObject(e))){a.each(e,function(){bg(this.name,this.value)})}else{for(var bf in e){u(bf,e[bf],be,bg)}}return bd.join("&").replace(i,"+")}});function u(be,bg,bd,bf){if(a.isArray(bg)&&bg.length){a.each(bg,function(bi,bh){if(bd||ah.test(be)){bf(be,bh)}else{u(be+"["+(typeof bh==="object"||a.isArray(bh)?bi:"")+"]",bh,bd,bf)}})}else{if(!bd&&bg!=null&&typeof bg==="object"){if(a.isArray(bg)||a.isEmptyObject(bg)){bf(be,"")}else{for(var e in bg){u(be+"["+e+"]",bg[e],bd,bf)}}}else{bf(be,bg)}}}a.extend({active:0,lastModified:{},etag:{}});function a4(bl,bk,bh){var bd=bl.contents,bj=bl.dataTypes,be=bl.responseFields,bg,bi,bf,e;for(bi in be){if(bi in bh){bk[be[bi]]=bh[bi]}}while(bj[0]==="*"){bj.shift();if(bg===H){bg=bl.mimeType||bk.getResponseHeader("content-type")}}if(bg){for(bi in bd){if(bd[bi]&&bd[bi].test(bg)){bj.unshift(bi);break}}}if(bj[0] in bh){bf=bj[0]}else{for(bi in bh){if(!bj[0]||bl.converters[bi+" "+bj[0]]){bf=bi;break}if(!e){e=bi}}bf=bf||e}if(bf){if(bf!==bj[0]){bj.unshift(bf)}return bh[bf]}}function D(bp,bh){if(bp.dataFilter){bh=bp.dataFilter(bh,bp.dataType)}var bl=bp.dataTypes,bo={},bi,bm,be=bl.length,bj,bk=bl[0],bf,bg,bn,bd,e;for(bi=1;bi<be;bi++){if(bi===1){for(bm in bp.converters){if(typeof bm==="string"){bo[bm.toLowerCase()]=bp.converters[bm]}}}bf=bk;bk=bl[bi];if(bk==="*"){bk=bf}else{if(bf!=="*"&&bf!==bk){bg=bf+" "+bk;bn=bo[bg]||bo["* "+bk];if(!bn){e=H;for(bd in bo){bj=bd.split(" ");if(bj[0]===bf||bj[0]==="*"){e=bo[bj[1]+" "+bk];if(e){bd=bo[bd];if(bd===true){bn=e}else{if(e===true){bn=bd}}break}}}}if(!(bn||e)){a.error("No conversion from "+bg.replace(" "," to "))}if(bn!==true){bh=bn?bn(bh):e(bd(bh))}}}}return bh}var aq=a.now(),t=/(\=)\?(&|$)|()\?\?()/i;a.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return a.expando+"_"+(aq++)}});a.ajaxPrefilter("json jsonp",function(bm,bi,bl){var bk=(typeof bm.data==="string");if(bm.dataTypes[0]==="jsonp"||bi.jsonpCallback||bi.jsonp!=null||bm.jsonp!==false&&(t.test(bm.url)||bk&&t.test(bm.data))){var bj,be=bm.jsonpCallback=a.isFunction(bm.jsonpCallback)?bm.jsonpCallback():bm.jsonpCallback,bh=aY[be],e=bm.url,bg=bm.data,bd="$1"+be+"$2",bf=function(){aY[be]=bh;if(bj&&a.isFunction(bh)){aY[be](bj[0])}};if(bm.jsonp!==false){e=e.replace(t,bd);if(bm.url===e){if(bk){bg=bg.replace(t,bd)}if(bm.data===bg){e+=(/\?/.test(e)?"&":"?")+bm.jsonp+"="+be}}}bm.url=e;bm.data=bg;aY[be]=function(bn){bj=[bn]};bl.then(bf,bf);bm.converters["script json"]=function(){if(!bj){a.error(be+" was not called")}return bj[0]};bm.dataTypes[0]="json";return"script"}});a.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(e){a.globalEval(e);return e}}});a.ajaxPrefilter("script",function(e){if(e.cache===H){e.cache=false}if(e.crossDomain){e.type="GET";e.global=false}});a.ajaxTransport("script",function(be){if(be.crossDomain){var e,bd=al.head||al.getElementsByTagName("head")[0]||al.documentElement;return{send:function(bf,bg){e=al.createElement("script");e.async="async";if(be.scriptCharset){e.charset=be.scriptCharset}e.src=be.url;e.onload=e.onreadystatechange=function(bi,bh){if(!e.readyState||/loaded|complete/.test(e.readyState)){e.onload=e.onreadystatechange=null;if(bd&&e.parentNode){bd.removeChild(e)}e=H;if(!bh){bg(200,"success")}}};bd.insertBefore(e,bd.firstChild)},abort:function(){if(e){e.onload(0,1)}}}}});var x=a.now(),J,at;function A(){a(aY).unload(function(){for(var e in J){J[e](0,1)}})}function aA(){try{return new aY.XMLHttpRequest()}catch(bd){}}function ad(){try{return new aY.ActiveXObject("Microsoft.XMLHTTP")}catch(bd){}}a.ajaxSettings.xhr=aY.ActiveXObject?function(){return !this.isLocal&&aA()||ad()}:aA;at=a.ajaxSettings.xhr();a.support.ajax=!!at;a.support.cors=at&&("withCredentials" in at);at=H;if(a.support.ajax){a.ajaxTransport(function(e){if(!e.crossDomain||a.support.cors){var bd;return{send:function(bj,be){var bi=e.xhr(),bh,bg;if(e.username){bi.open(e.type,e.url,e.async,e.username,e.password)}else{bi.open(e.type,e.url,e.async)}if(e.xhrFields){for(bg in e.xhrFields){bi[bg]=e.xhrFields[bg]}}if(e.mimeType&&bi.overrideMimeType){bi.overrideMimeType(e.mimeType)}if(!(e.crossDomain&&!e.hasContent)&&!bj["X-Requested-With"]){bj["X-Requested-With"]="XMLHttpRequest"}try{for(bg in bj){bi.setRequestHeader(bg,bj[bg])}}catch(bf){}bi.send((e.hasContent&&e.data)||null);bd=function(bs,bm){var bn,bl,bk,bq,bp;try{if(bd&&(bm||bi.readyState===4)){bd=H;if(bh){bi.onreadystatechange=a.noop;delete J[bh]}if(bm){if(bi.readyState!==4){bi.abort()}}else{bn=bi.status;bk=bi.getAllResponseHeaders();bq={};bp=bi.responseXML;if(bp&&bp.documentElement){bq.xml=bp}bq.text=bi.responseText;try{bl=bi.statusText}catch(br){bl=""}if(!bn&&e.isLocal&&!e.crossDomain){bn=bq.text?200:404}else{if(bn===1223){bn=204}}}}}catch(bo){if(!bm){be(-1,bo)}}if(bq){be(bn,bl,bq,bk)}};if(!e.async||bi.readyState===4){bd()}else{if(!J){J={};A()}bh=x++;bi.onreadystatechange=J[bh]=bd}},abort:function(){if(bd){bd(0,1)}}}}})}var N={},ap=/^(?:toggle|show|hide)$/,aF=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,aS,ax=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];a.fn.extend({show:function(bf,bi,bh){var be,bg;if(bf||bf===0){return this.animate(aQ("show",3),bf,bi,bh)}else{for(var bd=0,e=this.length;bd<e;bd++){be=this[bd];bg=be.style.display;if(!a._data(be,"olddisplay")&&bg==="none"){bg=be.style.display=""}if(bg===""&&a.css(be,"display")==="none"){a._data(be,"olddisplay",w(be.nodeName))}}for(bd=0;bd<e;bd++){be=this[bd];bg=be.style.display;if(bg===""||bg==="none"){be.style.display=a._data(be,"olddisplay")||""}}return this}},hide:function(be,bh,bg){if(be||be===0){return this.animate(aQ("hide",3),be,bh,bg)}else{for(var bd=0,e=this.length;bd<e;bd++){var bf=a.css(this[bd],"display");if(bf!=="none"&&!a._data(this[bd],"olddisplay")){a._data(this[bd],"olddisplay",bf)}}for(bd=0;bd<e;bd++){this[bd].style.display="none"}return this}},_toggle:a.fn.toggle,toggle:function(be,bd,bf){var e=typeof be==="boolean";if(a.isFunction(be)&&a.isFunction(bd)){this._toggle.apply(this,arguments)}else{if(be==null||e){this.each(function(){var bg=e?be:a(this).is(":hidden");a(this)[bg?"show":"hide"]()})}else{this.animate(aQ("toggle",3),be,bd,bf)}}return this},fadeTo:function(e,bf,be,bd){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:bf},e,be,bd)},animate:function(bg,bd,bf,be){var e=a.speed(bd,bf,be);if(a.isEmptyObject(bg)){return this.each(e.complete)}return this[e.queue===false?"each":"queue"](function(){var bj=a.extend({},e),bn,bk=this.nodeType===1,bl=bk&&a(this).is(":hidden"),bh=this;for(bn in bg){var bi=a.camelCase(bn);if(bn!==bi){bg[bi]=bg[bn];delete bg[bn];bn=bi}if(bg[bn]==="hide"&&bl||bg[bn]==="show"&&!bl){return bj.complete.call(this)}if(bk&&(bn==="height"||bn==="width")){bj.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY];if(a.css(this,"display")==="inline"&&a.css(this,"float")==="none"){if(!a.support.inlineBlockNeedsLayout){this.style.display="inline-block"}else{var bm=w(this.nodeName);if(bm==="inline"){this.style.display="inline-block"}else{this.style.display="inline";this.style.zoom=1}}}}if(a.isArray(bg[bn])){(bj.specialEasing=bj.specialEasing||{})[bn]=bg[bn][1];bg[bn]=bg[bn][0]}}if(bj.overflow!=null){this.style.overflow="hidden"}bj.curAnim=a.extend({},bg);a.each(bg,function(bp,bt){var bs=new a.fx(bh,bj,bp);if(ap.test(bt)){bs[bt==="toggle"?bl?"show":"hide":bt](bg)}else{var br=aF.exec(bt),bu=bs.cur();if(br){var bo=parseFloat(br[2]),bq=br[3]||(a.cssNumber[bp]?"":"px");if(bq!=="px"){a.style(bh,bp,(bo||1)+bq);bu=((bo||1)/bs.cur())*bu;a.style(bh,bp,bu+bq)}if(br[1]){bo=((br[1]==="-="?-1:1)*bo)+bu}bs.custom(bu,bo,bq)}else{bs.custom(bu,bt,"")}}});return true})},stop:function(bd,e){var be=a.timers;if(bd){this.queue([])}this.each(function(){for(var bf=be.length-1;bf>=0;bf--){if(be[bf].elem===this){if(e){be[bf](true)}be.splice(bf,1)}}});if(!e){this.dequeue()}return this}});function aQ(bd,e){var be={};a.each(ax.concat.apply([],ax.slice(0,e)),function(){be[this]=bd});return be}a.each({slideDown:aQ("show",1),slideUp:aQ("hide",1),slideToggle:aQ("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,bd){a.fn[e]=function(be,bg,bf){return this.animate(bd,be,bg,bf)}});a.extend({speed:function(be,bf,bd){var e=be&&typeof be==="object"?a.extend({},be):{complete:bd||!bd&&bf||a.isFunction(be)&&be,duration:be,easing:bd&&bf||bf&&!a.isFunction(bf)&&bf};e.duration=a.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in a.fx.speeds?a.fx.speeds[e.duration]:a.fx.speeds._default;e.old=e.complete;e.complete=function(){if(e.queue!==false){a(this).dequeue()}if(a.isFunction(e.old)){e.old.call(this)}};return e},easing:{linear:function(be,bf,e,bd){return e+bd*be},swing:function(be,bf,e,bd){return((-Math.cos(be*Math.PI)/2)+0.5)*bd+e}},timers:[],fx:function(bd,e,be){this.options=e;this.elem=bd;this.prop=be;if(!e.orig){e.orig={}}}});a.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(a.fx.step[this.prop]||a.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var e,bd=a.css(this.elem,this.prop);return isNaN(e=parseFloat(bd))?!bd||bd==="auto"?0:bd:e},custom:function(bh,bg,bf){var e=this,be=a.fx;this.startTime=a.now();this.start=bh;this.end=bg;this.unit=bf||this.unit||(a.cssNumber[this.prop]?"":"px");this.now=this.start;this.pos=this.state=0;function bd(bi){return e.step(bi)}bd.elem=this.elem;if(bd()&&a.timers.push(bd)&&!aS){aS=setInterval(be.tick,be.interval)}},show:function(){this.options.orig[this.prop]=a.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());a(this.elem).show()},hide:function(){this.options.orig[this.prop]=a.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(bf){var bk=a.now(),bg=true;if(bf||bk>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var bh in this.options.curAnim){if(this.options.curAnim[bh]!==true){bg=false}}if(bg){if(this.options.overflow!=null&&!a.support.shrinkWrapBlocks){var be=this.elem,bl=this.options;a.each(["","X","Y"],function(bm,bn){be.style["overflow"+bn]=bl.overflow[bm]})}if(this.options.hide){a(this.elem).hide()}if(this.options.hide||this.options.show){for(var e in this.options.curAnim){a.style(this.elem,e,this.options.orig[e])}}this.options.complete.call(this.elem)}return false}else{var bd=bk-this.startTime;this.state=bd/this.options.duration;var bi=this.options.specialEasing&&this.options.specialEasing[this.prop];var bj=this.options.easing||(a.easing.swing?"swing":"linear");this.pos=a.easing[bi||bj](this.state,bd,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};a.extend(a.fx,{tick:function(){var bd=a.timers;for(var e=0;e<bd.length;e++){if(!bd[e]()){bd.splice(e--,1)}}if(!bd.length){a.fx.stop()}},interval:13,stop:function(){clearInterval(aS);aS=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(e){a.style(e.elem,"opacity",e.now)},_default:function(e){if(e.elem.style&&e.elem.style[e.prop]!=null){e.elem.style[e.prop]=(e.prop==="width"||e.prop==="height"?Math.max(0,e.now):e.now)+e.unit}else{e.elem[e.prop]=e.now}}}});if(a.expr&&a.expr.filters){a.expr.filters.animated=function(e){return a.grep(a.timers,function(bd){return e===bd.elem}).length}}function w(be){if(!N[be]){var e=a("<"+be+">").appendTo("body"),bd=e.css("display");e.remove();if(bd==="none"||bd===""){bd="block"}N[be]=bd}return N[be]}var S=/^t(?:able|d|h)$/i,Y=/^(?:body|html)$/i;if("getBoundingClientRect" in al.documentElement){a.fn.offset=function(bq){var bg=this[0],bj;if(bq){return this.each(function(e){a.offset.setOffset(this,bq,e)})}if(!bg||!bg.ownerDocument){return null}if(bg===bg.ownerDocument.body){return a.offset.bodyOffset(bg)}try{bj=bg.getBoundingClientRect()}catch(bn){}var bp=bg.ownerDocument,be=bp.documentElement;if(!bj||!a.contains(be,bg)){return bj?{top:bj.top,left:bj.left}:{top:0,left:0}}var bk=bp.body,bl=az(bp),bi=be.clientTop||bk.clientTop||0,bm=be.clientLeft||bk.clientLeft||0,bd=(bl.pageYOffset||a.support.boxModel&&be.scrollTop||bk.scrollTop),bh=(bl.pageXOffset||a.support.boxModel&&be.scrollLeft||bk.scrollLeft),bo=bj.top+bd-bi,bf=bj.left+bh-bm;return{top:bo,left:bf}}}else{a.fn.offset=function(bn){var bh=this[0];if(bn){return this.each(function(bo){a.offset.setOffset(this,bn,bo)})}if(!bh||!bh.ownerDocument){return null}if(bh===bh.ownerDocument.body){return a.offset.bodyOffset(bh)}a.offset.initialize();var bk,be=bh.offsetParent,bd=bh,bm=bh.ownerDocument,bf=bm.documentElement,bi=bm.body,bj=bm.defaultView,e=bj?bj.getComputedStyle(bh,null):bh.currentStyle,bl=bh.offsetTop,bg=bh.offsetLeft;while((bh=bh.parentNode)&&bh!==bi&&bh!==bf){if(a.offset.supportsFixedPosition&&e.position==="fixed"){break}bk=bj?bj.getComputedStyle(bh,null):bh.currentStyle;bl-=bh.scrollTop;bg-=bh.scrollLeft;if(bh===be){bl+=bh.offsetTop;bg+=bh.offsetLeft;if(a.offset.doesNotAddBorder&&!(a.offset.doesAddBorderForTableAndCells&&S.test(bh.nodeName))){bl+=parseFloat(bk.borderTopWidth)||0;bg+=parseFloat(bk.borderLeftWidth)||0}bd=be;be=bh.offsetParent}if(a.offset.subtractsBorderForOverflowNotVisible&&bk.overflow!=="visible"){bl+=parseFloat(bk.borderTopWidth)||0;bg+=parseFloat(bk.borderLeftWidth)||0}e=bk}if(e.position==="relative"||e.position==="static"){bl+=bi.offsetTop;bg+=bi.offsetLeft}if(a.offset.supportsFixedPosition&&e.position==="fixed"){bl+=Math.max(bf.scrollTop,bi.scrollTop);bg+=Math.max(bf.scrollLeft,bi.scrollLeft)}return{top:bl,left:bg}}}a.offset={initialize:function(){var e=al.body,bd=al.createElement("div"),bg,bi,bh,bj,be=parseFloat(a.css(e,"marginTop"))||0,bf="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";a.extend(bd.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});bd.innerHTML=bf;e.insertBefore(bd,e.firstChild);bg=bd.firstChild;bi=bg.firstChild;bj=bg.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(bi.offsetTop!==5);this.doesAddBorderForTableAndCells=(bj.offsetTop===5);bi.style.position="fixed";bi.style.top="20px";this.supportsFixedPosition=(bi.offsetTop===20||bi.offsetTop===15);bi.style.position=bi.style.top="";bg.style.overflow="hidden";bg.style.position="relative";this.subtractsBorderForOverflowNotVisible=(bi.offsetTop===-5);this.doesNotIncludeMarginInBodyOffset=(e.offsetTop!==be);e.removeChild(bd);e=bd=bg=bi=bh=bj=null;a.offset.initialize=a.noop},bodyOffset:function(e){var be=e.offsetTop,bd=e.offsetLeft;a.offset.initialize();if(a.offset.doesNotIncludeMarginInBodyOffset){be+=parseFloat(a.css(e,"marginTop"))||0;bd+=parseFloat(a.css(e,"marginLeft"))||0}return{top:be,left:bd}},setOffset:function(bf,bo,bi){var bj=a.css(bf,"position");if(bj==="static"){bf.style.position="relative"}var bh=a(bf),bd=bh.offset(),e=a.css(bf,"top"),bm=a.css(bf,"left"),bn=(bj==="absolute"&&a.inArray("auto",[e,bm])>-1),bl={},bk={},be,bg;if(bn){bk=bh.position()}be=bn?bk.top:parseInt(e,10)||0;bg=bn?bk.left:parseInt(bm,10)||0;if(a.isFunction(bo)){bo=bo.call(bf,bi,bd)}if(bo.top!=null){bl.top=(bo.top-bd.top)+be}if(bo.left!=null){bl.left=(bo.left-bd.left)+bg}if("using" in bo){bo.using.call(bf,bl)}else{bh.css(bl)}}};a.fn.extend({position:function(){if(!this[0]){return null}var be=this[0],bd=this.offsetParent(),bf=this.offset(),e=Y.test(bd[0].nodeName)?{top:0,left:0}:bd.offset();bf.top-=parseFloat(a.css(be,"marginTop"))||0;bf.left-=parseFloat(a.css(be,"marginLeft"))||0;e.top+=parseFloat(a.css(bd[0],"borderTopWidth"))||0;e.left+=parseFloat(a.css(bd[0],"borderLeftWidth"))||0;return{top:bf.top-e.top,left:bf.left-e.left}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||al.body;while(e&&(!Y.test(e.nodeName)&&a.css(e,"position")==="static")){e=e.offsetParent}return e})}});a.each(["Left","Top"],function(bd,e){var be="scroll"+e;a.fn[be]=function(bh){var bf=this[0],bg;if(!bf){return null}if(bh!==H){return this.each(function(){bg=az(this);if(bg){bg.scrollTo(!bd?bh:a(bg).scrollLeft(),bd?bh:a(bg).scrollTop())}else{this[be]=bh}})}else{bg=az(bf);return bg?("pageXOffset" in bg)?bg[bd?"pageYOffset":"pageXOffset"]:a.support.boxModel&&bg.document.documentElement[be]||bg.document.body[be]:bf[be]}}});function az(e){return a.isWindow(e)?e:e.nodeType===9?e.defaultView||e.parentWindow:false}a.each(["Height","Width"],function(bd,e){var be=e.toLowerCase();a.fn["inner"+e]=function(){return this[0]?parseFloat(a.css(this[0],be,"padding")):null};a.fn["outer"+e]=function(bf){return this[0]?parseFloat(a.css(this[0],be,bf?"margin":"border")):null};a.fn[be]=function(bg){var bh=this[0];if(!bh){return bg==null?null:this}if(a.isFunction(bg)){return this.each(function(bl){var bk=a(this);bk[be](bg.call(this,bl,bk[be]()))})}if(a.isWindow(bh)){var bi=bh.document.documentElement["client"+e];return bh.document.compatMode==="CSS1Compat"&&bi||bh.document.body["client"+e]||bi}else{if(bh.nodeType===9){return Math.max(bh.documentElement["client"+e],bh.body["scroll"+e],bh.documentElement["scroll"+e],bh.body["offset"+e],bh.documentElement["offset"+e])}else{if(bg===H){var bj=a.css(bh,be),bf=parseFloat(bj);return a.isNaN(bf)?bj:bf}else{return this.css(be,typeof bg==="string"?bg:bg+"px")}}}}});aY.jQuery=aY.$=a})(window);
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/perl
2
+ # ============================================================================
3
+ # $Id: genTZPacking.pl 19162 2008-06-03 20:59:32Z stever $
4
+ # this script is used to generate the section of PACKING.be for WebTools.
5
+ #
6
+ # ============================================================================
7
+
8
+ open OUT, ">www.packing" or die "$0: can't open www.packing for write";
9
+ print OUT "mkdir examples/www\n";
10
+ for $file (`find . -type d | grep -v '.svn'`) {
11
+ chomp $file;
12
+ $file =~ s/^\.\///;
13
+ next if $file eq ".";
14
+ push @dirs, $file; # save these for later
15
+ print OUT "mkdir examples/www/$file\n";
16
+ }
17
+
18
+ for $file (`find . -type f | grep -v '.svn' | grep -v 'www.packing' | grep -v 'genPacking.pl'`) {
19
+ chomp $file;
20
+ my $isAscii = -T $file;
21
+ $file =~ s/^\.//;
22
+ print OUT "copy examples/www$file \$ARCHBASE/examples/www$file ";
23
+ print OUT $isAscii ? "text\n" : "bin\n";
24
+ }
25
+
26
+ for $dir (@dirs) {
27
+ print OUT "chmod examples/www/$dir dir 555\n";
28
+ }
29
+ print OUT "chmod examples/www dir 555\n";
30
+
data/public/index.html ADDED
@@ -0,0 +1,28 @@
1
+ <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
2
+ <html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
3
+ <head>
4
+ <meta http-equiv='Content-Type' content='text/html;charset=utf-8'/>
5
+ <meta http-equiv='Content-Script-Type' content='application/javascript'/>
6
+ <link href='css/webtools.css' rel='stylesheet' type='text/css'>
7
+ <link href='css/jjmenu.css' rel='stylesheet' type='text/css'>
8
+ <script src='scripts/jquery.js'></script>
9
+ <script src='scripts/jquery-ui.js'></script>
10
+ <script src='scripts/jjmenu.js'></script>
11
+ <script src='scripts/webtools.js'></script>
12
+ <title>GemStone/S WebTools</title>
13
+ </head>
14
+ <body>
15
+ <div id='tabs'>
16
+ <ul>
17
+ <li><a href='#homePanel' title='GemStone/S Web Tools Home'>Home</a></li>
18
+ </ul>
19
+ <div id='homePanel' class='hidden'>
20
+ <table>
21
+ <caption>GemStone/S WebTools</caption>
22
+ <tbody />
23
+ </table>
24
+ </div>
25
+ </div>
26
+ <div id='statusBar'>&nbsp</div>
27
+ </body>
28
+ </html>
@@ -0,0 +1,66 @@
1
+ errorCount
2
+ output push webtools.out only
3
+ errorCount
4
+ ifErr 1 stk
5
+ ! ifErr 2 logout
6
+ run
7
+ | name userProfile symbolDictionary |
8
+ name := #'WebTools'.
9
+ userProfile := GsSession currentSession userProfile.
10
+ symbolDictionary := userProfile objectNamed: name.
11
+ symbolDictionary isNil ifTrue: [
12
+ symbolDictionary := SymbolDictionary new name: name; yourself.
13
+ ] ifFalse: [
14
+ symbolDictionary keys do: [:each |
15
+ (symbolDictionary at: each) isClass ifTrue: [
16
+ symbolDictionary removeKey: each.
17
+ ].
18
+ ].
19
+ ].
20
+ userProfile insertDictionary: symbolDictionary at: 1.
21
+ %
22
+ input $GEMSTONE/examples/www/src/StatProcess.gs
23
+ errorCount
24
+ input $GEMSTONE/examples/www/src/StatStatistic.gs
25
+ errorCount
26
+ input $GEMSTONE/examples/www/src/StatProcessType.gs
27
+ errorCount
28
+ input $GEMSTONE/examples/www/src/Statmonitor.gs
29
+ errorCount
30
+ input $GEMSTONE/examples/www/src/Tool.gs
31
+ errorCount
32
+ input $GEMSTONE/examples/www/src/Server.gs
33
+ errorCount
34
+ input $GEMSTONE/examples/www/src/VersionReport.gs
35
+ errorCount
36
+ input $GEMSTONE/examples/www/src/SessionList.gs
37
+ errorCount
38
+ input $GEMSTONE/examples/www/src/CodeBrowser.gs
39
+ errorCount
40
+ input $GEMSTONE/examples/www/src/Statistics.gs
41
+ errorCount
42
+ input $GEMSTONE/examples/www/src/MethodList.gs
43
+ errorCount
44
+ input $GEMSTONE/examples/www/src/Workspace.gs
45
+ errorCount
46
+ input $GEMSTONE/examples/www/src/ObjectLog.gs
47
+ errorCount
48
+ input $GEMSTONE/examples/www/src/Debugger.gs
49
+ errorCount
50
+ input $GEMSTONE/examples/www/src/SharedPageCache.gs
51
+ errorCount
52
+ run
53
+ | symbolList symbolDictionary |
54
+ symbolList := GsSession currentSession userProfile symbolList.
55
+ symbolDictionary := symbolList at: 1.
56
+ symbolList removeAtIndex: 1.
57
+ (symbolList includes: symbolDictionary) ifFalse: [
58
+ symbolList addLast: symbolDictionary.
59
+ ].
60
+ %
61
+ commit
62
+ errorCount
63
+ output pop
64
+ ! return from webtools.out
65
+ errorCount
66
+
@@ -0,0 +1,5 @@
1
+ input $GEMSTONE/examples/www/install.tpz
2
+ run
3
+ (GsSession currentSession userProfile symbolList last at: #'Server') runInForeground.
4
+ %
5
+
@@ -0,0 +1,3510 @@
1
+ /*
2
+ * jsTree 1.0-rc1
3
+ * http://jstree.com/
4
+ *
5
+ * Copyright (c) 2010 Ivan Bozhanov (vakata.com)
6
+ *
7
+ * Dual licensed under the MIT and GPL licenses (same as jQuery):
8
+ * http://www.opensource.org/licenses/mit-license.php
9
+ * http://www.gnu.org/licenses/gpl.html
10
+ *
11
+ * $Date: 2010-07-01 10:51:11 +0300 (четв, 01 юли 2010) $
12
+ * $Revision: 191 $
13
+ */
14
+
15
+ /*jslint browser: true, onevar: true, undef: true, bitwise: true, strict: true */
16
+ /*global window : false, clearInterval: false, clearTimeout: false, document: false, setInterval: false, setTimeout: false, jQuery: false, navigator: false, XSLTProcessor: false, DOMParser: false, XMLSerializer: false*/
17
+
18
+ "use strict";
19
+ // Common functions not related to jsTree
20
+ // decided to move them to a `vakata` "namespace"
21
+ (function ($) {
22
+ $.vakata = {};
23
+ // CSS related functions
24
+ $.vakata.css = {
25
+ get_css : function(rule_name, delete_flag, sheet) {
26
+ rule_name = rule_name.toLowerCase();
27
+ var css_rules = sheet.cssRules || sheet.rules,
28
+ j = 0;
29
+ do {
30
+ if(css_rules.length && j > css_rules.length + 5) { return false; }
31
+ if(css_rules[j].selectorText && css_rules[j].selectorText.toLowerCase() == rule_name) {
32
+ if(delete_flag === true) {
33
+ if(sheet.removeRule) { sheet.removeRule(j); }
34
+ if(sheet.deleteRule) { sheet.deleteRule(j); }
35
+ return true;
36
+ }
37
+ else { return css_rules[j]; }
38
+ }
39
+ }
40
+ while (css_rules[++j]);
41
+ return false;
42
+ },
43
+ add_css : function(rule_name, sheet) {
44
+ if($.jstree.css.get_css(rule_name, false, sheet)) { return false; }
45
+ if(sheet.insertRule) { sheet.insertRule(rule_name + ' { }', 0); } else { sheet.addRule(rule_name, null, 0); }
46
+ return $.vakata.css.get_css(rule_name);
47
+ },
48
+ remove_css : function(rule_name, sheet) {
49
+ return $.vakata.css.get_css(rule_name, true, sheet);
50
+ },
51
+ add_sheet : function(opts) {
52
+ var tmp;
53
+ if(opts.str) {
54
+ tmp = document.createElement("style");
55
+ tmp.setAttribute('type',"text/css");
56
+ if(tmp.styleSheet) {
57
+ document.getElementsByTagName("head")[0].appendChild(tmp);
58
+ tmp.styleSheet.cssText = opts.str;
59
+ }
60
+ else {
61
+ tmp.appendChild(document.createTextNode(opts.str));
62
+ document.getElementsByTagName("head")[0].appendChild(tmp);
63
+ }
64
+ return tmp.sheet || tmp.styleSheet;
65
+ }
66
+ if(opts.url) {
67
+ if(document.createStyleSheet) {
68
+ try { tmp = document.createStyleSheet(opts.url); } catch (e) { }
69
+ }
70
+ else {
71
+ tmp = document.createElement('link');
72
+ tmp.rel = 'stylesheet';
73
+ tmp.type = 'text/css';
74
+ tmp.media = "all";
75
+ tmp.href = opts.url;
76
+ document.getElementsByTagName("head")[0].appendChild(tmp);
77
+ return tmp.styleSheet;
78
+ }
79
+ }
80
+ }
81
+ };
82
+ })(jQuery);
83
+
84
+ /*
85
+ * jsTree core 1.0
86
+ */
87
+ (function ($) {
88
+ // private variables
89
+ var instances = [], // instance array (used by $.jstree.reference/create/focused)
90
+ focused_instance = -1, // the index in the instance array of the currently focused instance
91
+ plugins = {}, // list of included plugins
92
+ prepared_move = {}, // for the move plugin
93
+ is_ie6 = false;
94
+
95
+ // jQuery plugin wrapper (thanks to jquery UI widget function)
96
+ $.fn.jstree = function (settings) {
97
+ var isMethodCall = (typeof settings == 'string'), // is this a method call like $().jstree("open_node")
98
+ args = Array.prototype.slice.call(arguments, 1),
99
+ returnValue = this;
100
+
101
+ // extend settings and allow for multiple hashes and metadata
102
+ if(!isMethodCall && $.meta) { args.push($.metadata.get(this).jstree); }
103
+ settings = !isMethodCall && args.length ? $.extend.apply(null, [true, settings].concat(args)) : settings;
104
+ // block calls to "private" methods
105
+ if(isMethodCall && settings.substring(0, 1) == '_') { return returnValue; }
106
+
107
+ // if a method call execute the method on all selected instances
108
+ if(isMethodCall) {
109
+ this.each(function() {
110
+ var instance = instances[$.data(this, "jstree-instance-id")],
111
+ methodValue = (instance && $.isFunction(instance[settings])) ? instance[settings].apply(instance, args) : instance;
112
+ if(typeof methodValue !== "undefined" && (settings.indexOf("is_" === 0) || (methodValue !== true && methodValue !== false))) { returnValue = methodValue; return false; }
113
+ });
114
+ }
115
+ else {
116
+ this.each(function() {
117
+ var instance_id = $.data(this, "jstree-instance-id"),
118
+ s = false;
119
+ // if an instance already exists, destroy it first
120
+ if(typeof instance_id !== "undefined" && instances[instance_id]) { instances[instance_id].destroy(); }
121
+ // push a new empty object to the instances array
122
+ instance_id = parseInt(instances.push({}),10) - 1;
123
+ // store the jstree instance id to the container element
124
+ $.data(this, "jstree-instance-id", instance_id);
125
+ // clean up all plugins
126
+ if(!settings) { settings = {}; }
127
+ settings.plugins = $.isArray(settings.plugins) ? settings.plugins : $.jstree.defaults.plugins;
128
+ if($.inArray("core", settings.plugins) === -1) { settings.plugins.unshift("core"); }
129
+
130
+ // only unique plugins (NOT WORKING)
131
+ // settings.plugins = settings.plugins.sort().join(",,").replace(/(,|^)([^,]+)(,,\2)+(,|$)/g,"$1$2$4").replace(/,,+/g,",").replace(/,$/,"").split(",");
132
+
133
+ // extend defaults with passed data
134
+ s = $.extend(true, {}, $.jstree.defaults, settings);
135
+ s.plugins = settings.plugins;
136
+ $.each(plugins, function (i, val) { if($.inArray(i, s.plugins) === -1) { s[i] = null; delete s[i]; } });
137
+ // push the new object to the instances array (at the same time set the default classes to the container) and init
138
+ instances[instance_id] = new $.jstree._instance(instance_id, $(this).addClass("jstree jstree-" + instance_id), s);
139
+ // init all activated plugins for this instance
140
+ $.each(instances[instance_id]._get_settings().plugins, function (i, val) { instances[instance_id].data[val] = {}; });
141
+ $.each(instances[instance_id]._get_settings().plugins, function (i, val) { if(plugins[val]) { plugins[val].__init.apply(instances[instance_id]); } });
142
+ // initialize the instance
143
+ instances[instance_id].init();
144
+ });
145
+ }
146
+ // return the jquery selection (or if it was a method call that returned a value - the returned value)
147
+ return returnValue;
148
+ };
149
+ // object to store exposed functions and objects
150
+ $.jstree = {
151
+ defaults : {
152
+ plugins : []
153
+ },
154
+ _focused : function () { return instances[focused_instance] || null; },
155
+ _reference : function (needle) {
156
+ // get by instance id
157
+ if(instances[needle]) { return instances[needle]; }
158
+ // get by DOM (if still no luck - return null
159
+ var o = $(needle);
160
+ if(!o.length && typeof needle === "string") { o = $("#" + needle); }
161
+ if(!o.length) { return null; }
162
+ return instances[o.closest(".jstree").data("jstree-instance-id")] || null;
163
+ },
164
+ _instance : function (index, container, settings) {
165
+ // for plugins to store data in
166
+ this.data = { core : {} };
167
+ this.get_settings = function () { return $.extend(true, {}, settings); };
168
+ this._get_settings = function () { return settings; };
169
+ this.get_index = function () { return index; };
170
+ this.get_container = function () { return container; };
171
+ this._set_settings = function (s) {
172
+ settings = $.extend(true, {}, settings, s);
173
+ };
174
+ },
175
+ _fn : { },
176
+ plugin : function (pname, pdata) {
177
+ pdata = $.extend({}, {
178
+ __init : $.noop,
179
+ __destroy : $.noop,
180
+ _fn : {},
181
+ defaults : false
182
+ }, pdata);
183
+ plugins[pname] = pdata;
184
+
185
+ $.jstree.defaults[pname] = pdata.defaults;
186
+ $.each(pdata._fn, function (i, val) {
187
+ val.plugin = pname;
188
+ val.old = $.jstree._fn[i];
189
+ $.jstree._fn[i] = function () {
190
+ var rslt,
191
+ func = val,
192
+ args = Array.prototype.slice.call(arguments),
193
+ evnt = new $.Event("before.jstree"),
194
+ rlbk = false;
195
+
196
+ // Check if function belongs to the included plugins of this instance
197
+ do {
198
+ if(func && func.plugin && $.inArray(func.plugin, this._get_settings().plugins) !== -1) { break; }
199
+ func = func.old;
200
+ } while(func);
201
+ if(!func) { return; }
202
+
203
+ // a chance to stop execution (or change arguments):
204
+ // * just bind to jstree.before
205
+ // * check the additional data object (func property)
206
+ // * call event.stopImmediatePropagation()
207
+ // * return false (or an array of arguments)
208
+ rslt = this.get_container().triggerHandler(evnt, { "func" : i, "inst" : this, "args" : args });
209
+ if(rslt === false) { return; }
210
+ if(typeof rslt !== "undefined") { args = rslt; }
211
+
212
+ // context and function to trigger events, then finally call the function
213
+ if(i.indexOf("_") === 0) {
214
+ rslt = func.apply(this, args);
215
+ }
216
+ else {
217
+ rslt = func.apply(
218
+ $.extend({}, this, {
219
+ __callback : function (data) {
220
+ this.get_container().triggerHandler( i + '.jstree', { "inst" : this, "args" : args, "rslt" : data, "rlbk" : rlbk });
221
+ },
222
+ __rollback : function () {
223
+ rlbk = this.get_rollback();
224
+ return rlbk;
225
+ },
226
+ __call_old : function (replace_arguments) {
227
+ return func.old.apply(this, (replace_arguments ? Array.prototype.slice.call(arguments, 1) : args ) );
228
+ }
229
+ }), args);
230
+ }
231
+
232
+ // return the result
233
+ return rslt;
234
+ };
235
+ $.jstree._fn[i].old = val.old;
236
+ $.jstree._fn[i].plugin = pname;
237
+ });
238
+ },
239
+ rollback : function (rb) {
240
+ if(rb) {
241
+ if(!$.isArray(rb)) { rb = [ rb ]; }
242
+ $.each(rb, function (i, val) {
243
+ instances[val.i].set_rollback(val.h, val.d);
244
+ });
245
+ }
246
+ }
247
+ };
248
+ // set the prototype for all instances
249
+ $.jstree._fn = $.jstree._instance.prototype = {};
250
+
251
+ // css functions - used internally
252
+
253
+ // load the css when DOM is ready
254
+ $(function() {
255
+ // code is copied form jQuery ($.browser is deprecated + there is a bug in IE)
256
+ var u = navigator.userAgent.toLowerCase(),
257
+ v = (u.match( /.+?(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1],
258
+ css_string = '' +
259
+ '.jstree ul, .jstree li { display:block; margin:0 0 0 0; padding:0 0 0 0; list-style-type:none; } ' +
260
+ '.jstree li { display:block; min-height:18px; line-height:18px; white-space:nowrap; margin-left:18px; } ' +
261
+ '.jstree-rtl li { margin-left:0; margin-right:18px; } ' +
262
+ '.jstree > ul > li { margin-left:0px; } ' +
263
+ '.jstree-rtl > ul > li { margin-right:0px; } ' +
264
+ '.jstree ins { display:inline-block; text-decoration:none; width:18px; height:18px; margin:0 0 0 0; padding:0; } ' +
265
+ '.jstree a { display:inline-block; line-height:16px; height:16px; color:black; white-space:nowrap; text-decoration:none; padding:1px 2px; margin:0; } ' +
266
+ '.jstree a:focus { outline: none; } ' +
267
+ '.jstree a > ins { height:16px; width:16px; } ' +
268
+ '.jstree a > .jstree-icon { margin-right:3px; } ' +
269
+ '.jstree-rtl a > .jstree-icon { margin-left:3px; margin-right:0; } ' +
270
+ 'li.jstree-open > ul { display:block; } ' +
271
+ 'li.jstree-closed > ul { display:none; } ';
272
+ // Correct IE 6 (does not support the > CSS selector)
273
+ if(/msie/.test(u) && parseInt(v, 10) == 6) {
274
+ is_ie6 = true;
275
+ css_string += '' +
276
+ '.jstree li { height:18px; margin-left:0; margin-right:0; } ' +
277
+ '.jstree li li { margin-left:18px; } ' +
278
+ '.jstree-rtl li li { margin-left:0px; margin-right:18px; } ' +
279
+ 'li.jstree-open ul { display:block; } ' +
280
+ 'li.jstree-closed ul { display:none !important; } ' +
281
+ '.jstree li a { display:inline; border-width:0 !important; padding:0px 2px !important; } ' +
282
+ '.jstree li a ins { height:16px; width:16px; margin-right:3px; } ' +
283
+ '.jstree-rtl li a ins { margin-right:0px; margin-left:3px; } ';
284
+ }
285
+ // Correct IE 7 (shifts anchor nodes onhover)
286
+ if(/msie/.test(u) && parseInt(v, 10) == 7) {
287
+ css_string += '.jstree li a { border-width:0 !important; padding:0px 2px !important; } ';
288
+ }
289
+ $.vakata.css.add_sheet({ str : css_string });
290
+ });
291
+
292
+ // core functions (open, close, create, update, delete)
293
+ $.jstree.plugin("core", {
294
+ __init : function () {
295
+ this.data.core.to_open = $.map($.makeArray(this.get_settings().core.initially_open), function (n) { return "#" + n.toString().replace(/^#/,"").replace('\\/','/').replace('/','\\/'); });
296
+ },
297
+ defaults : {
298
+ html_titles : false,
299
+ animation : 500,
300
+ initially_open : [],
301
+ rtl : false,
302
+ strings : {
303
+ loading : "Loading ...",
304
+ new_node : "New node"
305
+ }
306
+ },
307
+ _fn : {
308
+ init : function () {
309
+ this.set_focus();
310
+ if(this._get_settings().core.rtl) {
311
+ this.get_container().addClass("jstree-rtl").css("direction", "rtl");
312
+ }
313
+ this.get_container().html("<ul><li class='jstree-last jstree-leaf'><ins>&#160;</ins><a class='jstree-loading' href='#'><ins class='jstree-icon'>&#160;</ins>" + this._get_settings().core.strings.loading + "</a></li></ul>");
314
+ this.data.core.li_height = this.get_container().find("ul li.jstree-closed, ul li.jstree-leaf").eq(0).height() || 18;
315
+
316
+ this.get_container()
317
+ .delegate("li > ins", "click.jstree", $.proxy(function (event) {
318
+ var trgt = $(event.target);
319
+ if(trgt.is("ins") && event.pageY - trgt.offset().top < this.data.core.li_height) { this.toggle_node(trgt); }
320
+ }, this))
321
+ .bind("mousedown.jstree", $.proxy(function () {
322
+ this.set_focus(); // This used to be setTimeout(set_focus,0) - why?
323
+ }, this))
324
+ .bind("dblclick.jstree", function (event) {
325
+ var sel;
326
+ if(document.selection && document.selection.empty) { document.selection.empty(); }
327
+ else {
328
+ if(window.getSelection) {
329
+ sel = window.getSelection();
330
+ try {
331
+ sel.removeAllRanges();
332
+ sel.collapse();
333
+ } catch (err) { }
334
+ }
335
+ }
336
+ });
337
+ this.__callback();
338
+ this.load_node(-1, function () { this.loaded(); this.reopen(); });
339
+ },
340
+ destroy : function () {
341
+ var i,
342
+ n = this.get_index(),
343
+ s = this._get_settings(),
344
+ _this = this;
345
+
346
+ $.each(s.plugins, function (i, val) {
347
+ try { plugins[val].__destroy.apply(_this); } catch(err) { }
348
+ });
349
+ this.__callback();
350
+ // set focus to another instance if this one is focused
351
+ if(this.is_focused()) {
352
+ for(i in instances) {
353
+ if(instances.hasOwnProperty(i) && i != n) {
354
+ instances[i].set_focus();
355
+ break;
356
+ }
357
+ }
358
+ }
359
+ // if no other instance found
360
+ if(n === focused_instance) { focused_instance = -1; }
361
+ // remove all traces of jstree in the DOM (only the ones set using jstree*) and cleans all events
362
+ this.get_container()
363
+ .unbind(".jstree")
364
+ .undelegate(".jstree")
365
+ .removeData("jstree-instance-id")
366
+ .find("[class^='jstree']")
367
+ .andSelf()
368
+ .attr("class", function () { return this.className.replace(/jstree[^ ]*|$/ig,''); });
369
+ // remove the actual data
370
+ instances[n] = null;
371
+ delete instances[n];
372
+ },
373
+ save_opened : function () {
374
+ var _this = this;
375
+ this.data.core.to_open = [];
376
+ this.get_container().find(".jstree-open").each(function () {
377
+ _this.data.core.to_open.push("#" + this.id.toString().replace(/^#/,"").replace('\\/','/').replace('/','\\/'));
378
+ });
379
+ this.__callback(_this.data.core.to_open);
380
+ },
381
+ reopen : function (is_callback) {
382
+ var _this = this,
383
+ done = true,
384
+ current = [],
385
+ remaining = [];
386
+ if(!is_callback) { this.data.core.reopen = false; this.data.core.refreshing = true; }
387
+ if(this.data.core.to_open.length) {
388
+ $.each(this.data.core.to_open, function (i, val) {
389
+ if(val == "#") { return true; }
390
+ if($(val).length && $(val).is(".jstree-closed")) { current.push(val); }
391
+ else { remaining.push(val); }
392
+ });
393
+ if(current.length) {
394
+ this.data.core.to_open = remaining;
395
+ $.each(current, function (i, val) {
396
+ _this.open_node(val, function () { _this.reopen(true); }, true);
397
+ });
398
+ done = false;
399
+ }
400
+ }
401
+ if(done) {
402
+ // TODO: find a more elegant approach to syncronizing returning requests
403
+ if(this.data.core.reopen) { clearTimeout(this.data.core.reopen); }
404
+ this.data.core.reopen = setTimeout(function () { _this.__callback({}, _this); }, 50);
405
+ this.data.core.refreshing = false;
406
+ }
407
+ },
408
+ refresh : function (obj) {
409
+ var _this = this;
410
+ this.save_opened();
411
+ if(!obj) { obj = -1; }
412
+ obj = this._get_node(obj);
413
+ if(!obj) { obj = -1; }
414
+ if(obj !== -1) { obj.children("UL").remove(); }
415
+ this.load_node(obj, function () { _this.__callback({ "obj" : obj}); _this.reopen(); });
416
+ },
417
+ // Dummy function to fire after the first load (so that there is a jstree.loaded event)
418
+ loaded : function () {
419
+ this.__callback();
420
+ },
421
+ // deal with focus
422
+ set_focus : function () {
423
+ var f = $.jstree._focused();
424
+ if(f && f !== this) {
425
+ f.get_container().removeClass("jstree-focused");
426
+ }
427
+ if(f !== this) {
428
+ this.get_container().addClass("jstree-focused");
429
+ focused_instance = this.get_index();
430
+ }
431
+ this.__callback();
432
+ },
433
+ is_focused : function () {
434
+ return focused_instance == this.get_index();
435
+ },
436
+
437
+ // traverse
438
+ _get_node : function (obj) {
439
+ var $obj = $(obj, this.get_container());
440
+ if($obj.is(".jstree") || obj == -1) { return -1; }
441
+ $obj = $obj.closest("li", this.get_container());
442
+ return $obj.length ? $obj : false;
443
+ },
444
+ _get_next : function (obj, strict) {
445
+ obj = this._get_node(obj);
446
+ if(obj === -1) { return this.get_container().find("> ul > li:first-child"); }
447
+ if(!obj.length) { return false; }
448
+ if(strict) { return (obj.nextAll("li").size() > 0) ? obj.nextAll("li:eq(0)") : false; }
449
+
450
+ if(obj.hasClass("jstree-open")) { return obj.find("li:eq(0)"); }
451
+ else if(obj.nextAll("li").size() > 0) { return obj.nextAll("li:eq(0)"); }
452
+ else { return obj.parentsUntil(".jstree","li").next("li").eq(0); }
453
+ },
454
+ _get_prev : function (obj, strict) {
455
+ obj = this._get_node(obj);
456
+ if(obj === -1) { return this.get_container().find("> ul > li:last-child"); }
457
+ if(!obj.length) { return false; }
458
+ if(strict) { return (obj.prevAll("li").length > 0) ? obj.prevAll("li:eq(0)") : false; }
459
+
460
+ if(obj.prev("li").length) {
461
+ obj = obj.prev("li").eq(0);
462
+ while(obj.hasClass("jstree-open")) { obj = obj.children("ul:eq(0)").children("li:last"); }
463
+ return obj;
464
+ }
465
+ else { var o = obj.parentsUntil(".jstree","li:eq(0)"); return o.length ? o : false; }
466
+ },
467
+ _get_parent : function (obj) {
468
+ obj = this._get_node(obj);
469
+ if(obj == -1 || !obj.length) { return false; }
470
+ var o = obj.parentsUntil(".jstree", "li:eq(0)");
471
+ return o.length ? o : -1;
472
+ },
473
+ _get_children : function (obj) {
474
+ obj = this._get_node(obj);
475
+ if(obj === -1) { return this.get_container().children("ul:eq(0)").children("li"); }
476
+ if(!obj.length) { return false; }
477
+ return obj.children("ul:eq(0)").children("li");
478
+ },
479
+ get_path : function (obj, id_mode) {
480
+ var p = [],
481
+ _this = this;
482
+ obj = this._get_node(obj);
483
+ if(obj === -1 || !obj || !obj.length) { return false; }
484
+ obj.parentsUntil(".jstree", "li").each(function () {
485
+ p.push( id_mode ? this.id : _this.get_text(this) );
486
+ });
487
+ p.reverse();
488
+ p.push( id_mode ? obj.attr("id") : this.get_text(obj) );
489
+ return p;
490
+ },
491
+
492
+ is_open : function (obj) { obj = this._get_node(obj); return obj && obj !== -1 && obj.hasClass("jstree-open"); },
493
+ is_closed : function (obj) { obj = this._get_node(obj); return obj && obj !== -1 && obj.hasClass("jstree-closed"); },
494
+ is_leaf : function (obj) { obj = this._get_node(obj); return obj && obj !== -1 && obj.hasClass("jstree-leaf"); },
495
+ // open/close
496
+ open_node : function (obj, callback, skip_animation) {
497
+ obj = this._get_node(obj);
498
+ if(!obj.length) { return false; }
499
+ if(!obj.hasClass("jstree-closed")) { if(callback) { callback.call(); } return false; }
500
+ var s = skip_animation || is_ie6 ? 0 : this._get_settings().core.animation,
501
+ t = this;
502
+ if(!this._is_loaded(obj)) {
503
+ obj.children("a").addClass("jstree-loading");
504
+ this.load_node(obj, function () { t.open_node(obj, callback, skip_animation); }, callback);
505
+ }
506
+ else {
507
+ if(s) { obj.children("ul").css("display","none"); }
508
+ obj.removeClass("jstree-closed").addClass("jstree-open").children("a").removeClass("jstree-loading");
509
+ if(s) { obj.children("ul").stop(true).slideDown(s, function () { this.style.display = ""; }); }
510
+ this.__callback({ "obj" : obj });
511
+ if(callback) { callback.call(); }
512
+ }
513
+ },
514
+ close_node : function (obj, skip_animation) {
515
+ obj = this._get_node(obj);
516
+ var s = skip_animation || is_ie6 ? 0 : this._get_settings().core.animation;
517
+ if(!obj.length || !obj.hasClass("jstree-open")) { return false; }
518
+ if(s) { obj.children("ul").attr("style","display:block !important"); }
519
+ obj.removeClass("jstree-open").addClass("jstree-closed");
520
+ if(s) { obj.children("ul").stop(true).slideUp(s, function () { this.style.display = ""; }); }
521
+ this.__callback({ "obj" : obj });
522
+ },
523
+ toggle_node : function (obj) {
524
+ obj = this._get_node(obj);
525
+ if(obj.hasClass("jstree-closed")) { return this.open_node(obj); }
526
+ if(obj.hasClass("jstree-open")) { return this.close_node(obj); }
527
+ },
528
+ open_all : function (obj, original_obj) {
529
+ obj = obj ? this._get_node(obj) : this.get_container();
530
+ if(!obj || obj === -1) { obj = this.get_container(); }
531
+ if(original_obj) {
532
+ obj = obj.find("li.jstree-closed");
533
+ }
534
+ else {
535
+ original_obj = obj;
536
+ if(obj.is(".jstree-closed")) { obj = obj.find("li.jstree-closed").andSelf(); }
537
+ else { obj = obj.find("li.jstree-closed"); }
538
+ }
539
+ var _this = this;
540
+ obj.each(function () {
541
+ var __this = this;
542
+ if(!_this._is_loaded(this)) { _this.open_node(this, function() { _this.open_all(__this, original_obj); }, true); }
543
+ else { _this.open_node(this, false, true); }
544
+ });
545
+ // so that callback is fired AFTER all nodes are open
546
+ if(original_obj.find('li.jstree-closed').length === 0) { this.__callback({ "obj" : original_obj }); }
547
+ },
548
+ close_all : function (obj) {
549
+ var _this = this;
550
+ obj = obj ? this._get_node(obj) : this.get_container();
551
+ if(!obj || obj === -1) { obj = this.get_container(); }
552
+ obj.find("li.jstree-open").andSelf().each(function () { _this.close_node(this); });
553
+ this.__callback({ "obj" : obj });
554
+ },
555
+ clean_node : function (obj) {
556
+ obj = obj && obj != -1 ? $(obj) : this.get_container();
557
+ obj = obj.is("li") ? obj.find("li").andSelf() : obj.find("li");
558
+ obj.removeClass("jstree-last")
559
+ .filter("li:last-child").addClass("jstree-last").end()
560
+ .filter(":has(li)")
561
+ .not(".jstree-open").removeClass("jstree-leaf").addClass("jstree-closed");
562
+ obj.not(".jstree-open, .jstree-closed").addClass("jstree-leaf").children("ul").remove();
563
+ this.__callback({ "obj" : obj });
564
+ },
565
+ // rollback
566
+ get_rollback : function () {
567
+ this.__callback();
568
+ return { i : this.get_index(), h : this.get_container().children("ul").clone(true), d : this.data };
569
+ },
570
+ set_rollback : function (html, data) {
571
+ this.get_container().empty().append(html);
572
+ this.data = data;
573
+ this.__callback();
574
+ },
575
+ // Dummy functions to be overwritten by any datastore plugin included
576
+ load_node : function (obj, s_call, e_call) { this.__callback({ "obj" : obj }); },
577
+ _is_loaded : function (obj) { return true; },
578
+
579
+ // Basic operations: create
580
+ create_node : function (obj, position, js, callback, is_loaded) {
581
+ obj = this._get_node(obj);
582
+ position = typeof position === "undefined" ? "last" : position;
583
+ var d = $("<li>"),
584
+ s = this._get_settings().core,
585
+ tmp;
586
+
587
+ if(obj !== -1 && !obj.length) { return false; }
588
+ if(!is_loaded && !this._is_loaded(obj)) { this.load_node(obj, function () { this.create_node(obj, position, js, callback, true); }); return false; }
589
+
590
+ this.__rollback();
591
+
592
+ if(typeof js === "string") { js = { "data" : js }; }
593
+ if(!js) { js = {}; }
594
+ if(js.attr) { d.attr(js.attr); }
595
+ if(js.state) { d.addClass("jstree-" + js.state); }
596
+ if(!js.data) { js.data = s.strings.new_node; }
597
+ if(!$.isArray(js.data)) { tmp = js.data; js.data = []; js.data.push(tmp); }
598
+ $.each(js.data, function (i, m) {
599
+ tmp = $("<a>");
600
+ if($.isFunction(m)) { m = m.call(this, js); }
601
+ if(typeof m == "string") { tmp.attr('href','#')[ s.html_titles ? "html" : "text" ](m); }
602
+ else {
603
+ if(!m.attr) { m.attr = {}; }
604
+ if(!m.attr.href) { m.attr.href = '#'; }
605
+ tmp.attr(m.attr)[ s.html_titles ? "html" : "text" ](m.title);
606
+ if(m.language) { tmp.addClass(m.language); }
607
+ }
608
+ tmp.prepend("<ins class='jstree-icon'>&#160;</ins>");
609
+ if(m.icon) {
610
+ if(m.icon.indexOf("/") === -1) { tmp.children("ins").addClass(m.icon); }
611
+ else { tmp.children("ins").css("background","url('" + m.icon + "') center center no-repeat"); }
612
+ }
613
+ d.append(tmp);
614
+ });
615
+ d.prepend("<ins class='jstree-icon'>&#160;</ins>");
616
+ if(obj === -1) {
617
+ obj = this.get_container();
618
+ if(position === "before") { position = "first"; }
619
+ if(position === "after") { position = "last"; }
620
+ }
621
+ switch(position) {
622
+ case "before": obj.before(d); tmp = this._get_parent(obj); break;
623
+ case "after" : obj.after(d); tmp = this._get_parent(obj); break;
624
+ case "inside":
625
+ case "first" :
626
+ if(!obj.children("ul").length) { obj.append("<ul>"); }
627
+ obj.children("ul").prepend(d);
628
+ tmp = obj;
629
+ break;
630
+ case "last":
631
+ if(!obj.children("ul").length) { obj.append("<ul>"); }
632
+ obj.children("ul").append(d);
633
+ tmp = obj;
634
+ break;
635
+ default:
636
+ if(!obj.children("ul").length) { obj.append("<ul>"); }
637
+ if(!position) { position = 0; }
638
+ tmp = obj.children("ul").children("li").eq(position);
639
+ if(tmp.length) { tmp.before(d); }
640
+ else { obj.children("ul").append(d); }
641
+ tmp = obj;
642
+ break;
643
+ }
644
+ if(tmp === -1 || tmp.get(0) === this.get_container().get(0)) { tmp = -1; }
645
+ this.clean_node(tmp);
646
+ this.__callback({ "obj" : d, "parent" : tmp });
647
+ if(callback) { callback.call(this, d); }
648
+ return d;
649
+ },
650
+ // Basic operations: rename (deal with text)
651
+ get_text : function (obj) {
652
+ obj = this._get_node(obj);
653
+ if(!obj.length) { return false; }
654
+ var s = this._get_settings().core.html_titles;
655
+ obj = obj.children("a:eq(0)");
656
+ if(s) {
657
+ obj = obj.clone();
658
+ obj.children("INS").remove();
659
+ return obj.html();
660
+ }
661
+ else {
662
+ obj = obj.contents().filter(function() { return this.nodeType == 3; })[0];
663
+ return obj.nodeValue;
664
+ }
665
+ },
666
+ set_text : function (obj, val) {
667
+ obj = this._get_node(obj);
668
+ if(!obj.length) { return false; }
669
+ obj = obj.children("a:eq(0)");
670
+ if(this._get_settings().core.html_titles) {
671
+ var tmp = obj.children("INS").clone();
672
+ obj.html(val).prepend(tmp);
673
+ this.__callback({ "obj" : obj, "name" : val });
674
+ return true;
675
+ }
676
+ else {
677
+ obj = obj.contents().filter(function() { return this.nodeType == 3; })[0];
678
+ this.__callback({ "obj" : obj, "name" : val });
679
+ return (obj.nodeValue = val);
680
+ }
681
+ },
682
+ rename_node : function (obj, val) {
683
+ obj = this._get_node(obj);
684
+ this.__rollback();
685
+ if(obj && obj.length && this.set_text.apply(this, Array.prototype.slice.call(arguments))) { this.__callback({ "obj" : obj, "name" : val }); }
686
+ },
687
+ // Basic operations: deleting nodes
688
+ delete_node : function (obj) {
689
+ obj = this._get_node(obj);
690
+ if(!obj.length) { return false; }
691
+ this.__rollback();
692
+ var p = this._get_parent(obj), prev = this._get_prev(obj);
693
+ obj = obj.remove();
694
+ if(p !== -1 && p.find("> ul > li").length === 0) {
695
+ p.removeClass("jstree-open jstree-closed").addClass("jstree-leaf");
696
+ }
697
+ this.clean_node(p);
698
+ this.__callback({ "obj" : obj, "prev" : prev });
699
+ return obj;
700
+ },
701
+ prepare_move : function (o, r, pos, cb, is_cb) {
702
+ var p = {};
703
+
704
+ p.ot = $.jstree._reference(p.o) || this;
705
+ p.o = p.ot._get_node(o);
706
+ p.r = r === - 1 ? -1 : this._get_node(r);
707
+ p.p = (typeof p === "undefined") ? "last" : pos; // TODO: move to a setting
708
+ if(!is_cb && prepared_move.o && prepared_move.o[0] === p.o[0] && prepared_move.r[0] === p.r[0] && prepared_move.p === p.p) {
709
+ this.__callback(prepared_move);
710
+ if(cb) { cb.call(this, prepared_move); }
711
+ return;
712
+ }
713
+ p.ot = $.jstree._reference(p.o) || this;
714
+ p.rt = r === -1 ? p.ot : $.jstree._reference(p.r) || this;
715
+ if(p.r === -1) {
716
+ p.cr = -1;
717
+ switch(p.p) {
718
+ case "first":
719
+ case "before":
720
+ case "inside":
721
+ p.cp = 0;
722
+ break;
723
+ case "after":
724
+ case "last":
725
+ p.cp = p.rt.get_container().find(" > ul > li").length;
726
+ break;
727
+ default:
728
+ p.cp = p.p;
729
+ break;
730
+ }
731
+ }
732
+ else {
733
+ if(!/^(before|after)$/.test(p.p) && !this._is_loaded(p.r)) {
734
+ return this.load_node(p.r, function () { this.prepare_move(o, r, pos, cb, true); });
735
+ }
736
+ switch(p.p) {
737
+ case "before":
738
+ p.cp = p.r.index();
739
+ p.cr = p.rt._get_parent(p.r);
740
+ break;
741
+ case "after":
742
+ p.cp = p.r.index() + 1;
743
+ p.cr = p.rt._get_parent(p.r);
744
+ break;
745
+ case "inside":
746
+ case "first":
747
+ p.cp = 0;
748
+ p.cr = p.r;
749
+ break;
750
+ case "last":
751
+ p.cp = p.r.find(" > ul > li").length;
752
+ p.cr = p.r;
753
+ break;
754
+ default:
755
+ p.cp = p.p;
756
+ p.cr = p.r;
757
+ break;
758
+ }
759
+ }
760
+ p.np = p.cr == -1 ? p.rt.get_container() : p.cr;
761
+ p.op = p.ot._get_parent(p.o);
762
+ p.or = p.np.find(" > ul > li:nth-child(" + (p.cp + 1) + ")");
763
+
764
+ prepared_move = p;
765
+ this.__callback(prepared_move);
766
+ if(cb) { cb.call(this, prepared_move); }
767
+ },
768
+ check_move : function () {
769
+ var obj = prepared_move, ret = true;
770
+ if(obj.or[0] === obj.o[0]) { return false; }
771
+ obj.o.each(function () {
772
+ if(obj.r.parentsUntil(".jstree").andSelf().filter("li").index(this) !== -1) { ret = false; return false; }
773
+ });
774
+ return ret;
775
+ },
776
+ move_node : function (obj, ref, position, is_copy, is_prepared, skip_check) {
777
+ if(!is_prepared) {
778
+ return this.prepare_move(obj, ref, position, function (p) {
779
+ this.move_node(p, false, false, is_copy, true, skip_check);
780
+ });
781
+ }
782
+ if(!skip_check && !this.check_move()) { return false; }
783
+
784
+ this.__rollback();
785
+ var o = false;
786
+ if(is_copy) {
787
+ o = obj.o.clone();
788
+ o.find("*[id]").andSelf().each(function () {
789
+ if(this.id) { this.id = "copy_" + this.id; }
790
+ });
791
+ }
792
+ else { o = obj.o; }
793
+
794
+ if(obj.or.length) { obj.or.before(o); }
795
+ else {
796
+ if(!obj.np.children("ul").length) { $("<ul>").appendTo(obj.np); }
797
+ obj.np.children("ul:eq(0)").append(o);
798
+ }
799
+
800
+ try {
801
+ obj.ot.clean_node(obj.op);
802
+ obj.rt.clean_node(obj.np);
803
+ if(!obj.op.find("> ul > li").length) {
804
+ obj.op.removeClass("jstree-open jstree-closed").addClass("jstree-leaf").children("ul").remove();
805
+ }
806
+ } catch (e) { }
807
+
808
+ if(is_copy) {
809
+ prepared_move.cy = true;
810
+ prepared_move.oc = o;
811
+ }
812
+ this.__callback(prepared_move);
813
+ return prepared_move;
814
+ },
815
+ _get_move : function () { return prepared_move; }
816
+ }
817
+ });
818
+ })(jQuery);
819
+ //*/
820
+
821
+ /*
822
+ * jsTree ui plugin 1.0
823
+ * This plugins handles selecting/deselecting/hovering/dehovering nodes
824
+ */
825
+ (function ($) {
826
+ $.jstree.plugin("ui", {
827
+ __init : function () {
828
+ this.data.ui.selected = $();
829
+ this.data.ui.last_selected = false;
830
+ this.data.ui.hovered = null;
831
+ this.data.ui.to_select = this.get_settings().ui.initially_select;
832
+
833
+ this.get_container()
834
+ .delegate("a", "click.jstree", $.proxy(function (event) {
835
+ event.preventDefault();
836
+ this.select_node(event.currentTarget, true, event);
837
+ }, this))
838
+ .delegate("a", "mouseenter.jstree", $.proxy(function (event) {
839
+ this.hover_node(event.target);
840
+ }, this))
841
+ .delegate("a", "mouseleave.jstree", $.proxy(function (event) {
842
+ this.dehover_node(event.target);
843
+ }, this))
844
+ .bind("reopen.jstree", $.proxy(function () {
845
+ this.reselect();
846
+ }, this))
847
+ .bind("get_rollback.jstree", $.proxy(function () {
848
+ this.dehover_node();
849
+ this.save_selected();
850
+ }, this))
851
+ .bind("set_rollback.jstree", $.proxy(function () {
852
+ this.reselect();
853
+ }, this))
854
+ .bind("close_node.jstree", $.proxy(function (event, data) {
855
+ var s = this._get_settings().ui,
856
+ obj = this._get_node(data.rslt.obj),
857
+ clk = (obj && obj.length) ? obj.children("ul").find(".jstree-clicked") : $(),
858
+ _this = this;
859
+ if(s.selected_parent_close === false || !clk.length) { return; }
860
+ clk.each(function () {
861
+ _this.deselect_node(this);
862
+ if(s.selected_parent_close === "select_parent") { _this.select_node(obj); }
863
+ });
864
+ }, this))
865
+ .bind("delete_node.jstree", $.proxy(function (event, data) {
866
+ var s = this._get_settings().ui.select_prev_on_delete,
867
+ obj = this._get_node(data.rslt.obj),
868
+ clk = (obj && obj.length) ? obj.find(".jstree-clicked") : [],
869
+ _this = this;
870
+ clk.each(function () { _this.deselect_node(this); });
871
+ if(s && clk.length) { this.select_node(data.rslt.prev); }
872
+ }, this))
873
+ .bind("move_node.jstree", $.proxy(function (event, data) {
874
+ if(data.rslt.cy) {
875
+ data.rslt.oc.find(".jstree-clicked").removeClass("jstree-clicked");
876
+ }
877
+ }, this));
878
+ },
879
+ defaults : {
880
+ select_limit : -1, // 0, 1, 2 ... or -1 for unlimited
881
+ select_multiple_modifier : "ctrl", // on, or ctrl, shift, alt
882
+ selected_parent_close : "select_parent", // false, "deselect", "select_parent"
883
+ select_prev_on_delete : true,
884
+ disable_selecting_children : false,
885
+ initially_select : []
886
+ },
887
+ _fn : {
888
+ _get_node : function (obj, allow_multiple) {
889
+ if(typeof obj === "undefined" || obj === null) { return allow_multiple ? this.data.ui.selected : this.data.ui.last_selected; }
890
+ var $obj = $(obj, this.get_container());
891
+ if($obj.is(".jstree") || obj == -1) { return -1; }
892
+ $obj = $obj.closest("li", this.get_container());
893
+ return $obj.length ? $obj : false;
894
+ },
895
+ save_selected : function () {
896
+ var _this = this;
897
+ this.data.ui.to_select = [];
898
+ this.data.ui.selected.each(function () { _this.data.ui.to_select.push("#" + this.id.toString().replace(/^#/,"").replace('\\/','/').replace('/','\\/')); });
899
+ this.__callback(this.data.ui.to_select);
900
+ },
901
+ reselect : function () {
902
+ var _this = this,
903
+ s = this.data.ui.to_select;
904
+ s = $.map($.makeArray(s), function (n) { return "#" + n.toString().replace(/^#/,"").replace('\\/','/').replace('/','\\/'); });
905
+ this.deselect_all();
906
+ $.each(s, function (i, val) { if(val && val !== "#") { _this.select_node(val); } });
907
+ this.__callback();
908
+ },
909
+ refresh : function (obj) {
910
+ this.save_selected();
911
+ return this.__call_old();
912
+ },
913
+ hover_node : function (obj) {
914
+ obj = this._get_node(obj);
915
+ if(!obj.length) { return false; }
916
+ //if(this.data.ui.hovered && obj.get(0) === this.data.ui.hovered.get(0)) { return; }
917
+ if(!obj.hasClass("jstree-hovered")) { this.dehover_node(); }
918
+ this.data.ui.hovered = obj.children("a").addClass("jstree-hovered").parent();
919
+ this.__callback({ "obj" : obj });
920
+ },
921
+ dehover_node : function () {
922
+ var obj = this.data.ui.hovered, p;
923
+ if(!obj || !obj.length) { return false; }
924
+ p = obj.children("a").removeClass("jstree-hovered").parent();
925
+ if(this.data.ui.hovered[0] === p[0]) { this.data.ui.hovered = null; }
926
+ this.__callback({ "obj" : obj });
927
+ },
928
+ select_node : function (obj, check, e) {
929
+ obj = this._get_node(obj);
930
+ if(obj == -1 || !obj || !obj.length) { return false; }
931
+ var s = this._get_settings().ui,
932
+ is_multiple = (s.select_multiple_modifier == "on" || (s.select_multiple_modifier !== false && e && e[s.select_multiple_modifier + "Key"])),
933
+ is_selected = this.is_selected(obj),
934
+ proceed = true;
935
+ if(check) {
936
+ if(s.disable_selecting_children && is_multiple && obj.parents("li", this.get_container()).children(".jstree-clicked").length) {
937
+ return false;
938
+ }
939
+ proceed = false;
940
+ switch(!0) {
941
+ case (is_selected && !is_multiple):
942
+ this.deselect_all();
943
+ is_selected = false;
944
+ proceed = true;
945
+ break;
946
+ case (!is_selected && !is_multiple):
947
+ if(s.select_limit == -1 || s.select_limit > 0) {
948
+ this.deselect_all();
949
+ proceed = true;
950
+ }
951
+ break;
952
+ case (is_selected && is_multiple):
953
+ this.deselect_node(obj);
954
+ break;
955
+ case (!is_selected && is_multiple):
956
+ if(s.select_limit == -1 || this.data.ui.selected.length + 1 <= s.select_limit) {
957
+ proceed = true;
958
+ }
959
+ break;
960
+ }
961
+ }
962
+ if(proceed && !is_selected) {
963
+ obj.children("a").addClass("jstree-clicked");
964
+ this.data.ui.selected = this.data.ui.selected.add(obj);
965
+ this.data.ui.last_selected = obj;
966
+ this.__callback({ "obj" : obj });
967
+ }
968
+ },
969
+ deselect_node : function (obj) {
970
+ obj = this._get_node(obj);
971
+ if(!obj.length) { return false; }
972
+ if(this.is_selected(obj)) {
973
+ obj.children("a").removeClass("jstree-clicked");
974
+ this.data.ui.selected = this.data.ui.selected.not(obj);
975
+ if(this.data.ui.last_selected.get(0) === obj.get(0)) { this.data.ui.last_selected = this.data.ui.selected.eq(0); }
976
+ this.__callback({ "obj" : obj });
977
+ }
978
+ },
979
+ toggle_select : function (obj) {
980
+ obj = this._get_node(obj);
981
+ if(!obj.length) { return false; }
982
+ if(this.is_selected(obj)) { this.deselect_node(obj); }
983
+ else { this.select_node(obj); }
984
+ },
985
+ is_selected : function (obj) { return this.data.ui.selected.index(this._get_node(obj)) >= 0; },
986
+ get_selected : function (context) {
987
+ return context ? $(context).find(".jstree-clicked").parent() : this.data.ui.selected;
988
+ },
989
+ deselect_all : function (context) {
990
+ if(context) { $(context).find(".jstree-clicked").removeClass("jstree-clicked"); }
991
+ else { this.get_container().find(".jstree-clicked").removeClass("jstree-clicked"); }
992
+ this.data.ui.selected = $([]);
993
+ this.data.ui.last_selected = false;
994
+ this.__callback();
995
+ }
996
+ }
997
+ });
998
+ // include the selection plugin by default
999
+ $.jstree.defaults.plugins.push("ui");
1000
+ })(jQuery);
1001
+ //*/
1002
+
1003
+ /*
1004
+ * jsTree CRRM plugin 1.0
1005
+ * Handles creating/renaming/removing/moving nodes by user interaction.
1006
+ */
1007
+ (function ($) {
1008
+ $.jstree.plugin("crrm", {
1009
+ __init : function () {
1010
+ this.get_container()
1011
+ .bind("move_node.jstree", $.proxy(function (e, data) {
1012
+ if(this._get_settings().crrm.move.open_onmove) {
1013
+ var t = this;
1014
+ data.rslt.np.parentsUntil(".jstree").andSelf().filter(".jstree-closed").each(function () {
1015
+ t.open_node(this, false, true);
1016
+ });
1017
+ }
1018
+ }, this));
1019
+ },
1020
+ defaults : {
1021
+ input_width_limit : 200,
1022
+ move : {
1023
+ always_copy : false, // false, true or "multitree"
1024
+ open_onmove : true,
1025
+ default_position : "last",
1026
+ check_move : function (m) { return true; }
1027
+ }
1028
+ },
1029
+ _fn : {
1030
+ _show_input : function (obj, callback) {
1031
+ obj = this._get_node(obj);
1032
+ var rtl = this._get_settings().core.rtl,
1033
+ w = this._get_settings().crrm.input_width_limit,
1034
+ w1 = obj.children("ins").width(),
1035
+ w2 = obj.find("> a:visible > ins").width() * obj.find("> a:visible > ins").length,
1036
+ t = this.get_text(obj),
1037
+ h1 = $("<div>", { css : { "position" : "absolute", "top" : "-200px", "left" : (rtl ? "0px" : "-1000px"), "visibility" : "hidden" } }).appendTo("body"),
1038
+ h2 = obj.css("position","relative").append(
1039
+ $("<input>", {
1040
+ "value" : t,
1041
+ // "size" : t.length,
1042
+ "css" : {
1043
+ "padding" : "0",
1044
+ "border" : "1px solid silver",
1045
+ "position" : "absolute",
1046
+ "left" : (rtl ? "auto" : (w1 + w2 + 4) + "px"),
1047
+ "right" : (rtl ? (w1 + w2 + 4) + "px" : "auto"),
1048
+ "top" : "0px",
1049
+ "height" : (this.data.core.li_height - 2) + "px",
1050
+ "lineHeight" : (this.data.core.li_height - 2) + "px",
1051
+ "width" : "150px" // will be set a bit further down
1052
+ },
1053
+ "blur" : $.proxy(function () {
1054
+ var i = obj.children("input"),
1055
+ v = i.val();
1056
+ if(v === "") { v = t; }
1057
+ i.remove(); // rollback purposes
1058
+ this.set_text(obj,t); // rollback purposes
1059
+ this.rename_node(obj, v);
1060
+ callback.call(this, obj, v, t);
1061
+ obj.css("position","");
1062
+ }, this),
1063
+ "keyup" : function (event) {
1064
+ var key = event.keyCode || event.which;
1065
+ if(key == 27) { this.value = t; this.blur(); return; }
1066
+ else if(key == 13) { this.blur(); return; }
1067
+ else {
1068
+ h2.width(Math.min(h1.text("pW" + this.value).width(),w));
1069
+ }
1070
+ }
1071
+ })
1072
+ ).children("input");
1073
+ this.set_text(obj, "");
1074
+ h1.css({
1075
+ fontFamily : h2.css('fontFamily') || '',
1076
+ fontSize : h2.css('fontSize') || '',
1077
+ fontWeight : h2.css('fontWeight') || '',
1078
+ fontStyle : h2.css('fontStyle') || '',
1079
+ fontStretch : h2.css('fontStretch') || '',
1080
+ fontVariant : h2.css('fontVariant') || '',
1081
+ letterSpacing : h2.css('letterSpacing') || '',
1082
+ wordSpacing : h2.css('wordSpacing') || ''
1083
+ });
1084
+ h2.width(Math.min(h1.text("pW" + h2[0].value).width(),w))[0].select();
1085
+ },
1086
+ rename : function (obj) {
1087
+ obj = this._get_node(obj);
1088
+ this.__rollback();
1089
+ var f = this.__callback;
1090
+ this._show_input(obj, function (obj, new_name, old_name) {
1091
+ f.call(this, { "obj" : obj, "new_name" : new_name, "old_name" : old_name });
1092
+ });
1093
+ },
1094
+ create : function (obj, position, js, callback, skip_rename) {
1095
+ var t, _this = this;
1096
+ obj = this._get_node(obj);
1097
+ if(!obj) { obj = -1; }
1098
+ this.__rollback();
1099
+ t = this.create_node(obj, position, js, function (t) {
1100
+ var p = this._get_parent(t),
1101
+ pos = $(t).index();
1102
+ if(callback) { callback.call(this, t); }
1103
+ if(p.length && p.hasClass("jstree-closed")) { this.open_node(p, false, true); }
1104
+ if(!skip_rename) {
1105
+ this._show_input(t, function (obj, new_name, old_name) {
1106
+ _this.__callback({ "obj" : obj, "name" : new_name, "parent" : p, "position" : pos });
1107
+ });
1108
+ }
1109
+ else { _this.__callback({ "obj" : t, "name" : this.get_text(t), "parent" : p, "position" : pos }); }
1110
+ });
1111
+ return t;
1112
+ },
1113
+ remove : function (obj) {
1114
+ obj = this._get_node(obj, true);
1115
+ this.__rollback();
1116
+ this.delete_node(obj);
1117
+ this.__callback({ "obj" : obj });
1118
+ },
1119
+ check_move : function () {
1120
+ if(!this.__call_old()) { return false; }
1121
+ var s = this._get_settings().crrm.move;
1122
+ if(!s.check_move.call(this, this._get_move())) { return false; }
1123
+ return true;
1124
+ },
1125
+ move_node : function (obj, ref, position, is_copy, is_prepared, skip_check) {
1126
+ var s = this._get_settings().crrm.move;
1127
+ if(!is_prepared) {
1128
+ if(!position) { position = s.default_position; }
1129
+ if(position === "inside" && !s.default_position.match(/^(before|after)$/)) { position = s.default_position; }
1130
+ return this.__call_old(true, obj, ref, position, is_copy, false, skip_check);
1131
+ }
1132
+ // if the move is already prepared
1133
+ if(s.always_copy === true || (s.always_copy === "multitree" && obj.rt.get_index() !== obj.ot.get_index() )) {
1134
+ is_copy = true;
1135
+ }
1136
+ this.__call_old(true, obj, ref, position, is_copy, true, skip_check);
1137
+ },
1138
+
1139
+ cut : function (obj) {
1140
+ obj = this._get_node(obj);
1141
+ this.data.crrm.cp_nodes = false;
1142
+ this.data.crrm.ct_nodes = false;
1143
+ if(!obj || !obj.length) { return false; }
1144
+ this.data.crrm.ct_nodes = obj;
1145
+ },
1146
+ copy : function (obj) {
1147
+ obj = this._get_node(obj);
1148
+ this.data.crrm.cp_nodes = false;
1149
+ this.data.crrm.ct_nodes = false;
1150
+ if(!obj || !obj.length) { return false; }
1151
+ this.data.crrm.cp_nodes = obj;
1152
+ },
1153
+ paste : function (obj) {
1154
+ obj = this._get_node(obj);
1155
+ if(!obj || !obj.length) { return false; }
1156
+ if(!this.data.crrm.ct_nodes && !this.data.crrm.cp_nodes) { return false; }
1157
+ if(this.data.crrm.ct_nodes) { this.move_node(this.data.crrm.ct_nodes, obj); }
1158
+ if(this.data.crrm.cp_nodes) { this.move_node(this.data.crrm.cp_nodes, obj, false, true); }
1159
+ this.data.crrm.cp_nodes = false;
1160
+ this.data.crrm.ct_nodes = false;
1161
+ }
1162
+ }
1163
+ });
1164
+ // include the crr plugin by default
1165
+ $.jstree.defaults.plugins.push("crrm");
1166
+ })(jQuery);
1167
+
1168
+ /*
1169
+ * jsTree themes plugin 1.0
1170
+ * Handles loading and setting themes, as well as detecting path to themes, etc.
1171
+ */
1172
+ (function ($) {
1173
+ var themes_loaded = [];
1174
+ // this variable stores the path to the themes folder - if left as false - it will be autodetected
1175
+ $.jstree._themes = false;
1176
+ $.jstree.plugin("themes", {
1177
+ __init : function () {
1178
+ this.get_container()
1179
+ .bind("init.jstree", $.proxy(function () {
1180
+ var s = this._get_settings().themes;
1181
+ this.data.themes.dots = s.dots;
1182
+ this.data.themes.icons = s.icons;
1183
+ //alert(s.dots);
1184
+ this.set_theme(s.theme, s.url);
1185
+ }, this))
1186
+ .bind("loaded.jstree", $.proxy(function () {
1187
+ // bound here too, as simple HTML tree's won't honor dots & icons otherwise
1188
+ if(!this.data.themes.dots) { this.hide_dots(); }
1189
+ else { this.show_dots(); }
1190
+ if(!this.data.themes.icons) { this.hide_icons(); }
1191
+ else { this.show_icons(); }
1192
+ }, this));
1193
+ },
1194
+ defaults : {
1195
+ theme : "default",
1196
+ url : false,
1197
+ dots : true,
1198
+ icons : true
1199
+ },
1200
+ _fn : {
1201
+ set_theme : function (theme_name, theme_url) {
1202
+ if(!theme_name) { return false; }
1203
+ if(!theme_url) { theme_url = $.jstree._themes + theme_name + '/style.css'; }
1204
+ if($.inArray(theme_url, themes_loaded) == -1) {
1205
+ $.vakata.css.add_sheet({ "url" : theme_url, "rel" : "jstree" });
1206
+ themes_loaded.push(theme_url);
1207
+ }
1208
+ if(this.data.themes.theme != theme_name) {
1209
+ this.get_container().removeClass('jstree-' + this.data.themes.theme);
1210
+ this.data.themes.theme = theme_name;
1211
+ }
1212
+ this.get_container().addClass('jstree-' + theme_name);
1213
+ if(!this.data.themes.dots) { this.hide_dots(); }
1214
+ else { this.show_dots(); }
1215
+ if(!this.data.themes.icons) { this.hide_icons(); }
1216
+ else { this.show_icons(); }
1217
+ this.__callback();
1218
+ },
1219
+ get_theme : function () { return this.data.themes.theme; },
1220
+
1221
+ show_dots : function () { this.data.themes.dots = true; this.get_container().children("ul").removeClass("jstree-no-dots"); },
1222
+ hide_dots : function () { this.data.themes.dots = false; this.get_container().children("ul").addClass("jstree-no-dots"); },
1223
+ toggle_dots : function () { if(this.data.themes.dots) { this.hide_dots(); } else { this.show_dots(); } },
1224
+
1225
+ show_icons : function () { this.data.themes.icons = true; this.get_container().children("ul").removeClass("jstree-no-icons"); },
1226
+ hide_icons : function () { this.data.themes.icons = false; this.get_container().children("ul").addClass("jstree-no-icons"); },
1227
+ toggle_icons: function () { if(this.data.themes.icons) { this.hide_icons(); } else { this.show_icons(); } }
1228
+ }
1229
+ });
1230
+ // autodetect themes path
1231
+ $(function () {
1232
+ if($.jstree._themes === false) {
1233
+ $("script").each(function () {
1234
+ if(this.src.toString().match(/jquery\.jstree[^\/]*?\.js(\?.*)?$/)) {
1235
+ $.jstree._themes = this.src.toString().replace(/jquery\.jstree[^\/]*?\.js(\?.*)?$/, "") + 'themes/';
1236
+ return false;
1237
+ }
1238
+ });
1239
+ }
1240
+ if($.jstree._themes === false) { $.jstree._themes = "themes/"; }
1241
+ });
1242
+ // include the themes plugin by default
1243
+ $.jstree.defaults.plugins.push("themes");
1244
+ })(jQuery);
1245
+ //*/
1246
+
1247
+ /*
1248
+ * jsTree hotkeys plugin 1.0
1249
+ * Enables keyboard navigation for all tree instances
1250
+ * Depends on the jstree ui & jquery hotkeys plugins
1251
+ */
1252
+ (function ($) {
1253
+ var bound = [];
1254
+ function exec(i, event) {
1255
+ var f = $.jstree._focused(), tmp;
1256
+ if(f && f.data && f.data.hotkeys && f.data.hotkeys.enabled) {
1257
+ tmp = f._get_settings().hotkeys[i];
1258
+ if(tmp) { return tmp.call(f, event); }
1259
+ }
1260
+ }
1261
+ $.jstree.plugin("hotkeys", {
1262
+ __init : function () {
1263
+ if(typeof $.hotkeys === "undefined") { throw "jsTree hotkeys: jQuery hotkeys plugin not included."; }
1264
+ if(!this.data.ui) { throw "jsTree hotkeys: jsTree UI plugin not included."; }
1265
+ $.each(this._get_settings().hotkeys, function (i, val) {
1266
+ if($.inArray(i, bound) == -1) {
1267
+ $(document).bind("keydown", i, function (event) { return exec(i, event); });
1268
+ bound.push(i);
1269
+ }
1270
+ });
1271
+ this.enable_hotkeys();
1272
+ },
1273
+ defaults : {
1274
+ "up" : function () {
1275
+ var o = this.data.ui.hovered || this.data.ui.last_selected || -1;
1276
+ this.hover_node(this._get_prev(o));
1277
+ return false;
1278
+ },
1279
+ "down" : function () {
1280
+ var o = this.data.ui.hovered || this.data.ui.last_selected || -1;
1281
+ this.hover_node(this._get_next(o));
1282
+ return false;
1283
+ },
1284
+ "left" : function () {
1285
+ var o = this.data.ui.hovered || this.data.ui.last_selected;
1286
+ if(o) {
1287
+ if(o.hasClass("jstree-open")) { this.close_node(o); }
1288
+ else { this.hover_node(this._get_prev(o)); }
1289
+ }
1290
+ return false;
1291
+ },
1292
+ "right" : function () {
1293
+ var o = this.data.ui.hovered || this.data.ui.last_selected;
1294
+ if(o && o.length) {
1295
+ if(o.hasClass("jstree-closed")) { this.open_node(o); }
1296
+ else { this.hover_node(this._get_next(o)); }
1297
+ }
1298
+ return false;
1299
+ },
1300
+ "space" : function () {
1301
+ if(this.data.ui.hovered) { this.data.ui.hovered.children("a:eq(0)").click(); }
1302
+ return false;
1303
+ },
1304
+ "ctrl+space" : function (event) {
1305
+ event.type = "click";
1306
+ if(this.data.ui.hovered) { this.data.ui.hovered.children("a:eq(0)").trigger(event); }
1307
+ return false;
1308
+ },
1309
+ "f2" : function () { this.rename(this.data.ui.hovered || this.data.ui.last_selected); },
1310
+ "del" : function () { this.remove(this.data.ui.hovered || this._get_node(null)); }
1311
+ },
1312
+ _fn : {
1313
+ enable_hotkeys : function () {
1314
+ this.data.hotkeys.enabled = true;
1315
+ },
1316
+ disable_hotkeys : function () {
1317
+ this.data.hotkeys.enabled = false;
1318
+ }
1319
+ }
1320
+ });
1321
+ })(jQuery);
1322
+ //*/
1323
+
1324
+ /*
1325
+ * jsTree JSON 1.0
1326
+ * The JSON data store. Datastores are build by overriding the `load_node` and `_is_loaded` functions.
1327
+ */
1328
+ (function ($) {
1329
+ $.jstree.plugin("json_data", {
1330
+ defaults : {
1331
+ data : false,
1332
+ ajax : false,
1333
+ correct_state : true,
1334
+ progressive_render : false
1335
+ },
1336
+ _fn : {
1337
+ load_node : function (obj, s_call, e_call) { var _this = this; this.load_node_json(obj, function () { _this.__callback({ "obj" : obj }); s_call.call(this); }, e_call); },
1338
+ _is_loaded : function (obj) {
1339
+ var s = this._get_settings().json_data, d;
1340
+ obj = this._get_node(obj);
1341
+ if(obj && obj !== -1 && s.progressive_render && !obj.is(".jstree-open, .jstree-leaf") && obj.children("ul").children("li").length === 0 && obj.data("jstree-children")) {
1342
+ d = this._parse_json(obj.data("jstree-children"));
1343
+ if(d) {
1344
+ obj.append(d);
1345
+ $.removeData(obj, "jstree-children");
1346
+ }
1347
+ this.clean_node(obj);
1348
+ return true;
1349
+ }
1350
+ return obj == -1 || !obj || !s.ajax || obj.is(".jstree-open, .jstree-leaf") || obj.children("ul").children("li").size() > 0;
1351
+ },
1352
+ load_node_json : function (obj, s_call, e_call) {
1353
+ var s = this.get_settings().json_data, d,
1354
+ error_func = function () {},
1355
+ success_func = function () {};
1356
+ obj = this._get_node(obj);
1357
+ if(obj && obj !== -1) {
1358
+ if(obj.data("jstree-is-loading")) { return; }
1359
+ else { obj.data("jstree-is-loading",true); }
1360
+ }
1361
+ switch(!0) {
1362
+ case (!s.data && !s.ajax): throw "Neither data nor ajax settings supplied.";
1363
+ case (!!s.data && !s.ajax) || (!!s.data && !!s.ajax && (!obj || obj === -1)):
1364
+ if(!obj || obj == -1) {
1365
+ d = this._parse_json(s.data);
1366
+ if(d) {
1367
+ this.get_container().children("ul").empty().append(d.children());
1368
+ this.clean_node();
1369
+ }
1370
+ else {
1371
+ if(s.correct_state) { this.get_container().children("ul").empty(); }
1372
+ }
1373
+ }
1374
+ if(s_call) { s_call.call(this); }
1375
+ break;
1376
+ case (!s.data && !!s.ajax) || (!!s.data && !!s.ajax && obj && obj !== -1):
1377
+ error_func = function (x, t, e) {
1378
+ var ef = this.get_settings().json_data.ajax.error;
1379
+ if(ef) { ef.call(this, x, t, e); }
1380
+ if(obj != -1 && obj.length) {
1381
+ obj.children(".jstree-loading").removeClass("jstree-loading");
1382
+ obj.data("jstree-is-loading",false);
1383
+ if(t === "success" && s.correct_state) { obj.removeClass("jstree-open jstree-closed").addClass("jstree-leaf"); }
1384
+ }
1385
+ else {
1386
+ if(t === "success" && s.correct_state) { this.get_container().children("ul").empty(); }
1387
+ }
1388
+ if(e_call) { e_call.call(this); }
1389
+ };
1390
+ success_func = function (d, t, x) {
1391
+ var sf = this.get_settings().json_data.ajax.success;
1392
+ if(sf) { d = sf.call(this,d,t,x) || d; }
1393
+ if(d === "" || (!$.isArray(d) && !$.isPlainObject(d))) {
1394
+ return error_func.call(this, x, t, "");
1395
+ }
1396
+ d = this._parse_json(d);
1397
+ if(d) {
1398
+ if(obj === -1 || !obj) { this.get_container().children("ul").empty().append(d.children()); }
1399
+ else { obj.append(d).children(".jstree-loading").removeClass("jstree-loading"); obj.data("jstree-is-loading",false); }
1400
+ this.clean_node(obj);
1401
+ if(s_call) { s_call.call(this); }
1402
+ }
1403
+ else {
1404
+ if(obj === -1 || !obj) {
1405
+ if(s.correct_state) {
1406
+ this.get_container().children("ul").empty();
1407
+ if(s_call) { s_call.call(this); }
1408
+ }
1409
+ }
1410
+ else {
1411
+ obj.children(".jstree-loading").removeClass("jstree-loading");
1412
+ obj.data("jstree-is-loading",false);
1413
+ if(s.correct_state) {
1414
+ obj.removeClass("jstree-open jstree-closed").addClass("jstree-leaf");
1415
+ if(s_call) { s_call.call(this); }
1416
+ }
1417
+ }
1418
+ }
1419
+ };
1420
+ s.ajax.context = this;
1421
+ s.ajax.error = error_func;
1422
+ s.ajax.success = success_func;
1423
+ if(!s.ajax.dataType) { s.ajax.dataType = "json"; }
1424
+ if($.isFunction(s.ajax.url)) { s.ajax.url = s.ajax.url.call(this, obj); }
1425
+ if($.isFunction(s.ajax.data)) { s.ajax.data = s.ajax.data.call(this, obj); }
1426
+ $.ajax(s.ajax);
1427
+ break;
1428
+ }
1429
+ },
1430
+ _parse_json : function (js, is_callback) {
1431
+ var d = false,
1432
+ p = this._get_settings(),
1433
+ s = p.json_data,
1434
+ t = p.core.html_titles,
1435
+ tmp, i, j, ul1, ul2;
1436
+
1437
+ if(!js) { return d; }
1438
+ if($.isFunction(js)) {
1439
+ js = js.call(this);
1440
+ }
1441
+ if($.isArray(js)) {
1442
+ d = $();
1443
+ if(!js.length) { return false; }
1444
+ for(i = 0, j = js.length; i < j; i++) {
1445
+ tmp = this._parse_json(js[i], true);
1446
+ if(tmp.length) { d = d.add(tmp); }
1447
+ }
1448
+ }
1449
+ else {
1450
+ if(typeof js == "string") { js = { data : js }; }
1451
+ if(!js.data && js.data !== "") { return d; }
1452
+ d = $("<li>");
1453
+ if(js.attr) { d.attr(js.attr); }
1454
+ if(js.metadata) { d.data("jstree", js.metadata); }
1455
+ if(js.state) { d.addClass("jstree-" + js.state); }
1456
+ if(!$.isArray(js.data)) { tmp = js.data; js.data = []; js.data.push(tmp); }
1457
+ $.each(js.data, function (i, m) {
1458
+ tmp = $("<a>");
1459
+ if($.isFunction(m)) { m = m.call(this, js); }
1460
+ if(typeof m == "string") { tmp.attr('href','#')[ t ? "html" : "text" ](m); }
1461
+ else {
1462
+ if(!m.attr) { m.attr = {}; }
1463
+ if(!m.attr.href) { m.attr.href = '#'; }
1464
+ tmp.attr(m.attr)[ t ? "html" : "text" ](m.title);
1465
+ if(m.language) { tmp.addClass(m.language); }
1466
+ }
1467
+ tmp.prepend("<ins class='jstree-icon'>&#160;</ins>");
1468
+ if(!m.icon && js.icon) { m.icon = js.icon; }
1469
+ if(m.icon) {
1470
+ if(m.icon.indexOf("/") === -1) { tmp.children("ins").addClass(m.icon); }
1471
+ else { tmp.children("ins").css("background","url('" + m.icon + "') center center no-repeat"); }
1472
+ }
1473
+ d.append(tmp);
1474
+ });
1475
+ d.prepend("<ins class='jstree-icon'>&#160;</ins>");
1476
+ if(js.children) {
1477
+ if(s.progressive_render && js.state !== "open") {
1478
+ d.addClass("jstree-closed").data("jstree-children", js.children);
1479
+ }
1480
+ else {
1481
+ if($.isFunction(js.children)) {
1482
+ js.children = js.children.call(this, js);
1483
+ }
1484
+ if($.isArray(js.children) && js.children.length) {
1485
+ tmp = this._parse_json(js.children, true);
1486
+ if(tmp.length) {
1487
+ ul2 = $("<ul>");
1488
+ ul2.append(tmp);
1489
+ d.append(ul2);
1490
+ }
1491
+ }
1492
+ }
1493
+ }
1494
+ }
1495
+ if(!is_callback) {
1496
+ ul1 = $("<ul>");
1497
+ ul1.append(d);
1498
+ d = ul1;
1499
+ }
1500
+ return d;
1501
+ },
1502
+ get_json : function (obj, li_attr, a_attr, is_callback) {
1503
+ var result = [],
1504
+ s = this._get_settings(),
1505
+ _this = this,
1506
+ tmp1, tmp2, li, a, t, lang;
1507
+ obj = this._get_node(obj);
1508
+ if(!obj || obj === -1) { obj = this.get_container().find("> ul > li"); }
1509
+ li_attr = $.isArray(li_attr) ? li_attr : [ "id", "class" ];
1510
+ if(!is_callback && this.data.types) { li_attr.push(s.types.type_attr); }
1511
+ a_attr = $.isArray(a_attr) ? a_attr : [ ];
1512
+
1513
+ obj.each(function () {
1514
+ li = $(this);
1515
+ tmp1 = { data : [] };
1516
+ if(li_attr.length) { tmp1.attr = { }; }
1517
+ $.each(li_attr, function (i, v) {
1518
+ tmp2 = li.attr(v);
1519
+ if(tmp2 && tmp2.length && tmp2.replace(/jstree[^ ]*|$/ig,'').length) {
1520
+ tmp1.attr[v] = tmp2.replace(/jstree[^ ]*|$/ig,'');
1521
+ }
1522
+ });
1523
+ if(li.hasClass("jstree-open")) { tmp1.state = "open"; }
1524
+ if(li.hasClass("jstree-closed")) { tmp1.state = "closed"; }
1525
+ a = li.children("a");
1526
+ a.each(function () {
1527
+ t = $(this);
1528
+ if(
1529
+ a_attr.length ||
1530
+ $.inArray("languages", s.plugins) !== -1 ||
1531
+ t.children("ins").get(0).style.backgroundImage.length ||
1532
+ (t.children("ins").get(0).className && t.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,'').length)
1533
+ ) {
1534
+ lang = false;
1535
+ if($.inArray("languages", s.plugins) !== -1 && $.isArray(s.languages) && s.languages.length) {
1536
+ $.each(s.languages, function (l, lv) {
1537
+ if(t.hasClass(lv)) {
1538
+ lang = lv;
1539
+ return false;
1540
+ }
1541
+ });
1542
+ }
1543
+ tmp2 = { attr : { }, title : _this.get_text(t, lang) };
1544
+ $.each(a_attr, function (k, z) {
1545
+ tmp1.attr[z] = (t.attr(z) || "").replace(/jstree[^ ]*|$/ig,'');
1546
+ });
1547
+ $.each(s.languages, function (k, z) {
1548
+ if(t.hasClass(z)) { tmp2.language = z; return true; }
1549
+ });
1550
+ if(t.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,'').replace(/^\s+$/ig,"").length) {
1551
+ tmp2.icon = t.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,'').replace(/^\s+$/ig,"");
1552
+ }
1553
+ if(t.children("ins").get(0).style.backgroundImage.length) {
1554
+ tmp2.icon = t.children("ins").get(0).style.backgroundImage.replace("url(","").replace(")","");
1555
+ }
1556
+ }
1557
+ else {
1558
+ tmp2 = _this.get_text(t);
1559
+ }
1560
+ if(a.length > 1) { tmp1.data.push(tmp2); }
1561
+ else { tmp1.data = tmp2; }
1562
+ });
1563
+ li = li.find("> ul > li");
1564
+ if(li.length) { tmp1.children = _this.get_json(li, li_attr, a_attr, true); }
1565
+ result.push(tmp1);
1566
+ });
1567
+ return result;
1568
+ }
1569
+ }
1570
+ });
1571
+ })(jQuery);
1572
+ //*/
1573
+
1574
+ /*
1575
+ * jsTree languages plugin 1.0
1576
+ * Adds support for multiple language versions in one tree
1577
+ * This basically allows for many titles coexisting in one node, but only one of them being visible at any given time
1578
+ * This is useful for maintaining the same structure in many languages (hence the name of the plugin)
1579
+ */
1580
+ (function ($) {
1581
+ $.jstree.plugin("languages", {
1582
+ __init : function () { this._load_css(); },
1583
+ defaults : [],
1584
+ _fn : {
1585
+ set_lang : function (i) {
1586
+ var langs = this._get_settings().languages,
1587
+ st = false,
1588
+ selector = ".jstree-" + this.get_index() + ' a';
1589
+ if(!$.isArray(langs) || langs.length === 0) { return false; }
1590
+ if($.inArray(i,langs) == -1) {
1591
+ if(!!langs[i]) { i = langs[i]; }
1592
+ else { return false; }
1593
+ }
1594
+ if(i == this.data.languages.current_language) { return true; }
1595
+ st = $.vakata.css.get_css(selector + "." + this.data.languages.current_language, false, this.data.languages.language_css);
1596
+ if(st !== false) { st.style.display = "none"; }
1597
+ st = $.vakata.css.get_css(selector + "." + i, false, this.data.languages.language_css);
1598
+ if(st !== false) { st.style.display = ""; }
1599
+ this.data.languages.current_language = i;
1600
+ this.__callback(i);
1601
+ return true;
1602
+ },
1603
+ get_lang : function () {
1604
+ return this.data.languages.current_language;
1605
+ },
1606
+ get_text : function (obj, lang) {
1607
+ obj = this._get_node(obj) || this.data.ui.last_selected;
1608
+ if(!obj.size()) { return false; }
1609
+ var langs = this._get_settings().languages,
1610
+ s = this._get_settings().core.html_titles;
1611
+ if($.isArray(langs) && langs.length) {
1612
+ lang = (lang && $.inArray(lang,langs) != -1) ? lang : this.data.languages.current_language;
1613
+ obj = obj.children("a." + lang);
1614
+ }
1615
+ else { obj = obj.children("a:eq(0)"); }
1616
+ if(s) {
1617
+ obj = obj.clone();
1618
+ obj.children("INS").remove();
1619
+ return obj.html();
1620
+ }
1621
+ else {
1622
+ obj = obj.contents().filter(function() { return this.nodeType == 3; })[0];
1623
+ return obj.nodeValue;
1624
+ }
1625
+ },
1626
+ set_text : function (obj, val, lang) {
1627
+ obj = this._get_node(obj) || this.data.ui.last_selected;
1628
+ if(!obj.size()) { return false; }
1629
+ var langs = this._get_settings().languages,
1630
+ s = this._get_settings().core.html_titles,
1631
+ tmp;
1632
+ if($.isArray(langs) && langs.length) {
1633
+ lang = (lang && $.inArray(lang,langs) != -1) ? lang : this.data.languages.current_language;
1634
+ obj = obj.children("a." + lang);
1635
+ }
1636
+ else { obj = obj.children("a:eq(0)"); }
1637
+ if(s) {
1638
+ tmp = obj.children("INS").clone();
1639
+ obj.html(val).prepend(tmp);
1640
+ this.__callback({ "obj" : obj, "name" : val, "lang" : lang });
1641
+ return true;
1642
+ }
1643
+ else {
1644
+ obj = obj.contents().filter(function() { return this.nodeType == 3; })[0];
1645
+ this.__callback({ "obj" : obj, "name" : val, "lang" : lang });
1646
+ return (obj.nodeValue = val);
1647
+ }
1648
+ },
1649
+ _load_css : function () {
1650
+ var langs = this._get_settings().languages,
1651
+ str = "/* languages css */",
1652
+ selector = ".jstree-" + this.get_index() + ' a',
1653
+ ln;
1654
+ if($.isArray(langs) && langs.length) {
1655
+ this.data.languages.current_language = langs[0];
1656
+ for(ln = 0; ln < langs.length; ln++) {
1657
+ str += selector + "." + langs[ln] + " {";
1658
+ if(langs[ln] != this.data.languages.current_language) { str += " display:none; "; }
1659
+ str += " } ";
1660
+ }
1661
+ this.data.languages.language_css = $.vakata.css.add_sheet({ 'str' : str });
1662
+ }
1663
+ },
1664
+ create_node : function (obj, position, js, callback) {
1665
+ var t = this.__call_old(true, obj, position, js, function (t) {
1666
+ var langs = this._get_settings().languages,
1667
+ a = t.children("a"),
1668
+ ln;
1669
+ if($.isArray(langs) && langs.length) {
1670
+ for(ln = 0; ln < langs.length; ln++) {
1671
+ if(!a.is("." + langs[ln])) {
1672
+ t.append(a.eq(0).clone().removeClass(langs.join(" ")).addClass(langs[ln]));
1673
+ }
1674
+ }
1675
+ a.not("." + langs.join(", .")).remove();
1676
+ }
1677
+ if(callback) { callback.call(this, t); }
1678
+ });
1679
+ return t;
1680
+ }
1681
+ }
1682
+ });
1683
+ })(jQuery);
1684
+ //*/
1685
+
1686
+ /*
1687
+ * jsTree cookies plugin 1.0
1688
+ * Stores the currently opened/selected nodes in a cookie and then restores them
1689
+ * Depends on the jquery.cookie plugin
1690
+ */
1691
+ (function ($) {
1692
+ $.jstree.plugin("cookies", {
1693
+ __init : function () {
1694
+ if(typeof $.cookie === "undefined") { throw "jsTree cookie: jQuery cookie plugin not included."; }
1695
+
1696
+ var s = this._get_settings().cookies,
1697
+ tmp;
1698
+ if(!!s.save_opened) {
1699
+ tmp = $.cookie(s.save_opened);
1700
+ if(tmp && tmp.length) { this.data.core.to_open = tmp.split(","); }
1701
+ }
1702
+ if(!!s.save_selected) {
1703
+ tmp = $.cookie(s.save_selected);
1704
+ if(tmp && tmp.length && this.data.ui) { this.data.ui.to_select = tmp.split(","); }
1705
+ }
1706
+ this.get_container()
1707
+ .one( ( this.data.ui ? "reselect" : "reopen" ) + ".jstree", $.proxy(function () {
1708
+ this.get_container()
1709
+ .bind("open_node.jstree close_node.jstree select_node.jstree deselect_node.jstree", $.proxy(function (e) {
1710
+ if(this._get_settings().cookies.auto_save) { this.save_cookie((e.handleObj.namespace + e.handleObj.type).replace("jstree","")); }
1711
+ }, this));
1712
+ }, this));
1713
+ },
1714
+ defaults : {
1715
+ save_opened : "jstree_open",
1716
+ save_selected : "jstree_select",
1717
+ auto_save : true,
1718
+ cookie_options : {}
1719
+ },
1720
+ _fn : {
1721
+ save_cookie : function (c) {
1722
+ if(this.data.core.refreshing) { return; }
1723
+ var s = this._get_settings().cookies;
1724
+ if(!c) { // if called manually and not by event
1725
+ if(s.save_opened) {
1726
+ this.save_opened();
1727
+ $.cookie(s.save_opened, this.data.core.to_open.join(","), s.cookie_options);
1728
+ }
1729
+ if(s.save_selected && this.data.ui) {
1730
+ this.save_selected();
1731
+ $.cookie(s.save_selected, this.data.ui.to_select.join(","), s.cookie_options);
1732
+ }
1733
+ return;
1734
+ }
1735
+ switch(c) {
1736
+ case "open_node":
1737
+ case "close_node":
1738
+ if(!!s.save_opened) {
1739
+ this.save_opened();
1740
+ $.cookie(s.save_opened, this.data.core.to_open.join(","), s.cookie_options);
1741
+ }
1742
+ break;
1743
+ case "select_node":
1744
+ case "deselect_node":
1745
+ if(!!s.save_selected && this.data.ui) {
1746
+ this.save_selected();
1747
+ $.cookie(s.save_selected, this.data.ui.to_select.join(","), s.cookie_options);
1748
+ }
1749
+ break;
1750
+ }
1751
+ }
1752
+ }
1753
+ });
1754
+ // include cookies by default
1755
+ $.jstree.defaults.plugins.push("cookies");
1756
+ })(jQuery);
1757
+ //*/
1758
+
1759
+ /*
1760
+ * jsTree sort plugin 1.0
1761
+ * Sorts items alphabetically (or using any other function)
1762
+ */
1763
+ (function ($) {
1764
+ $.jstree.plugin("sort", {
1765
+ __init : function () {
1766
+ this.get_container()
1767
+ .bind("load_node.jstree", $.proxy(function (e, data) {
1768
+ var obj = this._get_node(data.rslt.obj);
1769
+ obj = obj === -1 ? this.get_container().children("ul") : obj.children("ul");
1770
+ this.sort(obj);
1771
+ }, this))
1772
+ .bind("rename_node.jstree", $.proxy(function (e, data) {
1773
+ this.sort(data.rslt.obj.parent());
1774
+ }, this))
1775
+ .bind("move_node.jstree", $.proxy(function (e, data) {
1776
+ var m = data.rslt.np == -1 ? this.get_container() : data.rslt.np;
1777
+ this.sort(m.children("ul"));
1778
+ }, this));
1779
+ },
1780
+ defaults : function (a, b) { return this.get_text(a) > this.get_text(b) ? 1 : -1; },
1781
+ _fn : {
1782
+ sort : function (obj) {
1783
+ var s = this._get_settings().sort,
1784
+ t = this;
1785
+ obj.append($.makeArray(obj.children("li")).sort($.proxy(s, t)));
1786
+ obj.find("> li > ul").each(function() { t.sort($(this)); });
1787
+ this.clean_node(obj);
1788
+ }
1789
+ }
1790
+ });
1791
+ })(jQuery);
1792
+ //*/
1793
+
1794
+ /*
1795
+ * jsTree DND plugin 1.0
1796
+ * Drag and drop plugin for moving/copying nodes
1797
+ */
1798
+ (function ($) {
1799
+ var o = false,
1800
+ r = false,
1801
+ m = false,
1802
+ sli = false,
1803
+ sti = false,
1804
+ dir1 = false,
1805
+ dir2 = false;
1806
+ $.vakata.dnd = {
1807
+ is_down : false,
1808
+ is_drag : false,
1809
+ helper : false,
1810
+ scroll_spd : 10,
1811
+ init_x : 0,
1812
+ init_y : 0,
1813
+ threshold : 5,
1814
+ user_data : {},
1815
+
1816
+ drag_start : function (e, data, html) {
1817
+ if($.vakata.dnd.is_drag) { $.vakata.drag_stop({}); }
1818
+ try {
1819
+ e.currentTarget.unselectable = "on";
1820
+ e.currentTarget.onselectstart = function() { return false; };
1821
+ if(e.currentTarget.style) { e.currentTarget.style.MozUserSelect = "none"; }
1822
+ } catch(err) { }
1823
+ $.vakata.dnd.init_x = e.pageX;
1824
+ $.vakata.dnd.init_y = e.pageY;
1825
+ $.vakata.dnd.user_data = data;
1826
+ $.vakata.dnd.is_down = true;
1827
+ $.vakata.dnd.helper = $("<div id='vakata-dragged'>").html(html).css("opacity", "0.75");
1828
+ $(document).bind("mousemove", $.vakata.dnd.drag);
1829
+ $(document).bind("mouseup", $.vakata.dnd.drag_stop);
1830
+ return false;
1831
+ },
1832
+ drag : function (e) {
1833
+ if(!$.vakata.dnd.is_down) { return; }
1834
+ if(!$.vakata.dnd.is_drag) {
1835
+ if(Math.abs(e.pageX - $.vakata.dnd.init_x) > 5 || Math.abs(e.pageY - $.vakata.dnd.init_y) > 5) {
1836
+ $.vakata.dnd.helper.appendTo("body");
1837
+ $.vakata.dnd.is_drag = true;
1838
+ $(document).triggerHandler("drag_start.vakata", { "event" : e, "data" : $.vakata.dnd.user_data });
1839
+ }
1840
+ else { return; }
1841
+ }
1842
+
1843
+ // maybe use a scrolling parent element instead of document?
1844
+ if(e.type === "mousemove") { // thought of adding scroll in order to move the helper, but mouse poisition is n/a
1845
+ var d = $(document), t = d.scrollTop(), l = d.scrollLeft();
1846
+ if(e.pageY - t < 20) {
1847
+ if(sti && dir1 === "down") { clearInterval(sti); sti = false; }
1848
+ if(!sti) { dir1 = "up"; sti = setInterval(function () { $(document).scrollTop($(document).scrollTop() - $.vakata.dnd.scroll_spd); }, 150); }
1849
+ }
1850
+ else {
1851
+ if(sti && dir1 === "up") { clearInterval(sti); sti = false; }
1852
+ }
1853
+ if($(window).height() - (e.pageY - t) < 20) {
1854
+ if(sti && dir1 === "up") { clearInterval(sti); sti = false; }
1855
+ if(!sti) { dir1 = "down"; sti = setInterval(function () { $(document).scrollTop($(document).scrollTop() + $.vakata.dnd.scroll_spd); }, 150); }
1856
+ }
1857
+ else {
1858
+ if(sti && dir1 === "down") { clearInterval(sti); sti = false; }
1859
+ }
1860
+
1861
+ if(e.pageX - l < 20) {
1862
+ if(sli && dir2 === "right") { clearInterval(sli); sli = false; }
1863
+ if(!sli) { dir2 = "left"; sli = setInterval(function () { $(document).scrollLeft($(document).scrollLeft() - $.vakata.dnd.scroll_spd); }, 150); }
1864
+ }
1865
+ else {
1866
+ if(sli && dir2 === "left") { clearInterval(sli); sli = false; }
1867
+ }
1868
+ if($(window).width() - (e.pageX - l) < 20) {
1869
+ if(sli && dir2 === "left") { clearInterval(sli); sli = false; }
1870
+ if(!sli) { dir2 = "right"; sli = setInterval(function () { $(document).scrollLeft($(document).scrollLeft() + $.vakata.dnd.scroll_spd); }, 150); }
1871
+ }
1872
+ else {
1873
+ if(sli && dir2 === "right") { clearInterval(sli); sli = false; }
1874
+ }
1875
+ }
1876
+
1877
+ $.vakata.dnd.helper.css({ left : (e.pageX + 5) + "px", top : (e.pageY + 10) + "px" });
1878
+ $(document).triggerHandler("drag.vakata", { "event" : e, "data" : $.vakata.dnd.user_data });
1879
+ },
1880
+ drag_stop : function (e) {
1881
+ $(document).unbind("mousemove", $.vakata.dnd.drag);
1882
+ $(document).unbind("mouseup", $.vakata.dnd.drag_stop);
1883
+ $(document).triggerHandler("drag_stop.vakata", { "event" : e, "data" : $.vakata.dnd.user_data });
1884
+ $.vakata.dnd.helper.remove();
1885
+ $.vakata.dnd.init_x = 0;
1886
+ $.vakata.dnd.init_y = 0;
1887
+ $.vakata.dnd.user_data = {};
1888
+ $.vakata.dnd.is_down = false;
1889
+ $.vakata.dnd.is_drag = false;
1890
+ }
1891
+ };
1892
+ $(function() {
1893
+ var css_string = '#vakata-dragged { display:block; margin:0 0 0 0; padding:4px 4px 4px 24px; position:absolute; top:-2000px; line-height:16px; z-index:10000; } ';
1894
+ $.vakata.css.add_sheet({ str : css_string });
1895
+ });
1896
+
1897
+ $.jstree.plugin("dnd", {
1898
+ __init : function () {
1899
+ this.data.dnd = {
1900
+ active : false,
1901
+ after : false,
1902
+ inside : false,
1903
+ before : false,
1904
+ off : false,
1905
+ prepared : false,
1906
+ w : 0,
1907
+ to1 : false,
1908
+ to2 : false,
1909
+ cof : false,
1910
+ cw : false,
1911
+ ch : false,
1912
+ i1 : false,
1913
+ i2 : false
1914
+ };
1915
+ this.get_container()
1916
+ .bind("mouseenter.jstree", $.proxy(function () {
1917
+ if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree && this.data.themes) {
1918
+ m.attr("class", "jstree-" + this.data.themes.theme);
1919
+ $.vakata.dnd.helper.attr("class", "jstree-dnd-helper jstree-" + this.data.themes.theme);
1920
+ }
1921
+ }, this))
1922
+ .bind("mouseleave.jstree", $.proxy(function () {
1923
+ if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {
1924
+ if(this.data.dnd.i1) { clearInterval(this.data.dnd.i1); }
1925
+ if(this.data.dnd.i2) { clearInterval(this.data.dnd.i2); }
1926
+ }
1927
+ }, this))
1928
+ .bind("mousemove.jstree", $.proxy(function (e) {
1929
+ if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {
1930
+ var cnt = this.get_container()[0];
1931
+
1932
+ // Horizontal scroll
1933
+ if(e.pageX + 24 > this.data.dnd.cof.left + this.data.dnd.cw) {
1934
+ if(this.data.dnd.i1) { clearInterval(this.data.dnd.i1); }
1935
+ this.data.dnd.i1 = setInterval($.proxy(function () { this.scrollLeft += $.vakata.dnd.scroll_spd; }, cnt), 100);
1936
+ }
1937
+ else if(e.pageX - 24 < this.data.dnd.cof.left) {
1938
+ if(this.data.dnd.i1) { clearInterval(this.data.dnd.i1); }
1939
+ this.data.dnd.i1 = setInterval($.proxy(function () { this.scrollLeft -= $.vakata.dnd.scroll_spd; }, cnt), 100);
1940
+ }
1941
+ else {
1942
+ if(this.data.dnd.i1) { clearInterval(this.data.dnd.i1); }
1943
+ }
1944
+
1945
+ // Vertical scroll
1946
+ if(e.pageY + 24 > this.data.dnd.cof.top + this.data.dnd.ch) {
1947
+ if(this.data.dnd.i2) { clearInterval(this.data.dnd.i2); }
1948
+ this.data.dnd.i2 = setInterval($.proxy(function () { this.scrollTop += $.vakata.dnd.scroll_spd; }, cnt), 100);
1949
+ }
1950
+ else if(e.pageY - 24 < this.data.dnd.cof.top) {
1951
+ if(this.data.dnd.i2) { clearInterval(this.data.dnd.i2); }
1952
+ this.data.dnd.i2 = setInterval($.proxy(function () { this.scrollTop -= $.vakata.dnd.scroll_spd; }, cnt), 100);
1953
+ }
1954
+ else {
1955
+ if(this.data.dnd.i2) { clearInterval(this.data.dnd.i2); }
1956
+ }
1957
+
1958
+ }
1959
+ }, this))
1960
+ .delegate("a", "mousedown.jstree", $.proxy(function (e) {
1961
+ if(e.which === 1) {
1962
+ this.start_drag(e.currentTarget, e);
1963
+ return false;
1964
+ }
1965
+ }, this))
1966
+ .delegate("a", "mouseenter.jstree", $.proxy(function (e) {
1967
+ if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {
1968
+ this.dnd_enter(e.currentTarget);
1969
+ }
1970
+ }, this))
1971
+ .delegate("a", "mousemove.jstree", $.proxy(function (e) {
1972
+ if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {
1973
+ if(typeof this.data.dnd.off.top === "undefined") { this.data.dnd.off = $(e.target).offset(); }
1974
+ this.data.dnd.w = (e.pageY - (this.data.dnd.off.top || 0)) % this.data.core.li_height;
1975
+ if(this.data.dnd.w < 0) { this.data.dnd.w += this.data.core.li_height; }
1976
+ this.dnd_show();
1977
+ }
1978
+ }, this))
1979
+ .delegate("a", "mouseleave.jstree", $.proxy(function (e) {
1980
+ if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {
1981
+ this.data.dnd.after = false;
1982
+ this.data.dnd.before = false;
1983
+ this.data.dnd.inside = false;
1984
+ $.vakata.dnd.helper.children("ins").attr("class","jstree-invalid");
1985
+ m.hide();
1986
+ if(r && r[0] === e.target.parentNode) {
1987
+ if(this.data.dnd.to1) {
1988
+ clearTimeout(this.data.dnd.to1);
1989
+ this.data.dnd.to1 = false;
1990
+ }
1991
+ if(this.data.dnd.to2) {
1992
+ clearTimeout(this.data.dnd.to2);
1993
+ this.data.dnd.to2 = false;
1994
+ }
1995
+ }
1996
+ }
1997
+ }, this))
1998
+ .delegate("a", "mouseup.jstree", $.proxy(function (e) {
1999
+ if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {
2000
+ this.dnd_finish(e);
2001
+ }
2002
+ }, this));
2003
+
2004
+ $(document)
2005
+ .bind("drag_stop.vakata", $.proxy(function () {
2006
+ this.data.dnd.after = false;
2007
+ this.data.dnd.before = false;
2008
+ this.data.dnd.inside = false;
2009
+ this.data.dnd.off = false;
2010
+ this.data.dnd.prepared = false;
2011
+ this.data.dnd.w = false;
2012
+ this.data.dnd.to1 = false;
2013
+ this.data.dnd.to2 = false;
2014
+ this.data.dnd.active = false;
2015
+ this.data.dnd.foreign = false;
2016
+ if(m) { m.css({ "top" : "-2000px" }); }
2017
+ }, this))
2018
+ .bind("drag_start.vakata", $.proxy(function (e, data) {
2019
+ if(data.data.jstree) {
2020
+ var et = $(data.event.target);
2021
+ if(et.closest(".jstree").hasClass("jstree-" + this.get_index())) {
2022
+ this.dnd_enter(et);
2023
+ }
2024
+ }
2025
+ }, this));
2026
+
2027
+ var s = this._get_settings().dnd;
2028
+ if(s.drag_target) {
2029
+ $(document)
2030
+ .delegate(s.drag_target, "mousedown.jstree", $.proxy(function (e) {
2031
+ o = e.target;
2032
+ $.vakata.dnd.drag_start(e, { jstree : true, obj : e.target }, "<ins class='jstree-icon'></ins>" + $(e.target).text() );
2033
+ if(this.data.themes) {
2034
+ m.attr("class", "jstree-" + this.data.themes.theme);
2035
+ $.vakata.dnd.helper.attr("class", "jstree-dnd-helper jstree-" + this.data.themes.theme);
2036
+ }
2037
+ $.vakata.dnd.helper.children("ins").attr("class","jstree-invalid");
2038
+ var cnt = this.get_container();
2039
+ this.data.dnd.cof = cnt.offset();
2040
+ this.data.dnd.cw = parseInt(cnt.width(),10);
2041
+ this.data.dnd.ch = parseInt(cnt.height(),10);
2042
+ this.data.dnd.foreign = true;
2043
+ return false;
2044
+ }, this));
2045
+ }
2046
+ if(s.drop_target) {
2047
+ $(document)
2048
+ .delegate(s.drop_target, "mouseenter.jstree", $.proxy(function (e) {
2049
+ if(this.data.dnd.active && this._get_settings().dnd.drop_check.call(this, { "o" : o, "r" : $(e.target) })) {
2050
+ $.vakata.dnd.helper.children("ins").attr("class","jstree-ok");
2051
+ }
2052
+ }, this))
2053
+ .delegate(s.drop_target, "mouseleave.jstree", $.proxy(function (e) {
2054
+ if(this.data.dnd.active) {
2055
+ $.vakata.dnd.helper.children("ins").attr("class","jstree-invalid");
2056
+ }
2057
+ }, this))
2058
+ .delegate(s.drop_target, "mouseup.jstree", $.proxy(function (e) {
2059
+ if(this.data.dnd.active && $.vakata.dnd.helper.children("ins").hasClass("jstree-ok")) {
2060
+ this._get_settings().dnd.drop_finish.call(this, { "o" : o, "r" : $(e.target) });
2061
+ }
2062
+ }, this));
2063
+ }
2064
+ },
2065
+ defaults : {
2066
+ copy_modifier : "ctrl",
2067
+ check_timeout : 200,
2068
+ open_timeout : 500,
2069
+ drop_target : ".jstree-drop",
2070
+ drop_check : function (data) { return true; },
2071
+ drop_finish : $.noop,
2072
+ drag_target : ".jstree-draggable",
2073
+ drag_finish : $.noop,
2074
+ drag_check : function (data) { return { after : false, before : false, inside : true }; }
2075
+ },
2076
+ _fn : {
2077
+ dnd_prepare : function () {
2078
+ if(!r || !r.length) { return; }
2079
+ this.data.dnd.off = r.offset();
2080
+ if(this._get_settings().core.rtl) {
2081
+ this.data.dnd.off.right = this.data.dnd.off.left + r.width();
2082
+ }
2083
+ if(this.data.dnd.foreign) {
2084
+ var a = this._get_settings().dnd.drag_check.call(this, { "o" : o, "r" : r });
2085
+ this.data.dnd.after = a.after;
2086
+ this.data.dnd.before = a.before;
2087
+ this.data.dnd.inside = a.inside;
2088
+ this.data.dnd.prepared = true;
2089
+ return this.dnd_show();
2090
+ }
2091
+ this.prepare_move(o, r, "before");
2092
+ this.data.dnd.before = this.check_move();
2093
+ this.prepare_move(o, r, "after");
2094
+ this.data.dnd.after = this.check_move();
2095
+ if(this._is_loaded(r)) {
2096
+ this.prepare_move(o, r, "inside");
2097
+ this.data.dnd.inside = this.check_move();
2098
+ }
2099
+ else {
2100
+ this.data.dnd.inside = false;
2101
+ }
2102
+ this.data.dnd.prepared = true;
2103
+ return this.dnd_show();
2104
+ },
2105
+ dnd_show : function () {
2106
+ if(!this.data.dnd.prepared) { return; }
2107
+ var o = ["before","inside","after"],
2108
+ r = false,
2109
+ rtl = this._get_settings().core.rtl,
2110
+ pos;
2111
+ if(this.data.dnd.w < this.data.core.li_height/3) { o = ["before","inside","after"]; }
2112
+ else if(this.data.dnd.w <= this.data.core.li_height*2/3) {
2113
+ o = this.data.dnd.w < this.data.core.li_height/2 ? ["inside","before","after"] : ["inside","after","before"];
2114
+ }
2115
+ else { o = ["after","inside","before"]; }
2116
+ $.each(o, $.proxy(function (i, val) {
2117
+ if(this.data.dnd[val]) {
2118
+ $.vakata.dnd.helper.children("ins").attr("class","jstree-ok");
2119
+ r = val;
2120
+ return false;
2121
+ }
2122
+ }, this));
2123
+ if(r === false) { $.vakata.dnd.helper.children("ins").attr("class","jstree-invalid"); }
2124
+
2125
+ pos = rtl ? (this.data.dnd.off.right - 18) : (this.data.dnd.off.left + 10);
2126
+ switch(r) {
2127
+ case "before":
2128
+ m.css({ "left" : pos + "px", "top" : (this.data.dnd.off.top - 6) + "px" }).show();
2129
+ break;
2130
+ case "after":
2131
+ m.css({ "left" : pos + "px", "top" : (this.data.dnd.off.top + this.data.core.li_height - 7) + "px" }).show();
2132
+ break;
2133
+ case "inside":
2134
+ m.css({ "left" : pos + ( rtl ? -4 : 4) + "px", "top" : (this.data.dnd.off.top + this.data.core.li_height/2 - 5) + "px" }).show();
2135
+ break;
2136
+ default:
2137
+ m.hide();
2138
+ break;
2139
+ }
2140
+ return r;
2141
+ },
2142
+ dnd_open : function () {
2143
+ this.data.dnd.to2 = false;
2144
+ this.open_node(r, $.proxy(this.dnd_prepare,this), true);
2145
+ },
2146
+ dnd_finish : function (e) {
2147
+ if(this.data.dnd.foreign) {
2148
+ if(this.data.dnd.after || this.data.dnd.before || this.data.dnd.inside) {
2149
+ this._get_settings().dnd.drag_finish.call(this, { "o" : o, "r" : r });
2150
+ }
2151
+ }
2152
+ else {
2153
+ this.dnd_prepare();
2154
+ this.move_node(o, r, this.dnd_show(), e[this._get_settings().dnd.copy_modifier + "Key"]);
2155
+ }
2156
+ o = false;
2157
+ r = false;
2158
+ m.hide();
2159
+ },
2160
+ dnd_enter : function (obj) {
2161
+ var s = this._get_settings().dnd;
2162
+ this.data.dnd.prepared = false;
2163
+ r = this._get_node(obj);
2164
+ if(s.check_timeout) {
2165
+ // do the calculations after a minimal timeout (users tend to drag quickly to the desired location)
2166
+ if(this.data.dnd.to1) { clearTimeout(this.data.dnd.to1); }
2167
+ this.data.dnd.to1 = setTimeout($.proxy(this.dnd_prepare, this), s.check_timeout);
2168
+ }
2169
+ else {
2170
+ this.dnd_prepare();
2171
+ }
2172
+ if(s.open_timeout) {
2173
+ if(this.data.dnd.to2) { clearTimeout(this.data.dnd.to2); }
2174
+ if(r && r.length && r.hasClass("jstree-closed")) {
2175
+ // if the node is closed - open it, then recalculate
2176
+ this.data.dnd.to2 = setTimeout($.proxy(this.dnd_open, this), s.open_timeout);
2177
+ }
2178
+ }
2179
+ else {
2180
+ if(r && r.length && r.hasClass("jstree-closed")) {
2181
+ this.dnd_open();
2182
+ }
2183
+ }
2184
+ },
2185
+ start_drag : function (obj, e) {
2186
+ o = this._get_node(obj);
2187
+ if(this.data.ui && this.is_selected(o)) { o = this._get_node(null, true); }
2188
+ $.vakata.dnd.drag_start(e, { jstree : true, obj : o }, "<ins class='jstree-icon'></ins>" + (o.length > 1 ? "Multiple selection" : this.get_text(o)) );
2189
+ if(this.data.themes) {
2190
+ m.attr("class", "jstree-" + this.data.themes.theme);
2191
+ $.vakata.dnd.helper.attr("class", "jstree-dnd-helper jstree-" + this.data.themes.theme);
2192
+ }
2193
+ var cnt = this.get_container();
2194
+ this.data.dnd.cof = cnt.children("ul").offset();
2195
+ this.data.dnd.cw = parseInt(cnt.width(),10);
2196
+ this.data.dnd.ch = parseInt(cnt.height(),10);
2197
+ this.data.dnd.active = true;
2198
+ }
2199
+ }
2200
+ });
2201
+ $(function() {
2202
+ var css_string = '' +
2203
+ '#vakata-dragged ins { display:block; text-decoration:none; width:16px; height:16px; margin:0 0 0 0; padding:0; position:absolute; top:4px; left:4px; } ' +
2204
+ '#vakata-dragged .jstree-ok { background:green; } ' +
2205
+ '#vakata-dragged .jstree-invalid { background:red; } ' +
2206
+ '#jstree-marker { padding:0; margin:0; line-height:12px; font-size:1px; overflow:hidden; height:12px; width:8px; position:absolute; top:-30px; z-index:10000; background-repeat:no-repeat; display:none; background-color:silver; } ';
2207
+ $.vakata.css.add_sheet({ str : css_string });
2208
+ m = $("<div>").attr({ id : "jstree-marker" }).hide().appendTo("body");
2209
+ $(document).bind("drag_start.vakata", function (e, data) {
2210
+ if(data.data.jstree) {
2211
+ m.show();
2212
+ }
2213
+ });
2214
+ $(document).bind("drag_stop.vakata", function (e, data) {
2215
+ if(data.data.jstree) { m.hide(); }
2216
+ });
2217
+ });
2218
+ })(jQuery);
2219
+ //*/
2220
+
2221
+ /*
2222
+ * jsTree checkbox plugin 1.0
2223
+ * Inserts checkboxes in front of every node
2224
+ * Depends on the ui plugin
2225
+ * DOES NOT WORK NICELY WITH MULTITREE DRAG'N'DROP
2226
+ */
2227
+ (function ($) {
2228
+ $.jstree.plugin("checkbox", {
2229
+ __init : function () {
2230
+ this.select_node = this.deselect_node = this.deselect_all = $.noop;
2231
+ this.get_selected = this.get_checked;
2232
+
2233
+ this.get_container()
2234
+ .bind("open_node.jstree create_node.jstree clean_node.jstree", $.proxy(function (e, data) {
2235
+ this._prepare_checkboxes(data.rslt.obj);
2236
+ }, this))
2237
+ .bind("loaded.jstree", $.proxy(function (e) {
2238
+ this._prepare_checkboxes();
2239
+ }, this))
2240
+ .delegate("a", "click.jstree", $.proxy(function (e) {
2241
+ if(this._get_node(e.target).hasClass("jstree-checked")) { this.uncheck_node(e.target); }
2242
+ else { this.check_node(e.target); }
2243
+ if(this.data.ui) { this.save_selected(); }
2244
+ if(this.data.cookies) { this.save_cookie("select_node"); }
2245
+ e.preventDefault();
2246
+ }, this));
2247
+ },
2248
+ __destroy : function () {
2249
+ this.get_container().find(".jstree-checkbox").remove();
2250
+ },
2251
+ _fn : {
2252
+ _prepare_checkboxes : function (obj) {
2253
+ obj = !obj || obj == -1 ? this.get_container() : this._get_node(obj);
2254
+ var c, _this = this, t;
2255
+ obj.each(function () {
2256
+ t = $(this);
2257
+ c = t.is("li") && t.hasClass("jstree-checked") ? "jstree-checked" : "jstree-unchecked";
2258
+ t.find("a").not(":has(.jstree-checkbox)").prepend("<ins class='jstree-checkbox'>&#160;</ins>").parent().not(".jstree-checked, .jstree-unchecked").addClass(c);
2259
+ });
2260
+ if(obj.is("li")) { this._repair_state(obj); }
2261
+ else { obj.find("> ul > li").each(function () { _this._repair_state(this); }); }
2262
+ },
2263
+ change_state : function (obj, state) {
2264
+ obj = this._get_node(obj);
2265
+ state = (state === false || state === true) ? state : obj.hasClass("jstree-checked");
2266
+ if(state) { obj.find("li").andSelf().removeClass("jstree-checked jstree-undetermined").addClass("jstree-unchecked"); }
2267
+ else {
2268
+ obj.find("li").andSelf().removeClass("jstree-unchecked jstree-undetermined").addClass("jstree-checked");
2269
+ if(this.data.ui) { this.data.ui.last_selected = obj; }
2270
+ this.data.checkbox.last_selected = obj;
2271
+ }
2272
+ obj.parentsUntil(".jstree", "li").each(function () {
2273
+ var $this = $(this);
2274
+ if(state) {
2275
+ if($this.children("ul").children(".jstree-checked, .jstree-undetermined").length) {
2276
+ $this.parentsUntil(".jstree", "li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");
2277
+ return false;
2278
+ }
2279
+ else {
2280
+ $this.removeClass("jstree-checked jstree-undetermined").addClass("jstree-unchecked");
2281
+ }
2282
+ }
2283
+ else {
2284
+ if($this.children("ul").children(".jstree-unchecked, .jstree-undetermined").length) {
2285
+ $this.parentsUntil(".jstree", "li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");
2286
+ return false;
2287
+ }
2288
+ else {
2289
+ $this.removeClass("jstree-unchecked jstree-undetermined").addClass("jstree-checked");
2290
+ }
2291
+ }
2292
+ });
2293
+ if(this.data.ui) { this.data.ui.selected = this.get_checked(); }
2294
+ this.__callback(obj);
2295
+ },
2296
+ check_node : function (obj) {
2297
+ this.change_state(obj, false);
2298
+ },
2299
+ uncheck_node : function (obj) {
2300
+ this.change_state(obj, true);
2301
+ },
2302
+ check_all : function () {
2303
+ var _this = this;
2304
+ this.get_container().children("ul").children("li").each(function () {
2305
+ _this.check_node(this, false);
2306
+ });
2307
+ },
2308
+ uncheck_all : function () {
2309
+ var _this = this;
2310
+ this.get_container().children("ul").children("li").each(function () {
2311
+ _this.change_state(this, true);
2312
+ });
2313
+ },
2314
+
2315
+ is_checked : function(obj) {
2316
+ obj = this._get_node(obj);
2317
+ return obj.length ? obj.is(".jstree-checked") : false;
2318
+ },
2319
+ get_checked : function (obj) {
2320
+ obj = !obj || obj === -1 ? this.get_container() : this._get_node(obj);
2321
+ return obj.find("> ul > .jstree-checked, .jstree-undetermined > ul > .jstree-checked");
2322
+ },
2323
+ get_unchecked : function (obj) {
2324
+ obj = !obj || obj === -1 ? this.get_container() : this._get_node(obj);
2325
+ return obj.find("> ul > .jstree-unchecked, .jstree-undetermined > ul > .jstree-unchecked");
2326
+ },
2327
+
2328
+ show_checkboxes : function () { this.get_container().children("ul").removeClass("jstree-no-checkboxes"); },
2329
+ hide_checkboxes : function () { this.get_container().children("ul").addClass("jstree-no-checkboxes"); },
2330
+
2331
+ _repair_state : function (obj) {
2332
+ obj = this._get_node(obj);
2333
+ if(!obj.length) { return; }
2334
+ var a = obj.find("> ul > .jstree-checked").length,
2335
+ b = obj.find("> ul > .jstree-undetermined").length,
2336
+ c = obj.find("> ul > li").length;
2337
+
2338
+ if(c === 0) { if(obj.hasClass("jstree-undetermined")) { this.check_node(obj); } }
2339
+ else if(a === 0 && b === 0) { this.uncheck_node(obj); }
2340
+ else if(a === c) { this.check_node(obj); }
2341
+ else {
2342
+ obj.parentsUntil(".jstree","li").removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");
2343
+ }
2344
+ },
2345
+ reselect : function () {
2346
+ if(this.data.ui) {
2347
+ var _this = this,
2348
+ s = this.data.ui.to_select;
2349
+ s = $.map($.makeArray(s), function (n) { return "#" + n.toString().replace(/^#/,"").replace('\\/','/').replace('/','\\/'); });
2350
+ this.deselect_all();
2351
+ $.each(s, function (i, val) { _this.check_node(val); });
2352
+ this.__callback();
2353
+ }
2354
+ }
2355
+ }
2356
+ });
2357
+ })(jQuery);
2358
+ //*/
2359
+
2360
+ /*
2361
+ * jsTree XML 1.0
2362
+ * The XML data store. Datastores are build by overriding the `load_node` and `_is_loaded` functions.
2363
+ */
2364
+ (function ($) {
2365
+ $.vakata.xslt = function (xml, xsl, callback) {
2366
+ var rs = "", xm, xs, processor, support;
2367
+ if(document.recalc) {
2368
+ xm = document.createElement('xml');
2369
+ xs = document.createElement('xml');
2370
+ xm.innerHTML = xml;
2371
+ xs.innerHTML = xsl;
2372
+ $("body").append(xm).append(xs);
2373
+ setTimeout( (function (xm, xs, callback) {
2374
+ return function () {
2375
+ callback.call(null, xm.transformNode(xs.XMLDocument));
2376
+ setTimeout( (function (xm, xs) { return function () { jQuery("body").remove(xm).remove(xs); }; })(xm, xs), 200);
2377
+ };
2378
+ }) (xm, xs, callback), 100);
2379
+ return true;
2380
+ }
2381
+ if(typeof window.DOMParser !== "undefined" && typeof window.XMLHttpRequest !== "undefined" && typeof window.XSLTProcessor !== "undefined") {
2382
+ processor = new XSLTProcessor();
2383
+ support = $.isFunction(processor.transformDocument) ? (typeof window.XMLSerializer !== "undefined") : true;
2384
+ if(!support) { return false; }
2385
+ xml = new DOMParser().parseFromString(xml, "text/xml");
2386
+ xsl = new DOMParser().parseFromString(xsl, "text/xml");
2387
+ if($.isFunction(processor.transformDocument)) {
2388
+ rs = document.implementation.createDocument("", "", null);
2389
+ processor.transformDocument(xml, xsl, rs, null);
2390
+ callback.call(null, XMLSerializer().serializeToString(rs));
2391
+ return true;
2392
+ }
2393
+ else {
2394
+ processor.importStylesheet(xsl);
2395
+ rs = processor.transformToFragment(xml, document);
2396
+ callback.call(null, $("<div>").append(rs).html());
2397
+ return true;
2398
+ }
2399
+ }
2400
+ return false;
2401
+ };
2402
+ var xsl = {
2403
+ 'nest' : '<?xml version="1.0" encoding="utf-8" ?>' +
2404
+ '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >' +
2405
+ '<xsl:output method="html" encoding="utf-8" omit-xml-declaration="yes" standalone="no" indent="no" media-type="text/html" />' +
2406
+ '<xsl:template match="/">' +
2407
+ ' <xsl:call-template name="nodes">' +
2408
+ ' <xsl:with-param name="node" select="/root" />' +
2409
+ ' </xsl:call-template>' +
2410
+ '</xsl:template>' +
2411
+ '<xsl:template name="nodes">' +
2412
+ ' <xsl:param name="node" />' +
2413
+ ' <ul>' +
2414
+ ' <xsl:for-each select="$node/item">' +
2415
+ ' <xsl:variable name="children" select="count(./item) &gt; 0" />' +
2416
+ ' <li>' +
2417
+ ' <xsl:attribute name="class">' +
2418
+ ' <xsl:if test="position() = last()">jstree-last </xsl:if>' +
2419
+ ' <xsl:choose>' +
2420
+ ' <xsl:when test="@state = \'open\'">jstree-open </xsl:when>' +
2421
+ ' <xsl:when test="$children or @hasChildren or @state = \'closed\'">jstree-closed </xsl:when>' +
2422
+ ' <xsl:otherwise>jstree-leaf </xsl:otherwise>' +
2423
+ ' </xsl:choose>' +
2424
+ ' <xsl:value-of select="@class" />' +
2425
+ ' </xsl:attribute>' +
2426
+ ' <xsl:for-each select="@*">' +
2427
+ ' <xsl:if test="name() != \'class\' and name() != \'state\' and name() != \'hasChildren\'">' +
2428
+ ' <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>' +
2429
+ ' </xsl:if>' +
2430
+ ' </xsl:for-each>' +
2431
+ ' <ins class="jstree-icon"><xsl:text>&#xa0;</xsl:text></ins>' +
2432
+ ' <xsl:for-each select="content/name">' +
2433
+ ' <a>' +
2434
+ ' <xsl:attribute name="href">' +
2435
+ ' <xsl:choose>' +
2436
+ ' <xsl:when test="@href"><xsl:value-of select="@href" /></xsl:when>' +
2437
+ ' <xsl:otherwise>#</xsl:otherwise>' +
2438
+ ' </xsl:choose>' +
2439
+ ' </xsl:attribute>' +
2440
+ ' <xsl:attribute name="class"><xsl:value-of select="@lang" /> <xsl:value-of select="@class" /></xsl:attribute>' +
2441
+ ' <xsl:attribute name="style"><xsl:value-of select="@style" /></xsl:attribute>' +
2442
+ ' <xsl:for-each select="@*">' +
2443
+ ' <xsl:if test="name() != \'style\' and name() != \'class\' and name() != \'href\'">' +
2444
+ ' <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>' +
2445
+ ' </xsl:if>' +
2446
+ ' </xsl:for-each>' +
2447
+ ' <ins>' +
2448
+ ' <xsl:attribute name="class">jstree-icon ' +
2449
+ ' <xsl:if test="string-length(attribute::icon) > 0 and not(contains(@icon,\'/\'))"><xsl:value-of select="@icon" /></xsl:if>' +
2450
+ ' </xsl:attribute>' +
2451
+ ' <xsl:if test="string-length(attribute::icon) > 0 and contains(@icon,\'/\')"><xsl:attribute name="style">background:url(<xsl:value-of select="@icon" />) center center no-repeat;</xsl:attribute></xsl:if>' +
2452
+ ' <xsl:text>&#xa0;</xsl:text>' +
2453
+ ' </ins>' +
2454
+ ' <xsl:value-of select="current()" />' +
2455
+ ' </a>' +
2456
+ ' </xsl:for-each>' +
2457
+ ' <xsl:if test="$children or @hasChildren"><xsl:call-template name="nodes"><xsl:with-param name="node" select="current()" /></xsl:call-template></xsl:if>' +
2458
+ ' </li>' +
2459
+ ' </xsl:for-each>' +
2460
+ ' </ul>' +
2461
+ '</xsl:template>' +
2462
+ '</xsl:stylesheet>',
2463
+
2464
+ 'flat' : '<?xml version="1.0" encoding="utf-8" ?>' +
2465
+ '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >' +
2466
+ '<xsl:output method="html" encoding="utf-8" omit-xml-declaration="yes" standalone="no" indent="no" media-type="text/xml" />' +
2467
+ '<xsl:template match="/">' +
2468
+ ' <ul>' +
2469
+ ' <xsl:for-each select="//item[not(@parent_id) or @parent_id=0 or not(@parent_id = //item/@id)]">' + /* the last `or` may be removed */
2470
+ ' <xsl:call-template name="nodes">' +
2471
+ ' <xsl:with-param name="node" select="." />' +
2472
+ ' <xsl:with-param name="is_last" select="number(position() = last())" />' +
2473
+ ' </xsl:call-template>' +
2474
+ ' </xsl:for-each>' +
2475
+ ' </ul>' +
2476
+ '</xsl:template>' +
2477
+ '<xsl:template name="nodes">' +
2478
+ ' <xsl:param name="node" />' +
2479
+ ' <xsl:param name="is_last" />' +
2480
+ ' <xsl:variable name="children" select="count(//item[@parent_id=$node/attribute::id]) &gt; 0" />' +
2481
+ ' <li>' +
2482
+ ' <xsl:attribute name="class">' +
2483
+ ' <xsl:if test="$is_last = true()">jstree-last </xsl:if>' +
2484
+ ' <xsl:choose>' +
2485
+ ' <xsl:when test="@state = \'open\'">jstree-open </xsl:when>' +
2486
+ ' <xsl:when test="$children or @hasChildren or @state = \'closed\'">jstree-closed </xsl:when>' +
2487
+ ' <xsl:otherwise>jstree-leaf </xsl:otherwise>' +
2488
+ ' </xsl:choose>' +
2489
+ ' <xsl:value-of select="@class" />' +
2490
+ ' </xsl:attribute>' +
2491
+ ' <xsl:for-each select="@*">' +
2492
+ ' <xsl:if test="name() != \'parent_id\' and name() != \'hasChildren\' and name() != \'class\' and name() != \'state\'">' +
2493
+ ' <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>' +
2494
+ ' </xsl:if>' +
2495
+ ' </xsl:for-each>' +
2496
+ ' <ins class="jstree-icon"><xsl:text>&#xa0;</xsl:text></ins>' +
2497
+ ' <xsl:for-each select="content/name">' +
2498
+ ' <a>' +
2499
+ ' <xsl:attribute name="href">' +
2500
+ ' <xsl:choose>' +
2501
+ ' <xsl:when test="@href"><xsl:value-of select="@href" /></xsl:when>' +
2502
+ ' <xsl:otherwise>#</xsl:otherwise>' +
2503
+ ' </xsl:choose>' +
2504
+ ' </xsl:attribute>' +
2505
+ ' <xsl:attribute name="class"><xsl:value-of select="@lang" /> <xsl:value-of select="@class" /></xsl:attribute>' +
2506
+ ' <xsl:attribute name="style"><xsl:value-of select="@style" /></xsl:attribute>' +
2507
+ ' <xsl:for-each select="@*">' +
2508
+ ' <xsl:if test="name() != \'style\' and name() != \'class\' and name() != \'href\'">' +
2509
+ ' <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>' +
2510
+ ' </xsl:if>' +
2511
+ ' </xsl:for-each>' +
2512
+ ' <ins>' +
2513
+ ' <xsl:attribute name="class">jstree-icon ' +
2514
+ ' <xsl:if test="string-length(attribute::icon) > 0 and not(contains(@icon,\'/\'))"><xsl:value-of select="@icon" /></xsl:if>' +
2515
+ ' </xsl:attribute>' +
2516
+ ' <xsl:if test="string-length(attribute::icon) > 0 and contains(@icon,\'/\')"><xsl:attribute name="style">background:url(<xsl:value-of select="@icon" />) center center no-repeat;</xsl:attribute></xsl:if>' +
2517
+ ' <xsl:text>&#xa0;</xsl:text>' +
2518
+ ' </ins>' +
2519
+ ' <xsl:value-of select="current()" />' +
2520
+ ' </a>' +
2521
+ ' </xsl:for-each>' +
2522
+ ' <xsl:if test="$children">' +
2523
+ ' <ul>' +
2524
+ ' <xsl:for-each select="//item[@parent_id=$node/attribute::id]">' +
2525
+ ' <xsl:call-template name="nodes">' +
2526
+ ' <xsl:with-param name="node" select="." />' +
2527
+ ' <xsl:with-param name="is_last" select="number(position() = last())" />' +
2528
+ ' </xsl:call-template>' +
2529
+ ' </xsl:for-each>' +
2530
+ ' </ul>' +
2531
+ ' </xsl:if>' +
2532
+ ' </li>' +
2533
+ '</xsl:template>' +
2534
+ '</xsl:stylesheet>'
2535
+ };
2536
+ $.jstree.plugin("xml_data", {
2537
+ defaults : {
2538
+ data : false,
2539
+ ajax : false,
2540
+ xsl : "flat",
2541
+ clean_node : false,
2542
+ correct_state : true
2543
+ },
2544
+ _fn : {
2545
+ load_node : function (obj, s_call, e_call) { var _this = this; this.load_node_xml(obj, function () { _this.__callback({ "obj" : obj }); s_call.call(this); }, e_call); },
2546
+ _is_loaded : function (obj) {
2547
+ var s = this._get_settings().xml_data;
2548
+ obj = this._get_node(obj);
2549
+ return obj == -1 || !obj || !s.ajax || obj.is(".jstree-open, .jstree-leaf") || obj.children("ul").children("li").size() > 0;
2550
+ },
2551
+ load_node_xml : function (obj, s_call, e_call) {
2552
+ var s = this.get_settings().xml_data,
2553
+ error_func = function () {},
2554
+ success_func = function () {};
2555
+
2556
+ obj = this._get_node(obj);
2557
+ if(obj && obj !== -1) {
2558
+ if(obj.data("jstree-is-loading")) { return; }
2559
+ else { obj.data("jstree-is-loading",true); }
2560
+ }
2561
+ switch(!0) {
2562
+ case (!s.data && !s.ajax): throw "Neither data nor ajax settings supplied.";
2563
+ case (!!s.data && !s.ajax) || (!!s.data && !!s.ajax && (!obj || obj === -1)):
2564
+ if(!obj || obj == -1) {
2565
+ this.parse_xml(s.data, $.proxy(function (d) {
2566
+ if(d) {
2567
+ d = d.replace(/ ?xmlns="[^"]*"/ig, "");
2568
+ if(d.length > 10) {
2569
+ d = $(d);
2570
+ this.get_container().children("ul").empty().append(d.children());
2571
+ if(s.clean_node) { this.clean_node(obj); }
2572
+ if(s_call) { s_call.call(this); }
2573
+ }
2574
+ }
2575
+ else {
2576
+ if(s.correct_state) {
2577
+ this.get_container().children("ul").empty();
2578
+ if(s_call) { s_call.call(this); }
2579
+ }
2580
+ }
2581
+ }, this));
2582
+ }
2583
+ break;
2584
+ case (!s.data && !!s.ajax) || (!!s.data && !!s.ajax && obj && obj !== -1):
2585
+ error_func = function (x, t, e) {
2586
+ var ef = this.get_settings().xml_data.ajax.error;
2587
+ if(ef) { ef.call(this, x, t, e); }
2588
+ if(obj !== -1 && obj.length) {
2589
+ obj.children(".jstree-loading").removeClass("jstree-loading");
2590
+ obj.data("jstree-is-loading",false);
2591
+ if(t === "success" && s.correct_state) { obj.removeClass("jstree-open jstree-closed").addClass("jstree-leaf"); }
2592
+ }
2593
+ else {
2594
+ if(t === "success" && s.correct_state) { this.get_container().children("ul").empty(); }
2595
+ }
2596
+ if(e_call) { e_call.call(this); }
2597
+ };
2598
+ success_func = function (d, t, x) {
2599
+ d = x.responseText;
2600
+ var sf = this.get_settings().xml_data.ajax.success;
2601
+ if(sf) { d = sf.call(this,d,t,x) || d; }
2602
+ if(d == "") {
2603
+ return error_func.call(this, x, t, "");
2604
+ }
2605
+ this.parse_xml(d, $.proxy(function (d) {
2606
+ if(d) {
2607
+ d = d.replace(/ ?xmlns="[^"]*"/ig, "");
2608
+ if(d.length > 10) {
2609
+ d = $(d);
2610
+ if(obj === -1 || !obj) { this.get_container().children("ul").empty().append(d.children()); }
2611
+ else { obj.children(".jstree-loading").removeClass("jstree-loading"); obj.append(d); obj.data("jstree-is-loading",false); }
2612
+ if(s.clean_node) { this.clean_node(obj); }
2613
+ if(s_call) { s_call.call(this); }
2614
+ }
2615
+ else {
2616
+ if(obj && obj !== -1) {
2617
+ obj.children(".jstree-loading").removeClass("jstree-loading");
2618
+ obj.data("jstree-is-loading",false);
2619
+ if(s.correct_state) {
2620
+ obj.removeClass("jstree-open jstree-closed").addClass("jstree-leaf");
2621
+ if(s_call) { s_call.call(this); }
2622
+ }
2623
+ }
2624
+ else {
2625
+ if(s.correct_state) {
2626
+ this.get_container().children("ul").empty();
2627
+ if(s_call) { s_call.call(this); }
2628
+ }
2629
+ }
2630
+ }
2631
+ }
2632
+ }, this));
2633
+ };
2634
+ s.ajax.context = this;
2635
+ s.ajax.error = error_func;
2636
+ s.ajax.success = success_func;
2637
+ if(!s.ajax.dataType) { s.ajax.dataType = "xml"; }
2638
+ if($.isFunction(s.ajax.url)) { s.ajax.url = s.ajax.url.call(this, obj); }
2639
+ if($.isFunction(s.ajax.data)) { s.ajax.data = s.ajax.data.call(this, obj); }
2640
+ $.ajax(s.ajax);
2641
+ break;
2642
+ }
2643
+ },
2644
+ parse_xml : function (xml, callback) {
2645
+ var s = this._get_settings().xml_data;
2646
+ $.vakata.xslt(xml, xsl[s.xsl], callback);
2647
+ },
2648
+ get_xml : function (tp, obj, li_attr, a_attr, is_callback) {
2649
+ var result = "",
2650
+ s = this._get_settings(),
2651
+ _this = this,
2652
+ tmp1, tmp2, li, a, lang;
2653
+ if(!tp) { tp = "flat"; }
2654
+ if(!is_callback) { is_callback = 0; }
2655
+ obj = this._get_node(obj);
2656
+ if(!obj || obj === -1) { obj = this.get_container().find("> ul > li"); }
2657
+ li_attr = $.isArray(li_attr) ? li_attr : [ "id", "class" ];
2658
+ if(!is_callback && this.data.types && $.inArray(s.types.type_attr, li_attr) === -1) { li_attr.push(s.types.type_attr); }
2659
+
2660
+ a_attr = $.isArray(a_attr) ? a_attr : [ ];
2661
+
2662
+ if(!is_callback) { result += "<root>"; }
2663
+ obj.each(function () {
2664
+ result += "<item";
2665
+ li = $(this);
2666
+ $.each(li_attr, function (i, v) { result += " " + v + "=\"" + (li.attr(v) || "").replace(/jstree[^ ]*|$/ig,'').replace(/^\s+$/ig,"") + "\""; });
2667
+ if(li.hasClass("jstree-open")) { result += " state=\"open\""; }
2668
+ if(li.hasClass("jstree-closed")) { result += " state=\"closed\""; }
2669
+ if(tp === "flat") { result += " parent_id=\"" + is_callback + "\""; }
2670
+ result += ">";
2671
+ result += "<content>";
2672
+ a = li.children("a");
2673
+ a.each(function () {
2674
+ tmp1 = $(this);
2675
+ lang = false;
2676
+ result += "<name";
2677
+ if($.inArray("languages", s.plugins) !== -1) {
2678
+ $.each(s.languages, function (k, z) {
2679
+ if(tmp1.hasClass(z)) { result += " lang=\"" + z + "\""; lang = z; return false; }
2680
+ });
2681
+ }
2682
+ if(a_attr.length) {
2683
+ $.each(a_attr, function (k, z) {
2684
+ result += " " + z + "=\"" + (tmp1.attr(z) || "").replace(/jstree[^ ]*|$/ig,'') + "\"";
2685
+ });
2686
+ }
2687
+ if(tmp1.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,'').replace(/^\s+$/ig,"").length) {
2688
+ result += ' icon="' + tmp1.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,'').replace(/^\s+$/ig,"") + '"';
2689
+ }
2690
+ if(tmp1.children("ins").get(0).style.backgroundImage.length) {
2691
+ result += ' icon="' + tmp1.children("ins").get(0).style.backgroundImage.replace("url(","").replace(")","") + '"';
2692
+ }
2693
+ result += ">";
2694
+ result += "<![CDATA[" + _this.get_text(tmp1, lang) + "]]>";
2695
+ result += "</name>";
2696
+ });
2697
+ result += "</content>";
2698
+ tmp2 = li[0].id;
2699
+ li = li.find("> ul > li");
2700
+ if(li.length) { tmp2 = _this.get_xml(tp, li, li_attr, a_attr, tmp2); }
2701
+ else { tmp2 = ""; }
2702
+ if(tp == "nest") { result += tmp2; }
2703
+ result += "</item>";
2704
+ if(tp == "flat") { result += tmp2; }
2705
+ });
2706
+ if(!is_callback) { result += "</root>"; }
2707
+ return result;
2708
+ }
2709
+ }
2710
+ });
2711
+ })(jQuery);
2712
+ //*/
2713
+
2714
+ /*
2715
+ * jsTree search plugin 1.0
2716
+ * Enables both sync and async search on the tree
2717
+ * DOES NOT WORK WITH JSON PROGRESSIVE RENDER
2718
+ */
2719
+ (function ($) {
2720
+ $.expr[':'].jstree_contains = function(a,i,m){
2721
+ return (a.textContent || a.innerText || "").toLowerCase().indexOf(m[3].toLowerCase())>=0;
2722
+ };
2723
+ $.jstree.plugin("search", {
2724
+ __init : function () {
2725
+ this.data.search.str = "";
2726
+ this.data.search.result = $();
2727
+ },
2728
+ defaults : {
2729
+ ajax : false, // OR ajax object
2730
+ case_insensitive : false
2731
+ },
2732
+ _fn : {
2733
+ search : function (str, skip_async) {
2734
+ if(str === "") { return; }
2735
+ var s = this.get_settings().search,
2736
+ t = this,
2737
+ error_func = function () { },
2738
+ success_func = function () { };
2739
+ this.data.search.str = str;
2740
+
2741
+ if(!skip_async && s.ajax !== false && this.get_container().find(".jstree-closed:eq(0)").length > 0) {
2742
+ this.search.supress_callback = true;
2743
+ error_func = function () { };
2744
+ success_func = function (d, t, x) {
2745
+ var sf = this.get_settings().search.ajax.success;
2746
+ if(sf) { d = sf.call(this,d,t,x) || d; }
2747
+ this.data.search.to_open = d;
2748
+ this._search_open();
2749
+ };
2750
+ s.ajax.context = this;
2751
+ s.ajax.error = error_func;
2752
+ s.ajax.success = success_func;
2753
+ if($.isFunction(s.ajax.url)) { s.ajax.url = s.ajax.url.call(this, str); }
2754
+ if($.isFunction(s.ajax.data)) { s.ajax.data = s.ajax.data.call(this, str); }
2755
+ if(!s.ajax.data) { s.ajax.data = { "search_string" : str }; }
2756
+ if(!s.ajax.dataType || /^json/.exec(s.ajax.dataType)) { s.ajax.dataType = "json"; }
2757
+ $.ajax(s.ajax);
2758
+ return;
2759
+ }
2760
+ if(this.data.search.result.length) { this.clear_search(); }
2761
+ this.data.search.result = this.get_container().find("a" + (this.data.languages ? "." + this.get_lang() : "" ) + ":" + (s.case_insensitive ? "jstree_contains" : "contains") + "(" + this.data.search.str + ")");
2762
+ this.data.search.result.addClass("jstree-search").parents(".jstree-closed").each(function () {
2763
+ t.open_node(this, false, true);
2764
+ });
2765
+ this.__callback({ nodes : this.data.search.result, str : str });
2766
+ },
2767
+ clear_search : function (str) {
2768
+ this.data.search.result.removeClass("jstree-search");
2769
+ this.__callback(this.data.search.result);
2770
+ this.data.search.result = $();
2771
+ },
2772
+ _search_open : function (is_callback) {
2773
+ var _this = this,
2774
+ done = true,
2775
+ current = [],
2776
+ remaining = [];
2777
+ if(this.data.search.to_open.length) {
2778
+ $.each(this.data.search.to_open, function (i, val) {
2779
+ if(val == "#") { return true; }
2780
+ if($(val).length && $(val).is(".jstree-closed")) { current.push(val); }
2781
+ else { remaining.push(val); }
2782
+ });
2783
+ if(current.length) {
2784
+ this.data.search.to_open = remaining;
2785
+ $.each(current, function (i, val) {
2786
+ _this.open_node(val, function () { _this._search_open(true); });
2787
+ });
2788
+ done = false;
2789
+ }
2790
+ }
2791
+ if(done) { this.search(this.data.search.str, true); }
2792
+ }
2793
+ }
2794
+ });
2795
+ })(jQuery);
2796
+ //*/
2797
+
2798
+ /*
2799
+ * jsTree contextmenu plugin 1.0
2800
+ */
2801
+ (function ($) {
2802
+ $.vakata.context = {
2803
+ cnt : $("<div id='vakata-contextmenu'>"),
2804
+ vis : false,
2805
+ tgt : false,
2806
+ par : false,
2807
+ func : false,
2808
+ data : false,
2809
+ show : function (s, t, x, y, d, p) {
2810
+ var html = $.vakata.context.parse(s), h, w;
2811
+ if(!html) { return; }
2812
+ $.vakata.context.vis = true;
2813
+ $.vakata.context.tgt = t;
2814
+ $.vakata.context.par = p || t || null;
2815
+ $.vakata.context.data = d || null;
2816
+ $.vakata.context.cnt
2817
+ .html(html)
2818
+ .css({ "visibility" : "hidden", "display" : "block", "left" : 0, "top" : 0 });
2819
+ h = $.vakata.context.cnt.height();
2820
+ w = $.vakata.context.cnt.width();
2821
+ if(x + w > $(document).width()) {
2822
+ x = $(document).width() - (w + 5);
2823
+ $.vakata.context.cnt.find("li > ul").addClass("right");
2824
+ }
2825
+ if(y + h > $(document).height()) {
2826
+ y = y - (h + t[0].offsetHeight);
2827
+ $.vakata.context.cnt.find("li > ul").addClass("bottom");
2828
+ }
2829
+
2830
+ $.vakata.context.cnt
2831
+ .css({ "left" : x, "top" : y })
2832
+ .find("li:has(ul)")
2833
+ .bind("mouseenter", function (e) {
2834
+ var w = $(document).width(),
2835
+ h = $(document).height(),
2836
+ ul = $(this).children("ul").show();
2837
+ if(w !== $(document).width()) { ul.toggleClass("right"); }
2838
+ if(h !== $(document).height()) { ul.toggleClass("bottom"); }
2839
+ })
2840
+ .bind("mouseleave", function (e) {
2841
+ $(this).children("ul").hide();
2842
+ })
2843
+ .end()
2844
+ .css({ "visibility" : "visible" })
2845
+ .show();
2846
+ $(document).triggerHandler("context_show.vakata");
2847
+ },
2848
+ hide : function () {
2849
+ $.vakata.context.vis = false;
2850
+ $.vakata.context.cnt.attr("class","").hide();
2851
+ $(document).triggerHandler("context_hide.vakata");
2852
+ },
2853
+ parse : function (s, is_callback) {
2854
+ if(!s) { return false; }
2855
+ var str = "",
2856
+ tmp = false,
2857
+ was_sep = true;
2858
+ if(!is_callback) { $.vakata.context.func = {}; }
2859
+ str += "<ul>";
2860
+ $.each(s, function (i, val) {
2861
+ if(!val) { return true; }
2862
+ $.vakata.context.func[i] = val.action;
2863
+ if(!was_sep && val.separator_before) {
2864
+ str += "<li class='vakata-separator vakata-separator-before'></li>";
2865
+ }
2866
+ was_sep = false;
2867
+ str += "<li class='" + (val._class || "") + (val._disabled ? " jstree-contextmenu-disabled " : "") + "'><ins ";
2868
+ if(val.icon && val.icon.indexOf("/") === -1) { str += " class='" + val.icon + "' "; }
2869
+ if(val.icon && val.icon.indexOf("/") !== -1) { str += " style='background:url(" + val.icon + ") center center no-repeat;' "; }
2870
+ str += ">&#160;</ins><a href='#' rel='" + i + "'>";
2871
+ if(val.submenu) {
2872
+ str += "<span style='float:right;'>&raquo;</span>";
2873
+ }
2874
+ str += val.label + "</a>";
2875
+ if(val.submenu) {
2876
+ tmp = $.vakata.context.parse(val.submenu, true);
2877
+ if(tmp) { str += tmp; }
2878
+ }
2879
+ str += "</li>";
2880
+ if(val.separator_after) {
2881
+ str += "<li class='vakata-separator vakata-separator-after'></li>";
2882
+ was_sep = true;
2883
+ }
2884
+ });
2885
+ str = str.replace(/<li class\='vakata-separator vakata-separator-after'\><\/li\>$/,"");
2886
+ str += "</ul>";
2887
+ return str.length > 10 ? str : false;
2888
+ },
2889
+ exec : function (i) {
2890
+ if($.isFunction($.vakata.context.func[i])) {
2891
+ $.vakata.context.func[i].call($.vakata.context.data, $.vakata.context.par);
2892
+ return true;
2893
+ }
2894
+ else { return false; }
2895
+ }
2896
+ };
2897
+ $(function () {
2898
+ var css_string = '' +
2899
+ '#vakata-contextmenu { display:none; position:absolute; margin:0; padding:0; min-width:180px; background:#ebebeb; border:1px solid silver; z-index:10000; *width:180px; } ' +
2900
+ '#vakata-contextmenu ul { min-width:180px; *width:180px; } ' +
2901
+ '#vakata-contextmenu ul, #vakata-contextmenu li { margin:0; padding:0; list-style-type:none; display:block; } ' +
2902
+ '#vakata-contextmenu li { line-height:20px; min-height:20px; position:relative; padding:0px; } ' +
2903
+ '#vakata-contextmenu li a { padding:1px 6px; line-height:17px; display:block; text-decoration:none; margin:1px 1px 0 1px; } ' +
2904
+ '#vakata-contextmenu li ins { float:left; width:16px; height:16px; text-decoration:none; margin-right:2px; } ' +
2905
+ '#vakata-contextmenu li a:hover, #vakata-contextmenu li.vakata-hover > a { background:gray; color:white; } ' +
2906
+ '#vakata-contextmenu li ul { display:none; position:absolute; top:-2px; left:100%; background:#ebebeb; border:1px solid gray; } ' +
2907
+ '#vakata-contextmenu .right { right:100%; left:auto; } ' +
2908
+ '#vakata-contextmenu .bottom { bottom:-1px; top:auto; } ' +
2909
+ '#vakata-contextmenu li.vakata-separator { min-height:0; height:1px; line-height:1px; font-size:1px; overflow:hidden; margin:0 2px; background:silver; /* border-top:1px solid #fefefe; */ padding:0; } ';
2910
+ $.vakata.css.add_sheet({ str : css_string });
2911
+ $.vakata.context.cnt
2912
+ .delegate("a","click", function (e) { e.preventDefault(); })
2913
+ .delegate("a","mouseup", function (e) {
2914
+ if(!$(this).parent().hasClass("jstree-contextmenu-disabled") && $.vakata.context.exec($(this).attr("rel"))) {
2915
+ $.vakata.context.hide();
2916
+ }
2917
+ else { $(this).blur(); }
2918
+ })
2919
+ .delegate("a","mouseover", function () {
2920
+ $.vakata.context.cnt.find(".vakata-hover").removeClass("vakata-hover");
2921
+ })
2922
+ .appendTo("body");
2923
+ $(document).bind("mousedown", function (e) { if($.vakata.context.vis && !$.contains($.vakata.context.cnt[0], e.target)) { $.vakata.context.hide(); } });
2924
+ if(typeof $.hotkeys !== "undefined") {
2925
+ $(document)
2926
+ .bind("keydown", "up", function (e) {
2927
+ if($.vakata.context.vis) {
2928
+ var o = $.vakata.context.cnt.find("ul:visible").last().children(".vakata-hover").removeClass("vakata-hover").prevAll("li:not(.vakata-separator)").first();
2929
+ if(!o.length) { o = $.vakata.context.cnt.find("ul:visible").last().children("li:not(.vakata-separator)").last(); }
2930
+ o.addClass("vakata-hover");
2931
+ e.stopImmediatePropagation();
2932
+ e.preventDefault();
2933
+ }
2934
+ })
2935
+ .bind("keydown", "down", function (e) {
2936
+ if($.vakata.context.vis) {
2937
+ var o = $.vakata.context.cnt.find("ul:visible").last().children(".vakata-hover").removeClass("vakata-hover").nextAll("li:not(.vakata-separator)").first();
2938
+ if(!o.length) { o = $.vakata.context.cnt.find("ul:visible").last().children("li:not(.vakata-separator)").first(); }
2939
+ o.addClass("vakata-hover");
2940
+ e.stopImmediatePropagation();
2941
+ e.preventDefault();
2942
+ }
2943
+ })
2944
+ .bind("keydown", "right", function (e) {
2945
+ if($.vakata.context.vis) {
2946
+ $.vakata.context.cnt.find(".vakata-hover").children("ul").show().children("li:not(.vakata-separator)").removeClass("vakata-hover").first().addClass("vakata-hover");
2947
+ e.stopImmediatePropagation();
2948
+ e.preventDefault();
2949
+ }
2950
+ })
2951
+ .bind("keydown", "left", function (e) {
2952
+ if($.vakata.context.vis) {
2953
+ $.vakata.context.cnt.find(".vakata-hover").children("ul").hide().children(".vakata-separator").removeClass("vakata-hover");
2954
+ e.stopImmediatePropagation();
2955
+ e.preventDefault();
2956
+ }
2957
+ })
2958
+ .bind("keydown", "esc", function (e) {
2959
+ $.vakata.context.hide();
2960
+ e.preventDefault();
2961
+ })
2962
+ .bind("keydown", "space", function (e) {
2963
+ $.vakata.context.cnt.find(".vakata-hover").last().children("a").click();
2964
+ e.preventDefault();
2965
+ });
2966
+ }
2967
+ });
2968
+
2969
+ $.jstree.plugin("contextmenu", {
2970
+ __init : function () {
2971
+ this.get_container()
2972
+ .delegate("a", "contextmenu.jstree", $.proxy(function (e) {
2973
+ e.preventDefault();
2974
+ this.show_contextmenu(e.currentTarget, e.pageX, e.pageY);
2975
+ }, this))
2976
+ .bind("destroy.jstree", $.proxy(function () {
2977
+ if(this.data.contextmenu) {
2978
+ $.vakata.context.hide();
2979
+ }
2980
+ }, this));
2981
+ $(document).bind("context_hide.vakata", $.proxy(function () { this.data.contextmenu = false; }, this));
2982
+ },
2983
+ defaults : {
2984
+ select_node : false, // requires UI plugin
2985
+ show_at_node : true,
2986
+ items : { // Could be a function that should return an object like this one
2987
+ "create" : {
2988
+ "separator_before" : false,
2989
+ "separator_after" : true,
2990
+ "label" : "Create",
2991
+ "action" : function (obj) { this.create(obj); }
2992
+ },
2993
+ "rename" : {
2994
+ "separator_before" : false,
2995
+ "separator_after" : false,
2996
+ "label" : "Rename",
2997
+ "action" : function (obj) { this.rename(obj); }
2998
+ },
2999
+ "remove" : {
3000
+ "separator_before" : false,
3001
+ "icon" : false,
3002
+ "separator_after" : false,
3003
+ "label" : "Delete",
3004
+ "action" : function (obj) { this.remove(obj); }
3005
+ },
3006
+ "ccp" : {
3007
+ "separator_before" : true,
3008
+ "icon" : false,
3009
+ "separator_after" : false,
3010
+ "label" : "Edit",
3011
+ "action" : false,
3012
+ "submenu" : {
3013
+ "cut" : {
3014
+ "separator_before" : false,
3015
+ "separator_after" : false,
3016
+ "label" : "Cut",
3017
+ "action" : function (obj) { this.cut(obj); }
3018
+ },
3019
+ "copy" : {
3020
+ "separator_before" : false,
3021
+ "icon" : false,
3022
+ "separator_after" : false,
3023
+ "label" : "Copy",
3024
+ "action" : function (obj) { this.copy(obj); }
3025
+ },
3026
+ "paste" : {
3027
+ "separator_before" : false,
3028
+ "icon" : false,
3029
+ "separator_after" : false,
3030
+ "label" : "Paste",
3031
+ "action" : function (obj) { this.paste(obj); }
3032
+ }
3033
+ }
3034
+ }
3035
+ }
3036
+ },
3037
+ _fn : {
3038
+ show_contextmenu : function (obj, x, y) {
3039
+ obj = this._get_node(obj);
3040
+ var s = this.get_settings().contextmenu,
3041
+ a = obj.children("a:visible:eq(0)"),
3042
+ o = false;
3043
+ if(s.select_node && this.data.ui && !this.is_selected(obj)) {
3044
+ this.deselect_all();
3045
+ this.select_node(obj, true);
3046
+ }
3047
+ if(s.show_at_node || typeof x === "undefined" || typeof y === "undefined") {
3048
+ o = a.offset();
3049
+ x = o.left;
3050
+ y = o.top + this.data.core.li_height;
3051
+ }
3052
+ if($.isFunction(s.items)) { s.items = s.items.call(this, obj); }
3053
+ this.data.contextmenu = true;
3054
+ $.vakata.context.show(s.items, a, x, y, this, obj);
3055
+ if(this.data.themes) { $.vakata.context.cnt.attr("class", "jstree-" + this.data.themes.theme + "-context"); }
3056
+ }
3057
+ }
3058
+ });
3059
+ })(jQuery);
3060
+ //*/
3061
+
3062
+ /*
3063
+ * jsTree types plugin 1.0
3064
+ * Adds support types of nodes
3065
+ * You can set an attribute on each li node, that represents its type.
3066
+ * According to the type setting the node may get custom icon/validation rules
3067
+ */
3068
+ (function ($) {
3069
+ $.jstree.plugin("types", {
3070
+ __init : function () {
3071
+ var s = this._get_settings().types;
3072
+ this.data.types.attach_to = [];
3073
+ this.get_container()
3074
+ .bind("init.jstree", $.proxy(function () {
3075
+ var types = s.types,
3076
+ attr = s.type_attr,
3077
+ icons_css = "",
3078
+ _this = this;
3079
+
3080
+ $.each(types, function (i, tp) {
3081
+ $.each(tp, function (k, v) {
3082
+ if(!/^(max_depth|max_children|icon|valid_children)$/.test(k)) { _this.data.types.attach_to.push(k); }
3083
+ });
3084
+ if(!tp.icon) { return true; }
3085
+ if( tp.icon.image || tp.icon.position) {
3086
+ if(i == "default") { icons_css += '.jstree-' + _this.get_index() + ' a > .jstree-icon { '; }
3087
+ else { icons_css += '.jstree-' + _this.get_index() + ' li[' + attr + '=' + i + '] > a > .jstree-icon { '; }
3088
+ if(tp.icon.image) { icons_css += ' background-image:url(' + tp.icon.image + '); '; }
3089
+ if(tp.icon.position){ icons_css += ' background-position:' + tp.icon.position + '; '; }
3090
+ else { icons_css += ' background-position:0 0; '; }
3091
+ icons_css += '} ';
3092
+ }
3093
+ });
3094
+ if(icons_css != "") { $.vakata.css.add_sheet({ 'str' : icons_css }); }
3095
+ }, this))
3096
+ .bind("before.jstree", $.proxy(function (e, data) {
3097
+ if($.inArray(data.func, this.data.types.attach_to) !== -1) {
3098
+ var s = this._get_settings().types.types,
3099
+ t = this._get_type(data.args[0]);
3100
+ if(
3101
+ (
3102
+ (s[t] && typeof s[t][data.func] !== "undefined") ||
3103
+ (s["default"] && typeof s["default"][data.func] !== "undefined")
3104
+ ) && !this._check(data.func, data.args[0])
3105
+ ) {
3106
+ e.stopImmediatePropagation();
3107
+ return false;
3108
+ }
3109
+ }
3110
+ }, this));
3111
+ },
3112
+ defaults : {
3113
+ // defines maximum number of root nodes (-1 means unlimited, -2 means disable max_children checking)
3114
+ max_children : -1,
3115
+ // defines the maximum depth of the tree (-1 means unlimited, -2 means disable max_depth checking)
3116
+ max_depth : -1,
3117
+ // defines valid node types for the root nodes
3118
+ valid_children : "all",
3119
+
3120
+ // where is the type stores (the rel attribute of the LI element)
3121
+ type_attr : "rel",
3122
+ // a list of types
3123
+ types : {
3124
+ // the default type
3125
+ "default" : {
3126
+ "max_children" : -1,
3127
+ "max_depth" : -1,
3128
+ "valid_children": "all"
3129
+
3130
+ // Bound functions - you can bind any other function here (using boolean or function)
3131
+ //"select_node" : true,
3132
+ //"open_node" : true,
3133
+ //"close_node" : true,
3134
+ //"create_node" : true,
3135
+ //"delete_node" : true
3136
+ }
3137
+ }
3138
+ },
3139
+ _fn : {
3140
+ _get_type : function (obj) {
3141
+ obj = this._get_node(obj);
3142
+ return (!obj || !obj.length) ? false : obj.attr(this._get_settings().types.type_attr) || "default";
3143
+ },
3144
+ set_type : function (str, obj) {
3145
+ obj = this._get_node(obj);
3146
+ return (!obj.length || !str) ? false : obj.attr(this._get_settings().types.type_attr, str);
3147
+ },
3148
+ _check : function (rule, obj, opts) {
3149
+ var v = false, t = this._get_type(obj), d = 0, _this = this, s = this._get_settings().types;
3150
+ if(obj === -1) {
3151
+ if(!!s[rule]) { v = s[rule]; }
3152
+ else { return; }
3153
+ }
3154
+ else {
3155
+ if(t === false) { return; }
3156
+ if(!!s.types[t] && !!s.types[t][rule]) { v = s.types[t][rule]; }
3157
+ else if(!!s.types["default"] && !!s.types["default"][rule]) { v = s.types["default"][rule]; }
3158
+ }
3159
+ if($.isFunction(v)) { v = v.call(this, obj); }
3160
+ if(rule === "max_depth" && obj !== -1 && opts !== false && s.max_depth !== -2 && v !== 0) {
3161
+ // also include the node itself - otherwise if root node it is not checked
3162
+ this._get_node(obj).children("a:eq(0)").parentsUntil(".jstree","li").each(function (i) {
3163
+ // check if current depth already exceeds global tree depth
3164
+ if(s.max_depth !== -1 && s.max_depth - (i + 1) <= 0) { v = 0; return false; }
3165
+ d = (i === 0) ? v : _this._check(rule, this, false);
3166
+ // check if current node max depth is already matched or exceeded
3167
+ if(d !== -1 && d - (i + 1) <= 0) { v = 0; return false; }
3168
+ // otherwise - set the max depth to the current value minus current depth
3169
+ if(d >= 0 && (d - (i + 1) < v || v < 0) ) { v = d - (i + 1); }
3170
+ // if the global tree depth exists and it minus the nodes calculated so far is less than `v` or `v` is unlimited
3171
+ if(s.max_depth >= 0 && (s.max_depth - (i + 1) < v || v < 0) ) { v = s.max_depth - (i + 1); }
3172
+ });
3173
+ }
3174
+ return v;
3175
+ },
3176
+ check_move : function () {
3177
+ if(!this.__call_old()) { return false; }
3178
+ var m = this._get_move(),
3179
+ s = m.rt._get_settings().types,
3180
+ mc = m.rt._check("max_children", m.cr),
3181
+ md = m.rt._check("max_depth", m.cr),
3182
+ vc = m.rt._check("valid_children", m.cr),
3183
+ ch = 0, d = 1, t;
3184
+
3185
+ if(vc === "none") { return false; }
3186
+ if($.isArray(vc) && m.ot && m.ot._get_type) {
3187
+ m.o.each(function () {
3188
+ if($.inArray(m.ot._get_type(this), vc) === -1) { d = false; return false; }
3189
+ });
3190
+ if(d === false) { return false; }
3191
+ }
3192
+ if(s.max_children !== -2 && mc !== -1) {
3193
+ ch = m.cr === -1 ? this.get_container().children("> ul > li").not(m.o).length : m.cr.children("> ul > li").not(m.o).length;
3194
+ if(ch + m.o.length > mc) { return false; }
3195
+ }
3196
+ if(s.max_depth !== -2 && md !== -1) {
3197
+ d = 0;
3198
+ if(md === 0) { return false; }
3199
+ if(typeof m.o.d === "undefined") {
3200
+ // TODO: deal with progressive rendering and async when checking max_depth (how to know the depth of the moved node)
3201
+ t = m.o;
3202
+ while(t.length > 0) {
3203
+ t = t.find("> ul > li");
3204
+ d ++;
3205
+ }
3206
+ m.o.d = d;
3207
+ }
3208
+ if(md - m.o.d < 0) { return false; }
3209
+ }
3210
+ return true;
3211
+ },
3212
+ create_node : function (obj, position, js, callback, is_loaded, skip_check) {
3213
+ if(!skip_check && (is_loaded || this._is_loaded(obj))) {
3214
+ var p = (position && position.match(/^before|after$/i) && obj !== -1) ? this._get_parent(obj) : this._get_node(obj),
3215
+ s = this._get_settings().types,
3216
+ mc = this._check("max_children", p),
3217
+ md = this._check("max_depth", p),
3218
+ vc = this._check("valid_children", p),
3219
+ ch;
3220
+ if(!js) { js = {}; }
3221
+ if(vc === "none") { return false; }
3222
+ if($.isArray(vc)) {
3223
+ if(!js.attr || !js.attr[s.type_attr]) {
3224
+ if(!js.attr) { js.attr = {}; }
3225
+ js.attr[s.type_attr] = vc[0];
3226
+ }
3227
+ else {
3228
+ if($.inArray(js.attr[s.type_attr], vc) === -1) { return false; }
3229
+ }
3230
+ }
3231
+ if(s.max_children !== -2 && mc !== -1) {
3232
+ ch = p === -1 ? this.get_container().children("> ul > li").length : p.children("> ul > li").length;
3233
+ if(ch + 1 > mc) { return false; }
3234
+ }
3235
+ if(s.max_depth !== -2 && md !== -1 && (md - 1) < 0) { return false; }
3236
+ }
3237
+ return this.__call_old(true, obj, position, js, callback, is_loaded, skip_check);
3238
+ }
3239
+ }
3240
+ });
3241
+ })(jQuery);
3242
+ //*/
3243
+
3244
+ /*
3245
+ * jsTree HTML data 1.0
3246
+ * The HTML data store. Datastores are build by replacing the `load_node` and `_is_loaded` functions.
3247
+ */
3248
+ (function ($) {
3249
+ $.jstree.plugin("html_data", {
3250
+ __init : function () {
3251
+ // this used to use html() and clean the whitespace, but this way any attached data was lost
3252
+ this.data.html_data.original_container_html = this.get_container().find(" > ul > li").clone(true);
3253
+ // remove white space from LI node - otherwise nodes appear a bit to the right
3254
+ this.data.html_data.original_container_html.find("li").andSelf().contents().filter(function() { return this.nodeType == 3; }).remove();
3255
+ },
3256
+ defaults : {
3257
+ data : false,
3258
+ ajax : false,
3259
+ correct_state : true
3260
+ },
3261
+ _fn : {
3262
+ load_node : function (obj, s_call, e_call) { var _this = this; this.load_node_html(obj, function () { _this.__callback({ "obj" : obj }); s_call.call(this); }, e_call); },
3263
+ _is_loaded : function (obj) {
3264
+ obj = this._get_node(obj);
3265
+ return obj == -1 || !obj || !this._get_settings().html_data.ajax || obj.is(".jstree-open, .jstree-leaf") || obj.children("ul").children("li").size() > 0;
3266
+ },
3267
+ load_node_html : function (obj, s_call, e_call) {
3268
+ var d,
3269
+ s = this.get_settings().html_data,
3270
+ error_func = function () {},
3271
+ success_func = function () {};
3272
+ obj = this._get_node(obj);
3273
+ if(obj && obj !== -1) {
3274
+ if(obj.data("jstree-is-loading")) { return; }
3275
+ else { obj.data("jstree-is-loading",true); }
3276
+ }
3277
+ switch(!0) {
3278
+ case (!s.data && !s.ajax):
3279
+ if(!obj || obj == -1) {
3280
+ this.get_container()
3281
+ .children("ul").empty()
3282
+ .append(this.data.html_data.original_container_html)
3283
+ .find("li, a").filter(function () { return this.firstChild.tagName !== "INS"; }).prepend("<ins class='jstree-icon'>&#160;</ins>").end()
3284
+ .filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon");
3285
+ this.clean_node();
3286
+ }
3287
+ if(s_call) { s_call.call(this); }
3288
+ break;
3289
+ case (!!s.data && !s.ajax) || (!!s.data && !!s.ajax && (!obj || obj === -1)):
3290
+ if(!obj || obj == -1) {
3291
+ d = $(s.data);
3292
+ if(!d.is("ul")) { d = $("<ul>").append(d); }
3293
+ this.get_container()
3294
+ .children("ul").empty().append(d.children())
3295
+ .find("li, a").filter(function () { return this.firstChild.tagName !== "INS"; }).prepend("<ins class='jstree-icon'>&#160;</ins>").end()
3296
+ .filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon");
3297
+ this.clean_node();
3298
+ }
3299
+ if(s_call) { s_call.call(this); }
3300
+ break;
3301
+ case (!s.data && !!s.ajax) || (!!s.data && !!s.ajax && obj && obj !== -1):
3302
+ obj = this._get_node(obj);
3303
+ error_func = function (x, t, e) {
3304
+ var ef = this.get_settings().html_data.ajax.error;
3305
+ if(ef) { ef.call(this, x, t, e); }
3306
+ if(obj != -1 && obj.length) {
3307
+ obj.children(".jstree-loading").removeClass("jstree-loading");
3308
+ obj.data("jstree-is-loading",false);
3309
+ if(t === "success" && s.correct_state) { obj.removeClass("jstree-open jstree-closed").addClass("jstree-leaf"); }
3310
+ }
3311
+ else {
3312
+ if(t === "success" && s.correct_state) { this.get_container().children("ul").empty(); }
3313
+ }
3314
+ if(e_call) { e_call.call(this); }
3315
+ };
3316
+ success_func = function (d, t, x) {
3317
+ var sf = this.get_settings().html_data.ajax.success;
3318
+ if(sf) { d = sf.call(this,d,t,x) || d; }
3319
+ if(d == "") {
3320
+ return error_func.call(this, x, t, "");
3321
+ }
3322
+ if(d) {
3323
+ d = $(d);
3324
+ if(!d.is("ul")) { d = $("<ul>").append(d); }
3325
+ if(obj == -1 || !obj) { this.get_container().children("ul").empty().append(d.children()).find("li, a").filter(function () { return this.firstChild.tagName !== "INS"; }).prepend("<ins class='jstree-icon'>&#160;</ins>").end().filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon"); }
3326
+ else { obj.children(".jstree-loading").removeClass("jstree-loading"); obj.append(d).find("li, a").filter(function () { return this.firstChild.tagName !== "INS"; }).prepend("<ins class='jstree-icon'>&#160;</ins>").end().filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon"); obj.data("jstree-is-loading",false); }
3327
+ this.clean_node(obj);
3328
+ if(s_call) { s_call.call(this); }
3329
+ }
3330
+ else {
3331
+ if(obj && obj !== -1) {
3332
+ obj.children(".jstree-loading").removeClass("jstree-loading");
3333
+ obj.data("jstree-is-loading",false);
3334
+ if(s.correct_state) {
3335
+ obj.removeClass("jstree-open jstree-closed").addClass("jstree-leaf");
3336
+ if(s_call) { s_call.call(this); }
3337
+ }
3338
+ }
3339
+ else {
3340
+ if(s.correct_state) {
3341
+ this.get_container().children("ul").empty();
3342
+ if(s_call) { s_call.call(this); }
3343
+ }
3344
+ }
3345
+ }
3346
+ };
3347
+ s.ajax.context = this;
3348
+ s.ajax.error = error_func;
3349
+ s.ajax.success = success_func;
3350
+ if(!s.ajax.dataType) { s.ajax.dataType = "html"; }
3351
+ if($.isFunction(s.ajax.url)) { s.ajax.url = s.ajax.url.call(this, obj); }
3352
+ if($.isFunction(s.ajax.data)) { s.ajax.data = s.ajax.data.call(this, obj); }
3353
+ $.ajax(s.ajax);
3354
+ break;
3355
+ }
3356
+ }
3357
+ }
3358
+ });
3359
+ // include the HTML data plugin by default
3360
+ $.jstree.defaults.plugins.push("html_data");
3361
+ })(jQuery);
3362
+ //*/
3363
+
3364
+ /*
3365
+ * jsTree themeroller plugin 1.0
3366
+ * Adds support for jQuery UI themes. Include this at the end of your plugins list, also make sure "themes" is not included.
3367
+ */
3368
+ (function ($) {
3369
+ $.jstree.plugin("themeroller", {
3370
+ __init : function () {
3371
+ var s = this._get_settings().themeroller;
3372
+ this.get_container()
3373
+ .addClass("ui-widget-content")
3374
+ .delegate("a","mouseenter.jstree", function () {
3375
+ $(this).addClass(s.item_h);
3376
+ })
3377
+ .delegate("a","mouseleave.jstree", function () {
3378
+ $(this).removeClass(s.item_h);
3379
+ })
3380
+ .bind("open_node.jstree create_node.jstree", $.proxy(function (e, data) {
3381
+ this._themeroller(data.rslt.obj);
3382
+ }, this))
3383
+ .bind("loaded.jstree refresh.jstree", $.proxy(function (e) {
3384
+ this._themeroller();
3385
+ }, this))
3386
+ .bind("close_node.jstree", $.proxy(function (e, data) {
3387
+ data.rslt.obj.children("ins").removeClass(s.opened).addClass(s.closed);
3388
+ }, this))
3389
+ .bind("select_node.jstree", $.proxy(function (e, data) {
3390
+ data.rslt.obj.children("a").addClass(s.item_a);
3391
+ }, this))
3392
+ .bind("deselect_node.jstree deselect_all.jstree", $.proxy(function (e, data) {
3393
+ this.get_container()
3394
+ .find("." + s.item_a).removeClass(s.item_a).end()
3395
+ .find(".jstree-clicked").addClass(s.item_a);
3396
+ }, this))
3397
+ .bind("move_node.jstree", $.proxy(function (e, data) {
3398
+ this._themeroller(data.rslt.o);
3399
+ }, this));
3400
+ },
3401
+ __destroy : function () {
3402
+ var s = this._get_settings().themeroller,
3403
+ c = [ "ui-icon" ];
3404
+ $.each(s, function (i, v) {
3405
+ v = v.split(" ");
3406
+ if(v.length) { c = c.concat(v); }
3407
+ });
3408
+ this.get_container()
3409
+ .removeClass("ui-widget-content")
3410
+ .find("." + c.join(", .")).removeClass(c.join(" "));
3411
+ },
3412
+ _fn : {
3413
+ _themeroller : function (obj) {
3414
+ var s = this._get_settings().themeroller;
3415
+ obj = !obj || obj == -1 ? this.get_container() : this._get_node(obj).parent();
3416
+ obj
3417
+ .find("li.jstree-closed > ins.jstree-icon").removeClass(s.opened).addClass("ui-icon " + s.closed).end()
3418
+ .find("li.jstree-open > ins.jstree-icon").removeClass(s.closed).addClass("ui-icon " + s.opened).end()
3419
+ .find("a").addClass(s.item)
3420
+ .children("ins.jstree-icon").addClass("ui-icon " + s.item_icon);
3421
+ }
3422
+ },
3423
+ defaults : {
3424
+ "opened" : "ui-icon-triangle-1-se",
3425
+ "closed" : "ui-icon-triangle-1-e",
3426
+ "item" : "ui-state-default",
3427
+ "item_h" : "ui-state-hover",
3428
+ "item_a" : "ui-state-active",
3429
+ "item_icon" : "ui-icon-folder-collapsed"
3430
+ }
3431
+ });
3432
+ $(function() {
3433
+ var css_string = '.jstree .ui-icon { overflow:visible; } .jstree a { padding:0 2px; }';
3434
+ $.vakata.css.add_sheet({ str : css_string });
3435
+ });
3436
+ })(jQuery);
3437
+ //*/
3438
+
3439
+ /*
3440
+ * jsTree unique plugin 1.0
3441
+ * Forces different names amongst siblings (still a bit experimental)
3442
+ * NOTE: does not check language versions (it will not be possible to have nodes with the same title, even in different languages)
3443
+ */
3444
+ (function ($) {
3445
+ $.jstree.plugin("unique", {
3446
+ __init : function () {
3447
+ this.get_container()
3448
+ .bind("before.jstree", $.proxy(function (e, data) {
3449
+ var nms = [], res = true, p, t;
3450
+ if(data.func == "move_node") {
3451
+ // obj, ref, position, is_copy, is_prepared, skip_check
3452
+ if(data.args[4] === true) {
3453
+ if(data.args[0].o && data.args[0].o.length) {
3454
+ data.args[0].o.children("a").each(function () { nms.push($(this).text().replace(/^\s+/g,"")); });
3455
+ res = this._check_unique(nms, data.args[0].np.find("> ul > li").not(data.args[0].o));
3456
+ }
3457
+ }
3458
+ }
3459
+ if(data.func == "create_node") {
3460
+ // obj, position, js, callback, is_loaded
3461
+ if(data.args[4] || this._is_loaded(data.args[0])) {
3462
+ p = this._get_node(data.args[0]);
3463
+ if(data.args[1] && (data.args[1] === "before" || data.args[1] === "after")) {
3464
+ p = this._get_parent(data.args[0]);
3465
+ if(!p || p === -1) { p = this.get_container(); }
3466
+ }
3467
+ if(typeof data.args[2] === "string") { nms.push(data.args[2]); }
3468
+ else if(!data.args[2] || !data.args[2].data) { nms.push(this._get_settings().core.strings.new_node); }
3469
+ else { nms.push(data.args[2].data); }
3470
+ res = this._check_unique(nms, p.find("> ul > li"));
3471
+ }
3472
+ }
3473
+ if(data.func == "rename_node") {
3474
+ // obj, val
3475
+ nms.push(data.args[1]);
3476
+ t = this._get_node(data.args[0]);
3477
+ p = this._get_parent(t);
3478
+ if(!p || p === -1) { p = this.get_container(); }
3479
+ res = this._check_unique(nms, p.find("> ul > li").not(t));
3480
+ }
3481
+ if(!res) {
3482
+ e.stopPropagation();
3483
+ return false;
3484
+ }
3485
+ }, this));
3486
+ },
3487
+ _fn : {
3488
+ _check_unique : function (nms, p) {
3489
+ var cnms = [];
3490
+ p.children("a").each(function () { cnms.push($(this).text().replace(/^\s+/g,"")); });
3491
+ if(!cnms.length || !nms.length) { return true; }
3492
+ cnms = cnms.sort().join(",,").replace(/(,|^)([^,]+)(,,\2)+(,|$)/g,"$1$2$4").replace(/,,+/g,",").replace(/,$/,"").split(",");
3493
+ if((cnms.length + nms.length) != cnms.concat(nms).sort().join(",,").replace(/(,|^)([^,]+)(,,\2)+(,|$)/g,"$1$2$4").replace(/,,+/g,",").replace(/,$/,"").split(",").length) {
3494
+ return false;
3495
+ }
3496
+ return true;
3497
+ },
3498
+ check_move : function () {
3499
+ if(!this.__call_old()) { return false; }
3500
+ var p = this._get_move(), nms = [];
3501
+ if(p.o && p.o.length) {
3502
+ p.o.children("a").each(function () { nms.push($(this).text().replace(/^\s+/g,"")); });
3503
+ return this._check_unique(nms, p.np.find("> ul > li").not(p.o));
3504
+ }
3505
+ return true;
3506
+ }
3507
+ }
3508
+ });
3509
+ })(jQuery);
3510
+ //*/