sunspot_solr 2.2.2 → 2.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (256) hide show
  1. checksums.yaml +4 -4
  2. data/bin/sunspot-solr +2 -6
  3. data/lib/sunspot/solr/server.rb +2 -3
  4. data/solr/README.txt +181 -181
  5. data/solr/bin/post +29 -19
  6. data/solr/bin/solr +247 -428
  7. data/solr/bin/solr.cmd +102 -256
  8. data/solr/bin/solr.in.cmd +15 -7
  9. data/solr/bin/solr.in.sh +26 -12
  10. data/solr/server/README.txt +110 -113
  11. data/solr/server/contexts/solr-jetty-context.xml +8 -8
  12. data/solr/server/etc/jetty-http.xml +47 -0
  13. data/solr/server/etc/jetty-https-ssl.xml +175 -159
  14. data/solr/server/etc/jetty-https.xml +53 -0
  15. data/solr/server/etc/jetty-ssl.xml +46 -0
  16. data/solr/server/etc/jetty.xml +189 -167
  17. data/solr/server/etc/webdefault.xml +527 -527
  18. data/solr/server/lib/javax.servlet-api-3.1.0.jar +0 -0
  19. data/solr/server/lib/jetty-continuation-9.2.11.v20150529.jar +0 -0
  20. data/solr/server/lib/jetty-deploy-9.2.11.v20150529.jar +0 -0
  21. data/solr/server/lib/jetty-http-9.2.11.v20150529.jar +0 -0
  22. data/solr/server/lib/jetty-io-9.2.11.v20150529.jar +0 -0
  23. data/solr/server/lib/jetty-jmx-9.2.11.v20150529.jar +0 -0
  24. data/solr/server/lib/jetty-rewrite-9.2.11.v20150529.jar +0 -0
  25. data/solr/server/lib/jetty-security-9.2.11.v20150529.jar +0 -0
  26. data/solr/server/lib/jetty-server-9.2.11.v20150529.jar +0 -0
  27. data/solr/server/lib/jetty-servlet-9.2.11.v20150529.jar +0 -0
  28. data/solr/server/lib/jetty-servlets-9.2.11.v20150529.jar +0 -0
  29. data/solr/server/lib/jetty-util-9.2.11.v20150529.jar +0 -0
  30. data/solr/server/lib/jetty-webapp-9.2.11.v20150529.jar +0 -0
  31. data/solr/server/lib/jetty-xml-9.2.11.v20150529.jar +0 -0
  32. data/solr/server/modules/http.mod +9 -0
  33. data/solr/server/modules/https.mod +9 -0
  34. data/solr/server/modules/server.mod +11 -0
  35. data/solr/server/modules/ssl.mod +9 -0
  36. data/solr/server/resources/jetty-logging.properties +1 -0
  37. data/solr/server/resources/log4j.properties +24 -24
  38. data/solr/server/solr-webapp/webapp/WEB-INF/lib/commons-exec-1.3.jar +0 -0
  39. data/solr/server/solr-webapp/webapp/WEB-INF/lib/{hadoop-annotations-2.3.0.jar → hadoop-annotations-2.6.0.jar} +0 -0
  40. data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-auth-2.6.0.jar +0 -0
  41. data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-common-2.6.0.jar +0 -0
  42. data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-hdfs-2.6.0.jar +0 -0
  43. data/solr/server/solr-webapp/webapp/WEB-INF/lib/htrace-core-3.0.4.jar +0 -0
  44. data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpclient-4.4.1.jar +0 -0
  45. data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpcore-4.4.1.jar +0 -0
  46. data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpmime-4.4.1.jar +0 -0
  47. data/solr/server/solr-webapp/webapp/WEB-INF/lib/jackson-core-2.5.4.jar +0 -0
  48. data/solr/server/solr-webapp/webapp/WEB-INF/lib/jackson-dataformat-smile-2.5.4.jar +0 -0
  49. data/solr/server/solr-webapp/webapp/WEB-INF/lib/{lucene-analyzers-common-5.0.0.jar → lucene-analyzers-common-5.3.1.jar} +0 -0
  50. data/solr/server/solr-webapp/webapp/WEB-INF/lib/{lucene-analyzers-kuromoji-5.0.0.jar → lucene-analyzers-kuromoji-5.3.1.jar} +0 -0
  51. data/solr/server/solr-webapp/webapp/WEB-INF/lib/{lucene-analyzers-phonetic-5.0.0.jar → lucene-analyzers-phonetic-5.3.1.jar} +0 -0
  52. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-backward-codecs-5.3.1.jar +0 -0
  53. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-codecs-5.3.1.jar +0 -0
  54. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-core-5.3.1.jar +0 -0
  55. data/solr/server/solr-webapp/webapp/WEB-INF/lib/{lucene-expressions-5.0.0.jar → lucene-expressions-5.3.1.jar} +0 -0
  56. data/solr/server/solr-webapp/webapp/WEB-INF/lib/{lucene-grouping-5.0.0.jar → lucene-grouping-5.3.1.jar} +0 -0
  57. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-highlighter-5.3.1.jar +0 -0
  58. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-join-5.3.1.jar +0 -0
  59. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-memory-5.3.1.jar +0 -0
  60. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-misc-5.3.1.jar +0 -0
  61. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-queries-5.3.1.jar +0 -0
  62. data/solr/server/solr-webapp/webapp/WEB-INF/lib/{lucene-queryparser-5.0.0.jar → lucene-queryparser-5.3.1.jar} +0 -0
  63. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-sandbox-5.3.1.jar +0 -0
  64. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-spatial-5.3.1.jar +0 -0
  65. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-suggest-5.3.1.jar +0 -0
  66. data/solr/server/solr-webapp/webapp/WEB-INF/lib/org.restlet-2.3.0.jar +0 -0
  67. data/solr/server/solr-webapp/webapp/WEB-INF/lib/org.restlet.ext.servlet-2.3.0.jar +0 -0
  68. data/solr/server/solr-webapp/webapp/WEB-INF/lib/solr-core-5.3.1.jar +0 -0
  69. data/solr/server/solr-webapp/webapp/WEB-INF/lib/solr-solrj-5.3.1.jar +0 -0
  70. data/solr/server/solr-webapp/webapp/WEB-INF/lib/t-digest-3.1.jar +0 -0
  71. data/solr/server/solr-webapp/webapp/WEB-INF/web.xml +169 -181
  72. data/solr/server/solr-webapp/webapp/WEB-INF/weblogic.xml +28 -28
  73. data/solr/server/solr-webapp/webapp/admin.html +164 -163
  74. data/solr/server/solr-webapp/webapp/css/angular/analysis.css +304 -0
  75. data/solr/server/solr-webapp/webapp/css/angular/chosen.css +465 -0
  76. data/solr/server/solr-webapp/webapp/css/angular/cloud.css +398 -0
  77. data/solr/server/solr-webapp/webapp/css/angular/common.css +724 -0
  78. data/solr/server/solr-webapp/webapp/css/angular/cores.css +233 -0
  79. data/solr/server/solr-webapp/webapp/css/angular/dataimport.css +370 -0
  80. data/solr/server/solr-webapp/webapp/css/angular/documents.css +179 -0
  81. data/solr/server/solr-webapp/webapp/css/angular/files.css +53 -0
  82. data/solr/server/solr-webapp/webapp/css/angular/index.css +206 -0
  83. data/solr/server/solr-webapp/webapp/css/angular/logging.css +376 -0
  84. data/solr/server/solr-webapp/webapp/css/angular/menu.css +321 -0
  85. data/solr/server/solr-webapp/webapp/css/angular/plugins.css +212 -0
  86. data/solr/server/solr-webapp/webapp/css/angular/query.css +162 -0
  87. data/solr/server/solr-webapp/webapp/css/angular/replication.css +500 -0
  88. data/solr/server/solr-webapp/webapp/css/angular/schema-browser.css +567 -0
  89. data/solr/server/solr-webapp/webapp/css/angular/segments.css +173 -0
  90. data/solr/server/solr-webapp/webapp/css/angular/threads.css +161 -0
  91. data/solr/server/solr-webapp/webapp/css/chosen.css +421 -421
  92. data/solr/server/solr-webapp/webapp/css/styles/analysis.css +311 -311
  93. data/solr/server/solr-webapp/webapp/css/styles/cloud.css +410 -410
  94. data/solr/server/solr-webapp/webapp/css/styles/common.css +701 -701
  95. data/solr/server/solr-webapp/webapp/css/styles/cores.css +244 -244
  96. data/solr/server/solr-webapp/webapp/css/styles/dashboard.css +155 -155
  97. data/solr/server/solr-webapp/webapp/css/styles/dataimport.css +403 -403
  98. data/solr/server/solr-webapp/webapp/css/styles/documents.css +197 -197
  99. data/solr/server/solr-webapp/webapp/css/styles/files.css +54 -54
  100. data/solr/server/solr-webapp/webapp/css/styles/index.css +207 -207
  101. data/solr/server/solr-webapp/webapp/css/styles/java-properties.css +52 -52
  102. data/solr/server/solr-webapp/webapp/css/styles/logging.css +391 -391
  103. data/solr/server/solr-webapp/webapp/css/styles/menu.css +329 -328
  104. data/solr/server/solr-webapp/webapp/css/styles/plugins.css +195 -195
  105. data/solr/server/solr-webapp/webapp/css/styles/query.css +173 -173
  106. data/solr/server/solr-webapp/webapp/css/styles/replication.css +515 -515
  107. data/solr/server/solr-webapp/webapp/css/styles/schema-browser.css +578 -578
  108. data/solr/server/solr-webapp/webapp/css/styles/segments.css +145 -0
  109. data/solr/server/solr-webapp/webapp/css/styles/threads.css +172 -172
  110. data/solr/server/solr-webapp/webapp/img/chosen-sprite-2x.png +0 -0
  111. data/solr/server/solr-webapp/webapp/img/filetypes/README +27 -27
  112. data/solr/server/solr-webapp/webapp/img/solr.svg +39 -39
  113. data/solr/server/solr-webapp/webapp/index.html +208 -0
  114. data/solr/server/solr-webapp/webapp/js/angular/app.js +713 -0
  115. data/solr/server/solr-webapp/webapp/js/angular/controllers/analysis.js +199 -0
  116. data/solr/server/solr-webapp/webapp/js/angular/controllers/cloud.js +528 -0
  117. data/solr/server/solr-webapp/webapp/js/angular/controllers/core-overview.js +225 -0
  118. data/solr/server/solr-webapp/webapp/js/angular/controllers/cores.js +465 -0
  119. data/solr/server/solr-webapp/webapp/js/angular/controllers/dataimport.js +284 -0
  120. data/solr/server/solr-webapp/webapp/js/angular/controllers/documents.js +139 -0
  121. data/solr/server/solr-webapp/webapp/js/angular/controllers/files.js +92 -0
  122. data/solr/server/solr-webapp/webapp/js/angular/controllers/index.js +95 -0
  123. data/solr/server/solr-webapp/webapp/js/angular/controllers/java-properties.js +45 -0
  124. data/solr/server/solr-webapp/webapp/js/angular/controllers/logging.js +146 -0
  125. data/solr/server/solr-webapp/webapp/js/angular/controllers/plugins.js +166 -0
  126. data/solr/server/solr-webapp/webapp/js/angular/controllers/query.js +99 -0
  127. data/solr/server/solr-webapp/webapp/js/angular/controllers/replication.js +227 -0
  128. data/solr/server/solr-webapp/webapp/js/angular/controllers/schema-browser.js +432 -0
  129. data/solr/server/solr-webapp/webapp/js/angular/controllers/segments.js +94 -0
  130. data/solr/server/solr-webapp/webapp/js/angular/controllers/threads.js +51 -0
  131. data/solr/server/solr-webapp/webapp/js/angular/services.js +214 -0
  132. data/solr/server/solr-webapp/webapp/js/lib/ZeroClipboard.js +342 -342
  133. data/solr/server/solr-webapp/webapp/js/lib/chosen.js +982 -982
  134. data/solr/server/solr-webapp/webapp/js/lib/console.js +29 -29
  135. data/solr/server/solr-webapp/webapp/js/lib/d3.js +9373 -9373
  136. data/solr/server/solr-webapp/webapp/js/lib/highlight.js +31 -31
  137. data/solr/server/solr-webapp/webapp/js/lib/jquery-1.7.2.min.js +30 -30
  138. data/solr/server/solr-webapp/webapp/js/lib/jquery.ajaxfileupload.js +184 -184
  139. data/solr/server/solr-webapp/webapp/js/lib/jquery.blockUI.js +523 -523
  140. data/solr/server/solr-webapp/webapp/js/lib/jquery.cookie.js +71 -71
  141. data/solr/server/solr-webapp/webapp/js/lib/jquery.form.js +806 -806
  142. data/solr/server/solr-webapp/webapp/js/lib/jquery.jstree.js +3534 -3534
  143. data/solr/server/solr-webapp/webapp/js/lib/jquery.sammy.js +1863 -1863
  144. data/solr/server/solr-webapp/webapp/js/lib/jquery.timeago.js +189 -189
  145. data/solr/server/solr-webapp/webapp/js/lib/linker.js +48 -48
  146. data/solr/server/solr-webapp/webapp/js/lib/naturalSort.js +82 -0
  147. data/solr/server/solr-webapp/webapp/js/lib/order.js +216 -216
  148. data/solr/server/solr-webapp/webapp/js/main.js +60 -58
  149. data/solr/server/solr-webapp/webapp/js/require.js +11349 -11349
  150. data/solr/server/solr-webapp/webapp/js/scripts/analysis.js +545 -545
  151. data/solr/server/solr-webapp/webapp/js/scripts/app.js +680 -679
  152. data/solr/server/solr-webapp/webapp/js/scripts/cloud.js +877 -877
  153. data/solr/server/solr-webapp/webapp/js/scripts/cores.js +719 -719
  154. data/solr/server/solr-webapp/webapp/js/scripts/dashboard.js +562 -562
  155. data/solr/server/solr-webapp/webapp/js/scripts/dataimport.js +812 -812
  156. data/solr/server/solr-webapp/webapp/js/scripts/documents.js +370 -370
  157. data/solr/server/solr-webapp/webapp/js/scripts/files.js +265 -265
  158. data/solr/server/solr-webapp/webapp/js/scripts/index.js +340 -340
  159. data/solr/server/solr-webapp/webapp/js/scripts/java-properties.js +106 -106
  160. data/solr/server/solr-webapp/webapp/js/scripts/logging.js +578 -576
  161. data/solr/server/solr-webapp/webapp/js/scripts/ping.js +72 -72
  162. data/solr/server/solr-webapp/webapp/js/scripts/plugins.js +462 -462
  163. data/solr/server/solr-webapp/webapp/js/scripts/query.js +229 -229
  164. data/solr/server/solr-webapp/webapp/js/scripts/replication.js +527 -527
  165. data/solr/server/solr-webapp/webapp/js/scripts/schema-browser.js +1229 -1229
  166. data/solr/server/solr-webapp/webapp/js/scripts/segments.js +206 -0
  167. data/solr/server/solr-webapp/webapp/js/scripts/threads.js +158 -158
  168. data/solr/server/solr-webapp/webapp/libs/angular-chosen.js +139 -0
  169. data/solr/server/solr-webapp/webapp/libs/angular-cookies.js +229 -0
  170. data/solr/server/solr-webapp/webapp/libs/angular-cookies.min.js +31 -0
  171. data/solr/server/solr-webapp/webapp/libs/angular-resource.min.js +36 -0
  172. data/solr/server/solr-webapp/webapp/libs/angular-route.js +1018 -0
  173. data/solr/server/solr-webapp/webapp/libs/angular-route.min.js +38 -0
  174. data/solr/server/solr-webapp/webapp/libs/angular-sanitize.js +703 -0
  175. data/solr/server/solr-webapp/webapp/libs/angular-sanitize.min.js +39 -0
  176. data/solr/server/solr-webapp/webapp/libs/angular.js +26093 -0
  177. data/solr/server/solr-webapp/webapp/libs/angular.min.js +273 -0
  178. data/solr/server/solr-webapp/webapp/libs/chosen.jquery.js +1194 -0
  179. data/solr/server/solr-webapp/webapp/libs/chosen.jquery.min.js +30 -0
  180. data/solr/server/solr-webapp/webapp/libs/d3.js +9373 -0
  181. data/solr/server/solr-webapp/webapp/libs/highlight.js +31 -0
  182. data/solr/server/solr-webapp/webapp/libs/jquery-2.1.3.min.js +29 -0
  183. data/solr/server/solr-webapp/webapp/libs/jquery.jstree.js +3534 -0
  184. data/solr/server/solr-webapp/webapp/libs/ngtimeago.js +102 -0
  185. data/solr/server/solr-webapp/webapp/partials/analysis.html +128 -0
  186. data/solr/server/solr-webapp/webapp/partials/cloud.html +104 -0
  187. data/solr/server/solr-webapp/webapp/partials/core_overview.html +227 -0
  188. data/solr/server/solr-webapp/webapp/partials/cores.html +231 -0
  189. data/solr/server/solr-webapp/webapp/partials/dataimport.html +209 -0
  190. data/solr/server/solr-webapp/webapp/partials/documents.html +118 -0
  191. data/solr/server/solr-webapp/webapp/partials/files.html +47 -0
  192. data/solr/server/solr-webapp/webapp/partials/index.html +261 -0
  193. data/solr/server/solr-webapp/webapp/partials/java-properties.html +27 -0
  194. data/solr/server/solr-webapp/webapp/partials/logging-levels.html +56 -0
  195. data/solr/server/solr-webapp/webapp/partials/logging.html +56 -0
  196. data/solr/server/solr-webapp/webapp/partials/plugins.html +72 -0
  197. data/solr/server/solr-webapp/webapp/partials/query.html +356 -0
  198. data/solr/server/solr-webapp/webapp/partials/replication.html +239 -0
  199. data/solr/server/solr-webapp/webapp/partials/schema-browser.html +206 -0
  200. data/solr/server/solr-webapp/webapp/partials/segments.html +99 -0
  201. data/solr/server/solr-webapp/webapp/partials/threads.html +65 -0
  202. data/solr/server/solr-webapp/webapp/tpl/analysis.html +83 -83
  203. data/solr/server/solr-webapp/webapp/tpl/cloud.html +87 -87
  204. data/solr/server/solr-webapp/webapp/tpl/cores.html +226 -226
  205. data/solr/server/solr-webapp/webapp/tpl/dashboard.html +201 -201
  206. data/solr/server/solr-webapp/webapp/tpl/dataimport.html +183 -183
  207. data/solr/server/solr-webapp/webapp/tpl/documents.html +107 -107
  208. data/solr/server/solr-webapp/webapp/tpl/files.html +44 -44
  209. data/solr/server/solr-webapp/webapp/tpl/index.html +250 -250
  210. data/solr/server/solr-webapp/webapp/tpl/logging.html +23 -23
  211. data/solr/server/solr-webapp/webapp/tpl/plugins.html +39 -39
  212. data/solr/server/solr-webapp/webapp/tpl/query.html +361 -361
  213. data/solr/server/solr-webapp/webapp/tpl/replication.html +216 -216
  214. data/solr/server/solr-webapp/webapp/tpl/schema-browser.html +192 -192
  215. data/solr/server/solr-webapp/webapp/tpl/segments.html +49 -0
  216. data/solr/server/solr-webapp/webapp/tpl/threads.html +56 -56
  217. data/solr/server/solr/README.txt +77 -77
  218. data/solr/server/solr/solr.xml +51 -51
  219. data/solr/server/solr/zoo.cfg +17 -17
  220. data/solr/server/start.jar +0 -0
  221. data/spec/server_spec.rb +3 -8
  222. metadata +132 -43
  223. data/solr/server/lib/jetty-continuation-8.1.10.v20130312.jar +0 -0
  224. data/solr/server/lib/jetty-deploy-8.1.10.v20130312.jar +0 -0
  225. data/solr/server/lib/jetty-http-8.1.10.v20130312.jar +0 -0
  226. data/solr/server/lib/jetty-io-8.1.10.v20130312.jar +0 -0
  227. data/solr/server/lib/jetty-jmx-8.1.10.v20130312.jar +0 -0
  228. data/solr/server/lib/jetty-security-8.1.10.v20130312.jar +0 -0
  229. data/solr/server/lib/jetty-server-8.1.10.v20130312.jar +0 -0
  230. data/solr/server/lib/jetty-servlet-8.1.10.v20130312.jar +0 -0
  231. data/solr/server/lib/jetty-util-8.1.10.v20130312.jar +0 -0
  232. data/solr/server/lib/jetty-webapp-8.1.10.v20130312.jar +0 -0
  233. data/solr/server/lib/jetty-xml-8.1.10.v20130312.jar +0 -0
  234. data/solr/server/lib/servlet-api-3.0.jar +0 -0
  235. data/solr/server/solr-webapp/webapp/.gitignore +0 -1
  236. data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-auth-2.3.0.jar +0 -0
  237. data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-common-2.3.0.jar +0 -0
  238. data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-hdfs-2.3.0.jar +0 -0
  239. data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpclient-4.3.1.jar +0 -0
  240. data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpcore-4.3.jar +0 -0
  241. data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpmime-4.3.1.jar +0 -0
  242. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-backward-codecs-5.0.0.jar +0 -0
  243. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-codecs-5.0.0.jar +0 -0
  244. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-core-5.0.0.jar +0 -0
  245. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-highlighter-5.0.0.jar +0 -0
  246. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-join-5.0.0.jar +0 -0
  247. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-memory-5.0.0.jar +0 -0
  248. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-misc-5.0.0.jar +0 -0
  249. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-queries-5.0.0.jar +0 -0
  250. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-spatial-5.0.0.jar +0 -0
  251. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-suggest-5.0.0.jar +0 -0
  252. data/solr/server/solr-webapp/webapp/WEB-INF/lib/org.restlet-2.1.1.jar +0 -0
  253. data/solr/server/solr-webapp/webapp/WEB-INF/lib/org.restlet.ext.servlet-2.1.1.jar +0 -0
  254. data/solr/server/solr-webapp/webapp/WEB-INF/lib/solr-core-5.0.0.jar +0 -0
  255. data/solr/server/solr-webapp/webapp/WEB-INF/lib/solr-solrj-5.0.0.jar +0 -0
  256. data/solr/server/webapps/solr.war +0 -0
