kirgudu_base 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (360) hide show
  1. checksums.yaml +15 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +3 -0
  4. data/Rakefile +40 -0
  5. data/app/assets/images/kirgudu_base/404-fry.png +0 -0
  6. data/app/assets/images/kirgudu_base/Documents.gif +0 -0
  7. data/app/assets/images/kirgudu_base/Meetings.gif +0 -0
  8. data/app/assets/images/kirgudu_base/Repair.gif +0 -0
  9. data/app/assets/images/kirgudu_base/ajax-loader.gif +0 -0
  10. data/app/assets/images/kirgudu_base/alpha.png +0 -0
  11. data/app/assets/images/kirgudu_base/alpha2.png +0 -0
  12. data/app/assets/images/kirgudu_base/arrow.png +0 -0
  13. data/app/assets/images/kirgudu_base/box.gif +0 -0
  14. data/app/assets/images/kirgudu_base/chosen-sprite.png +0 -0
  15. data/app/assets/images/kirgudu_base/company_pxg.png +0 -0
  16. data/app/assets/images/kirgudu_base/datatables/back_disabled.png +0 -0
  17. data/app/assets/images/kirgudu_base/datatables/back_enabled.png +0 -0
  18. data/app/assets/images/kirgudu_base/datatables/back_enabled_hover.png +0 -0
  19. data/app/assets/images/kirgudu_base/datatables/forward_disabled.png +0 -0
  20. data/app/assets/images/kirgudu_base/datatables/forward_enabled.png +0 -0
  21. data/app/assets/images/kirgudu_base/datatables/forward_enabled_hover.png +0 -0
  22. data/app/assets/images/kirgudu_base/datatables/sort_asc.png +0 -0
  23. data/app/assets/images/kirgudu_base/datatables/sort_asc_disabled.png +0 -0
  24. data/app/assets/images/kirgudu_base/datatables/sort_both.png +0 -0
  25. data/app/assets/images/kirgudu_base/datatables/sort_desc.png +0 -0
  26. data/app/assets/images/kirgudu_base/datatables/sort_desc_disabled.png +0 -0
  27. data/app/assets/images/kirgudu_base/fancybox/blank.gif +0 -0
  28. data/app/assets/images/kirgudu_base/fancybox/fancybox_buttons.png +0 -0
  29. data/app/assets/images/kirgudu_base/fancybox/fancybox_loading.gif +0 -0
  30. data/app/assets/images/kirgudu_base/fancybox/fancybox_overlay.png +0 -0
  31. data/app/assets/images/kirgudu_base/fancybox/fancybox_sprite.png +0 -0
  32. data/app/assets/images/kirgudu_base/favicon.png +0 -0
  33. data/app/assets/images/kirgudu_base/general/clock.png +0 -0
  34. data/app/assets/images/kirgudu_base/general/clock2.png +0 -0
  35. data/app/assets/images/kirgudu_base/general/coffee.png +0 -0
  36. data/app/assets/images/kirgudu_base/general/coffee2.png +0 -0
  37. data/app/assets/images/kirgudu_base/general/flipchart.png +0 -0
  38. data/app/assets/images/kirgudu_base/general/flipchart2.png +0 -0
  39. data/app/assets/images/kirgudu_base/general/sun.png +0 -0
  40. data/app/assets/images/kirgudu_base/general/sun2.png +0 -0
  41. data/app/assets/images/kirgudu_base/glyphicons-halflings-white.png +0 -0
  42. data/app/assets/images/kirgudu_base/glyphicons-halflings.png +0 -0
  43. data/app/assets/images/kirgudu_base/gradient1.png +0 -0
  44. data/app/assets/images/kirgudu_base/hue2.png +0 -0
  45. data/app/assets/images/kirgudu_base/ico_16_4_d.gif +0 -0
  46. data/app/assets/images/kirgudu_base/ico_18_1010.gif +0 -0
  47. data/app/assets/images/kirgudu_base/ico_18_112.gif +0 -0
  48. data/app/assets/images/kirgudu_base/ico_18_2020.gif +0 -0
  49. data/app/assets/images/kirgudu_base/icon-contacts.gif +0 -0
  50. data/app/assets/images/kirgudu_base/icon-employees.gif +0 -0
  51. data/app/assets/images/kirgudu_base/icon-list.gif +0 -0
  52. data/app/assets/images/kirgudu_base/icon-orders-green.gif +0 -0
  53. data/app/assets/images/kirgudu_base/icon-orders.gif +0 -0
  54. data/app/assets/images/kirgudu_base/icon-tenders.gif +0 -0
  55. data/app/assets/images/kirgudu_base/icons-sa7c41345d9.png +0 -0
  56. data/app/assets/images/kirgudu_base/login-corner.png +0 -0
  57. data/app/assets/images/kirgudu_base/login-corner2.png +0 -0
  58. data/app/assets/images/kirgudu_base/logo.png +0 -0
  59. data/app/assets/images/kirgudu_base/maps/m1.png +0 -0
  60. data/app/assets/images/kirgudu_base/maps/m2.png +0 -0
  61. data/app/assets/images/kirgudu_base/maps/m3.png +0 -0
  62. data/app/assets/images/kirgudu_base/meeting-schedule.gif +0 -0
  63. data/app/assets/images/kirgudu_base/menu_icons/calendar.png +0 -0
  64. data/app/assets/images/kirgudu_base/menu_icons/dashboard.png +0 -0
  65. data/app/assets/images/kirgudu_base/menu_icons/forms.png +0 -0
  66. data/app/assets/images/kirgudu_base/menu_icons/gallery.png +0 -0
  67. data/app/assets/images/kirgudu_base/menu_icons/grid.png +0 -0
  68. data/app/assets/images/kirgudu_base/menu_icons/maps.png +0 -0
  69. data/app/assets/images/kirgudu_base/menu_icons/others.png +0 -0
  70. data/app/assets/images/kirgudu_base/menu_icons/statistics.png +0 -0
  71. data/app/assets/images/kirgudu_base/menu_icons/tables.png +0 -0
  72. data/app/assets/images/kirgudu_base/menu_icons/widgets.png +0 -0
  73. data/app/assets/images/kirgudu_base/menu_top/profile-avatar.png +0 -0
  74. data/app/assets/images/kirgudu_base/menu_top/profile-messages.png +0 -0
  75. data/app/assets/images/kirgudu_base/message_avatar1.png +0 -0
  76. data/app/assets/images/kirgudu_base/message_avatar2.png +0 -0
  77. data/app/assets/images/kirgudu_base/message_avatar3.png +0 -0
  78. data/app/assets/images/kirgudu_base/message_avatar4.png +0 -0
  79. data/app/assets/images/kirgudu_base/message_avatar5.png +0 -0
  80. data/app/assets/images/kirgudu_base/message_avatar6.png +0 -0
  81. data/app/assets/images/kirgudu_base/message_avatar7.png +0 -0
  82. data/app/assets/images/kirgudu_base/news-icon-16.gif +0 -0
  83. data/app/assets/images/kirgudu_base/operator-def.png +0 -0
  84. data/app/assets/images/kirgudu_base/patterns/bg_dark.png +0 -0
  85. data/app/assets/images/kirgudu_base/patterns/bg_dark2.png +0 -0
  86. data/app/assets/images/kirgudu_base/patterns/bg_dark3.png +0 -0
  87. data/app/assets/images/kirgudu_base/patterns/whitey.png +0 -0
  88. data/app/assets/images/kirgudu_base/people-16-16-256.gif +0 -0
  89. data/app/assets/images/kirgudu_base/sales_24x24 (1).gif +0 -0
  90. data/app/assets/images/kirgudu_base/sample_avatar_big.jpg +0 -0
  91. data/app/assets/images/kirgudu_base/saturation2.png +0 -0
  92. data/app/assets/images/kirgudu_base/search.png +0 -0
  93. data/app/assets/images/kirgudu_base/toggle.png +0 -0
  94. data/app/assets/images/kirgudu_base/ui-bg_fine-grain_10_e7e7e7_60x60.png +0 -0
  95. data/app/assets/images/kirgudu_base/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  96. data/app/assets/images/kirgudu_base/ui-bg_flat_0_ef4622_40x100.png +0 -0
  97. data/app/assets/images/kirgudu_base/ui-bg_glass_65_ffffff_1x400.png +0 -0
  98. data/app/assets/images/kirgudu_base/ui-bg_highlight-hard_100_e1e1e1_1x100.png +0 -0
  99. data/app/assets/images/kirgudu_base/ui-bg_highlight-hard_100_eeeeee_1x100.png +0 -0
  100. data/app/assets/images/kirgudu_base/ui-bg_highlight-hard_75_dddddd_1x100.png +0 -0
  101. data/app/assets/images/kirgudu_base/ui-bg_inset-soft_95_fef1ec_1x100.png +0 -0
  102. data/app/assets/images/kirgudu_base/ui-icons_454545_256x240.png +0 -0
  103. data/app/assets/images/kirgudu_base/ui-icons_525d66_256x240.png +0 -0
  104. data/app/assets/images/kirgudu_base/ui-icons_cd0a0a_256x240.png +0 -0
  105. data/app/assets/images/kirgudu_base/ui-icons_ffffff_256x240.png +0 -0
  106. data/app/assets/images/kirgudu_base/uploadify-cancel.png +0 -0
  107. data/app/assets/javascripts/kirgudu_base/ajax_form.js +52 -0
  108. data/app/assets/javascripts/kirgudu_base/application.js +15 -0
  109. data/app/assets/javascripts/kirgudu_base/avgrund.js +85 -0
  110. data/app/assets/javascripts/kirgudu_base/bootstrap-alert.js +90 -0
  111. data/app/assets/javascripts/kirgudu_base/bootstrap-button.js +96 -0
  112. data/app/assets/javascripts/kirgudu_base/bootstrap-carousel.js +176 -0
  113. data/app/assets/javascripts/kirgudu_base/bootstrap-collapse.js +158 -0
  114. data/app/assets/javascripts/kirgudu_base/bootstrap-colorpicker.js +520 -0
  115. data/app/assets/javascripts/kirgudu_base/bootstrap-datepicker.js +401 -0
  116. data/app/assets/javascripts/kirgudu_base/bootstrap-dropdown.js +150 -0
  117. data/app/assets/javascripts/kirgudu_base/bootstrap-modal.js +239 -0
  118. data/app/assets/javascripts/kirgudu_base/bootstrap-popover.js +103 -0
  119. data/app/assets/javascripts/kirgudu_base/bootstrap-scrollspy.js +151 -0
  120. data/app/assets/javascripts/kirgudu_base/bootstrap-tab.js +135 -0
  121. data/app/assets/javascripts/kirgudu_base/bootstrap-tooltip.js +275 -0
  122. data/app/assets/javascripts/kirgudu_base/bootstrap-transition.js +60 -0
  123. data/app/assets/javascripts/kirgudu_base/bootstrap-typeahead.js +300 -0
  124. data/app/assets/javascripts/kirgudu_base/bootstrap-wysihtml5.js +458 -0
  125. data/app/assets/javascripts/kirgudu_base/bootstrap.js +6 -0
  126. data/app/assets/javascripts/kirgudu_base/character-limit.js +18 -0
  127. data/app/assets/javascripts/kirgudu_base/chosen.jquery.min.js +10 -0
  128. data/app/assets/javascripts/kirgudu_base/client_main.js +1017 -0
  129. data/app/assets/javascripts/kirgudu_base/delete.js +67 -0
  130. data/app/assets/javascripts/kirgudu_base/excanvas.compiled.js +35 -0
  131. data/app/assets/javascripts/kirgudu_base/fileinput.jquery.js +98 -0
  132. data/app/assets/javascripts/kirgudu_base/fullcalendar.js +5220 -0
  133. data/app/assets/javascripts/kirgudu_base/gmap3.min.js +39 -0
  134. data/app/assets/javascripts/kirgudu_base/highcharts.js +246 -0
  135. data/app/assets/javascripts/kirgudu_base/jdpicker.js +555 -0
  136. data/app/assets/javascripts/kirgudu_base/jnavigate.jquery.min.js +2 -0
  137. data/app/assets/javascripts/kirgudu_base/jquery-ui-1.8.23.custom.min.js +125 -0
  138. data/app/assets/javascripts/kirgudu_base/jquery-ui-1.8.23.custom.min_d9931121.js +125 -0
  139. data/app/assets/javascripts/kirgudu_base/jquery.blockUI.js +534 -0
  140. data/app/assets/javascripts/kirgudu_base/jquery.bookblock.js +533 -0
  141. data/app/assets/javascripts/kirgudu_base/jquery.cookie.js +94 -0
  142. data/app/assets/javascripts/kirgudu_base/jquery.dataTables.js +12092 -0
  143. data/app/assets/javascripts/kirgudu_base/jquery.endless-scroll.js +343 -0
  144. data/app/assets/javascripts/kirgudu_base/jquery.fancybox-buttons.js +121 -0
  145. data/app/assets/javascripts/kirgudu_base/jquery.fancybox-media.js +196 -0
  146. data/app/assets/javascripts/kirgudu_base/jquery.fancybox-thumbs.js +162 -0
  147. data/app/assets/javascripts/kirgudu_base/jquery.fancybox.js +1985 -0
  148. data/app/assets/javascripts/kirgudu_base/jquery.flot.crosshair.js +167 -0
  149. data/app/assets/javascripts/kirgudu_base/jquery.flot.js +2599 -0
  150. data/app/assets/javascripts/kirgudu_base/jquery.flot.pie.js +751 -0
  151. data/app/assets/javascripts/kirgudu_base/jquery.flot.resize.js +60 -0
  152. data/app/assets/javascripts/kirgudu_base/jquery.flot.spider.js +314 -0
  153. data/app/assets/javascripts/kirgudu_base/jquery.flot.stack.js +184 -0
  154. data/app/assets/javascripts/kirgudu_base/jquery.history.js +1 -0
  155. data/app/assets/javascripts/kirgudu_base/jquery.jcarousel.min.js +16 -0
  156. data/app/assets/javascripts/kirgudu_base/jquery.jeditable.js +543 -0
  157. data/app/assets/javascripts/kirgudu_base/jquery.js +2 -0
  158. data/app/assets/javascripts/kirgudu_base/jquery.json-2.3.min.js +23 -0
  159. data/app/assets/javascripts/kirgudu_base/jquery.maskedinput-1.3.js +258 -0
  160. data/app/assets/javascripts/kirgudu_base/jquery.mousewheel-min.js +12 -0
  161. data/app/assets/javascripts/kirgudu_base/jquery.peity.min.js +11 -0
  162. data/app/assets/javascripts/kirgudu_base/jquery.simplemodal-1.4.4.js +716 -0
  163. data/app/assets/javascripts/kirgudu_base/jquery.slides.min.js +7 -0
  164. data/app/assets/javascripts/kirgudu_base/jquery.sparkline.min.js +5 -0
  165. data/app/assets/javascripts/kirgudu_base/jquery.tagsinput.js +354 -0
  166. data/app/assets/javascripts/kirgudu_base/jquery.tools.min.js +17 -0
  167. data/app/assets/javascripts/kirgudu_base/jquery.touchdown.js +54 -0
  168. data/app/assets/javascripts/kirgudu_base/jquery.uniform.min.js +17 -0
  169. data/app/assets/javascripts/kirgudu_base/jquery.uploadify-3.1.js +975 -0
  170. data/app/assets/javascripts/kirgudu_base/jquery.uploadify.min.js +16 -0
  171. data/app/assets/javascripts/kirgudu_base/jquery.url-2.0.js +174 -0
  172. data/app/assets/javascripts/kirgudu_base/jquery.validate.min.js +4 -0
  173. data/app/assets/javascripts/kirgudu_base/jquerypp.custom.js +301 -0
  174. data/app/assets/javascripts/kirgudu_base/justgage.1.0.1.min.js +12 -0
  175. data/app/assets/javascripts/kirgudu_base/main.js +157 -0
  176. data/app/assets/javascripts/kirgudu_base/modernizr.custom.32549.js +815 -0
  177. data/app/assets/javascripts/kirgudu_base/mustache.js +532 -0
  178. data/app/assets/javascripts/kirgudu_base/popbox.js +57 -0
  179. data/app/assets/javascripts/kirgudu_base/raphael.2.1.0.min.js +10 -0
  180. data/app/assets/javascripts/kirgudu_base/scripts.js +1277 -0
  181. data/app/assets/javascripts/kirgudu_base/scripts_OLD.js +204 -0
  182. data/app/assets/javascripts/kirgudu_base/sub_select.js +50 -0
  183. data/app/assets/javascripts/kirgudu_base/swfobject.js +5 -0
  184. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shAutoloader.js +17 -0
  185. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushAS3.js +59 -0
  186. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushAppleScript.js +75 -0
  187. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushBash.js +59 -0
  188. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushCSharp.js +65 -0
  189. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushColdFusion.js +100 -0
  190. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushCpp.js +97 -0
  191. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushCss.js +91 -0
  192. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushDelphi.js +55 -0
  193. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushDiff.js +41 -0
  194. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushErlang.js +52 -0
  195. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushGroovy.js +67 -0
  196. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushJScript.js +52 -0
  197. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushJava.js +57 -0
  198. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushJavaFX.js +58 -0
  199. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushPerl.js +72 -0
  200. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushPhp.js +88 -0
  201. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushPlain.js +33 -0
  202. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushPowerShell.js +74 -0
  203. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushPython.js +64 -0
  204. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushRuby.js +55 -0
  205. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushSass.js +94 -0
  206. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushScala.js +51 -0
  207. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushSql.js +66 -0
  208. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushVb.js +56 -0
  209. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shBrushXml.js +69 -0
  210. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shCore.js +17 -0
  211. data/app/assets/javascripts/kirgudu_base/syntax-highlighter/shLegacy.js +17 -0
  212. data/app/assets/javascripts/kirgudu_base/textarea-autogrow.js +55 -0
  213. data/app/assets/javascripts/kirgudu_base/tiny_mce.js +1 -0
  214. data/app/assets/javascripts/kirgudu_base/watch.js +81 -0
  215. data/app/assets/javascripts/kirgudu_base/web/inputPlaceholder.js +82 -0
  216. data/app/assets/javascripts/kirgudu_base/web/js.js +91 -0
  217. data/app/assets/javascripts/kirgudu_base/web/navigate.js +20 -0
  218. data/app/assets/javascripts/kirgudu_base/web/watch.js +1706 -0
  219. data/app/assets/javascripts/kirgudu_base/wysihtml5-0.3.0.min.js +261 -0
  220. data/app/assets/stylesheets/kirgudu_base/bootstrap.css +4551 -0
  221. data/app/assets/stylesheets/kirgudu_base/chosen.css +397 -0
  222. data/app/assets/stylesheets/kirgudu_base/fullcalendar.css +655 -0
  223. data/app/assets/stylesheets/kirgudu_base/info-message.css +79 -0
  224. data/app/assets/stylesheets/kirgudu_base/jdpicker.css +200 -0
  225. data/app/assets/stylesheets/kirgudu_base/jquery-ui-1.8.23.custom.css +1235 -0
  226. data/app/assets/stylesheets/kirgudu_base/jquery.fancybox-buttons.css +96 -0
  227. data/app/assets/stylesheets/kirgudu_base/jquery.fancybox-thumbs.css +54 -0
  228. data/app/assets/stylesheets/kirgudu_base/jquery.fancybox.css +249 -0
  229. data/app/assets/stylesheets/kirgudu_base/jquery.tagsinput.css +7 -0
  230. data/app/assets/stylesheets/kirgudu_base/main.css +1368 -0
  231. data/app/assets/stylesheets/kirgudu_base/menu.css +159 -0
  232. data/app/assets/stylesheets/kirgudu_base/popbox.css +58 -0
  233. data/app/assets/stylesheets/kirgudu_base/responsive.css +2249 -0
  234. data/app/assets/stylesheets/kirgudu_base/switcher.css +80 -0
  235. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shCore.css +226 -0
  236. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shCoreDefault.css +328 -0
  237. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shCoreDjango.css +331 -0
  238. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shCoreEclipse.css +339 -0
  239. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shCoreEmacs.css +324 -0
  240. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shCoreFadeToGrey.css +328 -0
  241. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shCoreMDUltra.css +324 -0
  242. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shCoreMidnight.css +324 -0
  243. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shCoreRDark.css +324 -0
  244. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shThemeDefault.css +117 -0
  245. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shThemeDjango.css +120 -0
  246. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shThemeEclipse.css +128 -0
  247. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shThemeEmacs.css +113 -0
  248. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shThemeFadeToGrey.css +117 -0
  249. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shThemeMDUltra.css +113 -0
  250. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shThemeMidnight.css +113 -0
  251. data/app/assets/stylesheets/kirgudu_base/syntax-higlignter/shThemeRDark.css +113 -0
  252. data/app/assets/stylesheets/kirgudu_base/uploadify.css +92 -0
  253. data/app/controllers/kirgudu_base/admin_controller.rb +91 -0
  254. data/app/controllers/kirgudu_base/application_controller.rb +676 -0
  255. data/app/controllers/kirgudu_base/cabinet_controller.rb +93 -0
  256. data/app/controllers/kirgudu_base/facade_controller.rb +82 -0
  257. data/app/helpers/kirgudu_base/application_helper.rb +486 -0
  258. data/app/helpers/kirgudu_base/breadcrumbs_helper.rb +27 -0
  259. data/app/helpers/kirgudu_base/class_helper.rb +32 -0
  260. data/app/helpers/kirgudu_base/controllers/basic_actions.rb +625 -0
  261. data/app/helpers/kirgudu_base/controllers/container_items_management_actions.rb +118 -0
  262. data/app/helpers/kirgudu_base/controllers/container_items_sorting_actions.rb +64 -0
  263. data/app/helpers/kirgudu_base/controllers/dynamic_pages.rb +30 -0
  264. data/app/helpers/kirgudu_base/controllers/obligatory_filters.rb +29 -0
  265. data/app/helpers/kirgudu_base/controllers/transaction_wrapper.rb +138 -0
  266. data/app/helpers/kirgudu_base/form_builder.rb +474 -0
  267. data/app/helpers/kirgudu_base/gui_helper.rb +443 -0
  268. data/app/helpers/kirgudu_base/models/basic_management_urls.rb +104 -0
  269. data/app/helpers/kirgudu_base/models/data_filter.rb +236 -0
  270. data/app/helpers/kirgudu_base/models/exports.rb +167 -0
  271. data/app/helpers/kirgudu_base/models/filters.rb +32 -0
  272. data/app/helpers/kirgudu_base/models/form_properties.rb +108 -0
  273. data/app/helpers/kirgudu_base/models/form_property.rb +335 -0
  274. data/app/helpers/kirgudu_base/models/methods.rb +64 -0
  275. data/app/helpers/kirgudu_base/models/scopes.rb +157 -0
  276. data/app/helpers/kirgudu_base/models/sorting.rb +99 -0
  277. data/app/helpers/kirgudu_base/models/standard_actions.rb +50 -0
  278. data/app/helpers/kirgudu_base/models/uncloneable_properties.rb +21 -0
  279. data/app/helpers/kirgudu_base/old_form_builder.rb +340 -0
  280. data/app/helpers/kirgudu_base/url_helper.rb +18 -0
  281. data/app/models/kirgudu_base/base_model.rb +293 -0
  282. data/app/models/kirgudu_base/dynamic_pages/action_for.rb +78 -0
  283. data/app/models/kirgudu_base/dynamic_pages/action_for_builder.rb +46 -0
  284. data/app/models/kirgudu_base/dynamic_pages/data_source.rb +111 -0
  285. data/app/models/kirgudu_base/dynamic_pages/data_source_builder.rb +79 -0
  286. data/app/models/kirgudu_base/dynamic_pages/form.rb +99 -0
  287. data/app/models/kirgudu_base/dynamic_pages/form_builder.rb +85 -0
  288. data/app/models/kirgudu_base/dynamic_pages/input_type.rb +17 -0
  289. data/app/models/kirgudu_base/dynamic_pages/on_change.rb +40 -0
  290. data/app/models/kirgudu_base/dynamic_pages/on_change_builder.rb +38 -0
  291. data/app/models/kirgudu_base/dynamic_pages/page.rb +55 -0
  292. data/app/models/kirgudu_base/dynamic_pages/page_builder.rb +63 -0
  293. data/app/models/kirgudu_base/dynamic_pages/property.rb +185 -0
  294. data/app/models/kirgudu_base/dynamic_pages/property_builder.rb +123 -0
  295. data/app/models/kirgudu_base/template.rb +6 -0
  296. data/app/models/kirgudu_base/template_element.rb +6 -0
  297. data/app/views/layouts/kirgudu_base/application.html.erb +141 -0
  298. data/app/views/shared/kirgudu_base/_body_javascripts_files.html.erb +71 -0
  299. data/app/views/shared/kirgudu_base/_body_javascripts_scripts.html.erb +1099 -0
  300. data/app/views/shared/kirgudu_base/_breadcrumbs.html.erb +36 -0
  301. data/app/views/shared/kirgudu_base/_head_javascripts.html.erb +21 -0
  302. data/app/views/shared/kirgudu_base/_head_stylesheets.html.erb +21 -0
  303. data/app/views/shared/kirgudu_base/_index_page_filter.html.erb +43 -0
  304. data/app/views/shared/kirgudu_base/_left_menu_standard_actions.html.erb +57 -0
  305. data/app/views/shared/kirgudu_base/_services_top_line.html.erb +5 -0
  306. data/app/views/shared/kirgudu_base/_top_nav_bar.html.erb +58 -0
  307. data/app/views/shared/kirgudu_base/entry_edit_form_renderer.html.erb +70 -0
  308. data/app/views/shared/kirgudu_base/entry_index_renderer.html.erb +98 -0
  309. data/app/views/shared/kirgudu_base/entry_new_form_renderer.html.erb +68 -0
  310. data/app/views/shared/kirgudu_base/entry_not_found_renderer.html.erb +15 -0
  311. data/app/views/shared/kirgudu_base/entry_show_renderer.html.erb +28 -0
  312. data/app/views/shared/kirgudu_base/manage_images/managing_items_index.html.erb +34 -0
  313. data/app/views/shared/kirgudu_base/manage_images/managing_items_manage.html.erb +72 -0
  314. data/app/views/shared/kirgudu_base/manage_images/managing_items_sort_index.html.erb +33 -0
  315. data/app/views/shared/kirgudu_base/manage_items/managing_items_index.html.erb +42 -0
  316. data/app/views/shared/kirgudu_base/manage_items/managing_items_manage.html.erb +66 -0
  317. data/app/views/shared/kirgudu_base/manage_items/managing_items_sort_index.html.erb +33 -0
  318. data/config/routes.rb +3 -0
  319. data/db/migrate/20131114161828_create_kirgudu_base_templates.rb +17 -0
  320. data/db/migrate/20131114165013_create_kirgudu_base_template_elements.rb +18 -0
  321. data/lib/kirgudu_base/engine.rb +6 -0
  322. data/lib/kirgudu_base/version.rb +4 -0
  323. data/lib/kirgudu_base.rb +5 -0
  324. data/lib/tasks/kirgudu_base_tasks.rake +4 -0
  325. data/test/dummy/README.rdoc +261 -0
  326. data/test/dummy/Rakefile +7 -0
  327. data/test/dummy/app/assets/javascripts/application.js +15 -0
  328. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  329. data/test/dummy/app/controllers/application_controller.rb +4 -0
  330. data/test/dummy/app/helpers/application_helper.rb +3 -0
  331. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  332. data/test/dummy/config/application.rb +60 -0
  333. data/test/dummy/config/boot.rb +11 -0
  334. data/test/dummy/config/database.yml +25 -0
  335. data/test/dummy/config/environment.rb +6 -0
  336. data/test/dummy/config/environments/development.rb +38 -0
  337. data/test/dummy/config/environments/production.rb +68 -0
  338. data/test/dummy/config/environments/test.rb +38 -0
  339. data/test/dummy/config/initializers/backtrace_silencers.rb +8 -0
  340. data/test/dummy/config/initializers/inflections.rb +16 -0
  341. data/test/dummy/config/initializers/mime_types.rb +6 -0
  342. data/test/dummy/config/initializers/secret_token.rb +8 -0
  343. data/test/dummy/config/initializers/session_store.rb +9 -0
  344. data/test/dummy/config/initializers/wrap_parameters.rb +15 -0
  345. data/test/dummy/config/locales/en.yml +5 -0
  346. data/test/dummy/config/routes.rb +5 -0
  347. data/test/dummy/config.ru +4 -0
  348. data/test/dummy/public/404.html +26 -0
  349. data/test/dummy/public/422.html +26 -0
  350. data/test/dummy/public/500.html +25 -0
  351. data/test/dummy/public/favicon.ico +0 -0
  352. data/test/dummy/script/rails +6 -0
  353. data/test/fixtures/kirgudu_base/template_elements.yml +17 -0
  354. data/test/fixtures/kirgudu_base/templates.yml +15 -0
  355. data/test/integration/navigation_test.rb +11 -0
  356. data/test/kirgudu_base_test.rb +8 -0
  357. data/test/test_helper.rb +16 -0
  358. data/test/unit/kirgudu_base/template_element_test.rb +10 -0
  359. data/test/unit/kirgudu_base/template_test.rb +10 -0
  360. metadata +492 -0
