treport 0.2.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (950) hide show
  1. checksums.yaml +4 -4
  2. data/app/models/connect.rb +12 -10
  3. data/app/models/db.rb +52 -0
  4. data/app/models/map.rb +25 -0
  5. data/app/models/map_requirement.rb +54 -0
  6. data/app/models/report.rb +40 -14
  7. data/app/models/requirement.rb +17 -5
  8. data/app/views/layouts/report_admin.html.erb +177 -0
  9. data/db/migrate/_create_reports.rb +70 -0
  10. data/lib/generators/treport/install_generator.rb +23 -0
  11. data/lib/treport/engine.rb +4 -0
  12. data/lib/treport.rb +3 -2
  13. data/public/{report → treport}/css/AdminLTE.min.css +0 -0
  14. data/public/treport/css/ace-ie.min.css +1 -0
  15. data/public/treport/css/ace-part2.min.css +1 -0
  16. data/public/treport/css/ace-rtl.min.css +1 -0
  17. data/public/treport/css/ace-skins.min.css +1 -0
  18. data/public/treport/css/ace.min.css +1 -0
  19. data/public/treport/css/blue.css +62 -0
  20. data/public/treport/css/blue.png +0 -0
  21. data/public/treport/css/blue@2x.png +0 -0
  22. data/public/treport/css/bootstrap-colorpicker.min.css +9 -0
  23. data/public/treport/css/bootstrap-datepicker3.min.css +7 -0
  24. data/public/treport/css/bootstrap-datetimepicker.min.css +5 -0
  25. data/public/treport/css/bootstrap-duallistbox.min.css +1 -0
  26. data/public/treport/css/bootstrap-editable.min.css +12 -0
  27. data/public/treport/css/bootstrap-multiselect.min.css +1 -0
  28. data/public/treport/css/bootstrap-timepicker.min.css +10 -0
  29. data/public/treport/css/bootstrap.min.css +5 -0
  30. data/public/treport/css/chosen.min.css +11 -0
  31. data/public/treport/css/colorbox.min.css +1 -0
  32. data/public/treport/css/daterangepicker.min.css +1 -0
  33. data/public/treport/css/dropzone.min.css +1 -0
  34. data/public/treport/css/font-awesome.min.css +4 -0
  35. data/public/treport/css/fonts.googleapis.com.css +12 -0
  36. data/public/treport/css/fullcalendar.min.css +5 -0
  37. data/public/treport/css/ionicons.min.css +11 -0
  38. data/public/treport/css/jquery-ui.custom.min.css +4 -0
  39. data/public/treport/css/jquery-ui.min.css +4 -0
  40. data/public/treport/css/jquery.gritter.min.css +1 -0
  41. data/public/treport/css/lkmain.css +1 -0
  42. data/public/treport/css/prettify.min.css +1 -0
  43. data/public/treport/css/select2.min.css +1 -0
  44. data/public/treport/css/test.html +221 -0
  45. data/public/treport/css/ui.jqgrid.min.css +1 -0
  46. data/public/treport/font-awesome/4.5.0/css/font-awesome.min.css +4 -0
  47. data/public/treport/font-awesome/4.5.0/fonts/fontawesome-webfont.eot +0 -0
  48. data/public/treport/font-awesome/4.5.0/fonts/fontawesome-webfont.svg +655 -0
  49. data/public/treport/font-awesome/4.5.0/fonts/fontawesome-webfont.ttf +0 -0
  50. data/public/treport/font-awesome/4.5.0/fonts/fontawesome-webfont.woff +0 -0
  51. data/public/treport/font-awesome/4.5.0/fonts/fontawesome-webfont.woff2 +0 -0
  52. data/public/treport/fonts/glyphicons-halflings-regular.eot +0 -0
  53. data/public/treport/fonts/glyphicons-halflings-regular.svg +288 -0
  54. data/public/treport/fonts/glyphicons-halflings-regular.ttf +0 -0
  55. data/public/treport/fonts/glyphicons-halflings-regular.woff +0 -0
  56. data/public/treport/fonts/glyphicons-halflings-regular.woff2 +0 -0
  57. data/public/treport/images/avatars/avatar.png +0 -0
  58. data/public/treport/images/avatars/avatar1.png +0 -0
  59. data/public/treport/images/avatars/avatar2.png +0 -0
  60. data/public/treport/images/avatars/avatar3.png +0 -0
  61. data/public/treport/images/avatars/avatar4.png +0 -0
  62. data/public/treport/images/avatars/avatar5.png +0 -0
  63. data/public/treport/images/avatars/profile-pic.jpg +0 -0
  64. data/public/treport/images/avatars/user.jpg +0 -0
  65. data/public/treport/images/bootstrap-colorpicker/alpha-horizontal.png +0 -0
  66. data/public/treport/images/bootstrap-colorpicker/alpha.png +0 -0
  67. data/public/treport/images/bootstrap-colorpicker/hue-horizontal.png +0 -0
  68. data/public/treport/images/bootstrap-colorpicker/hue.png +0 -0
  69. data/public/treport/images/bootstrap-colorpicker/saturation.png +0 -0
  70. data/public/treport/images/email/email1.png +0 -0
  71. data/public/treport/images/email/email2.png +0 -0
  72. data/public/treport/images/email/email3.png +0 -0
  73. data/public/treport/images/email/email4.png +0 -0
  74. data/public/treport/images/gallery/image-1.jpg +0 -0
  75. data/public/treport/images/gallery/image-2.jpg +0 -0
  76. data/public/treport/images/gallery/image-3.jpg +0 -0
  77. data/public/treport/images/gallery/image-4.jpg +0 -0
  78. data/public/treport/images/gallery/image-5.jpg +0 -0
  79. data/public/treport/images/gallery/image-6.jpg +0 -0
  80. data/public/treport/images/gallery/thumb-1.jpg +0 -0
  81. data/public/treport/images/gallery/thumb-2.jpg +0 -0
  82. data/public/treport/images/gallery/thumb-3.jpg +0 -0
  83. data/public/treport/images/gallery/thumb-4.jpg +0 -0
  84. data/public/treport/images/gallery/thumb-5.jpg +0 -0
  85. data/public/treport/images/gallery/thumb-6.jpg +0 -0
  86. data/public/treport/images/placeholder/165x90.png +0 -0
  87. data/public/treport/images/placeholder/255x150.png +0 -0
  88. data/public/treport/images/placeholder/530x270.png +0 -0
  89. data/public/treport/images/placeholder/550x280.png +0 -0
  90. data/public/treport/images/ui-icons_ffffff_256x240.png +0 -0
  91. data/public/treport/js/ace-editable.min.js +4 -0
  92. data/public/treport/js/ace-elements.min.js +5 -0
  93. data/public/treport/js/ace-extra.min.js +1 -0
  94. data/public/treport/js/ace.min.js +5 -0
  95. data/public/treport/js/autosize.min.js +6 -0
  96. data/public/treport/js/bootbox.js +6 -0
  97. data/public/treport/js/bootstrap-colorpicker.min.js +11 -0
  98. data/public/treport/js/bootstrap-datepicker.min.js +9 -0
  99. data/public/treport/js/bootstrap-datetimepicker.min.js +9 -0
  100. data/public/treport/js/bootstrap-editable.min.js +6 -0
  101. data/public/treport/js/bootstrap-markdown.min.js +19 -0
  102. data/public/treport/js/bootstrap-multiselect.min.js +44 -0
  103. data/public/treport/js/bootstrap-tag.min.js +19 -0
  104. data/public/treport/js/bootstrap-timepicker.min.js +11 -0
  105. data/public/treport/js/bootstrap-wysiwyg.min.js +2 -0
  106. data/public/treport/js/bootstrap.min.js +7 -0
  107. data/public/treport/js/buttons.colVis.min.js +5 -0
  108. data/public/treport/js/buttons.flash.min.js +8 -0
  109. data/public/treport/js/buttons.html5.min.js +8 -0
  110. data/public/treport/js/buttons.print.min.js +5 -0
  111. data/public/treport/js/chosen.jquery.min.js +1 -0
  112. data/public/treport/js/dataTables.buttons.min.js +4 -0
  113. data/public/treport/js/dataTables.select.min.js +4 -0
  114. data/public/treport/js/daterangepicker.min.js +9 -0
  115. data/public/treport/js/dropzone.min.js +2 -0
  116. data/public/{report → treport}/js/echarts.min.js +0 -0
  117. data/public/treport/js/excanvas.min.js +1 -0
  118. data/public/treport/js/fullcalendar.min.js +9 -0
  119. data/public/treport/js/grid.locale-en.js +1 -0
  120. data/public/treport/js/holder.min.js +13 -0
  121. data/public/treport/js/html5shiv.min.js +4 -0
  122. data/public/treport/js/jquery-1.11.3.min.js +6 -0
  123. data/public/treport/js/jquery-2.1.4.min.js +5 -0
  124. data/public/treport/js/jquery-additional-methods.min.js +9 -0
  125. data/public/treport/js/jquery-typeahead.js +6 -0
  126. data/public/treport/js/jquery-ui.custom.min.js +8 -0
  127. data/public/treport/js/jquery-ui.min.js +12 -0
  128. data/public/treport/js/jquery.bootstrap-duallistbox.min.js +9 -0
  129. data/public/treport/js/jquery.colorbox.min.js +6 -0
  130. data/public/treport/js/jquery.dataTables.bootstrap.min.js +2 -0
  131. data/public/treport/js/jquery.dataTables.min.js +6 -0
  132. data/public/treport/js/jquery.easypiechart.min.js +9 -0
  133. data/public/treport/js/jquery.flot.min.js +8 -0
  134. data/public/treport/js/jquery.flot.pie.min.js +57 -0
  135. data/public/treport/js/jquery.flot.resize.min.js +13 -0
  136. data/public/treport/js/jquery.gritter.min.js +11 -0
  137. data/public/treport/js/jquery.hotkeys.index.min.js +3 -0
  138. data/public/treport/js/jquery.inputlimiter.min.js +28 -0
  139. data/public/treport/js/jquery.jqGrid.min.js +17 -0
  140. data/public/treport/js/jquery.knob.min.js +1 -0
  141. data/public/treport/js/jquery.maskedinput.min.js +7 -0
  142. data/public/treport/js/jquery.mobile.custom.min.js +10 -0
  143. data/public/treport/js/jquery.nestable.min.js +5 -0
  144. data/public/treport/js/jquery.raty.min.js +11 -0
  145. data/public/treport/js/jquery.sparkline.index.min.js +203 -0
  146. data/public/treport/js/jquery.ui.touch-punch.min.js +11 -0
  147. data/public/treport/js/jquery.validate.min.js +9 -0
  148. data/public/treport/js/markdown.min.js +3 -0
  149. data/public/treport/js/moment.min.js +5 -0
  150. data/public/treport/js/prettify.min.js +30 -0
  151. data/public/treport/js/respond.min.js +5 -0
  152. data/public/treport/js/select2.min.js +9 -0
  153. data/public/treport/js/spin.js +32 -0
  154. data/public/treport/js/spinbox.min.js +8 -0
  155. data/public/treport/js/tree.min.js +8 -0
  156. data/public/treport/js/wizard.min.js +8 -0
  157. data/public/treport/plugins/datePicker/My97DatePicker.htm +49 -0
  158. data/public/treport/plugins/datePicker/WdatePicker.js +53 -0
  159. data/public/treport/plugins/datePicker/calendar.js +5 -0
  160. data/public/treport/plugins/datePicker/config.js +17 -0
  161. data/public/treport/plugins/datePicker/lang/en.js +14 -0
  162. data/public/treport/plugins/datePicker/lang/zh-cn.js +14 -0
  163. data/public/treport/plugins/datePicker/lang/zh-tw.js +14 -0
  164. data/public/treport/plugins/datePicker/skin/Thumbs.db +0 -0
  165. data/public/treport/plugins/datePicker/skin/WdatePicker.css +10 -0
  166. data/public/treport/plugins/datePicker/skin/areo/Thumbs.db +0 -0
  167. data/public/treport/plugins/datePicker/skin/areo/datepicker.css +302 -0
  168. data/public/treport/plugins/datePicker/skin/areo/dateselect.gif +0 -0
  169. data/public/treport/plugins/datePicker/skin/areo/glass-bg.gif +0 -0
  170. data/public/treport/plugins/datePicker/skin/areo/hd-sprite.gif +0 -0
  171. data/public/treport/plugins/datePicker/skin/areo/img.gif +0 -0
  172. data/public/treport/plugins/datePicker/skin/areo/left-btn.gif +0 -0
  173. data/public/treport/plugins/datePicker/skin/areo/left-btn2.gif +0 -0
  174. data/public/treport/plugins/datePicker/skin/areo/right-btn.gif +0 -0
  175. data/public/treport/plugins/datePicker/skin/areo/right-btn2.gif +0 -0
  176. data/public/treport/plugins/datePicker/skin/armyGreen/Thumbs.db +0 -0
  177. data/public/treport/plugins/datePicker/skin/armyGreen/datepicker.css +302 -0
  178. data/public/treport/plugins/datePicker/skin/armyGreen/dateselect.gif +0 -0
  179. data/public/treport/plugins/datePicker/skin/armyGreen/glass-bg.gif +0 -0
  180. data/public/treport/plugins/datePicker/skin/armyGreen/hd-sprite.gif +0 -0
  181. data/public/treport/plugins/datePicker/skin/armyGreen/img.gif +0 -0
  182. data/public/treport/plugins/datePicker/skin/armyGreen/left-btn.gif +0 -0
  183. data/public/treport/plugins/datePicker/skin/armyGreen/left-btn2.gif +0 -0
  184. data/public/treport/plugins/datePicker/skin/armyGreen/right-btn.gif +0 -0
  185. data/public/treport/plugins/datePicker/skin/armyGreen/right-btn2.gif +0 -0
  186. data/public/treport/plugins/datePicker/skin/blue/Thumbs.db +0 -0
  187. data/public/treport/plugins/datePicker/skin/blue/bg.gif +0 -0
  188. data/public/treport/plugins/datePicker/skin/blue/datepicker.css +115 -0
  189. data/public/treport/plugins/datePicker/skin/blue/dateselect.gif +0 -0
  190. data/public/treport/plugins/datePicker/skin/blue/glass-bg.gif +0 -0
  191. data/public/treport/plugins/datePicker/skin/blue/hd-sprite.gif +0 -0
  192. data/public/treport/plugins/datePicker/skin/blue/img.gif +0 -0
  193. data/public/treport/plugins/datePicker/skin/blue/left-btn.gif +0 -0
  194. data/public/treport/plugins/datePicker/skin/blue/left-btn2.gif +0 -0
  195. data/public/treport/plugins/datePicker/skin/blue/qs.jpg +0 -0
  196. data/public/treport/plugins/datePicker/skin/blue/right-btn.gif +0 -0
  197. data/public/treport/plugins/datePicker/skin/blue/right-btn2.gif +0 -0
  198. data/public/treport/plugins/datePicker/skin/blueGreen/Thumbs.db +0 -0
  199. data/public/treport/plugins/datePicker/skin/blueGreen/datepicker.css +302 -0
  200. data/public/treport/plugins/datePicker/skin/blueGreen/dateselect.gif +0 -0
  201. data/public/treport/plugins/datePicker/skin/blueGreen/glass-bg.gif +0 -0
  202. data/public/treport/plugins/datePicker/skin/blueGreen/hd-sprite.gif +0 -0
  203. data/public/treport/plugins/datePicker/skin/blueGreen/img.gif +0 -0
  204. data/public/treport/plugins/datePicker/skin/blueGreen/left-btn.gif +0 -0
  205. data/public/treport/plugins/datePicker/skin/blueGreen/left-btn2.gif +0 -0
  206. data/public/treport/plugins/datePicker/skin/blueGreen/right-btn.gif +0 -0
  207. data/public/treport/plugins/datePicker/skin/blueGreen/right-btn2.gif +0 -0
  208. data/public/treport/plugins/datePicker/skin/darkBlue/Thumbs.db +0 -0
  209. data/public/treport/plugins/datePicker/skin/darkBlue/datepicker.css +309 -0
  210. data/public/treport/plugins/datePicker/skin/darkBlue/dateselect.gif +0 -0
  211. data/public/treport/plugins/datePicker/skin/darkBlue/glass-bg.gif +0 -0
  212. data/public/treport/plugins/datePicker/skin/darkBlue/hd-sprite.gif +0 -0
  213. data/public/treport/plugins/datePicker/skin/darkBlue/img.gif +0 -0
  214. data/public/treport/plugins/datePicker/skin/darkBlue/left-btn.gif +0 -0
  215. data/public/treport/plugins/datePicker/skin/darkBlue/left-btn2.gif +0 -0
  216. data/public/treport/plugins/datePicker/skin/darkBlue/right-btn.gif +0 -0
  217. data/public/treport/plugins/datePicker/skin/darkBlue/right-btn2.gif +0 -0
  218. data/public/treport/plugins/datePicker/skin/darkYellow/Thumbs.db +0 -0
  219. data/public/treport/plugins/datePicker/skin/darkYellow/bg.gif +0 -0
  220. data/public/treport/plugins/datePicker/skin/darkYellow/datepicker.css +115 -0
  221. data/public/treport/plugins/datePicker/skin/darkYellow/qs.jpg +0 -0
  222. data/public/treport/plugins/datePicker/skin/datePicker.gif +0 -0
  223. data/public/treport/plugins/datePicker/skin/deepBlue/Thumbs.db +0 -0
  224. data/public/treport/plugins/datePicker/skin/deepBlue/datepicker.css +301 -0
  225. data/public/treport/plugins/datePicker/skin/deepBlue/dateselect.gif +0 -0
  226. data/public/treport/plugins/datePicker/skin/deepBlue/glass-bg.gif +0 -0
  227. data/public/treport/plugins/datePicker/skin/deepBlue/hd-sprite.gif +0 -0
  228. data/public/treport/plugins/datePicker/skin/deepBlue/img.gif +0 -0
  229. data/public/treport/plugins/datePicker/skin/deepBlue/left-btn.gif +0 -0
  230. data/public/treport/plugins/datePicker/skin/deepBlue/left-btn2.gif +0 -0
  231. data/public/treport/plugins/datePicker/skin/deepBlue/right-btn.gif +0 -0
  232. data/public/treport/plugins/datePicker/skin/deepBlue/right-btn2.gif +0 -0
  233. data/public/treport/plugins/datePicker/skin/default/Thumbs.db +0 -0
  234. data/public/treport/plugins/datePicker/skin/default/datepicker.css +246 -0
  235. data/public/treport/plugins/datePicker/skin/default/img.gif +0 -0
  236. data/public/treport/plugins/datePicker/skin/green/Thumbs.db +0 -0
  237. data/public/treport/plugins/datePicker/skin/green/bg.gif +0 -0
  238. data/public/treport/plugins/datePicker/skin/green/datepicker.css +115 -0
  239. data/public/treport/plugins/datePicker/skin/green/dateselect.gif +0 -0
  240. data/public/treport/plugins/datePicker/skin/green/glass-bg.gif +0 -0
  241. data/public/treport/plugins/datePicker/skin/green/hd-sprite.gif +0 -0
  242. data/public/treport/plugins/datePicker/skin/green/img.gif +0 -0
  243. data/public/treport/plugins/datePicker/skin/green/left-btn.gif +0 -0
  244. data/public/treport/plugins/datePicker/skin/green/left-btn2.gif +0 -0
  245. data/public/treport/plugins/datePicker/skin/green/qs.jpg +0 -0
  246. data/public/treport/plugins/datePicker/skin/green/right-btn.gif +0 -0
  247. data/public/treport/plugins/datePicker/skin/green/right-btn2.gif +0 -0
  248. data/public/treport/plugins/datePicker/skin/lightBlue/Thumbs.db +0 -0
  249. data/public/treport/plugins/datePicker/skin/lightBlue/bg.gif +0 -0
  250. data/public/treport/plugins/datePicker/skin/lightBlue/btn.jpg +0 -0
  251. data/public/treport/plugins/datePicker/skin/lightBlue/datepicker.css +115 -0
  252. data/public/treport/plugins/datePicker/skin/lightBlue/dateselect.gif +0 -0
  253. data/public/treport/plugins/datePicker/skin/lightBlue/glass-bg.gif +0 -0
  254. data/public/treport/plugins/datePicker/skin/lightBlue/hd-sprite.gif +0 -0
  255. data/public/treport/plugins/datePicker/skin/lightBlue/img.gif +0 -0
  256. data/public/treport/plugins/datePicker/skin/lightBlue/left-btn.gif +0 -0
  257. data/public/treport/plugins/datePicker/skin/lightBlue/left-btn2.gif +0 -0
  258. data/public/treport/plugins/datePicker/skin/lightBlue/qs.jpg +0 -0
  259. data/public/treport/plugins/datePicker/skin/lightBlue/right-btn.gif +0 -0
  260. data/public/treport/plugins/datePicker/skin/lightBlue/right-btn2.gif +0 -0
  261. data/public/treport/plugins/datePicker/skin/lightBlue/titlebar.jpg +0 -0
  262. data/public/treport/plugins/datePicker/skin/modernBlue/Thumbs.db +0 -0
  263. data/public/treport/plugins/datePicker/skin/modernBlue/datepicker.css +302 -0
  264. data/public/treport/plugins/datePicker/skin/modernBlue/dateselect.gif +0 -0
  265. data/public/treport/plugins/datePicker/skin/modernBlue/glass-bg.gif +0 -0
  266. data/public/treport/plugins/datePicker/skin/modernBlue/hd-sprite.gif +0 -0
  267. data/public/treport/plugins/datePicker/skin/modernBlue/img.gif +0 -0
  268. data/public/treport/plugins/datePicker/skin/modernBlue/left-btn.gif +0 -0
  269. data/public/treport/plugins/datePicker/skin/modernBlue/left-btn2.gif +0 -0
  270. data/public/treport/plugins/datePicker/skin/modernBlue/right-btn.gif +0 -0
  271. data/public/treport/plugins/datePicker/skin/modernBlue/right-btn2.gif +0 -0
  272. data/public/treport/plugins/datePicker/skin/orange/Thumbs.db +0 -0
  273. data/public/treport/plugins/datePicker/skin/orange/datepicker.css +115 -0
  274. data/public/treport/plugins/datePicker/skin/orange/dateselect.gif +0 -0
  275. data/public/treport/plugins/datePicker/skin/orange/glass-bg.gif +0 -0
  276. data/public/treport/plugins/datePicker/skin/orange/hd-sprite.gif +0 -0
  277. data/public/treport/plugins/datePicker/skin/orange/img.gif +0 -0
  278. data/public/treport/plugins/datePicker/skin/orange/left-btn.gif +0 -0
  279. data/public/treport/plugins/datePicker/skin/orange/left-btn2.gif +0 -0
  280. data/public/treport/plugins/datePicker/skin/orange/right-btn.gif +0 -0
  281. data/public/treport/plugins/datePicker/skin/orange/right-btn2.gif +0 -0
  282. data/public/treport/plugins/datePicker/skin/red/Thumbs.db +0 -0
  283. data/public/treport/plugins/datePicker/skin/red/bg.gif +0 -0
  284. data/public/treport/plugins/datePicker/skin/red/datepicker.css +115 -0
  285. data/public/treport/plugins/datePicker/skin/red/dateselect.gif +0 -0
  286. data/public/treport/plugins/datePicker/skin/red/glass-bg.gif +0 -0
  287. data/public/treport/plugins/datePicker/skin/red/hd-sprite.gif +0 -0
  288. data/public/treport/plugins/datePicker/skin/red/img.gif +0 -0
  289. data/public/treport/plugins/datePicker/skin/red/left-btn.gif +0 -0
  290. data/public/treport/plugins/datePicker/skin/red/left-btn2.gif +0 -0
  291. data/public/treport/plugins/datePicker/skin/red/qs.jpg +0 -0
  292. data/public/treport/plugins/datePicker/skin/red/right-btn.gif +0 -0
  293. data/public/treport/plugins/datePicker/skin/red/right-btn2.gif +0 -0
  294. data/public/treport/plugins/datePicker/skin/whyGreen/Thumbs.db +0 -0
  295. data/public/treport/plugins/datePicker/skin/whyGreen/bg.jpg +0 -0
  296. data/public/treport/plugins/datePicker/skin/whyGreen/datepicker.css +256 -0
  297. data/public/treport/plugins/datePicker/skin/whyGreen/img.gif +0 -0
  298. data/public/treport/plugins/datePicker/skin/yellowGreen/Thumbs.db +0 -0
  299. data/public/treport/plugins/datePicker/skin/yellowGreen/bg.gif +0 -0
  300. data/public/treport/plugins/datePicker/skin/yellowGreen/datepicker.css +115 -0
  301. data/public/treport/plugins/datePicker/skin/yellowGreen/qs.jpg +0 -0
  302. data/public/treport/plugins/datePicker//351/222/203/346/277/212/345/243/212/351/220/250/356/206/277/345/201/206/351/217/200/347/221/260/345/217/276/346/265/240/346/240/255/356/227/223/351/217/215_txt +1 -0
  303. data/public/treport/plugins/heandlebars/handlebars-v4.0.5.js +4608 -0
  304. data/public/treport/plugins/jquery-ui/iframeTab.js +42 -0
  305. data/public/treport/plugins/jquery-ui/images/ui-icons_444444_256x240.png +0 -0
  306. data/public/treport/plugins/jquery-ui/images/ui-icons_555555_256x240.png +0 -0
  307. data/public/treport/plugins/jquery-ui/images/ui-icons_777620_256x240.png +0 -0
  308. data/public/treport/plugins/jquery-ui/images/ui-icons_777777_256x240.png +0 -0
  309. data/public/treport/plugins/jquery-ui/images/ui-icons_cc0000_256x240.png +0 -0
  310. data/public/treport/plugins/jquery-ui/images/ui-icons_ffffff_256x240.png +0 -0
  311. data/public/treport/plugins/jquery-ui/jquery-ui.css +1312 -0
  312. data/public/treport/plugins/jquery-ui/jquery-ui.js +18706 -0
  313. data/public/treport/plugins/layer/layer.js +2 -0
  314. data/public/treport/plugins/layer/mobile/layer.js +2 -0
  315. data/public/treport/plugins/layer/mobile/need/layer.css +1 -0
  316. data/public/treport/plugins/layer/skin/default/icon-ext.png +0 -0
  317. data/public/treport/plugins/layer/skin/default/icon.png +0 -0
  318. data/public/treport/plugins/layer/skin/default/layer.css +1 -0
  319. data/public/treport/plugins/layer/skin/default/loading-0.gif +0 -0
  320. data/public/treport/plugins/layer/skin/default/loading-1.gif +0 -0
  321. data/public/treport/plugins/layer/skin/default/loading-2.gif +0 -0
  322. data/public/treport/plugins/selectize/css/selectize.bootstrap2.css +494 -0
  323. data/public/treport/plugins/selectize/css/selectize.bootstrap3.css +408 -0
  324. data/public/treport/plugins/selectize/css/selectize.css +324 -0
  325. data/public/treport/plugins/selectize/css/selectize.default.css +394 -0
  326. data/public/treport/plugins/selectize/css/selectize.legacy.css +371 -0
  327. data/public/treport/plugins/selectize/js/selectize.js +3193 -0
  328. data/public/treport/plugins/selectize/js/selectize.min.js +3 -0
  329. data/public/treport/plugins/selectize/js/standalone/selectize.js +3829 -0
  330. data/public/treport/plugins/selectize/js/standalone/selectize.min.js +3 -0
  331. data/public/treport/plugins/selectize/less/plugins/drag_drop.less +16 -0
  332. data/public/treport/plugins/selectize/less/plugins/dropdown_header.less +20 -0
  333. data/public/treport/plugins/selectize/less/plugins/optgroup_columns.less +17 -0
  334. data/public/treport/plugins/selectize/less/plugins/remove_button.less +43 -0
  335. data/public/treport/plugins/selectize/less/selectize.bootstrap2.less +161 -0
  336. data/public/treport/plugins/selectize/less/selectize.bootstrap3.less +150 -0
  337. data/public/treport/plugins/selectize/less/selectize.default.less +84 -0
  338. data/public/treport/plugins/selectize/less/selectize.legacy.less +75 -0
  339. data/public/treport/plugins/selectize/less/selectize.less +296 -0
  340. data/public/treport/plugins/tools/tab_enter.js +30 -0
  341. data/public/treport/plugins/typeahead/typeahead.bundle.js +2451 -0
  342. data/public/treport/plugins/validationEngine/jquery.validationEngine-zh_CN.js +181 -0
  343. data/public/treport/plugins/validationEngine/jquery.validationEngine.js +2160 -0
  344. data/public/treport/plugins/validationEngine/template.css +125 -0
  345. data/public/treport/plugins/validationEngine/validationEngine.jquery.css +182 -0
  346. data/public/treport/plugins/zDialog/dialog.js +1313 -0
  347. data/public/treport/plugins/zDialog/drag.js +92 -0
  348. data/public/treport/plugins/zDialog/skins/blue/dialog_bg.jpg +0 -0
  349. data/public/treport/plugins/zDialog/skins/blue/dialog_cb.gif +0 -0
  350. data/public/treport/plugins/zDialog/skins/blue/dialog_cb.png +0 -0
  351. data/public/treport/plugins/zDialog/skins/blue/dialog_closebtn.gif +0 -0
  352. data/public/treport/plugins/zDialog/skins/blue/dialog_closebtn_over.gif +0 -0
  353. data/public/treport/plugins/zDialog/skins/blue/dialog_ct.gif +0 -0
  354. data/public/treport/plugins/zDialog/skins/blue/dialog_ct.png +0 -0
  355. data/public/treport/plugins/zDialog/skins/blue/dialog_lb.gif +0 -0
  356. data/public/treport/plugins/zDialog/skins/blue/dialog_lb.png +0 -0
  357. data/public/treport/plugins/zDialog/skins/blue/dialog_lt.gif +0 -0
  358. data/public/treport/plugins/zDialog/skins/blue/dialog_lt.png +0 -0
  359. data/public/treport/plugins/zDialog/skins/blue/dialog_mlm.gif +0 -0
  360. data/public/treport/plugins/zDialog/skins/blue/dialog_mlm.png +0 -0
  361. data/public/treport/plugins/zDialog/skins/blue/dialog_mrm.gif +0 -0
  362. data/public/treport/plugins/zDialog/skins/blue/dialog_mrm.png +0 -0
  363. data/public/treport/plugins/zDialog/skins/blue/dialog_rb.gif +0 -0
  364. data/public/treport/plugins/zDialog/skins/blue/dialog_rb.png +0 -0
  365. data/public/treport/plugins/zDialog/skins/blue/dialog_rt.gif +0 -0
  366. data/public/treport/plugins/zDialog/skins/blue/dialog_rt.png +0 -0
  367. data/public/treport/plugins/zDialog/skins/blue/dir.txt +24 -0
  368. data/public/treport/plugins/zDialog/skins/blue/icon_alert.gif +0 -0
  369. data/public/treport/plugins/zDialog/skins/blue/icon_dialog.gif +0 -0
  370. data/public/treport/plugins/zDialog/skins/blue/icon_query.gif +0 -0
  371. data/public/treport/plugins/zDialog/skins/blue/window.gif +0 -0
  372. data/public/treport/plugins/zDialog/skins/darkBlue/dialog_bg.jpg +0 -0
  373. data/public/treport/plugins/zDialog/skins/darkBlue/dialog_cb.gif +0 -0
  374. data/public/treport/plugins/zDialog/skins/darkBlue/dialog_cb.png +0 -0
  375. data/public/treport/plugins/zDialog/skins/darkBlue/dialog_closebtn.gif +0 -0
  376. data/public/treport/plugins/zDialog/skins/darkBlue/dialog_closebtn_over.gif +0 -0
  377. data/public/treport/plugins/zDialog/skins/darkBlue/dialog_ct.gif +0 -0
  378. data/public/treport/plugins/zDialog/skins/darkBlue/dialog_ct.png +0 -0
  379. data/public/treport/plugins/zDialog/skins/darkBlue/dialog_lb.gif +0 -0
  380. data/public/treport/plugins/zDialog/skins/darkBlue/dialog_lb.png +0 -0
  381. data/public/treport/plugins/zDialog/skins/darkBlue/dialog_lt.gif +0 -0
  382. data/public/treport/plugins/zDialog/skins/darkBlue/dialog_lt.png +0 -0
  383. data/public/treport/plugins/zDialog/skins/darkBlue/dialog_mlm.gif +0 -0
  384. data/public/treport/plugins/zDialog/skins/darkBlue/dialog_mlm.png +0 -0
  385. data/public/treport/plugins/zDialog/skins/darkBlue/dialog_mrm.gif +0 -0
  386. data/public/treport/plugins/zDialog/skins/darkBlue/dialog_mrm.png +0 -0
  387. data/public/treport/plugins/zDialog/skins/darkBlue/dialog_rb.gif +0 -0
  388. data/public/treport/plugins/zDialog/skins/darkBlue/dialog_rb.png +0 -0
  389. data/public/treport/plugins/zDialog/skins/darkBlue/dialog_rt.gif +0 -0
  390. data/public/treport/plugins/zDialog/skins/darkBlue/dialog_rt.png +0 -0
  391. data/public/treport/plugins/zDialog/skins/darkBlue/dir.txt +24 -0
  392. data/public/treport/plugins/zDialog/skins/darkBlue/icon_alert.gif +0 -0
  393. data/public/treport/plugins/zDialog/skins/darkBlue/icon_dialog.gif +0 -0
  394. data/public/treport/plugins/zDialog/skins/darkBlue/icon_query.gif +0 -0
  395. data/public/treport/plugins/zDialog/skins/darkBlue/window.gif +0 -0
  396. data/public/treport/plugins/zDialog/skins/darkYellow/dialog_bg.jpg +0 -0
  397. data/public/treport/plugins/zDialog/skins/darkYellow/dialog_cb.gif +0 -0
  398. data/public/treport/plugins/zDialog/skins/darkYellow/dialog_cb.png +0 -0
  399. data/public/treport/plugins/zDialog/skins/darkYellow/dialog_closebtn.gif +0 -0
  400. data/public/treport/plugins/zDialog/skins/darkYellow/dialog_closebtn_over.gif +0 -0
  401. data/public/treport/plugins/zDialog/skins/darkYellow/dialog_ct.gif +0 -0
  402. data/public/treport/plugins/zDialog/skins/darkYellow/dialog_ct.png +0 -0
  403. data/public/treport/plugins/zDialog/skins/darkYellow/dialog_lb.gif +0 -0
  404. data/public/treport/plugins/zDialog/skins/darkYellow/dialog_lb.png +0 -0
  405. data/public/treport/plugins/zDialog/skins/darkYellow/dialog_lt.gif +0 -0
  406. data/public/treport/plugins/zDialog/skins/darkYellow/dialog_lt.png +0 -0
  407. data/public/treport/plugins/zDialog/skins/darkYellow/dialog_mlm.gif +0 -0
  408. data/public/treport/plugins/zDialog/skins/darkYellow/dialog_mlm.png +0 -0
  409. data/public/treport/plugins/zDialog/skins/darkYellow/dialog_mrm.gif +0 -0
  410. data/public/treport/plugins/zDialog/skins/darkYellow/dialog_mrm.png +0 -0
  411. data/public/treport/plugins/zDialog/skins/darkYellow/dialog_rb.gif +0 -0
  412. data/public/treport/plugins/zDialog/skins/darkYellow/dialog_rb.png +0 -0
  413. data/public/treport/plugins/zDialog/skins/darkYellow/dialog_rt.gif +0 -0
  414. data/public/treport/plugins/zDialog/skins/darkYellow/dialog_rt.png +0 -0
  415. data/public/treport/plugins/zDialog/skins/darkYellow/dir.txt +24 -0
  416. data/public/treport/plugins/zDialog/skins/darkYellow/icon_alert.gif +0 -0
  417. data/public/treport/plugins/zDialog/skins/darkYellow/icon_dialog.gif +0 -0
  418. data/public/treport/plugins/zDialog/skins/darkYellow/icon_query.gif +0 -0
  419. data/public/treport/plugins/zDialog/skins/darkYellow/window.gif +0 -0
  420. data/public/treport/plugins/zDialog/skins/green/dialog_bg.jpg +0 -0
  421. data/public/treport/plugins/zDialog/skins/green/dialog_cb.gif +0 -0
  422. data/public/treport/plugins/zDialog/skins/green/dialog_cb.png +0 -0
  423. data/public/treport/plugins/zDialog/skins/green/dialog_closebtn.gif +0 -0
  424. data/public/treport/plugins/zDialog/skins/green/dialog_closebtn_over.gif +0 -0
  425. data/public/treport/plugins/zDialog/skins/green/dialog_ct.gif +0 -0
  426. data/public/treport/plugins/zDialog/skins/green/dialog_ct.png +0 -0
  427. data/public/treport/plugins/zDialog/skins/green/dialog_lb.gif +0 -0
  428. data/public/treport/plugins/zDialog/skins/green/dialog_lb.png +0 -0
  429. data/public/treport/plugins/zDialog/skins/green/dialog_lt.gif +0 -0
  430. data/public/treport/plugins/zDialog/skins/green/dialog_lt.png +0 -0
  431. data/public/treport/plugins/zDialog/skins/green/dialog_mlm.gif +0 -0
  432. data/public/treport/plugins/zDialog/skins/green/dialog_mlm.png +0 -0
  433. data/public/treport/plugins/zDialog/skins/green/dialog_mrm.gif +0 -0
  434. data/public/treport/plugins/zDialog/skins/green/dialog_mrm.png +0 -0
  435. data/public/treport/plugins/zDialog/skins/green/dialog_rb.gif +0 -0
  436. data/public/treport/plugins/zDialog/skins/green/dialog_rb.png +0 -0
  437. data/public/treport/plugins/zDialog/skins/green/dialog_rt.gif +0 -0
  438. data/public/treport/plugins/zDialog/skins/green/dialog_rt.png +0 -0
  439. data/public/treport/plugins/zDialog/skins/green/dir.txt +24 -0
  440. data/public/treport/plugins/zDialog/skins/green/icon_alert.gif +0 -0
  441. data/public/treport/plugins/zDialog/skins/green/icon_dialog.gif +0 -0
  442. data/public/treport/plugins/zDialog/skins/green/icon_query.gif +0 -0
  443. data/public/treport/plugins/zDialog/skins/green/window.gif +0 -0
  444. data/public/treport/plugins/zDialog/skins/lightBlue/dialog_bg.jpg +0 -0
  445. data/public/treport/plugins/zDialog/skins/lightBlue/dialog_cb.gif +0 -0
  446. data/public/treport/plugins/zDialog/skins/lightBlue/dialog_cb.png +0 -0
  447. data/public/treport/plugins/zDialog/skins/lightBlue/dialog_closebtn.gif +0 -0
  448. data/public/treport/plugins/zDialog/skins/lightBlue/dialog_closebtn_over.gif +0 -0
  449. data/public/treport/plugins/zDialog/skins/lightBlue/dialog_ct.gif +0 -0
  450. data/public/treport/plugins/zDialog/skins/lightBlue/dialog_ct.png +0 -0
  451. data/public/treport/plugins/zDialog/skins/lightBlue/dialog_lb.gif +0 -0
  452. data/public/treport/plugins/zDialog/skins/lightBlue/dialog_lb.png +0 -0
  453. data/public/treport/plugins/zDialog/skins/lightBlue/dialog_lt.gif +0 -0
  454. data/public/treport/plugins/zDialog/skins/lightBlue/dialog_lt.png +0 -0
  455. data/public/treport/plugins/zDialog/skins/lightBlue/dialog_mlm.gif +0 -0
  456. data/public/treport/plugins/zDialog/skins/lightBlue/dialog_mlm.png +0 -0
  457. data/public/treport/plugins/zDialog/skins/lightBlue/dialog_mrm.gif +0 -0
  458. data/public/treport/plugins/zDialog/skins/lightBlue/dialog_mrm.png +0 -0
  459. data/public/treport/plugins/zDialog/skins/lightBlue/dialog_rb.gif +0 -0
  460. data/public/treport/plugins/zDialog/skins/lightBlue/dialog_rb.png +0 -0
  461. data/public/treport/plugins/zDialog/skins/lightBlue/dialog_rt.gif +0 -0
  462. data/public/treport/plugins/zDialog/skins/lightBlue/dialog_rt.png +0 -0
  463. data/public/treport/plugins/zDialog/skins/lightBlue/dir.txt +24 -0
  464. data/public/treport/plugins/zDialog/skins/lightBlue/icon_alert.gif +0 -0
  465. data/public/treport/plugins/zDialog/skins/lightBlue/icon_dialog.gif +0 -0
  466. data/public/treport/plugins/zDialog/skins/lightBlue/icon_query.gif +0 -0
  467. data/public/treport/plugins/zDialog/skins/lightBlue/window.gif +0 -0
  468. data/public/treport/plugins/zDialog/skins/orange/dialog_bg.jpg +0 -0
  469. data/public/treport/plugins/zDialog/skins/orange/dialog_cb.gif +0 -0
  470. data/public/treport/plugins/zDialog/skins/orange/dialog_cb.png +0 -0
  471. data/public/treport/plugins/zDialog/skins/orange/dialog_closebtn.gif +0 -0
  472. data/public/treport/plugins/zDialog/skins/orange/dialog_closebtn_over.gif +0 -0
  473. data/public/treport/plugins/zDialog/skins/orange/dialog_ct.gif +0 -0
  474. data/public/treport/plugins/zDialog/skins/orange/dialog_ct.png +0 -0
  475. data/public/treport/plugins/zDialog/skins/orange/dialog_decreasebtn.gif +0 -0
  476. data/public/treport/plugins/zDialog/skins/orange/dialog_lb.gif +0 -0
  477. data/public/treport/plugins/zDialog/skins/orange/dialog_lb.png +0 -0
  478. data/public/treport/plugins/zDialog/skins/orange/dialog_lt.gif +0 -0
  479. data/public/treport/plugins/zDialog/skins/orange/dialog_lt.png +0 -0
  480. data/public/treport/plugins/zDialog/skins/orange/dialog_maxbtn.gif +0 -0
  481. data/public/treport/plugins/zDialog/skins/orange/dialog_minbtn.gif +0 -0
  482. data/public/treport/plugins/zDialog/skins/orange/dialog_mlm.gif +0 -0
  483. data/public/treport/plugins/zDialog/skins/orange/dialog_mlm.png +0 -0
  484. data/public/treport/plugins/zDialog/skins/orange/dialog_mrm.gif +0 -0
  485. data/public/treport/plugins/zDialog/skins/orange/dialog_mrm.png +0 -0
  486. data/public/treport/plugins/zDialog/skins/orange/dialog_rb.gif +0 -0
  487. data/public/treport/plugins/zDialog/skins/orange/dialog_rb.png +0 -0
  488. data/public/treport/plugins/zDialog/skins/orange/dialog_rt.gif +0 -0
  489. data/public/treport/plugins/zDialog/skins/orange/dialog_rt.png +0 -0
  490. data/public/treport/plugins/zDialog/skins/orange/icon_alert.gif +0 -0
  491. data/public/treport/plugins/zDialog/skins/orange/icon_dialog.gif +0 -0
  492. data/public/treport/plugins/zDialog/skins/orange/icon_dialog.png +0 -0
  493. data/public/treport/plugins/zDialog/skins/orange/icon_query.gif +0 -0
  494. data/public/treport/plugins/zDialog/skins/orange/item_leftBtn.gif +0 -0
  495. data/public/treport/plugins/zDialog/skins/orange/item_rightBtn.gif +0 -0
  496. data/public/treport/plugins/zDialog/skins/orange/shadow_cb.gif +0 -0
  497. data/public/treport/plugins/zDialog/skins/orange/shadow_cb.png +0 -0
  498. data/public/treport/plugins/zDialog/skins/orange/shadow_ct.gif +0 -0
  499. data/public/treport/plugins/zDialog/skins/orange/shadow_lb.gif +0 -0
  500. data/public/treport/plugins/zDialog/skins/orange/shadow_lb.png +0 -0
  501. data/public/treport/plugins/zDialog/skins/orange/shadow_lm.gif +0 -0
  502. data/public/treport/plugins/zDialog/skins/orange/shadow_lt.gif +0 -0
  503. data/public/treport/plugins/zDialog/skins/orange/shadow_rb.gif +0 -0
  504. data/public/treport/plugins/zDialog/skins/orange/shadow_rb.png +0 -0
  505. data/public/treport/plugins/zDialog/skins/orange/shadow_rm.gif +0 -0
  506. data/public/treport/plugins/zDialog/skins/orange/shadow_rt.gif +0 -0
  507. data/public/treport/plugins/zDialog/skins/orange/simple_bottomLine.gif +0 -0
  508. data/public/treport/plugins/zDialog/skins/orange/simple_close.gif +0 -0
  509. data/public/treport/plugins/zDialog/skins/orange/simple_tip.gif +0 -0
  510. data/public/treport/plugins/zDialog/skins/orange/simple_tip.png +0 -0
  511. data/public/treport/plugins/zDialog/skins/orange/taskBar.jpg +0 -0
  512. data/public/treport/plugins/zDialog/skins/orange/taskItemLeft.jpg +0 -0
  513. data/public/treport/plugins/zDialog/skins/orange/taskItemLeftCurrent.jpg +0 -0
  514. data/public/treport/plugins/zDialog/skins/orange/taskItemRight.jpg +0 -0
  515. data/public/treport/plugins/zDialog/skins/orange/taskItemRightCurrent.jpg +0 -0
  516. data/public/treport/plugins/zDialog/skins/orange/trans.gif +0 -0
  517. data/public/treport/plugins/zDialog/skins/orange/window.gif +0 -0
  518. data/public/treport/plugins/zDialog/skins/red/dialog_bg.jpg +0 -0
  519. data/public/treport/plugins/zDialog/skins/red/dialog_cb.gif +0 -0
  520. data/public/treport/plugins/zDialog/skins/red/dialog_cb.png +0 -0
  521. data/public/treport/plugins/zDialog/skins/red/dialog_closebtn.gif +0 -0
  522. data/public/treport/plugins/zDialog/skins/red/dialog_closebtn_over.gif +0 -0
  523. data/public/treport/plugins/zDialog/skins/red/dialog_ct.gif +0 -0
  524. data/public/treport/plugins/zDialog/skins/red/dialog_ct.png +0 -0
  525. data/public/treport/plugins/zDialog/skins/red/dialog_lb.gif +0 -0
  526. data/public/treport/plugins/zDialog/skins/red/dialog_lb.png +0 -0
  527. data/public/treport/plugins/zDialog/skins/red/dialog_lt.gif +0 -0
  528. data/public/treport/plugins/zDialog/skins/red/dialog_lt.png +0 -0
  529. data/public/treport/plugins/zDialog/skins/red/dialog_mlm.gif +0 -0
  530. data/public/treport/plugins/zDialog/skins/red/dialog_mlm.png +0 -0
  531. data/public/treport/plugins/zDialog/skins/red/dialog_mrm.gif +0 -0
  532. data/public/treport/plugins/zDialog/skins/red/dialog_mrm.png +0 -0
  533. data/public/treport/plugins/zDialog/skins/red/dialog_rb.gif +0 -0
  534. data/public/treport/plugins/zDialog/skins/red/dialog_rb.png +0 -0
  535. data/public/treport/plugins/zDialog/skins/red/dialog_rt.gif +0 -0
  536. data/public/treport/plugins/zDialog/skins/red/dialog_rt.png +0 -0
  537. data/public/treport/plugins/zDialog/skins/red/dir.txt +24 -0
  538. data/public/treport/plugins/zDialog/skins/red/icon_alert.gif +0 -0
  539. data/public/treport/plugins/zDialog/skins/red/icon_dialog.gif +0 -0
  540. data/public/treport/plugins/zDialog/skins/red/icon_query.gif +0 -0
  541. data/public/treport/plugins/zDialog/skins/red/window.gif +0 -0
  542. data/public/treport/plugins/zDialog/skins/yellowGreen/dialog_bg.jpg +0 -0
  543. data/public/treport/plugins/zDialog/skins/yellowGreen/dialog_cb.gif +0 -0
  544. data/public/treport/plugins/zDialog/skins/yellowGreen/dialog_cb.png +0 -0
  545. data/public/treport/plugins/zDialog/skins/yellowGreen/dialog_closebtn.gif +0 -0
  546. data/public/treport/plugins/zDialog/skins/yellowGreen/dialog_closebtn_over.gif +0 -0
  547. data/public/treport/plugins/zDialog/skins/yellowGreen/dialog_ct.gif +0 -0
  548. data/public/treport/plugins/zDialog/skins/yellowGreen/dialog_ct.png +0 -0
  549. data/public/treport/plugins/zDialog/skins/yellowGreen/dialog_lb.gif +0 -0
  550. data/public/treport/plugins/zDialog/skins/yellowGreen/dialog_lb.png +0 -0
  551. data/public/treport/plugins/zDialog/skins/yellowGreen/dialog_lt.gif +0 -0
  552. data/public/treport/plugins/zDialog/skins/yellowGreen/dialog_lt.png +0 -0
  553. data/public/treport/plugins/zDialog/skins/yellowGreen/dialog_mlm.gif +0 -0
  554. data/public/treport/plugins/zDialog/skins/yellowGreen/dialog_mlm.png +0 -0
  555. data/public/treport/plugins/zDialog/skins/yellowGreen/dialog_mrm.gif +0 -0
  556. data/public/treport/plugins/zDialog/skins/yellowGreen/dialog_mrm.png +0 -0
  557. data/public/treport/plugins/zDialog/skins/yellowGreen/dialog_rb.gif +0 -0
  558. data/public/treport/plugins/zDialog/skins/yellowGreen/dialog_rb.png +0 -0
  559. data/public/treport/plugins/zDialog/skins/yellowGreen/dialog_rt.gif +0 -0
  560. data/public/treport/plugins/zDialog/skins/yellowGreen/dialog_rt.png +0 -0
  561. data/public/treport/plugins/zDialog/skins/yellowGreen/dir.txt +24 -0
  562. data/public/treport/plugins/zDialog/skins/yellowGreen/icon_alert.gif +0 -0
  563. data/public/treport/plugins/zDialog/skins/yellowGreen/icon_dialog.gif +0 -0
  564. data/public/treport/plugins/zDialog/skins/yellowGreen/icon_query.gif +0 -0
  565. data/public/treport/plugins/zDialog/skins/yellowGreen/window.gif +0 -0
  566. data/public/treport/plugins/zDialog/zDialog.js +764 -0
  567. data/public/treport/plugins/zDialog/zDrag.js +1 -0
  568. data/public/treport/src-noconflict/ace.js +18673 -0
  569. data/public/treport/src-noconflict/ext-beautify.js +334 -0
  570. data/public/treport/src-noconflict/ext-chromevox.js +540 -0
  571. data/public/treport/src-noconflict/ext-elastic_tabstops_lite.js +274 -0
  572. data/public/treport/src-noconflict/ext-emmet.js +1218 -0
  573. data/public/treport/src-noconflict/ext-error_marker.js +6 -0
  574. data/public/treport/src-noconflict/ext-keybinding_menu.js +170 -0
  575. data/public/treport/src-noconflict/ext-language_tools.js +1938 -0
  576. data/public/treport/src-noconflict/ext-linking.js +52 -0
  577. data/public/treport/src-noconflict/ext-modelist.js +201 -0
  578. data/public/treport/src-noconflict/ext-old_ie.js +501 -0
  579. data/public/treport/src-noconflict/ext-searchbox.js +416 -0
  580. data/public/treport/src-noconflict/ext-settings_menu.js +653 -0
  581. data/public/treport/src-noconflict/ext-spellcheck.js +71 -0
  582. data/public/treport/src-noconflict/ext-split.js +246 -0
  583. data/public/treport/src-noconflict/ext-static_highlight.js +161 -0
  584. data/public/treport/src-noconflict/ext-statusbar.js +53 -0
  585. data/public/treport/src-noconflict/ext-textarea.js +559 -0
  586. data/public/treport/src-noconflict/ext-themelist.js +60 -0
  587. data/public/treport/src-noconflict/ext-whitespace.js +185 -0
  588. data/public/treport/src-noconflict/keybinding-emacs.js +1181 -0
  589. data/public/treport/src-noconflict/keybinding-vim.js +5580 -0
  590. data/public/treport/src-noconflict/mode-abap.js +214 -0
  591. data/public/treport/src-noconflict/mode-abc.js +260 -0
  592. data/public/treport/src-noconflict/mode-actionscript.js +266 -0
  593. data/public/treport/src-noconflict/mode-ada.js +87 -0
  594. data/public/treport/src-noconflict/mode-apache_conf.js +355 -0
  595. data/public/treport/src-noconflict/mode-applescript.js +271 -0
  596. data/public/treport/src-noconflict/mode-asciidoc.js +342 -0
  597. data/public/treport/src-noconflict/mode-assembly_x86.js +185 -0
  598. data/public/treport/src-noconflict/mode-autohotkey.js +234 -0
  599. data/public/treport/src-noconflict/mode-batchfile.js +222 -0
  600. data/public/treport/src-noconflict/mode-c9search.js +275 -0
  601. data/public/treport/src-noconflict/mode-c_cpp.js +845 -0
  602. data/public/treport/src-noconflict/mode-cirru.js +202 -0
  603. data/public/treport/src-noconflict/mode-clojure.js +306 -0
  604. data/public/treport/src-noconflict/mode-cobol.js +94 -0
  605. data/public/treport/src-noconflict/mode-coffee.js +393 -0
  606. data/public/treport/src-noconflict/mode-coldfusion.js +2867 -0
  607. data/public/treport/src-noconflict/mode-csharp.js +853 -0
  608. data/public/treport/src-noconflict/mode-css.js +1008 -0
  609. data/public/treport/src-noconflict/mode-curly.js +2836 -0
  610. data/public/treport/src-noconflict/mode-d.js +512 -0
  611. data/public/treport/src-noconflict/mode-dart.js +1049 -0
  612. data/public/treport/src-noconflict/mode-diff.js +139 -0
  613. data/public/treport/src-noconflict/mode-django.js +2870 -0
  614. data/public/treport/src-noconflict/mode-dockerfile.js +849 -0
  615. data/public/treport/src-noconflict/mode-dot.js +412 -0
  616. data/public/treport/src-noconflict/mode-eiffel.js +128 -0
  617. data/public/treport/src-noconflict/mode-ejs.js +3294 -0
  618. data/public/treport/src-noconflict/mode-elixir.js +493 -0
  619. data/public/treport/src-noconflict/mode-elm.js +296 -0
  620. data/public/treport/src-noconflict/mode-erlang.js +1001 -0
  621. data/public/treport/src-noconflict/mode-forth.js +289 -0
  622. data/public/treport/src-noconflict/mode-ftl.js +1137 -0
  623. data/public/treport/src-noconflict/mode-gcode.js +85 -0
  624. data/public/treport/src-noconflict/mode-gherkin.js +162 -0
  625. data/public/treport/src-noconflict/mode-gitignore.js +51 -0
  626. data/public/treport/src-noconflict/mode-glsl.js +922 -0
  627. data/public/treport/src-noconflict/mode-gobstones.js +1273 -0
  628. data/public/treport/src-noconflict/mode-golang.js +763 -0
  629. data/public/treport/src-noconflict/mode-groovy.js +1332 -0
  630. data/public/treport/src-noconflict/mode-haml.js +1482 -0
  631. data/public/treport/src-noconflict/mode-handlebars.js +2895 -0
  632. data/public/treport/src-noconflict/mode-haskell.js +371 -0
  633. data/public/treport/src-noconflict/mode-haxe.js +737 -0
  634. data/public/treport/src-noconflict/mode-html.js +2780 -0
  635. data/public/treport/src-noconflict/mode-html_elixir.js +3358 -0
  636. data/public/treport/src-noconflict/mode-html_ruby.js +3311 -0
  637. data/public/treport/src-noconflict/mode-ini.js +154 -0
  638. data/public/treport/src-noconflict/mode-io.js +246 -0
  639. data/public/treport/src-noconflict/mode-jack.js +696 -0
  640. data/public/treport/src-noconflict/mode-jade.js +2066 -0
  641. data/public/treport/src-noconflict/mode-java.js +1287 -0
  642. data/public/treport/src-noconflict/mode-javascript.js +1140 -0
  643. data/public/treport/src-noconflict/mode-json.js +668 -0
  644. data/public/treport/src-noconflict/mode-jsoniq.js +2956 -0
  645. data/public/treport/src-noconflict/mode-jsp.js +1701 -0
  646. data/public/treport/src-noconflict/mode-jsx.js +762 -0
  647. data/public/treport/src-noconflict/mode-julia.js +295 -0
  648. data/public/treport/src-noconflict/mode-latex.js +223 -0
  649. data/public/treport/src-noconflict/mode-lean.js +281 -0
  650. data/public/treport/src-noconflict/mode-less.js +1129 -0
  651. data/public/treport/src-noconflict/mode-liquid.js +1139 -0
  652. data/public/treport/src-noconflict/mode-lisp.js +104 -0
  653. data/public/treport/src-noconflict/mode-live_script.js +481 -0
  654. data/public/treport/src-noconflict/mode-livescript.js +271 -0
  655. data/public/treport/src-noconflict/mode-logiql.js +667 -0
  656. data/public/treport/src-noconflict/mode-lsl.js +692 -0
  657. data/public/treport/src-noconflict/mode-lua.js +423 -0
  658. data/public/treport/src-noconflict/mode-luapage.js +3277 -0
  659. data/public/treport/src-noconflict/mode-lucene.js +69 -0
  660. data/public/treport/src-noconflict/mode-makefile.js +403 -0
  661. data/public/treport/src-noconflict/mode-markdown.js +3165 -0
  662. data/public/treport/src-noconflict/mode-mask.js +2099 -0
  663. data/public/treport/src-noconflict/mode-matlab.js +256 -0
  664. data/public/treport/src-noconflict/mode-mavens_mate_log.js +160 -0
  665. data/public/treport/src-noconflict/mode-maze.js +283 -0
  666. data/public/treport/src-noconflict/mode-mel.js +613 -0
  667. data/public/treport/src-noconflict/mode-mips_assembler.js +235 -0
  668. data/public/treport/src-noconflict/mode-mipsassembler.js +196 -0
  669. data/public/treport/src-noconflict/mode-mushcode.js +673 -0
  670. data/public/treport/src-noconflict/mode-mysql.js +160 -0
  671. data/public/treport/src-noconflict/mode-nix.js +989 -0
  672. data/public/treport/src-noconflict/mode-nsis.js +304 -0
  673. data/public/treport/src-noconflict/mode-objectivec.js +726 -0
  674. data/public/treport/src-noconflict/mode-ocaml.js +414 -0
  675. data/public/treport/src-noconflict/mode-pascal.js +197 -0
  676. data/public/treport/src-noconflict/mode-perl.js +373 -0
  677. data/public/treport/src-noconflict/mode-pgsql.js +1489 -0
  678. data/public/treport/src-noconflict/mode-php.js +13328 -0
  679. data/public/treport/src-noconflict/mode-plain_text.js +25 -0
  680. data/public/treport/src-noconflict/mode-powershell.js +768 -0
  681. data/public/treport/src-noconflict/mode-praat.js +468 -0
  682. data/public/treport/src-noconflict/mode-prolog.js +363 -0
  683. data/public/treport/src-noconflict/mode-properties.js +72 -0
  684. data/public/treport/src-noconflict/mode-protobuf.js +936 -0
  685. data/public/treport/src-noconflict/mode-python.js +264 -0
  686. data/public/treport/src-noconflict/mode-r.js +302 -0
  687. data/public/treport/src-noconflict/mode-razor.js +3136 -0
  688. data/public/treport/src-noconflict/mode-rdoc.js +205 -0
  689. data/public/treport/src-noconflict/mode-rhtml.js +3079 -0
  690. data/public/treport/src-noconflict/mode-rst.js +249 -0
  691. data/public/treport/src-noconflict/mode-ruby.js +843 -0
  692. data/public/treport/src-noconflict/mode-rust.js +270 -0
  693. data/public/treport/src-noconflict/mode-sass.js +412 -0
  694. data/public/treport/src-noconflict/mode-scad.js +766 -0
  695. data/public/treport/src-noconflict/mode-scala.js +1329 -0
  696. data/public/treport/src-noconflict/mode-scheme.js +224 -0
  697. data/public/treport/src-noconflict/mode-scss.js +922 -0
  698. data/public/treport/src-noconflict/mode-sh.js +798 -0
  699. data/public/treport/src-noconflict/mode-sjs.js +1357 -0
  700. data/public/treport/src-noconflict/mode-smarty.js +2906 -0
  701. data/public/treport/src-noconflict/mode-snippets.js +198 -0
  702. data/public/treport/src-noconflict/mode-soy_template.js +3119 -0
  703. data/public/treport/src-noconflict/mode-space.js +159 -0
  704. data/public/treport/src-noconflict/mode-sql.js +100 -0
  705. data/public/treport/src-noconflict/mode-sqlserver.js +437 -0
  706. data/public/treport/src-noconflict/mode-stylus.js +414 -0
  707. data/public/treport/src-noconflict/mode-svg.js +1916 -0
  708. data/public/treport/src-noconflict/mode-swift.js +738 -0
  709. data/public/treport/src-noconflict/mode-swig.js +1099 -0
  710. data/public/treport/src-noconflict/mode-tcl.js +375 -0
  711. data/public/treport/src-noconflict/mode-tex.js +151 -0
  712. data/public/treport/src-noconflict/mode-text.js +1 -0
  713. data/public/treport/src-noconflict/mode-textile.js +141 -0
  714. data/public/treport/src-noconflict/mode-toml.js +145 -0
  715. data/public/treport/src-noconflict/mode-twig.js +2964 -0
  716. data/public/treport/src-noconflict/mode-typescript.js +1223 -0
  717. data/public/treport/src-noconflict/mode-vala.js +1026 -0
  718. data/public/treport/src-noconflict/mode-vbscript.js +226 -0
  719. data/public/treport/src-noconflict/mode-velocity.js +3062 -0
  720. data/public/treport/src-noconflict/mode-verilog.js +103 -0
  721. data/public/treport/src-noconflict/mode-vhdl.js +110 -0
  722. data/public/treport/src-noconflict/mode-wollok.js +1256 -0
  723. data/public/treport/src-noconflict/mode-xml.js +661 -0
  724. data/public/treport/src-noconflict/mode-xquery.js +2968 -0
  725. data/public/treport/src-noconflict/mode-yaml.js +256 -0
  726. data/public/treport/src-noconflict/snippets/abap.js +7 -0
  727. data/public/treport/src-noconflict/snippets/abc.js +38 -0
  728. data/public/treport/src-noconflict/snippets/actionscript.js +164 -0
  729. data/public/treport/src-noconflict/snippets/ada.js +7 -0
  730. data/public/treport/src-noconflict/snippets/apache_conf.js +7 -0
  731. data/public/treport/src-noconflict/snippets/applescript.js +7 -0
  732. data/public/treport/src-noconflict/snippets/asciidoc.js +7 -0
  733. data/public/treport/src-noconflict/snippets/assembly_x86.js +7 -0
  734. data/public/treport/src-noconflict/snippets/autohotkey.js +7 -0
  735. data/public/treport/src-noconflict/snippets/batchfile.js +7 -0
  736. data/public/treport/src-noconflict/snippets/c9search.js +7 -0
  737. data/public/treport/src-noconflict/snippets/c_cpp.js +138 -0
  738. data/public/treport/src-noconflict/snippets/cirru.js +7 -0
  739. data/public/treport/src-noconflict/snippets/clojure.js +97 -0
  740. data/public/treport/src-noconflict/snippets/cobol.js +7 -0
  741. data/public/treport/src-noconflict/snippets/coffee.js +102 -0
  742. data/public/treport/src-noconflict/snippets/coldfusion.js +7 -0
  743. data/public/treport/src-noconflict/snippets/csharp.js +7 -0
  744. data/public/treport/src-noconflict/snippets/css.js +974 -0
  745. data/public/treport/src-noconflict/snippets/curly.js +7 -0
  746. data/public/treport/src-noconflict/snippets/d.js +7 -0
  747. data/public/treport/src-noconflict/snippets/dart.js +90 -0
  748. data/public/treport/src-noconflict/snippets/diff.js +18 -0
  749. data/public/treport/src-noconflict/snippets/django.js +115 -0
  750. data/public/treport/src-noconflict/snippets/dockerfile.js +7 -0
  751. data/public/treport/src-noconflict/snippets/dot.js +7 -0
  752. data/public/treport/src-noconflict/snippets/eiffel.js +7 -0
  753. data/public/treport/src-noconflict/snippets/ejs.js +7 -0
  754. data/public/treport/src-noconflict/snippets/elixir.js +7 -0
  755. data/public/treport/src-noconflict/snippets/elm.js +7 -0
  756. data/public/treport/src-noconflict/snippets/erlang.js +167 -0
  757. data/public/treport/src-noconflict/snippets/forth.js +7 -0
  758. data/public/treport/src-noconflict/snippets/ftl.js +7 -0
  759. data/public/treport/src-noconflict/snippets/gcode.js +7 -0
  760. data/public/treport/src-noconflict/snippets/gherkin.js +7 -0
  761. data/public/treport/src-noconflict/snippets/gitignore.js +7 -0
  762. data/public/treport/src-noconflict/snippets/glsl.js +7 -0
  763. data/public/treport/src-noconflict/snippets/gobstones.js +41 -0
  764. data/public/treport/src-noconflict/snippets/golang.js +7 -0
  765. data/public/treport/src-noconflict/snippets/groovy.js +7 -0
  766. data/public/treport/src-noconflict/snippets/haml.js +27 -0
  767. data/public/treport/src-noconflict/snippets/handlebars.js +7 -0
  768. data/public/treport/src-noconflict/snippets/haskell.js +89 -0
  769. data/public/treport/src-noconflict/snippets/haxe.js +7 -0
  770. data/public/treport/src-noconflict/snippets/html.js +835 -0
  771. data/public/treport/src-noconflict/snippets/html_elixir.js +7 -0
  772. data/public/treport/src-noconflict/snippets/html_ruby.js +7 -0
  773. data/public/treport/src-noconflict/snippets/ini.js +7 -0
  774. data/public/treport/src-noconflict/snippets/io.js +69 -0
  775. data/public/treport/src-noconflict/snippets/jack.js +7 -0
  776. data/public/treport/src-noconflict/snippets/jade.js +7 -0
  777. data/public/treport/src-noconflict/snippets/java.js +247 -0
  778. data/public/treport/src-noconflict/snippets/javascript.js +202 -0
  779. data/public/treport/src-noconflict/snippets/json.js +7 -0
  780. data/public/treport/src-noconflict/snippets/jsoniq.js +68 -0
  781. data/public/treport/src-noconflict/snippets/jsp.js +106 -0
  782. data/public/treport/src-noconflict/snippets/jsx.js +7 -0
  783. data/public/treport/src-noconflict/snippets/julia.js +7 -0
  784. data/public/treport/src-noconflict/snippets/latex.js +7 -0
  785. data/public/treport/src-noconflict/snippets/lean.js +7 -0
  786. data/public/treport/src-noconflict/snippets/less.js +7 -0
  787. data/public/treport/src-noconflict/snippets/liquid.js +7 -0
  788. data/public/treport/src-noconflict/snippets/lisp.js +7 -0
  789. data/public/treport/src-noconflict/snippets/live_script.js +7 -0
  790. data/public/treport/src-noconflict/snippets/livescript.js +7 -0
  791. data/public/treport/src-noconflict/snippets/logiql.js +7 -0
  792. data/public/treport/src-noconflict/snippets/lsl.js +1239 -0
  793. data/public/treport/src-noconflict/snippets/lua.js +28 -0
  794. data/public/treport/src-noconflict/snippets/luapage.js +7 -0
  795. data/public/treport/src-noconflict/snippets/lucene.js +7 -0
  796. data/public/treport/src-noconflict/snippets/makefile.js +11 -0
  797. data/public/treport/src-noconflict/snippets/markdown.js +95 -0
  798. data/public/treport/src-noconflict/snippets/mask.js +7 -0
  799. data/public/treport/src-noconflict/snippets/matlab.js +7 -0
  800. data/public/treport/src-noconflict/snippets/maze.js +16 -0
  801. data/public/treport/src-noconflict/snippets/mel.js +7 -0
  802. data/public/treport/src-noconflict/snippets/mips_assembler.js +7 -0
  803. data/public/treport/src-noconflict/snippets/mipsassembler.js +7 -0
  804. data/public/treport/src-noconflict/snippets/mushcode.js +7 -0
  805. data/public/treport/src-noconflict/snippets/mysql.js +7 -0
  806. data/public/treport/src-noconflict/snippets/nix.js +7 -0
  807. data/public/treport/src-noconflict/snippets/nsis.js +7 -0
  808. data/public/treport/src-noconflict/snippets/objectivec.js +7 -0
  809. data/public/treport/src-noconflict/snippets/ocaml.js +7 -0
  810. data/public/treport/src-noconflict/snippets/pascal.js +7 -0
  811. data/public/treport/src-noconflict/snippets/perl.js +354 -0
  812. data/public/treport/src-noconflict/snippets/pgsql.js +7 -0
  813. data/public/treport/src-noconflict/snippets/php.js +384 -0
  814. data/public/treport/src-noconflict/snippets/plain_text.js +7 -0
  815. data/public/treport/src-noconflict/snippets/powershell.js +7 -0
  816. data/public/treport/src-noconflict/snippets/praat.js +7 -0
  817. data/public/treport/src-noconflict/snippets/prolog.js +7 -0
  818. data/public/treport/src-noconflict/snippets/properties.js +7 -0
  819. data/public/treport/src-noconflict/snippets/protobuf.js +7 -0
  820. data/public/treport/src-noconflict/snippets/python.js +165 -0
  821. data/public/treport/src-noconflict/snippets/r.js +128 -0
  822. data/public/treport/src-noconflict/snippets/razor.js +10 -0
  823. data/public/treport/src-noconflict/snippets/rdoc.js +7 -0
  824. data/public/treport/src-noconflict/snippets/rhtml.js +7 -0
  825. data/public/treport/src-noconflict/snippets/rst.js +7 -0
  826. data/public/treport/src-noconflict/snippets/ruby.js +935 -0
  827. data/public/treport/src-noconflict/snippets/rust.js +7 -0
  828. data/public/treport/src-noconflict/snippets/sass.js +7 -0
  829. data/public/treport/src-noconflict/snippets/scad.js +7 -0
  830. data/public/treport/src-noconflict/snippets/scala.js +7 -0
  831. data/public/treport/src-noconflict/snippets/scheme.js +7 -0
  832. data/public/treport/src-noconflict/snippets/scss.js +7 -0
  833. data/public/treport/src-noconflict/snippets/sh.js +90 -0
  834. data/public/treport/src-noconflict/snippets/sjs.js +7 -0
  835. data/public/treport/src-noconflict/snippets/smarty.js +7 -0
  836. data/public/treport/src-noconflict/snippets/snippets.js +16 -0
  837. data/public/treport/src-noconflict/snippets/soy_template.js +7 -0
  838. data/public/treport/src-noconflict/snippets/space.js +7 -0
  839. data/public/treport/src-noconflict/snippets/sql.js +33 -0
  840. data/public/treport/src-noconflict/snippets/sqlserver.js +76 -0
  841. data/public/treport/src-noconflict/snippets/stylus.js +7 -0
  842. data/public/treport/src-noconflict/snippets/svg.js +7 -0
  843. data/public/treport/src-noconflict/snippets/swift.js +7 -0
  844. data/public/treport/src-noconflict/snippets/swig.js +7 -0
  845. data/public/treport/src-noconflict/snippets/tcl.js +99 -0
  846. data/public/treport/src-noconflict/snippets/tex.js +197 -0
  847. data/public/treport/src-noconflict/snippets/text.js +7 -0
  848. data/public/treport/src-noconflict/snippets/textile.js +37 -0
  849. data/public/treport/src-noconflict/snippets/toml.js +7 -0
  850. data/public/treport/src-noconflict/snippets/twig.js +7 -0
  851. data/public/treport/src-noconflict/snippets/typescript.js +7 -0
  852. data/public/treport/src-noconflict/snippets/vala.js +193 -0
  853. data/public/treport/src-noconflict/snippets/vbscript.js +7 -0
  854. data/public/treport/src-noconflict/snippets/velocity.js +36 -0
  855. data/public/treport/src-noconflict/snippets/verilog.js +7 -0
  856. data/public/treport/src-noconflict/snippets/vhdl.js +7 -0
  857. data/public/treport/src-noconflict/snippets/wollok.js +91 -0
  858. data/public/treport/src-noconflict/snippets/xml.js +7 -0
  859. data/public/treport/src-noconflict/snippets/xquery.js +68 -0
  860. data/public/treport/src-noconflict/snippets/yaml.js +7 -0
  861. data/public/treport/src-noconflict/theme-ambiance.js +182 -0
  862. data/public/treport/src-noconflict/theme-chaos.js +156 -0
  863. data/public/treport/src-noconflict/theme-chrome.js +128 -0
  864. data/public/treport/src-noconflict/theme-clouds.js +95 -0
  865. data/public/treport/src-noconflict/theme-clouds_midnight.js +96 -0
  866. data/public/treport/src-noconflict/theme-cobalt.js +113 -0
  867. data/public/treport/src-noconflict/theme-crimson_editor.js +118 -0
  868. data/public/treport/src-noconflict/theme-dawn.js +108 -0
  869. data/public/treport/src-noconflict/theme-dreamweaver.js +141 -0
  870. data/public/treport/src-noconflict/theme-eclipse.js +98 -0
  871. data/public/treport/src-noconflict/theme-github.js +103 -0
  872. data/public/treport/src-noconflict/theme-idle_fingers.js +96 -0
  873. data/public/treport/src-noconflict/theme-iplastic.js +121 -0
  874. data/public/treport/src-noconflict/theme-katzenmilch.js +121 -0
  875. data/public/treport/src-noconflict/theme-kr_theme.js +104 -0
  876. data/public/treport/src-noconflict/theme-kuroir.js +61 -0
  877. data/public/treport/src-noconflict/theme-merbivore.js +95 -0
  878. data/public/treport/src-noconflict/theme-merbivore_soft.js +96 -0
  879. data/public/treport/src-noconflict/theme-mono_industrial.js +107 -0
  880. data/public/treport/src-noconflict/theme-monokai.js +105 -0
  881. data/public/treport/src-noconflict/theme-pastel_on_dark.js +108 -0
  882. data/public/treport/src-noconflict/theme-solarized_dark.js +88 -0
  883. data/public/treport/src-noconflict/theme-solarized_light.js +91 -0
  884. data/public/treport/src-noconflict/theme-sqlserver.js +138 -0
  885. data/public/treport/src-noconflict/theme-terminal.js +114 -0
  886. data/public/treport/src-noconflict/theme-textmate.js +129 -0
  887. data/public/treport/src-noconflict/theme-tomorrow.js +108 -0
  888. data/public/treport/src-noconflict/theme-tomorrow_night.js +108 -0
  889. data/public/treport/src-noconflict/theme-tomorrow_night_blue.js +106 -0
  890. data/public/treport/src-noconflict/theme-tomorrow_night_bright.js +121 -0
  891. data/public/treport/src-noconflict/theme-tomorrow_night_eighties.js +108 -0
  892. data/public/treport/src-noconflict/theme-twilight.js +109 -0
  893. data/public/treport/src-noconflict/theme-vibrant_ink.js +94 -0
  894. data/public/treport/src-noconflict/theme-xcode.js +88 -0
  895. data/public/treport/src-noconflict/worker-coffee.js +2159 -0
  896. data/public/treport/src-noconflict/worker-css.js +8762 -0
  897. data/public/treport/src-noconflict/worker-html.js +11607 -0
  898. data/public/treport/src-noconflict/worker-javascript.js +12530 -0
  899. data/public/treport/src-noconflict/worker-json.js +2398 -0
  900. data/public/treport/src-noconflict/worker-lua.js +3634 -0
  901. data/public/treport/src-noconflict/worker-php.js +7021 -0
  902. data/public/treport/src-noconflict/worker-xml.js +3889 -0
  903. data/public/treport/src-noconflict/worker-xquery.js +49612 -0
  904. data/public/treport/swf/flashExport.swf +0 -0
  905. metadata +906 -54
  906. data/app/controllers/connects_controller.rb +0 -56
  907. data/app/controllers/dictionaries_controller.rb +0 -56
  908. data/app/controllers/reports_controller.rb +0 -62
  909. data/app/controllers/requirements_controller.rb +0 -60
  910. data/app/controllers/series_controller.rb +0 -60
  911. data/app/models/.keep +0 -0
  912. data/app/models/dictionary.rb +0 -4
  913. data/app/models/series.rb +0 -4
  914. data/app/views/connects/_form.html.erb +0 -68
  915. data/app/views/connects/edit.html.erb +0 -1
  916. data/app/views/connects/index.html.erb +0 -48
  917. data/app/views/connects/new.html.erb +0 -1
  918. data/app/views/dictionaries/_form.html.erb +0 -49
  919. data/app/views/dictionaries/edit.html.erb +0 -1
  920. data/app/views/dictionaries/index.html.erb +0 -42
  921. data/app/views/dictionaries/new.html.erb +0 -1
  922. data/app/views/layouts/report.html.erb +0 -54
  923. data/app/views/reports/_form.html.erb +0 -65
  924. data/app/views/reports/edit.html.erb +0 -1
  925. data/app/views/reports/index.html.erb +0 -50
  926. data/app/views/reports/new.html.erb +0 -1
  927. data/app/views/requirements/_form.html.erb +0 -72
  928. data/app/views/requirements/edit.html.erb +0 -1
  929. data/app/views/requirements/index.html.erb +0 -51
  930. data/app/views/requirements/new.html.erb +0 -1
  931. data/app/views/series/_form.html.erb +0 -47
  932. data/app/views/series/edit.html.erb +0 -1
  933. data/app/views/series/index.html.erb +0 -40
  934. data/app/views/series/new.html.erb +0 -1
  935. data/app/views/templates/public_one.html.erb +0 -75
  936. data/app/views/templates/public_two.html.erb +0 -76
  937. data/app/views/templates/text.html.erb +0 -9
  938. data/db/migrate/20160607002137_create_connects.rb +0 -15
  939. data/db/migrate/20160608123333_create_reports.rb +0 -15
  940. data/db/migrate/20160608124539_create_requirements.rb +0 -16
  941. data/db/migrate/20160608124549_create_dictionaries.rb +0 -12
  942. data/db/migrate/20160608124602_create_series.rb +0 -11
  943. data/lib/generators/report/install_generator.rb +0 -26
  944. data/lib/treport/db.rb +0 -49
  945. data/public/report/css/AdminLTE.css +0 -4906
  946. data/public/report/css/bootstrap.min.css +0 -6
  947. data/public/report/css/skins/_all-skins.css +0 -1799
  948. data/public/report/css/skins/_all-skins.min.css +0 -1
  949. data/public/report/js/app.js +0 -44
  950. data/treport.gemspec +0 -12