@@ -0,0 +1,31 @@
1
+ /*
2
+
3
+ Copyright (c) 2006, Ivan Sagalaev
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ * Redistributions of source code must retain the above copyright
10
+ notice, this list of conditions and the following disclaimer.
11
+ * Redistributions in binary form must reproduce the above copyright
12
+ notice, this list of conditions and the following disclaimer in the
13
+ documentation and/or other materials provided with the distribution.
14
+ * Neither the name of highlight.js nor the names of its contributors
15
+ may be used to endorse or promote products derived from this software
16
+ without specific prior written permission.
17
+
18
+ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
19
+ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
22
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
+
29
+ */
30
+
31
+ var hljs=new function(){function l(o){return o.replace(/&/gm,"&amp;").replace(/</gm,"&lt;").replace(/>/gm,"&gt;")}function b(p){for(var o=p.firstChild;o;o=o.nextSibling){if(o.nodeName=="CODE"){return o}if(!(o.nodeType==3&&o.nodeValue.match(/\s+/))){break}}}function h(p,o){return Array.prototype.map.call(p.childNodes,function(q){if(q.nodeType==3){return o?q.nodeValue.replace(/\n/g,""):q.nodeValue}if(q.nodeName=="BR"){return"\n"}return h(q,o)}).join("")}function a(q){var p=(q.className+" "+q.parentNode.className).split(/\s+/);p=p.map(function(r){return r.replace(/^language-/,"")});for(var o=0;o<p.length;o++){if(e[p[o]]||p[o]=="no-highlight"){return p[o]}}}function c(q){var o=[];(function p(r,s){for(var t=r.firstChild;t;t=t.nextSibling){if(t.nodeType==3){s+=t.nodeValue.length}else{if(t.nodeName=="BR"){s+=1}else{if(t.nodeType==1){o.push({event:"start",offset:s,node:t});s=p(t,s);o.push({event:"stop",offset:s,node:t})}}}}return s})(q,0);return o}function j(x,v,w){var p=0;var y="";var r=[];function t(){if(x.length&&v.length){if(x[0].offset!=v[0].offset){return(x[0].offset<v[0].offset)?x:v}else{return v[0].event=="start"?x:v}}else{return x.length?x:v}}function s(A){function z(B){return" "+B.nodeName+'="'+l(B.value)+'"'}return"<"+A.nodeName+Array.prototype.map.call(A.attributes,z).join("")+">"}while(x.length||v.length){var u=t().splice(0,1)[0];y+=l(w.substr(p,u.offset-p));p=u.offset;if(u.event=="start"){y+=s(u.node);r.push(u.node)}else{if(u.event=="stop"){var o,q=r.length;do{q--;o=r[q];y+=("</"+o.nodeName.toLowerCase()+">")}while(o!=u.node);r.splice(q,1);while(q<r.length){y+=s(r[q]);q++}}}}return y+l(w.substr(p))}function f(q){function o(s,r){return RegExp(s,"m"+(q.cI?"i":"")+(r?"g":""))}function p(y,w){if(y.compiled){return}y.compiled=true;var s=[];if(y.k){var r={};function z(A,t){t.split(" ").forEach(function(B){var C=B.split("|");r[C[0]]=[A,C[1]?Number(C[1]):1];s.push(C[0])})}y.lR=o(y.l||hljs.IR,true);if(typeof y.k=="string"){z("keyword",y.k)}else{for(var x in y.k){if(!y.k.hasOwnProperty(x)){continue}z(x,y.k[x])}}y.k=r}if(w){if(y.bWK){y.b="\\b("+s.join("|")+")\\s"}y.bR=o(y.b?y.b:"\\B|\\b");if(!y.e&&!y.eW){y.e="\\B|\\b"}if(y.e){y.eR=o(y.e)}y.tE=y.e||"";if(y.eW&&w.tE){y.tE+=(y.e?"|":"")+w.tE}}if(y.i){y.iR=o(y.i)}if(y.r===undefined){y.r=1}if(!y.c){y.c=[]}for(var v=0;v<y.c.length;v++){if(y.c[v]=="self"){y.c[v]=y}p(y.c[v],y)}if(y.starts){p(y.starts,w)}var u=[];for(var v=0;v<y.c.length;v++){u.push(y.c[v].b)}if(y.tE){u.push(y.tE)}if(y.i){u.push(y.i)}y.t=u.length?o(u.join("|"),true):{exec:function(t){return null}}}p(q)}function d(D,E){function o(r,M){for(var L=0;L<M.c.length;L++){var K=M.c[L].bR.exec(r);if(K&&K.index==0){return M.c[L]}}}function s(K,r){if(K.e&&K.eR.test(r)){return K}if(K.eW){return s(K.parent,r)}}function t(r,K){return K.i&&K.iR.test(r)}function y(L,r){var K=F.cI?r[0].toLowerCase():r[0];return L.k.hasOwnProperty(K)&&L.k[K]}function G(){var K=l(w);if(!A.k){return K}var r="";var N=0;A.lR.lastIndex=0;var L=A.lR.exec(K);while(L){r+=K.substr(N,L.index-N);var M=y(A,L);if(M){v+=M[1];r+='<span class="'+M[0]+'">'+L[0]+"</span>"}else{r+=L[0]}N=A.lR.lastIndex;L=A.lR.exec(K)}return r+K.substr(N)}function z(){if(A.sL&&!e[A.sL]){return l(w)}var r=A.sL?d(A.sL,w):g(w);if(A.r>0){v+=r.keyword_count;B+=r.r}return'<span class="'+r.language+'">'+r.value+"</span>"}function J(){return A.sL!==undefined?z():G()}function I(L,r){var K=L.cN?'<span class="'+L.cN+'">':"";if(L.rB){x+=K;w=""}else{if(L.eB){x+=l(r)+K;w=""}else{x+=K;w=r}}A=Object.create(L,{parent:{value:A}});B+=L.r}function C(K,r){w+=K;if(r===undefined){x+=J();return 0}var L=o(r,A);if(L){x+=J();I(L,r);return L.rB?0:r.length}var M=s(A,r);if(M){if(!(M.rE||M.eE)){w+=r}x+=J();do{if(A.cN){x+="</span>"}A=A.parent}while(A!=M.parent);if(M.eE){x+=l(r)}w="";if(M.starts){I(M.starts,"")}return M.rE?0:r.length}if(t(r,A)){throw"Illegal"}w+=r;return r.length||1}var F=e[D];f(F);var A=F;var w="";var B=0;var v=0;var x="";try{var u,q,p=0;while(true){A.t.lastIndex=p;u=A.t.exec(E);if(!u){break}q=C(E.substr(p,u.index-p),u[0]);p=u.index+q}C(E.substr(p));return{r:B,keyword_count:v,value:x,language:D}}catch(H){if(H=="Illegal"){return{r:0,keyword_count:0,value:l(E)}}else{throw H}}}function g(s){var o={keyword_count:0,r:0,value:l(s)};var q=o;for(var p in e){if(!e.hasOwnProperty(p)){continue}var r=d(p,s);r.language=p;if(r.keyword_count+r.r>q.keyword_count+q.r){q=r}if(r.keyword_count+r.r>o.keyword_count+o.r){q=o;o=r}}if(q.language){o.second_best=q}return o}function i(q,p,o){if(p){q=q.replace(/^((<[^>]+>|\t)+)/gm,function(r,v,u,t){return v.replace(/\t/g,p)})}if(o){q=q.replace(/\n/g,"<br>")}return q}function m(r,u,p){var v=h(r,p);var t=a(r);if(t=="no-highlight"){return}var w=t?d(t,v):g(v);t=w.language;var o=c(r);if(o.length){var q=document.createElement("pre");q.innerHTML=w.value;w.value=j(o,c(q),v)}w.value=i(w.value,u,p);var s=r.className;if(!s.match("(\\s|^)(language-)?"+t+"(\\s|$)")){s=s?(s+" "+t):t}r.innerHTML=w.value;r.className=s;r.result={language:t,kw:w.keyword_count,re:w.r};if(w.second_best){r.second_best={language:w.second_best.language,kw:w.second_best.keyword_count,re:w.second_best.r}}}function n(){if(n.called){return}n.called=true;Array.prototype.map.call(document.getElementsByTagName("pre"),b).filter(Boolean).forEach(function(o){m(o,hljs.tabReplace)})}function k(){window.addEventListener("DOMContentLoaded",n,false);window.addEventListener("load",n,false)}var e={};this.LANGUAGES=e;this.highlight=d;this.highlightAuto=g;this.fixMarkup=i;this.highlightBlock=m;this.initHighlighting=n;this.initHighlightingOnLoad=k;this.IR="[a-zA-Z][a-zA-Z0-9_]*";this.UIR="[a-zA-Z_][a-zA-Z0-9_]*";this.NR="\\b\\d+(\\.\\d+)?";this.CNR="(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)";this.BNR="\\b(0b[01]+)";this.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|\\.|-|-=|/|/=|:|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~";this.BE={b:"\\\\[\\s\\S]",r:0};this.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[this.BE],r:0};this.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[this.BE],r:0};this.CLCM={cN:"comment",b:"//",e:"$"};this.CBLCLM={cN:"comment",b:"/\\*",e:"\\*/"};this.HCM={cN:"comment",b:"#",e:"$"};this.NM={cN:"number",b:this.NR,r:0};this.CNM={cN:"number",b:this.CNR,r:0};this.BNM={cN:"number",b:this.BNR,r:0};this.inherit=function(q,r){var o={};for(var p in q){o[p]=q[p]}if(r){for(var p in r){o[p]=r[p]}}return o}}();hljs.LANGUAGES.ruby=function(e){var a="[a-zA-Z_][a-zA-Z0-9_]*(\\!|\\?)?";var j="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?";var g={keyword:"and false then defined module in return redo if BEGIN retry end for true self when next until do begin unless END rescue nil else break undef not super class case require yield alias while ensure elsif or include"};var c={cN:"yardoctag",b:"@[A-Za-z]+"};var k=[{cN:"comment",b:"#",e:"$",c:[c]},{cN:"comment",b:"^\\=begin",e:"^\\=end",c:[c],r:10},{cN:"comment",b:"^__END__",e:"\\n$"}];var d={cN:"subst",b:"#\\{",e:"}",l:a,k:g};var i=[e.BE,d];var b=[{cN:"string",b:"'",e:"'",c:i,r:0},{cN:"string",b:'"',e:'"',c:i,r:0},{cN:"string",b:"%[qw]?\\(",e:"\\)",c:i},{cN:"string",b:"%[qw]?\\[",e:"\\]",c:i},{cN:"string",b:"%[qw]?{",e:"}",c:i},{cN:"string",b:"%[qw]?<",e:">",c:i,r:10},{cN:"string",b:"%[qw]?/",e:"/",c:i,r:10},{cN:"string",b:"%[qw]?%",e:"%",c:i,r:10},{cN:"string",b:"%[qw]?-",e:"-",c:i,r:10},{cN:"string",b:"%[qw]?\\|",e:"\\|",c:i,r:10}];var h={cN:"function",bWK:true,e:" |$|;",k:"def",c:[{cN:"title",b:j,l:a,k:g},{cN:"params",b:"\\(",e:"\\)",l:a,k:g}].concat(k)};var f=k.concat(b.concat([{cN:"class",bWK:true,e:"$|;",k:"class module",c:[{cN:"title",b:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?",r:0},{cN:"inheritance",b:"<\\s*",c:[{cN:"parent",b:"("+e.IR+"::)?"+e.IR}]}].concat(k)},h,{cN:"constant",b:"(::)?(\\b[A-Z]\\w*(::)?)+",r:0},{cN:"symbol",b:":",c:b.concat([{b:j}]),r:0},{cN:"symbol",b:a+":",r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{cN:"number",b:"\\?\\w"},{cN:"variable",b:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))"},{b:"("+e.RSR+")\\s*",c:k.concat([{cN:"regexp",b:"/",e:"/[a-z]*",i:"\\n",c:[e.BE,d]}]),r:0}]));d.c=f;h.c[1].c=f;return{l:a,k:g,c:f}}(hljs);hljs.LANGUAGES.diff=function(a){return{c:[{cN:"chunk",b:"^\\@\\@ +\\-\\d+,\\d+ +\\+\\d+,\\d+ +\\@\\@$",r:10},{cN:"chunk",b:"^\\*\\*\\* +\\d+,\\d+ +\\*\\*\\*\\*$",r:10},{cN:"chunk",b:"^\\-\\-\\- +\\d+,\\d+ +\\-\\-\\-\\-$",r:10},{cN:"header",b:"Index: ",e:"$"},{cN:"header",b:"=====",e:"=====$"},{cN:"header",b:"^\\-\\-\\-",e:"$"},{cN:"header",b:"^\\*{3} ",e:"$"},{cN:"header",b:"^\\+\\+\\+",e:"$"},{cN:"header",b:"\\*{5}",e:"\\*{5}$"},{cN:"addition",b:"^\\+",e:"$"},{cN:"deletion",b:"^\\-",e:"$"},{cN:"change",b:"^\\!",e:"$"}]}}(hljs);hljs.LANGUAGES.javascript=function(a){return{k:{keyword:"in if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const",literal:"true false null undefined NaN Infinity"},c:[a.ASM,a.QSM,a.CLCM,a.CBLCLM,a.CNM,{b:"("+a.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[a.CLCM,a.CBLCLM,{cN:"regexp",b:"/",e:"/[gim]*",i:"\\n",c:[{b:"\\\\/"}]},{b:"<",e:">;",sL:"xml"}],r:0},{cN:"function",bWK:true,e:"{",k:"function",c:[{cN:"title",b:"[A-Za-z$_][0-9A-Za-z$_]*"},{cN:"params",b:"\\(",e:"\\)",c:[a.CLCM,a.CBLCLM],i:"[\"'\\(]"}],i:"\\[|%"}]}}(hljs);hljs.LANGUAGES.xml=function(a){var c="[A-Za-z0-9\\._:-]+";var b={eW:true,c:[{cN:"attribute",b:c,r:0},{b:'="',rB:true,e:'"',c:[{cN:"value",b:'"',eW:true}]},{b:"='",rB:true,e:"'",c:[{cN:"value",b:"'",eW:true}]},{b:"=",c:[{cN:"value",b:"[^\\s/>]+"}]}]};return{cI:true,c:[{cN:"pi",b:"<\\?",e:"\\?>",r:10},{cN:"doctype",b:"<!DOCTYPE",e:">",r:10,c:[{b:"\\[",e:"\\]"}]},{cN:"comment",b:"<!--",e:"-->",r:10},{cN:"cdata",b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{cN:"tag",b:"<style(?=\\s|>|$)",e:">",k:{title:"style"},c:[b],starts:{e:"</style>",rE:true,sL:"css"}},{cN:"tag",b:"<script(?=\\s|>|$)",e:">",k:{title:"script"},c:[b],starts:{e:"<\/script>",rE:true,sL:"javascript"}},{b:"<%",e:"%>",sL:"vbscript"},{cN:"tag",b:"</?",e:"/?>",c:[{cN:"title",b:"[^ />]+"},b]}]}}(hljs);hljs.LANGUAGES.php=function(a){var e={cN:"variable",b:"\\$+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*"};var b=[a.inherit(a.ASM,{i:null}),a.inherit(a.QSM,{i:null}),{cN:"string",b:'b"',e:'"',c:[a.BE]},{cN:"string",b:"b'",e:"'",c:[a.BE]}];var c=[a.BNM,a.CNM];var d={cN:"title",b:a.UIR};return{cI:true,k:"and include_once list abstract global private echo interface as static endswitch array null if endwhile or const for endforeach self var while isset public protected exit foreach throw elseif include __FILE__ empty require_once do xor return implements parent clone use __CLASS__ __LINE__ else break print eval new catch __METHOD__ case exception php_user_filter default die require __FUNCTION__ enddeclare final try this switch continue endfor endif declare unset true false namespace trait goto instanceof insteadof __DIR__ __NAMESPACE__ __halt_compiler",c:[a.CLCM,a.HCM,{cN:"comment",b:"/\\*",e:"\\*/",c:[{cN:"phpdoc",b:"\\s@[A-Za-z]+"}]},{cN:"comment",eB:true,b:"__halt_compiler.+?;",eW:true},{cN:"string",b:"<<<['\"]?\\w+['\"]?$",e:"^\\w+;",c:[a.BE]},{cN:"preprocessor",b:"<\\?php",r:10},{cN:"preprocessor",b:"\\?>"},e,{cN:"function",bWK:true,e:"{",k:"function",i:"\\$|\\[|%",c:[d,{cN:"params",b:"\\(",e:"\\)",c:["self",e,a.CBLCLM].concat(b).concat(c)}]},{cN:"class",bWK:true,e:"{",k:"class",i:"[:\\(\\$]",c:[{bWK:true,eW:true,k:"extends",c:[d]},d]},{b:"=>"}].concat(b).concat(c)}}(hljs);hljs.LANGUAGES.python=function(a){var f={cN:"prompt",b:"^(>>>|\\.\\.\\.) "};var c=[{cN:"string",b:"(u|b)?r?'''",e:"'''",c:[f],r:10},{cN:"string",b:'(u|b)?r?"""',e:'"""',c:[f],r:10},{cN:"string",b:"(u|r|ur)'",e:"'",c:[a.BE],r:10},{cN:"string",b:'(u|r|ur)"',e:'"',c:[a.BE],r:10},{cN:"string",b:"(b|br)'",e:"'",c:[a.BE]},{cN:"string",b:'(b|br)"',e:'"',c:[a.BE]}].concat([a.ASM,a.QSM]);var e={cN:"title",b:a.UIR};var d={cN:"params",b:"\\(",e:"\\)",c:["self",a.CNM,f].concat(c)};var b={bWK:true,e:":",i:"[${=;\\n]",c:[e,d],r:10};return{k:{keyword:"and elif is global as in if from raise for except finally print import pass return exec else break not with class assert yield try while continue del or def lambda nonlocal|10",built_in:"None True False Ellipsis NotImplemented"},i:"(</|->|\\?)",c:c.concat([f,a.HCM,a.inherit(b,{cN:"function",k:"def"}),a.inherit(b,{cN:"class",k:"class"}),a.CNM,{cN:"decorator",b:"@",e:"$"},{b:"\\b(print|exec)\\("}])}}(hljs);hljs.LANGUAGES.json=function(a){var e={literal:"true false null"};var d=[a.QSM,a.CNM];var c={cN:"value",e:",",eW:true,eE:true,c:d,k:e};var b={b:"{",e:"}",c:[{cN:"attribute",b:'\\s*"',e:'"\\s*:\\s*',eB:true,eE:true,c:[a.BE],i:"\\n",starts:c}],i:"\\S"};var f={b:"\\[",e:"\\]",c:[a.inherit(c,{cN:null})],i:"\\S"};d.splice(d.length,0,b,f);return{c:d,k:e,i:"\\S"}}(hljs);
@@ -0,0 +1,29 @@
1
+ /*!
2
+
3
+ Copyright 2014 jQuery Foundation and other contributors
4
+ http://jquery.com/
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining
7
+ a copy of this software and associated documentation files (the
8
+ "Software"), to deal in the Software without restriction, including
9
+ without limitation the rights to use, copy, modify, merge, publish,
10
+ distribute, sublicense, and/or sell copies of the Software, and to
11
+ permit persons to whom the Software is furnished to do so, subject to
12
+ the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be
15
+ included in all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
+
25
+ */
26
+ /*! jQuery v2.1.3 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */
27
+ !function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l=a.document,m="2.1.3",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(n.isPlainObject(d)||(e=n.isArray(d)))?(e?(e=!1,f=c&&n.isArray(c)?c:[]):f=c&&n.isPlainObject(c)?c:{},g[b]=n.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){return!n.isArray(a)&&a-parseFloat(a)+1>=0},isPlainObject:function(a){return"object"!==n.type(a)||a.nodeType||n.isWindow(a)?!1:a.constructor&&!j.call(a.constructor.prototype,"isPrototypeOf")?!1:!0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=n.trim(a),a&&(1===a.indexOf("use strict")?(b=l.createElement("script"),b.text=a,l.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:g.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(c=a[b],b=a,a=c),n.isFunction(a)?(e=d.call(arguments,2),f=function(){return a.apply(b||this,e.concat(d.call(arguments)))},f.guid=a.guid=a.guid||n.guid++,f):void 0},now:Date.now,support:k}),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=hb(),z=hb(),A=hb(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N=M.replace("w","w#"),O="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+N+"))|)"+L+"*\\]",P=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+O+")*)|.*)\\)|)",Q=new RegExp(L+"+","g"),R=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),S=new RegExp("^"+L+"*,"+L+"*"),T=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),U=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),V=new RegExp(P),W=new RegExp("^"+N+"$"),X={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+O),PSEUDO:new RegExp("^"+P),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ab=/[+~]/,bb=/'|\\/g,cb=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),db=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},eb=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(fb){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function gb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],k=b.nodeType,"string"!=typeof a||!a||1!==k&&9!==k&&11!==k)return d;if(!e&&p){if(11!==k&&(f=_.exec(a)))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return H.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName)return H.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=1!==k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(bb,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+rb(o[l]);w=ab.test(a)&&pb(b.parentNode)||b,x=o.join(",")}if(x)try{return H.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function hb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ib(a){return a[u]=!0,a}function jb(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function kb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function lb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function nb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function ob(a){return ib(function(b){return b=+b,ib(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function pb(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=gb.support={},f=gb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=gb.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=g.documentElement,e=g.defaultView,e&&e!==e.top&&(e.addEventListener?e.addEventListener("unload",eb,!1):e.attachEvent&&e.attachEvent("onunload",eb)),p=!f(g),c.attributes=jb(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=jb(function(a){return a.appendChild(g.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(g.getElementsByClassName),c.getById=jb(function(a){return o.appendChild(a).id=u,!g.getElementsByName||!g.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(g.querySelectorAll))&&(jb(function(a){o.appendChild(a).innerHTML="<a id='"+u+"'></a><select id='"+u+"-\f]' msallowcapture=''><option selected=''></option></select>",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),jb(function(a){var b=g.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&jb(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",P)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===g||a.ownerDocument===v&&t(v,a)?-1:b===g||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,h=[a],i=[b];if(!e||!f)return a===g?-1:b===g?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return lb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?lb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},g):n},gb.matches=function(a,b){return gb(a,null,null,b)},gb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return gb(b,n,null,[a]).length>0},gb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},gb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},gb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},gb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=gb.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=gb.selectors={cacheLength:50,createPseudo:ib,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(cb,db),a[3]=(a[3]||a[4]||a[5]||"").replace(cb,db),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||gb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&gb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(cb,db).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=gb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(Q," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||gb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ib(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ib(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?ib(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ib(function(a){return function(b){return gb(a,b).length>0}}),contains:ib(function(a){return a=a.replace(cb,db),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ib(function(a){return W.test(a||"")||gb.error("unsupported lang: "+a),a=a.replace(cb,db).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:ob(function(){return[0]}),last:ob(function(a,b){return[b-1]}),eq:ob(function(a,b,c){return[0>c?c+b:c]}),even:ob(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:ob(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:ob(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:ob(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=mb(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=nb(b);function qb(){}qb.prototype=d.filters=d.pseudos,d.setFilters=new qb,g=gb.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=S.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=T.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(R," ")}),h=h.slice(c.length));for(g in d.filter)!(e=X[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?gb.error(a):z(a,i).slice(0)};function rb(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function sb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function tb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ub(a,b,c){for(var d=0,e=b.length;e>d;d++)gb(a,b[d],c);return c}function vb(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function wb(a,b,c,d,e,f){return d&&!d[u]&&(d=wb(d)),e&&!e[u]&&(e=wb(e,f)),ib(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ub(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:vb(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=vb(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=vb(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function xb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=sb(function(a){return a===b},h,!0),l=sb(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[sb(tb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return wb(i>1&&tb(m),i>1&&rb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&xb(a.slice(i,e)),f>e&&xb(a=a.slice(e)),f>e&&rb(a))}m.push(c)}return tb(m)}function yb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=F.call(i));s=vb(s)}H.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&gb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?ib(f):f}return h=gb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=xb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,yb(e,d)),f.selector=a}return f},i=gb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(cb,db),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(cb,db),ab.test(j[0].type)&&pb(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&rb(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&pb(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=jb(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),jb(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||kb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&jb(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||kb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),jb(function(a){return null==a.getAttribute("disabled")})||kb(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),gb}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=n.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(w.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return g.call(b,a)>=0!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;c>b;b++)if(n.contains(e[b],this))return!0}));for(b=0;c>b;b++)n.find(a,e[b],d);return d=this.pushStack(c>1?n.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,"string"==typeof a&&u.test(a)?n(a):a||[],!1).length}});var y,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=n.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:l,!0)),v.test(c[1])&&n.isPlainObject(b))for(c in b)n.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}return d=l.getElementById(c[2]),d&&d.parentNode&&(this.length=1,this[0]=d),this.context=l,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof y.ready?y.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};A.prototype=n.fn,y=n(l);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};n.extend({dir:function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),n.fn.extend({has:function(a){var b=n(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(n.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=u.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.unique(f):f)},index:function(a){return a?"string"==typeof a?g.call(n(a),this[0]):g.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.unique(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){while((a=a[b])&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return n.dir(a,"parentNode")},parentsUntil:function(a,b,c){return n.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return n.dir(a,"nextSibling")},prevAll:function(a){return n.dir(a,"previousSibling")},nextUntil:function(a,b,c){return n.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return n.dir(a,"previousSibling",c)},siblings:function(a){return n.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return n.sibling(a.firstChild)},contents:function(a){return a.contentDocument||n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(C[a]||n.unique(e),B.test(a)&&e.reverse()),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return n.each(a.match(E)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):n.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(b=a.memory&&l,c=!0,g=e||0,e=0,f=h.length,d=!0;h&&f>g;g++)if(h[g].apply(l[0],l[1])===!1&&a.stopOnFalse){b=!1;break}d=!1,h&&(i?i.length&&j(i.shift()):b?h=[]:k.disable())},k={add:function(){if(h){var c=h.length;!function g(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&g(c)})}(arguments),d?f=h.length:b&&(e=c,j(b))}return this},remove:function(){return h&&n.each(arguments,function(a,b){var c;while((c=n.inArray(b,h,c))>-1)h.splice(c,1),d&&(f>=c&&f--,g>=c&&g--)}),this},has:function(a){return a?n.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],f=0,this},disable:function(){return h=i=b=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,b||k.disable(),this},locked:function(){return!i},fireWith:function(a,b){return!h||c&&!i||(b=b||[],b=[a,b.slice?b.slice():b],d?i.push(b):j(b)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!c}};return k},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&n.isFunction(a.promise)?e:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(H.resolveWith(l,[n]),n.fn.triggerHandler&&(n(l).triggerHandler("ready"),n(l).off("ready"))))}});function I(){l.removeEventListener("DOMContentLoaded",I,!1),a.removeEventListener("load",I,!1),n.ready()}n.ready.promise=function(b){return H||(H=n.Deferred(),"complete"===l.readyState?setTimeout(n.ready):(l.addEventListener("DOMContentLoaded",I,!1),a.addEventListener("load",I,!1))),H.promise(b)},n.ready.promise();var J=n.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)n.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f};n.acceptData=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function K(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=n.expando+K.uid++}K.uid=1,K.accepts=n.acceptData,K.prototype={key:function(a){if(!K.accepts(a))return 0;var b={},c=a[this.expando];if(!c){c=K.uid++;try{b[this.expando]={value:c},Object.defineProperties(a,b)}catch(d){b[this.expando]=c,n.extend(a,b)}}return this.cache[c]||(this.cache[c]={}),c},set:function(a,b,c){var d,e=this.key(a),f=this.cache[e];if("string"==typeof b)f[b]=c;else if(n.isEmptyObject(f))n.extend(this.cache[e],b);else for(d in b)f[d]=b[d];return f},get:function(a,b){var c=this.cache[this.key(a)];return void 0===b?c:c[b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,n.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=this.key(a),g=this.cache[f];if(void 0===b)this.cache[f]={};else{n.isArray(b)?d=b.concat(b.map(n.camelCase)):(e=n.camelCase(b),b in g?d=[b,e]:(d=e,d=d in g?[d]:d.match(E)||[])),c=d.length;while(c--)delete g[d[c]]}},hasData:function(a){return!n.isEmptyObject(this.cache[a[this.expando]]||{})},discard:function(a){a[this.expando]&&delete this.cache[a[this.expando]]}};var L=new K,M=new K,N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(O,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}M.set(a,b,c)}else c=void 0;return c}n.extend({hasData:function(a){return M.hasData(a)||L.hasData(a)},data:function(a,b,c){return M.access(a,b,c)
28
+ },removeData:function(a,b){M.remove(a,b)},_data:function(a,b,c){return L.access(a,b,c)},_removeData:function(a,b){L.remove(a,b)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=M.get(f),1===f.nodeType&&!L.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d])));L.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){M.set(this,a)}):J(this,function(b){var c,d=n.camelCase(a);if(f&&void 0===b){if(c=M.get(f,a),void 0!==c)return c;if(c=M.get(f,d),void 0!==c)return c;if(c=P(f,d,void 0),void 0!==c)return c}else this.each(function(){var c=M.get(this,d);M.set(this,d,b),-1!==a.indexOf("-")&&void 0!==c&&M.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){M.remove(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=L.get(a,b),c&&(!d||n.isArray(c)?d=L.access(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return L.get(a,c)||L.access(a,c,{empty:n.Callbacks("once memory").add(function(){L.remove(a,[b+"queue",c])})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?n.queue(this[0],a):void 0===b?this:this.each(function(){var c=n.queue(this,a,b);n._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&n.dequeue(this,a)})},dequeue:function(a){return this.each(function(){n.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=n.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=L.get(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var Q=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,R=["Top","Right","Bottom","Left"],S=function(a,b){return a=b||a,"none"===n.css(a,"display")||!n.contains(a.ownerDocument,a)},T=/^(?:checkbox|radio)$/i;!function(){var a=l.createDocumentFragment(),b=a.appendChild(l.createElement("div")),c=l.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="<textarea>x</textarea>",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var U="undefined";k.focusinBubbles="onfocusin"in a;var V=/^key/,W=/^(?:mouse|pointer|contextmenu)|click/,X=/^(?:focusinfocus|focusoutblur)$/,Y=/^([^.]*)(?:\.(.+)|)$/;function Z(){return!0}function $(){return!1}function _(){try{return l.activeElement}catch(a){}}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=n.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return typeof n!==U&&n.event.triggered!==b.type?n.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(E)||[""],j=b.length;while(j--)h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o&&(l=n.event.special[o]||{},o=(e?l.delegateType:l.bindType)||o,l=n.event.special[o]||{},k=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[o])||(m=i[o]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(o,g,!1)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),n.event.global[o]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.hasData(a)&&L.get(a);if(r&&(i=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=i[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&q!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete i[o])}else for(o in i)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(i)&&(delete r.handle,L.remove(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,m,o,p=[d||l],q=j.call(b,"type")?b.type:b,r=j.call(b,"namespace")?b.namespace.split("."):[];if(g=h=d=d||l,3!==d.nodeType&&8!==d.nodeType&&!X.test(q+n.event.triggered)&&(q.indexOf(".")>=0&&(r=q.split("."),q=r.shift(),r.sort()),k=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.Event(q,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=r.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:n.makeArray(c,[b]),o=n.event.special[q]||{},e||!o.trigger||o.trigger.apply(d,c)!==!1)){if(!e&&!o.noBubble&&!n.isWindow(d)){for(i=o.delegateType||q,X.test(i+q)||(g=g.parentNode);g;g=g.parentNode)p.push(g),h=g;h===(d.ownerDocument||l)&&p.push(h.defaultView||h.parentWindow||a)}f=0;while((g=p[f++])&&!b.isPropagationStopped())b.type=f>1?i:o.bindType||q,m=(L.get(g,"events")||{})[b.type]&&L.get(g,"handle"),m&&m.apply(g,c),m=k&&g[k],m&&m.apply&&n.acceptData(g)&&(b.result=m.apply(g,c),b.result===!1&&b.preventDefault());return b.type=q,e||b.isDefaultPrevented()||o._default&&o._default.apply(p.pop(),c)!==!1||!n.acceptData(d)||k&&n.isFunction(d[q])&&!n.isWindow(d)&&(h=d[k],h&&(d[k]=null),n.event.triggered=q,d[q](),n.event.triggered=void 0,h&&(d[k]=h)),b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(L.get(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(g.namespace))&&(a.handleObj=g,a.data=g.data,e=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(a.result=e)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!==this;i=i.parentNode||this)if(i.disabled!==!0||"click"!==a.type){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>=0:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button;return null==a.pageX&&null!=b.clientX&&(c=a.target.ownerDocument||l,d=c.documentElement,e=c.body,a.pageX=b.clientX+(d&&d.scrollLeft||e&&e.scrollLeft||0)-(d&&d.clientLeft||e&&e.clientLeft||0),a.pageY=b.clientY+(d&&d.scrollTop||e&&e.scrollTop||0)-(d&&d.clientTop||e&&e.clientTop||0)),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},fix:function(a){if(a[n.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];g||(this.fixHooks[e]=g=W.test(e)?this.mouseHooks:V.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new n.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=l),3===a.target.nodeType&&(a.target=a.target.parentNode),g.filter?g.filter(a,f):a},special:{load:{noBubble:!0},focus:{trigger:function(){return this!==_()&&this.focus?(this.focus(),!1):void 0},delegateType:"focusin"},blur:{trigger:function(){return this===_()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return"checkbox"===this.type&&this.click&&n.nodeName(this,"input")?(this.click(),!1):void 0},_default:function(a){return n.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=n.extend(new n.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?n.event.trigger(e,null,b):n.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},n.removeEvent=function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)},n.Event=function(a,b){return this instanceof n.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?Z:$):this.type=a,b&&n.extend(this,b),this.timeStamp=a&&a.timeStamp||n.now(),void(this[n.expando]=!0)):new n.Event(a,b)},n.Event.prototype={isDefaultPrevented:$,isPropagationStopped:$,isImmediatePropagationStopped:$,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=Z,a&&a.preventDefault&&a.preventDefault()},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=Z,a&&a.stopPropagation&&a.stopPropagation()},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=Z,a&&a.stopImmediatePropagation&&a.stopImmediatePropagation(),this.stopPropagation()}},n.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){n.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!n.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),k.focusinBubbles||n.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){n.event.simulate(b,a.target,n.event.fix(a),!0)};n.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=L.access(d,b);e||d.addEventListener(a,c,!0),L.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=L.access(d,b)-1;e?L.access(d,b,e):(d.removeEventListener(a,c,!0),L.remove(d,b))}}}),n.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(g in a)this.on(g,b,c,a[g],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=$;else if(!d)return this;return 1===e&&(f=d,d=function(a){return n().off(a),f.apply(this,arguments)},d.guid=f.guid||(f.guid=n.guid++)),this.each(function(){n.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,n(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return(b===!1||"function"==typeof b)&&(c=b,b=void 0),c===!1&&(c=$),this.each(function(){n.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){n.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?n.event.trigger(a,b,c,!0):void 0}});var ab=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bb=/<([\w:]+)/,cb=/<|&#?\w+;/,db=/<(?:script|style|link)/i,eb=/checked\s*(?:[^=]|=\s*.checked.)/i,fb=/^$|\/(?:java|ecma)script/i,gb=/^true\/(.*)/,hb=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,ib={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};ib.optgroup=ib.option,ib.tbody=ib.tfoot=ib.colgroup=ib.caption=ib.thead,ib.th=ib.td;function jb(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function kb(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function lb(a){var b=gb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function mb(a,b){for(var c=0,d=a.length;d>c;c++)L.set(a[c],"globalEval",!b||L.get(b[c],"globalEval"))}function nb(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(L.hasData(a)&&(f=L.access(a),g=L.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)n.event.add(b,e,j[e][c])}M.hasData(a)&&(h=M.access(a),i=n.extend({},h),M.set(b,i))}}function ob(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&n.nodeName(a,b)?n.merge([a],c):c}function pb(a,b){var c=b.nodeName.toLowerCase();"input"===c&&T.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}n.extend({clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=n.contains(a.ownerDocument,a);if(!(k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(g=ob(h),f=ob(a),d=0,e=f.length;e>d;d++)pb(f[d],g[d]);if(b)if(c)for(f=f||ob(a),g=g||ob(h),d=0,e=f.length;e>d;d++)nb(f[d],g[d]);else nb(a,h);return g=ob(h,"script"),g.length>0&&mb(g,!i&&ob(a,"script")),h},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k=b.createDocumentFragment(),l=[],m=0,o=a.length;o>m;m++)if(e=a[m],e||0===e)if("object"===n.type(e))n.merge(l,e.nodeType?[e]:e);else if(cb.test(e)){f=f||k.appendChild(b.createElement("div")),g=(bb.exec(e)||["",""])[1].toLowerCase(),h=ib[g]||ib._default,f.innerHTML=h[1]+e.replace(ab,"<$1></$2>")+h[2],j=h[0];while(j--)f=f.lastChild;n.merge(l,f.childNodes),f=k.firstChild,f.textContent=""}else l.push(b.createTextNode(e));k.textContent="",m=0;while(e=l[m++])if((!d||-1===n.inArray(e,d))&&(i=n.contains(e.ownerDocument,e),f=ob(k.appendChild(e),"script"),i&&mb(f),c)){j=0;while(e=f[j++])fb.test(e.type||"")&&c.push(e)}return k},cleanData:function(a){for(var b,c,d,e,f=n.event.special,g=0;void 0!==(c=a[g]);g++){if(n.acceptData(c)&&(e=c[L.expando],e&&(b=L.cache[e]))){if(b.events)for(d in b.events)f[d]?n.event.remove(c,d):n.removeEvent(c,d,b.handle);L.cache[e]&&delete L.cache[e]}delete M.cache[c[M.expando]]}}}),n.fn.extend({text:function(a){return J(this,function(a){return void 0===a?n.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=a)})},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?n.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||n.cleanData(ob(c)),c.parentNode&&(b&&n.contains(c.ownerDocument,c)&&mb(ob(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(n.cleanData(ob(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return J(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!db.test(a)&&!ib[(bb.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(ab,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(ob(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,n.cleanData(ob(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,m=this,o=l-1,p=a[0],q=n.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&eb.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(c=n.buildFragment(a,this[0].ownerDocument,!1,this),d=c.firstChild,1===c.childNodes.length&&(c=d),d)){for(f=n.map(ob(c,"script"),kb),g=f.length;l>j;j++)h=c,j!==o&&(h=n.clone(h,!0,!0),g&&n.merge(f,ob(h,"script"))),b.call(this[j],h,j);if(g)for(i=f[f.length-1].ownerDocument,n.map(f,lb),j=0;g>j;j++)h=f[j],fb.test(h.type||"")&&!L.access(h,"globalEval")&&n.contains(i,h)&&(h.src?n._evalUrl&&n._evalUrl(h.src):n.globalEval(h.textContent.replace(hb,"")))}return this}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=[],e=n(a),g=e.length-1,h=0;g>=h;h++)c=h===g?this:this.clone(!0),n(e[h])[b](c),f.apply(d,c.get());return this.pushStack(d)}});var qb,rb={};function sb(b,c){var d,e=n(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:n.css(e[0],"display");return e.detach(),f}function tb(a){var b=l,c=rb[a];return c||(c=sb(a,b),"none"!==c&&c||(qb=(qb||n("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=qb[0].contentDocument,b.write(),b.close(),c=sb(a,b),qb.detach()),rb[a]=c),c}var ub=/^margin/,vb=new RegExp("^("+Q+")(?!px)[a-z%]+$","i"),wb=function(b){return b.ownerDocument.defaultView.opener?b.ownerDocument.defaultView.getComputedStyle(b,null):a.getComputedStyle(b,null)};function xb(a,b,c){var d,e,f,g,h=a.style;return c=c||wb(a),c&&(g=c.getPropertyValue(b)||c[b]),c&&(""!==g||n.contains(a.ownerDocument,a)||(g=n.style(a,b)),vb.test(g)&&ub.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0!==g?g+"":g}function yb(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d=l.documentElement,e=l.createElement("div"),f=l.createElement("div");if(f.style){f.style.backgroundClip="content-box",f.cloneNode(!0).style.backgroundClip="",k.clearCloneStyle="content-box"===f.style.backgroundClip,e.style.cssText="border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;position:absolute",e.appendChild(f);function g(){f.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",f.innerHTML="",d.appendChild(e);var g=a.getComputedStyle(f,null);b="1%"!==g.top,c="4px"===g.width,d.removeChild(e)}a.getComputedStyle&&n.extend(k,{pixelPosition:function(){return g(),b},boxSizingReliable:function(){return null==c&&g(),c},reliableMarginRight:function(){var b,c=f.appendChild(l.createElement("div"));return c.style.cssText=f.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",c.style.marginRight=c.style.width="0",f.style.width="1px",d.appendChild(e),b=!parseFloat(a.getComputedStyle(c,null).marginRight),d.removeChild(e),f.removeChild(c),b}})}}(),n.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var zb=/^(none|table(?!-c[ea]).+)/,Ab=new RegExp("^("+Q+")(.*)$","i"),Bb=new RegExp("^([+-])=("+Q+")","i"),Cb={position:"absolute",visibility:"hidden",display:"block"},Db={letterSpacing:"0",fontWeight:"400"},Eb=["Webkit","O","Moz","ms"];function Fb(a,b){if(b in a)return b;var c=b[0].toUpperCase()+b.slice(1),d=b,e=Eb.length;while(e--)if(b=Eb[e]+c,b in a)return b;return d}function Gb(a,b,c){var d=Ab.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Hb(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=n.css(a,c+R[f],!0,e)),d?("content"===c&&(g-=n.css(a,"padding"+R[f],!0,e)),"margin"!==c&&(g-=n.css(a,"border"+R[f]+"Width",!0,e))):(g+=n.css(a,"padding"+R[f],!0,e),"padding"!==c&&(g+=n.css(a,"border"+R[f]+"Width",!0,e)));return g}function Ib(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=wb(a),g="border-box"===n.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=xb(a,b,f),(0>e||null==e)&&(e=a.style[b]),vb.test(e))return e;d=g&&(k.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Hb(a,b,c||(g?"border":"content"),d,f)+"px"}function Jb(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=L.get(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&S(d)&&(f[g]=L.access(d,"olddisplay",tb(d.nodeName)))):(e=S(d),"none"===c&&e||L.set(d,"olddisplay",e?c:n.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}n.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=xb(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=n.camelCase(b),i=a.style;return b=n.cssProps[h]||(n.cssProps[h]=Fb(i,h)),g=n.cssHooks[b]||n.cssHooks[h],void 0===c?g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b]:(f=typeof c,"string"===f&&(e=Bb.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(n.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||n.cssNumber[h]||(c+="px"),k.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),g&&"set"in g&&void 0===(c=g.set(a,c,d))||(i[b]=c)),void 0)}},css:function(a,b,c,d){var e,f,g,h=n.camelCase(b);return b=n.cssProps[h]||(n.cssProps[h]=Fb(a.style,h)),g=n.cssHooks[b]||n.cssHooks[h],g&&"get"in g&&(e=g.get(a,!0,c)),void 0===e&&(e=xb(a,b,d)),"normal"===e&&b in Db&&(e=Db[b]),""===c||c?(f=parseFloat(e),c===!0||n.isNumeric(f)?f||0:e):e}}),n.each(["height","width"],function(a,b){n.cssHooks[b]={get:function(a,c,d){return c?zb.test(n.css(a,"display"))&&0===a.offsetWidth?n.swap(a,Cb,function(){return Ib(a,b,d)}):Ib(a,b,d):void 0},set:function(a,c,d){var e=d&&wb(a);return Gb(a,c,d?Hb(a,b,d,"border-box"===n.css(a,"boxSizing",!1,e),e):0)}}}),n.cssHooks.marginRight=yb(k.reliableMarginRight,function(a,b){return b?n.swap(a,{display:"inline-block"},xb,[a,"marginRight"]):void 0}),n.each({margin:"",padding:"",border:"Width"},function(a,b){n.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+R[d]+b]=f[d]||f[d-2]||f[0];return e}},ub.test(a)||(n.cssHooks[a+b].set=Gb)}),n.fn.extend({css:function(a,b){return J(this,function(a,b,c){var d,e,f={},g=0;if(n.isArray(b)){for(d=wb(a),e=b.length;e>g;g++)f[b[g]]=n.css(a,b[g],!1,d);return f}return void 0!==c?n.style(a,b,c):n.css(a,b)},a,b,arguments.length>1)},show:function(){return Jb(this,!0)},hide:function(){return Jb(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){S(this)?n(this).show():n(this).hide()})}});function Kb(a,b,c,d,e){return new Kb.prototype.init(a,b,c,d,e)}n.Tween=Kb,Kb.prototype={constructor:Kb,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(n.cssNumber[c]?"":"px")},cur:function(){var a=Kb.propHooks[this.prop];return a&&a.get?a.get(this):Kb.propHooks._default.get(this)},run:function(a){var b,c=Kb.propHooks[this.prop];return this.pos=b=this.options.duration?n.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Kb.propHooks._default.set(this),this}},Kb.prototype.init.prototype=Kb.prototype,Kb.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=n.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){n.fx.step[a.prop]?n.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[n.cssProps[a.prop]]||n.cssHooks[a.prop])?n.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},Kb.propHooks.scrollTop=Kb.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},n.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},n.fx=Kb.prototype.init,n.fx.step={};var Lb,Mb,Nb=/^(?:toggle|show|hide)$/,Ob=new RegExp("^(?:([+-])=|)("+Q+")([a-z%]*)$","i"),Pb=/queueHooks$/,Qb=[Vb],Rb={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=Ob.exec(b),f=e&&e[3]||(n.cssNumber[a]?"":"px"),g=(n.cssNumber[a]||"px"!==f&&+d)&&Ob.exec(n.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,n.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function Sb(){return setTimeout(function(){Lb=void 0}),Lb=n.now()}function Tb(a,b){var c,d=0,e={height:a};for(b=b?1:0;4>d;d+=2-b)c=R[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function Ub(a,b,c){for(var d,e=(Rb[b]||[]).concat(Rb["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function Vb(a,b,c){var d,e,f,g,h,i,j,k,l=this,m={},o=a.style,p=a.nodeType&&S(a),q=L.get(a,"fxshow");c.queue||(h=n._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,l.always(function(){l.always(function(){h.unqueued--,n.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[o.overflow,o.overflowX,o.overflowY],j=n.css(a,"display"),k="none"===j?L.get(a,"olddisplay")||tb(a.nodeName):j,"inline"===k&&"none"===n.css(a,"float")&&(o.display="inline-block")),c.overflow&&(o.overflow="hidden",l.always(function(){o.overflow=c.overflow[0],o.overflowX=c.overflow[1],o.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],Nb.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(p?"hide":"show")){if("show"!==e||!q||void 0===q[d])continue;p=!0}m[d]=q&&q[d]||n.style(a,d)}else j=void 0;if(n.isEmptyObject(m))"inline"===("none"===j?tb(a.nodeName):j)&&(o.display=j);else{q?"hidden"in q&&(p=q.hidden):q=L.access(a,"fxshow",{}),f&&(q.hidden=!p),p?n(a).show():l.done(function(){n(a).hide()}),l.done(function(){var b;L.remove(a,"fxshow");for(b in m)n.style(a,b,m[b])});for(d in m)g=Ub(p?q[d]:0,d,l),d in q||(q[d]=g.start,p&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function Wb(a,b){var c,d,e,f,g;for(c in a)if(d=n.camelCase(c),e=b[d],f=a[c],n.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=n.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function Xb(a,b,c){var d,e,f=0,g=Qb.length,h=n.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=Lb||Sb(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:n.extend({},b),opts:n.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:Lb||Sb(),duration:c.duration,tweens:[],createTween:function(b,c){var d=n.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(Wb(k,j.opts.specialEasing);g>f;f++)if(d=Qb[f].call(j,a,k,j.opts))return d;return n.map(k,Ub,j),n.isFunction(j.opts.start)&&j.opts.start.call(a,j),n.fx.timer(n.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}n.Animation=n.extend(Xb,{tweener:function(a,b){n.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],Rb[c]=Rb[c]||[],Rb[c].unshift(b)},prefilter:function(a,b){b?Qb.unshift(a):Qb.push(a)}}),n.speed=function(a,b,c){var d=a&&"object"==typeof a?n.extend({},a):{complete:c||!c&&b||n.isFunction(a)&&a,duration:a,easing:c&&b||b&&!n.isFunction(b)&&b};return d.duration=n.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in n.fx.speeds?n.fx.speeds[d.duration]:n.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){n.isFunction(d.old)&&d.old.call(this),d.queue&&n.dequeue(this,d.queue)},d},n.fn.extend({fadeTo:function(a,b,c,d){return this.filter(S).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=n.isEmptyObject(a),f=n.speed(b,c,d),g=function(){var b=Xb(this,n.extend({},a),f);(e||L.get(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=n.timers,g=L.get(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&Pb.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&n.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=L.get(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=n.timers,g=d?d.length:0;for(c.finish=!0,n.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),n.each(["toggle","show","hide"],function(a,b){var c=n.fn[b];n.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(Tb(b,!0),a,d,e)}}),n.each({slideDown:Tb("show"),slideUp:Tb("hide"),slideToggle:Tb("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){n.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),n.timers=[],n.fx.tick=function(){var a,b=0,c=n.timers;for(Lb=n.now();b<c.length;b++)a=c[b],a()||c[b]!==a||c.splice(b--,1);c.length||n.fx.stop(),Lb=void 0},n.fx.timer=function(a){n.timers.push(a),a()?n.fx.start():n.timers.pop()},n.fx.interval=13,n.fx.start=function(){Mb||(Mb=setInterval(n.fx.tick,n.fx.interval))},n.fx.stop=function(){clearInterval(Mb),Mb=null},n.fx.speeds={slow:600,fast:200,_default:400},n.fn.delay=function(a,b){return a=n.fx?n.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a=l.createElement("input"),b=l.createElement("select"),c=b.appendChild(l.createElement("option"));a.type="checkbox",k.checkOn=""!==a.value,k.optSelected=c.selected,b.disabled=!0,k.optDisabled=!c.disabled,a=l.createElement("input"),a.value="t",a.type="radio",k.radioValue="t"===a.value}();var Yb,Zb,$b=n.expr.attrHandle;n.fn.extend({attr:function(a,b){return J(this,n.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){n.removeAttr(this,a)})}}),n.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===U?n.prop(a,b,c):(1===f&&n.isXMLDoc(a)||(b=b.toLowerCase(),d=n.attrHooks[b]||(n.expr.match.bool.test(b)?Zb:Yb)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=n.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void n.removeAttr(a,b))
29
+ },removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(E);if(f&&1===a.nodeType)while(c=f[e++])d=n.propFix[c]||c,n.expr.match.bool.test(c)&&(a[d]=!1),a.removeAttribute(c)},attrHooks:{type:{set:function(a,b){if(!k.radioValue&&"radio"===b&&n.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),Zb={set:function(a,b,c){return b===!1?n.removeAttr(a,c):a.setAttribute(c,c),c}},n.each(n.expr.match.bool.source.match(/\w+/g),function(a,b){var c=$b[b]||n.find.attr;$b[b]=function(a,b,d){var e,f;return d||(f=$b[b],$b[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,$b[b]=f),e}});var _b=/^(?:input|select|textarea|button)$/i;n.fn.extend({prop:function(a,b){return J(this,n.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[n.propFix[a]||a]})}}),n.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!n.isXMLDoc(a),f&&(b=n.propFix[b]||b,e=n.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){return a.hasAttribute("tabindex")||_b.test(a.nodeName)||a.href?a.tabIndex:-1}}}}),k.optSelected||(n.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null}}),n.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){n.propFix[this.toLowerCase()]=this});var ac=/[\t\r\n\f]/g;n.fn.extend({addClass:function(a){var b,c,d,e,f,g,h="string"==typeof a&&a,i=0,j=this.length;if(n.isFunction(a))return this.each(function(b){n(this).addClass(a.call(this,b,this.className))});if(h)for(b=(a||"").match(E)||[];j>i;i++)if(c=this[i],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ac," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=n.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0===arguments.length||"string"==typeof a&&a,i=0,j=this.length;if(n.isFunction(a))return this.each(function(b){n(this).removeClass(a.call(this,b,this.className))});if(h)for(b=(a||"").match(E)||[];j>i;i++)if(c=this[i],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ac," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?n.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(n.isFunction(a)?function(c){n(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=n(this),f=a.match(E)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===U||"boolean"===c)&&(this.className&&L.set(this,"__className__",this.className),this.className=this.className||a===!1?"":L.get(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(ac," ").indexOf(b)>=0)return!0;return!1}});var bc=/\r/g;n.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=n.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,n(this).val()):a,null==e?e="":"number"==typeof e?e+="":n.isArray(e)&&(e=n.map(e,function(a){return null==a?"":a+""})),b=n.valHooks[this.type]||n.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=n.valHooks[e.type]||n.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(bc,""):null==c?"":c)}}}),n.extend({valHooks:{option:{get:function(a){var b=n.find.attr(a,"value");return null!=b?b:n.trim(n.text(a))}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(k.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&n.nodeName(c.parentNode,"optgroup"))){if(b=n(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=n.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=n.inArray(d.value,f)>=0)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),n.each(["radio","checkbox"],function(){n.valHooks[this]={set:function(a,b){return n.isArray(b)?a.checked=n.inArray(n(a).val(),b)>=0:void 0}},k.checkOn||(n.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})}),n.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 contextmenu".split(" "),function(a,b){n.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),n.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var cc=n.now(),dc=/\?/;n.parseJSON=function(a){return JSON.parse(a+"")},n.parseXML=function(a){var b,c;if(!a||"string"!=typeof a)return null;try{c=new DOMParser,b=c.parseFromString(a,"text/xml")}catch(d){b=void 0}return(!b||b.getElementsByTagName("parsererror").length)&&n.error("Invalid XML: "+a),b};var ec=/#.*$/,fc=/([?&])_=[^&]*/,gc=/^(.*?):[ \t]*([^\r\n]*)$/gm,hc=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,ic=/^(?:GET|HEAD)$/,jc=/^\/\//,kc=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,lc={},mc={},nc="*/".concat("*"),oc=a.location.href,pc=kc.exec(oc.toLowerCase())||[];function qc(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(E)||[];if(n.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function rc(a,b,c,d){var e={},f=a===mc;function g(h){var i;return e[h]=!0,n.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function sc(a,b){var c,d,e=n.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&n.extend(!0,a,d),a}function tc(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function uc(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}n.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:oc,type:"GET",isLocal:hc.test(pc[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":nc,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":n.parseJSON,"text xml":n.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?sc(sc(a,n.ajaxSettings),b):sc(n.ajaxSettings,a)},ajaxPrefilter:qc(lc),ajaxTransport:qc(mc),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=n.ajaxSetup({},b),l=k.context||k,m=k.context&&(l.nodeType||l.jquery)?n(l):n.event,o=n.Deferred(),p=n.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!f){f={};while(b=gc.exec(e))f[b[1].toLowerCase()]=b[2]}b=f[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?e:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return c&&c.abort(b),x(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||oc)+"").replace(ec,"").replace(jc,pc[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=n.trim(k.dataType||"*").toLowerCase().match(E)||[""],null==k.crossDomain&&(h=kc.exec(k.url.toLowerCase()),k.crossDomain=!(!h||h[1]===pc[1]&&h[2]===pc[2]&&(h[3]||("http:"===h[1]?"80":"443"))===(pc[3]||("http:"===pc[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=n.param(k.data,k.traditional)),rc(lc,k,b,v),2===t)return v;i=n.event&&k.global,i&&0===n.active++&&n.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!ic.test(k.type),d=k.url,k.hasContent||(k.data&&(d=k.url+=(dc.test(d)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=fc.test(d)?d.replace(fc,"$1_="+cc++):d+(dc.test(d)?"&":"?")+"_="+cc++)),k.ifModified&&(n.lastModified[d]&&v.setRequestHeader("If-Modified-Since",n.lastModified[d]),n.etag[d]&&v.setRequestHeader("If-None-Match",n.etag[d])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+nc+"; q=0.01":""):k.accepts["*"]);for(j in k.headers)v.setRequestHeader(j,k.headers[j]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(j in{success:1,error:1,complete:1})v[j](k[j]);if(c=rc(mc,k,b,v)){v.readyState=1,i&&m.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,c.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,f,h){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),c=void 0,e=h||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,f&&(u=tc(k,v,f)),u=uc(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(n.lastModified[d]=w),w=v.getResponseHeader("etag"),w&&(n.etag[d]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?o.resolveWith(l,[r,x,v]):o.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,i&&m.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),i&&(m.trigger("ajaxComplete",[v,k]),--n.active||n.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return n.get(a,b,c,"json")},getScript:function(a,b){return n.get(a,void 0,b,"script")}}),n.each(["get","post"],function(a,b){n[b]=function(a,c,d,e){return n.isFunction(c)&&(e=e||d,d=c,c=void 0),n.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),n._evalUrl=function(a){return n.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},n.fn.extend({wrapAll:function(a){var b;return n.isFunction(a)?this.each(function(b){n(this).wrapAll(a.call(this,b))}):(this[0]&&(b=n(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this)},wrapInner:function(a){return this.each(n.isFunction(a)?function(b){n(this).wrapInner(a.call(this,b))}:function(){var b=n(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=n.isFunction(a);return this.each(function(c){n(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){n.nodeName(this,"body")||n(this).replaceWith(this.childNodes)}).end()}}),n.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0},n.expr.filters.visible=function(a){return!n.expr.filters.hidden(a)};var vc=/%20/g,wc=/\[\]$/,xc=/\r?\n/g,yc=/^(?:submit|button|image|reset|file)$/i,zc=/^(?:input|select|textarea|keygen)/i;function Ac(a,b,c,d){var e;if(n.isArray(b))n.each(b,function(b,e){c||wc.test(a)?d(a,e):Ac(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==n.type(b))d(a,b);else for(e in b)Ac(a+"["+e+"]",b[e],c,d)}n.param=function(a,b){var c,d=[],e=function(a,b){b=n.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=n.ajaxSettings&&n.ajaxSettings.traditional),n.isArray(a)||a.jquery&&!n.isPlainObject(a))n.each(a,function(){e(this.name,this.value)});else for(c in a)Ac(c,a[c],b,e);return d.join("&").replace(vc,"+")},n.fn.extend({serialize:function(){return n.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=n.prop(this,"elements");return a?n.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!n(this).is(":disabled")&&zc.test(this.nodeName)&&!yc.test(a)&&(this.checked||!T.test(a))}).map(function(a,b){var c=n(this).val();return null==c?null:n.isArray(c)?n.map(c,function(a){return{name:b.name,value:a.replace(xc,"\r\n")}}):{name:b.name,value:c.replace(xc,"\r\n")}}).get()}}),n.ajaxSettings.xhr=function(){try{return new XMLHttpRequest}catch(a){}};var Bc=0,Cc={},Dc={0:200,1223:204},Ec=n.ajaxSettings.xhr();a.attachEvent&&a.attachEvent("onunload",function(){for(var a in Cc)Cc[a]()}),k.cors=!!Ec&&"withCredentials"in Ec,k.ajax=Ec=!!Ec,n.ajaxTransport(function(a){var b;return k.cors||Ec&&!a.crossDomain?{send:function(c,d){var e,f=a.xhr(),g=++Bc;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)f.setRequestHeader(e,c[e]);b=function(a){return function(){b&&(delete Cc[g],b=f.onload=f.onerror=null,"abort"===a?f.abort():"error"===a?d(f.status,f.statusText):d(Dc[f.status]||f.status,f.statusText,"string"==typeof f.responseText?{text:f.responseText}:void 0,f.getAllResponseHeaders()))}},f.onload=b(),f.onerror=b("error"),b=Cc[g]=b("abort");try{f.send(a.hasContent&&a.data||null)}catch(h){if(b)throw h}},abort:function(){b&&b()}}:void 0}),n.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return n.globalEval(a),a}}}),n.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),n.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(d,e){b=n("<script>").prop({async:!0,charset:a.scriptCharset,src:a.url}).on("load error",c=function(a){b.remove(),c=null,a&&e("error"===a.type?404:200,a.type)}),l.head.appendChild(b[0])},abort:function(){c&&c()}}}});var Fc=[],Gc=/(=)\?(?=&|$)|\?\?/;n.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=Fc.pop()||n.expando+"_"+cc++;return this[a]=!0,a}}),n.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(Gc.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&Gc.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=n.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(Gc,"$1"+e):b.jsonp!==!1&&(b.url+=(dc.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||n.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,Fc.push(e)),g&&n.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),n.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||l;var d=v.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=n.buildFragment([a],b,e),e&&e.length&&n(e).remove(),n.merge([],d.childNodes))};var Hc=n.fn.load;n.fn.load=function(a,b,c){if("string"!=typeof a&&Hc)return Hc.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=n.trim(a.slice(h)),a=a.slice(0,h)),n.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(e="POST"),g.length>0&&n.ajax({url:a,type:e,dataType:"html",data:b}).done(function(a){f=arguments,g.html(d?n("<div>").append(n.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,f||[a.responseText,b,a])}),this},n.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){n.fn[b]=function(a){return this.on(b,a)}}),n.expr.filters.animated=function(a){return n.grep(n.timers,function(b){return a===b.elem}).length};var Ic=a.document.documentElement;function Jc(a){return n.isWindow(a)?a:9===a.nodeType&&a.defaultView}n.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=n.css(a,"position"),l=n(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=n.css(a,"top"),i=n.css(a,"left"),j=("absolute"===k||"fixed"===k)&&(f+i).indexOf("auto")>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),n.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},n.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){n.offset.setOffset(this,a,b)});var b,c,d=this[0],e={top:0,left:0},f=d&&d.ownerDocument;if(f)return b=f.documentElement,n.contains(b,d)?(typeof d.getBoundingClientRect!==U&&(e=d.getBoundingClientRect()),c=Jc(f),{top:e.top+c.pageYOffset-b.clientTop,left:e.left+c.pageXOffset-b.clientLeft}):e},position:function(){if(this[0]){var a,b,c=this[0],d={top:0,left:0};return"fixed"===n.css(c,"position")?b=c.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),n.nodeName(a[0],"html")||(d=a.offset()),d.top+=n.css(a[0],"borderTopWidth",!0),d.left+=n.css(a[0],"borderLeftWidth",!0)),{top:b.top-d.top-n.css(c,"marginTop",!0),left:b.left-d.left-n.css(c,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||Ic;while(a&&!n.nodeName(a,"html")&&"static"===n.css(a,"position"))a=a.offsetParent;return a||Ic})}}),n.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(b,c){var d="pageYOffset"===c;n.fn[b]=function(e){return J(this,function(b,e,f){var g=Jc(b);return void 0===f?g?g[c]:b[e]:void(g?g.scrollTo(d?a.pageXOffset:f,d?f:a.pageYOffset):b[e]=f)},b,e,arguments.length,null)}}),n.each(["top","left"],function(a,b){n.cssHooks[b]=yb(k.pixelPosition,function(a,c){return c?(c=xb(a,b),vb.test(c)?n(a).position()[b]+"px":c):void 0})}),n.each({Height:"height",Width:"width"},function(a,b){n.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){n.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return J(this,function(b,c,d){var e;return n.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?n.css(b,c,g):n.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),n.fn.size=function(){return this.length},n.fn.andSelf=n.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return n});var Kc=a.jQuery,Lc=a.$;return n.noConflict=function(b){return a.$===n&&(a.$=Lc),b&&a.jQuery===n&&(a.jQuery=Kc),n},typeof b===U&&(a.jQuery=a.$=n),n});
@@ -0,0 +1,3534 @@
1
+ /*
2
+
3
+ The MIT License (MIT)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
22
+
23
+ */
24
+
25
+ /*
26
+ * jsTree 1.0-rc1
27
+ * http://jstree.com/
28
+ *
29
+ * Copyright (c) 2010 Ivan Bozhanov (vakata.com)
30
+ *
31
+ * Dual licensed under the MIT and GPL licenses (same as jQuery):
32
+ * http://www.opensource.org/licenses/mit-license.php
33
+ * http://www.gnu.org/licenses/gpl.html
34
+ *
35
+ * Date: 2010-07-01 10:51:11 +0300 (четв, 01 юли 2010) $
36
+ * Revision: 191 $
37
+ */
38
+
39
+ /*jslint browser: true, onevar: true, undef: true, bitwise: true, strict: true */
40
+ /*global window : false, clearInterval: false, clearTimeout: false, document: false, setInterval: false, setTimeout: false, jQuery: false, navigator: false, XSLTProcessor: false, DOMParser: false, XMLSerializer: false*/
41
+
42
+ "use strict";
43
+ // Common functions not related to jsTree
44
+ // decided to move them to a `vakata` "namespace"
45
+ (function ($) {
46
+ $.vakata = {};
47
+ // CSS related functions
48
+ $.vakata.css = {
49
+ get_css : function(rule_name, delete_flag, sheet) {
50
+ rule_name = rule_name.toLowerCase();
51
+ var css_rules = sheet.cssRules || sheet.rules,
52
+ j = 0;
53
+ do {
54
+ if(css_rules.length && j > css_rules.length + 5) { return false; }
55
+ if(css_rules[j].selectorText && css_rules[j].selectorText.toLowerCase() == rule_name) {
56
+ if(delete_flag === true) {
57
+ if(sheet.removeRule) { sheet.removeRule(j); }
58
+ if(sheet.deleteRule) { sheet.deleteRule(j); }
59
+ return true;
60
+ }
61
+ else { return css_rules[j]; }
62
+ }
63
+ }
64
+ while (css_rules[++j]);
65
+ return false;
66
+ },
67
+ add_css : function(rule_name, sheet) {
68
+ if($.jstree.css.get_css(rule_name, false, sheet)) { return false; }
69
+ if(sheet.insertRule) { sheet.insertRule(rule_name + ' { }', 0); } else { sheet.addRule(rule_name, null, 0); }
70
+ return $.vakata.css.get_css(rule_name);
71
+ },
72
+ remove_css : function(rule_name, sheet) {
73
+ return $.vakata.css.get_css(rule_name, true, sheet);
74
+ },
75
+ add_sheet : function(opts) {
76
+ var tmp;
77
+ if(opts.str) {
78
+ tmp = document.createElement("style");
79
+ tmp.setAttribute('type',"text/css");
80
+ if(tmp.styleSheet) {
81
+ document.getElementsByTagName("head")[0].appendChild(tmp);
82
+ tmp.styleSheet.cssText = opts.str;
83
+ }
84
+ else {
85
+ tmp.appendChild(document.createTextNode(opts.str));
86
+ document.getElementsByTagName("head")[0].appendChild(tmp);
87
+ }
88
+ return tmp.sheet || tmp.styleSheet;
89
+ }
90
+ if(opts.url) {
91
+ if(document.createStyleSheet) {
92
+ try { tmp = document.createStyleSheet(opts.url); } catch (e) { }
93
+ }
94
+ else {
95
+ tmp = document.createElement('link');
96
+ tmp.rel = 'stylesheet';
97
+ tmp.type = 'text/css';
98
+ tmp.media = "all";
99
+ tmp.href = opts.url;
100
+ document.getElementsByTagName("head")[0].appendChild(tmp);
101
+ return tmp.styleSheet;
102
+ }
103
+ }
104
+ }
105
+ };
106
+ })(jQuery);
107
+
108
+ /*
109
+ * jsTree core 1.0
110
+ */
111
+ (function ($) {
112
+ // private variables
113
+ var instances = [], // instance array (used by $.jstree.reference/create/focused)
114
+ focused_instance = -1, // the index in the instance array of the currently focused instance
115
+ plugins = {}, // list of included plugins
116
+ prepared_move = {}, // for the move plugin
117
+ is_ie6 = false;
118
+
119
+ // jQuery plugin wrapper (thanks to jquery UI widget function)
120
+ $.fn.jstree = function (settings) {
121
+ var isMethodCall = (typeof settings == 'string'), // is this a method call like $().jstree("open_node")
122
+ args = Array.prototype.slice.call(arguments, 1),
123
+ returnValue = this;
124
+
125
+ // extend settings and allow for multiple hashes and metadata
126
+ if(!isMethodCall && $.meta) { args.push($.metadata.get(this).jstree); }
127
+ settings = !isMethodCall && args.length ? $.extend.apply(null, [true, settings].concat(args)) : settings;
128
+ // block calls to "private" methods
129
+ if(isMethodCall && settings.substring(0, 1) == '_') { return returnValue; }
130
+
131
+ // if a method call execute the method on all selected instances
132
+ if(isMethodCall) {
133
+ this.each(function() {
134
+ var instance = instances[$.data(this, "jstree-instance-id")],
135
+ methodValue = (instance && $.isFunction(instance[settings])) ? instance[settings].apply(instance, args) : instance;
136
+ if(typeof methodValue !== "undefined" && (settings.indexOf("is_" === 0) || (methodValue !== true && methodValue !== false))) { returnValue = methodValue; return false; }
137
+ });
138
+ }
139
+ else {
140
+ this.each(function() {
141
+ var instance_id = $.data(this, "jstree-instance-id"),
142
+ s = false;
143
+ // if an instance already exists, destroy it first
144
+ if(typeof instance_id !== "undefined" && instances[instance_id]) { instances[instance_id].destroy(); }
145
+ // push a new empty object to the instances array
146
+ instance_id = parseInt(instances.push({}),10) - 1;
147
+ // store the jstree instance id to the container element
148
+ $.data(this, "jstree-instance-id", instance_id);
149
+ // clean up all plugins
150
+ if(!settings) { settings = {}; }
151
+ settings.plugins = $.isArray(settings.plugins) ? settings.plugins : $.jstree.defaults.plugins;
152
+ if($.inArray("core", settings.plugins) === -1) { settings.plugins.unshift("core"); }
153
+
154
+ // only unique plugins (NOT WORKING)
155
+ // settings.plugins = settings.plugins.sort().join(",,").replace(/(,|^)([^,]+)(,,\2)+(,|$)/g,"$1$2$4").replace(/,,+/g,",").replace(/,$/,"").split(",");
156
+
157
+ // extend defaults with passed data
158
+ s = $.extend(true, {}, $.jstree.defaults, settings);
159
+ s.plugins = settings.plugins;
160
+ $.each(plugins, function (i, val) { if($.inArray(i, s.plugins) === -1) { s[i] = null; delete s[i]; } });
161
+ // push the new object to the instances array (at the same time set the default classes to the container) and init
162
+ instances[instance_id] = new $.jstree._instance(instance_id, $(this).addClass("jstree jstree-" + instance_id), s);
163
+ // init all activated plugins for this instance
164
+ $.each(instances[instance_id]._get_settings().plugins, function (i, val) { instances[instance_id].data[val] = {}; });
165
+ $.each(instances[instance_id]._get_settings().plugins, function (i, val) { if(plugins[val]) { plugins[val].__init.apply(instances[instance_id]); } });
166
+ // initialize the instance
167
+ instances[instance_id].init();
168
+ });
169
+ }
170
+ // return the jquery selection (or if it was a method call that returned a value - the returned value)
171
+ return returnValue;
172
+ };
173
+ // object to store exposed functions and objects
174
+ $.jstree = {
175
+ defaults : {
176
+ plugins : []
177
+ },
178
+ _focused : function () { return instances[focused_instance] || null; },
179
+ _reference : function (needle) {
180
+ // get by instance id
181
+ if(instances[needle]) { return instances[needle]; }
182
+ // get by DOM (if still no luck - return null
183
+ var o = $(needle);
184
+ if(!o.length && typeof needle === "string") { o = $("#" + needle); }
185
+ if(!o.length) { return null; }
186
+ return instances[o.closest(".jstree").data("jstree-instance-id")] || null;
187
+ },
188
+ _instance : function (index, container, settings) {
189
+ // for plugins to store data in
190
+ this.data = { core : {} };
191
+ this.get_settings = function () { return $.extend(true, {}, settings); };
192
+ this._get_settings = function () { return settings; };
193
+ this.get_index = function () { return index; };
194
+ this.get_container = function () { return container; };
195
+ this._set_settings = function (s) {
196
+ settings = $.extend(true, {}, settings, s);
197
+ };
198
+ },
199
+ _fn : { },
200
+ plugin : function (pname, pdata) {
201
+ pdata = $.extend({}, {
202
+ __init : $.noop,
203
+ __destroy : $.noop,
204
+ _fn : {},
205
+ defaults : false
206
+ }, pdata);
207
+ plugins[pname] = pdata;
208
+
209
+ $.jstree.defaults[pname] = pdata.defaults;
210
+ $.each(pdata._fn, function (i, val) {
211
+ val.plugin = pname;
212
+ val.old = $.jstree._fn[i];
213
+ $.jstree._fn[i] = function () {
214
+ var rslt,
215
+ func = val,
216
+ args = Array.prototype.slice.call(arguments),
217
+ evnt = new $.Event("before.jstree"),
218
+ rlbk = false;
219
+
220
+ // Check if function belongs to the included plugins of this instance
221
+ do {
222
+ if(func && func.plugin && $.inArray(func.plugin, this._get_settings().plugins) !== -1) { break; }
223
+ func = func.old;
224
+ } while(func);
225
+ if(!func) { return; }
226
+
227
+ // a chance to stop execution (or change arguments):
228
+ // * just bind to jstree.before
229
+ // * check the additional data object (func property)
230
+ // * call event.stopImmediatePropagation()
231
+ // * return false (or an array of arguments)
232
+ rslt = this.get_container().triggerHandler(evnt, { "func" : i, "inst" : this, "args" : args });
233
+ if(rslt === false) { return; }
234
+ if(typeof rslt !== "undefined") { args = rslt; }
235
+
236
+ // context and function to trigger events, then finally call the function
237
+ if(i.indexOf("_") === 0) {
238
+ rslt = func.apply(this, args);
239
+ }
240
+ else {
241
+ rslt = func.apply(
242
+ $.extend({}, this, {
243
+ __callback : function (data) {
244
+ this.get_container().triggerHandler( i + '.jstree', { "inst" : this, "args" : args, "rslt" : data, "rlbk" : rlbk });
245
+ },
246
+ __rollback : function () {
247
+ rlbk = this.get_rollback();
248
+ return rlbk;
249
+ },
250
+ __call_old : function (replace_arguments) {
251
+ return func.old.apply(this, (replace_arguments ? Array.prototype.slice.call(arguments, 1) : args ) );
252
+ }
253
+ }), args);
254
+ }
255
+
256
+ // return the result
257
+ return rslt;
258
+ };
259
+ $.jstree._fn[i].old = val.old;
260
+ $.jstree._fn[i].plugin = pname;
261
+ });
262
+ },
263
+ rollback : function (rb) {
264
+ if(rb) {
265
+ if(!$.isArray(rb)) { rb = [ rb ]; }
266
+ $.each(rb, function (i, val) {
267
+ instances[val.i].set_rollback(val.h, val.d);
268
+ });
269
+ }
270
+ }
271
+ };
272
+ // set the prototype for all instances
273
+ $.jstree._fn = $.jstree._instance.prototype = {};
274
+
275
+ // css functions - used internally
276
+
277
+ // load the css when DOM is ready
278
+ $(function() {
279
+ // code is copied form jQuery ($.browser is deprecated + there is a bug in IE)
280
+ var u = navigator.userAgent.toLowerCase(),
281
+ v = (u.match( /.+?(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1],
282
+ css_string = '' +
283
+ '.jstree ul, .jstree li { display:block; margin:0 0 0 0; padding:0 0 0 0; list-style-type:none; } ' +
284
+ '.jstree li { display:block; min-height:18px; line-height:18px; white-space:nowrap; margin-left:18px; } ' +
285
+ '.jstree-rtl li { margin-left:0; margin-right:18px; } ' +
286
+ '.jstree > ul > li { margin-left:0px; } ' +
287
+ '.jstree-rtl > ul > li { margin-right:0px; } ' +
288
+ '.jstree ins { display:inline-block; text-decoration:none; width:18px; height:18px; margin:0 0 0 0; padding:0; } ' +
289
+ '.jstree a { display:inline-block; line-height:16px; height:16px; color:black; white-space:nowrap; text-decoration:none; padding:1px 2px; margin:0; } ' +
290
+ '.jstree a:focus { outline: none; } ' +
291
+ '.jstree a > ins { height:16px; width:16px; } ' +
292
+ '.jstree a > .jstree-icon { margin-right:3px; } ' +
293
+ '.jstree-rtl a > .jstree-icon { margin-left:3px; margin-right:0; } ' +
294
+ 'li.jstree-open > ul { display:block; } ' +
295
+ 'li.jstree-closed > ul { display:none; } ';
296
+ // Correct IE 6 (does not support the > CSS selector)
297
+ if(/msie/.test(u) && parseInt(v, 10) == 6) {
298
+ is_ie6 = true;
299
+ css_string += '' +
300
+ '.jstree li { height:18px; margin-left:0; margin-right:0; } ' +
301
+ '.jstree li li { margin-left:18px; } ' +
302
+ '.jstree-rtl li li { margin-left:0px; margin-right:18px; } ' +
303
+ 'li.jstree-open ul { display:block; } ' +
304
+ 'li.jstree-closed ul { display:none !important; } ' +
305
+ '.jstree li a { display:inline; border-width:0 !important; padding:0px 2px !important; } ' +
306
+ '.jstree li a ins { height:16px; width:16px; margin-right:3px; } ' +
307
+ '.jstree-rtl li a ins { margin-right:0px; margin-left:3px; } ';
308
+ }
309
+ // Correct IE 7 (shifts anchor nodes onhover)
310
+ if(/msie/.test(u) && parseInt(v, 10) == 7) {
311
+ css_string += '.jstree li a { border-width:0 !important; padding:0px 2px !important; } ';
312
+ }
313
+ $.vakata.css.add_sheet({ str : css_string });
314
+ });
315
+
316
+ // core functions (open, close, create, update, delete)
317
+ $.jstree.plugin("core", {
318
+ __init : function () {
319
+ this.data.core.to_open = $.map($.makeArray(this.get_settings().core.initially_open), function (n) { return "#" + n.toString().replace(/^#/,"").replace('\\/','/').replace('/','\\/'); });
320
+ },
321
+ defaults : {
322
+ html_titles : false,
323
+ animation : 500,
324
+ initially_open : [],
325
+ rtl : false,
326
+ strings : {
327
+ loading : "Loading ...",
328
+ new_node : "New node"
329
+ }
330
+ },
331
+ _fn : {
332
+ init : function () {
333
+ this.set_focus();
334
+ if(this._get_settings().core.rtl) {
335
+ this.get_container().addClass("jstree-rtl").css("direction", "rtl");
336
+ }
337
+ 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>");
338
+ this.data.core.li_height = this.get_container().find("ul li.jstree-closed, ul li.jstree-leaf").eq(0).height() || 18;
339
+
340
+ this.get_container()
341
+ .delegate("li > ins", "click.jstree", $.proxy(function (event) {
342
+ var trgt = $(event.target);
343
+ if(trgt.is("ins") && event.pageY - trgt.offset().top < this.data.core.li_height) { this.toggle_node(trgt); }
344
+ }, this))
345
+ .bind("mousedown.jstree", $.proxy(function () {
346
+ this.set_focus(); // This used to be setTimeout(set_focus,0) - why?
347
+ }, this))
348
+ .bind("dblclick.jstree", function (event) {
349
+ var sel;
350
+ if(document.selection && document.selection.empty) { document.selection.empty(); }
351
+ else {
352
+ if(window.getSelection) {
353
+ sel = window.getSelection();
354
+ try {
355
+ sel.removeAllRanges();
356
+ sel.collapse();
357
+ } catch (err) { }
358
+ }
359
+ }
360
+ });
361
+ this.__callback();
362
+ this.load_node(-1, function () { this.loaded(); this.reopen(); });
363
+ },
364
+ destroy : function () {
365
+ var i,
366
+ n = this.get_index(),
367
+ s = this._get_settings(),
368
+ _this = this;
369
+
370
+ $.each(s.plugins, function (i, val) {
371
+ try { plugins[val].__destroy.apply(_this); } catch(err) { }
372
+ });
373
+ this.__callback();
374
+ // set focus to another instance if this one is focused
375
+ if(this.is_focused()) {
376
+ for(i in instances) {
377
+ if(instances.hasOwnProperty(i) && i != n) {
378
+ instances[i].set_focus();
379
+ break;
380
+ }
381
+ }
382
+ }
383
+ // if no other instance found
384
+ if(n === focused_instance) { focused_instance = -1; }
385
+ // remove all traces of jstree in the DOM (only the ones set using jstree*) and cleans all events
386
+ this.get_container()
387
+ .unbind(".jstree")
388
+ .undelegate(".jstree")
389
+ .removeData("jstree-instance-id")
390
+ .find("[class^='jstree']")
391
+ .andSelf()
392
+ .attr("class", function () { return this.className.replace(/jstree[^ ]*|$/ig,''); });
393
+ // remove the actual data
394
+ instances[n] = null;
395
+ delete instances[n];
396
+ },
397
+ save_opened : function () {
398
+ var _this = this;
399
+ this.data.core.to_open = [];
400
+ this.get_container().find(".jstree-open").each(function () {
401
+ _this.data.core.to_open.push("#" + this.id.toString().replace(/^#/,"").replace('\\/','/').replace('/','\\/'));
402
+ });
403
+ this.__callback(_this.data.core.to_open);
404
+ },
405
+ reopen : function (is_callback) {
406
+ var _this = this,
407
+ done = true,
408
+ current = [],
409
+ remaining = [];
410
+ if(!is_callback) { this.data.core.reopen = false; this.data.core.refreshing = true; }
411
+ if(this.data.core.to_open.length) {
412
+ $.each(this.data.core.to_open, function (i, val) {
413
+ if(val == "#") { return true; }
414
+ if($(val).length && $(val).is(".jstree-closed")) { current.push(val); }
415
+ else { remaining.push(val); }
416
+ });
417
+ if(current.length) {
418
+ this.data.core.to_open = remaining;
419
+ $.each(current, function (i, val) {
420
+ _this.open_node(val, function () { _this.reopen(true); }, true);
421
+ });
422
+ done = false;
423
+ }
424
+ }
425
+ if(done) {
426
+ // TODO: find a more elegant approach to syncronizing returning requests
427
+ if(this.data.core.reopen) { clearTimeout(this.data.core.reopen); }
428
+ this.data.core.reopen = setTimeout(function () { _this.__callback({}, _this); }, 50);
429
+ this.data.core.refreshing = false;
430
+ }
431
+ },
432
+ refresh : function (obj) {
433
+ var _this = this;
434
+ this.save_opened();
435
+ if(!obj) { obj = -1; }
436
+ obj = this._get_node(obj);
437
+ if(!obj) { obj = -1; }
438
+ if(obj !== -1) { obj.children("UL").remove(); }
439
+ this.load_node(obj, function () { _this.__callback({ "obj" : obj}); _this.reopen(); });
440
+ },
441
+ // Dummy function to fire after the first load (so that there is a jstree.loaded event)
442
+ loaded : function () {
443
+ this.__callback();
444
+ },
445
+ // deal with focus
446
+ set_focus : function () {
447
+ var f = $.jstree._focused();
448
+ if(f && f !== this) {
449
+ f.get_container().removeClass("jstree-focused");
450
+ }
451
+ if(f !== this) {
452
+ this.get_container().addClass("jstree-focused");
453
+ focused_instance = this.get_index();
454
+ }
455
+ this.__callback();
456
+ },
457
+ is_focused : function () {
458
+ return focused_instance == this.get_index();
459
+ },
460
+
461
+ // traverse
462
+ _get_node : function (obj) {
463
+ var $obj = $(obj, this.get_container());
464
+ if($obj.is(".jstree") || obj == -1) { return -1; }
465
+ $obj = $obj.closest("li", this.get_container());
466
+ return $obj.length ? $obj : false;
467
+ },
468
+ _get_next : function (obj, strict) {
469
+ obj = this._get_node(obj);
470
+ if(obj === -1) { return this.get_container().find("> ul > li:first-child"); }
471
+ if(!obj.length) { return false; }
472
+ if(strict) { return (obj.nextAll("li").size() > 0) ? obj.nextAll("li:eq(0)") : false; }
473
+
474
+ if(obj.hasClass("jstree-open")) { return obj.find("li:eq(0)"); }
475
+ else if(obj.nextAll("li").size() > 0) { return obj.nextAll("li:eq(0)"); }
476
+ else { return obj.parentsUntil(".jstree","li").next("li").eq(0); }
477
+ },
478
+ _get_prev : function (obj, strict) {
479
+ obj = this._get_node(obj);
480
+ if(obj === -1) { return this.get_container().find("> ul > li:last-child"); }
481
+ if(!obj.length) { return false; }
482
+ if(strict) { return (obj.prevAll("li").length > 0) ? obj.prevAll("li:eq(0)") : false; }
483
+
484
+ if(obj.prev("li").length) {
485
+ obj = obj.prev("li").eq(0);
486
+ while(obj.hasClass("jstree-open")) { obj = obj.children("ul:eq(0)").children("li:last"); }
487
+ return obj;
488
+ }
489
+ else { var o = obj.parentsUntil(".jstree","li:eq(0)"); return o.length ? o : false; }
490
+ },
491
+ _get_parent : function (obj) {
492
+ obj = this._get_node(obj);
493
+ if(obj == -1 || !obj.length) { return false; }
494
+ var o = obj.parentsUntil(".jstree", "li:eq(0)");
495
+ return o.length ? o : -1;
496
+ },
497
+ _get_children : function (obj) {
498
+ obj = this._get_node(obj);
499
+ if(obj === -1) { return this.get_container().children("ul:eq(0)").children("li"); }
500
+ if(!obj.length) { return false; }
501
+ return obj.children("ul:eq(0)").children("li");
502
+ },
503
+ get_path : function (obj, id_mode) {
504
+ var p = [],
505
+ _this = this;
506
+ obj = this._get_node(obj);
507
+ if(obj === -1 || !obj || !obj.length) { return false; }
508
+ obj.parentsUntil(".jstree", "li").each(function () {
509
+ p.push( id_mode ? this.id : _this.get_text(this) );
510
+ });
511
+ p.reverse();
512
+ p.push( id_mode ? obj.attr("id") : this.get_text(obj) );
513
+ return p;
514
+ },
515
+
516
+ is_open : function (obj) { obj = this._get_node(obj); return obj && obj !== -1 && obj.hasClass("jstree-open"); },
517
+ is_closed : function (obj) { obj = this._get_node(obj); return obj && obj !== -1 && obj.hasClass("jstree-closed"); },
518
+ is_leaf : function (obj) { obj = this._get_node(obj); return obj && obj !== -1 && obj.hasClass("jstree-leaf"); },
519
+ // open/close
520
+ open_node : function (obj, callback, skip_animation) {
521
+ obj = this._get_node(obj);
522
+ if(!obj.length) { return false; }
523
+ if(!obj.hasClass("jstree-closed")) { if(callback) { callback.call(); } return false; }
524
+ var s = skip_animation || is_ie6 ? 0 : this._get_settings().core.animation,
525
+ t = this;
526
+ if(!this._is_loaded(obj)) {
527
+ obj.children("a").addClass("jstree-loading");
528
+ this.load_node(obj, function () { t.open_node(obj, callback, skip_animation); }, callback);
529
+ }
530
+ else {
531
+ if(s) { obj.children("ul").css("display","none"); }
532
+ obj.removeClass("jstree-closed").addClass("jstree-open").children("a").removeClass("jstree-loading");
533
+ if(s) { obj.children("ul").stop(true).slideDown(s, function () { this.style.display = ""; }); }
534
+ this.__callback({ "obj" : obj });
535
+ if(callback) { callback.call(); }
536
+ }
537
+ },
538
+ close_node : function (obj, skip_animation) {
539
+ obj = this._get_node(obj);
540
+ var s = skip_animation || is_ie6 ? 0 : this._get_settings().core.animation;
541
+ if(!obj.length || !obj.hasClass("jstree-open")) { return false; }
542
+ if(s) { obj.children("ul").attr("style","display:block !important"); }
543
+ obj.removeClass("jstree-open").addClass("jstree-closed");
544
+ if(s) { obj.children("ul").stop(true).slideUp(s, function () { this.style.display = ""; }); }
545
+ this.__callback({ "obj" : obj });
546
+ },
547
+ toggle_node : function (obj) {
548
+ obj = this._get_node(obj);
549
+ if(obj.hasClass("jstree-closed")) { return this.open_node(obj); }
550
+ if(obj.hasClass("jstree-open")) { return this.close_node(obj); }
551
+ },
552
+ open_all : function (obj, original_obj) {
553
+ obj = obj ? this._get_node(obj) : this.get_container();
554
+ if(!obj || obj === -1) { obj = this.get_container(); }
555
+ if(original_obj) {
556
+ obj = obj.find("li.jstree-closed");
557
+ }
558
+ else {
559
+ original_obj = obj;
560
+ if(obj.is(".jstree-closed")) { obj = obj.find("li.jstree-closed").andSelf(); }
561
+ else { obj = obj.find("li.jstree-closed"); }
562
+ }
563
+ var _this = this;
564
+ obj.each(function () {
565
+ var __this = this;
566
+ if(!_this._is_loaded(this)) { _this.open_node(this, function() { _this.open_all(__this, original_obj); }, true); }
567
+ else { _this.open_node(this, false, true); }
568
+ });
569
+ // so that callback is fired AFTER all nodes are open
570
+ if(original_obj.find('li.jstree-closed').length === 0) { this.__callback({ "obj" : original_obj }); }
571
+ },
572
+ close_all : function (obj) {
573
+ var _this = this;
574
+ obj = obj ? this._get_node(obj) : this.get_container();
575
+ if(!obj || obj === -1) { obj = this.get_container(); }
576
+ obj.find("li.jstree-open").andSelf().each(function () { _this.close_node(this); });
577
+ this.__callback({ "obj" : obj });
578
+ },
579
+ clean_node : function (obj) {
580
+ obj = obj && obj != -1 ? $(obj) : this.get_container();
581
+ obj = obj.is("li") ? obj.find("li").andSelf() : obj.find("li");
582
+ obj.removeClass("jstree-last")
583
+ .filter("li:last-child").addClass("jstree-last").end()
584
+ .filter(":has(li)")
585
+ .not(".jstree-open").removeClass("jstree-leaf").addClass("jstree-closed");
586
+ obj.not(".jstree-open, .jstree-closed").addClass("jstree-leaf").children("ul").remove();
587
+ this.__callback({ "obj" : obj });
588
+ },
589
+ // rollback
590
+ get_rollback : function () {
591
+ this.__callback();
592
+ return { i : this.get_index(), h : this.get_container().children("ul").clone(true), d : this.data };
593
+ },
594
+ set_rollback : function (html, data) {
595
+ this.get_container().empty().append(html);
596
+ this.data = data;
597
+ this.__callback();
598
+ },
599
+ // Dummy functions to be overwritten by any datastore plugin included
600
+ load_node : function (obj, s_call, e_call) { this.__callback({ "obj" : obj }); },
601
+ _is_loaded : function (obj) { return true; },
602
+
603
+ // Basic operations: create
604
+ create_node : function (obj, position, js, callback, is_loaded) {
605
+ obj = this._get_node(obj);
606
+ position = typeof position === "undefined" ? "last" : position;
607
+ var d = $("<li>"),
608
+ s = this._get_settings().core,
609
+ tmp;
610
+
611
+ if(obj !== -1 && !obj.length) { return false; }
612
+ if(!is_loaded && !this._is_loaded(obj)) { this.load_node(obj, function () { this.create_node(obj, position, js, callback, true); }); return false; }
613
+
614
+ this.__rollback();
615
+
616
+ if(typeof js === "string") { js = { "data" : js }; }
617
+ if(!js) { js = {}; }
618
+ if(js.attr) { d.attr(js.attr); }
619
+ if(js.state) { d.addClass("jstree-" + js.state); }
620
+ if(!js.data) { js.data = s.strings.new_node; }
621
+ if(!$.isArray(js.data)) { tmp = js.data; js.data = []; js.data.push(tmp); }
622
+ $.each(js.data, function (i, m) {
623
+ tmp = $("<a>");
624
+ if($.isFunction(m)) { m = m.call(this, js); }
625
+ if(typeof m == "string") { tmp.attr('href','#')[ s.html_titles ? "html" : "text" ](m); }
626
+ else {
627
+ if(!m.attr) { m.attr = {}; }
628
+ if(!m.attr.href) { m.attr.href = '#'; }
629
+ tmp.attr(m.attr)[ s.html_titles ? "html" : "text" ](m.title);
630
+ if(m.language) { tmp.addClass(m.language); }
631
+ }
632
+ tmp.prepend("<ins class='jstree-icon'>&#160;</ins>");
633
+ if(m.icon) {
634
+ if(m.icon.indexOf("/") === -1) { tmp.children("ins").addClass(m.icon); }
635
+ else { tmp.children("ins").css("background","url('" + m.icon + "') center center no-repeat"); }
636
+ }
637
+ d.append(tmp);
638
+ });
639
+ d.prepend("<ins class='jstree-icon'>&#160;</ins>");
640
+ if(obj === -1) {
641
+ obj = this.get_container();
642
+ if(position === "before") { position = "first"; }
643
+ if(position === "after") { position = "last"; }
644
+ }
645
+ switch(position) {
646
+ case "before": obj.before(d); tmp = this._get_parent(obj); break;
647
+ case "after" : obj.after(d); tmp = this._get_parent(obj); break;
648
+ case "inside":
649
+ case "first" :
650
+ if(!obj.children("ul").length) { obj.append("<ul>"); }
651
+ obj.children("ul").prepend(d);
652
+ tmp = obj;
653
+ break;
654
+ case "last":
655
+ if(!obj.children("ul").length) { obj.append("<ul>"); }
656
+ obj.children("ul").append(d);
657
+ tmp = obj;
658
+ break;
659
+ default:
660
+ if(!obj.children("ul").length) { obj.append("<ul>"); }
661
+ if(!position) { position = 0; }
662
+ tmp = obj.children("ul").children("li").eq(position);
663
+ if(tmp.length) { tmp.before(d); }
664
+ else { obj.children("ul").append(d); }
665
+ tmp = obj;
666
+ break;
667
+ }
668
+ if(tmp === -1 || tmp.get(0) === this.get_container().get(0)) { tmp = -1; }
669
+ this.clean_node(tmp);
670
+ this.__callback({ "obj" : d, "parent" : tmp });
671
+ if(callback) { callback.call(this, d); }
672
+ return d;
673
+ },
674
+ // Basic operations: rename (deal with text)
675
+ get_text : function (obj) {
676
+ obj = this._get_node(obj);
677
+ if(!obj.length) { return false; }
678
+ var s = this._get_settings().core.html_titles;
679
+ obj = obj.children("a:eq(0)");
680
+ if(s) {
681
+ obj = obj.clone();
682
+ obj.children("INS").remove();
683
+ return obj.html();
684
+ }
685
+ else {
686
+ obj = obj.contents().filter(function() { return this.nodeType == 3; })[0];
687
+ return obj.nodeValue;
688
+ }
689
+ },
690
+ set_text : function (obj, val) {
691
+ obj = this._get_node(obj);
692
+ if(!obj.length) { return false; }
693
+ obj = obj.children("a:eq(0)");
694
+ if(this._get_settings().core.html_titles) {
695
+ var tmp = obj.children("INS").clone();
696
+ obj.html(val).prepend(tmp);
697
+ this.__callback({ "obj" : obj, "name" : val });
698
+ return true;
699
+ }
700
+ else {
701
+ obj = obj.contents().filter(function() { return this.nodeType == 3; })[0];
702
+ this.__callback({ "obj" : obj, "name" : val });
703
+ return (obj.nodeValue = val);
704
+ }
705
+ },
706
+ rename_node : function (obj, val) {
707
+ obj = this._get_node(obj);
708
+ this.__rollback();
709
+ if(obj && obj.length && this.set_text.apply(this, Array.prototype.slice.call(arguments))) { this.__callback({ "obj" : obj, "name" : val }); }
710
+ },
711
+ // Basic operations: deleting nodes
712
+ delete_node : function (obj) {
713
+ obj = this._get_node(obj);
714
+ if(!obj.length) { return false; }
715
+ this.__rollback();
716
+ var p = this._get_parent(obj), prev = this._get_prev(obj);
717
+ obj = obj.remove();
718
+ if(p !== -1 && p.find("> ul > li").length === 0) {
719
+ p.removeClass("jstree-open jstree-closed").addClass("jstree-leaf");
720
+ }
721
+ this.clean_node(p);
722
+ this.__callback({ "obj" : obj, "prev" : prev });
723
+ return obj;
724
+ },
725
+ prepare_move : function (o, r, pos, cb, is_cb) {
726
+ var p = {};
727
+
728
+ p.ot = $.jstree._reference(p.o) || this;
729
+ p.o = p.ot._get_node(o);
730
+ p.r = r === - 1 ? -1 : this._get_node(r);
731
+ p.p = (typeof p === "undefined") ? "last" : pos; // TODO: move to a setting
732
+ 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) {
733
+ this.__callback(prepared_move);
734
+ if(cb) { cb.call(this, prepared_move); }
735
+ return;
736
+ }
737
+ p.ot = $.jstree._reference(p.o) || this;
738
+ p.rt = r === -1 ? p.ot : $.jstree._reference(p.r) || this;
739
+ if(p.r === -1) {
740
+ p.cr = -1;
741
+ switch(p.p) {
742
+ case "first":
743
+ case "before":
744
+ case "inside":
745
+ p.cp = 0;
746
+ break;
747
+ case "after":
748
+ case "last":
749
+ p.cp = p.rt.get_container().find(" > ul > li").length;
750
+ break;
751
+ default:
752
+ p.cp = p.p;
753
+ break;
754
+ }
755
+ }
756
+ else {
757
+ if(!/^(before|after)$/.test(p.p) && !this._is_loaded(p.r)) {
758
+ return this.load_node(p.r, function () { this.prepare_move(o, r, pos, cb, true); });
759
+ }
760
+ switch(p.p) {
761
+ case "before":
762
+ p.cp = p.r.index();
763
+ p.cr = p.rt._get_parent(p.r);
764
+ break;
765
+ case "after":
766
+ p.cp = p.r.index() + 1;
767
+ p.cr = p.rt._get_parent(p.r);
768
+ break;
769
+ case "inside":
770
+ case "first":
771
+ p.cp = 0;
772
+ p.cr = p.r;
773
+ break;
774
+ case "last":
775
+ p.cp = p.r.find(" > ul > li").length;
776
+ p.cr = p.r;
777
+ break;
778
+ default:
779
+ p.cp = p.p;
780
+ p.cr = p.r;
781
+ break;
782
+ }
783
+ }
784
+ p.np = p.cr == -1 ? p.rt.get_container() : p.cr;
785
+ p.op = p.ot._get_parent(p.o);
786
+ p.or = p.np.find(" > ul > li:nth-child(" + (p.cp + 1) + ")");
787
+
788
+ prepared_move = p;
789
+ this.__callback(prepared_move);
790
+ if(cb) { cb.call(this, prepared_move); }
791
+ },
792
+ check_move : function () {
793
+ var obj = prepared_move, ret = true;
794
+ if(obj.or[0] === obj.o[0]) { return false; }
795
+ obj.o.each(function () {
796
+ if(obj.r.parentsUntil(".jstree").andSelf().filter("li").index(this) !== -1) { ret = false; return false; }
797
+ });
798
+ return ret;
799
+ },
800
+ move_node : function (obj, ref, position, is_copy, is_prepared, skip_check) {
801
+ if(!is_prepared) {
802
+ return this.prepare_move(obj, ref, position, function (p) {
803
+ this.move_node(p, false, false, is_copy, true, skip_check);
804
+ });
805
+ }
806
+ if(!skip_check && !this.check_move()) { return false; }
807
+
808
+ this.__rollback();
809
+ var o = false;
810
+ if(is_copy) {
811
+ o = obj.o.clone();
812
+ o.find("*[id]").andSelf().each(function () {
813
+ if(this.id) { this.id = "copy_" + this.id; }
814
+ });
815
+ }
816
+ else { o = obj.o; }
817
+
818
+ if(obj.or.length) { obj.or.before(o); }
819
+ else {
820
+ if(!obj.np.children("ul").length) { $("<ul>").appendTo(obj.np); }
821
+ obj.np.children("ul:eq(0)").append(o);
822
+ }
823
+
824
+ try {
825
+ obj.ot.clean_node(obj.op);
826
+ obj.rt.clean_node(obj.np);
827
+ if(!obj.op.find("> ul > li").length) {
828
+ obj.op.removeClass("jstree-open jstree-closed").addClass("jstree-leaf").children("ul").remove();
829
+ }
830
+ } catch (e) { }
831
+
832
+ if(is_copy) {
833
+ prepared_move.cy = true;
834
+ prepared_move.oc = o;
835
+ }
836
+ this.__callback(prepared_move);
837
+ return prepared_move;
838
+ },
839
+ _get_move : function () { return prepared_move; }
840
+ }
841
+ });
842
+ })(jQuery);
843
+ //*/
844
+
845
+ /*
846
+ * jsTree ui plugin 1.0
847
+ * This plugins handles selecting/deselecting/hovering/dehovering nodes
848
+ */
849
+ (function ($) {
850
+ $.jstree.plugin("ui", {
851
+ __init : function () {
852
+ this.data.ui.selected = $();
853
+ this.data.ui.last_selected = false;
854
+ this.data.ui.hovered = null;
855
+ this.data.ui.to_select = this.get_settings().ui.initially_select;
856
+
857
+ this.get_container()
858
+ .delegate("a", "click.jstree", $.proxy(function (event) {
859
+ event.preventDefault();
860
+ this.select_node(event.currentTarget, true, event);
861
+ }, this))
862
+ .delegate("a", "mouseenter.jstree", $.proxy(function (event) {
863
+ this.hover_node(event.target);
864
+ }, this))
865
+ .delegate("a", "mouseleave.jstree", $.proxy(function (event) {
866
+ this.dehover_node(event.target);
867
+ }, this))
868
+ .bind("reopen.jstree", $.proxy(function () {
869
+ this.reselect();
870
+ }, this))
871
+ .bind("get_rollback.jstree", $.proxy(function () {
872
+ this.dehover_node();
873
+ this.save_selected();
874
+ }, this))
875
+ .bind("set_rollback.jstree", $.proxy(function () {
876
+ this.reselect();
877
+ }, this))
878
+ .bind("close_node.jstree", $.proxy(function (event, data) {
879
+ var s = this._get_settings().ui,
880
+ obj = this._get_node(data.rslt.obj),
881
+ clk = (obj && obj.length) ? obj.children("ul").find(".jstree-clicked") : $(),
882
+ _this = this;
883
+ if(s.selected_parent_close === false || !clk.length) { return; }
884
+ clk.each(function () {
885
+ _this.deselect_node(this);
886
+ if(s.selected_parent_close === "select_parent") { _this.select_node(obj); }
887
+ });
888
+ }, this))
889
+ .bind("delete_node.jstree", $.proxy(function (event, data) {
890
+ var s = this._get_settings().ui.select_prev_on_delete,
891
+ obj = this._get_node(data.rslt.obj),
892
+ clk = (obj && obj.length) ? obj.find(".jstree-clicked") : [],
893
+ _this = this;
894
+ clk.each(function () { _this.deselect_node(this); });
895
+ if(s && clk.length) { this.select_node(data.rslt.prev); }
896
+ }, this))
897
+ .bind("move_node.jstree", $.proxy(function (event, data) {
898
+ if(data.rslt.cy) {
899
+ data.rslt.oc.find(".jstree-clicked").removeClass("jstree-clicked");
900
+ }
901
+ }, this));
902
+ },
903
+ defaults : {
904
+ select_limit : -1, // 0, 1, 2 ... or -1 for unlimited
905
+ select_multiple_modifier : "ctrl", // on, or ctrl, shift, alt
906
+ selected_parent_close : "select_parent", // false, "deselect", "select_parent"
907
+ select_prev_on_delete : true,
908
+ disable_selecting_children : false,
909
+ initially_select : []
910
+ },
911
+ _fn : {
912
+ _get_node : function (obj, allow_multiple) {
913
+ if(typeof obj === "undefined" || obj === null) { return allow_multiple ? this.data.ui.selected : this.data.ui.last_selected; }
914
+ var $obj = $(obj, this.get_container());
915
+ if($obj.is(".jstree") || obj == -1) { return -1; }
916
+ $obj = $obj.closest("li", this.get_container());
917
+ return $obj.length ? $obj : false;
918
+ },
919
+ save_selected : function () {
920
+ var _this = this;
921
+ this.data.ui.to_select = [];
922
+ this.data.ui.selected.each(function () { _this.data.ui.to_select.push("#" + this.id.toString().replace(/^#/,"").replace('\\/','/').replace('/','\\/')); });
923
+ this.__callback(this.data.ui.to_select);
924
+ },
925
+ reselect : function () {
926
+ var _this = this,
927
+ s = this.data.ui.to_select;
928
+ s = $.map($.makeArray(s), function (n) { return "#" + n.toString().replace(/^#/,"").replace('\\/','/').replace('/','\\/'); });
929
+ this.deselect_all();
930
+ $.each(s, function (i, val) { if(val && val !== "#") { _this.select_node(val); } });
931
+ this.__callback();
932
+ },
933
+ refresh : function (obj) {
934
+ this.save_selected();
935
+ return this.__call_old();
936
+ },
937
+ hover_node : function (obj) {
938
+ obj = this._get_node(obj);
939
+ if(!obj.length) { return false; }
940
+ //if(this.data.ui.hovered && obj.get(0) === this.data.ui.hovered.get(0)) { return; }
941
+ if(!obj.hasClass("jstree-hovered")) { this.dehover_node(); }
942
+ this.data.ui.hovered = obj.children("a").addClass("jstree-hovered").parent();
943
+ this.__callback({ "obj" : obj });
944
+ },
945
+ dehover_node : function () {
946
+ var obj = this.data.ui.hovered, p;
947
+ if(!obj || !obj.length) { return false; }
948
+ p = obj.children("a").removeClass("jstree-hovered").parent();
949
+ if(this.data.ui.hovered[0] === p[0]) { this.data.ui.hovered = null; }
950
+ this.__callback({ "obj" : obj });
951
+ },
952
+ select_node : function (obj, check, e) {
953
+ obj = this._get_node(obj);
954
+ if(obj == -1 || !obj || !obj.length) { return false; }
955
+ var s = this._get_settings().ui,
956
+ is_multiple = (s.select_multiple_modifier == "on" || (s.select_multiple_modifier !== false && e && e[s.select_multiple_modifier + "Key"])),
957
+ is_selected = this.is_selected(obj),
958
+ proceed = true;
959
+ if(check) {
960
+ if(s.disable_selecting_children && is_multiple && obj.parents("li", this.get_container()).children(".jstree-clicked").length) {
961
+ return false;
962
+ }
963
+ proceed = false;
964
+ switch(!0) {
965
+ case (is_selected && !is_multiple):
966
+ this.deselect_all();
967
+ is_selected = false;
968
+ proceed = true;
969
+ break;
970
+ case (!is_selected && !is_multiple):
971
+ if(s.select_limit == -1 || s.select_limit > 0) {
972
+ this.deselect_all();
973
+ proceed = true;
974
+ }
975
+ break;
976
+ case (is_selected && is_multiple):
977
+ this.deselect_node(obj);
978
+ break;
979
+ case (!is_selected && is_multiple):
980
+ if(s.select_limit == -1 || this.data.ui.selected.length + 1 <= s.select_limit) {
981
+ proceed = true;
982
+ }
983
+ break;
984
+ }
985
+ }
986
+ if(proceed && !is_selected) {
987
+ obj.children("a").addClass("jstree-clicked");
988
+ this.data.ui.selected = this.data.ui.selected.add(obj);
989
+ this.data.ui.last_selected = obj;
990
+ this.__callback({ "obj" : obj });
991
+ }
992
+ },
993
+ deselect_node : function (obj) {
994
+ obj = this._get_node(obj);
995
+ if(!obj.length) { return false; }
996
+ if(this.is_selected(obj)) {
997
+ obj.children("a").removeClass("jstree-clicked");
998
+ this.data.ui.selected = this.data.ui.selected.not(obj);
999
+ if(this.data.ui.last_selected.get(0) === obj.get(0)) { this.data.ui.last_selected = this.data.ui.selected.eq(0); }
1000
+ this.__callback({ "obj" : obj });
1001
+ }
1002
+ },
1003
+ toggle_select : function (obj) {
1004
+ obj = this._get_node(obj);
1005
+ if(!obj.length) { return false; }
1006
+ if(this.is_selected(obj)) { this.deselect_node(obj); }
1007
+ else { this.select_node(obj); }
1008
+ },
1009
+ is_selected : function (obj) { return this.data.ui.selected.index(this._get_node(obj)) >= 0; },
1010
+ get_selected : function (context) {
1011
+ return context ? $(context).find(".jstree-clicked").parent() : this.data.ui.selected;
1012
+ },
1013
+ deselect_all : function (context) {
1014
+ if(context) { $(context).find(".jstree-clicked").removeClass("jstree-clicked"); }
1015
+ else { this.get_container().find(".jstree-clicked").removeClass("jstree-clicked"); }
1016
+ this.data.ui.selected = $([]);
1017
+ this.data.ui.last_selected = false;
1018
+ this.__callback();
1019
+ }
1020
+ }
1021
+ });
1022
+ // include the selection plugin by default
1023
+ $.jstree.defaults.plugins.push("ui");
1024
+ })(jQuery);
1025
+ //*/
1026
+
1027
+ /*
1028
+ * jsTree CRRM plugin 1.0
1029
+ * Handles creating/renaming/removing/moving nodes by user interaction.
1030
+ */
1031
+ (function ($) {
1032
+ $.jstree.plugin("crrm", {
1033
+ __init : function () {
1034
+ this.get_container()
1035
+ .bind("move_node.jstree", $.proxy(function (e, data) {
1036
+ if(this._get_settings().crrm.move.open_onmove) {
1037
+ var t = this;
1038
+ data.rslt.np.parentsUntil(".jstree").andSelf().filter(".jstree-closed").each(function () {
1039
+ t.open_node(this, false, true);
1040
+ });
1041
+ }
1042
+ }, this));
1043
+ },
1044
+ defaults : {
1045
+ input_width_limit : 200,
1046
+ move : {
1047
+ always_copy : false, // false, true or "multitree"
1048
+ open_onmove : true,
1049
+ default_position : "last",
1050
+ check_move : function (m) { return true; }
1051
+ }
1052
+ },
1053
+ _fn : {
1054
+ _show_input : function (obj, callback) {
1055
+ obj = this._get_node(obj);
1056
+ var rtl = this._get_settings().core.rtl,
1057
+ w = this._get_settings().crrm.input_width_limit,
1058
+ w1 = obj.children("ins").width(),
1059
+ w2 = obj.find("> a:visible > ins").width() * obj.find("> a:visible > ins").length,
1060
+ t = this.get_text(obj),
1061
+ h1 = $("<div>", { css : { "position" : "absolute", "top" : "-200px", "left" : (rtl ? "0px" : "-1000px"), "visibility" : "hidden" } }).appendTo("body"),
1062
+ h2 = obj.css("position","relative").append(
1063
+ $("<input>", {
1064
+ "value" : t,
1065
+ // "size" : t.length,
1066
+ "css" : {
1067
+ "padding" : "0",
1068
+ "border" : "1px solid silver",
1069
+ "position" : "absolute",
1070
+ "left" : (rtl ? "auto" : (w1 + w2 + 4) + "px"),
1071
+ "right" : (rtl ? (w1 + w2 + 4) + "px" : "auto"),
1072
+ "top" : "0px",
1073
+ "height" : (this.data.core.li_height - 2) + "px",
1074
+ "lineHeight" : (this.data.core.li_height - 2) + "px",
1075
+ "width" : "150px" // will be set a bit further down
1076
+ },
1077
+ "blur" : $.proxy(function () {
1078
+ var i = obj.children("input"),
1079
+ v = i.val();
1080
+ if(v === "") { v = t; }
1081
+ i.remove(); // rollback purposes
1082
+ this.set_text(obj,t); // rollback purposes
1083
+ this.rename_node(obj, v);
1084
+ callback.call(this, obj, v, t);
1085
+ obj.css("position","");
1086
+ }, this),
1087
+ "keyup" : function (event) {
1088
+ var key = event.keyCode || event.which;
1089
+ if(key == 27) { this.value = t; this.blur(); return; }
1090
+ else if(key == 13) { this.blur(); return; }
1091
+ else {
1092
+ h2.width(Math.min(h1.text("pW" + this.value).width(),w));
1093
+ }
1094
+ }
1095
+ })
1096
+ ).children("input");
1097
+ this.set_text(obj, "");
1098
+ h1.css({
1099
+ fontFamily : h2.css('fontFamily') || '',
1100
+ fontSize : h2.css('fontSize') || '',
1101
+ fontWeight : h2.css('fontWeight') || '',
1102
+ fontStyle : h2.css('fontStyle') || '',
1103
+ fontStretch : h2.css('fontStretch') || '',
1104
+ fontVariant : h2.css('fontVariant') || '',
1105
+ letterSpacing : h2.css('letterSpacing') || '',
1106
+ wordSpacing : h2.css('wordSpacing') || ''
1107
+ });
1108
+ h2.width(Math.min(h1.text("pW" + h2[0].value).width(),w))[0].select();
1109
+ },
1110
+ rename : function (obj) {
1111
+ obj = this._get_node(obj);
1112
+ this.__rollback();
1113
+ var f = this.__callback;
1114
+ this._show_input(obj, function (obj, new_name, old_name) {
1115
+ f.call(this, { "obj" : obj, "new_name" : new_name, "old_name" : old_name });
1116
+ });
1117
+ },
1118
+ create : function (obj, position, js, callback, skip_rename) {
1119
+ var t, _this = this;
1120
+ obj = this._get_node(obj);
1121
+ if(!obj) { obj = -1; }
1122
+ this.__rollback();
1123
+ t = this.create_node(obj, position, js, function (t) {
1124
+ var p = this._get_parent(t),
1125
+ pos = $(t).index();
1126
+ if(callback) { callback.call(this, t); }
1127
+ if(p.length && p.hasClass("jstree-closed")) { this.open_node(p, false, true); }
1128
+ if(!skip_rename) {
1129
+ this._show_input(t, function (obj, new_name, old_name) {
1130
+ _this.__callback({ "obj" : obj, "name" : new_name, "parent" : p, "position" : pos });
1131
+ });
1132
+ }
1133
+ else { _this.__callback({ "obj" : t, "name" : this.get_text(t), "parent" : p, "position" : pos }); }
1134
+ });
1135
+ return t;
1136
+ },
1137
+ remove : function (obj) {
1138
+ obj = this._get_node(obj, true);
1139
+ this.__rollback();
1140
+ this.delete_node(obj);
1141
+ this.__callback({ "obj" : obj });
1142
+ },
1143
+ check_move : function () {
1144
+ if(!this.__call_old()) { return false; }
1145
+ var s = this._get_settings().crrm.move;
1146
+ if(!s.check_move.call(this, this._get_move())) { return false; }
1147
+ return true;
1148
+ },
1149
+ move_node : function (obj, ref, position, is_copy, is_prepared, skip_check) {
1150
+ var s = this._get_settings().crrm.move;
1151
+ if(!is_prepared) {
1152
+ if(!position) { position = s.default_position; }
1153
+ if(position === "inside" && !s.default_position.match(/^(before|after)$/)) { position = s.default_position; }
1154
+ return this.__call_old(true, obj, ref, position, is_copy, false, skip_check);
1155
+ }
1156
+ // if the move is already prepared
1157
+ if(s.always_copy === true || (s.always_copy === "multitree" && obj.rt.get_index() !== obj.ot.get_index() )) {
1158
+ is_copy = true;
1159
+ }
1160
+ this.__call_old(true, obj, ref, position, is_copy, true, skip_check);
1161
+ },
1162
+
1163
+ cut : function (obj) {
1164
+ obj = this._get_node(obj);
1165
+ this.data.crrm.cp_nodes = false;
1166
+ this.data.crrm.ct_nodes = false;
1167
+ if(!obj || !obj.length) { return false; }
1168
+ this.data.crrm.ct_nodes = obj;
1169
+ },
1170
+ copy : function (obj) {
1171
+ obj = this._get_node(obj);
1172
+ this.data.crrm.cp_nodes = false;
1173
+ this.data.crrm.ct_nodes = false;
1174
+ if(!obj || !obj.length) { return false; }
1175
+ this.data.crrm.cp_nodes = obj;
1176
+ },
1177
+ paste : function (obj) {
1178
+ obj = this._get_node(obj);
1179
+ if(!obj || !obj.length) { return false; }
1180
+ if(!this.data.crrm.ct_nodes && !this.data.crrm.cp_nodes) { return false; }
1181
+ if(this.data.crrm.ct_nodes) { this.move_node(this.data.crrm.ct_nodes, obj); }
1182
+ if(this.data.crrm.cp_nodes) { this.move_node(this.data.crrm.cp_nodes, obj, false, true); }
1183
+ this.data.crrm.cp_nodes = false;
1184
+ this.data.crrm.ct_nodes = false;
1185
+ }
1186
+ }
1187
+ });
1188
+ // include the crr plugin by default
1189
+ $.jstree.defaults.plugins.push("crrm");
1190
+ })(jQuery);
1191
+
1192
+ /*
1193
+ * jsTree themes plugin 1.0
1194
+ * Handles loading and setting themes, as well as detecting path to themes, etc.
1195
+ */
1196
+ (function ($) {
1197
+ var themes_loaded = [];
1198
+ // this variable stores the path to the themes folder - if left as false - it will be autodetected
1199
+ $.jstree._themes = false;
1200
+ $.jstree.plugin("themes", {
1201
+ __init : function () {
1202
+ this.get_container()
1203
+ .bind("init.jstree", $.proxy(function () {
1204
+ var s = this._get_settings().themes;
1205
+ this.data.themes.dots = s.dots;
1206
+ this.data.themes.icons = s.icons;
1207
+ //alert(s.dots);
1208
+ this.set_theme(s.theme, s.url);
1209
+ }, this))
1210
+ .bind("loaded.jstree", $.proxy(function () {
1211
+ // bound here too, as simple HTML tree's won't honor dots & icons otherwise
1212
+ if(!this.data.themes.dots) { this.hide_dots(); }
1213
+ else { this.show_dots(); }
1214
+ if(!this.data.themes.icons) { this.hide_icons(); }
1215
+ else { this.show_icons(); }
1216
+ }, this));
1217
+ },
1218
+ defaults : {
1219
+ theme : "default",
1220
+ url : false,
1221
+ dots : true,
1222
+ icons : true
1223
+ },
1224
+ _fn : {
1225
+ set_theme : function (theme_name, theme_url) {
1226
+ if(!theme_name) { return false; }
1227
+ if(!theme_url) { theme_url = $.jstree._themes + theme_name + '/style.css'; }
1228
+ if($.inArray(theme_url, themes_loaded) == -1) {
1229
+ $.vakata.css.add_sheet({ "url" : theme_url, "rel" : "jstree" });
1230
+ themes_loaded.push(theme_url);
1231
+ }
1232
+ if(this.data.themes.theme != theme_name) {
1233
+ this.get_container().removeClass('jstree-' + this.data.themes.theme);
1234
+ this.data.themes.theme = theme_name;
1235
+ }
1236
+ this.get_container().addClass('jstree-' + theme_name);
1237
+ if(!this.data.themes.dots) { this.hide_dots(); }
1238
+ else { this.show_dots(); }
1239
+ if(!this.data.themes.icons) { this.hide_icons(); }
1240
+ else { this.show_icons(); }
1241
+ this.__callback();
1242
+ },
1243
+ get_theme : function () { return this.data.themes.theme; },
1244
+
1245
+ show_dots : function () { this.data.themes.dots = true; this.get_container().children("ul").removeClass("jstree-no-dots"); },
1246
+ hide_dots : function () { this.data.themes.dots = false; this.get_container().children("ul").addClass("jstree-no-dots"); },
1247
+ toggle_dots : function () { if(this.data.themes.dots) { this.hide_dots(); } else { this.show_dots(); } },
1248
+
1249
+ show_icons : function () { this.data.themes.icons = true; this.get_container().children("ul").removeClass("jstree-no-icons"); },
1250
+ hide_icons : function () { this.data.themes.icons = false; this.get_container().children("ul").addClass("jstree-no-icons"); },
1251
+ toggle_icons: function () { if(this.data.themes.icons) { this.hide_icons(); } else { this.show_icons(); } }
1252
+ }
1253
+ });
1254
+ // autodetect themes path
1255
+ $(function () {
1256
+ if($.jstree._themes === false) {
1257
+ $("script").each(function () {
1258
+ if(this.src.toString().match(/jquery\.jstree[^\/]*?\.js(\?.*)?$/)) {
1259
+ $.jstree._themes = this.src.toString().replace(/jquery\.jstree[^\/]*?\.js(\?.*)?$/, "") + 'themes/';
1260
+ return false;
1261
+ }
1262
+ });
1263
+ }
1264
+ if($.jstree._themes === false) { $.jstree._themes = "themes/"; }
1265
+ });
1266
+ // include the themes plugin by default
1267
+ $.jstree.defaults.plugins.push("themes");
1268
+ })(jQuery);
1269
+ //*/
1270
+
1271
+ /*
1272
+ * jsTree hotkeys plugin 1.0
1273
+ * Enables keyboard navigation for all tree instances
1274
+ * Depends on the jstree ui & jquery hotkeys plugins
1275
+ */
1276
+ (function ($) {
1277
+ var bound = [];
1278
+ function exec(i, event) {
1279
+ var f = $.jstree._focused(), tmp;
1280
+ if(f && f.data && f.data.hotkeys && f.data.hotkeys.enabled) {
1281
+ tmp = f._get_settings().hotkeys[i];
1282
+ if(tmp) { return tmp.call(f, event); }
1283
+ }
1284
+ }
1285
+ $.jstree.plugin("hotkeys", {
1286
+ __init : function () {
1287
+ if(typeof $.hotkeys === "undefined") { throw "jsTree hotkeys: jQuery hotkeys plugin not included."; }
1288
+ if(!this.data.ui) { throw "jsTree hotkeys: jsTree UI plugin not included."; }
1289
+ $.each(this._get_settings().hotkeys, function (i, val) {
1290
+ if($.inArray(i, bound) == -1) {
1291
+ $(document).bind("keydown", i, function (event) { return exec(i, event); });
1292
+ bound.push(i);
1293
+ }
1294
+ });
1295
+ this.enable_hotkeys();
1296
+ },
1297
+ defaults : {
1298
+ "up" : function () {
1299
+ var o = this.data.ui.hovered || this.data.ui.last_selected || -1;
1300
+ this.hover_node(this._get_prev(o));
1301
+ return false;
1302
+ },
1303
+ "down" : function () {
1304
+ var o = this.data.ui.hovered || this.data.ui.last_selected || -1;
1305
+ this.hover_node(this._get_next(o));
1306
+ return false;
1307
+ },
1308
+ "left" : function () {
1309
+ var o = this.data.ui.hovered || this.data.ui.last_selected;
1310
+ if(o) {
1311
+ if(o.hasClass("jstree-open")) { this.close_node(o); }
1312
+ else { this.hover_node(this._get_prev(o)); }
1313
+ }
1314
+ return false;
1315
+ },
1316
+ "right" : function () {
1317
+ var o = this.data.ui.hovered || this.data.ui.last_selected;
1318
+ if(o && o.length) {
1319
+ if(o.hasClass("jstree-closed")) { this.open_node(o); }
1320
+ else { this.hover_node(this._get_next(o)); }
1321
+ }
1322
+ return false;
1323
+ },
1324
+ "space" : function () {
1325
+ if(this.data.ui.hovered) { this.data.ui.hovered.children("a:eq(0)").click(); }
1326
+ return false;
1327
+ },
1328
+ "ctrl+space" : function (event) {
1329
+ event.type = "click";
1330
+ if(this.data.ui.hovered) { this.data.ui.hovered.children("a:eq(0)").trigger(event); }
1331
+ return false;
1332
+ },
1333
+ "f2" : function () { this.rename(this.data.ui.hovered || this.data.ui.last_selected); },
1334
+ "del" : function () { this.remove(this.data.ui.hovered || this._get_node(null)); }
1335
+ },
1336
+ _fn : {
1337
+ enable_hotkeys : function () {
1338
+ this.data.hotkeys.enabled = true;
1339
+ },
1340
+ disable_hotkeys : function () {
1341
+ this.data.hotkeys.enabled = false;
1342
+ }
1343
+ }
1344
+ });
1345
+ })(jQuery);
1346
+ //*/
1347
+
1348
+ /*
1349
+ * jsTree JSON 1.0
1350
+ * The JSON data store. Datastores are build by overriding the `load_node` and `_is_loaded` functions.
1351
+ */
1352
+ (function ($) {
1353
+ $.jstree.plugin("json_data", {
1354
+ defaults : {
1355
+ data : false,
1356
+ ajax : false,
1357
+ correct_state : true,
1358
+ progressive_render : false
1359
+ },
1360
+ _fn : {
1361
+ 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); },
1362
+ _is_loaded : function (obj) {
1363
+ var s = this._get_settings().json_data, d;
1364
+ obj = this._get_node(obj);
1365
+ if(obj && obj !== -1 && s.progressive_render && !obj.is(".jstree-open, .jstree-leaf") && obj.children("ul").children("li").length === 0 && obj.data("jstree-children")) {
1366
+ d = this._parse_json(obj.data("jstree-children"));
1367
+ if(d) {
1368
+ obj.append(d);
1369
+ $.removeData(obj, "jstree-children");
1370
+ }
1371
+ this.clean_node(obj);
1372
+ return true;
1373
+ }
1374
+ return obj == -1 || !obj || !s.ajax || obj.is(".jstree-open, .jstree-leaf") || obj.children("ul").children("li").size() > 0;
1375
+ },
1376
+ load_node_json : function (obj, s_call, e_call) {
1377
+ var s = this.get_settings().json_data, d,
1378
+ error_func = function () {},
1379
+ success_func = function () {};
1380
+ obj = this._get_node(obj);
1381
+ if(obj && obj !== -1) {
1382
+ if(obj.data("jstree-is-loading")) { return; }
1383
+ else { obj.data("jstree-is-loading",true); }
1384
+ }
1385
+ switch(!0) {
1386
+ case (!s.data && !s.ajax): throw "Neither data nor ajax settings supplied.";
1387
+ case (!!s.data && !s.ajax) || (!!s.data && !!s.ajax && (!obj || obj === -1)):
1388
+ if(!obj || obj == -1) {
1389
+ d = this._parse_json(s.data);
1390
+ if(d) {
1391
+ this.get_container().children("ul").empty().append(d.children());
1392
+ this.clean_node();
1393
+ }
1394
+ else {
1395
+ if(s.correct_state) { this.get_container().children("ul").empty(); }
1396
+ }
1397
+ }
1398
+ if(s_call) { s_call.call(this); }
1399
+ break;
1400
+ case (!s.data && !!s.ajax) || (!!s.data && !!s.ajax && obj && obj !== -1):
1401
+ error_func = function (x, t, e) {
1402
+ var ef = this.get_settings().json_data.ajax.error;
1403
+ if(ef) { ef.call(this, x, t, e); }
1404
+ if(obj != -1 && obj.length) {
1405
+ obj.children(".jstree-loading").removeClass("jstree-loading");
1406
+ obj.data("jstree-is-loading",false);
1407
+ if(t === "success" && s.correct_state) { obj.removeClass("jstree-open jstree-closed").addClass("jstree-leaf"); }
1408
+ }
1409
+ else {
1410
+ if(t === "success" && s.correct_state) { this.get_container().children("ul").empty(); }
1411
+ }
1412
+ if(e_call) { e_call.call(this); }
1413
+ };
1414
+ success_func = function (d, t, x) {
1415
+ var sf = this.get_settings().json_data.ajax.success;
1416
+ if(sf) { d = sf.call(this,d,t,x) || d; }
1417
+ if(d === "" || (!$.isArray(d) && !$.isPlainObject(d))) {
1418
+ return error_func.call(this, x, t, "");
1419
+ }
1420
+ d = this._parse_json(d);
1421
+ if(d) {
1422
+ if(obj === -1 || !obj) { this.get_container().children("ul").empty().append(d.children()); }
1423
+ else { obj.append(d).children(".jstree-loading").removeClass("jstree-loading"); obj.data("jstree-is-loading",false); }
1424
+ this.clean_node(obj);
1425
+ if(s_call) { s_call.call(this); }
1426
+ }
1427
+ else {
1428
+ if(obj === -1 || !obj) {
1429
+ if(s.correct_state) {
1430
+ this.get_container().children("ul").empty();
1431
+ if(s_call) { s_call.call(this); }
1432
+ }
1433
+ }
1434
+ else {
1435
+ obj.children(".jstree-loading").removeClass("jstree-loading");
1436
+ obj.data("jstree-is-loading",false);
1437
+ if(s.correct_state) {
1438
+ obj.removeClass("jstree-open jstree-closed").addClass("jstree-leaf");
1439
+ if(s_call) { s_call.call(this); }
1440
+ }
1441
+ }
1442
+ }
1443
+ };
1444
+ s.ajax.context = this;
1445
+ s.ajax.error = error_func;
1446
+ s.ajax.success = success_func;
1447
+ if(!s.ajax.dataType) { s.ajax.dataType = "json"; }
1448
+ if($.isFunction(s.ajax.url)) { s.ajax.url = s.ajax.url.call(this, obj); }
1449
+ if($.isFunction(s.ajax.data)) { s.ajax.data = s.ajax.data.call(this, obj); }
1450
+ $.ajax(s.ajax);
1451
+ break;
1452
+ }
1453
+ },
1454
+ _parse_json : function (js, is_callback) {
1455
+ var d = false,
1456
+ p = this._get_settings(),
1457
+ s = p.json_data,
1458
+ t = p.core.html_titles,
1459
+ tmp, i, j, ul1, ul2;
1460
+
1461
+ if(!js) { return d; }
1462
+ if($.isFunction(js)) {
1463
+ js = js.call(this);
1464
+ }
1465
+ if($.isArray(js)) {
1466
+ d = $();
1467
+ if(!js.length) { return false; }
1468
+ for(i = 0, j = js.length; i < j; i++) {
1469
+ tmp = this._parse_json(js[i], true);
1470
+ if(tmp.length) { d = d.add(tmp); }
1471
+ }
1472
+ }
1473
+ else {
1474
+ if(typeof js == "string") { js = { data : js }; }
1475
+ if(!js.data && js.data !== "") { return d; }
1476
+ d = $("<li>");
1477
+ if(js.attr) { d.attr(js.attr); }
1478
+ if(js.metadata) { d.data("jstree", js.metadata); }
1479
+ if(js.state) { d.addClass("jstree-" + js.state); }
1480
+ if(!$.isArray(js.data)) { tmp = js.data; js.data = []; js.data.push(tmp); }
1481
+ $.each(js.data, function (i, m) {
1482
+ tmp = $("<a>");
1483
+ if($.isFunction(m)) { m = m.call(this, js); }
1484
+ if(typeof m == "string") { tmp.attr('href','#')[ t ? "html" : "text" ](m); }
1485
+ else {
1486
+ if(!m.attr) { m.attr = {}; }
1487
+ if(!m.attr.href) { m.attr.href = '#'; }
1488
+ tmp.attr(m.attr)[ t ? "html" : "text" ](m.title);
1489
+ if(m.language) { tmp.addClass(m.language); }
1490
+ }
1491
+ tmp.prepend("<ins class='jstree-icon'>&#160;</ins>");
1492
+ if(!m.icon && js.icon) { m.icon = js.icon; }
1493
+ if(m.icon) {
1494
+ if(m.icon.indexOf("/") === -1) { tmp.children("ins").addClass(m.icon); }
1495
+ else { tmp.children("ins").css("background","url('" + m.icon + "') center center no-repeat"); }
1496
+ }
1497
+ d.append(tmp);
1498
+ });
1499
+ d.prepend("<ins class='jstree-icon'>&#160;</ins>");
1500
+ if(js.children) {
1501
+ if(s.progressive_render && js.state !== "open") {
1502
+ d.addClass("jstree-closed").data("jstree-children", js.children);
1503
+ }
1504
+ else {
1505
+ if($.isFunction(js.children)) {
1506
+ js.children = js.children.call(this, js);
1507
+ }
1508
+ if($.isArray(js.children) && js.children.length) {
1509
+ tmp = this._parse_json(js.children, true);
1510
+ if(tmp.length) {
1511
+ ul2 = $("<ul>");
1512
+ ul2.append(tmp);
1513
+ d.append(ul2);
1514
+ }
1515
+ }
1516
+ }
1517
+ }
1518
+ }
1519
+ if(!is_callback) {
1520
+ ul1 = $("<ul>");
1521
+ ul1.append(d);
1522
+ d = ul1;
1523
+ }
1524
+ return d;
1525
+ },
1526
+ get_json : function (obj, li_attr, a_attr, is_callback) {
1527
+ var result = [],
1528
+ s = this._get_settings(),
1529
+ _this = this,
1530
+ tmp1, tmp2, li, a, t, lang;
1531
+ obj = this._get_node(obj);
1532
+ if(!obj || obj === -1) { obj = this.get_container().find("> ul > li"); }
1533
+ li_attr = $.isArray(li_attr) ? li_attr : [ "id", "class" ];
1534
+ if(!is_callback && this.data.types) { li_attr.push(s.types.type_attr); }
1535
+ a_attr = $.isArray(a_attr) ? a_attr : [ ];
1536
+
1537
+ obj.each(function () {
1538
+ li = $(this);
1539
+ tmp1 = { data : [] };
1540
+ if(li_attr.length) { tmp1.attr = { }; }
1541
+ $.each(li_attr, function (i, v) {
1542
+ tmp2 = li.attr(v);
1543
+ if(tmp2 && tmp2.length && tmp2.replace(/jstree[^ ]*|$/ig,'').length) {
1544
+ tmp1.attr[v] = tmp2.replace(/jstree[^ ]*|$/ig,'');
1545
+ }
1546
+ });
1547
+ if(li.hasClass("jstree-open")) { tmp1.state = "open"; }
1548
+ if(li.hasClass("jstree-closed")) { tmp1.state = "closed"; }
1549
+ a = li.children("a");
1550
+ a.each(function () {
1551
+ t = $(this);
1552
+ if(
1553
+ a_attr.length ||
1554
+ $.inArray("languages", s.plugins) !== -1 ||
1555
+ t.children("ins").get(0).style.backgroundImage.length ||
1556
+ (t.children("ins").get(0).className && t.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,'').length)
1557
+ ) {
1558
+ lang = false;
1559
+ if($.inArray("languages", s.plugins) !== -1 && $.isArray(s.languages) && s.languages.length) {
1560
+ $.each(s.languages, function (l, lv) {
1561
+ if(t.hasClass(lv)) {
1562
+ lang = lv;
1563
+ return false;
1564
+ }
1565
+ });
1566
+ }
1567
+ tmp2 = { attr : { }, title : _this.get_text(t, lang) };
1568
+ $.each(a_attr, function (k, z) {
1569
+ tmp1.attr[z] = (t.attr(z) || "").replace(/jstree[^ ]*|$/ig,'');
1570
+ });
1571
+ $.each(s.languages, function (k, z) {
1572
+ if(t.hasClass(z)) { tmp2.language = z; return true; }
1573
+ });
1574
+ if(t.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,'').replace(/^\s+$/ig,"").length) {
1575
+ tmp2.icon = t.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,'').replace(/^\s+$/ig,"");
1576
+ }
1577
+ if(t.children("ins").get(0).style.backgroundImage.length) {
1578
+ tmp2.icon = t.children("ins").get(0).style.backgroundImage.replace("url(","").replace(")","");
1579
+ }
1580
+ }
1581
+ else {
1582
+ tmp2 = _this.get_text(t);
1583
+ }
1584
+ if(a.length > 1) { tmp1.data.push(tmp2); }
1585
+ else { tmp1.data = tmp2; }
1586
+ });
1587
+ li = li.find("> ul > li");
1588
+ if(li.length) { tmp1.children = _this.get_json(li, li_attr, a_attr, true); }
1589
+ result.push(tmp1);
1590
+ });
1591
+ return result;
1592
+ }
1593
+ }
1594
+ });
1595
+ })(jQuery);
1596
+ //*/
1597
+
1598
+ /*
1599
+ * jsTree languages plugin 1.0
1600
+ * Adds support for multiple language versions in one tree
1601
+ * This basically allows for many titles coexisting in one node, but only one of them being visible at any given time
1602
+ * This is useful for maintaining the same structure in many languages (hence the name of the plugin)
1603
+ */
1604
+ (function ($) {
1605
+ $.jstree.plugin("languages", {
1606
+ __init : function () { this._load_css(); },
1607
+ defaults : [],
1608
+ _fn : {
1609
+ set_lang : function (i) {
1610
+ var langs = this._get_settings().languages,
1611
+ st = false,
1612
+ selector = ".jstree-" + this.get_index() + ' a';
1613
+ if(!$.isArray(langs) || langs.length === 0) { return false; }
1614
+ if($.inArray(i,langs) == -1) {
1615
+ if(!!langs[i]) { i = langs[i]; }
1616
+ else { return false; }
1617
+ }
1618
+ if(i == this.data.languages.current_language) { return true; }
1619
+ st = $.vakata.css.get_css(selector + "." + this.data.languages.current_language, false, this.data.languages.language_css);
1620
+ if(st !== false) { st.style.display = "none"; }
1621
+ st = $.vakata.css.get_css(selector + "." + i, false, this.data.languages.language_css);
1622
+ if(st !== false) { st.style.display = ""; }
1623
+ this.data.languages.current_language = i;
1624
+ this.__callback(i);
1625
+ return true;
1626
+ },
1627
+ get_lang : function () {
1628
+ return this.data.languages.current_language;
1629
+ },
1630
+ get_text : function (obj, lang) {
1631
+ obj = this._get_node(obj) || this.data.ui.last_selected;
1632
+ if(!obj.size()) { return false; }
1633
+ var langs = this._get_settings().languages,
1634
+ s = this._get_settings().core.html_titles;
1635
+ if($.isArray(langs) && langs.length) {
1636
+ lang = (lang && $.inArray(lang,langs) != -1) ? lang : this.data.languages.current_language;
1637
+ obj = obj.children("a." + lang);
1638
+ }
1639
+ else { obj = obj.children("a:eq(0)"); }
1640
+ if(s) {
1641
+ obj = obj.clone();
1642
+ obj.children("INS").remove();
1643
+ return obj.html();
1644
+ }
1645
+ else {
1646
+ obj = obj.contents().filter(function() { return this.nodeType == 3; })[0];
1647
+ return obj.nodeValue;
1648
+ }
1649
+ },
1650
+ set_text : function (obj, val, lang) {
1651
+ obj = this._get_node(obj) || this.data.ui.last_selected;
1652
+ if(!obj.size()) { return false; }
1653
+ var langs = this._get_settings().languages,
1654
+ s = this._get_settings().core.html_titles,
1655
+ tmp;
1656
+ if($.isArray(langs) && langs.length) {
1657
+ lang = (lang && $.inArray(lang,langs) != -1) ? lang : this.data.languages.current_language;
1658
+ obj = obj.children("a." + lang);
1659
+ }
1660
+ else { obj = obj.children("a:eq(0)"); }
1661
+ if(s) {
1662
+ tmp = obj.children("INS").clone();
1663
+ obj.html(val).prepend(tmp);
1664
+ this.__callback({ "obj" : obj, "name" : val, "lang" : lang });
1665
+ return true;
1666
+ }
1667
+ else {
1668
+ obj = obj.contents().filter(function() { return this.nodeType == 3; })[0];
1669
+ this.__callback({ "obj" : obj, "name" : val, "lang" : lang });
1670
+ return (obj.nodeValue = val);
1671
+ }
1672
+ },
1673
+ _load_css : function () {
1674
+ var langs = this._get_settings().languages,
1675
+ str = "/* languages css */",
1676
+ selector = ".jstree-" + this.get_index() + ' a',
1677
+ ln;
1678
+ if($.isArray(langs) && langs.length) {
1679
+ this.data.languages.current_language = langs[0];
1680
+ for(ln = 0; ln < langs.length; ln++) {
1681
+ str += selector + "." + langs[ln] + " {";
1682
+ if(langs[ln] != this.data.languages.current_language) { str += " display:none; "; }
1683
+ str += " } ";
1684
+ }
1685
+ this.data.languages.language_css = $.vakata.css.add_sheet({ 'str' : str });
1686
+ }
1687
+ },
1688
+ create_node : function (obj, position, js, callback) {
1689
+ var t = this.__call_old(true, obj, position, js, function (t) {
1690
+ var langs = this._get_settings().languages,
1691
+ a = t.children("a"),
1692
+ ln;
1693
+ if($.isArray(langs) && langs.length) {
1694
+ for(ln = 0; ln < langs.length; ln++) {
1695
+ if(!a.is("." + langs[ln])) {
1696
+ t.append(a.eq(0).clone().removeClass(langs.join(" ")).addClass(langs[ln]));
1697
+ }
1698
+ }
1699
+ a.not("." + langs.join(", .")).remove();
1700
+ }
1701
+ if(callback) { callback.call(this, t); }
1702
+ });
1703
+ return t;
1704
+ }
1705
+ }
1706
+ });
1707
+ })(jQuery);
1708
+ //*/
1709
+
1710
+ /*
1711
+ * jsTree cookies plugin 1.0
1712
+ * Stores the currently opened/selected nodes in a cookie and then restores them
1713
+ * Depends on the jquery.cookie plugin
1714
+ */
1715
+ (function ($) {
1716
+ $.jstree.plugin("cookies", {
1717
+ __init : function () {
1718
+ if(typeof $.cookie === "undefined") { throw "jsTree cookie: jQuery cookie plugin not included."; }
1719
+
1720
+ var s = this._get_settings().cookies,
1721
+ tmp;
1722
+ if(!!s.save_opened) {
1723
+ tmp = $.cookie(s.save_opened);
1724
+ if(tmp && tmp.length) { this.data.core.to_open = tmp.split(","); }
1725
+ }
1726
+ if(!!s.save_selected) {
1727
+ tmp = $.cookie(s.save_selected);
1728
+ if(tmp && tmp.length && this.data.ui) { this.data.ui.to_select = tmp.split(","); }
1729
+ }
1730
+ this.get_container()
1731
+ .one( ( this.data.ui ? "reselect" : "reopen" ) + ".jstree", $.proxy(function () {
1732
+ this.get_container()
1733
+ .bind("open_node.jstree close_node.jstree select_node.jstree deselect_node.jstree", $.proxy(function (e) {
1734
+ if(this._get_settings().cookies.auto_save) { this.save_cookie((e.handleObj.namespace + e.handleObj.type).replace("jstree","")); }
1735
+ }, this));
1736
+ }, this));
1737
+ },
1738
+ defaults : {
1739
+ save_opened : "jstree_open",
1740
+ save_selected : "jstree_select",
1741
+ auto_save : true,
1742
+ cookie_options : {}
1743
+ },
1744
+ _fn : {
1745
+ save_cookie : function (c) {
1746
+ if(this.data.core.refreshing) { return; }
1747
+ var s = this._get_settings().cookies;
1748
+ if(!c) { // if called manually and not by event
1749
+ if(s.save_opened) {
1750
+ this.save_opened();
1751
+ $.cookie(s.save_opened, this.data.core.to_open.join(","), s.cookie_options);
1752
+ }
1753
+ if(s.save_selected && this.data.ui) {
1754
+ this.save_selected();
1755
+ $.cookie(s.save_selected, this.data.ui.to_select.join(","), s.cookie_options);
1756
+ }
1757
+ return;
1758
+ }
1759
+ switch(c) {
1760
+ case "open_node":
1761
+ case "close_node":
1762
+ if(!!s.save_opened) {
1763
+ this.save_opened();
1764
+ $.cookie(s.save_opened, this.data.core.to_open.join(","), s.cookie_options);
1765
+ }
1766
+ break;
1767
+ case "select_node":
1768
+ case "deselect_node":
1769
+ if(!!s.save_selected && this.data.ui) {
1770
+ this.save_selected();
1771
+ $.cookie(s.save_selected, this.data.ui.to_select.join(","), s.cookie_options);
1772
+ }
1773
+ break;
1774
+ }
1775
+ }
1776
+ }
1777
+ });
1778
+ // include cookies by default
1779
+ $.jstree.defaults.plugins.push("cookies");
1780
+ })(jQuery);
1781
+ //*/
1782
+
1783
+ /*
1784
+ * jsTree sort plugin 1.0
1785
+ * Sorts items alphabetically (or using any other function)
1786
+ */
1787
+ (function ($) {
1788
+ $.jstree.plugin("sort", {
1789
+ __init : function () {
1790
+ this.get_container()
1791
+ .bind("load_node.jstree", $.proxy(function (e, data) {
1792
+ var obj = this._get_node(data.rslt.obj);
1793
+ obj = obj === -1 ? this.get_container().children("ul") : obj.children("ul");
1794
+ this.sort(obj);
1795
+ }, this))
1796
+ .bind("rename_node.jstree", $.proxy(function (e, data) {
1797
+ this.sort(data.rslt.obj.parent());
1798
+ }, this))
1799
+ .bind("move_node.jstree", $.proxy(function (e, data) {
1800
+ var m = data.rslt.np == -1 ? this.get_container() : data.rslt.np;
1801
+ this.sort(m.children("ul"));
1802
+ }, this));
1803
+ },
1804
+ defaults : function (a, b) { return this.get_text(a) > this.get_text(b) ? 1 : -1; },
1805
+ _fn : {
1806
+ sort : function (obj) {
1807
+ var s = this._get_settings().sort,
1808
+ t = this;
1809
+ obj.append($.makeArray(obj.children("li")).sort($.proxy(s, t)));
1810
+ obj.find("> li > ul").each(function() { t.sort($(this)); });
1811
+ this.clean_node(obj);
1812
+ }
1813
+ }
1814
+ });
1815
+ })(jQuery);
1816
+ //*/
1817
+
1818
+ /*
1819
+ * jsTree DND plugin 1.0
1820
+ * Drag and drop plugin for moving/copying nodes
1821
+ */
1822
+ (function ($) {
1823
+ var o = false,
1824
+ r = false,
1825
+ m = false,
1826
+ sli = false,
1827
+ sti = false,
1828
+ dir1 = false,
1829
+ dir2 = false;
1830
+ $.vakata.dnd = {
1831
+ is_down : false,
1832
+ is_drag : false,
1833
+ helper : false,
1834
+ scroll_spd : 10,
1835
+ init_x : 0,
1836
+ init_y : 0,
1837
+ threshold : 5,
1838
+ user_data : {},
1839
+
1840
+ drag_start : function (e, data, html) {
1841
+ if($.vakata.dnd.is_drag) { $.vakata.drag_stop({}); }
1842
+ try {
1843
+ e.currentTarget.unselectable = "on";
1844
+ e.currentTarget.onselectstart = function() { return false; };
1845
+ if(e.currentTarget.style) { e.currentTarget.style.MozUserSelect = "none"; }
1846
+ } catch(err) { }
1847
+ $.vakata.dnd.init_x = e.pageX;
1848
+ $.vakata.dnd.init_y = e.pageY;
1849
+ $.vakata.dnd.user_data = data;
1850
+ $.vakata.dnd.is_down = true;
1851
+ $.vakata.dnd.helper = $("<div id='vakata-dragged'>").html(html).css("opacity", "0.75");
1852
+ $(document).bind("mousemove", $.vakata.dnd.drag);
1853
+ $(document).bind("mouseup", $.vakata.dnd.drag_stop);
1854
+ return false;
1855
+ },
1856
+ drag : function (e) {
1857
+ if(!$.vakata.dnd.is_down) { return; }
1858
+ if(!$.vakata.dnd.is_drag) {
1859
+ if(Math.abs(e.pageX - $.vakata.dnd.init_x) > 5 || Math.abs(e.pageY - $.vakata.dnd.init_y) > 5) {
1860
+ $.vakata.dnd.helper.appendTo("body");
1861
+ $.vakata.dnd.is_drag = true;
1862
+ $(document).triggerHandler("drag_start.vakata", { "event" : e, "data" : $.vakata.dnd.user_data });
1863
+ }
1864
+ else { return; }
1865
+ }
1866
+
1867
+ // maybe use a scrolling parent element instead of document?
1868
+ if(e.type === "mousemove") { // thought of adding scroll in order to move the helper, but mouse poisition is n/a
1869
+ var d = $(document), t = d.scrollTop(), l = d.scrollLeft();
1870
+ if(e.pageY - t < 20) {
1871
+ if(sti && dir1 === "down") { clearInterval(sti); sti = false; }
1872
+ if(!sti) { dir1 = "up"; sti = setInterval(function () { $(document).scrollTop($(document).scrollTop() - $.vakata.dnd.scroll_spd); }, 150); }
1873
+ }
1874
+ else {
1875
+ if(sti && dir1 === "up") { clearInterval(sti); sti = false; }
1876
+ }
1877
+ if($(window).height() - (e.pageY - t) < 20) {
1878
+ if(sti && dir1 === "up") { clearInterval(sti); sti = false; }
1879
+ if(!sti) { dir1 = "down"; sti = setInterval(function () { $(document).scrollTop($(document).scrollTop() + $.vakata.dnd.scroll_spd); }, 150); }
1880
+ }
1881
+ else {
1882
+ if(sti && dir1 === "down") { clearInterval(sti); sti = false; }
1883
+ }
1884
+
1885
+ if(e.pageX - l < 20) {
1886
+ if(sli && dir2 === "right") { clearInterval(sli); sli = false; }
1887
+ if(!sli) { dir2 = "left"; sli = setInterval(function () { $(document).scrollLeft($(document).scrollLeft() - $.vakata.dnd.scroll_spd); }, 150); }
1888
+ }
1889
+ else {
1890
+ if(sli && dir2 === "left") { clearInterval(sli); sli = false; }
1891
+ }
1892
+ if($(window).width() - (e.pageX - l) < 20) {
1893
+ if(sli && dir2 === "left") { clearInterval(sli); sli = false; }
1894
+ if(!sli) { dir2 = "right"; sli = setInterval(function () { $(document).scrollLeft($(document).scrollLeft() + $.vakata.dnd.scroll_spd); }, 150); }
1895
+ }
1896
+ else {
1897
+ if(sli && dir2 === "right") { clearInterval(sli); sli = false; }
1898
+ }
1899
+ }
1900
+
1901
+ $.vakata.dnd.helper.css({ left : (e.pageX + 5) + "px", top : (e.pageY + 10) + "px" });
1902
+ $(document).triggerHandler("drag.vakata", { "event" : e, "data" : $.vakata.dnd.user_data });
1903
+ },
1904
+ drag_stop : function (e) {
1905
+ $(document).unbind("mousemove", $.vakata.dnd.drag);
1906
+ $(document).unbind("mouseup", $.vakata.dnd.drag_stop);
1907
+ $(document).triggerHandler("drag_stop.vakata", { "event" : e, "data" : $.vakata.dnd.user_data });
1908
+ $.vakata.dnd.helper.remove();
1909
+ $.vakata.dnd.init_x = 0;
1910
+ $.vakata.dnd.init_y = 0;
1911
+ $.vakata.dnd.user_data = {};
1912
+ $.vakata.dnd.is_down = false;
1913
+ $.vakata.dnd.is_drag = false;
1914
+ }
1915
+ };
1916
+ $(function() {
1917
+ 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; } ';
1918
+ $.vakata.css.add_sheet({ str : css_string });
1919
+ });
1920
+
1921
+ $.jstree.plugin("dnd", {
1922
+ __init : function () {
1923
+ this.data.dnd = {
1924
+ active : false,
1925
+ after : false,
1926
+ inside : false,
1927
+ before : false,
1928
+ off : false,
1929
+ prepared : false,
1930
+ w : 0,
1931
+ to1 : false,
1932
+ to2 : false,
1933
+ cof : false,
1934
+ cw : false,
1935
+ ch : false,
1936
+ i1 : false,
1937
+ i2 : false
1938
+ };
1939
+ this.get_container()
1940
+ .bind("mouseenter.jstree", $.proxy(function () {
1941
+ if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree && this.data.themes) {
1942
+ m.attr("class", "jstree-" + this.data.themes.theme);
1943
+ $.vakata.dnd.helper.attr("class", "jstree-dnd-helper jstree-" + this.data.themes.theme);
1944
+ }
1945
+ }, this))
1946
+ .bind("mouseleave.jstree", $.proxy(function () {
1947
+ if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {
1948
+ if(this.data.dnd.i1) { clearInterval(this.data.dnd.i1); }
1949
+ if(this.data.dnd.i2) { clearInterval(this.data.dnd.i2); }
1950
+ }
1951
+ }, this))
1952
+ .bind("mousemove.jstree", $.proxy(function (e) {
1953
+ if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {
1954
+ var cnt = this.get_container()[0];
1955
+
1956
+ // Horizontal scroll
1957
+ if(e.pageX + 24 > this.data.dnd.cof.left + this.data.dnd.cw) {
1958
+ if(this.data.dnd.i1) { clearInterval(this.data.dnd.i1); }
1959
+ this.data.dnd.i1 = setInterval($.proxy(function () { this.scrollLeft += $.vakata.dnd.scroll_spd; }, cnt), 100);
1960
+ }
1961
+ else if(e.pageX - 24 < this.data.dnd.cof.left) {
1962
+ if(this.data.dnd.i1) { clearInterval(this.data.dnd.i1); }
1963
+ this.data.dnd.i1 = setInterval($.proxy(function () { this.scrollLeft -= $.vakata.dnd.scroll_spd; }, cnt), 100);
1964
+ }
1965
+ else {
1966
+ if(this.data.dnd.i1) { clearInterval(this.data.dnd.i1); }
1967
+ }
1968
+
1969
+ // Vertical scroll
1970
+ if(e.pageY + 24 > this.data.dnd.cof.top + this.data.dnd.ch) {
1971
+ if(this.data.dnd.i2) { clearInterval(this.data.dnd.i2); }
1972
+ this.data.dnd.i2 = setInterval($.proxy(function () { this.scrollTop += $.vakata.dnd.scroll_spd; }, cnt), 100);
1973
+ }
1974
+ else if(e.pageY - 24 < this.data.dnd.cof.top) {
1975
+ if(this.data.dnd.i2) { clearInterval(this.data.dnd.i2); }
1976
+ this.data.dnd.i2 = setInterval($.proxy(function () { this.scrollTop -= $.vakata.dnd.scroll_spd; }, cnt), 100);
1977
+ }
1978
+ else {
1979
+ if(this.data.dnd.i2) { clearInterval(this.data.dnd.i2); }
1980
+ }
1981
+
1982
+ }
1983
+ }, this))
1984
+ .delegate("a", "mousedown.jstree", $.proxy(function (e) {
1985
+ if(e.which === 1) {
1986
+ this.start_drag(e.currentTarget, e);
1987
+ return false;
1988
+ }
1989
+ }, this))
1990
+ .delegate("a", "mouseenter.jstree", $.proxy(function (e) {
1991
+ if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {
1992
+ this.dnd_enter(e.currentTarget);
1993
+ }
1994
+ }, this))
1995
+ .delegate("a", "mousemove.jstree", $.proxy(function (e) {
1996
+ if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {
1997
+ if(typeof this.data.dnd.off.top === "undefined") { this.data.dnd.off = $(e.target).offset(); }
1998
+ this.data.dnd.w = (e.pageY - (this.data.dnd.off.top || 0)) % this.data.core.li_height;
1999
+ if(this.data.dnd.w < 0) { this.data.dnd.w += this.data.core.li_height; }
2000
+ this.dnd_show();
2001
+ }
2002
+ }, this))
2003
+ .delegate("a", "mouseleave.jstree", $.proxy(function (e) {
2004
+ if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {
2005
+ this.data.dnd.after = false;
2006
+ this.data.dnd.before = false;
2007
+ this.data.dnd.inside = false;
2008
+ $.vakata.dnd.helper.children("ins").attr("class","jstree-invalid");
2009
+ m.hide();
2010
+ if(r && r[0] === e.target.parentNode) {
2011
+ if(this.data.dnd.to1) {
2012
+ clearTimeout(this.data.dnd.to1);
2013
+ this.data.dnd.to1 = false;
2014
+ }
2015
+ if(this.data.dnd.to2) {
2016
+ clearTimeout(this.data.dnd.to2);
2017
+ this.data.dnd.to2 = false;
2018
+ }
2019
+ }
2020
+ }
2021
+ }, this))
2022
+ .delegate("a", "mouseup.jstree", $.proxy(function (e) {
2023
+ if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {
2024
+ this.dnd_finish(e);
2025
+ }
2026
+ }, this));
2027
+
2028
+ $(document)
2029
+ .bind("drag_stop.vakata", $.proxy(function () {
2030
+ this.data.dnd.after = false;
2031
+ this.data.dnd.before = false;
2032
+ this.data.dnd.inside = false;
2033
+ this.data.dnd.off = false;
2034
+ this.data.dnd.prepared = false;
2035
+ this.data.dnd.w = false;
2036
+ this.data.dnd.to1 = false;
2037
+ this.data.dnd.to2 = false;
2038
+ this.data.dnd.active = false;
2039
+ this.data.dnd.foreign = false;
2040
+ if(m) { m.css({ "top" : "-2000px" }); }
2041
+ }, this))
2042
+ .bind("drag_start.vakata", $.proxy(function (e, data) {
2043
+ if(data.data.jstree) {
2044
+ var et = $(data.event.target);
2045
+ if(et.closest(".jstree").hasClass("jstree-" + this.get_index())) {
2046
+ this.dnd_enter(et);
2047
+ }
2048
+ }
2049
+ }, this));
2050
+
2051
+ var s = this._get_settings().dnd;
2052
+ if(s.drag_target) {
2053
+ $(document)
2054
+ .delegate(s.drag_target, "mousedown.jstree", $.proxy(function (e) {
2055
+ o = e.target;
2056
+ $.vakata.dnd.drag_start(e, { jstree : true, obj : e.target }, "<ins class='jstree-icon'></ins>" + $(e.target).text() );
2057
+ if(this.data.themes) {
2058
+ m.attr("class", "jstree-" + this.data.themes.theme);
2059
+ $.vakata.dnd.helper.attr("class", "jstree-dnd-helper jstree-" + this.data.themes.theme);
2060
+ }
2061
+ $.vakata.dnd.helper.children("ins").attr("class","jstree-invalid");
2062
+ var cnt = this.get_container();
2063
+ this.data.dnd.cof = cnt.offset();
2064
+ this.data.dnd.cw = parseInt(cnt.width(),10);
2065
+ this.data.dnd.ch = parseInt(cnt.height(),10);
2066
+ this.data.dnd.foreign = true;
2067
+ return false;
2068
+ }, this));
2069
+ }
2070
+ if(s.drop_target) {
2071
+ $(document)
2072
+ .delegate(s.drop_target, "mouseenter.jstree", $.proxy(function (e) {
2073
+ if(this.data.dnd.active && this._get_settings().dnd.drop_check.call(this, { "o" : o, "r" : $(e.target) })) {
2074
+ $.vakata.dnd.helper.children("ins").attr("class","jstree-ok");
2075
+ }
2076
+ }, this))
2077
+ .delegate(s.drop_target, "mouseleave.jstree", $.proxy(function (e) {
2078
+ if(this.data.dnd.active) {
2079
+ $.vakata.dnd.helper.children("ins").attr("class","jstree-invalid");
2080
+ }
2081
+ }, this))
2082
+ .delegate(s.drop_target, "mouseup.jstree", $.proxy(function (e) {
2083
+ if(this.data.dnd.active && $.vakata.dnd.helper.children("ins").hasClass("jstree-ok")) {
2084
+ this._get_settings().dnd.drop_finish.call(this, { "o" : o, "r" : $(e.target) });
2085
+ }
2086
+ }, this));
2087
+ }
2088
+ },
2089
+ defaults : {
2090
+ copy_modifier : "ctrl",
2091
+ check_timeout : 200,
2092
+ open_timeout : 500,
2093
+ drop_target : ".jstree-drop",
2094
+ drop_check : function (data) { return true; },
2095
+ drop_finish : $.noop,
2096
+ drag_target : ".jstree-draggable",
2097
+ drag_finish : $.noop,
2098
+ drag_check : function (data) { return { after : false, before : false, inside : true }; }
2099
+ },
2100
+ _fn : {
2101
+ dnd_prepare : function () {
2102
+ if(!r || !r.length) { return; }
2103
+ this.data.dnd.off = r.offset();
2104
+ if(this._get_settings().core.rtl) {
2105
+ this.data.dnd.off.right = this.data.dnd.off.left + r.width();
2106
+ }
2107
+ if(this.data.dnd.foreign) {
2108
+ var a = this._get_settings().dnd.drag_check.call(this, { "o" : o, "r" : r });
2109
+ this.data.dnd.after = a.after;
2110
+ this.data.dnd.before = a.before;
2111
+ this.data.dnd.inside = a.inside;
2112
+ this.data.dnd.prepared = true;
2113
+ return this.dnd_show();
2114
+ }
2115
+ this.prepare_move(o, r, "before");
2116
+ this.data.dnd.before = this.check_move();
2117
+ this.prepare_move(o, r, "after");
2118
+ this.data.dnd.after = this.check_move();
2119
+ if(this._is_loaded(r)) {
2120
+ this.prepare_move(o, r, "inside");
2121
+ this.data.dnd.inside = this.check_move();
2122
+ }
2123
+ else {
2124
+ this.data.dnd.inside = false;
2125
+ }
2126
+ this.data.dnd.prepared = true;
2127
+ return this.dnd_show();
2128
+ },
2129
+ dnd_show : function () {
2130
+ if(!this.data.dnd.prepared) { return; }
2131
+ var o = ["before","inside","after"],
2132
+ r = false,
2133
+ rtl = this._get_settings().core.rtl,
2134
+ pos;
2135
+ if(this.data.dnd.w < this.data.core.li_height/3) { o = ["before","inside","after"]; }
2136
+ else if(this.data.dnd.w <= this.data.core.li_height*2/3) {
2137
+ o = this.data.dnd.w < this.data.core.li_height/2 ? ["inside","before","after"] : ["inside","after","before"];
2138
+ }
2139
+ else { o = ["after","inside","before"]; }
2140
+ $.each(o, $.proxy(function (i, val) {
2141
+ if(this.data.dnd[val]) {
2142
+ $.vakata.dnd.helper.children("ins").attr("class","jstree-ok");
2143
+ r = val;
2144
+ return false;
2145
+ }
2146
+ }, this));
2147
+ if(r === false) { $.vakata.dnd.helper.children("ins").attr("class","jstree-invalid"); }
2148
+
2149
+ pos = rtl ? (this.data.dnd.off.right - 18) : (this.data.dnd.off.left + 10);
2150
+ switch(r) {
2151
+ case "before":
2152
+ m.css({ "left" : pos + "px", "top" : (this.data.dnd.off.top - 6) + "px" }).show();
2153
+ break;
2154
+ case "after":
2155
+ m.css({ "left" : pos + "px", "top" : (this.data.dnd.off.top + this.data.core.li_height - 7) + "px" }).show();
2156
+ break;
2157
+ case "inside":
2158
+ m.css({ "left" : pos + ( rtl ? -4 : 4) + "px", "top" : (this.data.dnd.off.top + this.data.core.li_height/2 - 5) + "px" }).show();
2159
+ break;
2160
+ default:
2161
+ m.hide();
2162
+ break;
2163
+ }
2164
+ return r;
2165
+ },
2166
+ dnd_open : function () {
2167
+ this.data.dnd.to2 = false;
2168
+ this.open_node(r, $.proxy(this.dnd_prepare,this), true);
2169
+ },
2170
+ dnd_finish : function (e) {
2171
+ if(this.data.dnd.foreign) {
2172
+ if(this.data.dnd.after || this.data.dnd.before || this.data.dnd.inside) {
2173
+ this._get_settings().dnd.drag_finish.call(this, { "o" : o, "r" : r });
2174
+ }
2175
+ }
2176
+ else {
2177
+ this.dnd_prepare();
2178
+ this.move_node(o, r, this.dnd_show(), e[this._get_settings().dnd.copy_modifier + "Key"]);
2179
+ }
2180
+ o = false;
2181
+ r = false;
2182
+ m.hide();
2183
+ },
2184
+ dnd_enter : function (obj) {
2185
+ var s = this._get_settings().dnd;
2186
+ this.data.dnd.prepared = false;
2187
+ r = this._get_node(obj);
2188
+ if(s.check_timeout) {
2189
+ // do the calculations after a minimal timeout (users tend to drag quickly to the desired location)
2190
+ if(this.data.dnd.to1) { clearTimeout(this.data.dnd.to1); }
2191
+ this.data.dnd.to1 = setTimeout($.proxy(this.dnd_prepare, this), s.check_timeout);
2192
+ }
2193
+ else {
2194
+ this.dnd_prepare();
2195
+ }
2196
+ if(s.open_timeout) {
2197
+ if(this.data.dnd.to2) { clearTimeout(this.data.dnd.to2); }
2198
+ if(r && r.length && r.hasClass("jstree-closed")) {
2199
+ // if the node is closed - open it, then recalculate
2200
+ this.data.dnd.to2 = setTimeout($.proxy(this.dnd_open, this), s.open_timeout);
2201
+ }
2202
+ }
2203
+ else {
2204
+ if(r && r.length && r.hasClass("jstree-closed")) {
2205
+ this.dnd_open();
2206
+ }
2207
+ }
2208
+ },
2209
+ start_drag : function (obj, e) {
2210
+ o = this._get_node(obj);
2211
+ if(this.data.ui && this.is_selected(o)) { o = this._get_node(null, true); }
2212
+ $.vakata.dnd.drag_start(e, { jstree : true, obj : o }, "<ins class='jstree-icon'></ins>" + (o.length > 1 ? "Multiple selection" : this.get_text(o)) );
2213
+ if(this.data.themes) {
2214
+ m.attr("class", "jstree-" + this.data.themes.theme);
2215
+ $.vakata.dnd.helper.attr("class", "jstree-dnd-helper jstree-" + this.data.themes.theme);
2216
+ }
2217
+ var cnt = this.get_container();
2218
+ this.data.dnd.cof = cnt.children("ul").offset();
2219
+ this.data.dnd.cw = parseInt(cnt.width(),10);
2220
+ this.data.dnd.ch = parseInt(cnt.height(),10);
2221
+ this.data.dnd.active = true;
2222
+ }
2223
+ }
2224
+ });
2225
+ $(function() {
2226
+ var css_string = '' +
2227
+ '#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; } ' +
2228
+ '#vakata-dragged .jstree-ok { background:green; } ' +
2229
+ '#vakata-dragged .jstree-invalid { background:red; } ' +
2230
+ '#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; } ';
2231
+ $.vakata.css.add_sheet({ str : css_string });
2232
+ m = $("<div>").attr({ id : "jstree-marker" }).hide().appendTo("body");
2233
+ $(document).bind("drag_start.vakata", function (e, data) {
2234
+ if(data.data.jstree) {
2235
+ m.show();
2236
+ }
2237
+ });
2238
+ $(document).bind("drag_stop.vakata", function (e, data) {
2239
+ if(data.data.jstree) { m.hide(); }
2240
+ });
2241
+ });
2242
+ })(jQuery);
2243
+ //*/
2244
+
2245
+ /*
2246
+ * jsTree checkbox plugin 1.0
2247
+ * Inserts checkboxes in front of every node
2248
+ * Depends on the ui plugin
2249
+ * DOES NOT WORK NICELY WITH MULTITREE DRAG'N'DROP
2250
+ */
2251
+ (function ($) {
2252
+ $.jstree.plugin("checkbox", {
2253
+ __init : function () {
2254
+ this.select_node = this.deselect_node = this.deselect_all = $.noop;
2255
+ this.get_selected = this.get_checked;
2256
+
2257
+ this.get_container()
2258
+ .bind("open_node.jstree create_node.jstree clean_node.jstree", $.proxy(function (e, data) {
2259
+ this._prepare_checkboxes(data.rslt.obj);
2260
+ }, this))
2261
+ .bind("loaded.jstree", $.proxy(function (e) {
2262
+ this._prepare_checkboxes();
2263
+ }, this))
2264
+ .delegate("a", "click.jstree", $.proxy(function (e) {
2265
+ if(this._get_node(e.target).hasClass("jstree-checked")) { this.uncheck_node(e.target); }
2266
+ else { this.check_node(e.target); }
2267
+ if(this.data.ui) { this.save_selected(); }
2268
+ if(this.data.cookies) { this.save_cookie("select_node"); }
2269
+ e.preventDefault();
2270
+ }, this));
2271
+ },
2272
+ __destroy : function () {
2273
+ this.get_container().find(".jstree-checkbox").remove();
2274
+ },
2275
+ _fn : {
2276
+ _prepare_checkboxes : function (obj) {
2277
+ obj = !obj || obj == -1 ? this.get_container() : this._get_node(obj);
2278
+ var c, _this = this, t;
2279
+ obj.each(function () {
2280
+ t = $(this);
2281
+ c = t.is("li") && t.hasClass("jstree-checked") ? "jstree-checked" : "jstree-unchecked";
2282
+ t.find("a").not(":has(.jstree-checkbox)").prepend("<ins class='jstree-checkbox'>&#160;</ins>").parent().not(".jstree-checked, .jstree-unchecked").addClass(c);
2283
+ });
2284
+ if(obj.is("li")) { this._repair_state(obj); }
2285
+ else { obj.find("> ul > li").each(function () { _this._repair_state(this); }); }
2286
+ },
2287
+ change_state : function (obj, state) {
2288
+ obj = this._get_node(obj);
2289
+ state = (state === false || state === true) ? state : obj.hasClass("jstree-checked");
2290
+ if(state) { obj.find("li").andSelf().removeClass("jstree-checked jstree-undetermined").addClass("jstree-unchecked"); }
2291
+ else {
2292
+ obj.find("li").andSelf().removeClass("jstree-unchecked jstree-undetermined").addClass("jstree-checked");
2293
+ if(this.data.ui) { this.data.ui.last_selected = obj; }
2294
+ this.data.checkbox.last_selected = obj;
2295
+ }
2296
+ obj.parentsUntil(".jstree", "li").each(function () {
2297
+ var $this = $(this);
2298
+ if(state) {
2299
+ if($this.children("ul").children(".jstree-checked, .jstree-undetermined").length) {
2300
+ $this.parentsUntil(".jstree", "li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");
2301
+ return false;
2302
+ }
2303
+ else {
2304
+ $this.removeClass("jstree-checked jstree-undetermined").addClass("jstree-unchecked");
2305
+ }
2306
+ }
2307
+ else {
2308
+ if($this.children("ul").children(".jstree-unchecked, .jstree-undetermined").length) {
2309
+ $this.parentsUntil(".jstree", "li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");
2310
+ return false;
2311
+ }
2312
+ else {
2313
+ $this.removeClass("jstree-unchecked jstree-undetermined").addClass("jstree-checked");
2314
+ }
2315
+ }
2316
+ });
2317
+ if(this.data.ui) { this.data.ui.selected = this.get_checked(); }
2318
+ this.__callback(obj);
2319
+ },
2320
+ check_node : function (obj) {
2321
+ this.change_state(obj, false);
2322
+ },
2323
+ uncheck_node : function (obj) {
2324
+ this.change_state(obj, true);
2325
+ },
2326
+ check_all : function () {
2327
+ var _this = this;
2328
+ this.get_container().children("ul").children("li").each(function () {
2329
+ _this.check_node(this, false);
2330
+ });
2331
+ },
2332
+ uncheck_all : function () {
2333
+ var _this = this;
2334
+ this.get_container().children("ul").children("li").each(function () {
2335
+ _this.change_state(this, true);
2336
+ });
2337
+ },
2338
+
2339
+ is_checked : function(obj) {
2340
+ obj = this._get_node(obj);
2341
+ return obj.length ? obj.is(".jstree-checked") : false;
2342
+ },
2343
+ get_checked : function (obj) {
2344
+ obj = !obj || obj === -1 ? this.get_container() : this._get_node(obj);
2345
+ return obj.find("> ul > .jstree-checked, .jstree-undetermined > ul > .jstree-checked");
2346
+ },
2347
+ get_unchecked : function (obj) {
2348
+ obj = !obj || obj === -1 ? this.get_container() : this._get_node(obj);
2349
+ return obj.find("> ul > .jstree-unchecked, .jstree-undetermined > ul > .jstree-unchecked");
2350
+ },
2351
+
2352
+ show_checkboxes : function () { this.get_container().children("ul").removeClass("jstree-no-checkboxes"); },
2353
+ hide_checkboxes : function () { this.get_container().children("ul").addClass("jstree-no-checkboxes"); },
2354
+
2355
+ _repair_state : function (obj) {
2356
+ obj = this._get_node(obj);
2357
+ if(!obj.length) { return; }
2358
+ var a = obj.find("> ul > .jstree-checked").length,
2359
+ b = obj.find("> ul > .jstree-undetermined").length,
2360
+ c = obj.find("> ul > li").length;
2361
+
2362
+ if(c === 0) { if(obj.hasClass("jstree-undetermined")) { this.check_node(obj); } }
2363
+ else if(a === 0 && b === 0) { this.uncheck_node(obj); }
2364
+ else if(a === c) { this.check_node(obj); }
2365
+ else {
2366
+ obj.parentsUntil(".jstree","li").removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");
2367
+ }
2368
+ },
2369
+ reselect : function () {
2370
+ if(this.data.ui) {
2371
+ var _this = this,
2372
+ s = this.data.ui.to_select;
2373
+ s = $.map($.makeArray(s), function (n) { return "#" + n.toString().replace(/^#/,"").replace('\\/','/').replace('/','\\/'); });
2374
+ this.deselect_all();
2375
+ $.each(s, function (i, val) { _this.check_node(val); });
2376
+ this.__callback();
2377
+ }
2378
+ }
2379
+ }
2380
+ });
2381
+ })(jQuery);
2382
+ //*/
2383
+
2384
+ /*
2385
+ * jsTree XML 1.0
2386
+ * The XML data store. Datastores are build by overriding the `load_node` and `_is_loaded` functions.
2387
+ */
2388
+ (function ($) {
2389
+ $.vakata.xslt = function (xml, xsl, callback) {
2390
+ var rs = "", xm, xs, processor, support;
2391
+ if(document.recalc) {
2392
+ xm = document.createElement('xml');
2393
+ xs = document.createElement('xml');
2394
+ xm.innerHTML = xml;
2395
+ xs.innerHTML = xsl;
2396
+ $("body").append(xm).append(xs);
2397
+ setTimeout( (function (xm, xs, callback) {
2398
+ return function () {
2399
+ callback.call(null, xm.transformNode(xs.XMLDocument));
2400
+ setTimeout( (function (xm, xs) { return function () { jQuery("body").remove(xm).remove(xs); }; })(xm, xs), 200);
2401
+ };
2402
+ }) (xm, xs, callback), 100);
2403
+ return true;
2404
+ }
2405
+ if(typeof window.DOMParser !== "undefined" && typeof window.XMLHttpRequest !== "undefined" && typeof window.XSLTProcessor !== "undefined") {
2406
+ processor = new XSLTProcessor();
2407
+ support = $.isFunction(processor.transformDocument) ? (typeof window.XMLSerializer !== "undefined") : true;
2408
+ if(!support) { return false; }
2409
+ xml = new DOMParser().parseFromString(xml, "text/xml");
2410
+ xsl = new DOMParser().parseFromString(xsl, "text/xml");
2411
+ if($.isFunction(processor.transformDocument)) {
2412
+ rs = document.implementation.createDocument("", "", null);
2413
+ processor.transformDocument(xml, xsl, rs, null);
2414
+ callback.call(null, XMLSerializer().serializeToString(rs));
2415
+ return true;
2416
+ }
2417
+ else {
2418
+ processor.importStylesheet(xsl);
2419
+ rs = processor.transformToFragment(xml, document);
2420
+ callback.call(null, $("<div>").append(rs).html());
2421
+ return true;
2422
+ }
2423
+ }
2424
+ return false;
2425
+ };
2426
+ var xsl = {
2427
+ 'nest' : '<?xml version="1.0" encoding="utf-8" ?>' +
2428
+ '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >' +
2429
+ '<xsl:output method="html" encoding="utf-8" omit-xml-declaration="yes" standalone="no" indent="no" media-type="text/html" />' +
2430
+ '<xsl:template match="/">' +
2431
+ ' <xsl:call-template name="nodes">' +
2432
+ ' <xsl:with-param name="node" select="/root" />' +
2433
+ ' </xsl:call-template>' +
2434
+ '</xsl:template>' +
2435
+ '<xsl:template name="nodes">' +
2436
+ ' <xsl:param name="node" />' +
2437
+ ' <ul>' +
2438
+ ' <xsl:for-each select="$node/item">' +
2439
+ ' <xsl:variable name="children" select="count(./item) &gt; 0" />' +
2440
+ ' <li>' +
2441
+ ' <xsl:attribute name="class">' +
2442
+ ' <xsl:if test="position() = last()">jstree-last </xsl:if>' +
2443
+ ' <xsl:choose>' +
2444
+ ' <xsl:when test="@state = \'open\'">jstree-open </xsl:when>' +
2445
+ ' <xsl:when test="$children or @hasChildren or @state = \'closed\'">jstree-closed </xsl:when>' +
2446
+ ' <xsl:otherwise>jstree-leaf </xsl:otherwise>' +
2447
+ ' </xsl:choose>' +
2448
+ ' <xsl:value-of select="@class" />' +
2449
+ ' </xsl:attribute>' +
2450
+ ' <xsl:for-each select="@*">' +
2451
+ ' <xsl:if test="name() != \'class\' and name() != \'state\' and name() != \'hasChildren\'">' +
2452
+ ' <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>' +
2453
+ ' </xsl:if>' +
2454
+ ' </xsl:for-each>' +
2455
+ ' <ins class="jstree-icon"><xsl:text>&#xa0;</xsl:text></ins>' +
2456
+ ' <xsl:for-each select="content/name">' +
2457
+ ' <a>' +
2458
+ ' <xsl:attribute name="href">' +
2459
+ ' <xsl:choose>' +
2460
+ ' <xsl:when test="@href"><xsl:value-of select="@href" /></xsl:when>' +
2461
+ ' <xsl:otherwise>#</xsl:otherwise>' +
2462
+ ' </xsl:choose>' +
2463
+ ' </xsl:attribute>' +
2464
+ ' <xsl:attribute name="class"><xsl:value-of select="@lang" /> <xsl:value-of select="@class" /></xsl:attribute>' +
2465
+ ' <xsl:attribute name="style"><xsl:value-of select="@style" /></xsl:attribute>' +
2466
+ ' <xsl:for-each select="@*">' +
2467
+ ' <xsl:if test="name() != \'style\' and name() != \'class\' and name() != \'href\'">' +
2468
+ ' <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>' +
2469
+ ' </xsl:if>' +
2470
+ ' </xsl:for-each>' +
2471
+ ' <ins>' +
2472
+ ' <xsl:attribute name="class">jstree-icon ' +
2473
+ ' <xsl:if test="string-length(attribute::icon) > 0 and not(contains(@icon,\'/\'))"><xsl:value-of select="@icon" /></xsl:if>' +
2474
+ ' </xsl:attribute>' +
2475
+ ' <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>' +
2476
+ ' <xsl:text>&#xa0;</xsl:text>' +
2477
+ ' </ins>' +
2478
+ ' <xsl:value-of select="current()" />' +
2479
+ ' </a>' +
2480
+ ' </xsl:for-each>' +
2481
+ ' <xsl:if test="$children or @hasChildren"><xsl:call-template name="nodes"><xsl:with-param name="node" select="current()" /></xsl:call-template></xsl:if>' +
2482
+ ' </li>' +
2483
+ ' </xsl:for-each>' +
2484
+ ' </ul>' +
2485
+ '</xsl:template>' +
2486
+ '</xsl:stylesheet>',
2487
+
2488
+ 'flat' : '<?xml version="1.0" encoding="utf-8" ?>' +
2489
+ '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >' +
2490
+ '<xsl:output method="html" encoding="utf-8" omit-xml-declaration="yes" standalone="no" indent="no" media-type="text/xml" />' +
2491
+ '<xsl:template match="/">' +
2492
+ ' <ul>' +
2493
+ ' <xsl:for-each select="//item[not(@parent_id) or @parent_id=0 or not(@parent_id = //item/@id)]">' + /* the last `or` may be removed */
2494
+ ' <xsl:call-template name="nodes">' +
2495
+ ' <xsl:with-param name="node" select="." />' +
2496
+ ' <xsl:with-param name="is_last" select="number(position() = last())" />' +
2497
+ ' </xsl:call-template>' +
2498
+ ' </xsl:for-each>' +
2499
+ ' </ul>' +
2500
+ '</xsl:template>' +
2501
+ '<xsl:template name="nodes">' +
2502
+ ' <xsl:param name="node" />' +
2503
+ ' <xsl:param name="is_last" />' +
2504
+ ' <xsl:variable name="children" select="count(//item[@parent_id=$node/attribute::id]) &gt; 0" />' +
2505
+ ' <li>' +
2506
+ ' <xsl:attribute name="class">' +
2507
+ ' <xsl:if test="$is_last = true()">jstree-last </xsl:if>' +
2508
+ ' <xsl:choose>' +
2509
+ ' <xsl:when test="@state = \'open\'">jstree-open </xsl:when>' +
2510
+ ' <xsl:when test="$children or @hasChildren or @state = \'closed\'">jstree-closed </xsl:when>' +
2511
+ ' <xsl:otherwise>jstree-leaf </xsl:otherwise>' +
2512
+ ' </xsl:choose>' +
2513
+ ' <xsl:value-of select="@class" />' +
2514
+ ' </xsl:attribute>' +
2515
+ ' <xsl:for-each select="@*">' +
2516
+ ' <xsl:if test="name() != \'parent_id\' and name() != \'hasChildren\' and name() != \'class\' and name() != \'state\'">' +
2517
+ ' <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>' +
2518
+ ' </xsl:if>' +
2519
+ ' </xsl:for-each>' +
2520
+ ' <ins class="jstree-icon"><xsl:text>&#xa0;</xsl:text></ins>' +
2521
+ ' <xsl:for-each select="content/name">' +
2522
+ ' <a>' +
2523
+ ' <xsl:attribute name="href">' +
2524
+ ' <xsl:choose>' +
2525
+ ' <xsl:when test="@href"><xsl:value-of select="@href" /></xsl:when>' +
2526
+ ' <xsl:otherwise>#</xsl:otherwise>' +
2527
+ ' </xsl:choose>' +
2528
+ ' </xsl:attribute>' +
2529
+ ' <xsl:attribute name="class"><xsl:value-of select="@lang" /> <xsl:value-of select="@class" /></xsl:attribute>' +
2530
+ ' <xsl:attribute name="style"><xsl:value-of select="@style" /></xsl:attribute>' +
2531
+ ' <xsl:for-each select="@*">' +
2532
+ ' <xsl:if test="name() != \'style\' and name() != \'class\' and name() != \'href\'">' +
2533
+ ' <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>' +
2534
+ ' </xsl:if>' +
2535
+ ' </xsl:for-each>' +
2536
+ ' <ins>' +
2537
+ ' <xsl:attribute name="class">jstree-icon ' +
2538
+ ' <xsl:if test="string-length(attribute::icon) > 0 and not(contains(@icon,\'/\'))"><xsl:value-of select="@icon" /></xsl:if>' +
2539
+ ' </xsl:attribute>' +
2540
+ ' <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>' +
2541
+ ' <xsl:text>&#xa0;</xsl:text>' +
2542
+ ' </ins>' +
2543
+ ' <xsl:value-of select="current()" />' +
2544
+ ' </a>' +
2545
+ ' </xsl:for-each>' +
2546
+ ' <xsl:if test="$children">' +
2547
+ ' <ul>' +
2548
+ ' <xsl:for-each select="//item[@parent_id=$node/attribute::id]">' +
2549
+ ' <xsl:call-template name="nodes">' +
2550
+ ' <xsl:with-param name="node" select="." />' +
2551
+ ' <xsl:with-param name="is_last" select="number(position() = last())" />' +
2552
+ ' </xsl:call-template>' +
2553
+ ' </xsl:for-each>' +
2554
+ ' </ul>' +
2555
+ ' </xsl:if>' +
2556
+ ' </li>' +
2557
+ '</xsl:template>' +
2558
+ '</xsl:stylesheet>'
2559
+ };
2560
+ $.jstree.plugin("xml_data", {
2561
+ defaults : {
2562
+ data : false,
2563
+ ajax : false,
2564
+ xsl : "flat",
2565
+ clean_node : false,
2566
+ correct_state : true
2567
+ },
2568
+ _fn : {
2569
+ 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); },
2570
+ _is_loaded : function (obj) {
2571
+ var s = this._get_settings().xml_data;
2572
+ obj = this._get_node(obj);
2573
+ return obj == -1 || !obj || !s.ajax || obj.is(".jstree-open, .jstree-leaf") || obj.children("ul").children("li").size() > 0;
2574
+ },
2575
+ load_node_xml : function (obj, s_call, e_call) {
2576
+ var s = this.get_settings().xml_data,
2577
+ error_func = function () {},
2578
+ success_func = function () {};
2579
+
2580
+ obj = this._get_node(obj);
2581
+ if(obj && obj !== -1) {
2582
+ if(obj.data("jstree-is-loading")) { return; }
2583
+ else { obj.data("jstree-is-loading",true); }
2584
+ }
2585
+ switch(!0) {
2586
+ case (!s.data && !s.ajax): throw "Neither data nor ajax settings supplied.";
2587
+ case (!!s.data && !s.ajax) || (!!s.data && !!s.ajax && (!obj || obj === -1)):
2588
+ if(!obj || obj == -1) {
2589
+ this.parse_xml(s.data, $.proxy(function (d) {
2590
+ if(d) {
2591
+ d = d.replace(/ ?xmlns="[^"]*"/ig, "");
2592
+ if(d.length > 10) {
2593
+ d = $(d);
2594
+ this.get_container().children("ul").empty().append(d.children());
2595
+ if(s.clean_node) { this.clean_node(obj); }
2596
+ if(s_call) { s_call.call(this); }
2597
+ }
2598
+ }
2599
+ else {
2600
+ if(s.correct_state) {
2601
+ this.get_container().children("ul").empty();
2602
+ if(s_call) { s_call.call(this); }
2603
+ }
2604
+ }
2605
+ }, this));
2606
+ }
2607
+ break;
2608
+ case (!s.data && !!s.ajax) || (!!s.data && !!s.ajax && obj && obj !== -1):
2609
+ error_func = function (x, t, e) {
2610
+ var ef = this.get_settings().xml_data.ajax.error;
2611
+ if(ef) { ef.call(this, x, t, e); }
2612
+ if(obj !== -1 && obj.length) {
2613
+ obj.children(".jstree-loading").removeClass("jstree-loading");
2614
+ obj.data("jstree-is-loading",false);
2615
+ if(t === "success" && s.correct_state) { obj.removeClass("jstree-open jstree-closed").addClass("jstree-leaf"); }
2616
+ }
2617
+ else {
2618
+ if(t === "success" && s.correct_state) { this.get_container().children("ul").empty(); }
2619
+ }
2620
+ if(e_call) { e_call.call(this); }
2621
+ };
2622
+ success_func = function (d, t, x) {
2623
+ d = x.responseText;
2624
+ var sf = this.get_settings().xml_data.ajax.success;
2625
+ if(sf) { d = sf.call(this,d,t,x) || d; }
2626
+ if(d == "") {
2627
+ return error_func.call(this, x, t, "");
2628
+ }
2629
+ this.parse_xml(d, $.proxy(function (d) {
2630
+ if(d) {
2631
+ d = d.replace(/ ?xmlns="[^"]*"/ig, "");
2632
+ if(d.length > 10) {
2633
+ d = $(d);
2634
+ if(obj === -1 || !obj) { this.get_container().children("ul").empty().append(d.children()); }
2635
+ else { obj.children(".jstree-loading").removeClass("jstree-loading"); obj.append(d); obj.data("jstree-is-loading",false); }
2636
+ if(s.clean_node) { this.clean_node(obj); }
2637
+ if(s_call) { s_call.call(this); }
2638
+ }
2639
+ else {
2640
+ if(obj && obj !== -1) {
2641
+ obj.children(".jstree-loading").removeClass("jstree-loading");
2642
+ obj.data("jstree-is-loading",false);
2643
+ if(s.correct_state) {
2644
+ obj.removeClass("jstree-open jstree-closed").addClass("jstree-leaf");
2645
+ if(s_call) { s_call.call(this); }
2646
+ }
2647
+ }
2648
+ else {
2649
+ if(s.correct_state) {
2650
+ this.get_container().children("ul").empty();
2651
+ if(s_call) { s_call.call(this); }
2652
+ }
2653
+ }
2654
+ }
2655
+ }
2656
+ }, this));
2657
+ };
2658
+ s.ajax.context = this;
2659
+ s.ajax.error = error_func;
2660
+ s.ajax.success = success_func;
2661
+ if(!s.ajax.dataType) { s.ajax.dataType = "xml"; }
2662
+ if($.isFunction(s.ajax.url)) { s.ajax.url = s.ajax.url.call(this, obj); }
2663
+ if($.isFunction(s.ajax.data)) { s.ajax.data = s.ajax.data.call(this, obj); }
2664
+ $.ajax(s.ajax);
2665
+ break;
2666
+ }
2667
+ },
2668
+ parse_xml : function (xml, callback) {
2669
+ var s = this._get_settings().xml_data;
2670
+ $.vakata.xslt(xml, xsl[s.xsl], callback);
2671
+ },
2672
+ get_xml : function (tp, obj, li_attr, a_attr, is_callback) {
2673
+ var result = "",
2674
+ s = this._get_settings(),
2675
+ _this = this,
2676
+ tmp1, tmp2, li, a, lang;
2677
+ if(!tp) { tp = "flat"; }
2678
+ if(!is_callback) { is_callback = 0; }
2679
+ obj = this._get_node(obj);
2680
+ if(!obj || obj === -1) { obj = this.get_container().find("> ul > li"); }
2681
+ li_attr = $.isArray(li_attr) ? li_attr : [ "id", "class" ];
2682
+ if(!is_callback && this.data.types && $.inArray(s.types.type_attr, li_attr) === -1) { li_attr.push(s.types.type_attr); }
2683
+
2684
+ a_attr = $.isArray(a_attr) ? a_attr : [ ];
2685
+
2686
+ if(!is_callback) { result += "<root>"; }
2687
+ obj.each(function () {
2688
+ result += "<item";
2689
+ li = $(this);
2690
+ $.each(li_attr, function (i, v) { result += " " + v + "=\"" + (li.attr(v) || "").replace(/jstree[^ ]*|$/ig,'').replace(/^\s+$/ig,"") + "\""; });
2691
+ if(li.hasClass("jstree-open")) { result += " state=\"open\""; }
2692
+ if(li.hasClass("jstree-closed")) { result += " state=\"closed\""; }
2693
+ if(tp === "flat") { result += " parent_id=\"" + is_callback + "\""; }
2694
+ result += ">";
2695
+ result += "<content>";
2696
+ a = li.children("a");
2697
+ a.each(function () {
2698
+ tmp1 = $(this);
2699
+ lang = false;
2700
+ result += "<name";
2701
+ if($.inArray("languages", s.plugins) !== -1) {
2702
+ $.each(s.languages, function (k, z) {
2703
+ if(tmp1.hasClass(z)) { result += " lang=\"" + z + "\""; lang = z; return false; }
2704
+ });
2705
+ }
2706
+ if(a_attr.length) {
2707
+ $.each(a_attr, function (k, z) {
2708
+ result += " " + z + "=\"" + (tmp1.attr(z) || "").replace(/jstree[^ ]*|$/ig,'') + "\"";
2709
+ });
2710
+ }
2711
+ if(tmp1.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,'').replace(/^\s+$/ig,"").length) {
2712
+ result += ' icon="' + tmp1.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,'').replace(/^\s+$/ig,"") + '"';
2713
+ }
2714
+ if(tmp1.children("ins").get(0).style.backgroundImage.length) {
2715
+ result += ' icon="' + tmp1.children("ins").get(0).style.backgroundImage.replace("url(","").replace(")","") + '"';
2716
+ }
2717
+ result += ">";
2718
+ result += "<![CDATA[" + _this.get_text(tmp1, lang) + "]]>";
2719
+ result += "</name>";
2720
+ });
2721
+ result += "</content>";
2722
+ tmp2 = li[0].id;
2723
+ li = li.find("> ul > li");
2724
+ if(li.length) { tmp2 = _this.get_xml(tp, li, li_attr, a_attr, tmp2); }
2725
+ else { tmp2 = ""; }
2726
+ if(tp == "nest") { result += tmp2; }
2727
+ result += "</item>";
2728
+ if(tp == "flat") { result += tmp2; }
2729
+ });
2730
+ if(!is_callback) { result += "</root>"; }
2731
+ return result;
2732
+ }
2733
+ }
2734
+ });
2735
+ })(jQuery);
2736
+ //*/
2737
+
2738
+ /*
2739
+ * jsTree search plugin 1.0
2740
+ * Enables both sync and async search on the tree
2741
+ * DOES NOT WORK WITH JSON PROGRESSIVE RENDER
2742
+ */
2743
+ (function ($) {
2744
+ $.expr[':'].jstree_contains = function(a,i,m){
2745
+ return (a.textContent || a.innerText || "").toLowerCase().indexOf(m[3].toLowerCase())>=0;
2746
+ };
2747
+ $.jstree.plugin("search", {
2748
+ __init : function () {
2749
+ this.data.search.str = "";
2750
+ this.data.search.result = $();
2751
+ },
2752
+ defaults : {
2753
+ ajax : false, // OR ajax object
2754
+ case_insensitive : false
2755
+ },
2756
+ _fn : {
2757
+ search : function (str, skip_async) {
2758
+ if(str === "") { return; }
2759
+ var s = this.get_settings().search,
2760
+ t = this,
2761
+ error_func = function () { },
2762
+ success_func = function () { };
2763
+ this.data.search.str = str;
2764
+
2765
+ if(!skip_async && s.ajax !== false && this.get_container().find(".jstree-closed:eq(0)").length > 0) {
2766
+ this.search.supress_callback = true;
2767
+ error_func = function () { };
2768
+ success_func = function (d, t, x) {
2769
+ var sf = this.get_settings().search.ajax.success;
2770
+ if(sf) { d = sf.call(this,d,t,x) || d; }
2771
+ this.data.search.to_open = d;
2772
+ this._search_open();
2773
+ };
2774
+ s.ajax.context = this;
2775
+ s.ajax.error = error_func;
2776
+ s.ajax.success = success_func;
2777
+ if($.isFunction(s.ajax.url)) { s.ajax.url = s.ajax.url.call(this, str); }
2778
+ if($.isFunction(s.ajax.data)) { s.ajax.data = s.ajax.data.call(this, str); }
2779
+ if(!s.ajax.data) { s.ajax.data = { "search_string" : str }; }
2780
+ if(!s.ajax.dataType || /^json/.exec(s.ajax.dataType)) { s.ajax.dataType = "json"; }
2781
+ $.ajax(s.ajax);
2782
+ return;
2783
+ }
2784
+ if(this.data.search.result.length) { this.clear_search(); }
2785
+ 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 + ")");
2786
+ this.data.search.result.addClass("jstree-search").parents(".jstree-closed").each(function () {
2787
+ t.open_node(this, false, true);
2788
+ });
2789
+ this.__callback({ nodes : this.data.search.result, str : str });
2790
+ },
2791
+ clear_search : function (str) {
2792
+ this.data.search.result.removeClass("jstree-search");
2793
+ this.__callback(this.data.search.result);
2794
+ this.data.search.result = $();
2795
+ },
2796
+ _search_open : function (is_callback) {
2797
+ var _this = this,
2798
+ done = true,
2799
+ current = [],
2800
+ remaining = [];
2801
+ if(this.data.search.to_open.length) {
2802
+ $.each(this.data.search.to_open, function (i, val) {
2803
+ if(val == "#") { return true; }
2804
+ if($(val).length && $(val).is(".jstree-closed")) { current.push(val); }
2805
+ else { remaining.push(val); }
2806
+ });
2807
+ if(current.length) {
2808
+ this.data.search.to_open = remaining;
2809
+ $.each(current, function (i, val) {
2810
+ _this.open_node(val, function () { _this._search_open(true); });
2811
+ });
2812
+ done = false;
2813
+ }
2814
+ }
2815
+ if(done) { this.search(this.data.search.str, true); }
2816
+ }
2817
+ }
2818
+ });
2819
+ })(jQuery);
2820
+ //*/
2821
+
2822
+ /*
2823
+ * jsTree contextmenu plugin 1.0
2824
+ */
2825
+ (function ($) {
2826
+ $.vakata.context = {
2827
+ cnt : $("<div id='vakata-contextmenu'>"),
2828
+ vis : false,
2829
+ tgt : false,
2830
+ par : false,
2831
+ func : false,
2832
+ data : false,
2833
+ show : function (s, t, x, y, d, p) {
2834
+ var html = $.vakata.context.parse(s), h, w;
2835
+ if(!html) { return; }
2836
+ $.vakata.context.vis = true;
2837
+ $.vakata.context.tgt = t;
2838
+ $.vakata.context.par = p || t || null;
2839
+ $.vakata.context.data = d || null;
2840
+ $.vakata.context.cnt
2841
+ .html(html)
2842
+ .css({ "visibility" : "hidden", "display" : "block", "left" : 0, "top" : 0 });
2843
+ h = $.vakata.context.cnt.height();
2844
+ w = $.vakata.context.cnt.width();
2845
+ if(x + w > $(document).width()) {
2846
+ x = $(document).width() - (w + 5);
2847
+ $.vakata.context.cnt.find("li > ul").addClass("right");
2848
+ }
2849
+ if(y + h > $(document).height()) {
2850
+ y = y - (h + t[0].offsetHeight);
2851
+ $.vakata.context.cnt.find("li > ul").addClass("bottom");
2852
+ }
2853
+
2854
+ $.vakata.context.cnt
2855
+ .css({ "left" : x, "top" : y })
2856
+ .find("li:has(ul)")
2857
+ .bind("mouseenter", function (e) {
2858
+ var w = $(document).width(),
2859
+ h = $(document).height(),
2860
+ ul = $(this).children("ul").show();
2861
+ if(w !== $(document).width()) { ul.toggleClass("right"); }
2862
+ if(h !== $(document).height()) { ul.toggleClass("bottom"); }
2863
+ })
2864
+ .bind("mouseleave", function (e) {
2865
+ $(this).children("ul").hide();
2866
+ })
2867
+ .end()
2868
+ .css({ "visibility" : "visible" })
2869
+ .show();
2870
+ $(document).triggerHandler("context_show.vakata");
2871
+ },
2872
+ hide : function () {
2873
+ $.vakata.context.vis = false;
2874
+ $.vakata.context.cnt.attr("class","").hide();
2875
+ $(document).triggerHandler("context_hide.vakata");
2876
+ },
2877
+ parse : function (s, is_callback) {
2878
+ if(!s) { return false; }
2879
+ var str = "",
2880
+ tmp = false,
2881
+ was_sep = true;
2882
+ if(!is_callback) { $.vakata.context.func = {}; }
2883
+ str += "<ul>";
2884
+ $.each(s, function (i, val) {
2885
+ if(!val) { return true; }
2886
+ $.vakata.context.func[i] = val.action;
2887
+ if(!was_sep && val.separator_before) {
2888
+ str += "<li class='vakata-separator vakata-separator-before'></li>";
2889
+ }
2890
+ was_sep = false;
2891
+ str += "<li class='" + (val._class || "") + (val._disabled ? " jstree-contextmenu-disabled " : "") + "'><ins ";
2892
+ if(val.icon && val.icon.indexOf("/") === -1) { str += " class='" + val.icon + "' "; }
2893
+ if(val.icon && val.icon.indexOf("/") !== -1) { str += " style='background:url(" + val.icon + ") center center no-repeat;' "; }
2894
+ str += ">&#160;</ins><a href='#' rel='" + i + "'>";
2895
+ if(val.submenu) {
2896
+ str += "<span style='float:right;'>&raquo;</span>";
2897
+ }
2898
+ str += val.label + "</a>";
2899
+ if(val.submenu) {
2900
+ tmp = $.vakata.context.parse(val.submenu, true);
2901
+ if(tmp) { str += tmp; }
2902
+ }
2903
+ str += "</li>";
2904
+ if(val.separator_after) {
2905
+ str += "<li class='vakata-separator vakata-separator-after'></li>";
2906
+ was_sep = true;
2907
+ }
2908
+ });
2909
+ str = str.replace(/<li class\='vakata-separator vakata-separator-after'\><\/li\>$/,"");
2910
+ str += "</ul>";
2911
+ return str.length > 10 ? str : false;
2912
+ },
2913
+ exec : function (i) {
2914
+ if($.isFunction($.vakata.context.func[i])) {
2915
+ $.vakata.context.func[i].call($.vakata.context.data, $.vakata.context.par);
2916
+ return true;
2917
+ }
2918
+ else { return false; }
2919
+ }
2920
+ };
2921
+ $(function () {
2922
+ var css_string = '' +
2923
+ '#vakata-contextmenu { display:none; position:absolute; margin:0; padding:0; min-width:180px; background:#ebebeb; border:1px solid silver; z-index:10000; *width:180px; } ' +
2924
+ '#vakata-contextmenu ul { min-width:180px; *width:180px; } ' +
2925
+ '#vakata-contextmenu ul, #vakata-contextmenu li { margin:0; padding:0; list-style-type:none; display:block; } ' +
2926
+ '#vakata-contextmenu li { line-height:20px; min-height:20px; position:relative; padding:0px; } ' +
2927
+ '#vakata-contextmenu li a { padding:1px 6px; line-height:17px; display:block; text-decoration:none; margin:1px 1px 0 1px; } ' +
2928
+ '#vakata-contextmenu li ins { float:left; width:16px; height:16px; text-decoration:none; margin-right:2px; } ' +
2929
+ '#vakata-contextmenu li a:hover, #vakata-contextmenu li.vakata-hover > a { background:gray; color:white; } ' +
2930
+ '#vakata-contextmenu li ul { display:none; position:absolute; top:-2px; left:100%; background:#ebebeb; border:1px solid gray; } ' +
2931
+ '#vakata-contextmenu .right { right:100%; left:auto; } ' +
2932
+ '#vakata-contextmenu .bottom { bottom:-1px; top:auto; } ' +
2933
+ '#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; } ';
2934
+ $.vakata.css.add_sheet({ str : css_string });
2935
+ $.vakata.context.cnt
2936
+ .delegate("a","click", function (e) { e.preventDefault(); })
2937
+ .delegate("a","mouseup", function (e) {
2938
+ if(!$(this).parent().hasClass("jstree-contextmenu-disabled") && $.vakata.context.exec($(this).attr("rel"))) {
2939
+ $.vakata.context.hide();
2940
+ }
2941
+ else { $(this).blur(); }
2942
+ })
2943
+ .delegate("a","mouseover", function () {
2944
+ $.vakata.context.cnt.find(".vakata-hover").removeClass("vakata-hover");
2945
+ })
2946
+ .appendTo("body");
2947
+ $(document).bind("mousedown", function (e) { if($.vakata.context.vis && !$.contains($.vakata.context.cnt[0], e.target)) { $.vakata.context.hide(); } });
2948
+ if(typeof $.hotkeys !== "undefined") {
2949
+ $(document)
2950
+ .bind("keydown", "up", function (e) {
2951
+ if($.vakata.context.vis) {
2952
+ var o = $.vakata.context.cnt.find("ul:visible").last().children(".vakata-hover").removeClass("vakata-hover").prevAll("li:not(.vakata-separator)").first();
2953
+ if(!o.length) { o = $.vakata.context.cnt.find("ul:visible").last().children("li:not(.vakata-separator)").last(); }
2954
+ o.addClass("vakata-hover");
2955
+ e.stopImmediatePropagation();
2956
+ e.preventDefault();
2957
+ }
2958
+ })
2959
+ .bind("keydown", "down", function (e) {
2960
+ if($.vakata.context.vis) {
2961
+ var o = $.vakata.context.cnt.find("ul:visible").last().children(".vakata-hover").removeClass("vakata-hover").nextAll("li:not(.vakata-separator)").first();
2962
+ if(!o.length) { o = $.vakata.context.cnt.find("ul:visible").last().children("li:not(.vakata-separator)").first(); }
2963
+ o.addClass("vakata-hover");
2964
+ e.stopImmediatePropagation();
2965
+ e.preventDefault();
2966
+ }
2967
+ })
2968
+ .bind("keydown", "right", function (e) {
2969
+ if($.vakata.context.vis) {
2970
+ $.vakata.context.cnt.find(".vakata-hover").children("ul").show().children("li:not(.vakata-separator)").removeClass("vakata-hover").first().addClass("vakata-hover");
2971
+ e.stopImmediatePropagation();
2972
+ e.preventDefault();
2973
+ }
2974
+ })
2975
+ .bind("keydown", "left", function (e) {
2976
+ if($.vakata.context.vis) {
2977
+ $.vakata.context.cnt.find(".vakata-hover").children("ul").hide().children(".vakata-separator").removeClass("vakata-hover");
2978
+ e.stopImmediatePropagation();
2979
+ e.preventDefault();
2980
+ }
2981
+ })
2982
+ .bind("keydown", "esc", function (e) {
2983
+ $.vakata.context.hide();
2984
+ e.preventDefault();
2985
+ })
2986
+ .bind("keydown", "space", function (e) {
2987
+ $.vakata.context.cnt.find(".vakata-hover").last().children("a").click();
2988
+ e.preventDefault();
2989
+ });
2990
+ }
2991
+ });
2992
+
2993
+ $.jstree.plugin("contextmenu", {
2994
+ __init : function () {
2995
+ this.get_container()
2996
+ .delegate("a", "contextmenu.jstree", $.proxy(function (e) {
2997
+ e.preventDefault();
2998
+ this.show_contextmenu(e.currentTarget, e.pageX, e.pageY);
2999
+ }, this))
3000
+ .bind("destroy.jstree", $.proxy(function () {
3001
+ if(this.data.contextmenu) {
3002
+ $.vakata.context.hide();
3003
+ }
3004
+ }, this));
3005
+ $(document).bind("context_hide.vakata", $.proxy(function () { this.data.contextmenu = false; }, this));
3006
+ },
3007
+ defaults : {
3008
+ select_node : false, // requires UI plugin
3009
+ show_at_node : true,
3010
+ items : { // Could be a function that should return an object like this one
3011
+ "create" : {
3012
+ "separator_before" : false,
3013
+ "separator_after" : true,
3014
+ "label" : "Create",
3015
+ "action" : function (obj) { this.create(obj); }
3016
+ },
3017
+ "rename" : {
3018
+ "separator_before" : false,
3019
+ "separator_after" : false,
3020
+ "label" : "Rename",
3021
+ "action" : function (obj) { this.rename(obj); }
3022
+ },
3023
+ "remove" : {
3024
+ "separator_before" : false,
3025
+ "icon" : false,
3026
+ "separator_after" : false,
3027
+ "label" : "Delete",
3028
+ "action" : function (obj) { this.remove(obj); }
3029
+ },
3030
+ "ccp" : {
3031
+ "separator_before" : true,
3032
+ "icon" : false,
3033
+ "separator_after" : false,
3034
+ "label" : "Edit",
3035
+ "action" : false,
3036
+ "submenu" : {
3037
+ "cut" : {
3038
+ "separator_before" : false,
3039
+ "separator_after" : false,
3040
+ "label" : "Cut",
3041
+ "action" : function (obj) { this.cut(obj); }
3042
+ },
3043
+ "copy" : {
3044
+ "separator_before" : false,
3045
+ "icon" : false,
3046
+ "separator_after" : false,
3047
+ "label" : "Copy",
3048
+ "action" : function (obj) { this.copy(obj); }
3049
+ },
3050
+ "paste" : {
3051
+ "separator_before" : false,
3052
+ "icon" : false,
3053
+ "separator_after" : false,
3054
+ "label" : "Paste",
3055
+ "action" : function (obj) { this.paste(obj); }
3056
+ }
3057
+ }
3058
+ }
3059
+ }
3060
+ },
3061
+ _fn : {
3062
+ show_contextmenu : function (obj, x, y) {
3063
+ obj = this._get_node(obj);
3064
+ var s = this.get_settings().contextmenu,
3065
+ a = obj.children("a:visible:eq(0)"),
3066
+ o = false;
3067
+ if(s.select_node && this.data.ui && !this.is_selected(obj)) {
3068
+ this.deselect_all();
3069
+ this.select_node(obj, true);
3070
+ }
3071
+ if(s.show_at_node || typeof x === "undefined" || typeof y === "undefined") {
3072
+ o = a.offset();
3073
+ x = o.left;
3074
+ y = o.top + this.data.core.li_height;
3075
+ }
3076
+ if($.isFunction(s.items)) { s.items = s.items.call(this, obj); }
3077
+ this.data.contextmenu = true;
3078
+ $.vakata.context.show(s.items, a, x, y, this, obj);
3079
+ if(this.data.themes) { $.vakata.context.cnt.attr("class", "jstree-" + this.data.themes.theme + "-context"); }
3080
+ }
3081
+ }
3082
+ });
3083
+ })(jQuery);
3084
+ //*/
3085
+
3086
+ /*
3087
+ * jsTree types plugin 1.0
3088
+ * Adds support types of nodes
3089
+ * You can set an attribute on each li node, that represents its type.
3090
+ * According to the type setting the node may get custom icon/validation rules
3091
+ */
3092
+ (function ($) {
3093
+ $.jstree.plugin("types", {
3094
+ __init : function () {
3095
+ var s = this._get_settings().types;
3096
+ this.data.types.attach_to = [];
3097
+ this.get_container()
3098
+ .bind("init.jstree", $.proxy(function () {
3099
+ var types = s.types,
3100
+ attr = s.type_attr,
3101
+ icons_css = "",
3102
+ _this = this;
3103
+
3104
+ $.each(types, function (i, tp) {
3105
+ $.each(tp, function (k, v) {
3106
+ if(!/^(max_depth|max_children|icon|valid_children)$/.test(k)) { _this.data.types.attach_to.push(k); }
3107
+ });
3108
+ if(!tp.icon) { return true; }
3109
+ if( tp.icon.image || tp.icon.position) {
3110
+ if(i == "default") { icons_css += '.jstree-' + _this.get_index() + ' a > .jstree-icon { '; }
3111
+ else { icons_css += '.jstree-' + _this.get_index() + ' li[' + attr + '=' + i + '] > a > .jstree-icon { '; }
3112
+ if(tp.icon.image) { icons_css += ' background-image:url(' + tp.icon.image + '); '; }
3113
+ if(tp.icon.position){ icons_css += ' background-position:' + tp.icon.position + '; '; }
3114
+ else { icons_css += ' background-position:0 0; '; }
3115
+ icons_css += '} ';
3116
+ }
3117
+ });
3118
+ if(icons_css != "") { $.vakata.css.add_sheet({ 'str' : icons_css }); }
3119
+ }, this))
3120
+ .bind("before.jstree", $.proxy(function (e, data) {
3121
+ if($.inArray(data.func, this.data.types.attach_to) !== -1) {
3122
+ var s = this._get_settings().types.types,
3123
+ t = this._get_type(data.args[0]);
3124
+ if(
3125
+ (
3126
+ (s[t] && typeof s[t][data.func] !== "undefined") ||
3127
+ (s["default"] && typeof s["default"][data.func] !== "undefined")
3128
+ ) && !this._check(data.func, data.args[0])
3129
+ ) {
3130
+ e.stopImmediatePropagation();
3131
+ return false;
3132
+ }
3133
+ }
3134
+ }, this));
3135
+ },
3136
+ defaults : {
3137
+ // defines maximum number of root nodes (-1 means unlimited, -2 means disable max_children checking)
3138
+ max_children : -1,
3139
+ // defines the maximum depth of the tree (-1 means unlimited, -2 means disable max_depth checking)
3140
+ max_depth : -1,
3141
+ // defines valid node types for the root nodes
3142
+ valid_children : "all",
3143
+
3144
+ // where is the type stores (the rel attribute of the LI element)
3145
+ type_attr : "rel",
3146
+ // a list of types
3147
+ types : {
3148
+ // the default type
3149
+ "default" : {
3150
+ "max_children" : -1,
3151
+ "max_depth" : -1,
3152
+ "valid_children": "all"
3153
+
3154
+ // Bound functions - you can bind any other function here (using boolean or function)
3155
+ //"select_node" : true,
3156
+ //"open_node" : true,
3157
+ //"close_node" : true,
3158
+ //"create_node" : true,
3159
+ //"delete_node" : true
3160
+ }
3161
+ }
3162
+ },
3163
+ _fn : {
3164
+ _get_type : function (obj) {
3165
+ obj = this._get_node(obj);
3166
+ return (!obj || !obj.length) ? false : obj.attr(this._get_settings().types.type_attr) || "default";
3167
+ },
3168
+ set_type : function (str, obj) {
3169
+ obj = this._get_node(obj);
3170
+ return (!obj.length || !str) ? false : obj.attr(this._get_settings().types.type_attr, str);
3171
+ },
3172
+ _check : function (rule, obj, opts) {
3173
+ var v = false, t = this._get_type(obj), d = 0, _this = this, s = this._get_settings().types;
3174
+ if(obj === -1) {
3175
+ if(!!s[rule]) { v = s[rule]; }
3176
+ else { return; }
3177
+ }
3178
+ else {
3179
+ if(t === false) { return; }
3180
+ if(!!s.types[t] && !!s.types[t][rule]) { v = s.types[t][rule]; }
3181
+ else if(!!s.types["default"] && !!s.types["default"][rule]) { v = s.types["default"][rule]; }
3182
+ }
3183
+ if($.isFunction(v)) { v = v.call(this, obj); }
3184
+ if(rule === "max_depth" && obj !== -1 && opts !== false && s.max_depth !== -2 && v !== 0) {
3185
+ // also include the node itself - otherwise if root node it is not checked
3186
+ this._get_node(obj).children("a:eq(0)").parentsUntil(".jstree","li").each(function (i) {
3187
+ // check if current depth already exceeds global tree depth
3188
+ if(s.max_depth !== -1 && s.max_depth - (i + 1) <= 0) { v = 0; return false; }
3189
+ d = (i === 0) ? v : _this._check(rule, this, false);
3190
+ // check if current node max depth is already matched or exceeded
3191
+ if(d !== -1 && d - (i + 1) <= 0) { v = 0; return false; }
3192
+ // otherwise - set the max depth to the current value minus current depth
3193
+ if(d >= 0 && (d - (i + 1) < v || v < 0) ) { v = d - (i + 1); }
3194
+ // if the global tree depth exists and it minus the nodes calculated so far is less than `v` or `v` is unlimited
3195
+ if(s.max_depth >= 0 && (s.max_depth - (i + 1) < v || v < 0) ) { v = s.max_depth - (i + 1); }
3196
+ });
3197
+ }
3198
+ return v;
3199
+ },
3200
+ check_move : function () {
3201
+ if(!this.__call_old()) { return false; }
3202
+ var m = this._get_move(),
3203
+ s = m.rt._get_settings().types,
3204
+ mc = m.rt._check("max_children", m.cr),
3205
+ md = m.rt._check("max_depth", m.cr),
3206
+ vc = m.rt._check("valid_children", m.cr),
3207
+ ch = 0, d = 1, t;
3208
+
3209
+ if(vc === "none") { return false; }
3210
+ if($.isArray(vc) && m.ot && m.ot._get_type) {
3211
+ m.o.each(function () {
3212
+ if($.inArray(m.ot._get_type(this), vc) === -1) { d = false; return false; }
3213
+ });
3214
+ if(d === false) { return false; }
3215
+ }
3216
+ if(s.max_children !== -2 && mc !== -1) {
3217
+ ch = m.cr === -1 ? this.get_container().children("> ul > li").not(m.o).length : m.cr.children("> ul > li").not(m.o).length;
3218
+ if(ch + m.o.length > mc) { return false; }
3219
+ }
3220
+ if(s.max_depth !== -2 && md !== -1) {
3221
+ d = 0;
3222
+ if(md === 0) { return false; }
3223
+ if(typeof m.o.d === "undefined") {
3224
+ // TODO: deal with progressive rendering and async when checking max_depth (how to know the depth of the moved node)
3225
+ t = m.o;
3226
+ while(t.length > 0) {
3227
+ t = t.find("> ul > li");
3228
+ d ++;
3229
+ }
3230
+ m.o.d = d;
3231
+ }
3232
+ if(md - m.o.d < 0) { return false; }
3233
+ }
3234
+ return true;
3235
+ },
3236
+ create_node : function (obj, position, js, callback, is_loaded, skip_check) {
3237
+ if(!skip_check && (is_loaded || this._is_loaded(obj))) {
3238
+ var p = (position && position.match(/^before|after$/i) && obj !== -1) ? this._get_parent(obj) : this._get_node(obj),
3239
+ s = this._get_settings().types,
3240
+ mc = this._check("max_children", p),
3241
+ md = this._check("max_depth", p),
3242
+ vc = this._check("valid_children", p),
3243
+ ch;
3244
+ if(!js) { js = {}; }
3245
+ if(vc === "none") { return false; }
3246
+ if($.isArray(vc)) {
3247
+ if(!js.attr || !js.attr[s.type_attr]) {
3248
+ if(!js.attr) { js.attr = {}; }
3249
+ js.attr[s.type_attr] = vc[0];
3250
+ }
3251
+ else {
3252
+ if($.inArray(js.attr[s.type_attr], vc) === -1) { return false; }
3253
+ }
3254
+ }
3255
+ if(s.max_children !== -2 && mc !== -1) {
3256
+ ch = p === -1 ? this.get_container().children("> ul > li").length : p.children("> ul > li").length;
3257
+ if(ch + 1 > mc) { return false; }
3258
+ }
3259
+ if(s.max_depth !== -2 && md !== -1 && (md - 1) < 0) { return false; }
3260
+ }
3261
+ return this.__call_old(true, obj, position, js, callback, is_loaded, skip_check);
3262
+ }
3263
+ }
3264
+ });
3265
+ })(jQuery);
3266
+ //*/
3267
+
3268
+ /*
3269
+ * jsTree HTML data 1.0
3270
+ * The HTML data store. Datastores are build by replacing the `load_node` and `_is_loaded` functions.
3271
+ */
3272
+ (function ($) {
3273
+ $.jstree.plugin("html_data", {
3274
+ __init : function () {
3275
+ // this used to use html() and clean the whitespace, but this way any attached data was lost
3276
+ this.data.html_data.original_container_html = this.get_container().find(" > ul > li").clone(true);
3277
+ // remove white space from LI node - otherwise nodes appear a bit to the right
3278
+ this.data.html_data.original_container_html.find("li").andSelf().contents().filter(function() { return this.nodeType == 3; }).remove();
3279
+ },
3280
+ defaults : {
3281
+ data : false,
3282
+ ajax : false,
3283
+ correct_state : true
3284
+ },
3285
+ _fn : {
3286
+ 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); },
3287
+ _is_loaded : function (obj) {
3288
+ obj = this._get_node(obj);
3289
+ return obj == -1 || !obj || !this._get_settings().html_data.ajax || obj.is(".jstree-open, .jstree-leaf") || obj.children("ul").children("li").size() > 0;
3290
+ },
3291
+ load_node_html : function (obj, s_call, e_call) {
3292
+ var d,
3293
+ s = this.get_settings().html_data,
3294
+ error_func = function () {},
3295
+ success_func = function () {};
3296
+ obj = this._get_node(obj);
3297
+ if(obj && obj !== -1) {
3298
+ if(obj.data("jstree-is-loading")) { return; }
3299
+ else { obj.data("jstree-is-loading",true); }
3300
+ }
3301
+ switch(!0) {
3302
+ case (!s.data && !s.ajax):
3303
+ if(!obj || obj == -1) {
3304
+ this.get_container()
3305
+ .children("ul").empty()
3306
+ .append(this.data.html_data.original_container_html)
3307
+ .find("li, a").filter(function () { return this.firstChild.tagName !== "INS"; }).prepend("<ins class='jstree-icon'>&#160;</ins>").end()
3308
+ .filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon");
3309
+ this.clean_node();
3310
+ }
3311
+ if(s_call) { s_call.call(this); }
3312
+ break;
3313
+ case (!!s.data && !s.ajax) || (!!s.data && !!s.ajax && (!obj || obj === -1)):
3314
+ if(!obj || obj == -1) {
3315
+ d = $(s.data);
3316
+ if(!d.is("ul")) { d = $("<ul>").append(d); }
3317
+ this.get_container()
3318
+ .children("ul").empty().append(d.children())
3319
+ .find("li, a").filter(function () { return this.firstChild.tagName !== "INS"; }).prepend("<ins class='jstree-icon'>&#160;</ins>").end()
3320
+ .filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon");
3321
+ this.clean_node();
3322
+ }
3323
+ if(s_call) { s_call.call(this); }
3324
+ break;
3325
+ case (!s.data && !!s.ajax) || (!!s.data && !!s.ajax && obj && obj !== -1):
3326
+ obj = this._get_node(obj);
3327
+ error_func = function (x, t, e) {
3328
+ var ef = this.get_settings().html_data.ajax.error;
3329
+ if(ef) { ef.call(this, x, t, e); }
3330
+ if(obj != -1 && obj.length) {
3331
+ obj.children(".jstree-loading").removeClass("jstree-loading");
3332
+ obj.data("jstree-is-loading",false);
3333
+ if(t === "success" && s.correct_state) { obj.removeClass("jstree-open jstree-closed").addClass("jstree-leaf"); }
3334
+ }
3335
+ else {
3336
+ if(t === "success" && s.correct_state) { this.get_container().children("ul").empty(); }
3337
+ }
3338
+ if(e_call) { e_call.call(this); }
3339
+ };
3340
+ success_func = function (d, t, x) {
3341
+ var sf = this.get_settings().html_data.ajax.success;
3342
+ if(sf) { d = sf.call(this,d,t,x) || d; }
3343
+ if(d == "") {
3344
+ return error_func.call(this, x, t, "");
3345
+ }
3346
+ if(d) {
3347
+ d = $(d);
3348
+ if(!d.is("ul")) { d = $("<ul>").append(d); }
3349
+ 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"); }
3350
+ 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); }
3351
+ this.clean_node(obj);
3352
+ if(s_call) { s_call.call(this); }
3353
+ }
3354
+ else {
3355
+ if(obj && obj !== -1) {
3356
+ obj.children(".jstree-loading").removeClass("jstree-loading");
3357
+ obj.data("jstree-is-loading",false);
3358
+ if(s.correct_state) {
3359
+ obj.removeClass("jstree-open jstree-closed").addClass("jstree-leaf");
3360
+ if(s_call) { s_call.call(this); }
3361
+ }
3362
+ }
3363
+ else {
3364
+ if(s.correct_state) {
3365
+ this.get_container().children("ul").empty();
3366
+ if(s_call) { s_call.call(this); }
3367
+ }
3368
+ }
3369
+ }
3370
+ };
3371
+ s.ajax.context = this;
3372
+ s.ajax.error = error_func;
3373
+ s.ajax.success = success_func;
3374
+ if(!s.ajax.dataType) { s.ajax.dataType = "html"; }
3375
+ if($.isFunction(s.ajax.url)) { s.ajax.url = s.ajax.url.call(this, obj); }
3376
+ if($.isFunction(s.ajax.data)) { s.ajax.data = s.ajax.data.call(this, obj); }
3377
+ $.ajax(s.ajax);
3378
+ break;
3379
+ }
3380
+ }
3381
+ }
3382
+ });
3383
+ // include the HTML data plugin by default
3384
+ $.jstree.defaults.plugins.push("html_data");
3385
+ })(jQuery);
3386
+ //*/
3387
+
3388
+ /*
3389
+ * jsTree themeroller plugin 1.0
3390
+ * Adds support for jQuery UI themes. Include this at the end of your plugins list, also make sure "themes" is not included.
3391
+ */
3392
+ (function ($) {
3393
+ $.jstree.plugin("themeroller", {
3394
+ __init : function () {
3395
+ var s = this._get_settings().themeroller;
3396
+ this.get_container()
3397
+ .addClass("ui-widget-content")
3398
+ .delegate("a","mouseenter.jstree", function () {
3399
+ $(this).addClass(s.item_h);
3400
+ })
3401
+ .delegate("a","mouseleave.jstree", function () {
3402
+ $(this).removeClass(s.item_h);
3403
+ })
3404
+ .bind("open_node.jstree create_node.jstree", $.proxy(function (e, data) {
3405
+ this._themeroller(data.rslt.obj);
3406
+ }, this))
3407
+ .bind("loaded.jstree refresh.jstree", $.proxy(function (e) {
3408
+ this._themeroller();
3409
+ }, this))
3410
+ .bind("close_node.jstree", $.proxy(function (e, data) {
3411
+ data.rslt.obj.children("ins").removeClass(s.opened).addClass(s.closed);
3412
+ }, this))
3413
+ .bind("select_node.jstree", $.proxy(function (e, data) {
3414
+ data.rslt.obj.children("a").addClass(s.item_a);
3415
+ }, this))
3416
+ .bind("deselect_node.jstree deselect_all.jstree", $.proxy(function (e, data) {
3417
+ this.get_container()
3418
+ .find("." + s.item_a).removeClass(s.item_a).end()
3419
+ .find(".jstree-clicked").addClass(s.item_a);
3420
+ }, this))
3421
+ .bind("move_node.jstree", $.proxy(function (e, data) {
3422
+ this._themeroller(data.rslt.o);
3423
+ }, this));
3424
+ },
3425
+ __destroy : function () {
3426
+ var s = this._get_settings().themeroller,
3427
+ c = [ "ui-icon" ];
3428
+ $.each(s, function (i, v) {
3429
+ v = v.split(" ");
3430
+ if(v.length) { c = c.concat(v); }
3431
+ });
3432
+ this.get_container()
3433
+ .removeClass("ui-widget-content")
3434
+ .find("." + c.join(", .")).removeClass(c.join(" "));
3435
+ },
3436
+ _fn : {
3437
+ _themeroller : function (obj) {
3438
+ var s = this._get_settings().themeroller;
3439
+ obj = !obj || obj == -1 ? this.get_container() : this._get_node(obj).parent();
3440
+ obj
3441
+ .find("li.jstree-closed > ins.jstree-icon").removeClass(s.opened).addClass("ui-icon " + s.closed).end()
3442
+ .find("li.jstree-open > ins.jstree-icon").removeClass(s.closed).addClass("ui-icon " + s.opened).end()
3443
+ .find("a").addClass(s.item)
3444
+ .children("ins.jstree-icon").addClass("ui-icon " + s.item_icon);
3445
+ }
3446
+ },
3447
+ defaults : {
3448
+ "opened" : "ui-icon-triangle-1-se",
3449
+ "closed" : "ui-icon-triangle-1-e",
3450
+ "item" : "ui-state-default",
3451
+ "item_h" : "ui-state-hover",
3452
+ "item_a" : "ui-state-active",
3453
+ "item_icon" : "ui-icon-folder-collapsed"
3454
+ }
3455
+ });
3456
+ $(function() {
3457
+ var css_string = '.jstree .ui-icon { overflow:visible; } .jstree a { padding:0 2px; }';
3458
+ $.vakata.css.add_sheet({ str : css_string });
3459
+ });
3460
+ })(jQuery);
3461
+ //*/
3462
+
3463
+ /*
3464
+ * jsTree unique plugin 1.0
3465
+ * Forces different names amongst siblings (still a bit experimental)
3466
+ * NOTE: does not check language versions (it will not be possible to have nodes with the same title, even in different languages)
3467
+ */
3468
+ (function ($) {
3469
+ $.jstree.plugin("unique", {
3470
+ __init : function () {
3471
+ this.get_container()
3472
+ .bind("before.jstree", $.proxy(function (e, data) {
3473
+ var nms = [], res = true, p, t;
3474
+ if(data.func == "move_node") {
3475
+ // obj, ref, position, is_copy, is_prepared, skip_check
3476
+ if(data.args[4] === true) {
3477
+ if(data.args[0].o && data.args[0].o.length) {
3478
+ data.args[0].o.children("a").each(function () { nms.push($(this).text().replace(/^\s+/g,"")); });
3479
+ res = this._check_unique(nms, data.args[0].np.find("> ul > li").not(data.args[0].o));
3480
+ }
3481
+ }
3482
+ }
3483
+ if(data.func == "create_node") {
3484
+ // obj, position, js, callback, is_loaded
3485
+ if(data.args[4] || this._is_loaded(data.args[0])) {
3486
+ p = this._get_node(data.args[0]);
3487
+ if(data.args[1] && (data.args[1] === "before" || data.args[1] === "after")) {
3488
+ p = this._get_parent(data.args[0]);
3489
+ if(!p || p === -1) { p = this.get_container(); }
3490
+ }
3491
+ if(typeof data.args[2] === "string") { nms.push(data.args[2]); }
3492
+ else if(!data.args[2] || !data.args[2].data) { nms.push(this._get_settings().core.strings.new_node); }
3493
+ else { nms.push(data.args[2].data); }
3494
+ res = this._check_unique(nms, p.find("> ul > li"));
3495
+ }
3496
+ }
3497
+ if(data.func == "rename_node") {
3498
+ // obj, val
3499
+ nms.push(data.args[1]);
3500
+ t = this._get_node(data.args[0]);
3501
+ p = this._get_parent(t);
3502
+ if(!p || p === -1) { p = this.get_container(); }
3503
+ res = this._check_unique(nms, p.find("> ul > li").not(t));
3504
+ }
3505
+ if(!res) {
3506
+ e.stopPropagation();
3507
+ return false;
3508
+ }
3509
+ }, this));
3510
+ },
3511
+ _fn : {
3512
+ _check_unique : function (nms, p) {
3513
+ var cnms = [];
3514
+ p.children("a").each(function () { cnms.push($(this).text().replace(/^\s+/g,"")); });
3515
+ if(!cnms.length || !nms.length) { return true; }
3516
+ cnms = cnms.sort().join(",,").replace(/(,|^)([^,]+)(,,\2)+(,|$)/g,"$1$2$4").replace(/,,+/g,",").replace(/,$/,"").split(",");
3517
+ if((cnms.length + nms.length) != cnms.concat(nms).sort().join(",,").replace(/(,|^)([^,]+)(,,\2)+(,|$)/g,"$1$2$4").replace(/,,+/g,",").replace(/,$/,"").split(",").length) {
3518
+ return false;
3519
+ }
3520
+ return true;
3521
+ },
3522
+ check_move : function () {
3523
+ if(!this.__call_old()) { return false; }
3524
+ var p = this._get_move(), nms = [];
3525
+ if(p.o && p.o.length) {
3526
+ p.o.children("a").each(function () { nms.push($(this).text().replace(/^\s+/g,"")); });
3527
+ return this._check_unique(nms, p.np.find("> ul > li").not(p.o));
3528
+ }
3529
+ return true;
3530
+ }
3531
+ }
3532
+ });
3533
+ })(jQuery);
3534
+ //*/