@@ -0,0 +1,6 @@
1
+ /*!
2
+ * Bootstrap.js by @fat & @mdo
3
+ * Copyright 2012 Twitter, Inc.
4
+ * http://www.apache.org/licenses/LICENSE-2.0.txt
5
+ */
6
+ !function(a){a(function(){"use strict",a.support.transition=function(){var a=function(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",msTransition:"MSTransitionEnd",transition:"transitionend"},c;for(c in b)if(a.style[c]!==undefined)return b[c]}();return a&&{end:a}}()})}(window.jQuery),!function(a){"use strict";var b='[data-dismiss="alert"]',c=function(c){a(c).on("click",b,this.close)};c.prototype.close=function(b){function f(){e.trigger("closed").remove()}var c=a(this),d=c.attr("data-target"),e;d||(d=c.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),e=a(d),b&&b.preventDefault(),e.length||(e=c.hasClass("alert")?c:c.parent()),e.trigger(b=a.Event("close"));if(b.isDefaultPrevented())return;e.removeClass("in"),a.support.transition&&e.hasClass("fade")?e.on(a.support.transition.end,f):f()},a.fn.alert=function(b){return this.each(function(){var d=a(this),e=d.data("alert");e||d.data("alert",e=new c(this)),typeof b=="string"&&e[b].call(d)})},a.fn.alert.Constructor=c,a(function(){a("body").on("click.alert.data-api",b,c.prototype.close)})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.button.defaults,c)};b.prototype.setState=function(a){var b="disabled",c=this.$element,d=c.data(),e=c.is("input")?"val":"html";a+="Text",d.resetText||c.data("resetText",c[e]()),c[e](d[a]||this.options[a]),setTimeout(function(){a=="loadingText"?c.addClass(b).attr(b,b):c.removeClass(b).removeAttr(b)},0)},b.prototype.toggle=function(){var a=this.$element.parent('[data-toggle="buttons-radio"]');a&&a.find(".active").removeClass("active"),this.$element.toggleClass("active")},a.fn.button=function(c){return this.each(function(){var d=a(this),e=d.data("button"),f=typeof c=="object"&&c;e||d.data("button",e=new b(this,f)),c=="toggle"?e.toggle():c&&e.setState(c)})},a.fn.button.defaults={loadingText:"loading..."},a.fn.button.Constructor=b,a(function(){a("body").on("click.button.data-api","[data-toggle^=button]",function(b){var c=a(b.target);c.hasClass("btn")||(c=c.closest(".btn")),c.button("toggle")})})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=c,this.options.slide&&this.slide(this.options.slide),this.options.pause=="hover"&&this.$element.on("mouseenter",a.proxy(this.pause,this)).on("mouseleave",a.proxy(this.cycle,this))};b.prototype={cycle:function(b){return b||(this.paused=!1),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},to:function(b){var c=this.$element.find(".active"),d=c.parent().children(),e=d.index(c),f=this;if(b>d.length-1||b<0)return;return this.sliding?this.$element.one("slid",function(){f.to(b)}):e==b?this.pause().cycle():this.slide(b>e?"next":"prev",a(d[b]))},pause:function(a){return a||(this.paused=!0),clearInterval(this.interval),this.interval=null,this},next:function(){if(this.sliding)return;return this.slide("next")},prev:function(){if(this.sliding)return;return this.slide("prev")},slide:function(b,c){var d=this.$element.find(".active"),e=c||d[b](),f=this.interval,g=b=="next"?"left":"right",h=b=="next"?"first":"last",i=this,j=a.Event("slide");this.sliding=!0,f&&this.pause(),e=e.length?e:this.$element.find(".item")[h]();if(e.hasClass("active"))return;if(a.support.transition&&this.$element.hasClass("slide")){this.$element.trigger(j);if(j.isDefaultPrevented())return;e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),this.$element.one(a.support.transition.end,function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger("slid")},0)})}else{this.$element.trigger(j);if(j.isDefaultPrevented())return;d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger("slid")}return f&&this.cycle(),this}},a.fn.carousel=function(c){return this.each(function(){var d=a(this),e=d.data("carousel"),f=a.extend({},a.fn.carousel.defaults,typeof c=="object"&&c);e||d.data("carousel",e=new b(this,f)),typeof c=="number"?e.to(c):typeof c=="string"||(c=f.slide)?e[c]():f.interval&&e.cycle()})},a.fn.carousel.defaults={interval:5e3,pause:"hover"},a.fn.carousel.Constructor=b,a(function(){a("body").on("click.carousel.data-api","[data-slide]",function(b){var c=a(this),d,e=a(c.attr("data-target")||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,"")),f=!e.data("modal")&&a.extend({},e.data(),c.data());e.carousel(f),b.preventDefault()})})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.collapse.defaults,c),this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.prototype={constructor:b,dimension:function(){var a=this.$element.hasClass("width");return a?"width":"height"},show:function(){var b,c,d,e;if(this.transitioning)return;b=this.dimension(),c=a.camelCase(["scroll",b].join("-")),d=this.$parent&&this.$parent.find("> .accordion-group > .in");if(d&&d.length){e=d.data("collapse");if(e&&e.transitioning)return;d.collapse("hide"),e||d.data("collapse",null)}this.$element[b](0),this.transition("addClass",a.Event("show"),"shown"),this.$element[b](this.$element[0][c])},hide:function(){var b;if(this.transitioning)return;b=this.dimension(),this.reset(this.$element[b]()),this.transition("removeClass",a.Event("hide"),"hidden"),this.$element[b](0)},reset:function(a){var b=this.dimension();return this.$element.removeClass("collapse")[b](a||"auto")[0].offsetWidth,this.$element[a!==null?"addClass":"removeClass"]("collapse"),this},transition:function(b,c,d){var e=this,f=function(){c.type=="show"&&e.reset(),e.transitioning=0,e.$element.trigger(d)};this.$element.trigger(c);if(c.isDefaultPrevented())return;this.transitioning=1,this.$element[b]("in"),a.support.transition&&this.$element.hasClass("collapse")?this.$element.one(a.support.transition.end,f):f()},toggle:function(){this[this.$element.hasClass("in")?"hide":"show"]()}},a.fn.collapse=function(c){return this.each(function(){var d=a(this),e=d.data("collapse"),f=typeof c=="object"&&c;e||d.data("collapse",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.collapse.defaults={toggle:!0},a.fn.collapse.Constructor=b,a(function(){a("body").on("click.collapse.data-api","[data-toggle=collapse]",function(b){var c=a(this),d,e=c.attr("data-target")||b.preventDefault()||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""),f=a(e).data("collapse")?"toggle":c.data();a(e).collapse(f)})})}(window.jQuery),!function(a){function d(){a(b).parent().removeClass("open")}"use strict";var b='[data-toggle="dropdown"]',c=function(b){var c=a(b).on("click.dropdown.data-api",this.toggle);a("html").on("click.dropdown.data-api",function(){c.parent().removeClass("open")})};c.prototype={constructor:c,toggle:function(b){var c=a(this),e,f,g;if(c.is(".disabled, :disabled"))return;return f=c.attr("data-target"),f||(f=c.attr("href"),f=f&&f.replace(/.*(?=#[^\s]*$)/,"")),e=a(f),e.length||(e=c.parent()),g=e.hasClass("open"),d(),g||e.toggleClass("open"),!1}},a.fn.dropdown=function(b){return this.each(function(){var d=a(this),e=d.data("dropdown");e||d.data("dropdown",e=new c(this)),typeof b=="string"&&e[b].call(d)})},a.fn.dropdown.Constructor=c,a(function(){a("html").on("click.dropdown.data-api",d),a("body").on("click.dropdown",".dropdown form",function(a){a.stopPropagation()}).on("click.dropdown.data-api",b,c.prototype.toggle)})}(window.jQuery),!function(a){function c(){var b=this,c=setTimeout(function(){b.$element.off(a.support.transition.end),d.call(b)},500);this.$element.one(a.support.transition.end,function(){clearTimeout(c),d.call(b)})}function d(a){this.$element.hide().trigger("hidden"),e.call(this)}function e(b){var c=this,d=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var e=a.support.transition&&d;this.$backdrop=a('<div class="modal-backdrop '+d+'" />').appendTo(document.body),this.options.backdrop!="static"&&this.$backdrop.click(a.proxy(this.hide,this)),e&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),e?this.$backdrop.one(a.support.transition.end,b):b()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(a.support.transition.end,a.proxy(f,this)):f.call(this)):b&&b()}function f(){this.$backdrop.remove(),this.$backdrop=null}function g(){var b=this;this.isShown&&this.options.keyboard?a(document).on("keyup.dismiss.modal",function(a){a.which==27&&b.hide()}):this.isShown||a(document).off("keyup.dismiss.modal")}"use strict";var b=function(b,c){this.options=c,this.$element=a(b).delegate('[data-dismiss="modal"]',"click.dismiss.modal",a.proxy(this.hide,this))};b.prototype={constructor:b,toggle:function(){return this[this.isShown?"hide":"show"]()},show:function(){var b=this,c=a.Event("show");this.$element.trigger(c);if(this.isShown||c.isDefaultPrevented())return;a("body").addClass("modal-open"),this.isShown=!0,g.call(this),e.call(this,function(){var c=a.support.transition&&b.$element.hasClass("fade");b.$element.parent().length||b.$element.appendTo(document.body),b.$element.show(),c&&b.$element[0].offsetWidth,b.$element.addClass("in"),c?b.$element.one(a.support.transition.end,function(){b.$element.trigger("shown")}):b.$element.trigger("shown")})},hide:function(b){b&&b.preventDefault();var e=this;b=a.Event("hide"),this.$element.trigger(b);if(!this.isShown||b.isDefaultPrevented())return;this.isShown=!1,a("body").removeClass("modal-open"),g.call(this),this.$element.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?c.call(this):d.call(this)}},a.fn.modal=function(c){return this.each(function(){var d=a(this),e=d.data("modal"),f=a.extend({},a.fn.modal.defaults,d.data(),typeof c=="object"&&c);e||d.data("modal",e=new b(this,f)),typeof c=="string"?e[c]():f.show&&e.show()})},a.fn.modal.defaults={backdrop:!0,keyboard:!0,show:!0},a.fn.modal.Constructor=b,a(function(){a("body").on("click.modal.data-api",'[data-toggle="modal"]',function(b){var c=a(this),d,e=a(c.attr("data-target")||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,"")),f=e.data("modal")?"toggle":a.extend({},e.data(),c.data());b.preventDefault(),e.modal(f)})})}(window.jQuery),!function(a){"use strict";var b=function(a,b){this.init("tooltip",a,b)};b.prototype={constructor:b,init:function(b,c,d){var e,f;this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.enabled=!0,this.options.trigger!="manual"&&(e=this.options.trigger=="hover"?"mouseenter":"focus",f=this.options.trigger=="hover"?"mouseleave":"blur",this.$element.on(e,this.options.selector,a.proxy(this.enter,this)),this.$element.on(f,this.options.selector,a.proxy(this.leave,this))),this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},getOptions:function(b){return b=a.extend({},a.fn[this.type].defaults,b,this.$element.data()),b.delay&&typeof b.delay=="number"&&(b.delay={show:b.delay,hide:b.delay}),b},enter:function(b){var c=a(b.currentTarget)[this.type](this._options).data(this.type);if(!c.options.delay||!c.options.delay.show)return c.show();clearTimeout(this.timeout),c.hoverState="in",this.timeout=setTimeout(function(){c.hoverState=="in"&&c.show()},c.options.delay.show)},leave:function(b){var c=a(b.currentTarget)[this.type](this._options).data(this.type);if(!c.options.delay||!c.options.delay.hide)return c.hide();clearTimeout(this.timeout),c.hoverState="out",this.timeout=setTimeout(function(){c.hoverState=="out"&&c.hide()},c.options.delay.hide)},show:function(){var a,b,c,d,e,f,g;if(this.hasContent()&&this.enabled){a=this.tip(),this.setContent(),this.options.animation&&a.addClass("fade"),f=typeof this.options.placement=="function"?this.options.placement.call(this,a[0],this.$element[0]):this.options.placement,b=/in/.test(f),a.remove().css({top:0,left:0,display:"block"}).appendTo(b?this.$element:document.body),c=this.getPosition(b),d=a[0].offsetWidth,e=a[0].offsetHeight;switch(b?f.split(" ")[1]:f){case"bottom":g={top:c.top+c.height,left:c.left+c.width/2-d/2};break;case"top":g={top:c.top-e,left:c.left+c.width/2-d/2};break;case"left":g={top:c.top+c.height/2-e/2,left:c.left-d};break;case"right":g={top:c.top+c.height/2-e/2,left:c.left+c.width}}a.css(g).addClass(f).addClass("in")}},isHTML:function(a){return typeof a!="string"||a.charAt(0)==="<"&&a.charAt(a.length-1)===">"&&a.length>=3||/^(?:[^<]*<[\w\W]+>[^>]*$)/.exec(a)},setContent:function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.isHTML(b)?"html":"text"](b),a.removeClass("fade in top bottom left right")},hide:function(){function d(){var b=setTimeout(function(){c.off(a.support.transition.end).remove()},500);c.one(a.support.transition.end,function(){clearTimeout(b),c.remove()})}var b=this,c=this.tip();c.removeClass("in"),a.support.transition&&this.$tip.hasClass("fade")?d():c.remove()},fixTitle:function(){var a=this.$element;(a.attr("title")||typeof a.attr("data-original-title")!="string")&&a.attr("data-original-title",a.attr("title")||"").removeAttr("title")},hasContent:function(){return this.getTitle()},getPosition:function(b){return a.extend({},b?{top:0,left:0}:this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight})},getTitle:function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||(typeof c.title=="function"?c.title.call(b[0]):c.title),a},tip:function(){return this.$tip=this.$tip||a(this.options.template)},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled},toggle:function(){this[this.tip().hasClass("in")?"hide":"show"]()}},a.fn.tooltip=function(c){return this.each(function(){var d=a(this),e=d.data("tooltip"),f=typeof c=="object"&&c;e||d.data("tooltip",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.tooltip.Constructor=b,a.fn.tooltip.defaults={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover",title:"",delay:0}}(window.jQuery),!function(a){"use strict";var b=function(a,b){this.init("popover",a,b)};b.prototype=a.extend({},a.fn.tooltip.Constructor.prototype,{constructor:b,setContent:function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.isHTML(b)?"html":"text"](b),a.find(".popover-content > *")[this.isHTML(c)?"html":"text"](c),a.removeClass("fade top bottom left right in")},hasContent:function(){return this.getTitle()||this.getContent()},getContent:function(){var a,b=this.$element,c=this.options;return a=b.attr("data-content")||(typeof c.content=="function"?c.content.call(b[0]):c.content),a},tip:function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip}}),a.fn.popover=function(c){return this.each(function(){var d=a(this),e=d.data("popover"),f=typeof c=="object"&&c;e||d.data("popover",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.popover.Constructor=b,a.fn.popover.defaults=a.extend({},a.fn.tooltip.defaults,{placement:"right",content:"",template:'<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>'})}(window.jQuery),!function(a){function b(b,c){var d=a.proxy(this.process,this),e=a(b).is("body")?a(window):a(b),f;this.options=a.extend({},a.fn.scrollspy.defaults,c),this.$scrollElement=e.on("scroll.scroll.data-api",d),this.selector=(this.options.target||(f=a(b).attr("href"))&&f.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.$body=a("body"),this.refresh(),this.process()}"use strict",b.prototype={constructor:b,refresh:function(){var b=this,c;this.offsets=a([]),this.targets=a([]),c=this.$body.find(this.selector).map(function(){var b=a(this),c=b.data("target")||b.attr("href"),d=/^#\w/.test(c)&&a(c);return d&&c.length&&[[d.position().top,c]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){b.offsets.push(this[0]),b.targets.push(this[1])})},process:function(){var a=this.$scrollElement.scrollTop()+this.options.offset,b=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,c=b-this.$scrollElement.height(),d=this.offsets,e=this.targets,f=this.activeTarget,g;if(a>=c)return f!=(g=e.last()[0])&&this.activate(g);for(g=d.length;g--;)f!=e[g]&&a>=d[g]&&(!d[g+1]||a<=d[g+1])&&this.activate(e[g])},activate:function(b){var c,d;this.activeTarget=b,a(this.selector).parent(".active").removeClass("active"),d=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',c=a(d).parent("li").addClass("active"),c.parent(".dropdown-menu")&&(c=c.closest("li.dropdown").addClass("active")),c.trigger("activate")}},a.fn.scrollspy=function(c){return this.each(function(){var d=a(this),e=d.data("scrollspy"),f=typeof c=="object"&&c;e||d.data("scrollspy",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.scrollspy.Constructor=b,a.fn.scrollspy.defaults={offset:10},a(function(){a('[data-spy="scroll"]').each(function(){var b=a(this);b.scrollspy(b.data())})})}(window.jQuery),!function(a){"use strict";var b=function(b){this.element=a(b)};b.prototype={constructor:b,show:function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.attr("data-target"),e,f,g;d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,""));if(b.parent("li").hasClass("active"))return;e=c.find(".active a").last()[0],g=a.Event("show",{relatedTarget:e}),b.trigger(g);if(g.isDefaultPrevented())return;f=a(d),this.activate(b.parent("li"),c),this.activate(f,f.parent(),function(){b.trigger({type:"shown",relatedTarget:e})})},activate:function(b,c,d){function g(){e.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),f?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var e=c.find("> .active"),f=d&&a.support.transition&&e.hasClass("fade");f?e.one(a.support.transition.end,g):g(),e.removeClass("in")}},a.fn.tab=function(c){return this.each(function(){var d=a(this),e=d.data("tab");e||d.data("tab",e=new b(this)),typeof c=="string"&&e[c]()})},a.fn.tab.Constructor=b,a(function(){a("body").on("click.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(b){b.preventDefault(),a(this).tab("show")})})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.typeahead.defaults,c),this.matcher=this.options.matcher||this.matcher,this.sorter=this.options.sorter||this.sorter,this.highlighter=this.options.highlighter||this.highlighter,this.updater=this.options.updater||this.updater,this.$menu=a(this.options.menu).appendTo("body"),this.source=this.options.source,this.shown=!1,this.listen()};b.prototype={constructor:b,select:function(){var a=this.$menu.find(".active").attr("data-value");return this.$element.val(this.updater(a)).change(),this.hide()},updater:function(a){return a},show:function(){var b=a.extend({},this.$element.offset(),{height:this.$element[0].offsetHeight});return this.$menu.css({top:b.top+b.height,left:b.left}),this.$menu.show(),this.shown=!0,this},hide:function(){return this.$menu.hide(),this.shown=!1,this},lookup:function(b){var c=this,d,e;return this.query=this.$element.val(),this.query?(d=a.grep(this.source,function(a){return c.matcher(a)}),d=this.sorter(d),d.length?this.render(d.slice(0,this.options.items)).show():this.shown?this.hide():this):this.shown?this.hide():this},matcher:function(a){return~a.toLowerCase().indexOf(this.query.toLowerCase())},sorter:function(a){var b=[],c=[],d=[],e;while(e=a.shift())e.toLowerCase().indexOf(this.query.toLowerCase())?~e.indexOf(this.query)?c.push(e):d.push(e):b.push(e);return b.concat(c,d)},highlighter:function(a){var b=this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&");return a.replace(new RegExp("("+b+")","ig"),function(a,b){return"<strong>"+b+"</strong>"})},render:function(b){var c=this;return b=a(b).map(function(b,d){return b=a(c.options.item).attr("data-value",d),b.find("a").html(c.highlighter(d)),b[0]}),b.first().addClass("active"),this.$menu.html(b),this},next:function(b){var c=this.$menu.find(".active").removeClass("active"),d=c.next();d.length||(d=a(this.$menu.find("li")[0])),d.addClass("active")},prev:function(a){var b=this.$menu.find(".active").removeClass("active"),c=b.prev();c.length||(c=this.$menu.find("li").last()),c.addClass("active")},listen:function(){this.$element.on("blur",a.proxy(this.blur,this)).on("keypress",a.proxy(this.keypress,this)).on("keyup",a.proxy(this.keyup,this)),(a.browser.webkit||a.browser.msie)&&this.$element.on("keydown",a.proxy(this.keypress,this)),this.$menu.on("click",a.proxy(this.click,this)).on("mouseenter","li",a.proxy(this.mouseenter,this))},keyup:function(a){switch(a.keyCode){case 40:case 38:break;case 9:case 13:if(!this.shown)return;this.select();break;case 27:if(!this.shown)return;this.hide();break;default:this.lookup()}a.stopPropagation(),a.preventDefault()},keypress:function(a){if(!this.shown)return;switch(a.keyCode){case 9:case 13:case 27:a.preventDefault();break;case 38:if(a.type!="keydown")break;a.preventDefault(),this.prev();break;case 40:if(a.type!="keydown")break;a.preventDefault(),this.next()}a.stopPropagation()},blur:function(a){var b=this;setTimeout(function(){b.hide()},150)},click:function(a){a.stopPropagation(),a.preventDefault(),this.select()},mouseenter:function(b){this.$menu.find(".active").removeClass("active"),a(b.currentTarget).addClass("active")}},a.fn.typeahead=function(c){return this.each(function(){var d=a(this),e=d.data("typeahead"),f=typeof c=="object"&&c;e||d.data("typeahead",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.typeahead.defaults={source:[],items:8,menu:'<ul class="typeahead dropdown-menu"></ul>',item:'<li><a href="#"></a></li>'},a.fn.typeahead.Constructor=b,a(function(){a("body").on("focus.typeahead.data-api",'[data-provide="typeahead"]',function(b){var c=a(this);if(c.data("typeahead"))return;b.preventDefault(),c.typeahead(c.data())})})}(window.jQuery);
@@ -0,0 +1,18 @@
1
+ (function($) {
2
+ $.fn.extend( {
3
+ limiter: function(limit, elem) {
4
+ $(this).on("keyup focus", function() {
5
+ setCount(this, elem);
6
+ });
7
+ function setCount(src, elem) {
8
+ var chars = src.value.length;
9
+ if (chars > limit) {
10
+ src.value = src.value.substr(0, limit);
11
+ chars = limit;
12
+ }
13
+ elem.html( limit - chars );
14
+ }
15
+ setCount($(this)[0], elem);
16
+ }
17
+ });
18
+ })(jQuery);
@@ -0,0 +1,10 @@
1
+ // Chosen, a Select Box Enhancer for jQuery and Protoype
2
+ // by Patrick Filler for Harvest, http://getharvest.com
3
+ //
4
+ // Version 0.9.8
5
+ // Full source at https://github.com/harvesthq/chosen
6
+ // Copyright (c) 2011 Harvest http://getharvest.com
7
+
8
+ // MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
9
+ // This file is generated by `cake build`, do not edit it by hand.
10
+ (function(){var SelectParser;SelectParser=function(){function SelectParser(){this.options_index=0,this.parsed=[]}return SelectParser.prototype.add_node=function(child){return child.nodeName.toUpperCase()==="OPTGROUP"?this.add_group(child):this.add_option(child)},SelectParser.prototype.add_group=function(group){var group_position,option,_i,_len,_ref,_results;group_position=this.parsed.length,this.parsed.push({array_index:group_position,group:!0,label:group.label,children:0,disabled:group.disabled}),_ref=group.childNodes,_results=[];for(_i=0,_len=_ref.length;_i<_len;_i++)option=_ref[_i],_results.push(this.add_option(option,group_position,group.disabled));return _results},SelectParser.prototype.add_option=function(option,group_position,group_disabled){if(option.nodeName.toUpperCase()==="OPTION")return option.text!==""?(group_position!=null&&(this.parsed[group_position].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:option.value,text:option.text,html:option.innerHTML,selected:option.selected,disabled:group_disabled===!0?group_disabled:option.disabled,group_array_index:group_position,classes:option.className,style:option.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1},SelectParser}(),SelectParser.select_to_array=function(select){var child,parser,_i,_len,_ref;parser=new SelectParser,_ref=select.childNodes;for(_i=0,_len=_ref.length;_i<_len;_i++)child=_ref[_i],parser.add_node(child);return parser.parsed},this.SelectParser=SelectParser}).call(this),function(){var AbstractChosen,root;root=this,AbstractChosen=function(){function AbstractChosen(form_field,options){this.form_field=form_field,this.options=options!=null?options:{},this.set_default_values(),this.is_multiple=this.form_field.multiple,this.set_default_text(),this.setup(),this.set_up_html(),this.register_observers(),this.finish_setup()}return AbstractChosen.prototype.set_default_values=function(){var _this=this;return this.click_test_action=function(evt){return _this.test_active_click(evt)},this.activate_action=function(evt){return _this.activate_field(evt)},this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.result_single_selected=null,this.allow_single_deselect=this.options.allow_single_deselect!=null&&this.form_field.options[0]!=null&&this.form_field.options[0].text===""?this.options.allow_single_deselect:!1,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.search_contains=this.options.search_contains||!1,this.choices=0,this.single_backstroke_delete=this.options.single_backstroke_delete||!1,this.max_selected_options=this.options.max_selected_options||Infinity},AbstractChosen.prototype.set_default_text=function(){return this.form_field.getAttribute("data-placeholder")?this.default_text=this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.default_text=this.options.placeholder_text_multiple||this.options.placeholder_text||"Select Some Options":this.default_text=this.options.placeholder_text_single||this.options.placeholder_text||"Select an Option",this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||"No results match"},AbstractChosen.prototype.mouse_enter=function(){return this.mouse_on_container=!0},AbstractChosen.prototype.mouse_leave=function(){return this.mouse_on_container=!1},AbstractChosen.prototype.input_focus=function(evt){var _this=this;if(!this.active_field)return setTimeout(function(){return _this.container_mousedown()},50)},AbstractChosen.prototype.input_blur=function(evt){var _this=this;if(!this.mouse_on_container)return this.active_field=!1,setTimeout(function(){return _this.blur_test()},100)},AbstractChosen.prototype.result_add_option=function(option){var classes,style;return option.disabled?"":(option.dom_id=this.container_id+"_o_"+option.array_index,classes=option.selected&&this.is_multiple?[]:["active-result"],option.selected&&classes.push("result-selected"),option.group_array_index!=null&&classes.push("group-option"),option.classes!==""&&classes.push(option.classes),style=option.style.cssText!==""?' style="'+option.style+'"':"",'<li id="'+option.dom_id+'" class="'+classes.join(" ")+'"'+style+">"+option.html+"</li>")},AbstractChosen.prototype.results_update_field=function(){return this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.result_single_selected=null,this.results_build()},AbstractChosen.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},AbstractChosen.prototype.results_search=function(evt){return this.results_showing?this.winnow_results():this.results_show()},AbstractChosen.prototype.keyup_checker=function(evt){var stroke,_ref;stroke=(_ref=evt.which)!=null?_ref:evt.keyCode,this.search_field_scale();switch(stroke){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices>0)return this.keydown_backstroke();if(!this.pending_backstroke)return this.result_clear_highlight(),this.results_search();break;case 13:evt.preventDefault();if(this.results_showing)return this.result_select(evt);break;case 27:return this.results_showing&&this.results_hide(),!0;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}},AbstractChosen.prototype.generate_field_id=function(){var new_id;return new_id=this.generate_random_id(),this.form_field.id=new_id,new_id},AbstractChosen.prototype.generate_random_char=function(){var chars,newchar,rand;return chars="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",rand=Math.floor(Math.random()*chars.length),newchar=chars.substring(rand,rand+1)},AbstractChosen}(),root.AbstractChosen=AbstractChosen}.call(this),function(){var $,Chosen,get_side_border_padding,root,__hasProp=Object.prototype.hasOwnProperty,__extends=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)__hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child};root=this,$=jQuery,$.fn.extend({chosen:function(options){return $.browser.msie&&($.browser.version==="6.0"||$.browser.version==="7.0"&&document.documentMode===7)?this:this.each(function(input_field){var $this;$this=$(this);if(!$this.hasClass("chzn-done"))return $this.data("chosen",new Chosen(this,options))})}}),Chosen=function(_super){function Chosen(){Chosen.__super__.constructor.apply(this,arguments)}return __extends(Chosen,_super),Chosen.prototype.setup=function(){return this.form_field_jq=$(this.form_field),this.current_value=this.form_field_jq.val(),this.is_rtl=this.form_field_jq.hasClass("chzn-rtl")},Chosen.prototype.finish_setup=function(){return this.form_field_jq.addClass("chzn-done")},Chosen.prototype.set_up_html=function(){var container_div,dd_top,dd_width,sf_width;return this.container_id=this.form_field.id.length?this.form_field.id.replace(/[^\w]/g,"_"):this.generate_field_id(),this.container_id+="_chzn",this.f_width=this.form_field_jq.outerWidth(),container_div=$("<div />",{id:this.container_id,"class":"chzn-container"+(this.is_rtl?" chzn-rtl":""),style:"width: "+this.f_width+"px;"}),this.is_multiple?container_div.html('<ul class="chzn-choices"><li class="search-field"><input type="text" value="'+this.default_text+'" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>'):container_div.html('<a href="javascript:void(0)" class="chzn-single chzn-default"><span>'+this.default_text+'</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>'),this.form_field_jq.hide().after(container_div),this.container=$("#"+this.container_id),this.container.addClass("chzn-container-"+(this.is_multiple?"multi":"single")),this.dropdown=this.container.find("div.chzn-drop").first(),dd_top=this.container.height(),dd_width=this.f_width-get_side_border_padding(this.dropdown),this.dropdown.css({width:dd_width+"px",top:dd_top+"px"}),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chzn-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chzn-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chzn-search").first(),this.selected_item=this.container.find(".chzn-single").first(),sf_width=dd_width-get_side_border_padding(this.search_container)-get_side_border_padding(this.search_field),this.search_field.css({width:sf_width+"px"})),this.results_build(),this.set_tab_index(),this.form_field_jq.trigger("liszt:ready",{chosen:this})},Chosen.prototype.register_observers=function(){var _this=this;return this.container.mousedown(function(evt){return _this.container_mousedown(evt)}),this.container.mouseup(function(evt){return _this.container_mouseup(evt)}),this.container.mouseenter(function(evt){return _this.mouse_enter(evt)}),this.container.mouseleave(function(evt){return _this.mouse_leave(evt)}),this.search_results.mouseup(function(evt){return _this.search_results_mouseup(evt)}),this.search_results.mouseover(function(evt){return _this.search_results_mouseover(evt)}),this.search_results.mouseout(function(evt){return _this.search_results_mouseout(evt)}),this.form_field_jq.bind("liszt:updated",function(evt){return _this.results_update_field(evt)}),this.form_field_jq.bind("liszt:activate",function(evt){return _this.activate_field(evt)}),this.form_field_jq.bind("liszt:open",function(evt){return _this.container_mousedown(evt)}),this.search_field.blur(function(evt){return _this.input_blur(evt)}),this.search_field.keyup(function(evt){return _this.keyup_checker(evt)}),this.search_field.keydown(function(evt){return _this.keydown_checker(evt)}),this.is_multiple?(this.search_choices.click(function(evt){return _this.choices_click(evt)}),this.search_field.focus(function(evt){return _this.input_focus(evt)})):this.container.click(function(evt){return evt.preventDefault()})},Chosen.prototype.search_field_disabled=function(){this.is_disabled=this.form_field_jq[0].disabled;if(this.is_disabled)return this.container.addClass("chzn-disabled"),this.search_field[0].disabled=!0,this.is_multiple||this.selected_item.unbind("focus",this.activate_action),this.close_field();this.container.removeClass("chzn-disabled"),this.search_field[0].disabled=!1;if(!this.is_multiple)return this.selected_item.bind("focus",this.activate_action)},Chosen.prototype.container_mousedown=function(evt){var target_closelink;if(!this.is_disabled)return target_closelink=evt!=null?$(evt.target).hasClass("search-choice-close"):!1,evt&&evt.type==="mousedown"&&!this.results_showing&&evt.stopPropagation(),!this.pending_destroy_click&&!target_closelink?(this.active_field?!this.is_multiple&&evt&&($(evt.target)[0]===this.selected_item[0]||$(evt.target).parents("a.chzn-single").length)&&(evt.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),$(document).click(this.click_test_action),this.results_show()),this.activate_field()):this.pending_destroy_click=!1},Chosen.prototype.container_mouseup=function(evt){if(evt.target.nodeName==="ABBR"&&!this.is_disabled)return this.results_reset(evt)},Chosen.prototype.blur_test=function(evt){if(!this.active_field&&this.container.hasClass("chzn-container-active"))return this.close_field()},Chosen.prototype.close_field=function(){return $(document).unbind("click",this.click_test_action),this.is_multiple||(this.selected_item.attr("tabindex",this.search_field.attr("tabindex")),this.search_field.attr("tabindex",-1)),this.active_field=!1,this.results_hide(),this.container.removeClass("chzn-container-active"),this.winnow_results_clear(),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale()},Chosen.prototype.activate_field=function(){return!this.is_multiple&&!this.active_field&&(this.search_field.attr("tabindex",this.selected_item.attr("tabindex")),this.selected_item.attr("tabindex",-1)),this.container.addClass("chzn-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},Chosen.prototype.test_active_click=function(evt){return $(evt.target).parents("#"+this.container_id).length?this.active_field=!0:this.close_field()},Chosen.prototype.results_build=function(){var content,data,_i,_len,_ref;this.parsing=!0,this.results_data=root.SelectParser.select_to_array(this.form_field),this.is_multiple&&this.choices>0?(this.search_choices.find("li.search-choice").remove(),this.choices=0):this.is_multiple||(this.selected_item.addClass("chzn-default").find("span").text(this.default_text),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?this.container.addClass("chzn-container-single-nosearch"):this.container.removeClass("chzn-container-single-nosearch")),content="",_ref=this.results_data;for(_i=0,_len=_ref.length;_i<_len;_i++)data=_ref[_i],data.group?content+=this.result_add_group(data):data.empty||(content+=this.result_add_option(data),data.selected&&this.is_multiple?this.choice_build(data):data.selected&&!this.is_multiple&&(this.selected_item.removeClass("chzn-default").find("span").text(data.text),this.allow_single_deselect&&this.single_deselect_control_build()));return this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.search_results.html(content),this.parsing=!1},Chosen.prototype.result_add_group=function(group){return group.disabled?"":(group.dom_id=this.container_id+"_g_"+group.array_index,'<li id="'+group.dom_id+'" class="group-result">'+$("<div />").text(group.label).html()+"</li>")},Chosen.prototype.result_do_highlight=function(el){var high_bottom,high_top,maxHeight,visible_bottom,visible_top;if(el.length){this.result_clear_highlight(),this.result_highlight=el,this.result_highlight.addClass("highlighted"),maxHeight=parseInt(this.search_results.css("maxHeight"),10),visible_top=this.search_results.scrollTop(),visible_bottom=maxHeight+visible_top,high_top=this.result_highlight.position().top+this.search_results.scrollTop(),high_bottom=high_top+this.result_highlight.outerHeight();if(high_bottom>=visible_bottom)return this.search_results.scrollTop(high_bottom-maxHeight>0?high_bottom-maxHeight:0);if(high_top<visible_top)return this.search_results.scrollTop(high_top)}},Chosen.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClass("highlighted"),this.result_highlight=null},Chosen.prototype.results_show=function(){var dd_top;if(!this.is_multiple)this.selected_item.addClass("chzn-single-with-drop"),this.result_single_selected&&this.result_do_highlight(this.result_single_selected);else if(this.max_selected_options<=this.choices)return this.form_field_jq.trigger("liszt:maxselected",{chosen:this}),!1;return dd_top=this.is_multiple?this.container.height():this.container.height()-1,this.form_field_jq.trigger("liszt:showing_dropdown",{chosen:this}),this.dropdown.css({top:dd_top+"px",left:0}),this.results_showing=!0,this.search_field.focus(),this.search_field.val(this.search_field.val()),this.winnow_results()},Chosen.prototype.results_hide=function(){return this.is_multiple||this.selected_item.removeClass("chzn-single-with-drop"),this.result_clear_highlight(),this.form_field_jq.trigger("liszt:hiding_dropdown",{chosen:this}),this.dropdown.css({left:"-9000px"}),this.results_showing=!1},Chosen.prototype.set_tab_index=function(el){var ti;if(this.form_field_jq.attr("tabindex"))return ti=this.form_field_jq.attr("tabindex"),this.form_field_jq.attr("tabindex",-1),this.is_multiple?this.search_field.attr("tabindex",ti):(this.selected_item.attr("tabindex",ti),this.search_field.attr("tabindex",-1))},Chosen.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},Chosen.prototype.search_results_mouseup=function(evt){var target;target=$(evt.target).hasClass("active-result")?$(evt.target):$(evt.target).parents(".active-result").first();if(target.length)return this.result_highlight=target,this.result_select(evt)},Chosen.prototype.search_results_mouseover=function(evt){var target;target=$(evt.target).hasClass("active-result")?$(evt.target):$(evt.target).parents(".active-result").first();if(target)return this.result_do_highlight(target)},Chosen.prototype.search_results_mouseout=function(evt){if($(evt.target).hasClass("active-result"))return this.result_clear_highlight()},Chosen.prototype.choices_click=function(evt){evt.preventDefault();if(this.active_field&&!$(evt.target).hasClass("search-choice")&&!this.results_showing)return this.results_show()},Chosen.prototype.choice_build=function(item){var choice_id,html,link,_this=this;return this.is_multiple&&this.max_selected_options<=this.choices?(this.form_field_jq.trigger("liszt:maxselected",{chosen:this}),!1):(choice_id=this.container_id+"_c_"+item.array_index,this.choices+=1,item.disabled?html='<li class="search-choice search-choice-disabled" id="'+choice_id+'"><span>'+item.html+"</span></li>":html='<li class="search-choice" id="'+choice_id+'"><span>'+item.html+'</span><a href="javascript:void(0)" class="search-choice-close" rel="'+item.array_index+'"></a></li>',this.search_container.before(html),link=$("#"+choice_id).find("a").first(),link.click(function(evt){return _this.choice_destroy_link_click(evt)}))},Chosen.prototype.choice_destroy_link_click=function(evt){return evt.preventDefault(),this.is_disabled?evt.stopPropagation:(this.pending_destroy_click=!0,this.choice_destroy($(evt.target)))},Chosen.prototype.choice_destroy=function(link){if(this.result_deselect(link.attr("rel")))return this.choices-=1,this.show_search_field_default(),this.is_multiple&&this.choices>0&&this.search_field.val().length<1&&this.results_hide(),link.parents("li").first().remove()},Chosen.prototype.results_reset=function(){this.form_field.options[0].selected=!0,this.selected_item.find("span").text(this.default_text),this.is_multiple||this.selected_item.addClass("chzn-default"),this.show_search_field_default(),this.results_reset_cleanup(),this.form_field_jq.trigger("change");if(this.active_field)return this.results_hide()},Chosen.prototype.results_reset_cleanup=function(){return this.current_value=this.form_field_jq.val(),this.selected_item.find("abbr").remove()},Chosen.prototype.result_select=function(evt){var high,high_id,item,position;if(this.result_highlight)return high=this.result_highlight,high_id=high.attr("id"),this.result_clear_highlight(),this.is_multiple?this.result_deactivate(high):(this.search_results.find(".result-selected").removeClass("result-selected"),this.result_single_selected=high,this.selected_item.removeClass("chzn-default")),high.addClass("result-selected"),position=high_id.substr(high_id.lastIndexOf("_")+1),item=this.results_data[position],item.selected=!0,this.form_field.options[item.options_index].selected=!0,this.is_multiple?this.choice_build(item):(this.selected_item.find("span").first().text(item.text),this.allow_single_deselect&&this.single_deselect_control_build()),(!evt.metaKey||!this.is_multiple)&&this.results_hide(),this.search_field.val(""),(this.is_multiple||this.form_field_jq.val()!==this.current_value)&&this.form_field_jq.trigger("change",{selected:this.form_field.options[item.options_index].value}),this.current_value=this.form_field_jq.val(),this.search_field_scale()},Chosen.prototype.result_activate=function(el){return el.addClass("active-result")},Chosen.prototype.result_deactivate=function(el){return el.removeClass("active-result")},Chosen.prototype.result_deselect=function(pos){var result,result_data;return result_data=this.results_data[pos],this.form_field.options[result_data.options_index].disabled?!1:(result_data.selected=!1,this.form_field.options[result_data.options_index].selected=!1,result=$("#"+this.container_id+"_o_"+pos),result.removeClass("result-selected").addClass("active-result").show(),this.result_clear_highlight(),this.winnow_results(),this.form_field_jq.trigger("change",{deselected:this.form_field.options[result_data.options_index].value}),this.search_field_scale(),!0)},Chosen.prototype.single_deselect_control_build=function(){if(this.allow_single_deselect&&this.selected_item.find("abbr").length<1)return this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>')},Chosen.prototype.winnow_results=function(){var found,option,part,parts,regex,regexAnchor,result,result_id,results,searchText,startpos,text,zregex,_i,_j,_len,_len2,_ref;this.no_results_clear(),results=0,searchText=this.search_field.val()===this.default_text?"":$("<div/>").text($.trim(this.search_field.val())).html(),regexAnchor=this.search_contains?"":"^",regex=new RegExp(regexAnchor+searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),zregex=new RegExp(searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),_ref=this.results_data;for(_i=0,_len=_ref.length;_i<_len;_i++){option=_ref[_i];if(!option.disabled&&!option.empty)if(option.group)$("#"+option.dom_id).css("display","none");else if(!this.is_multiple||!option.selected){found=!1,result_id=option.dom_id,result=$("#"+result_id);if(regex.test(option.html))found=!0,results+=1;else if(option.html.indexOf(" ")>=0||option.html.indexOf("[")===0){parts=option.html.replace(/\[|\]/g,"").split(" ");if(parts.length)for(_j=0,_len2=parts.length;_j<_len2;_j++)part=parts[_j],regex.test(part)&&(found=!0,results+=1)}found?(searchText.length?(startpos=option.html.search(zregex),text=option.html.substr(0,startpos+searchText.length)+"</em>"+option.html.substr(startpos+searchText.length),text=text.substr(0,startpos)+"<em>"+text.substr(startpos)):text=option.html,result.html(text),this.result_activate(result),option.group_array_index!=null&&$("#"+this.results_data[option.group_array_index].dom_id).css("display","list-item")):(this.result_highlight&&result_id===this.result_highlight.attr("id")&&this.result_clear_highlight(),this.result_deactivate(result))}}return results<1&&searchText.length?this.no_results(searchText):this.winnow_results_set_highlight()},Chosen.prototype.winnow_results_clear=function(){var li,lis,_i,_len,_results;this.search_field.val(""),lis=this.search_results.find("li"),_results=[];for(_i=0,_len=lis.length;_i<_len;_i++)li=lis[_i],li=$(li),li.hasClass("group-result")?_results.push(li.css("display","auto")):!this.is_multiple||!li.hasClass("result-selected")?_results.push(this.result_activate(li)):_results.push(void 0);return _results},Chosen.prototype.winnow_results_set_highlight=function(){var do_high,selected_results;if(!this.result_highlight){selected_results=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),do_high=selected_results.length?selected_results.first():this.search_results.find(".active-result").first();if(do_high!=null)return this.result_do_highlight(do_high)}},Chosen.prototype.no_results=function(terms){var no_results_html;return no_results_html=$('<li class="no-results">'+this.results_none_found+' "<span></span>"</li>'),no_results_html.find("span").first().html(terms),this.search_results.append(no_results_html)},Chosen.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},Chosen.prototype.keydown_arrow=function(){var first_active,next_sib;this.result_highlight?this.results_showing&&(next_sib=this.result_highlight.nextAll("li.active-result").first(),next_sib&&this.result_do_highlight(next_sib)):(first_active=this.search_results.find("li.active-result").first(),first_active&&this.result_do_highlight($(first_active)));if(!this.results_showing)return this.results_show()},Chosen.prototype.keyup_arrow=function(){var prev_sibs;if(!this.results_showing&&!this.is_multiple)return this.results_show();if(this.result_highlight)return prev_sibs=this.result_highlight.prevAll("li.active-result"),prev_sibs.length?this.result_do_highlight(prev_sibs.first()):(this.choices>0&&this.results_hide(),this.result_clear_highlight())},Chosen.prototype.keydown_backstroke=function(){var next_available_destroy;if(this.pending_backstroke)return this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke();next_available_destroy=this.search_container.siblings("li.search-choice").last();if(next_available_destroy.length&&!next_available_destroy.hasClass("search-choice-disabled"))return this.pending_backstroke=next_available_destroy,this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClass("search-choice-focus")},Chosen.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},Chosen.prototype.keydown_checker=function(evt){var stroke,_ref;stroke=(_ref=evt.which)!=null?_ref:evt.keyCode,this.search_field_scale(),stroke!==8&&this.pending_backstroke&&this.clear_backstroke();switch(stroke){case 8:this.backstroke_length=this.search_field.val().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(evt),this.mouse_on_container=!1;break;case 13:evt.preventDefault();break;case 38:evt.preventDefault(),this.keyup_arrow();break;case 40:this.keydown_arrow()}},Chosen.prototype.search_field_scale=function(){var dd_top,div,h,style,style_block,styles,w,_i,_len;if(this.is_multiple){h=0,w=0,style_block="position:absolute; left: -1000px; top: -1000px; display:none;",styles=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"];for(_i=0,_len=styles.length;_i<_len;_i++)style=styles[_i],style_block+=style+":"+this.search_field.css(style)+";";return div=$("<div />",{style:style_block}),div.text(this.search_field.val()),$("body").append(div),w=div.width()+25,div.remove(),w>this.f_width-10&&(w=this.f_width-10),this.search_field.css({width:w+"px"}),dd_top=this.container.height(),this.dropdown.css({top:dd_top+"px"})}},Chosen.prototype.generate_random_id=function(){var string;string="sel"+this.generate_random_char()+this.generate_random_char()+this.generate_random_char();while($("#"+string).length>0)string+=this.generate_random_char();return string},Chosen}(AbstractChosen),get_side_border_padding=function(elmt){var side_border_padding;return side_border_padding=elmt.outerWidth()-elmt.width()},root.get_side_border_padding=get_side_border_padding}.call(this);
@@ -0,0 +1,1017 @@
1
+ if(window.LTX_STATIC_HOST === undefined) {
2
+ window.LTX_STATIC_HOST = 'cs15.livetex.ru';
3
+ }
4
+ if(window.LTX_CS_HOST === undefined) {
5
+ window.LTX_CS_HOST = 'cs15.livetex.ru';
6
+ }
7
+ // Preloader
8
+ var divElements = document.getElementsByTagName('div');
9
+ for (var jixt=0; jixt < divElements.length; jixt++ ){
10
+ if (divElements[jixt].id.search('liveTexButton_') != -1){
11
+ var port = window.livetexTest ? (':' + window.livetexTest) : '';
12
+ divElements[jixt].innerHTML = '<img src="'+ (/https/.test(document.location.href) ? 'https' : 'http')
13
+ +'://' + window.LTX_STATIC_HOST + port + '/img/loadbtn.gif" width="80" height="12" class="livetexBtnPreloader" />';
14
+ }
15
+ }
16
+ window.livetexTestLoadingFSB = 'undef: step = start';
17
+ window.livetexTestLink = '';
18
+
19
+ //setTimeout( function(){
20
+ // if (window.livetexTestLoadingFSB !== '1')
21
+ // {
22
+ // if (!window.livetexTestLoadingFSB) window.livetexTestLoadingFSB = 'undef';
23
+ // if (!window.livetexTestLink) window.livetexTestLink = 'nolink';
24
+ // jquery15.post(/https/.test(document.location.href) ? 'https' : 'http' + '://cs15.livetex.ru/buglog_fsb7.php?b=' + encodeURIComponent(navigator.userAgent) +
25
+ // '&u=[' + encodeURIComponent('[' + document.location.href + ']').split('#').join('') + ']' +
26
+ // '&f=' + encodeURIComponent(window.livetexTestLoadingFSB),
27
+ // { 'link' : encodeURIComponent(livetexTestLink)} );
28
+ // }
29
+ //}, 15000 );
30
+
31
+ if (window.liveTex && window.liveTexID && window.liveTex_object) {
32
+ window.liveTex = function (site_id)
33
+ {
34
+ var _lab, _auto, _soundL, _session_id, _server,
35
+ _site_id = site_id,
36
+ port = window.livetexTest ? (':' + window.livetexTest) : '',
37
+ http = /https/.test(document.location.href) ? 'https' : 'http',
38
+ logOn = /livetexLog/.test(document.location.href),
39
+ flag_loaded = false,
40
+ flag_js_loaded = false,
41
+ timestamp = {},
42
+ warning_time,
43
+ use_visits,
44
+ use_pages,
45
+ httpservLink ='';
46
+
47
+ var prechatFields = {};
48
+ var scriptSafeLoader = function( url, method, callback, name ){
49
+ var counter = 0,
50
+ isLoaded = false,
51
+ firstTimestamp = timestamp.check();
52
+
53
+ var _load = function( url, method, callback )
54
+ {
55
+ var ajaxResult;
56
+ counter += 1;
57
+
58
+ ajaxResult = jquery15.ajax({
59
+ url : url,
60
+ dataType : method,
61
+ timeout : (counter * 1000 + 5000)
62
+ });
63
+
64
+ if (typeof ajaxResult.fail !== 'undefined') ajaxResult.fail(_error);
65
+ else ajaxResult.error(_error);
66
+ ajaxResult.success(callback);
67
+ };
68
+
69
+ var _jsonpLoad = function ( url, callback )
70
+ {
71
+ _load( url, 'jsonp', function( data )
72
+ {
73
+ if (isLoaded) return;
74
+ else isLoaded = true;
75
+ callback( data );
76
+ }
77
+ );
78
+ };
79
+
80
+ var _scriptLoad = function( url, callback )
81
+ {
82
+ _load( url, 'script', function()
83
+ {
84
+ if (isLoaded) return;
85
+ else isLoaded = true;
86
+ callback();
87
+ }
88
+ );
89
+ };
90
+
91
+ var _startLoad = function( )
92
+ {
93
+ switch(method){
94
+ case 'jsonp' : _jsonpLoad( url, callback ); break;
95
+ case 'script': _scriptLoad( url, callback ); break;
96
+ default: return;
97
+ }
98
+ };
99
+
100
+ var _error = function( )
101
+ {
102
+ var add = '';
103
+ if (isLoaded) return ;
104
+ add += '_' + url
105
+ + '_' + (_session_id || 'none')
106
+ + '_' + firstTimestamp
107
+ + '_' + timestamp.check() +'_';
108
+
109
+
110
+ if (counter < 6) setTimeout( _startLoad, 1000);
111
+ else _postError('timeout_'+ name, add, '');
112
+ };
113
+
114
+ _startLoad();
115
+ };
116
+
117
+
118
+ var base64 = {};
119
+ base64.__KEYS_STR = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
120
+ base64.encode = function(string, opt_forUrl) {
121
+ var result = '';
122
+ var str = base64.__utfEncode(string);
123
+ if (window.btoa !== undefined) {
124
+ result = window.btoa(str);
125
+ } else {
126
+ var chr1, chr2, chr3,
127
+ enc1, enc2, enc3, enc4;
128
+ var i = 0;
129
+ while (i < str.length) {
130
+ chr1 = str.charCodeAt(i++);
131
+ chr2 = str.charCodeAt(i++);
132
+ chr3 = str.charCodeAt(i++);
133
+ enc1 = chr1 >> 2;
134
+ enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
135
+ enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
136
+ enc4 = chr3 & 63;
137
+ if (isNaN(chr2)) {
138
+ enc3 = enc4 = 64;
139
+ } else if (isNaN(chr3)) {
140
+ enc4 = 64;
141
+ }
142
+ result += base64.__KEYS_STR.charAt(enc1) +
143
+ base64.__KEYS_STR.charAt(enc2) +
144
+ base64.__KEYS_STR.charAt(enc3) +
145
+ base64.__KEYS_STR.charAt(enc4);
146
+ }
147
+ }
148
+ if (opt_forUrl) {
149
+ result = result.replace(/\+/g, '-')
150
+ .replace(/\//g, '_')
151
+ .replace(/\=+\s*$/g, '');
152
+ }
153
+ return result;
154
+ };
155
+ base64.__utfEncode = function(string) {
156
+ string = string.replace(/\r\n/g,"\n");
157
+ var utftext = "";
158
+ for (var n = 0; n < string.length; n++) {
159
+ var c = string.charCodeAt(n);
160
+ if (c < 128) {
161
+ utftext += String.fromCharCode(c);
162
+ }
163
+ else if((c > 127) && (c < 2048)) {
164
+ utftext += String.fromCharCode((c >> 6) | 192);
165
+ utftext += String.fromCharCode((c & 63) | 128);
166
+ }
167
+ else {
168
+ utftext += String.fromCharCode((c >> 12) | 224);
169
+ utftext += String.fromCharCode(((c >> 6) & 63) | 128);
170
+ utftext += String.fromCharCode((c & 63) | 128);
171
+ }
172
+ }
173
+ return utftext;
174
+ };
175
+
176
+
177
+ window.livetexTestLoadingFSB = 'undef: step = livetex start';
178
+
179
+ timestamp.start = new Date().getTime();
180
+ timestamp.check = function(){ return new Date().getTime() - this.start; };
181
+ timestamp.step = function(num)
182
+ {
183
+ //if (num == 4 && (this.check() - warning_time) > 4000) jquery15.getJSON(http + '://cs15.livetex.ru/buglog_temp.php?b=' + encodeURIComponent(navigator.userAgent) +
184
+ // '&u=[' + encodeURIComponent('[' + document.location.href + ']').split('#').join(''));
185
+ };
186
+
187
+ var _postError = function( script, message, stack )
188
+ {
189
+
190
+ };
191
+
192
+
193
+ var versionCheck = function( jq )
194
+ {
195
+ var first = jq.fn.jquery.split('.')[0].toString(),
196
+ second = jq.fn.jquery.split('.')[1].toString(),
197
+ third = jq.fn.jquery.split('.')[2] ? jq.fn.jquery.split('.')[2].toString() : 0 ;
198
+
199
+ if (second.length > 1) second = second[0];
200
+
201
+ return (jq.fn && +first >= 1 && +second >= 7 && (+second == 7 ? +third >= 2 : true ));
202
+ };
203
+
204
+ var _onload = function ()
205
+ {
206
+ window.livetexTestLoadingFSB = 'undef: step = _onload (start)';
207
+ timestamp.step('liveTex test: step 5');
208
+ if (!window.liveTexLabel) {
209
+ setTimeout(_onload, 100);
210
+ return true
211
+ }
212
+ window.livetexTestLoadingFSB = 'undef: step = _onload(after livetexlabel load)';
213
+ if (flag_loaded) {
214
+ return false;
215
+ }
216
+ window.livetexTestLoadingFSB = 'undef: step = _onload(after flag loaded)';
217
+ flag_loaded = true;
218
+ try
219
+ {
220
+ if (window.liveSettings)
221
+ {
222
+ window.livetexTestLoadingFSB = 'undef: step = _onload(we got livesettings)';
223
+ timestamp.step('liveTex test: step 6');
224
+ if (liveSettings.jarl.id)
225
+ {
226
+ window.livetexTestLoadingFSB = 'undef: step = _onload(into label)';
227
+ timestamp.step('liveTex test: step 7');
228
+ _lab = new liveTexLabel(liveSettings.jarl);
229
+ timestamp.step('liveTex test: step 8');
230
+ _auto = new liveTexAutoWelcome(_lab, liveSettings.auto);
231
+ timestamp.step('liveTex test: step 9');
232
+ if (window.liveSettings.jarl_sound) _soundL = new liveTexSoundLabel(liveSettings.jarl_sound);
233
+ }
234
+ window.livetexTestLoadingFSB = 'undef: step = _onload(after label)';
235
+ if (window.liveSettings.buttons && window.liveSettings.buttons.length)
236
+ {
237
+ window.livetexTestLoadingFSB = 'undef: step = _onload(into buttons)';
238
+ for (var i=0, l=liveSettings.buttons.length; i<l; i++)
239
+ {
240
+ if (typeof liveSettings.buttons[i] !== 'undefined') new liveTexButton(liveSettings.buttons[i])
241
+ }
242
+ }
243
+ window.livetexTestLoadingFSB = 'undef: step = _onload(after buttons)';
244
+ timestamp.step('liveTex test: step 10');
245
+ jquery15.cookie("livetex_uid", liveSettings.id_session, {
246
+ "path" : "/", "expires" : 14*60*24
247
+ });
248
+ jquery15.cookie("livetex_siteid", liveSettings.id_site, {
249
+ "path" : "/", "expires" : 14*60*24
250
+ });
251
+ }
252
+ window.livetexTestLoadingFSB = '1';
253
+ }
254
+ catch (e)
255
+ {
256
+ if (/BingPreview/.test(navigator.userAgent)) return ;
257
+ _postError('catched_onload', e.message, e.stack);
258
+ window.livetexTestLoadingFSB = 'FSB Except =|'+e.message+'|';
259
+ }
260
+
261
+
262
+ // Partial API stuff
263
+
264
+ (function(){
265
+ var api_get = function() {
266
+ return 'http://' + _server + "/?site_id=" + _site_id +
267
+ "&session_id=" + liveSettings.id_session +
268
+ '&flag_api=true' +
269
+ '&api_version=1.0.0&use_time=' + _get_livetex_cookie("livetex_time_all") || '0';
270
+ };
271
+ if (window.LiveTex !== undefined) {
272
+ LiveTex.setName = function(name) {
273
+ name = name.replace(/^\s+|\s+$/g, '').replace(/<[^>]*>/g, '');
274
+ if (name.length > 0) {
275
+ jquery15.getJSON(api_get() + '&api_action=setName&api_value='+
276
+ encodeURIComponent(name) +'&callback=?', '', function(){});
277
+ }
278
+ };
279
+ LiveTex.setManyPrechatFields = function(prechats, hidden){
280
+ prechatFields.prechat = prechats;
281
+ prechatFields.hidden = hidden;
282
+ };
283
+
284
+ if (LiveTex.onLiveTexReady !== undefined) {
285
+ LiveTex.onLiveTexReady();
286
+ }
287
+ }
288
+ })();
289
+
290
+
291
+ };
292
+ var ls_preload = function ( data )
293
+ {
294
+ if (data && data.error) { _postError('custom_badrequest', data.error, data.stack); return ;}
295
+ if (!data) {_postError('custom_livetexsimple_empty', httpservLink, {}); return ;}
296
+
297
+ window.livetexTestLoadingFSB = 'undef: step = livetex preload(start)';
298
+ //var data = livetexSimple;
299
+
300
+ timestamp.step('liveTex test: step 4');
301
+ timestamp.step('4');
302
+ var tempId,
303
+ tempElem,
304
+ buttons = {},
305
+ autos = {},
306
+ request = false;
307
+ window.livetexTestLoadingFSB = 'undef: step = livetex preload(before settings)';
308
+ if (data.button_list == null) data.button_list = [];
309
+ if (data.auto_list == null) data.auto_list = [];
310
+ // Подготавливаем настройки
311
+ for(var i1 = 0, l1 = data.button_list.length; i1 < l1; i1++)
312
+ {
313
+ buttons['id' + data.button_list[i1].local_id] = data.button_list[i1];
314
+ }
315
+ window.livetexTestLoadingFSB = 'undef: step = livetex preload(after buttons)';
316
+ for(var i2 = 0, l2 = data.auto_list.length; i2 < l2; i2++)
317
+ {
318
+ if (data.auto_list[i2].local_id == '-1')
319
+ {
320
+ // Приглашение из пульта оператора
321
+ request = true;
322
+ autos['id1'] = data.auto_list[i2];
323
+ }
324
+ else
325
+ {
326
+ autos['id' + data.auto_list[i2].local_id] = data.auto_list[i2];
327
+ }
328
+
329
+ }
330
+ window.livetexTestLoadingFSB = 'undef: step = livetex preload(prepared settings)';
331
+ // Добавляем настройку для приглашения из пульта оператора
332
+ if (request)
333
+ {
334
+ liveSettings.auto.splice(0, 1, // добавить в начало массива 1 элемент
335
+ {
336
+ "id" : 1,
337
+ "settings" : {"no_chat":"true","time_sec_page":"1"},
338
+ "oper" :
339
+ {
340
+ "say" : ""
341
+ },
342
+ "is_active" : false, "is_activated" : false
343
+ }
344
+ );
345
+ }
346
+ window.livetexTestLoadingFSB = 'undef: step = livetex preload(splice label)';
347
+ // Кнопки
348
+
349
+ // Обрабатываем настройки
350
+ for(var i3 = 0, l3 = liveSettings.buttons.length; i3 < l3; i3++ )
351
+ {
352
+ // Если кнопки нет, убираем запись
353
+ if (typeof liveSettings.buttons[i3] === 'undefined')
354
+ {
355
+ liveSettings.buttons.splice(i3, 1);
356
+ i3 -=1; l3 -=1;
357
+ continue;
358
+ }
359
+ // Получаем локальный ключ
360
+ tempId = 'id' + liveSettings.buttons[i3].id.split('liveTexButton_').join('');
361
+ tempElem = buttons[ tempId ];
362
+
363
+ if (!tempElem)
364
+ {
365
+ // Не приходит элемент с сервера, если неверно записаны в нём пользователь с группой
366
+ //delete liveSettings.buttons[i3];
367
+ liveSettings.buttons.splice(i3, 1);
368
+ i3 -= 1; l3 -= 1;
369
+ }
370
+ else
371
+ {
372
+ // Ставим настройки
373
+ liveSettings.buttons[i3].name = tempElem.member_firstname;
374
+ //+ ' ' +
375
+ // tempElem.member_lastname;
376
+ liveSettings.buttons[i3].depart = tempElem.group_name;
377
+ liveSettings.buttons[i3].foto = tempElem.member_photo_url;
378
+ liveSettings.buttons[i3].state = !!tempElem.state;
379
+ liveSettings.buttons[i3].no_group = data.flag_no_group;
380
+ //Если кнопка войс, то не принимать группу и мемебра от сервера
381
+ if (!liveSettings.buttons[i3].voice){
382
+ liveSettings.buttons[i3].member_id = tempElem.member_id;
383
+ liveSettings.buttons[i3].group_id = tempElem.group_id;
384
+ }
385
+
386
+ if (liveSettings.buttons[i3].flag_custom === 1)
387
+ {
388
+ // Оператор онлайн
389
+ if (!!tempElem.state)
390
+ {
391
+ liveSettings.buttons[i3].width = liveSettings.buttons[i3].customSettings.custom_w;
392
+ liveSettings.buttons[i3].height = liveSettings.buttons[i3].customSettings.custom_h;
393
+ liveSettings.buttons[i3].custom_def_w = liveSettings.buttons[i3].customSettings.custom_w;
394
+ liveSettings.buttons[i3].custom_def_h = liveSettings.buttons[i3].customSettings.custom_h;
395
+ }
396
+ // Оператор офлайн
397
+ else
398
+ {
399
+ liveSettings.buttons[i3].width = liveSettings.buttons[i3].customSettings.custom_woff;
400
+ liveSettings.buttons[i3].height = liveSettings.buttons[i3].customSettings.custom_hoff;
401
+ liveSettings.buttons[i3].custom_def_w = liveSettings.buttons[i3].customSettings.custom_woff;
402
+ liveSettings.buttons[i3].custom_def_h = liveSettings.buttons[i3].customSettings.custom_hoff;
403
+ }
404
+ }
405
+ }
406
+ }
407
+
408
+ window.livetexTestLoadingFSB = 'undef: step = livetex preload(set buttons)';
409
+ // Автоприглашения liveSettings.buttons
410
+ for(var i4 = 0, l4 = liveSettings.auto.length; i4 < l4; i4++ )
411
+ {
412
+ // Получаем локальный ключ
413
+ tempId = 'id' + liveSettings.auto[i4].id;
414
+ tempElem = autos[ tempId ];
415
+
416
+ if (!tempElem || !tempElem.state)
417
+ {
418
+ // Не приходит элемент с сервера, если неверно записаны в нём пользователь с группой
419
+
420
+ if (!liveSettings.auto[i4].flag_lid || !data.flag_enable_lid) liveSettings.auto[i4] = null;
421
+ }
422
+ else
423
+ {
424
+ // Ставим настройки
425
+ liveSettings.auto[i4].oper.name = tempElem.member_firstname + ' ' +
426
+ tempElem.member_lastname;
427
+ liveSettings.auto[i4].oper.bg = tempElem.member_photo_url;
428
+ liveSettings.auto[i4].oper.member_id = tempElem.member_id;
429
+ liveSettings.auto[i4].oper.group_id = tempElem.group_id;
430
+ liveSettings.auto[i4].oper.depart = tempElem.group_name;
431
+ liveSettings.auto[i4].member_id = tempElem.member_id;
432
+ liveSettings.auto[i4].group_id = tempElem.group_id;
433
+
434
+ if (tempId == 'id1')
435
+ {
436
+ liveSettings.auto[i4].oper.say = tempElem.text;
437
+ }
438
+ }
439
+ }
440
+ window.livetexTestLoadingFSB = 'undef: step = livetex preload(set auto)';
441
+ // Удаляем ненужные
442
+ for(var i5 = 0, l5 = liveSettings.auto.length, tempArray = []; i5 < l5; i5++ )
443
+ {
444
+ if (liveSettings.auto[i5] !== null) tempArray.push(liveSettings.auto[i5]);
445
+ }
446
+ window.livetexTestLoadingFSB = 'undef: step = livetex preload(del auto)';
447
+ liveSettings.auto = tempArray;
448
+
449
+ // Остальные настройки
450
+ liveSettings.session_part_id = data.session_id;
451
+ liveSettings.session_part_key = data.session_key;
452
+ liveSettings.stable = data.flag_server_stable ? 'stable' : 'unstable';
453
+ liveSettings.id_session = data.session_id + data.session_key;
454
+ liveSettings.id_site = _site_id;
455
+ liveSettings.jarl.state = data.flag_state;
456
+ liveSettings.state = data.flag_state;
457
+ //TODO заменить на false после выкатала глеба
458
+ liveSettings.lid = data.flag_enable_lid || false;
459
+ liveSettings.jarl.no_group = data.flag_no_group;
460
+
461
+
462
+ //Состояние звукового ярлыка
463
+ if (liveSettings.jarl_sound) liveSettings.jarl_sound.flag_slabel_state = !!data.flag_slabel_state;
464
+
465
+ //локация
466
+ liveSettings.location = {};
467
+ liveSettings.location.country_name = data.country_name;
468
+
469
+ liveSettings.location.region_name = data.region_name;
470
+ liveSettings.location.city_name = data.city_name;
471
+
472
+ // Загружаем ярлыки и кнопки
473
+ var temp = jquery15.ajaxSettings.cache;
474
+ jquery15.ajaxSettings.cache = true;
475
+ if (http === 'https') port = '';
476
+ var scriptLoad = http + '://' + window.LTX_STATIC_HOST + port +'/js/compiled/from_server_body.min.js';
477
+
478
+ scriptSafeLoader( scriptLoad, 'script', _onload, 'fsb' );
479
+
480
+ window.livetexTestLoadingFSB = 'FSBLOAD: step = livetex preload(script start loading)';
481
+ window.livetexTestLink = scriptLoad;
482
+ timestamp.step('liveTex test: step 4.1');
483
+ jquery15.ajaxSettings.cache = temp;
484
+ };
485
+
486
+ // Загрузка jQuery
487
+ var _jq_onload = function( loaded )
488
+ {
489
+ window.livetexTestLoadingFSB = 'undef: step = jquery onload(start)';
490
+ timestamp.step('liveTex test: step 2');
491
+
492
+ // Если скрипт сработал повторно, прекращаем
493
+ if (flag_js_loaded) return false;
494
+ window.livetexTestLoadingFSB = 'undef: step = jquery onload(before version check)';
495
+ // Если есть jQuery и её версия нам не подходит -
496
+ // Перезапрашиваем jQuery повторно с задержкой, она могла не подгрузиться
497
+ if (!window.jQuery || !versionCheck(window.jQuery)) {
498
+ setTimeout(function(){ _jq_onload(loaded); }, 100);
499
+ timestamp.step('liveTex test: step 2.05 - repeat, jQ version is - ' + (window.jQuery ? jQuery.fn.jquery : 'none'));
500
+ return true
501
+ }
502
+ window.livetexTestLoadingFSB = 'undef: step = jquery onload(after version check)';
503
+ // Скрипт запущен - повторные срабатывания будут отсеяны
504
+ flag_js_loaded = true;
505
+
506
+ // Если была загружена новая jQuery, разрешаем возможные конфликты
507
+ if (loaded)
508
+ {
509
+ window.livetexTestLoadingFSB = 'undef: step = jquery onload(new loaded version check)';
510
+ window.jquery15 = jQuery.noConflict(true);
511
+ }
512
+ // Если загружена не была, т.е. на сайте есть устраивающая нас версия jQuery
513
+ // Создаём на неё ссылку
514
+ else
515
+ {
516
+ window.livetexTestLoadingFSB = 'undef: step = jquery onload(old version check)';
517
+ window.jquery15 = jQuery;
518
+ }
519
+
520
+ /* Supply! */
521
+
522
+ //в следующих версиях не будет jquery browser
523
+ if (!window.jquery15.browser){
524
+ // Limit scope pollution from any deprecated API
525
+ (function() {
526
+
527
+ var matched, browser;
528
+
529
+ // Use of jQuery.browser is frowned upon.
530
+ // More details: http://api.jquery.com/jQuery.browser
531
+ // jQuery.uaMatch maintained for back-compat
532
+ jQuery.uaMatch = function( ua ) {
533
+ ua = ua.toLowerCase();
534
+
535
+ var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
536
+ /(webkit)[ \/]([\w.]+)/.exec( ua ) ||
537
+ /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
538
+ /(msie) ([\w.]+)/.exec( ua ) ||
539
+ ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
540
+ [];
541
+
542
+ return {
543
+ browser: match[ 1 ] || "",
544
+ version: match[ 2 ] || "0"
545
+ };
546
+ };
547
+
548
+ matched = jQuery.uaMatch( navigator.userAgent );
549
+ browser = {};
550
+
551
+ if ( matched.browser ) {
552
+ browser[ matched.browser ] = true;
553
+ browser.version = matched.version;
554
+ }
555
+
556
+ // Chrome is Webkit, but Webkit is also Safari.
557
+ if ( browser.chrome ) {
558
+ browser.webkit = true;
559
+ } else if ( browser.webkit ) {
560
+ browser.safari = true;
561
+ }
562
+
563
+ jQuery.browser = browser;
564
+
565
+ jQuery.sub = function() {
566
+ function jQuerySub( selector, context ) {
567
+ return new jQuerySub.fn.init( selector, context );
568
+ }
569
+ jQuery.extend( true, jQuerySub, this );
570
+ jQuerySub.superclass = this;
571
+ jQuerySub.fn = jQuerySub.prototype = this();
572
+ jQuerySub.fn.constructor = jQuerySub;
573
+ jQuerySub.sub = this.sub;
574
+ jQuerySub.fn.init = function init( selector, context ) {
575
+ if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
576
+ context = jQuerySub( context );
577
+ }
578
+
579
+ return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
580
+ };
581
+ jQuerySub.fn.init.prototype = jQuerySub.fn;
582
+ var rootjQuerySub = jQuerySub(document);
583
+ return jQuerySub;
584
+ };
585
+
586
+ })();
587
+ }
588
+
589
+ // jQuery Cookie
590
+ window.jquery15.cookie = function ( name, value, options )
591
+ {
592
+ var expires = ('undefined' !== typeof options && options.expires) ? options.expires : '',
593
+ path = ('undefined' !== typeof options && options.path) ? '; path=' + (options.path) : '',
594
+ domain = ('undefined' !== typeof options && options.domain) ? '; domain=' + (options.domain) : '',
595
+ secure = ('undefined' !== typeof options && options.secure) ? '; secure' : '',
596
+
597
+ /* const */
598
+ // Костанты
599
+ _const = {ONE_MINUTE : 60000},
600
+
601
+ /* methods */
602
+ // Получить куку
603
+ getCookie = function ( name )
604
+ {
605
+ var cookiesNotEmpty = (document.cookie && 0 < document.cookie.length),
606
+ cookies = cookiesNotEmpty ? document.cookie : null;
607
+
608
+ return (null === cookies) ? null : _extractCookieValue( cookies.split( ';' ), name );
609
+ },
610
+
611
+ setCookie = function ( name, value, path, expires, domain, secure )
612
+ {
613
+ expires = _formatExpires( expires );
614
+ document.cookie =
615
+ [name, '=', encodeURIComponent( value ), expires, path, domain, secure].join( '' );
616
+ return value;
617
+ },
618
+
619
+
620
+ delCookie = function ( name, path, domain, secure )
621
+ {
622
+ return setCookie( name, '', path, -1, domain, secure );
623
+ },
624
+
625
+ /* supply methods */
626
+
627
+ _extractCookieValue = function ( cookieHash, cookieName )
628
+ {
629
+ var cookieCurrentName = null,
630
+ cookie = null,
631
+ cookieValue = null,
632
+ i;
633
+
634
+ for ( i = 0; i < cookieHash.length; i++ )
635
+ {
636
+ cookie = jquery15.trim( cookieHash[i] );
637
+ cookieCurrentName = cookie.substring( 0, cookieName.length + 1 );
638
+ if ( cookieCurrentName === cookieName + '=' )
639
+ {
640
+ cookieValue = decodeURIComponent( cookie.substring( cookieName.length + 1 ) );
641
+ break;
642
+ }
643
+ }
644
+ return cookieValue || null;
645
+ },
646
+
647
+ _formatExpires = function ( expires )
648
+ {
649
+ var date;
650
+
651
+ if ( 'number' === typeof expires )
652
+ {
653
+ date = new Date();
654
+ date.setTime( date.getTime() + (expires * _const.ONE_MINUTE) );
655
+ return '; expires=' + date.toUTCString();
656
+ } else if ( 'undefined' !== typeof expires && expires && expires.toUTCString )
657
+ {
658
+ return '; expires=' + expires.toUTCString();
659
+ }
660
+ else
661
+ {
662
+ return '';
663
+ }
664
+ };
665
+
666
+ if ( 'undefined' == typeof value )
667
+ {
668
+ return getCookie( name );
669
+ } else if ( null === value )
670
+ {
671
+ return delCookie( name, path, domain, secure );
672
+ }
673
+ else
674
+ {
675
+ return setCookie( name, value, path, expires, domain, secure );
676
+ }
677
+ };
678
+ timestamp.step('liveTex test: step 2.1');
679
+
680
+ // Составляем путь
681
+ var newSite;
682
+ if ((site_id+"").length < 3) newSite = '0' + (site_id+"");
683
+ else newSite = site_id;
684
+ var startSite = (newSite+"").length - 3,
685
+ path = [ 'js/settings/',
686
+ (newSite+"").substr( startSite, 1 )+"", '/',
687
+ (newSite+"").substr( startSite + 1, 1 ), '/',
688
+ (newSite+"").substr( startSite + 2, 1 ), '/',
689
+ newSite, '.js?r=', Math.floor(Math.random() * 10000)
690
+ ].join('');
691
+ window.livetexTestLoadingFSB = 'undef: step = jquery onload(path)';
692
+ // Загружаем его
693
+ if (http === 'https') port = '';
694
+ var url = http + '://' + window.LTX_CS_HOST + port +'/' + path;
695
+ window.livetexTestLoadingFSB = 'undef: step = jquery onload(before load script)';
696
+
697
+ scriptSafeLoader( url, 'script', _settings_onload, 'settings');
698
+
699
+ window.livetexTestLoadingFSB = 'SETTINGS: step = jquery onload(after load script)';
700
+ window.livetexTestLink = url;
701
+
702
+ };
703
+
704
+ // Загрузка балансера после загрузки настроек
705
+ var _settings_onload = function ()
706
+ {
707
+ var balancer = [ http, '://',
708
+ window.livetexBalancer || 'lb3.livetex.ru', '/',
709
+ '?sender=client&action=getserver'].join("");
710
+ timestamp.step('liveTex test: step 2.2 - settings loaded, start preload balancer');
711
+
712
+ _balancer_cached_load(balancer);
713
+ window.livetexTestLoadingFSB = 'BALANCER: step = settings onload ver2(after start balancer loading ['+balancer+'])';
714
+ timestamp.step('liveTex test: step 2.3 - start after start preload balancer');
715
+ };
716
+
717
+ //кеширование настрое балансера в куках
718
+ var _balancer_cached_load = function(balancer){
719
+ var data = _get_livetex_cookie('livetex_balancer');
720
+ if (data != null && window.JSON !== undefined && window.JSON.parse !== undefined){
721
+ data = JSON.parse(data);
722
+ if (data.result_info && data.result_info === 'ok'){
723
+ _balancer_onload(data);
724
+ return;
725
+ }
726
+ }
727
+ scriptSafeLoader( balancer, 'jsonp', _balancer_onload, 'balancer' );
728
+ };
729
+
730
+ // Загрузка http сервера
731
+ var _balancer_onload = function (data, dontSaveBalancer)
732
+ {
733
+ if (!dontSaveBalancer && data.result_info && data.result_info === 'ok' && window.JSON !== undefined && window.JSON.stringify !== undefined){
734
+ jquery15.cookie("livetex_balancer", JSON.stringify(data) , {"path" : "/", "expires" : 5 /* 5 минут*/});
735
+ }
736
+ window.livetexTestLoadingFSB = 'undef: step = balancer onload(start)';
737
+ timestamp.step('liveTex test: step 3');
738
+
739
+ _session_id = _get_livetex_cookie("livetex_uid") || null;
740
+ var use_time = _get_livetex_cookie("livetex_time_all") || '0';
741
+ use_pages = +_get_livetex_cookie("livetex_countpage");
742
+ use_visits = +_get_livetex_cookie("livetex_visit");
743
+ if(use_pages === 0 || use_visits === 0) // апдейтим визит
744
+ {
745
+ use_visits += 1;
746
+ }
747
+ use_pages +=1;
748
+
749
+
750
+ //jquery15.cookie("livetex_visit", use_visits , {"path" : "/", "expires" : 14*60*24 /* 2 недели*/});
751
+ //jquery15.cookie("livetex_countpage", use_pages , {"path" : "/", "expires" : 2 /* 2 минуты*/});
752
+
753
+ var title = jquery15("title").text().substring(0, 1024) || "null";
754
+ var serv = _server = data.server;
755
+ var nocache = new Date();
756
+ nocache = nocache.getTime();
757
+ var get_string = "/?site_id=" + site_id + "&session_id=" + _session_id;
758
+ var refererObj = refererFunc(),
759
+ refererString = refererObj ? ('&seo_type=true&seo_engine=' + refererObj.engine + '&seo_q=' + base64.encode(refererObj.query)) : '&seo_type=false',
760
+ additional = (window.livetexAdditional) ? ('&additional=' + encodeURIComponent(livetexAdditional) ) : '';
761
+ window.livetexTestLoadingFSB = 'undef: step = balancer onload(after vars)';
762
+
763
+ var realReferrer = (refererObj && refererObj.realReferrer != '') ? refererObj.realReferrer : document.referrer;
764
+
765
+ get_string += "&referer=" + (realReferrer ? base64.encode(realReferrer) : "null") +
766
+ "&url=" + base64.encode(document.location.href) +
767
+ additional +
768
+ "&use_time=" + use_time +
769
+ "&use_visits=" + use_visits +
770
+ "&use_pages=" + use_pages +
771
+ "&title=" + base64.encode(title) + "&nocache=" + nocache + refererString +
772
+ "&flag_simple=true&settings=" + _getSettings();
773
+
774
+ window.livetexTestLoadingFSB = 'undef: step = balancer onload(after getstring)';
775
+
776
+ if (http === 'https') serv = serv.split(':80').join('');
777
+ get_string = http + '://' + serv + get_string;
778
+ window.livetexTestLoadingFSB = 'undef: step = balancer onload(after serv split)';
779
+ httpservLink = get_string;
780
+
781
+ scriptSafeLoader( get_string, 'jsonp', ls_preload, 'http' );
782
+
783
+ window.livetexTestLoadingFSB = 'undef: step = balancer onload(after script load)';
784
+ timestamp.step('liveTex test: step 3.1');
785
+ warning_time = timestamp.check();
786
+ window.livetexTestLoadingFSB = 'HTTP: step = balancer onload(after step check)';
787
+ window.livetexTestLink = get_string;
788
+ };
789
+
790
+ // Формирование настроек
791
+ var _getSettings = function()
792
+ {
793
+ if (!window.liveSettings) {_postError('custom_liveSettings_empty', 'Empty liveSettings', {}); return ;}
794
+ window.livetexTestLoadingFSB = 'undef: step = getsettings onload (start)';
795
+
796
+ var buttons = "", autos = "", settings;
797
+ // Формирование кнопок
798
+ for( var i1 = 0, l1 = liveSettings.buttons.length; i1 < l1; i1++ )
799
+ {
800
+ window.livetexTestLoadingFSB = 'undef: step = getsettings onload (in buttons)';
801
+ if (buttons) buttons += '-';
802
+ buttons += [ liveSettings.buttons[i1].id.split('liveTexButton_').join(''),
803
+ liveSettings.buttons[i1].member_id,
804
+ liveSettings.buttons[i1].group_id,
805
+ liveSettings.buttons[i1].voice].join('.');
806
+ }
807
+ window.livetexTestLoadingFSB = 'undef: step = getsettings onload (after buttons)';
808
+ // Формирование автоприглашений
809
+ for( var i2 = 0, l2 = liveSettings.auto.length; i2 < l2; i2++ )
810
+ {
811
+ window.livetexTestLoadingFSB = 'undef: step = getsettings onload (in auto)';
812
+ if (autos) autos += '-';
813
+ autos += [ liveSettings.auto[i2].id,
814
+ liveSettings.auto[i2].member_id,
815
+ liveSettings.auto[i2].group_id].join('.');
816
+ }
817
+ window.livetexTestLoadingFSB = 'undef: step = getsettings onload (after auto)';
818
+ settings = '(' + buttons + ')(' + autos + ')';
819
+ return settings;
820
+
821
+ };
822
+
823
+ var _get_livetex_cookie = function (name)
824
+ {
825
+ window.livetexTestLoadingFSB = 'undef: step = begin cookie (start)';
826
+ var cookieValue = null;
827
+ if (document.cookie && document.cookie != '')
828
+ {
829
+ var cookies = document.cookie.split(';');
830
+ for (var i = 0; i < cookies.length; i++)
831
+ {
832
+ var cookie = String.prototype.trim ? (cookies[i] == null ? "" : cookies[i].trim()) : (cookies[i] == null ? "" : cookies[i].toString().replace(/^\s+/,
833
+ "").replace(/\s+$/, ""));
834
+ if (cookie.substring(0, name.length + 1) == (name + '=')) {
835
+ cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
836
+ break
837
+ }
838
+ }
839
+ }
840
+ window.livetexTestLoadingFSB = 'undef: step = begin cookie (finish cookie)';
841
+ return cookieValue;
842
+ };
843
+ var _create_script = function (link, callback)
844
+ {
845
+ window.livetexTestLoadingFSB = 'undef: step = begin create script (start)';
846
+ window.livetexTestLoadingFSB = 'undef: step = create script';
847
+ var headID = document.getElementsByTagName("head")[0];
848
+ var newScript = document.createElement('script');
849
+ newScript.type = 'text/javascript';
850
+ newScript.src = link;
851
+ newScript.onload = newScript.onreadystatechange = callback;
852
+ headID.appendChild(newScript);
853
+ window.livetexTestLoadingFSB = 'undef: step = begin cookie (finish script)';
854
+ };
855
+ // Определение поисковика и запроса
856
+ var refererFunc = function ()
857
+ {
858
+ window.livetexTestLoadingFSB = 'undef: step = referer script(start)';
859
+ var engines =
860
+ [
861
+ {start:'http://www.google.', query:'q', name:'google'},
862
+ {start:'http://yandex.', query:'text', name:'yandex'},
863
+ {start:'rambler.ru/search', query:'query', name:'rambler'},
864
+ {start:'http://go.mail.ru/', query:'q', name:'mailru'},
865
+ {start:'http://www.bing.com/', query:'q', name:'bing'},
866
+ {start:'search.yahoo.com/search', query:'p', name:'yahoo'},
867
+ {start:'http://ru.ask.com/', query:'q', name:'ask'},
868
+ {start:'http://search.qip.ru/search', query:'query', name:'qip'}
869
+ ],
870
+
871
+ ref=document.referrer, req="",engine="", start, cp1251;
872
+ window.livetexTestLoadingFSB = 'undef: step = referer script(after engines)';
873
+ for (var i in engines){
874
+ if (!engines.hasOwnProperty(i))
875
+ continue;
876
+ if (ref.indexOf(engines[i].start)==-1)
877
+ continue;
878
+ start = ref.indexOf('?' + engines[i].query + '=');
879
+ if (start == -1){
880
+ start = ref.indexOf('&' + engines[i].query + '=');
881
+ if (start == -1)
882
+ return false;
883
+ }
884
+ engine = engines[i].name;
885
+ req = engines[i].query;
886
+ cp1251 = engines[i].hasOwnProperty('cp1251');
887
+ }
888
+ window.livetexTestLoadingFSB = 'undef: step = referer script(after for)';
889
+ if (!engine)
890
+ return false;
891
+ ref = ref.substr(start + req.length + 2);
892
+ var end = ref.indexOf('&');
893
+ window.livetexTestLoadingFSB = 'undef: step = referer script(after indexof)';
894
+ if (end != -1)
895
+ ref = ref.substr(0, end);
896
+ if (cp1251){
897
+ window.livetexTestLoadingFSB = 'undef: step = referer script(before 1251)';
898
+ function win2unicode(str) {
899
+ var charmap = unescape(
900
+ "%u0402%u0403%u201A%u0453%u201E%u2026%u2020%u2021%u20AC%u2030%u0409%u2039%u040A%u040C%u040B%u040F"+
901
+ "%u0452%u2018%u2019%u201C%u201D%u2022%u2013%u2014%u0000%u2122%u0459%u203A%u045A%u045C%u045B%u045F"+
902
+ "%u00A0%u040E%u045E%u0408%u00A4%u0490%u00A6%u00A7%u0401%u00A9%u0404%u00AB%u00AC%u00AD%u00AE%u0407"+
903
+ "%u00B0%u00B1%u0406%u0456%u0491%u00B5%u00B6%u00B7%u0451%u2116%u0454%u00BB%u0458%u0405%u0455%u0457");
904
+ var code2char = function(code) {
905
+ if(code >= 0xC0 && code <= 0xFF) return String.fromCharCode(code - 0xC0 + 0x0410);
906
+ if(code >= 0x80 && code <= 0xBF) return charmap.charAt(code - 0x80);
907
+ return String.fromCharCode(code);
908
+ };
909
+ var res = "";
910
+ for(var i = 0; i < str.length; i++) res = res + code2char(str.charCodeAt(i));
911
+ return res;
912
+ }
913
+ ref = unescape(ref);
914
+ ref = win2unicode(ref);
915
+ }else
916
+ ref = decodeURIComponent(ref);
917
+ window.livetexTestLoadingFSB = 'undef: step = referer script(afer 1251)';
918
+ ref = ref.replace(/[+]+/g, ' ');
919
+ window.livetexTestLoadingFSB = 'undef: step = referer script(afer reg)';
920
+
921
+ //если это гугл, то получаем реальный реферер
922
+ var realReferrer = '';
923
+ if (engine === 'google'){
924
+ var pattern = /&q=(.+?)&/;
925
+
926
+ if (pattern.test(document.referrer)){
927
+ var res = pattern.exec(document.referrer);
928
+ realReferrer = 'http://google.com/search?q=' + res[1];
929
+ }
930
+
931
+ }
932
+ return {"engine": engine, "query": ref, "realReferrer" : realReferrer};
933
+ };
934
+
935
+ timestamp.step('liveTex test: step 1');
936
+ if (!window.jQuery || !versionCheck(window.jQuery))
937
+ {
938
+ window.livetexTestLoadingFSB = 'undef: step = loading jq 1.7.2';
939
+ timestamp.step('liveTex test: step 1.1');
940
+ _create_script(http + "://" + window.LTX_STATIC_HOST + port +"/js/jquery-1.7.2.min.js", function()
941
+ {
942
+ timestamp.step('liveTex test: step 1.1.1');
943
+ _jq_onload(true)
944
+ });
945
+ timestamp.step('liveTex test: step 1.1.0');
946
+ }
947
+ else {
948
+ window.livetexTestLoadingFSB = 'undef: step = NOT loading jq 1.7.2';
949
+ timestamp.step('liveTex test: step 1.2');
950
+ _jq_onload(false);
951
+ timestamp.step('liveTex test: step 1.2.0');
952
+ }
953
+ return {
954
+ prechatFields : prechatFields,
955
+ scriptSafeLoader : scriptSafeLoader,
956
+ label : function ()
957
+ {
958
+ return _lab;
959
+ },
960
+ auto_welcome : function ()
961
+ {
962
+ return _auto;
963
+ },
964
+ site_id : function ()
965
+ {
966
+ return _site_id;
967
+ },
968
+ getServer : function()
969
+ {
970
+ return _server;
971
+ },
972
+ getStatus : function()
973
+ {
974
+ return (window.liveSettings) ? liveSettings.state : false;
975
+ },
976
+ hideLabel : function()
977
+ {
978
+ if (window.jquery15)
979
+ {
980
+ jquery15( '#content_' + liveSettings.jarl.id ).hide();
981
+ }
982
+ },
983
+ showLabel : function()
984
+ {
985
+ // alert( '#' + liveSettings.jarl.id);
986
+ if( window.liveSettings && liveSettings.jarl && liveSettings.jarl.flag_hide_offline && !liveSettings.jarl.state)
987
+ {
988
+ return ;
989
+ }
990
+
991
+ if (window.jquery15 )
992
+ {
993
+ //alert( '2' );
994
+ jquery15( '#' + liveSettings.jarl.id ).show();
995
+ }
996
+ }
997
+ }
998
+ };
999
+ if (window.liveTex_object === true)
1000
+ {
1001
+ window.livetexTestLoadingFSB = 'undef: step = livetex start create';
1002
+ try
1003
+ {
1004
+ liveTex_object=new liveTex(liveTexID);
1005
+ }
1006
+ catch(e)
1007
+ {
1008
+
1009
+ }
1010
+ window.ltAPI = liveTex_object;
1011
+ window.livetexTestLoadingFSB = 'undef: step = livetex create';
1012
+ }
1013
+ }
1014
+ else
1015
+ {
1016
+ window.livetexTestLoadingFSB = 'undef: step = bad site settings';
1017
+ }