@@ -0,0 +1,3193 @@
1
+ /**
2
+ * selectize.js (v0.12.4)
3
+ * Copyright (c) 2013–2015 Brian Reavis & contributors
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
6
+ * file except in compliance with the License. You may obtain a copy of the License at:
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11
+ * ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ *
14
+ * @author Brian Reavis <brian@thirdroute.com>
15
+ */
16
+
17
+ /*jshint curly:false */
18
+ /*jshint browser:true */
19
+
20
+ (function(root, factory) {
21
+ if (typeof define === 'function' && define.amd) {
22
+ define(['jquery','sifter','microplugin'], factory);
23
+ } else if (typeof exports === 'object') {
24
+ module.exports = factory(require('jquery'), require('sifter'), require('microplugin'));
25
+ } else {
26
+ root.Selectize = factory(root.jQuery, root.Sifter, root.MicroPlugin);
27
+ }
28
+ }(this, function($, Sifter, MicroPlugin) {
29
+ 'use strict';
30
+
31
+ var highlight = function($element, pattern) {
32
+ if (typeof pattern === 'string' && !pattern.length) return;
33
+ var regex = (typeof pattern === 'string') ? new RegExp(pattern, 'i') : pattern;
34
+
35
+ var highlight = function(node) {
36
+ var skip = 0;
37
+ if (node.nodeType === 3) {
38
+ var pos = node.data.search(regex);
39
+ if (pos >= 0 && node.data.length > 0) {
40
+ var match = node.data.match(regex);
41
+ var spannode = document.createElement('span');
42
+ spannode.className = 'highlight';
43
+ var middlebit = node.splitText(pos);
44
+ var endbit = middlebit.splitText(match[0].length);
45
+ var middleclone = middlebit.cloneNode(true);
46
+ spannode.appendChild(middleclone);
47
+ middlebit.parentNode.replaceChild(spannode, middlebit);
48
+ skip = 1;
49
+ }
50
+ } else if (node.nodeType === 1 && node.childNodes && !/(script|style)/i.test(node.tagName)) {
51
+ for (var i = 0; i < node.childNodes.length; ++i) {
52
+ i += highlight(node.childNodes[i]);
53
+ }
54
+ }
55
+ return skip;
56
+ };
57
+
58
+ return $element.each(function() {
59
+ highlight(this);
60
+ });
61
+ };
62
+
63
+ /**
64
+ * removeHighlight fn copied from highlight v5 and
65
+ * edited to remove with() and pass js strict mode
66
+ */
67
+ $.fn.removeHighlight = function() {
68
+ return this.find("span.highlight").each(function() {
69
+ this.parentNode.firstChild.nodeName;
70
+ var parent = this.parentNode;
71
+ parent.replaceChild(this.firstChild, this);
72
+ parent.normalize();
73
+ }).end();
74
+ };
75
+
76
+
77
+ var MicroEvent = function() {};
78
+ MicroEvent.prototype = {
79
+ on: function(event, fct){
80
+ this._events = this._events || {};
81
+ this._events[event] = this._events[event] || [];
82
+ this._events[event].push(fct);
83
+ },
84
+ off: function(event, fct){
85
+ var n = arguments.length;
86
+ if (n === 0) return delete this._events;
87
+ if (n === 1) return delete this._events[event];
88
+
89
+ this._events = this._events || {};
90
+ if (event in this._events === false) return;
91
+ this._events[event].splice(this._events[event].indexOf(fct), 1);
92
+ },
93
+ trigger: function(event /* , args... */){
94
+ this._events = this._events || {};
95
+ if (event in this._events === false) return;
96
+ for (var i = 0; i < this._events[event].length; i++){
97
+ this._events[event][i].apply(this, Array.prototype.slice.call(arguments, 1));
98
+ }
99
+ }
100
+ };
101
+
102
+ /**
103
+ * Mixin will delegate all MicroEvent.js function in the destination object.
104
+ *
105
+ * - MicroEvent.mixin(Foobar) will make Foobar able to use MicroEvent
106
+ *
107
+ * @param {object} the object which will support MicroEvent
108
+ */
109
+ MicroEvent.mixin = function(destObject){
110
+ var props = ['on', 'off', 'trigger'];
111
+ for (var i = 0; i < props.length; i++){
112
+ destObject.prototype[props[i]] = MicroEvent.prototype[props[i]];
113
+ }
114
+ };
115
+
116
+ var IS_MAC = /Mac/.test(navigator.userAgent);
117
+
118
+ var KEY_A = 65;
119
+ var KEY_COMMA = 188;
120
+ var KEY_RETURN = 13;
121
+ var KEY_ESC = 27;
122
+ var KEY_LEFT = 37;
123
+ var KEY_UP = 38;
124
+ var KEY_P = 80;
125
+ var KEY_RIGHT = 39;
126
+ var KEY_DOWN = 40;
127
+ var KEY_N = 78;
128
+ var KEY_BACKSPACE = 8;
129
+ var KEY_DELETE = 46;
130
+ var KEY_SHIFT = 16;
131
+ var KEY_CMD = IS_MAC ? 91 : 17;
132
+ var KEY_CTRL = IS_MAC ? 18 : 17;
133
+ var KEY_TAB = 9;
134
+
135
+ var TAG_SELECT = 1;
136
+ var TAG_INPUT = 2;
137
+
138
+ // for now, android support in general is too spotty to support validity
139
+ var SUPPORTS_VALIDITY_API = !/android/i.test(window.navigator.userAgent) && !!document.createElement('input').validity;
140
+
141
+
142
+ var isset = function(object) {
143
+ return typeof object !== 'undefined';
144
+ };
145
+
146
+ /**
147
+ * Converts a scalar to its best string representation
148
+ * for hash keys and HTML attribute values.
149
+ *
150
+ * Transformations:
151
+ * 'str' -> 'str'
152
+ * null -> ''
153
+ * undefined -> ''
154
+ * true -> '1'
155
+ * false -> '0'
156
+ * 0 -> '0'
157
+ * 1 -> '1'
158
+ *
159
+ * @param {string} value
160
+ * @returns {string|null}
161
+ */
162
+ var hash_key = function(value) {
163
+ if (typeof value === 'undefined' || value === null) return null;
164
+ if (typeof value === 'boolean') return value ? '1' : '0';
165
+ return value + '';
166
+ };
167
+
168
+ /**
169
+ * Escapes a string for use within HTML.
170
+ *
171
+ * @param {string} str
172
+ * @returns {string}
173
+ */
174
+ var escape_html = function(str) {
175
+ return (str + '')
176
+ .replace(/&/g, '&amp;')
177
+ .replace(/</g, '&lt;')
178
+ .replace(/>/g, '&gt;')
179
+ .replace(/"/g, '&quot;');
180
+ };
181
+
182
+ /**
183
+ * Escapes "$" characters in replacement strings.
184
+ *
185
+ * @param {string} str
186
+ * @returns {string}
187
+ */
188
+ var escape_replace = function(str) {
189
+ return (str + '').replace(/\$/g, '$$$$');
190
+ };
191
+
192
+ var hook = {};
193
+
194
+ /**
195
+ * Wraps `method` on `self` so that `fn`
196
+ * is invoked before the original method.
197
+ *
198
+ * @param {object} self
199
+ * @param {string} method
200
+ * @param {function} fn
201
+ */
202
+ hook.before = function(self, method, fn) {
203
+ var original = self[method];
204
+ self[method] = function() {
205
+ fn.apply(self, arguments);
206
+ return original.apply(self, arguments);
207
+ };
208
+ };
209
+
210
+ /**
211
+ * Wraps `method` on `self` so that `fn`
212
+ * is invoked after the original method.
213
+ *
214
+ * @param {object} self
215
+ * @param {string} method
216
+ * @param {function} fn
217
+ */
218
+ hook.after = function(self, method, fn) {
219
+ var original = self[method];
220
+ self[method] = function() {
221
+ var result = original.apply(self, arguments);
222
+ fn.apply(self, arguments);
223
+ return result;
224
+ };
225
+ };
226
+
227
+ /**
228
+ * Wraps `fn` so that it can only be invoked once.
229
+ *
230
+ * @param {function} fn
231
+ * @returns {function}
232
+ */
233
+ var once = function(fn) {
234
+ var called = false;
235
+ return function() {
236
+ if (called) return;
237
+ called = true;
238
+ fn.apply(this, arguments);
239
+ };
240
+ };
241
+
242
+ /**
243
+ * Wraps `fn` so that it can only be called once
244
+ * every `delay` milliseconds (invoked on the falling edge).
245
+ *
246
+ * @param {function} fn
247
+ * @param {int} delay
248
+ * @returns {function}
249
+ */
250
+ var debounce = function(fn, delay) {
251
+ var timeout;
252
+ return function() {
253
+ var self = this;
254
+ var args = arguments;
255
+ window.clearTimeout(timeout);
256
+ timeout = window.setTimeout(function() {
257
+ fn.apply(self, args);
258
+ }, delay);
259
+ };
260
+ };
261
+
262
+ /**
263
+ * Debounce all fired events types listed in `types`
264
+ * while executing the provided `fn`.
265
+ *
266
+ * @param {object} self
267
+ * @param {array} types
268
+ * @param {function} fn
269
+ */
270
+ var debounce_events = function(self, types, fn) {
271
+ var type;
272
+ var trigger = self.trigger;
273
+ var event_args = {};
274
+
275
+ // override trigger method
276
+ self.trigger = function() {
277
+ var type = arguments[0];
278
+ if (types.indexOf(type) !== -1) {
279
+ event_args[type] = arguments;
280
+ } else {
281
+ return trigger.apply(self, arguments);
282
+ }
283
+ };
284
+
285
+ // invoke provided function
286
+ fn.apply(self, []);
287
+ self.trigger = trigger;
288
+
289
+ // trigger queued events
290
+ for (type in event_args) {
291
+ if (event_args.hasOwnProperty(type)) {
292
+ trigger.apply(self, event_args[type]);
293
+ }
294
+ }
295
+ };
296
+
297
+ /**
298
+ * A workaround for http://bugs.jquery.com/ticket/6696
299
+ *
300
+ * @param {object} $parent - Parent element to listen on.
301
+ * @param {string} event - Event name.
302
+ * @param {string} selector - Descendant selector to filter by.
303
+ * @param {function} fn - Event handler.
304
+ */
305
+ var watchChildEvent = function($parent, event, selector, fn) {
306
+ $parent.on(event, selector, function(e) {
307
+ var child = e.target;
308
+ while (child && child.parentNode !== $parent[0]) {
309
+ child = child.parentNode;
310
+ }
311
+ e.currentTarget = child;
312
+ return fn.apply(this, [e]);
313
+ });
314
+ };
315
+
316
+ /**
317
+ * Determines the current selection within a text input control.
318
+ * Returns an object containing:
319
+ * - start
320
+ * - length
321
+ *
322
+ * @param {object} input
323
+ * @returns {object}
324
+ */
325
+ var getSelection = function(input) {
326
+ var result = {};
327
+ if ('selectionStart' in input) {
328
+ result.start = input.selectionStart;
329
+ result.length = input.selectionEnd - result.start;
330
+ } else if (document.selection) {
331
+ input.focus();
332
+ var sel = document.selection.createRange();
333
+ var selLen = document.selection.createRange().text.length;
334
+ sel.moveStart('character', -input.value.length);
335
+ result.start = sel.text.length - selLen;
336
+ result.length = selLen;
337
+ }
338
+ return result;
339
+ };
340
+
341
+ /**
342
+ * Copies CSS properties from one element to another.
343
+ *
344
+ * @param {object} $from
345
+ * @param {object} $to
346
+ * @param {array} properties
347
+ */
348
+ var transferStyles = function($from, $to, properties) {
349
+ var i, n, styles = {};
350
+ if (properties) {
351
+ for (i = 0, n = properties.length; i < n; i++) {
352
+ styles[properties[i]] = $from.css(properties[i]);
353
+ }
354
+ } else {
355
+ styles = $from.css();
356
+ }
357
+ $to.css(styles);
358
+ };
359
+
360
+ /**
361
+ * Measures the width of a string within a
362
+ * parent element (in pixels).
363
+ *
364
+ * @param {string} str
365
+ * @param {object} $parent
366
+ * @returns {int}
367
+ */
368
+ var measureString = function(str, $parent) {
369
+ if (!str) {
370
+ return 0;
371
+ }
372
+
373
+ var $test = $('<test>').css({
374
+ position: 'absolute',
375
+ top: -99999,
376
+ left: -99999,
377
+ width: 'auto',
378
+ padding: 0,
379
+ whiteSpace: 'pre'
380
+ }).text(str).appendTo('body');
381
+
382
+ transferStyles($parent, $test, [
383
+ 'letterSpacing',
384
+ 'fontSize',
385
+ 'fontFamily',
386
+ 'fontWeight',
387
+ 'textTransform'
388
+ ]);
389
+
390
+ var width = $test.width();
391
+ $test.remove();
392
+
393
+ return width;
394
+ };
395
+
396
+ /**
397
+ * Sets up an input to grow horizontally as the user
398
+ * types. If the value is changed manually, you can
399
+ * trigger the "update" handler to resize:
400
+ *
401
+ * $input.trigger('update');
402
+ *
403
+ * @param {object} $input
404
+ */
405
+ var autoGrow = function($input) {
406
+ var currentWidth = null;
407
+
408
+ var update = function(e, options) {
409
+ var value, keyCode, printable, placeholder, width;
410
+ var shift, character, selection;
411
+ e = e || window.event || {};
412
+ options = options || {};
413
+
414
+ if (e.metaKey || e.altKey) return;
415
+ if (!options.force && $input.data('grow') === false) return;
416
+
417
+ value = $input.val();
418
+ if (e.type && e.type.toLowerCase() === 'keydown') {
419
+ keyCode = e.keyCode;
420
+ printable = (
421
+ (keyCode >= 97 && keyCode <= 122) || // a-z
422
+ (keyCode >= 65 && keyCode <= 90) || // A-Z
423
+ (keyCode >= 48 && keyCode <= 57) || // 0-9
424
+ keyCode === 32 // space
425
+ );
426
+
427
+ if (keyCode === KEY_DELETE || keyCode === KEY_BACKSPACE) {
428
+ selection = getSelection($input[0]);
429
+ if (selection.length) {
430
+ value = value.substring(0, selection.start) + value.substring(selection.start + selection.length);
431
+ } else if (keyCode === KEY_BACKSPACE && selection.start) {
432
+ value = value.substring(0, selection.start - 1) + value.substring(selection.start + 1);
433
+ } else if (keyCode === KEY_DELETE && typeof selection.start !== 'undefined') {
434
+ value = value.substring(0, selection.start) + value.substring(selection.start + 1);
435
+ }
436
+ } else if (printable) {
437
+ shift = e.shiftKey;
438
+ character = String.fromCharCode(e.keyCode);
439
+ if (shift) character = character.toUpperCase();
440
+ else character = character.toLowerCase();
441
+ value += character;
442
+ }
443
+ }
444
+
445
+ placeholder = $input.attr('placeholder');
446
+ if (!value && placeholder) {
447
+ value = placeholder;
448
+ }
449
+
450
+ width = measureString(value, $input) + 4;
451
+ if (width !== currentWidth) {
452
+ currentWidth = width;
453
+ $input.width(width);
454
+ $input.triggerHandler('resize');
455
+ }
456
+ };
457
+
458
+ $input.on('keydown keyup update blur', update);
459
+ update();
460
+ };
461
+
462
+ var domToString = function(d) {
463
+ var tmp = document.createElement('div');
464
+
465
+ tmp.appendChild(d.cloneNode(true));
466
+
467
+ return tmp.innerHTML;
468
+ };
469
+
470
+ var logError = function(message, options){
471
+ if(!options) options = {};
472
+ var component = "Selectize";
473
+
474
+ console.error(component + ": " + message)
475
+
476
+ if(options.explanation){
477
+ // console.group is undefined in <IE11
478
+ if(console.group) console.group();
479
+ console.error(options.explanation);
480
+ if(console.group) console.groupEnd();
481
+ }
482
+ }
483
+
484
+
485
+ var Selectize = function($input, settings) {
486
+ var key, i, n, dir, input, self = this;
487
+ input = $input[0];
488
+ input.selectize = self;
489
+
490
+ // detect rtl environment
491
+ var computedStyle = window.getComputedStyle && window.getComputedStyle(input, null);
492
+ dir = computedStyle ? computedStyle.getPropertyValue('direction') : input.currentStyle && input.currentStyle.direction;
493
+ dir = dir || $input.parents('[dir]:first').attr('dir') || '';
494
+
495
+ // setup default state
496
+ $.extend(self, {
497
+ order : 0,
498
+ settings : settings,
499
+ $input : $input,
500
+ tabIndex : $input.attr('tabindex') || '',
501
+ tagType : input.tagName.toLowerCase() === 'select' ? TAG_SELECT : TAG_INPUT,
502
+ rtl : /rtl/i.test(dir),
503
+
504
+ eventNS : '.selectize' + (++Selectize.count),
505
+ highlightedValue : null,
506
+ isOpen : false,
507
+ isDisabled : false,
508
+ isRequired : $input.is('[required]'),
509
+ isInvalid : false,
510
+ isLocked : false,
511
+ isFocused : false,
512
+ isInputHidden : false,
513
+ isSetup : false,
514
+ isShiftDown : false,
515
+ isCmdDown : false,
516
+ isCtrlDown : false,
517
+ ignoreFocus : false,
518
+ ignoreBlur : false,
519
+ ignoreHover : false,
520
+ hasOptions : false,
521
+ currentResults : null,
522
+ lastValue : '',
523
+ caretPos : 0,
524
+ loading : 0,
525
+ loadedSearches : {},
526
+
527
+ $activeOption : null,
528
+ $activeItems : [],
529
+
530
+ optgroups : {},
531
+ options : {},
532
+ userOptions : {},
533
+ items : [],
534
+ renderCache : {},
535
+ onSearchChange : settings.loadThrottle === null ? self.onSearchChange : debounce(self.onSearchChange, settings.loadThrottle)
536
+ });
537
+
538
+ // search system
539
+ self.sifter = new Sifter(this.options, {diacritics: settings.diacritics});
540
+
541
+ // build options table
542
+ if (self.settings.options) {
543
+ for (i = 0, n = self.settings.options.length; i < n; i++) {
544
+ self.registerOption(self.settings.options[i]);
545
+ }
546
+ delete self.settings.options;
547
+ }
548
+
549
+ // build optgroup table
550
+ if (self.settings.optgroups) {
551
+ for (i = 0, n = self.settings.optgroups.length; i < n; i++) {
552
+ self.registerOptionGroup(self.settings.optgroups[i]);
553
+ }
554
+ delete self.settings.optgroups;
555
+ }
556
+
557
+ // option-dependent defaults
558
+ self.settings.mode = self.settings.mode || (self.settings.maxItems === 1 ? 'single' : 'multi');
559
+ if (typeof self.settings.hideSelected !== 'boolean') {
560
+ self.settings.hideSelected = self.settings.mode === 'multi';
561
+ }
562
+
563
+ self.initializePlugins(self.settings.plugins);
564
+ self.setupCallbacks();
565
+ self.setupTemplates();
566
+ self.setup();
567
+ };
568
+
569
+ // mixins
570
+ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
571
+
572
+ MicroEvent.mixin(Selectize);
573
+
574
+ if(typeof MicroPlugin !== "undefined"){
575
+ MicroPlugin.mixin(Selectize);
576
+ }else{
577
+ logError("Dependency MicroPlugin is missing",
578
+ {explanation:
579
+ "Make sure you either: (1) are using the \"standalone\" "+
580
+ "version of Selectize, or (2) require MicroPlugin before you "+
581
+ "load Selectize."}
582
+ );
583
+ }
584
+
585
+
586
+ // methods
587
+ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
588
+
589
+ $.extend(Selectize.prototype, {
590
+
591
+ /**
592
+ * Creates all elements and sets up event bindings.
593
+ */
594
+ setup: function() {
595
+ var self = this;
596
+ var settings = self.settings;
597
+ var eventNS = self.eventNS;
598
+ var $window = $(window);
599
+ var $document = $(document);
600
+ var $input = self.$input;
601
+
602
+ var $wrapper;
603
+ var $control;
604
+ var $control_input;
605
+ var $dropdown;
606
+ var $dropdown_content;
607
+ var $dropdown_parent;
608
+ var inputMode;
609
+ var timeout_blur;
610
+ var timeout_focus;
611
+ var classes;
612
+ var classes_plugins;
613
+ var inputId;
614
+
615
+ inputMode = self.settings.mode;
616
+ classes = $input.attr('class') || '';
617
+
618
+ $wrapper = $('<div>').addClass(settings.wrapperClass).addClass(classes).addClass(inputMode);
619
+ $control = $('<div>').addClass(settings.inputClass).addClass('items').appendTo($wrapper);
620
+ $control_input = $('<input type="text" autocomplete="off" />').appendTo($control).attr('tabindex', $input.is(':disabled') ? '-1' : self.tabIndex);
621
+ $dropdown_parent = $(settings.dropdownParent || $wrapper);
622
+ $dropdown = $('<div>').addClass(settings.dropdownClass).addClass(inputMode).hide().appendTo($dropdown_parent);
623
+ $dropdown_content = $('<div>').addClass(settings.dropdownContentClass).appendTo($dropdown);
624
+
625
+ if(inputId = $input.attr('id')) {
626
+ $control_input.attr('id', inputId + '-selectized');
627
+ $("label[for='"+inputId+"']").attr('for', inputId + '-selectized');
628
+ }
629
+
630
+ if(self.settings.copyClassesToDropdown) {
631
+ $dropdown.addClass(classes);
632
+ }
633
+
634
+ $wrapper.css({
635
+ width: $input[0].style.width
636
+ });
637
+
638
+ if (self.plugins.names.length) {
639
+ classes_plugins = 'plugin-' + self.plugins.names.join(' plugin-');
640
+ $wrapper.addClass(classes_plugins);
641
+ $dropdown.addClass(classes_plugins);
642
+ }
643
+
644
+ if ((settings.maxItems === null || settings.maxItems > 1) && self.tagType === TAG_SELECT) {
645
+ $input.attr('multiple', 'multiple');
646
+ }
647
+
648
+ if (self.settings.placeholder) {
649
+ $control_input.attr('placeholder', settings.placeholder);
650
+ }
651
+
652
+ // if splitOn was not passed in, construct it from the delimiter to allow pasting universally
653
+ if (!self.settings.splitOn && self.settings.delimiter) {
654
+ var delimiterEscaped = self.settings.delimiter.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
655
+ self.settings.splitOn = new RegExp('\\s*' + delimiterEscaped + '+\\s*');
656
+ }
657
+
658
+ if ($input.attr('autocorrect')) {
659
+ $control_input.attr('autocorrect', $input.attr('autocorrect'));
660
+ }
661
+
662
+ if ($input.attr('autocapitalize')) {
663
+ $control_input.attr('autocapitalize', $input.attr('autocapitalize'));
664
+ }
665
+
666
+ self.$wrapper = $wrapper;
667
+ self.$control = $control;
668
+ self.$control_input = $control_input;
669
+ self.$dropdown = $dropdown;
670
+ self.$dropdown_content = $dropdown_content;
671
+
672
+ $dropdown.on('mouseenter', '[data-selectable]', function() { return self.onOptionHover.apply(self, arguments); });
673
+ $dropdown.on('mousedown click', '[data-selectable]', function() { return self.onOptionSelect.apply(self, arguments); });
674
+ watchChildEvent($control, 'mousedown', '*:not(input)', function() { return self.onItemSelect.apply(self, arguments); });
675
+ autoGrow($control_input);
676
+
677
+ $control.on({
678
+ mousedown : function() { return self.onMouseDown.apply(self, arguments); },
679
+ click : function() { return self.onClick.apply(self, arguments); }
680
+ });
681
+
682
+ $control_input.on({
683
+ mousedown : function(e) { e.stopPropagation(); },
684
+ keydown : function() { return self.onKeyDown.apply(self, arguments); },
685
+ keyup : function() { return self.onKeyUp.apply(self, arguments); },
686
+ keypress : function() { return self.onKeyPress.apply(self, arguments); },
687
+ resize : function() { self.positionDropdown.apply(self, []); },
688
+ blur : function() { return self.onBlur.apply(self, arguments); },
689
+ focus : function() { self.ignoreBlur = false; return self.onFocus.apply(self, arguments); },
690
+ paste : function() { return self.onPaste.apply(self, arguments); }
691
+ });
692
+
693
+ $document.on('keydown' + eventNS, function(e) {
694
+ self.isCmdDown = e[IS_MAC ? 'metaKey' : 'ctrlKey'];
695
+ self.isCtrlDown = e[IS_MAC ? 'altKey' : 'ctrlKey'];
696
+ self.isShiftDown = e.shiftKey;
697
+ });
698
+
699
+ $document.on('keyup' + eventNS, function(e) {
700
+ if (e.keyCode === KEY_CTRL) self.isCtrlDown = false;
701
+ if (e.keyCode === KEY_SHIFT) self.isShiftDown = false;
702
+ if (e.keyCode === KEY_CMD) self.isCmdDown = false;
703
+ });
704
+
705
+ $document.on('mousedown' + eventNS, function(e) {
706
+ if (self.isFocused) {
707
+ // prevent events on the dropdown scrollbar from causing the control to blur
708
+ if (e.target === self.$dropdown[0] || e.target.parentNode === self.$dropdown[0]) {
709
+ return false;
710
+ }
711
+ // blur on click outside
712
+ if (!self.$control.has(e.target).length && e.target !== self.$control[0]) {
713
+ self.blur(e.target);
714
+ }
715
+ }
716
+ });
717
+
718
+ $window.on(['scroll' + eventNS, 'resize' + eventNS].join(' '), function() {
719
+ if (self.isOpen) {
720
+ self.positionDropdown.apply(self, arguments);
721
+ }
722
+ });
723
+ $window.on('mousemove' + eventNS, function() {
724
+ self.ignoreHover = false;
725
+ });
726
+
727
+ // store original children and tab index so that they can be
728
+ // restored when the destroy() method is called.
729
+ this.revertSettings = {
730
+ $children : $input.children().detach(),
731
+ tabindex : $input.attr('tabindex')
732
+ };
733
+
734
+ $input.attr('tabindex', -1).hide().after(self.$wrapper);
735
+
736
+ if ($.isArray(settings.items)) {
737
+ self.setValue(settings.items);
738
+ delete settings.items;
739
+ }
740
+
741
+ // feature detect for the validation API
742
+ if (SUPPORTS_VALIDITY_API) {
743
+ $input.on('invalid' + eventNS, function(e) {
744
+ e.preventDefault();
745
+ self.isInvalid = true;
746
+ self.refreshState();
747
+ });
748
+ }
749
+
750
+ self.updateOriginalInput();
751
+ self.refreshItems();
752
+ self.refreshState();
753
+ self.updatePlaceholder();
754
+ self.isSetup = true;
755
+
756
+ if ($input.is(':disabled')) {
757
+ self.disable();
758
+ }
759
+
760
+ self.on('change', this.onChange);
761
+
762
+ $input.data('selectize', self);
763
+ $input.addClass('selectized');
764
+ self.trigger('initialize');
765
+
766
+ // preload options
767
+ if (settings.preload === true) {
768
+ self.onSearchChange('');
769
+ }
770
+
771
+ },
772
+
773
+ /**
774
+ * Sets up default rendering functions.
775
+ */
776
+ setupTemplates: function() {
777
+ var self = this;
778
+ var field_label = self.settings.labelField;
779
+ var field_optgroup = self.settings.optgroupLabelField;
780
+
781
+ var templates = {
782
+ 'optgroup': function(data) {
783
+ return '<div class="optgroup">' + data.html + '</div>';
784
+ },
785
+ 'optgroup_header': function(data, escape) {
786
+ return '<div class="optgroup-header">' + escape(data[field_optgroup]) + '</div>';
787
+ },
788
+ 'option': function(data, escape) {
789
+ return '<div class="option">' + escape(data[field_label]) + '</div>';
790
+ },
791
+ 'item': function(data, escape) {
792
+ return '<div class="item">' + escape(data[field_label]) + '</div>';
793
+ },
794
+ 'option_create': function(data, escape) {
795
+ return '<div class="create">Add <strong>' + escape(data.input) + '</strong>&hellip;</div>';
796
+ }
797
+ };
798
+
799
+ self.settings.render = $.extend({}, templates, self.settings.render);
800
+ },
801
+
802
+ /**
803
+ * Maps fired events to callbacks provided
804
+ * in the settings used when creating the control.
805
+ */
806
+ setupCallbacks: function() {
807
+ var key, fn, callbacks = {
808
+ 'initialize' : 'onInitialize',
809
+ 'change' : 'onChange',
810
+ 'item_add' : 'onItemAdd',
811
+ 'item_remove' : 'onItemRemove',
812
+ 'clear' : 'onClear',
813
+ 'option_add' : 'onOptionAdd',
814
+ 'option_remove' : 'onOptionRemove',
815
+ 'option_clear' : 'onOptionClear',
816
+ 'optgroup_add' : 'onOptionGroupAdd',
817
+ 'optgroup_remove' : 'onOptionGroupRemove',
818
+ 'optgroup_clear' : 'onOptionGroupClear',
819
+ 'dropdown_open' : 'onDropdownOpen',
820
+ 'dropdown_close' : 'onDropdownClose',
821
+ 'type' : 'onType',
822
+ 'load' : 'onLoad',
823
+ 'focus' : 'onFocus',
824
+ 'blur' : 'onBlur'
825
+ };
826
+
827
+ for (key in callbacks) {
828
+ if (callbacks.hasOwnProperty(key)) {
829
+ fn = this.settings[callbacks[key]];
830
+ if (fn) this.on(key, fn);
831
+ }
832
+ }
833
+ },
834
+
835
+ /**
836
+ * Triggered when the main control element
837
+ * has a click event.
838
+ *
839
+ * @param {object} e
840
+ * @return {boolean}
841
+ */
842
+ onClick: function(e) {
843
+ var self = this;
844
+
845
+ // necessary for mobile webkit devices (manual focus triggering
846
+ // is ignored unless invoked within a click event)
847
+ if (!self.isFocused) {
848
+ self.focus();
849
+ e.preventDefault();
850
+ }
851
+ },
852
+
853
+ /**
854
+ * Triggered when the main control element
855
+ * has a mouse down event.
856
+ *
857
+ * @param {object} e
858
+ * @return {boolean}
859
+ */
860
+ onMouseDown: function(e) {
861
+ var self = this;
862
+ var defaultPrevented = e.isDefaultPrevented();
863
+ var $target = $(e.target);
864
+
865
+ if (self.isFocused) {
866
+ // retain focus by preventing native handling. if the
867
+ // event target is the input it should not be modified.
868
+ // otherwise, text selection within the input won't work.
869
+ if (e.target !== self.$control_input[0]) {
870
+ if (self.settings.mode === 'single') {
871
+ // toggle dropdown
872
+ self.isOpen ? self.close() : self.open();
873
+ } else if (!defaultPrevented) {
874
+ self.setActiveItem(null);
875
+ }
876
+ return false;
877
+ }
878
+ } else {
879
+ // give control focus
880
+ if (!defaultPrevented) {
881
+ window.setTimeout(function() {
882
+ self.focus();
883
+ }, 0);
884
+ }
885
+ }
886
+ },
887
+
888
+ /**
889
+ * Triggered when the value of the control has been changed.
890
+ * This should propagate the event to the original DOM
891
+ * input / select element.
892
+ */
893
+ onChange: function() {
894
+ this.$input.trigger('change');
895
+ },
896
+
897
+ /**
898
+ * Triggered on <input> paste.
899
+ *
900
+ * @param {object} e
901
+ * @returns {boolean}
902
+ */
903
+ onPaste: function(e) {
904
+ var self = this;
905
+
906
+ if (self.isFull() || self.isInputHidden || self.isLocked) {
907
+ e.preventDefault();
908
+ return;
909
+ }
910
+
911
+ // If a regex or string is included, this will split the pasted
912
+ // input and create Items for each separate value
913
+ if (self.settings.splitOn) {
914
+
915
+ // Wait for pasted text to be recognized in value
916
+ setTimeout(function() {
917
+ var pastedText = self.$control_input.val();
918
+ if(!pastedText.match(self.settings.splitOn)){ return }
919
+
920
+ var splitInput = $.trim(pastedText).split(self.settings.splitOn);
921
+ for (var i = 0, n = splitInput.length; i < n; i++) {
922
+ self.createItem(splitInput[i]);
923
+ }
924
+ }, 0);
925
+ }
926
+ },
927
+
928
+ /**
929
+ * Triggered on <input> keypress.
930
+ *
931
+ * @param {object} e
932
+ * @returns {boolean}
933
+ */
934
+ onKeyPress: function(e) {
935
+ if (this.isLocked) return e && e.preventDefault();
936
+ var character = String.fromCharCode(e.keyCode || e.which);
937
+ if (this.settings.create && this.settings.mode === 'multi' && character === this.settings.delimiter) {
938
+ this.createItem();
939
+ e.preventDefault();
940
+ return false;
941
+ }
942
+ },
943
+
944
+ /**
945
+ * Triggered on <input> keydown.
946
+ *
947
+ * @param {object} e
948
+ * @returns {boolean}
949
+ */
950
+ onKeyDown: function(e) {
951
+ var isInput = e.target === this.$control_input[0];
952
+ var self = this;
953
+
954
+ if (self.isLocked) {
955
+ if (e.keyCode !== KEY_TAB) {
956
+ e.preventDefault();
957
+ }
958
+ return;
959
+ }
960
+
961
+ switch (e.keyCode) {
962
+ case KEY_A:
963
+ if (self.isCmdDown) {
964
+ self.selectAll();
965
+ return;
966
+ }
967
+ break;
968
+ case KEY_ESC:
969
+ if (self.isOpen) {
970
+ e.preventDefault();
971
+ e.stopPropagation();
972
+ self.close();
973
+ }
974
+ return;
975
+ case KEY_N:
976
+ if (!e.ctrlKey || e.altKey) break;
977
+ case KEY_DOWN:
978
+ if (!self.isOpen && self.hasOptions) {
979
+ self.open();
980
+ } else if (self.$activeOption) {
981
+ self.ignoreHover = true;
982
+ var $next = self.getAdjacentOption(self.$activeOption, 1);
983
+ if ($next.length) self.setActiveOption($next, true, true);
984
+ }
985
+ e.preventDefault();
986
+ return;
987
+ case KEY_P:
988
+ if (!e.ctrlKey || e.altKey) break;
989
+ case KEY_UP:
990
+ if (self.$activeOption) {
991
+ self.ignoreHover = true;
992
+ var $prev = self.getAdjacentOption(self.$activeOption, -1);
993
+ if ($prev.length) self.setActiveOption($prev, true, true);
994
+ }
995
+ e.preventDefault();
996
+ return;
997
+ case KEY_RETURN:
998
+ if (self.isOpen && self.$activeOption) {
999
+ self.onOptionSelect({currentTarget: self.$activeOption});
1000
+ e.preventDefault();
1001
+ }
1002
+ return;
1003
+ case KEY_LEFT:
1004
+ self.advanceSelection(-1, e);
1005
+ return;
1006
+ case KEY_RIGHT:
1007
+ self.advanceSelection(1, e);
1008
+ return;
1009
+ case KEY_TAB:
1010
+ if (self.settings.selectOnTab && self.isOpen && self.$activeOption) {
1011
+ self.onOptionSelect({currentTarget: self.$activeOption});
1012
+
1013
+ // Default behaviour is to jump to the next field, we only want this
1014
+ // if the current field doesn't accept any more entries
1015
+ if (!self.isFull()) {
1016
+ e.preventDefault();
1017
+ }
1018
+ }
1019
+ if (self.settings.create && self.createItem()) {
1020
+ e.preventDefault();
1021
+ }
1022
+ return;
1023
+ case KEY_BACKSPACE:
1024
+ case KEY_DELETE:
1025
+ self.deleteSelection(e);
1026
+ return;
1027
+ }
1028
+
1029
+ if ((self.isFull() || self.isInputHidden) && !(IS_MAC ? e.metaKey : e.ctrlKey)) {
1030
+ e.preventDefault();
1031
+ return;
1032
+ }
1033
+ },
1034
+
1035
+ /**
1036
+ * Triggered on <input> keyup.
1037
+ *
1038
+ * @param {object} e
1039
+ * @returns {boolean}
1040
+ */
1041
+ onKeyUp: function(e) {
1042
+ var self = this;
1043
+
1044
+ if (self.isLocked) return e && e.preventDefault();
1045
+ var value = self.$control_input.val() || '';
1046
+ if (self.lastValue !== value) {
1047
+ self.lastValue = value;
1048
+ self.onSearchChange(value);
1049
+ self.refreshOptions();
1050
+ self.trigger('type', value);
1051
+ }
1052
+ },
1053
+
1054
+ /**
1055
+ * Invokes the user-provide option provider / loader.
1056
+ *
1057
+ * Note: this function is debounced in the Selectize
1058
+ * constructor (by `settings.loadThrottle` milliseconds)
1059
+ *
1060
+ * @param {string} value
1061
+ */
1062
+ onSearchChange: function(value) {
1063
+ var self = this;
1064
+ var fn = self.settings.load;
1065
+ if (!fn) return;
1066
+ if (self.loadedSearches.hasOwnProperty(value)) return;
1067
+ self.loadedSearches[value] = true;
1068
+ self.load(function(callback) {
1069
+ fn.apply(self, [value, callback]);
1070
+ });
1071
+ },
1072
+
1073
+ /**
1074
+ * Triggered on <input> focus.
1075
+ *
1076
+ * @param {object} e (optional)
1077
+ * @returns {boolean}
1078
+ */
1079
+ onFocus: function(e) {
1080
+ var self = this;
1081
+ var wasFocused = self.isFocused;
1082
+
1083
+ if (self.isDisabled) {
1084
+ self.blur();
1085
+ e && e.preventDefault();
1086
+ return false;
1087
+ }
1088
+
1089
+ if (self.ignoreFocus) return;
1090
+ self.isFocused = true;
1091
+ if (self.settings.preload === 'focus') self.onSearchChange('');
1092
+
1093
+ if (!wasFocused) self.trigger('focus');
1094
+
1095
+ if (!self.$activeItems.length) {
1096
+ self.showInput();
1097
+ self.setActiveItem(null);
1098
+ self.refreshOptions(!!self.settings.openOnFocus);
1099
+ }
1100
+
1101
+ self.refreshState();
1102
+ },
1103
+
1104
+ /**
1105
+ * Triggered on <input> blur.
1106
+ *
1107
+ * @param {object} e
1108
+ * @param {Element} dest
1109
+ */
1110
+ onBlur: function(e, dest) {
1111
+ var self = this;
1112
+ if (!self.isFocused) return;
1113
+ self.isFocused = false;
1114
+
1115
+ if (self.ignoreFocus) {
1116
+ return;
1117
+ } else if (!self.ignoreBlur && document.activeElement === self.$dropdown_content[0]) {
1118
+ // necessary to prevent IE closing the dropdown when the scrollbar is clicked
1119
+ self.ignoreBlur = true;
1120
+ self.onFocus(e);
1121
+ return;
1122
+ }
1123
+
1124
+ var deactivate = function() {
1125
+ self.close();
1126
+ self.setTextboxValue('');
1127
+ self.setActiveItem(null);
1128
+ self.setActiveOption(null);
1129
+ self.setCaret(self.items.length);
1130
+ self.refreshState();
1131
+
1132
+ // IE11 bug: element still marked as active
1133
+ dest && dest.focus && dest.focus();
1134
+
1135
+ self.ignoreFocus = false;
1136
+ self.trigger('blur');
1137
+ };
1138
+
1139
+ self.ignoreFocus = true;
1140
+ if (self.settings.create && self.settings.createOnBlur) {
1141
+ self.createItem(null, false, deactivate);
1142
+ } else {
1143
+ deactivate();
1144
+ }
1145
+ },
1146
+
1147
+ /**
1148
+ * Triggered when the user rolls over
1149
+ * an option in the autocomplete dropdown menu.
1150
+ *
1151
+ * @param {object} e
1152
+ * @returns {boolean}
1153
+ */
1154
+ onOptionHover: function(e) {
1155
+ if (this.ignoreHover) return;
1156
+ this.setActiveOption(e.currentTarget, false);
1157
+ },
1158
+
1159
+ /**
1160
+ * Triggered when the user clicks on an option
1161
+ * in the autocomplete dropdown menu.
1162
+ *
1163
+ * @param {object} e
1164
+ * @returns {boolean}
1165
+ */
1166
+ onOptionSelect: function(e) {
1167
+ var value, $target, $option, self = this;
1168
+
1169
+ if (e.preventDefault) {
1170
+ e.preventDefault();
1171
+ e.stopPropagation();
1172
+ }
1173
+
1174
+ $target = $(e.currentTarget);
1175
+ if ($target.hasClass('create')) {
1176
+ self.createItem(null, function() {
1177
+ if (self.settings.closeAfterSelect) {
1178
+ self.close();
1179
+ }
1180
+ });
1181
+ } else {
1182
+ value = $target.attr('data-value');
1183
+ if (typeof value !== 'undefined') {
1184
+ self.lastQuery = null;
1185
+ self.setTextboxValue('');
1186
+ self.addItem(value);
1187
+ if (self.settings.closeAfterSelect) {
1188
+ self.close();
1189
+ } else if (!self.settings.hideSelected && e.type && /mouse/.test(e.type)) {
1190
+ self.setActiveOption(self.getOption(value));
1191
+ }
1192
+ }
1193
+ }
1194
+ },
1195
+
1196
+ /**
1197
+ * Triggered when the user clicks on an item
1198
+ * that has been selected.
1199
+ *
1200
+ * @param {object} e
1201
+ * @returns {boolean}
1202
+ */
1203
+ onItemSelect: function(e) {
1204
+ var self = this;
1205
+
1206
+ if (self.isLocked) return;
1207
+ if (self.settings.mode === 'multi') {
1208
+ e.preventDefault();
1209
+ self.setActiveItem(e.currentTarget, e);
1210
+ }
1211
+ },
1212
+
1213
+ /**
1214
+ * Invokes the provided method that provides
1215
+ * results to a callback---which are then added
1216
+ * as options to the control.
1217
+ *
1218
+ * @param {function} fn
1219
+ */
1220
+ load: function(fn) {
1221
+ var self = this;
1222
+ var $wrapper = self.$wrapper.addClass(self.settings.loadingClass);
1223
+
1224
+ self.loading++;
1225
+ fn.apply(self, [function(results) {
1226
+ self.loading = Math.max(self.loading - 1, 0);
1227
+ if (results && results.length) {
1228
+ self.addOption(results);
1229
+ self.refreshOptions(self.isFocused && !self.isInputHidden);
1230
+ }
1231
+ if (!self.loading) {
1232
+ $wrapper.removeClass(self.settings.loadingClass);
1233
+ }
1234
+ self.trigger('load', results);
1235
+ }]);
1236
+ },
1237
+
1238
+ /**
1239
+ * Sets the input field of the control to the specified value.
1240
+ *
1241
+ * @param {string} value
1242
+ */
1243
+ setTextboxValue: function(value) {
1244
+ var $input = this.$control_input;
1245
+ var changed = $input.val() !== value;
1246
+ if (changed) {
1247
+ $input.val(value).triggerHandler('update');
1248
+ this.lastValue = value;
1249
+ }
1250
+ },
1251
+
1252
+ /**
1253
+ * Returns the value of the control. If multiple items
1254
+ * can be selected (e.g. <select multiple>), this returns
1255
+ * an array. If only one item can be selected, this
1256
+ * returns a string.
1257
+ *
1258
+ * @returns {mixed}
1259
+ */
1260
+ getValue: function() {
1261
+ if (this.tagType === TAG_SELECT && this.$input.attr('multiple')) {
1262
+ return this.items;
1263
+ } else {
1264
+ return this.items.join(this.settings.delimiter);
1265
+ }
1266
+ },
1267
+
1268
+ /**
1269
+ * Resets the selected items to the given value.
1270
+ *
1271
+ * @param {mixed} value
1272
+ */
1273
+ setValue: function(value, silent) {
1274
+ var events = silent ? [] : ['change'];
1275
+
1276
+ debounce_events(this, events, function() {
1277
+ this.clear(silent);
1278
+ this.addItems(value, silent);
1279
+ });
1280
+ },
1281
+
1282
+ /**
1283
+ * Sets the selected item.
1284
+ *
1285
+ * @param {object} $item
1286
+ * @param {object} e (optional)
1287
+ */
1288
+ setActiveItem: function($item, e) {
1289
+ var self = this;
1290
+ var eventName;
1291
+ var i, idx, begin, end, item, swap;
1292
+ var $last;
1293
+
1294
+ if (self.settings.mode === 'single') return;
1295
+ $item = $($item);
1296
+
1297
+ // clear the active selection
1298
+ if (!$item.length) {
1299
+ $(self.$activeItems).removeClass('active');
1300
+ self.$activeItems = [];
1301
+ if (self.isFocused) {
1302
+ self.showInput();
1303
+ }
1304
+ return;
1305
+ }
1306
+
1307
+ // modify selection
1308
+ eventName = e && e.type.toLowerCase();
1309
+
1310
+ if (eventName === 'mousedown' && self.isShiftDown && self.$activeItems.length) {
1311
+ $last = self.$control.children('.active:last');
1312
+ begin = Array.prototype.indexOf.apply(self.$control[0].childNodes, [$last[0]]);
1313
+ end = Array.prototype.indexOf.apply(self.$control[0].childNodes, [$item[0]]);
1314
+ if (begin > end) {
1315
+ swap = begin;
1316
+ begin = end;
1317
+ end = swap;
1318
+ }
1319
+ for (i = begin; i <= end; i++) {
1320
+ item = self.$control[0].childNodes[i];
1321
+ if (self.$activeItems.indexOf(item) === -1) {
1322
+ $(item).addClass('active');
1323
+ self.$activeItems.push(item);
1324
+ }
1325
+ }
1326
+ e.preventDefault();
1327
+ } else if ((eventName === 'mousedown' && self.isCtrlDown) || (eventName === 'keydown' && this.isShiftDown)) {
1328
+ if ($item.hasClass('active')) {
1329
+ idx = self.$activeItems.indexOf($item[0]);
1330
+ self.$activeItems.splice(idx, 1);
1331
+ $item.removeClass('active');
1332
+ } else {
1333
+ self.$activeItems.push($item.addClass('active')[0]);
1334
+ }
1335
+ } else {
1336
+ $(self.$activeItems).removeClass('active');
1337
+ self.$activeItems = [$item.addClass('active')[0]];
1338
+ }
1339
+
1340
+ // ensure control has focus
1341
+ self.hideInput();
1342
+ if (!this.isFocused) {
1343
+ self.focus();
1344
+ }
1345
+ },
1346
+
1347
+ /**
1348
+ * Sets the selected item in the dropdown menu
1349
+ * of available options.
1350
+ *
1351
+ * @param {object} $object
1352
+ * @param {boolean} scroll
1353
+ * @param {boolean} animate
1354
+ */
1355
+ setActiveOption: function($option, scroll, animate) {
1356
+ var height_menu, height_item, y;
1357
+ var scroll_top, scroll_bottom;
1358
+ var self = this;
1359
+
1360
+ if (self.$activeOption) self.$activeOption.removeClass('active');
1361
+ self.$activeOption = null;
1362
+
1363
+ $option = $($option);
1364
+ if (!$option.length) return;
1365
+
1366
+ self.$activeOption = $option.addClass('active');
1367
+
1368
+ if (scroll || !isset(scroll)) {
1369
+
1370
+ height_menu = self.$dropdown_content.height();
1371
+ height_item = self.$activeOption.outerHeight(true);
1372
+ scroll = self.$dropdown_content.scrollTop() || 0;
1373
+ y = self.$activeOption.offset().top - self.$dropdown_content.offset().top + scroll;
1374
+ scroll_top = y;
1375
+ scroll_bottom = y - height_menu + height_item;
1376
+
1377
+ if (y + height_item > height_menu + scroll) {
1378
+ self.$dropdown_content.stop().animate({scrollTop: scroll_bottom}, animate ? self.settings.scrollDuration : 0);
1379
+ } else if (y < scroll) {
1380
+ self.$dropdown_content.stop().animate({scrollTop: scroll_top}, animate ? self.settings.scrollDuration : 0);
1381
+ }
1382
+
1383
+ }
1384
+ },
1385
+
1386
+ /**
1387
+ * Selects all items (CTRL + A).
1388
+ */
1389
+ selectAll: function() {
1390
+ var self = this;
1391
+ if (self.settings.mode === 'single') return;
1392
+
1393
+ self.$activeItems = Array.prototype.slice.apply(self.$control.children(':not(input)').addClass('active'));
1394
+ if (self.$activeItems.length) {
1395
+ self.hideInput();
1396
+ self.close();
1397
+ }
1398
+ self.focus();
1399
+ },
1400
+
1401
+ /**
1402
+ * Hides the input element out of view, while
1403
+ * retaining its focus.
1404
+ */
1405
+ hideInput: function() {
1406
+ var self = this;
1407
+
1408
+ self.setTextboxValue('');
1409
+ self.$control_input.css({opacity: 0, position: 'absolute', left: self.rtl ? 10000 : -10000});
1410
+ self.isInputHidden = true;
1411
+ },
1412
+
1413
+ /**
1414
+ * Restores input visibility.
1415
+ */
1416
+ showInput: function() {
1417
+ this.$control_input.css({opacity: 1, position: 'relative', left: 0});
1418
+ this.isInputHidden = false;
1419
+ },
1420
+
1421
+ /**
1422
+ * Gives the control focus.
1423
+ */
1424
+ focus: function() {
1425
+ var self = this;
1426
+ if (self.isDisabled) return;
1427
+
1428
+ self.ignoreFocus = true;
1429
+ self.$control_input[0].focus();
1430
+ window.setTimeout(function() {
1431
+ self.ignoreFocus = false;
1432
+ self.onFocus();
1433
+ }, 0);
1434
+ },
1435
+
1436
+ /**
1437
+ * Forces the control out of focus.
1438
+ *
1439
+ * @param {Element} dest
1440
+ */
1441
+ blur: function(dest) {
1442
+ this.$control_input[0].blur();
1443
+ this.onBlur(null, dest);
1444
+ },
1445
+
1446
+ /**
1447
+ * Returns a function that scores an object
1448
+ * to show how good of a match it is to the
1449
+ * provided query.
1450
+ *
1451
+ * @param {string} query
1452
+ * @param {object} options
1453
+ * @return {function}
1454
+ */
1455
+ getScoreFunction: function(query) {
1456
+ return this.sifter.getScoreFunction(query, this.getSearchOptions());
1457
+ },
1458
+
1459
+ /**
1460
+ * Returns search options for sifter (the system
1461
+ * for scoring and sorting results).
1462
+ *
1463
+ * @see https://github.com/brianreavis/sifter.js
1464
+ * @return {object}
1465
+ */
1466
+ getSearchOptions: function() {
1467
+ var settings = this.settings;
1468
+ var sort = settings.sortField;
1469
+ if (typeof sort === 'string') {
1470
+ sort = [{field: sort}];
1471
+ }
1472
+
1473
+ return {
1474
+ fields : settings.searchField,
1475
+ conjunction : settings.searchConjunction,
1476
+ sort : sort
1477
+ };
1478
+ },
1479
+
1480
+ /**
1481
+ * Searches through available options and returns
1482
+ * a sorted array of matches.
1483
+ *
1484
+ * Returns an object containing:
1485
+ *
1486
+ * - query {string}
1487
+ * - tokens {array}
1488
+ * - total {int}
1489
+ * - items {array}
1490
+ *
1491
+ * @param {string} query
1492
+ * @returns {object}
1493
+ */
1494
+ search: function(query) {
1495
+ var i, value, score, result, calculateScore;
1496
+ var self = this;
1497
+ var settings = self.settings;
1498
+ var options = this.getSearchOptions();
1499
+
1500
+ // validate user-provided result scoring function
1501
+ if (settings.score) {
1502
+ calculateScore = self.settings.score.apply(this, [query]);
1503
+ if (typeof calculateScore !== 'function') {
1504
+ throw new Error('Selectize "score" setting must be a function that returns a function');
1505
+ }
1506
+ }
1507
+
1508
+ // perform search
1509
+ if (query !== self.lastQuery) {
1510
+ self.lastQuery = query;
1511
+ result = self.sifter.search(query, $.extend(options, {score: calculateScore}));
1512
+ self.currentResults = result;
1513
+ } else {
1514
+ result = $.extend(true, {}, self.currentResults);
1515
+ }
1516
+
1517
+ // filter out selected items
1518
+ if (settings.hideSelected) {
1519
+ for (i = result.items.length - 1; i >= 0; i--) {
1520
+ if (self.items.indexOf(hash_key(result.items[i].id)) !== -1) {
1521
+ result.items.splice(i, 1);
1522
+ }
1523
+ }
1524
+ }
1525
+
1526
+ return result;
1527
+ },
1528
+
1529
+ /**
1530
+ * Refreshes the list of available options shown
1531
+ * in the autocomplete dropdown menu.
1532
+ *
1533
+ * @param {boolean} triggerDropdown
1534
+ */
1535
+ refreshOptions: function(triggerDropdown) {
1536
+ var i, j, k, n, groups, groups_order, option, option_html, optgroup, optgroups, html, html_children, has_create_option;
1537
+ var $active, $active_before, $create;
1538
+
1539
+ if (typeof triggerDropdown === 'undefined') {
1540
+ triggerDropdown = true;
1541
+ }
1542
+
1543
+ var self = this;
1544
+ var query = $.trim(self.$control_input.val());
1545
+ var results = self.search(query);
1546
+ var $dropdown_content = self.$dropdown_content;
1547
+ var active_before = self.$activeOption && hash_key(self.$activeOption.attr('data-value'));
1548
+
1549
+ // build markup
1550
+ n = results.items.length;
1551
+ if (typeof self.settings.maxOptions === 'number') {
1552
+ n = Math.min(n, self.settings.maxOptions);
1553
+ }
1554
+
1555
+ // render and group available options individually
1556
+ groups = {};
1557
+ groups_order = [];
1558
+
1559
+ for (i = 0; i < n; i++) {
1560
+ option = self.options[results.items[i].id];
1561
+ option_html = self.render('option', option);
1562
+ optgroup = option[self.settings.optgroupField] || '';
1563
+ optgroups = $.isArray(optgroup) ? optgroup : [optgroup];
1564
+
1565
+ for (j = 0, k = optgroups && optgroups.length; j < k; j++) {
1566
+ optgroup = optgroups[j];
1567
+ if (!self.optgroups.hasOwnProperty(optgroup)) {
1568
+ optgroup = '';
1569
+ }
1570
+ if (!groups.hasOwnProperty(optgroup)) {
1571
+ groups[optgroup] = document.createDocumentFragment();
1572
+ groups_order.push(optgroup);
1573
+ }
1574
+ groups[optgroup].appendChild(option_html);
1575
+ }
1576
+ }
1577
+
1578
+ // sort optgroups
1579
+ if (this.settings.lockOptgroupOrder) {
1580
+ groups_order.sort(function(a, b) {
1581
+ var a_order = self.optgroups[a].$order || 0;
1582
+ var b_order = self.optgroups[b].$order || 0;
1583
+ return a_order - b_order;
1584
+ });
1585
+ }
1586
+
1587
+ // render optgroup headers & join groups
1588
+ html = document.createDocumentFragment();
1589
+ for (i = 0, n = groups_order.length; i < n; i++) {
1590
+ optgroup = groups_order[i];
1591
+ if (self.optgroups.hasOwnProperty(optgroup) && groups[optgroup].childNodes.length) {
1592
+ // render the optgroup header and options within it,
1593
+ // then pass it to the wrapper template
1594
+ html_children = document.createDocumentFragment();
1595
+ html_children.appendChild(self.render('optgroup_header', self.optgroups[optgroup]));
1596
+ html_children.appendChild(groups[optgroup]);
1597
+
1598
+ html.appendChild(self.render('optgroup', $.extend({}, self.optgroups[optgroup], {
1599
+ html: domToString(html_children),
1600
+ dom: html_children
1601
+ })));
1602
+ } else {
1603
+ html.appendChild(groups[optgroup]);
1604
+ }
1605
+ }
1606
+
1607
+ $dropdown_content.html(html);
1608
+
1609
+ // highlight matching terms inline
1610
+ if (self.settings.highlight && results.query.length && results.tokens.length) {
1611
+ $dropdown_content.removeHighlight();
1612
+ for (i = 0, n = results.tokens.length; i < n; i++) {
1613
+ highlight($dropdown_content, results.tokens[i].regex);
1614
+ }
1615
+ }
1616
+
1617
+ // add "selected" class to selected options
1618
+ if (!self.settings.hideSelected) {
1619
+ for (i = 0, n = self.items.length; i < n; i++) {
1620
+ self.getOption(self.items[i]).addClass('selected');
1621
+ }
1622
+ }
1623
+
1624
+ // add create option
1625
+ has_create_option = self.canCreate(query);
1626
+ if (has_create_option) {
1627
+ $dropdown_content.prepend(self.render('option_create', {input: query}));
1628
+ $create = $($dropdown_content[0].childNodes[0]);
1629
+ }
1630
+
1631
+ // activate
1632
+ self.hasOptions = results.items.length > 0 || has_create_option;
1633
+ if (self.hasOptions) {
1634
+ if (results.items.length > 0) {
1635
+ $active_before = active_before && self.getOption(active_before);
1636
+ if ($active_before && $active_before.length) {
1637
+ $active = $active_before;
1638
+ } else if (self.settings.mode === 'single' && self.items.length) {
1639
+ $active = self.getOption(self.items[0]);
1640
+ }
1641
+ if (!$active || !$active.length) {
1642
+ if ($create && !self.settings.addPrecedence) {
1643
+ $active = self.getAdjacentOption($create, 1);
1644
+ } else {
1645
+ $active = $dropdown_content.find('[data-selectable]:first');
1646
+ }
1647
+ }
1648
+ } else {
1649
+ $active = $create;
1650
+ }
1651
+ self.setActiveOption($active);
1652
+ if (triggerDropdown && !self.isOpen) { self.open(); }
1653
+ } else {
1654
+ self.setActiveOption(null);
1655
+ if (triggerDropdown && self.isOpen) { self.close(); }
1656
+ }
1657
+ },
1658
+
1659
+ /**
1660
+ * Adds an available option. If it already exists,
1661
+ * nothing will happen. Note: this does not refresh
1662
+ * the options list dropdown (use `refreshOptions`
1663
+ * for that).
1664
+ *
1665
+ * Usage:
1666
+ *
1667
+ * this.addOption(data)
1668
+ *
1669
+ * @param {object|array} data
1670
+ */
1671
+ addOption: function(data) {
1672
+ var i, n, value, self = this;
1673
+
1674
+ if ($.isArray(data)) {
1675
+ for (i = 0, n = data.length; i < n; i++) {
1676
+ self.addOption(data[i]);
1677
+ }
1678
+ return;
1679
+ }
1680
+
1681
+ if (value = self.registerOption(data)) {
1682
+ self.userOptions[value] = true;
1683
+ self.lastQuery = null;
1684
+ self.trigger('option_add', value, data);
1685
+ }
1686
+ },
1687
+
1688
+ /**
1689
+ * Registers an option to the pool of options.
1690
+ *
1691
+ * @param {object} data
1692
+ * @return {boolean|string}
1693
+ */
1694
+ registerOption: function(data) {
1695
+ var key = hash_key(data[this.settings.valueField]);
1696
+ if (typeof key === 'undefined' || key === null || this.options.hasOwnProperty(key)) return false;
1697
+ data.$order = data.$order || ++this.order;
1698
+ this.options[key] = data;
1699
+ return key;
1700
+ },
1701
+
1702
+ /**
1703
+ * Registers an option group to the pool of option groups.
1704
+ *
1705
+ * @param {object} data
1706
+ * @return {boolean|string}
1707
+ */
1708
+ registerOptionGroup: function(data) {
1709
+ var key = hash_key(data[this.settings.optgroupValueField]);
1710
+ if (!key) return false;
1711
+
1712
+ data.$order = data.$order || ++this.order;
1713
+ this.optgroups[key] = data;
1714
+ return key;
1715
+ },
1716
+
1717
+ /**
1718
+ * Registers a new optgroup for options
1719
+ * to be bucketed into.
1720
+ *
1721
+ * @param {string} id
1722
+ * @param {object} data
1723
+ */
1724
+ addOptionGroup: function(id, data) {
1725
+ data[this.settings.optgroupValueField] = id;
1726
+ if (id = this.registerOptionGroup(data)) {
1727
+ this.trigger('optgroup_add', id, data);
1728
+ }
1729
+ },
1730
+
1731
+ /**
1732
+ * Removes an existing option group.
1733
+ *
1734
+ * @param {string} id
1735
+ */
1736
+ removeOptionGroup: function(id) {
1737
+ if (this.optgroups.hasOwnProperty(id)) {
1738
+ delete this.optgroups[id];
1739
+ this.renderCache = {};
1740
+ this.trigger('optgroup_remove', id);
1741
+ }
1742
+ },
1743
+
1744
+ /**
1745
+ * Clears all existing option groups.
1746
+ */
1747
+ clearOptionGroups: function() {
1748
+ this.optgroups = {};
1749
+ this.renderCache = {};
1750
+ this.trigger('optgroup_clear');
1751
+ },
1752
+
1753
+ /**
1754
+ * Updates an option available for selection. If
1755
+ * it is visible in the selected items or options
1756
+ * dropdown, it will be re-rendered automatically.
1757
+ *
1758
+ * @param {string} value
1759
+ * @param {object} data
1760
+ */
1761
+ updateOption: function(value, data) {
1762
+ var self = this;
1763
+ var $item, $item_new;
1764
+ var value_new, index_item, cache_items, cache_options, order_old;
1765
+
1766
+ value = hash_key(value);
1767
+ value_new = hash_key(data[self.settings.valueField]);
1768
+
1769
+ // sanity checks
1770
+ if (value === null) return;
1771
+ if (!self.options.hasOwnProperty(value)) return;
1772
+ if (typeof value_new !== 'string') throw new Error('Value must be set in option data');
1773
+
1774
+ order_old = self.options[value].$order;
1775
+
1776
+ // update references
1777
+ if (value_new !== value) {
1778
+ delete self.options[value];
1779
+ index_item = self.items.indexOf(value);
1780
+ if (index_item !== -1) {
1781
+ self.items.splice(index_item, 1, value_new);
1782
+ }
1783
+ }
1784
+ data.$order = data.$order || order_old;
1785
+ self.options[value_new] = data;
1786
+
1787
+ // invalidate render cache
1788
+ cache_items = self.renderCache['item'];
1789
+ cache_options = self.renderCache['option'];
1790
+
1791
+ if (cache_items) {
1792
+ delete cache_items[value];
1793
+ delete cache_items[value_new];
1794
+ }
1795
+ if (cache_options) {
1796
+ delete cache_options[value];
1797
+ delete cache_options[value_new];
1798
+ }
1799
+
1800
+ // update the item if it's selected
1801
+ if (self.items.indexOf(value_new) !== -1) {
1802
+ $item = self.getItem(value);
1803
+ $item_new = $(self.render('item', data));
1804
+ if ($item.hasClass('active')) $item_new.addClass('active');
1805
+ $item.replaceWith($item_new);
1806
+ }
1807
+
1808
+ // invalidate last query because we might have updated the sortField
1809
+ self.lastQuery = null;
1810
+
1811
+ // update dropdown contents
1812
+ if (self.isOpen) {
1813
+ self.refreshOptions(false);
1814
+ }
1815
+ },
1816
+
1817
+ /**
1818
+ * Removes a single option.
1819
+ *
1820
+ * @param {string} value
1821
+ * @param {boolean} silent
1822
+ */
1823
+ removeOption: function(value, silent) {
1824
+ var self = this;
1825
+ value = hash_key(value);
1826
+
1827
+ var cache_items = self.renderCache['item'];
1828
+ var cache_options = self.renderCache['option'];
1829
+ if (cache_items) delete cache_items[value];
1830
+ if (cache_options) delete cache_options[value];
1831
+
1832
+ delete self.userOptions[value];
1833
+ delete self.options[value];
1834
+ self.lastQuery = null;
1835
+ self.trigger('option_remove', value);
1836
+ self.removeItem(value, silent);
1837
+ },
1838
+
1839
+ /**
1840
+ * Clears all options.
1841
+ */
1842
+ clearOptions: function() {
1843
+ var self = this;
1844
+
1845
+ self.loadedSearches = {};
1846
+ self.userOptions = {};
1847
+ self.renderCache = {};
1848
+ self.options = self.sifter.items = {};
1849
+ self.lastQuery = null;
1850
+ self.trigger('option_clear');
1851
+ self.clear();
1852
+ },
1853
+
1854
+ /**
1855
+ * Returns the jQuery element of the option
1856
+ * matching the given value.
1857
+ *
1858
+ * @param {string} value
1859
+ * @returns {object}
1860
+ */
1861
+ getOption: function(value) {
1862
+ return this.getElementWithValue(value, this.$dropdown_content.find('[data-selectable]'));
1863
+ },
1864
+
1865
+ /**
1866
+ * Returns the jQuery element of the next or
1867
+ * previous selectable option.
1868
+ *
1869
+ * @param {object} $option
1870
+ * @param {int} direction can be 1 for next or -1 for previous
1871
+ * @return {object}
1872
+ */
1873
+ getAdjacentOption: function($option, direction) {
1874
+ var $options = this.$dropdown.find('[data-selectable]');
1875
+ var index = $options.index($option) + direction;
1876
+
1877
+ return index >= 0 && index < $options.length ? $options.eq(index) : $();
1878
+ },
1879
+
1880
+ /**
1881
+ * Finds the first element with a "data-value" attribute
1882
+ * that matches the given value.
1883
+ *
1884
+ * @param {mixed} value
1885
+ * @param {object} $els
1886
+ * @return {object}
1887
+ */
1888
+ getElementWithValue: function(value, $els) {
1889
+ value = hash_key(value);
1890
+
1891
+ if (typeof value !== 'undefined' && value !== null) {
1892
+ for (var i = 0, n = $els.length; i < n; i++) {
1893
+ if ($els[i].getAttribute('data-value') === value) {
1894
+ return $($els[i]);
1895
+ }
1896
+ }
1897
+ }
1898
+
1899
+ return $();
1900
+ },
1901
+
1902
+ /**
1903
+ * Returns the jQuery element of the item
1904
+ * matching the given value.
1905
+ *
1906
+ * @param {string} value
1907
+ * @returns {object}
1908
+ */
1909
+ getItem: function(value) {
1910
+ return this.getElementWithValue(value, this.$control.children());
1911
+ },
1912
+
1913
+ /**
1914
+ * "Selects" multiple items at once. Adds them to the list
1915
+ * at the current caret position.
1916
+ *
1917
+ * @param {string} value
1918
+ * @param {boolean} silent
1919
+ */
1920
+ addItems: function(values, silent) {
1921
+ var items = $.isArray(values) ? values : [values];
1922
+ for (var i = 0, n = items.length; i < n; i++) {
1923
+ this.isPending = (i < n - 1);
1924
+ this.addItem(items[i], silent);
1925
+ }
1926
+ },
1927
+
1928
+ /**
1929
+ * "Selects" an item. Adds it to the list
1930
+ * at the current caret position.
1931
+ *
1932
+ * @param {string} value
1933
+ * @param {boolean} silent
1934
+ */
1935
+ addItem: function(value, silent) {
1936
+ var events = silent ? [] : ['change'];
1937
+
1938
+ debounce_events(this, events, function() {
1939
+ var $item, $option, $options;
1940
+ var self = this;
1941
+ var inputMode = self.settings.mode;
1942
+ var i, active, value_next, wasFull;
1943
+ value = hash_key(value);
1944
+
1945
+ if (self.items.indexOf(value) !== -1) {
1946
+ if (inputMode === 'single') self.close();
1947
+ return;
1948
+ }
1949
+
1950
+ if (!self.options.hasOwnProperty(value)) return;
1951
+ if (inputMode === 'single') self.clear(silent);
1952
+ if (inputMode === 'multi' && self.isFull()) return;
1953
+
1954
+ $item = $(self.render('item', self.options[value]));
1955
+ wasFull = self.isFull();
1956
+ self.items.splice(self.caretPos, 0, value);
1957
+ self.insertAtCaret($item);
1958
+ if (!self.isPending || (!wasFull && self.isFull())) {
1959
+ self.refreshState();
1960
+ }
1961
+
1962
+ if (self.isSetup) {
1963
+ $options = self.$dropdown_content.find('[data-selectable]');
1964
+
1965
+ // update menu / remove the option (if this is not one item being added as part of series)
1966
+ if (!self.isPending) {
1967
+ $option = self.getOption(value);
1968
+ value_next = self.getAdjacentOption($option, 1).attr('data-value');
1969
+ self.refreshOptions(self.isFocused && inputMode !== 'single');
1970
+ if (value_next) {
1971
+ self.setActiveOption(self.getOption(value_next));
1972
+ }
1973
+ }
1974
+
1975
+ // hide the menu if the maximum number of items have been selected or no options are left
1976
+ if (!$options.length || self.isFull()) {
1977
+ self.close();
1978
+ } else {
1979
+ self.positionDropdown();
1980
+ }
1981
+
1982
+ self.updatePlaceholder();
1983
+ self.trigger('item_add', value, $item);
1984
+ self.updateOriginalInput({silent: silent});
1985
+ }
1986
+ });
1987
+ },
1988
+
1989
+ /**
1990
+ * Removes the selected item matching
1991
+ * the provided value.
1992
+ *
1993
+ * @param {string} value
1994
+ */
1995
+ removeItem: function(value, silent) {
1996
+ var self = this;
1997
+ var $item, i, idx;
1998
+
1999
+ $item = (value instanceof $) ? value : self.getItem(value);
2000
+ value = hash_key($item.attr('data-value'));
2001
+ i = self.items.indexOf(value);
2002
+
2003
+ if (i !== -1) {
2004
+ $item.remove();
2005
+ if ($item.hasClass('active')) {
2006
+ idx = self.$activeItems.indexOf($item[0]);
2007
+ self.$activeItems.splice(idx, 1);
2008
+ }
2009
+
2010
+ self.items.splice(i, 1);
2011
+ self.lastQuery = null;
2012
+ if (!self.settings.persist && self.userOptions.hasOwnProperty(value)) {
2013
+ self.removeOption(value, silent);
2014
+ }
2015
+
2016
+ if (i < self.caretPos) {
2017
+ self.setCaret(self.caretPos - 1);
2018
+ }
2019
+
2020
+ self.refreshState();
2021
+ self.updatePlaceholder();
2022
+ self.updateOriginalInput({silent: silent});
2023
+ self.positionDropdown();
2024
+ self.trigger('item_remove', value, $item);
2025
+ }
2026
+ },
2027
+
2028
+ /**
2029
+ * Invokes the `create` method provided in the
2030
+ * selectize options that should provide the data
2031
+ * for the new item, given the user input.
2032
+ *
2033
+ * Once this completes, it will be added
2034
+ * to the item list.
2035
+ *
2036
+ * @param {string} value
2037
+ * @param {boolean} [triggerDropdown]
2038
+ * @param {function} [callback]
2039
+ * @return {boolean}
2040
+ */
2041
+ createItem: function(input, triggerDropdown) {
2042
+ var self = this;
2043
+ var caret = self.caretPos;
2044
+ input = input || $.trim(self.$control_input.val() || '');
2045
+
2046
+ var callback = arguments[arguments.length - 1];
2047
+ if (typeof callback !== 'function') callback = function() {};
2048
+
2049
+ if (typeof triggerDropdown !== 'boolean') {
2050
+ triggerDropdown = true;
2051
+ }
2052
+
2053
+ if (!self.canCreate(input)) {
2054
+ callback();
2055
+ return false;
2056
+ }
2057
+
2058
+ self.lock();
2059
+
2060
+ var setup = (typeof self.settings.create === 'function') ? this.settings.create : function(input) {
2061
+ var data = {};
2062
+ data[self.settings.labelField] = input;
2063
+ data[self.settings.valueField] = input;
2064
+ return data;
2065
+ };
2066
+
2067
+ var create = once(function(data) {
2068
+ self.unlock();
2069
+
2070
+ if (!data || typeof data !== 'object') return callback();
2071
+ var value = hash_key(data[self.settings.valueField]);
2072
+ if (typeof value !== 'string') return callback();
2073
+
2074
+ self.setTextboxValue('');
2075
+ self.addOption(data);
2076
+ self.setCaret(caret);
2077
+ self.addItem(value);
2078
+ self.refreshOptions(triggerDropdown && self.settings.mode !== 'single');
2079
+ callback(data);
2080
+ });
2081
+
2082
+ var output = setup.apply(this, [input, create]);
2083
+ if (typeof output !== 'undefined') {
2084
+ create(output);
2085
+ }
2086
+
2087
+ return true;
2088
+ },
2089
+
2090
+ /**
2091
+ * Re-renders the selected item lists.
2092
+ */
2093
+ refreshItems: function() {
2094
+ this.lastQuery = null;
2095
+
2096
+ if (this.isSetup) {
2097
+ this.addItem(this.items);
2098
+ }
2099
+
2100
+ this.refreshState();
2101
+ this.updateOriginalInput();
2102
+ },
2103
+
2104
+ /**
2105
+ * Updates all state-dependent attributes
2106
+ * and CSS classes.
2107
+ */
2108
+ refreshState: function() {
2109
+ this.refreshValidityState();
2110
+ this.refreshClasses();
2111
+ },
2112
+
2113
+ /**
2114
+ * Update the `required` attribute of both input and control input.
2115
+ *
2116
+ * The `required` property needs to be activated on the control input
2117
+ * for the error to be displayed at the right place. `required` also
2118
+ * needs to be temporarily deactivated on the input since the input is
2119
+ * hidden and can't show errors.
2120
+ */
2121
+ refreshValidityState: function() {
2122
+ if (!this.isRequired) return false;
2123
+
2124
+ var invalid = !this.items.length;
2125
+
2126
+ this.isInvalid = invalid;
2127
+ this.$control_input.prop('required', invalid);
2128
+ this.$input.prop('required', !invalid);
2129
+ },
2130
+
2131
+ /**
2132
+ * Updates all state-dependent CSS classes.
2133
+ */
2134
+ refreshClasses: function() {
2135
+ var self = this;
2136
+ var isFull = self.isFull();
2137
+ var isLocked = self.isLocked;
2138
+
2139
+ self.$wrapper
2140
+ .toggleClass('rtl', self.rtl);
2141
+
2142
+ self.$control
2143
+ .toggleClass('focus', self.isFocused)
2144
+ .toggleClass('disabled', self.isDisabled)
2145
+ .toggleClass('required', self.isRequired)
2146
+ .toggleClass('invalid', self.isInvalid)
2147
+ .toggleClass('locked', isLocked)
2148
+ .toggleClass('full', isFull).toggleClass('not-full', !isFull)
2149
+ .toggleClass('input-active', self.isFocused && !self.isInputHidden)
2150
+ .toggleClass('dropdown-active', self.isOpen)
2151
+ .toggleClass('has-options', !$.isEmptyObject(self.options))
2152
+ .toggleClass('has-items', self.items.length > 0);
2153
+
2154
+ self.$control_input.data('grow', !isFull && !isLocked);
2155
+ },
2156
+
2157
+ /**
2158
+ * Determines whether or not more items can be added
2159
+ * to the control without exceeding the user-defined maximum.
2160
+ *
2161
+ * @returns {boolean}
2162
+ */
2163
+ isFull: function() {
2164
+ return this.settings.maxItems !== null && this.items.length >= this.settings.maxItems;
2165
+ },
2166
+
2167
+ /**
2168
+ * Refreshes the original <select> or <input>
2169
+ * element to reflect the current state.
2170
+ */
2171
+ updateOriginalInput: function(opts) {
2172
+ var i, n, options, label, self = this;
2173
+ opts = opts || {};
2174
+
2175
+ if (self.tagType === TAG_SELECT) {
2176
+ options = [];
2177
+ for (i = 0, n = self.items.length; i < n; i++) {
2178
+ label = self.options[self.items[i]][self.settings.labelField] || '';
2179
+ options.push('<option value="' + escape_html(self.items[i]) + '" selected="selected">' + escape_html(label) + '</option>');
2180
+ }
2181
+ if (!options.length && !this.$input.attr('multiple')) {
2182
+ options.push('<option value="" selected="selected"></option>');
2183
+ }
2184
+ self.$input.html(options.join(''));
2185
+ } else {
2186
+ self.$input.val(self.getValue());
2187
+ self.$input.attr('value',self.$input.val());
2188
+ }
2189
+
2190
+ if (self.isSetup) {
2191
+ if (!opts.silent) {
2192
+ self.trigger('change', self.$input.val());
2193
+ }
2194
+ }
2195
+ },
2196
+
2197
+ /**
2198
+ * Shows/hide the input placeholder depending
2199
+ * on if there items in the list already.
2200
+ */
2201
+ updatePlaceholder: function() {
2202
+ if (!this.settings.placeholder) return;
2203
+ var $input = this.$control_input;
2204
+
2205
+ if (this.items.length) {
2206
+ $input.removeAttr('placeholder');
2207
+ } else {
2208
+ $input.attr('placeholder', this.settings.placeholder);
2209
+ }
2210
+ $input.triggerHandler('update', {force: true});
2211
+ },
2212
+
2213
+ /**
2214
+ * Shows the autocomplete dropdown containing
2215
+ * the available options.
2216
+ */
2217
+ open: function() {
2218
+ var self = this;
2219
+
2220
+ if (self.isLocked || self.isOpen || (self.settings.mode === 'multi' && self.isFull())) return;
2221
+ self.focus();
2222
+ self.isOpen = true;
2223
+ self.refreshState();
2224
+ self.$dropdown.css({visibility: 'hidden', display: 'block'});
2225
+ self.positionDropdown();
2226
+ self.$dropdown.css({visibility: 'visible'});
2227
+ self.trigger('dropdown_open', self.$dropdown);
2228
+ },
2229
+
2230
+ /**
2231
+ * Closes the autocomplete dropdown menu.
2232
+ */
2233
+ close: function() {
2234
+ var self = this;
2235
+ var trigger = self.isOpen;
2236
+
2237
+ if (self.settings.mode === 'single' && self.items.length) {
2238
+ self.hideInput();
2239
+ self.$control_input.blur(); // close keyboard on iOS
2240
+ }
2241
+
2242
+ self.isOpen = false;
2243
+ self.$dropdown.hide();
2244
+ self.setActiveOption(null);
2245
+ self.refreshState();
2246
+
2247
+ if (trigger) self.trigger('dropdown_close', self.$dropdown);
2248
+ },
2249
+
2250
+ /**
2251
+ * Calculates and applies the appropriate
2252
+ * position of the dropdown.
2253
+ */
2254
+ positionDropdown: function() {
2255
+ var $control = this.$control;
2256
+ var offset = this.settings.dropdownParent === 'body' ? $control.offset() : $control.position();
2257
+ offset.top += $control.outerHeight(true);
2258
+
2259
+ this.$dropdown.css({
2260
+ width : $control.outerWidth(),
2261
+ top : offset.top,
2262
+ left : offset.left
2263
+ });
2264
+ },
2265
+
2266
+ /**
2267
+ * Resets / clears all selected items
2268
+ * from the control.
2269
+ *
2270
+ * @param {boolean} silent
2271
+ */
2272
+ clear: function(silent) {
2273
+ var self = this;
2274
+
2275
+ if (!self.items.length) return;
2276
+ self.$control.children(':not(input)').remove();
2277
+ self.items = [];
2278
+ self.lastQuery = null;
2279
+ self.setCaret(0);
2280
+ self.setActiveItem(null);
2281
+ self.updatePlaceholder();
2282
+ self.updateOriginalInput({silent: silent});
2283
+ self.refreshState();
2284
+ self.showInput();
2285
+ self.trigger('clear');
2286
+ },
2287
+
2288
+ /**
2289
+ * A helper method for inserting an element
2290
+ * at the current caret position.
2291
+ *
2292
+ * @param {object} $el
2293
+ */
2294
+ insertAtCaret: function($el) {
2295
+ var caret = Math.min(this.caretPos, this.items.length);
2296
+ if (caret === 0) {
2297
+ this.$control.prepend($el);
2298
+ } else {
2299
+ $(this.$control[0].childNodes[caret]).before($el);
2300
+ }
2301
+ this.setCaret(caret + 1);
2302
+ },
2303
+
2304
+ /**
2305
+ * Removes the current selected item(s).
2306
+ *
2307
+ * @param {object} e (optional)
2308
+ * @returns {boolean}
2309
+ */
2310
+ deleteSelection: function(e) {
2311
+ var i, n, direction, selection, values, caret, option_select, $option_select, $tail;
2312
+ var self = this;
2313
+
2314
+ direction = (e && e.keyCode === KEY_BACKSPACE) ? -1 : 1;
2315
+ selection = getSelection(self.$control_input[0]);
2316
+
2317
+ if (self.$activeOption && !self.settings.hideSelected) {
2318
+ option_select = self.getAdjacentOption(self.$activeOption, -1).attr('data-value');
2319
+ }
2320
+
2321
+ // determine items that will be removed
2322
+ values = [];
2323
+
2324
+ if (self.$activeItems.length) {
2325
+ $tail = self.$control.children('.active:' + (direction > 0 ? 'last' : 'first'));
2326
+ caret = self.$control.children(':not(input)').index($tail);
2327
+ if (direction > 0) { caret++; }
2328
+
2329
+ for (i = 0, n = self.$activeItems.length; i < n; i++) {
2330
+ values.push($(self.$activeItems[i]).attr('data-value'));
2331
+ }
2332
+ if (e) {
2333
+ e.preventDefault();
2334
+ e.stopPropagation();
2335
+ }
2336
+ } else if ((self.isFocused || self.settings.mode === 'single') && self.items.length) {
2337
+ if (direction < 0 && selection.start === 0 && selection.length === 0) {
2338
+ values.push(self.items[self.caretPos - 1]);
2339
+ } else if (direction > 0 && selection.start === self.$control_input.val().length) {
2340
+ values.push(self.items[self.caretPos]);
2341
+ }
2342
+ }
2343
+
2344
+ // allow the callback to abort
2345
+ if (!values.length || (typeof self.settings.onDelete === 'function' && self.settings.onDelete.apply(self, [values]) === false)) {
2346
+ return false;
2347
+ }
2348
+
2349
+ // perform removal
2350
+ if (typeof caret !== 'undefined') {
2351
+ self.setCaret(caret);
2352
+ }
2353
+ while (values.length) {
2354
+ self.removeItem(values.pop());
2355
+ }
2356
+
2357
+ self.showInput();
2358
+ self.positionDropdown();
2359
+ self.refreshOptions(true);
2360
+
2361
+ // select previous option
2362
+ if (option_select) {
2363
+ $option_select = self.getOption(option_select);
2364
+ if ($option_select.length) {
2365
+ self.setActiveOption($option_select);
2366
+ }
2367
+ }
2368
+
2369
+ return true;
2370
+ },
2371
+
2372
+ /**
2373
+ * Selects the previous / next item (depending
2374
+ * on the `direction` argument).
2375
+ *
2376
+ * > 0 - right
2377
+ * < 0 - left
2378
+ *
2379
+ * @param {int} direction
2380
+ * @param {object} e (optional)
2381
+ */
2382
+ advanceSelection: function(direction, e) {
2383
+ var tail, selection, idx, valueLength, cursorAtEdge, $tail;
2384
+ var self = this;
2385
+
2386
+ if (direction === 0) return;
2387
+ if (self.rtl) direction *= -1;
2388
+
2389
+ tail = direction > 0 ? 'last' : 'first';
2390
+ selection = getSelection(self.$control_input[0]);
2391
+
2392
+ if (self.isFocused && !self.isInputHidden) {
2393
+ valueLength = self.$control_input.val().length;
2394
+ cursorAtEdge = direction < 0
2395
+ ? selection.start === 0 && selection.length === 0
2396
+ : selection.start === valueLength;
2397
+
2398
+ if (cursorAtEdge && !valueLength) {
2399
+ self.advanceCaret(direction, e);
2400
+ }
2401
+ } else {
2402
+ $tail = self.$control.children('.active:' + tail);
2403
+ if ($tail.length) {
2404
+ idx = self.$control.children(':not(input)').index($tail);
2405
+ self.setActiveItem(null);
2406
+ self.setCaret(direction > 0 ? idx + 1 : idx);
2407
+ }
2408
+ }
2409
+ },
2410
+
2411
+ /**
2412
+ * Moves the caret left / right.
2413
+ *
2414
+ * @param {int} direction
2415
+ * @param {object} e (optional)
2416
+ */
2417
+ advanceCaret: function(direction, e) {
2418
+ var self = this, fn, $adj;
2419
+
2420
+ if (direction === 0) return;
2421
+
2422
+ fn = direction > 0 ? 'next' : 'prev';
2423
+ if (self.isShiftDown) {
2424
+ $adj = self.$control_input[fn]();
2425
+ if ($adj.length) {
2426
+ self.hideInput();
2427
+ self.setActiveItem($adj);
2428
+ e && e.preventDefault();
2429
+ }
2430
+ } else {
2431
+ self.setCaret(self.caretPos + direction);
2432
+ }
2433
+ },
2434
+
2435
+ /**
2436
+ * Moves the caret to the specified index.
2437
+ *
2438
+ * @param {int} i
2439
+ */
2440
+ setCaret: function(i) {
2441
+ var self = this;
2442
+
2443
+ if (self.settings.mode === 'single') {
2444
+ i = self.items.length;
2445
+ } else {
2446
+ i = Math.max(0, Math.min(self.items.length, i));
2447
+ }
2448
+
2449
+ if(!self.isPending) {
2450
+ // the input must be moved by leaving it in place and moving the
2451
+ // siblings, due to the fact that focus cannot be restored once lost
2452
+ // on mobile webkit devices
2453
+ var j, n, fn, $children, $child;
2454
+ $children = self.$control.children(':not(input)');
2455
+ for (j = 0, n = $children.length; j < n; j++) {
2456
+ $child = $($children[j]).detach();
2457
+ if (j < i) {
2458
+ self.$control_input.before($child);
2459
+ } else {
2460
+ self.$control.append($child);
2461
+ }
2462
+ }
2463
+ }
2464
+
2465
+ self.caretPos = i;
2466
+ },
2467
+
2468
+ /**
2469
+ * Disables user input on the control. Used while
2470
+ * items are being asynchronously created.
2471
+ */
2472
+ lock: function() {
2473
+ this.close();
2474
+ this.isLocked = true;
2475
+ this.refreshState();
2476
+ },
2477
+
2478
+ /**
2479
+ * Re-enables user input on the control.
2480
+ */
2481
+ unlock: function() {
2482
+ this.isLocked = false;
2483
+ this.refreshState();
2484
+ },
2485
+
2486
+ /**
2487
+ * Disables user input on the control completely.
2488
+ * While disabled, it cannot receive focus.
2489
+ */
2490
+ disable: function() {
2491
+ var self = this;
2492
+ self.$input.prop('disabled', true);
2493
+ self.$control_input.prop('disabled', true).prop('tabindex', -1);
2494
+ self.isDisabled = true;
2495
+ self.lock();
2496
+ },
2497
+
2498
+ /**
2499
+ * Enables the control so that it can respond
2500
+ * to focus and user input.
2501
+ */
2502
+ enable: function() {
2503
+ var self = this;
2504
+ self.$input.prop('disabled', false);
2505
+ self.$control_input.prop('disabled', false).prop('tabindex', self.tabIndex);
2506
+ self.isDisabled = false;
2507
+ self.unlock();
2508
+ },
2509
+
2510
+ /**
2511
+ * Completely destroys the control and
2512
+ * unbinds all event listeners so that it can
2513
+ * be garbage collected.
2514
+ */
2515
+ destroy: function() {
2516
+ var self = this;
2517
+ var eventNS = self.eventNS;
2518
+ var revertSettings = self.revertSettings;
2519
+
2520
+ self.trigger('destroy');
2521
+ self.off();
2522
+ self.$wrapper.remove();
2523
+ self.$dropdown.remove();
2524
+
2525
+ self.$input
2526
+ .html('')
2527
+ .append(revertSettings.$children)
2528
+ .removeAttr('tabindex')
2529
+ .removeClass('selectized')
2530
+ .attr({tabindex: revertSettings.tabindex})
2531
+ .show();
2532
+
2533
+ self.$control_input.removeData('grow');
2534
+ self.$input.removeData('selectize');
2535
+
2536
+ $(window).off(eventNS);
2537
+ $(document).off(eventNS);
2538
+ $(document.body).off(eventNS);
2539
+
2540
+ delete self.$input[0].selectize;
2541
+ },
2542
+
2543
+ /**
2544
+ * A helper method for rendering "item" and
2545
+ * "option" templates, given the data.
2546
+ *
2547
+ * @param {string} templateName
2548
+ * @param {object} data
2549
+ * @returns {string}
2550
+ */
2551
+ render: function(templateName, data) {
2552
+ var value, id, label;
2553
+ var html = '';
2554
+ var cache = false;
2555
+ var self = this;
2556
+ var regex_tag = /^[\t \r\n]*<([a-z][a-z0-9\-_]*(?:\:[a-z][a-z0-9\-_]*)?)/i;
2557
+
2558
+ if (templateName === 'option' || templateName === 'item') {
2559
+ value = hash_key(data[self.settings.valueField]);
2560
+ cache = !!value;
2561
+ }
2562
+
2563
+ // pull markup from cache if it exists
2564
+ if (cache) {
2565
+ if (!isset(self.renderCache[templateName])) {
2566
+ self.renderCache[templateName] = {};
2567
+ }
2568
+ if (self.renderCache[templateName].hasOwnProperty(value)) {
2569
+ return self.renderCache[templateName][value];
2570
+ }
2571
+ }
2572
+
2573
+ // render markup
2574
+ html = $(self.settings.render[templateName].apply(this, [data, escape_html]));
2575
+
2576
+ // add mandatory attributes
2577
+ if (templateName === 'option' || templateName === 'option_create') {
2578
+ html.attr('data-selectable', '');
2579
+ }
2580
+ else if (templateName === 'optgroup') {
2581
+ id = data[self.settings.optgroupValueField] || '';
2582
+ html.attr('data-group', id);
2583
+ }
2584
+ if (templateName === 'option' || templateName === 'item') {
2585
+ html.attr('data-value', value || '');
2586
+ }
2587
+
2588
+ // update cache
2589
+ if (cache) {
2590
+ self.renderCache[templateName][value] = html[0];
2591
+ }
2592
+
2593
+ return html[0];
2594
+ },
2595
+
2596
+ /**
2597
+ * Clears the render cache for a template. If
2598
+ * no template is given, clears all render
2599
+ * caches.
2600
+ *
2601
+ * @param {string} templateName
2602
+ */
2603
+ clearCache: function(templateName) {
2604
+ var self = this;
2605
+ if (typeof templateName === 'undefined') {
2606
+ self.renderCache = {};
2607
+ } else {
2608
+ delete self.renderCache[templateName];
2609
+ }
2610
+ },
2611
+
2612
+ /**
2613
+ * Determines whether or not to display the
2614
+ * create item prompt, given a user input.
2615
+ *
2616
+ * @param {string} input
2617
+ * @return {boolean}
2618
+ */
2619
+ canCreate: function(input) {
2620
+ var self = this;
2621
+ if (!self.settings.create) return false;
2622
+ var filter = self.settings.createFilter;
2623
+ return input.length
2624
+ && (typeof filter !== 'function' || filter.apply(self, [input]))
2625
+ && (typeof filter !== 'string' || new RegExp(filter).test(input))
2626
+ && (!(filter instanceof RegExp) || filter.test(input));
2627
+ }
2628
+
2629
+ });
2630
+
2631
+
2632
+ Selectize.count = 0;
2633
+ Selectize.defaults = {
2634
+ options: [],
2635
+ optgroups: [],
2636
+
2637
+ plugins: [],
2638
+ delimiter: ',',
2639
+ splitOn: null, // regexp or string for splitting up values from a paste command
2640
+ persist: true,
2641
+ diacritics: true,
2642
+ create: false,
2643
+ createOnBlur: false,
2644
+ createFilter: null,
2645
+ highlight: true,
2646
+ openOnFocus: true,
2647
+ maxOptions: 1000,
2648
+ maxItems: null,
2649
+ hideSelected: null,
2650
+ addPrecedence: false,
2651
+ selectOnTab: false,
2652
+ preload: false,
2653
+ allowEmptyOption: false,
2654
+ closeAfterSelect: false,
2655
+
2656
+ scrollDuration: 60,
2657
+ loadThrottle: 300,
2658
+ loadingClass: 'loading',
2659
+
2660
+ dataAttr: 'data-data',
2661
+ optgroupField: 'optgroup',
2662
+ valueField: 'value',
2663
+ labelField: 'text',
2664
+ optgroupLabelField: 'label',
2665
+ optgroupValueField: 'value',
2666
+ lockOptgroupOrder: false,
2667
+
2668
+ sortField: '$order',
2669
+ searchField: ['text'],
2670
+ searchConjunction: 'and',
2671
+
2672
+ mode: null,
2673
+ wrapperClass: 'selectize-control',
2674
+ inputClass: 'selectize-input',
2675
+ dropdownClass: 'selectize-dropdown',
2676
+ dropdownContentClass: 'selectize-dropdown-content',
2677
+
2678
+ dropdownParent: null,
2679
+
2680
+ copyClassesToDropdown: true,
2681
+
2682
+ /*
2683
+ load : null, // function(query, callback) { ... }
2684
+ score : null, // function(search) { ... }
2685
+ onInitialize : null, // function() { ... }
2686
+ onChange : null, // function(value) { ... }
2687
+ onItemAdd : null, // function(value, $item) { ... }
2688
+ onItemRemove : null, // function(value) { ... }
2689
+ onClear : null, // function() { ... }
2690
+ onOptionAdd : null, // function(value, data) { ... }
2691
+ onOptionRemove : null, // function(value) { ... }
2692
+ onOptionClear : null, // function() { ... }
2693
+ onOptionGroupAdd : null, // function(id, data) { ... }
2694
+ onOptionGroupRemove : null, // function(id) { ... }
2695
+ onOptionGroupClear : null, // function() { ... }
2696
+ onDropdownOpen : null, // function($dropdown) { ... }
2697
+ onDropdownClose : null, // function($dropdown) { ... }
2698
+ onType : null, // function(str) { ... }
2699
+ onDelete : null, // function(values) { ... }
2700
+ */
2701
+
2702
+ render: {
2703
+ /*
2704
+ item: null,
2705
+ optgroup: null,
2706
+ optgroup_header: null,
2707
+ option: null,
2708
+ option_create: null
2709
+ */
2710
+ }
2711
+ };
2712
+
2713
+
2714
+ $.fn.selectize = function(settings_user) {
2715
+ var defaults = $.fn.selectize.defaults;
2716
+ var settings = $.extend({}, defaults, settings_user);
2717
+ var attr_data = settings.dataAttr;
2718
+ var field_label = settings.labelField;
2719
+ var field_value = settings.valueField;
2720
+ var field_optgroup = settings.optgroupField;
2721
+ var field_optgroup_label = settings.optgroupLabelField;
2722
+ var field_optgroup_value = settings.optgroupValueField;
2723
+
2724
+ /**
2725
+ * Initializes selectize from a <input type="text"> element.
2726
+ *
2727
+ * @param {object} $input
2728
+ * @param {object} settings_element
2729
+ */
2730
+ var init_textbox = function($input, settings_element) {
2731
+ var i, n, values, option;
2732
+
2733
+ var data_raw = $input.attr(attr_data);
2734
+
2735
+ if (!data_raw) {
2736
+ var value = $.trim($input.val() || '');
2737
+ if (!settings.allowEmptyOption && !value.length) return;
2738
+ values = value.split(settings.delimiter);
2739
+ for (i = 0, n = values.length; i < n; i++) {
2740
+ option = {};
2741
+ option[field_label] = values[i];
2742
+ option[field_value] = values[i];
2743
+ settings_element.options.push(option);
2744
+ }
2745
+ settings_element.items = values;
2746
+ } else {
2747
+ settings_element.options = JSON.parse(data_raw);
2748
+ for (i = 0, n = settings_element.options.length; i < n; i++) {
2749
+ settings_element.items.push(settings_element.options[i][field_value]);
2750
+ }
2751
+ }
2752
+ };
2753
+
2754
+ /**
2755
+ * Initializes selectize from a <select> element.
2756
+ *
2757
+ * @param {object} $input
2758
+ * @param {object} settings_element
2759
+ */
2760
+ var init_select = function($input, settings_element) {
2761
+ var i, n, tagName, $children, order = 0;
2762
+ var options = settings_element.options;
2763
+ var optionsMap = {};
2764
+
2765
+ var readData = function($el) {
2766
+ var data = attr_data && $el.attr(attr_data);
2767
+ if (typeof data === 'string' && data.length) {
2768
+ return JSON.parse(data);
2769
+ }
2770
+ return null;
2771
+ };
2772
+
2773
+ var addOption = function($option, group) {
2774
+ $option = $($option);
2775
+
2776
+ var value = hash_key($option.val());
2777
+ if (!value && !settings.allowEmptyOption) return;
2778
+
2779
+ // if the option already exists, it's probably been
2780
+ // duplicated in another optgroup. in this case, push
2781
+ // the current group to the "optgroup" property on the
2782
+ // existing option so that it's rendered in both places.
2783
+ if (optionsMap.hasOwnProperty(value)) {
2784
+ if (group) {
2785
+ var arr = optionsMap[value][field_optgroup];
2786
+ if (!arr) {
2787
+ optionsMap[value][field_optgroup] = group;
2788
+ } else if (!$.isArray(arr)) {
2789
+ optionsMap[value][field_optgroup] = [arr, group];
2790
+ } else {
2791
+ arr.push(group);
2792
+ }
2793
+ }
2794
+ return;
2795
+ }
2796
+
2797
+ var option = readData($option) || {};
2798
+ option[field_label] = option[field_label] || $option.text();
2799
+ option[field_value] = option[field_value] || value;
2800
+ option[field_optgroup] = option[field_optgroup] || group;
2801
+
2802
+ optionsMap[value] = option;
2803
+ options.push(option);
2804
+
2805
+ if ($option.is(':selected')) {
2806
+ settings_element.items.push(value);
2807
+ }
2808
+ };
2809
+
2810
+ var addGroup = function($optgroup) {
2811
+ var i, n, id, optgroup, $options;
2812
+
2813
+ $optgroup = $($optgroup);
2814
+ id = $optgroup.attr('label');
2815
+
2816
+ if (id) {
2817
+ optgroup = readData($optgroup) || {};
2818
+ optgroup[field_optgroup_label] = id;
2819
+ optgroup[field_optgroup_value] = id;
2820
+ settings_element.optgroups.push(optgroup);
2821
+ }
2822
+
2823
+ $options = $('option', $optgroup);
2824
+ for (i = 0, n = $options.length; i < n; i++) {
2825
+ addOption($options[i], id);
2826
+ }
2827
+ };
2828
+
2829
+ settings_element.maxItems = $input.attr('multiple') ? null : 1;
2830
+
2831
+ $children = $input.children();
2832
+ for (i = 0, n = $children.length; i < n; i++) {
2833
+ tagName = $children[i].tagName.toLowerCase();
2834
+ if (tagName === 'optgroup') {
2835
+ addGroup($children[i]);
2836
+ } else if (tagName === 'option') {
2837
+ addOption($children[i]);
2838
+ }
2839
+ }
2840
+ };
2841
+
2842
+ return this.each(function() {
2843
+ if (this.selectize) return;
2844
+
2845
+ var instance;
2846
+ var $input = $(this);
2847
+ var tag_name = this.tagName.toLowerCase();
2848
+ var placeholder = $input.attr('placeholder') || $input.attr('data-placeholder');
2849
+ if (!placeholder && !settings.allowEmptyOption) {
2850
+ placeholder = $input.children('option[value=""]').text();
2851
+ }
2852
+
2853
+ var settings_element = {
2854
+ 'placeholder' : placeholder,
2855
+ 'options' : [],
2856
+ 'optgroups' : [],
2857
+ 'items' : []
2858
+ };
2859
+
2860
+ if (tag_name === 'select') {
2861
+ init_select($input, settings_element);
2862
+ } else {
2863
+ init_textbox($input, settings_element);
2864
+ }
2865
+
2866
+ instance = new Selectize($input, $.extend(true, {}, defaults, settings_element, settings_user));
2867
+ });
2868
+ };
2869
+
2870
+ $.fn.selectize.defaults = Selectize.defaults;
2871
+ $.fn.selectize.support = {
2872
+ validity: SUPPORTS_VALIDITY_API
2873
+ };
2874
+
2875
+
2876
+ Selectize.define('drag_drop', function(options) {
2877
+ if (!$.fn.sortable) throw new Error('The "drag_drop" plugin requires jQuery UI "sortable".');
2878
+ if (this.settings.mode !== 'multi') return;
2879
+ var self = this;
2880
+
2881
+ self.lock = (function() {
2882
+ var original = self.lock;
2883
+ return function() {
2884
+ var sortable = self.$control.data('sortable');
2885
+ if (sortable) sortable.disable();
2886
+ return original.apply(self, arguments);
2887
+ };
2888
+ })();
2889
+
2890
+ self.unlock = (function() {
2891
+ var original = self.unlock;
2892
+ return function() {
2893
+ var sortable = self.$control.data('sortable');
2894
+ if (sortable) sortable.enable();
2895
+ return original.apply(self, arguments);
2896
+ };
2897
+ })();
2898
+
2899
+ self.setup = (function() {
2900
+ var original = self.setup;
2901
+ return function() {
2902
+ original.apply(this, arguments);
2903
+
2904
+ var $control = self.$control.sortable({
2905
+ items: '[data-value]',
2906
+ forcePlaceholderSize: true,
2907
+ disabled: self.isLocked,
2908
+ start: function(e, ui) {
2909
+ ui.placeholder.css('width', ui.helper.css('width'));
2910
+ $control.css({overflow: 'visible'});
2911
+ },
2912
+ stop: function() {
2913
+ $control.css({overflow: 'hidden'});
2914
+ var active = self.$activeItems ? self.$activeItems.slice() : null;
2915
+ var values = [];
2916
+ $control.children('[data-value]').each(function() {
2917
+ values.push($(this).attr('data-value'));
2918
+ });
2919
+ self.setValue(values);
2920
+ self.setActiveItem(active);
2921
+ }
2922
+ });
2923
+ };
2924
+ })();
2925
+
2926
+ });
2927
+
2928
+ Selectize.define('dropdown_header', function(options) {
2929
+ var self = this;
2930
+
2931
+ options = $.extend({
2932
+ title : 'Untitled',
2933
+ headerClass : 'selectize-dropdown-header',
2934
+ titleRowClass : 'selectize-dropdown-header-title',
2935
+ labelClass : 'selectize-dropdown-header-label',
2936
+ closeClass : 'selectize-dropdown-header-close',
2937
+
2938
+ html: function(data) {
2939
+ return (
2940
+ '<div class="' + data.headerClass + '">' +
2941
+ '<div class="' + data.titleRowClass + '">' +
2942
+ '<span class="' + data.labelClass + '">' + data.title + '</span>' +
2943
+ '<a href="javascript:void(0)" class="' + data.closeClass + '">&times;</a>' +
2944
+ '</div>' +
2945
+ '</div>'
2946
+ );
2947
+ }
2948
+ }, options);
2949
+
2950
+ self.setup = (function() {
2951
+ var original = self.setup;
2952
+ return function() {
2953
+ original.apply(self, arguments);
2954
+ self.$dropdown_header = $(options.html(options));
2955
+ self.$dropdown.prepend(self.$dropdown_header);
2956
+ };
2957
+ })();
2958
+
2959
+ });
2960
+
2961
+ Selectize.define('optgroup_columns', function(options) {
2962
+ var self = this;
2963
+
2964
+ options = $.extend({
2965
+ equalizeWidth : true,
2966
+ equalizeHeight : true
2967
+ }, options);
2968
+
2969
+ this.getAdjacentOption = function($option, direction) {
2970
+ var $options = $option.closest('[data-group]').find('[data-selectable]');
2971
+ var index = $options.index($option) + direction;
2972
+
2973
+ return index >= 0 && index < $options.length ? $options.eq(index) : $();
2974
+ };
2975
+
2976
+ this.onKeyDown = (function() {
2977
+ var original = self.onKeyDown;
2978
+ return function(e) {
2979
+ var index, $option, $options, $optgroup;
2980
+
2981
+ if (this.isOpen && (e.keyCode === KEY_LEFT || e.keyCode === KEY_RIGHT)) {
2982
+ self.ignoreHover = true;
2983
+ $optgroup = this.$activeOption.closest('[data-group]');
2984
+ index = $optgroup.find('[data-selectable]').index(this.$activeOption);
2985
+
2986
+ if(e.keyCode === KEY_LEFT) {
2987
+ $optgroup = $optgroup.prev('[data-group]');
2988
+ } else {
2989
+ $optgroup = $optgroup.next('[data-group]');
2990
+ }
2991
+
2992
+ $options = $optgroup.find('[data-selectable]');
2993
+ $option = $options.eq(Math.min($options.length - 1, index));
2994
+ if ($option.length) {
2995
+ this.setActiveOption($option);
2996
+ }
2997
+ return;
2998
+ }
2999
+
3000
+ return original.apply(this, arguments);
3001
+ };
3002
+ })();
3003
+
3004
+ var getScrollbarWidth = function() {
3005
+ var div;
3006
+ var width = getScrollbarWidth.width;
3007
+ var doc = document;
3008
+
3009
+ if (typeof width === 'undefined') {
3010
+ div = doc.createElement('div');
3011
+ div.innerHTML = '<div style="width:50px;height:50px;position:absolute;left:-50px;top:-50px;overflow:auto;"><div style="width:1px;height:100px;"></div></div>';
3012
+ div = div.firstChild;
3013
+ doc.body.appendChild(div);
3014
+ width = getScrollbarWidth.width = div.offsetWidth - div.clientWidth;
3015
+ doc.body.removeChild(div);
3016
+ }
3017
+ return width;
3018
+ };
3019
+
3020
+ var equalizeSizes = function() {
3021
+ var i, n, height_max, width, width_last, width_parent, $optgroups;
3022
+
3023
+ $optgroups = $('[data-group]', self.$dropdown_content);
3024
+ n = $optgroups.length;
3025
+ if (!n || !self.$dropdown_content.width()) return;
3026
+
3027
+ if (options.equalizeHeight) {
3028
+ height_max = 0;
3029
+ for (i = 0; i < n; i++) {
3030
+ height_max = Math.max(height_max, $optgroups.eq(i).height());
3031
+ }
3032
+ $optgroups.css({height: height_max});
3033
+ }
3034
+
3035
+ if (options.equalizeWidth) {
3036
+ width_parent = self.$dropdown_content.innerWidth() - getScrollbarWidth();
3037
+ width = Math.round(width_parent / n);
3038
+ $optgroups.css({width: width});
3039
+ if (n > 1) {
3040
+ width_last = width_parent - width * (n - 1);
3041
+ $optgroups.eq(n - 1).css({width: width_last});
3042
+ }
3043
+ }
3044
+ };
3045
+
3046
+ if (options.equalizeHeight || options.equalizeWidth) {
3047
+ hook.after(this, 'positionDropdown', equalizeSizes);
3048
+ hook.after(this, 'refreshOptions', equalizeSizes);
3049
+ }
3050
+
3051
+
3052
+ });
3053
+
3054
+ Selectize.define('remove_button', function(options) {
3055
+ options = $.extend({
3056
+ label : '&times;',
3057
+ title : 'Remove',
3058
+ className : 'remove',
3059
+ append : true
3060
+ }, options);
3061
+
3062
+ var singleClose = function(thisRef, options) {
3063
+
3064
+ options.className = 'remove-single';
3065
+
3066
+ var self = thisRef;
3067
+ var html = '<a href="javascript:void(0)" class="' + options.className + '" tabindex="-1" title="' + escape_html(options.title) + '">' + options.label + '</a>';
3068
+
3069
+ /**
3070
+ * Appends an element as a child (with raw HTML).
3071
+ *
3072
+ * @param {string} html_container
3073
+ * @param {string} html_element
3074
+ * @return {string}
3075
+ */
3076
+ var append = function(html_container, html_element) {
3077
+ return html_container + html_element;
3078
+ };
3079
+
3080
+ thisRef.setup = (function() {
3081
+ var original = self.setup;
3082
+ return function() {
3083
+ // override the item rendering method to add the button to each
3084
+ if (options.append) {
3085
+ var id = $(self.$input.context).attr('id');
3086
+ var selectizer = $('#'+id);
3087
+
3088
+ var render_item = self.settings.render.item;
3089
+ self.settings.render.item = function(data) {
3090
+ return append(render_item.apply(thisRef, arguments), html);
3091
+ };
3092
+ }
3093
+
3094
+ original.apply(thisRef, arguments);
3095
+
3096
+ // add event listener
3097
+ thisRef.$control.on('click', '.' + options.className, function(e) {
3098
+ e.preventDefault();
3099
+ if (self.isLocked) return;
3100
+
3101
+ self.clear();
3102
+ });
3103
+
3104
+ };
3105
+ })();
3106
+ };
3107
+
3108
+ var multiClose = function(thisRef, options) {
3109
+
3110
+ var self = thisRef;
3111
+ var html = '<a href="javascript:void(0)" class="' + options.className + '" tabindex="-1" title="' + escape_html(options.title) + '">' + options.label + '</a>';
3112
+
3113
+ /**
3114
+ * Appends an element as a child (with raw HTML).
3115
+ *
3116
+ * @param {string} html_container
3117
+ * @param {string} html_element
3118
+ * @return {string}
3119
+ */
3120
+ var append = function(html_container, html_element) {
3121
+ var pos = html_container.search(/(<\/[^>]+>\s*)$/);
3122
+ return html_container.substring(0, pos) + html_element + html_container.substring(pos);
3123
+ };
3124
+
3125
+ thisRef.setup = (function() {
3126
+ var original = self.setup;
3127
+ return function() {
3128
+ // override the item rendering method to add the button to each
3129
+ if (options.append) {
3130
+ var render_item = self.settings.render.item;
3131
+ self.settings.render.item = function(data) {
3132
+ return append(render_item.apply(thisRef, arguments), html);
3133
+ };
3134
+ }
3135
+
3136
+ original.apply(thisRef, arguments);
3137
+
3138
+ // add event listener
3139
+ thisRef.$control.on('click', '.' + options.className, function(e) {
3140
+ e.preventDefault();
3141
+ if (self.isLocked) return;
3142
+
3143
+ var $item = $(e.currentTarget).parent();
3144
+ self.setActiveItem($item);
3145
+ if (self.deleteSelection()) {
3146
+ self.setCaret(self.items.length);
3147
+ }
3148
+ });
3149
+
3150
+ };
3151
+ })();
3152
+ };
3153
+
3154
+ if (this.settings.mode === 'single') {
3155
+ singleClose(this, options);
3156
+ return;
3157
+ } else {
3158
+ multiClose(this, options);
3159
+ }
3160
+ });
3161
+
3162
+
3163
+ Selectize.define('restore_on_backspace', function(options) {
3164
+ var self = this;
3165
+
3166
+ options.text = options.text || function(option) {
3167
+ return option[this.settings.labelField];
3168
+ };
3169
+
3170
+ this.onKeyDown = (function() {
3171
+ var original = self.onKeyDown;
3172
+ return function(e) {
3173
+ var index, option;
3174
+ if (e.keyCode === KEY_BACKSPACE && this.$control_input.val() === '' && !this.$activeItems.length) {
3175
+ index = this.caretPos - 1;
3176
+ if (index >= 0 && index < this.items.length) {
3177
+ option = this.options[this.items[index]];
3178
+ if (this.deleteSelection(e)) {
3179
+ this.setTextboxValue(options.text.apply(this, [option]));
3180
+ this.refreshOptions(true);
3181
+ }
3182
+ e.preventDefault();
3183
+ return;
3184
+ }
3185
+ }
3186
+ return original.apply(this, arguments);
3187
+ };
3188
+ })();
3189
+ });
3190
+
3191
+
3192
+ return Selectize;
3193
+ }));