pwb 1.0.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (367) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/app/assets/javascripts/comfy/admin/cms/custom.js.coffee +1 -0
  4. data/app/assets/stylesheets/comfy/admin/cms/custom.sass +1 -0
  5. data/app/assets/stylesheets/pwb/themes/berlin/inmo.scss +6 -1
  6. data/app/assets/stylesheets/pwb/themes/berlin/main.scss +12 -11
  7. data/app/assets/stylesheets/pwb/themes/default/shame.scss +1 -1
  8. data/app/controllers/pwb/admin_panel_controller.rb +2 -2
  9. data/app/controllers/pwb/api/v1/cms_pages_controller.rb +102 -0
  10. data/app/controllers/pwb/api/v1/website_controller.rb +7 -0
  11. data/app/controllers/pwb/api_public/v1/props_controller.rb +2 -2
  12. data/app/controllers/pwb/application_api_controller.rb +3 -7
  13. data/app/controllers/pwb/application_controller.rb +2 -3
  14. data/app/controllers/pwb/comfy_controller.rb +106 -0
  15. data/app/controllers/pwb/css_controller.rb +1 -2
  16. data/app/controllers/pwb/devise/registrations_controller.rb +2 -5
  17. data/app/controllers/pwb/devise_controller.rb +3 -8
  18. data/app/controllers/pwb/export/properties_controller.rb +5 -6
  19. data/app/controllers/pwb/export/translations_controller.rb +1 -5
  20. data/app/controllers/pwb/export/web_contents_controller.rb +1 -4
  21. data/app/controllers/pwb/export/website_controller.rb +0 -1
  22. data/app/controllers/pwb/import/mls_controller.rb +3 -6
  23. data/app/controllers/pwb/import/properties_controller.rb +2 -4
  24. data/app/controllers/pwb/import/scrapper_controller.rb +6 -9
  25. data/app/controllers/pwb/props_controller.rb +10 -13
  26. data/app/controllers/pwb/search_controller.rb +16 -16
  27. data/app/controllers/pwb/sections_controller.rb +21 -22
  28. data/app/controllers/pwb/welcome_controller.rb +1 -2
  29. data/app/helpers/pwb/application_helper.rb +37 -0
  30. data/app/helpers/pwb/css_helper.rb +9 -0
  31. data/app/models/pwb/cms_page_container.rb +9 -0
  32. data/app/models/pwb/content.rb +10 -6
  33. data/app/models/pwb/prop.rb +12 -4
  34. data/app/models/pwb/section.rb +1 -1
  35. data/app/models/pwb/website.rb +14 -1
  36. data/app/resources/pwb/api/v1/cms_block_resource.rb +11 -0
  37. data/app/resources/pwb/api/v1/cms_page_resource.rb +27 -0
  38. data/app/themes/berlin/views/layouts/pwb/application.html.erb +25 -9
  39. data/app/themes/berlin/views/pwb/props/show.html.erb +5 -5
  40. data/app/themes/berlin/views/pwb/search/_search_results.html.erb +2 -1
  41. data/app/themes/berlin/views/pwb/search/buy.html.erb +1 -1
  42. data/app/themes/berlin/views/pwb/search/rent.html.erb +2 -1
  43. data/app/themes/berlin/views/pwb/sections/about_us.html.erb +3 -2
  44. data/app/themes/berlin/views/pwb/sections/cms.html.erb +34 -0
  45. data/app/themes/berlin/views/pwb/sections/contact_us.html.erb +2 -1
  46. data/app/themes/berlin/views/pwb/welcome/_about_us_to_del.html.erb +35 -0
  47. data/app/themes/berlin/views/pwb/welcome/{_adv_search.html.erb → _adv_search_to_del.html.erb} +0 -0
  48. data/app/themes/berlin/views/pwb/welcome/_landing_carousel.html.erb +1 -1
  49. data/app/themes/berlin/views/pwb/welcome/_latest_properties.html.erb +2 -1
  50. data/app/themes/default/views/layouts/pwb/application.html.erb +24 -3
  51. data/app/themes/default/views/pwb/sections/about_us.html.erb +1 -2
  52. data/app/themes/default/views/pwb/sections/cms.html.erb +30 -0
  53. data/app/themes/default/views/pwb/welcome/_single_property_row.html.erb +2 -1
  54. data/app/themes/default/views/pwb/welcome/index.html.erb +3 -1
  55. data/app/views/layouts/pwb/devise.html.erb +1 -0
  56. data/app/views/pwb/_analytics.html.erb +15 -0
  57. data/app/views/pwb/_footer.html.erb +0 -12
  58. data/app/views/pwb/custom_css/{berlin.css.erb → _berlin.css.erb} +0 -1
  59. data/app/views/pwb/custom_css/{default.css.erb → _default.css.erb} +0 -1
  60. data/app/views/pwb/custom_css/_shared.css.erb +1 -0
  61. data/app/views/pwb/props/_images_section_carousel.html.erb +13 -27
  62. data/app/views/pwb/props/_prop_info_list.html.erb +1 -1
  63. data/app/views/pwb/search/_search_result_item.html.erb +62 -64
  64. data/app/views/pwb/search/_search_result_item_to_del.html.erb +3 -3
  65. data/config/client_setups/default.json +59 -21
  66. data/config/cms_page_containers/about-us.json +18 -0
  67. data/config/cms_page_containers/about.json +107 -0
  68. data/config/cms_page_containers/landing.json +19 -0
  69. data/config/cms_page_containers/legal.json +17 -0
  70. data/config/cms_page_containers/sell.json +96 -0
  71. data/config/initializers/cloudinary.rb +3 -0
  72. data/config/initializers/comfortable_mexican_sofa.rb +142 -0
  73. data/config/locales/admin.en.yml +213 -0
  74. data/config/locales/admin.es.yml +32 -17
  75. data/config/locales/admin.ru.yml +432 -0
  76. data/config/locales/admin.zh.yml.tmp +226 -0
  77. data/config/locales/de.yml +31 -32
  78. data/config/locales/devise.zh-HK.yml +119 -0
  79. data/config/locales/en.yml +3 -0
  80. data/config/locales/es.yml +3 -5
  81. data/config/locales/rails.zh-HK.yml +210 -0
  82. data/config/locales/ru.yml +11 -11
  83. data/config/locales/zh-HK.yml +154 -0
  84. data/config/routes.rb +17 -2
  85. data/db/cms_fixtures/cms/categories/pages.yml +3 -0
  86. data/db/cms_fixtures/cms/files/_rerenting-landing_framed.png.yml +6 -0
  87. data/{spec/dummy/public/system/comfy/cms/files/files/000/000/003/original → db/cms_fixtures/cms/files}/rerenting-landing_framed.png +0 -0
  88. data/db/cms_fixtures/cms/layouts/about-us/attributes.yml +4 -0
  89. data/db/cms_fixtures/cms/layouts/about-us/content.html +0 -0
  90. data/db/cms_fixtures/cms/layouts/about-us/javascript.js +0 -0
  91. data/db/cms_fixtures/cms/layouts/about-us/people/attributes.yml +4 -0
  92. data/db/cms_fixtures/cms/layouts/about-us/people/content.html +55 -0
  93. data/db/cms_fixtures/cms/layouts/about-us/services/attributes.yml +4 -0
  94. data/db/cms_fixtures/cms/layouts/about-us/services/content.html +32 -0
  95. data/db/cms_fixtures/cms/layouts/about-us/services/javascript.js +0 -0
  96. data/db/cms_fixtures/cms/layouts/about-us/services/stylesheet.css +0 -0
  97. data/db/cms_fixtures/cms/layouts/about-us/stylesheet.css +0 -0
  98. data/db/cms_fixtures/cms/layouts/default-layout/attributes.yml +4 -0
  99. data/db/cms_fixtures/cms/layouts/default-layout/content.html +51 -0
  100. data/db/cms_fixtures/cms/layouts/default-layout/javascript.js +0 -0
  101. data/db/cms_fixtures/cms/layouts/default-layout/stylesheet.css +0 -0
  102. data/db/cms_fixtures/cms/pages/index/about-us/attributes.yml +8 -0
  103. data/db/cms_fixtures/cms/pages/index/about-us/people/attributes.yml +8 -0
  104. data/db/cms_fixtures/cms/pages/index/about-us/people/de/attributes.yml +8 -0
  105. data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_details_a.html +1 -0
  106. data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_details_b.html +1 -0
  107. data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_details_c.html +1 -0
  108. data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_details_d.html +1 -0
  109. data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_img_url_a.html +1 -0
  110. data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_img_url_b.html +1 -0
  111. data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_img_url_c.html +1 -0
  112. data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_img_url_d.html +1 -0
  113. data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_name_a.html +1 -0
  114. data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_name_b.html +1 -0
  115. data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_name_c.html +1 -0
  116. data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_name_d.html +1 -0
  117. data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_title_a.html +1 -0
  118. data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_title_b.html +1 -0
  119. data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_title_c.html +1 -0
  120. data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_title_d.html +1 -0
  121. data/db/cms_fixtures/cms/pages/index/about-us/people/en/attributes.yml +8 -0
  122. data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_details_a.html +1 -0
  123. data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_details_b.html +1 -0
  124. data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_details_c.html +1 -0
  125. data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_details_d.html +1 -0
  126. data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_img_url_a.html +1 -0
  127. data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_img_url_b.html +1 -0
  128. data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_img_url_c.html +1 -0
  129. data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_img_url_d.html +1 -0
  130. data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_name_a.html +1 -0
  131. data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_name_b.html +1 -0
  132. data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_name_c.html +1 -0
  133. data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_name_d.html +1 -0
  134. data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_title_a.html +1 -0
  135. data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_title_b.html +1 -0
  136. data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_title_c.html +1 -0
  137. data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_title_d.html +1 -0
  138. data/db/cms_fixtures/cms/pages/index/about-us/people/es/attributes.yml +8 -0
  139. data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_details_a.html +1 -0
  140. data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_details_b.html +1 -0
  141. data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_details_c.html +1 -0
  142. data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_details_d.html +1 -0
  143. data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_img_url_a.html +1 -0
  144. data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_img_url_b.html +1 -0
  145. data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_img_url_c.html +1 -0
  146. data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_img_url_d.html +1 -0
  147. data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_name_a.html +1 -0
  148. data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_name_b.html +1 -0
  149. data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_name_c.html +1 -0
  150. data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_name_d.html +1 -0
  151. data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_title_a.html +1 -0
  152. data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_title_b.html +1 -0
  153. data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_title_c.html +1 -0
  154. data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_title_d.html +1 -0
  155. data/db/cms_fixtures/cms/pages/index/about-us/people/pt/attributes.yml +8 -0
  156. data/db/cms_fixtures/cms/pages/index/about-us/people/pt/person_details_a.html +1 -0
  157. data/db/cms_fixtures/cms/pages/index/about-us/people/pt/person_details_b.html +1 -0
  158. data/db/cms_fixtures/cms/pages/index/about-us/people/pt/person_details_c.html +1 -0
  159. data/db/cms_fixtures/cms/pages/index/about-us/people/pt/person_details_d.html +1 -0
  160. data/db/cms_fixtures/cms/pages/index/about-us/people/pt/person_name_a.html +1 -0
  161. data/db/cms_fixtures/cms/pages/index/about-us/people/pt/person_name_b.html +1 -0
  162. data/db/cms_fixtures/cms/pages/index/about-us/people/pt/person_name_c.html +1 -0
  163. data/db/cms_fixtures/cms/pages/index/about-us/people/pt/person_name_d.html +1 -0
  164. data/db/cms_fixtures/cms/pages/index/about-us/people/pt/person_title_a.html +1 -0
  165. data/db/cms_fixtures/cms/pages/index/about-us/people/pt/person_title_b.html +1 -0
  166. data/db/cms_fixtures/cms/pages/index/about-us/people/pt/person_title_c.html +1 -0
  167. data/db/cms_fixtures/cms/pages/index/about-us/people/pt/person_title_d.html +1 -0
  168. data/db/cms_fixtures/cms/pages/index/about-us/people/ru/attributes.yml +8 -0
  169. data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_details_a.html +1 -0
  170. data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_details_b.html +1 -0
  171. data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_details_c.html +1 -0
  172. data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_details_d.html +1 -0
  173. data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_img_url_a.html +1 -0
  174. data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_img_url_b.html +1 -0
  175. data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_img_url_c.html +1 -0
  176. data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_img_url_d.html +1 -0
  177. data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_name_a.html +1 -0
  178. data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_name_b.html +1 -0
  179. data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_name_c.html +1 -0
  180. data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_name_d.html +1 -0
  181. data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_title_a.html +1 -0
  182. data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_title_b.html +1 -0
  183. data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_title_c.html +1 -0
  184. data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_title_d.html +1 -0
  185. data/db/cms_fixtures/cms/pages/index/about-us/services/attributes.yml +8 -0
  186. data/db/cms_fixtures/cms/pages/index/about-us/services/content_a.html +1 -0
  187. data/db/cms_fixtures/cms/pages/index/about-us/services/content_b.html +0 -0
  188. data/db/cms_fixtures/cms/pages/index/about-us/services/content_c.html +0 -0
  189. data/db/cms_fixtures/cms/pages/index/about-us/services/de/attributes.yml +8 -0
  190. data/db/cms_fixtures/cms/pages/index/about-us/services/de/content_a.html +1 -0
  191. data/db/cms_fixtures/cms/pages/index/about-us/services/de/content_b.html +1 -0
  192. data/db/cms_fixtures/cms/pages/index/about-us/services/de/content_c.html +1 -0
  193. data/db/cms_fixtures/cms/pages/index/about-us/services/de/title_a.html +1 -0
  194. data/db/cms_fixtures/cms/pages/index/about-us/services/de/title_b.html +1 -0
  195. data/db/cms_fixtures/cms/pages/index/about-us/services/de/title_c.html +1 -0
  196. data/db/cms_fixtures/cms/pages/index/about-us/services/en/attributes.yml +8 -0
  197. data/db/cms_fixtures/cms/pages/index/about-us/services/en/content_a.html +1 -0
  198. data/db/cms_fixtures/cms/pages/index/about-us/services/en/content_b.html +1 -0
  199. data/db/cms_fixtures/cms/pages/index/about-us/services/en/content_c.html +1 -0
  200. data/db/cms_fixtures/cms/pages/index/about-us/services/en/title_a.html +1 -0
  201. data/db/cms_fixtures/cms/pages/index/about-us/services/en/title_b.html +1 -0
  202. data/db/cms_fixtures/cms/pages/index/about-us/services/en/title_c.html +1 -0
  203. data/db/cms_fixtures/cms/pages/index/about-us/services/es/attributes.yml +8 -0
  204. data/db/cms_fixtures/cms/pages/index/about-us/services/es/content_a.html +1 -0
  205. data/db/cms_fixtures/cms/pages/index/about-us/services/es/content_b.html +1 -0
  206. data/db/cms_fixtures/cms/pages/index/about-us/services/es/content_c.html +1 -0
  207. data/db/cms_fixtures/cms/pages/index/about-us/services/es/title_a.html +1 -0
  208. data/db/cms_fixtures/cms/pages/index/about-us/services/es/title_b.html +1 -0
  209. data/db/cms_fixtures/cms/pages/index/about-us/services/es/title_c.html +1 -0
  210. data/db/cms_fixtures/cms/pages/index/about-us/services/title_a.html +1 -0
  211. data/db/cms_fixtures/cms/pages/index/about-us/services/title_b.html +0 -0
  212. data/db/cms_fixtures/cms/pages/index/about-us/services/title_c.html +0 -0
  213. data/db/cms_fixtures/cms/pages/index/attributes.yml +8 -0
  214. data/db/cms_fixtures/cms/pages/index/content.html +1 -0
  215. data/db/cms_fixtures/cms/pages/index/title.html +0 -0
  216. data/db/cms_fixtures/cms/snippets/snippet1/attributes.yml +3 -0
  217. data/db/cms_fixtures/cms/snippets/snippet1/content.html +1 -0
  218. data/db/cms_fixtures/sample-site/categories/files.yml +1 -0
  219. data/db/cms_fixtures/sample-site/categories/pages.yml +1 -0
  220. data/db/cms_fixtures/sample-site/categories/snippets.yml +1 -0
  221. data/db/cms_fixtures/sample-site/files/_sample.jpg.yml +5 -0
  222. data/db/cms_fixtures/sample-site/files/sample.jpg +0 -0
  223. data/db/cms_fixtures/sample-site/layouts/default/attributes.yml +1 -0
  224. data/db/cms_fixtures/sample-site/layouts/default/content.html +5 -0
  225. data/db/cms_fixtures/sample-site/layouts/default/javascript.js +1 -0
  226. data/db/cms_fixtures/sample-site/layouts/default/nested/attributes.yml +2 -0
  227. data/db/cms_fixtures/sample-site/layouts/default/nested/content.haml +3 -0
  228. data/db/cms_fixtures/sample-site/layouts/default/nested/javascript.js +1 -0
  229. data/db/cms_fixtures/sample-site/layouts/default/nested/stylesheet.css +1 -0
  230. data/db/cms_fixtures/sample-site/layouts/default/stylesheet.css +1 -0
  231. data/db/cms_fixtures/sample-site/pages/index/attributes.yml +6 -0
  232. data/db/cms_fixtures/sample-site/pages/index/child/attributes.yml +3 -0
  233. data/db/cms_fixtures/sample-site/pages/index/child/left.haml +1 -0
  234. data/db/cms_fixtures/sample-site/pages/index/child/right.html +1 -0
  235. data/db/cms_fixtures/sample-site/pages/index/child/thumbnail.png +0 -0
  236. data/db/cms_fixtures/sample-site/pages/index/content.html +2 -0
  237. data/db/cms_fixtures/sample-site/snippets/default/attributes.yml +4 -0
  238. data/db/cms_fixtures/sample-site/snippets/default/content.html +1 -0
  239. data/db/migrate/20170513221300_create_cms.rb +133 -0
  240. data/db/seeds/spain/translations.rb +2 -2
  241. data/db/seeds/translations_ca.rb +92 -0
  242. data/db/seeds/translations_de.rb +86 -85
  243. data/db/seeds/translations_en.rb +73 -73
  244. data/db/seeds/translations_es.rb +79 -78
  245. data/db/seeds/translations_ru.rb +92 -0
  246. data/db/yml_seeds/prop/flat_for_rent.yml +4 -4
  247. data/db/yml_seeds/sections.yml +2 -2
  248. data/db/yml_seeds/website.yml +3 -1
  249. data/lib/pwb/cms_data_loader.rb +38 -0
  250. data/lib/pwb/engine.rb +1 -0
  251. data/lib/pwb/locale_loader.rb +47 -0
  252. data/lib/pwb/seeder.rb +8 -5
  253. data/lib/pwb/version.rb +1 -1
  254. data/lib/tasks/pwb_tasks.rake +1 -0
  255. data/spec/dummy/config/routes.rb +5 -0
  256. data/spec/dummy/config/secrets.yml +5 -0
  257. data/spec/dummy/db/schema.rb +111 -1
  258. data/spec/dummy/log/development.log +0 -0
  259. data/spec/features/pwb/admin_spec.rb +14 -40
  260. data/spec/features/pwb/admin_spec_tmp.rb +54 -0
  261. data/spec/fixtures/to_import/pwb-properties.csv +2 -2
  262. data/spec/views/pwb/application_layout.html.erb_spec.rb +1 -0
  263. metadata +207 -235
  264. data/app/themes/berlin/views/pwb/welcome/_about_us.html.erb +0 -36
  265. data/db/seeds/translations_others.rb +0 -215
  266. data/spec/dummy/public/assets/application-af04b226fd7202dfc532ce7aedb95a0128277937e90d3b3a3d35e1cce9e16886.css +0 -16
  267. data/spec/dummy/public/assets/application-af04b226fd7202dfc532ce7aedb95a0128277937e90d3b3a3d35e1cce9e16886.css.gz +0 -0
  268. data/spec/dummy/public/assets/application-ec8550e416fd8df1557ddb7f132ccd38baaafd36e4c5c9aff8420fbd47c0313f.js +0 -617
  269. data/spec/dummy/public/assets/application-ec8550e416fd8df1557ddb7f132ccd38baaafd36e4c5c9aff8420fbd47c0313f.js.gz +0 -0
  270. data/spec/dummy/public/assets/bootstrap/glyphicons-halflings-regular-13634da87d9e23f8c3ed9108ce1724d183a39ad072e73e1b3d8cbf646d2d0407.eot +0 -0
  271. data/spec/dummy/public/assets/bootstrap/glyphicons-halflings-regular-13634da87d9e23f8c3ed9108ce1724d183a39ad072e73e1b3d8cbf646d2d0407.eot.gz +0 -0
  272. data/spec/dummy/public/assets/bootstrap/glyphicons-halflings-regular-42f60659d265c1a3c30f9fa42abcbb56bd4a53af4d83d316d6dd7a36903c43e5.svg +0 -288
  273. data/spec/dummy/public/assets/bootstrap/glyphicons-halflings-regular-42f60659d265c1a3c30f9fa42abcbb56bd4a53af4d83d316d6dd7a36903c43e5.svg.gz +0 -0
  274. data/spec/dummy/public/assets/bootstrap/glyphicons-halflings-regular-a26394f7ede100ca118eff2eda08596275a9839b959c226e15439557a5a80742.woff +0 -0
  275. data/spec/dummy/public/assets/bootstrap/glyphicons-halflings-regular-e395044093757d82afcb138957d06a1ea9361bdcf0b442d06a18a8051af57456.ttf +0 -0
  276. data/spec/dummy/public/assets/bootstrap/glyphicons-halflings-regular-e395044093757d82afcb138957d06a1ea9361bdcf0b442d06a18a8051af57456.ttf.gz +0 -0
  277. data/spec/dummy/public/assets/bootstrap/glyphicons-halflings-regular-fe185d11a49676890d47bb783312a0cda5a44c4039214094e7957b4c040ef11c.woff2 +0 -0
  278. data/spec/dummy/public/assets/pwb/application-0dc6ff845cde8e032ed365593c17fe09c18a6966d44f551946bf1673d8d1ac51.css +0 -13
  279. data/spec/dummy/public/assets/pwb/application-0dc6ff845cde8e032ed365593c17fe09c18a6966d44f551946bf1673d8d1ac51.css.gz +0 -0
  280. data/spec/dummy/public/assets/pwb/application-b4df8e7ae7700a0d09d88175af77e7f457ca2fbe15ae08450551ebf3bfb0c4d1.js +0 -15656
  281. data/spec/dummy/public/assets/pwb/application-b4df8e7ae7700a0d09d88175af77e7f457ca2fbe15ae08450551ebf3bfb0c4d1.js.gz +0 -0
  282. data/spec/dummy/public/assets/pwb/themes/berlin-279c2e3a7fa11a902fdee83a6819dcc315ff8eb240cfad21b1322cedadb07ea7.js +0 -18690
  283. data/spec/dummy/public/assets/pwb/themes/berlin-279c2e3a7fa11a902fdee83a6819dcc315ff8eb240cfad21b1322cedadb07ea7.js.gz +0 -0
  284. data/spec/dummy/public/assets/pwb/themes/berlin-8038d5cfd670e73fbffb581f6bb8d8c00ac448957945622c5c34438c467d218b.css +0 -8582
  285. data/spec/dummy/public/assets/pwb/themes/berlin-8038d5cfd670e73fbffb581f6bb8d8c00ac448957945622c5c34438c467d218b.css.gz +0 -0
  286. data/spec/dummy/public/assets/pwb/themes/chic-facdff61de4827adfd797b6a36ffd6c8b432072df7190ed722d039f971caa539.css +0 -3500
  287. data/spec/dummy/public/assets/pwb/themes/chic-facdff61de4827adfd797b6a36ffd6c8b432072df7190ed722d039f971caa539.css.gz +0 -0
  288. data/spec/dummy/public/assets/pwb/themes/default-d697fb0c278f500986e614ddd7eb41fd7db502a54f3370b3e8166cc1714509d0.css +0 -8423
  289. data/spec/dummy/public/assets/pwb/themes/default-d697fb0c278f500986e614ddd7eb41fd7db502a54f3370b3e8166cc1714509d0.css.gz +0 -0
  290. data/spec/dummy/public/assets/pwb_admin_panel/application-2d624898965d7a347eb7f365feab34257032c25051633370811ed7dfd24d7c8c.js +0 -61
  291. data/spec/dummy/public/assets/pwb_admin_panel/application-2d624898965d7a347eb7f365feab34257032c25051633370811ed7dfd24d7c8c.js.gz +0 -0
  292. data/spec/dummy/public/assets/pwb_admin_panel/application-f0e38d58d1ce32501b22edd16697f45b561fa44b5be9265398a05e8dee169885.css +0 -17970
  293. data/spec/dummy/public/assets/pwb_admin_panel/application-f0e38d58d1ce32501b22edd16697f45b561fa44b5be9265398a05e8dee169885.css.gz +0 -0
  294. data/spec/dummy/public/img/about-us.png +0 -0
  295. data/spec/dummy/public/img/agents/agent-1.png +0 -0
  296. data/spec/dummy/public/img/agents/agent-3.png +0 -0
  297. data/spec/dummy/public/img/agents/agent-4.png +0 -0
  298. data/spec/dummy/public/img/agents/agent-5.png +0 -0
  299. data/spec/dummy/public/img/banner-ads.jpg +0 -0
  300. data/spec/dummy/public/img/blog-img-1.jpg +0 -0
  301. data/spec/dummy/public/img/blog-img-2.jpg +0 -0
  302. data/spec/dummy/public/img/blog-img-3.jpg +0 -0
  303. data/spec/dummy/public/img/client-brand-1.png +0 -0
  304. data/spec/dummy/public/img/client-brand-2.png +0 -0
  305. data/spec/dummy/public/img/client-brand-3.png +0 -0
  306. data/spec/dummy/public/img/client-brand-4.png +0 -0
  307. data/spec/dummy/public/img/client-brand-5.png +0 -0
  308. data/spec/dummy/public/img/favicon.ico +0 -0
  309. data/spec/dummy/public/img/gallery/big/1.jpg +0 -0
  310. data/spec/dummy/public/img/gallery/big/10.jpg +0 -0
  311. data/spec/dummy/public/img/gallery/big/11 - Copy.jpg +0 -0
  312. data/spec/dummy/public/img/gallery/big/12.jpg +0 -0
  313. data/spec/dummy/public/img/gallery/big/2.jpg +0 -0
  314. data/spec/dummy/public/img/gallery/big/3.jpg +0 -0
  315. data/spec/dummy/public/img/gallery/big/4.jpg +0 -0
  316. data/spec/dummy/public/img/gallery/big/5.jpg +0 -0
  317. data/spec/dummy/public/img/gallery/big/6.jpg +0 -0
  318. data/spec/dummy/public/img/gallery/big/7.jpg +0 -0
  319. data/spec/dummy/public/img/gallery/big/8.jpg +0 -0
  320. data/spec/dummy/public/img/gallery/big/9.jpg +0 -0
  321. data/spec/dummy/public/img/gallery/fancybox_buttons.png +0 -0
  322. data/spec/dummy/public/img/gallery/fancybox_loading.gif +0 -0
  323. data/spec/dummy/public/img/gallery/fancybox_loading@2x.gif +0 -0
  324. data/spec/dummy/public/img/gallery/fancybox_overlay.png +0 -0
  325. data/spec/dummy/public/img/gallery/fancybox_sprite.png +0 -0
  326. data/spec/dummy/public/img/gallery/fancybox_sprite@2x.png +0 -0
  327. data/spec/dummy/public/img/gallery/small/1.jpg +0 -0
  328. data/spec/dummy/public/img/gallery/small/10.jpg +0 -0
  329. data/spec/dummy/public/img/gallery/small/11.jpg +0 -0
  330. data/spec/dummy/public/img/gallery/small/12.jpg +0 -0
  331. data/spec/dummy/public/img/gallery/small/2.jpg +0 -0
  332. data/spec/dummy/public/img/gallery/small/3.jpg +0 -0
  333. data/spec/dummy/public/img/gallery/small/4.jpg +0 -0
  334. data/spec/dummy/public/img/gallery/small/5.jpg +0 -0
  335. data/spec/dummy/public/img/gallery/small/6.jpg +0 -0
  336. data/spec/dummy/public/img/gallery/small/7.jpg +0 -0
  337. data/spec/dummy/public/img/gallery/small/8.jpg +0 -0
  338. data/spec/dummy/public/img/gallery/small/9.jpg +0 -0
  339. data/spec/dummy/public/img/item/1.jpg +0 -0
  340. data/spec/dummy/public/img/item/2.jpg +0 -0
  341. data/spec/dummy/public/img/item/3.jpg +0 -0
  342. data/spec/dummy/public/img/item/4.jpg +0 -0
  343. data/spec/dummy/public/img/item/5.jpg +0 -0
  344. data/spec/dummy/public/img/item/6.jpg +0 -0
  345. data/spec/dummy/public/img/logo.png +0 -0
  346. data/spec/dummy/public/img/promo-banner.jpg +0 -0
  347. data/spec/dummy/public/img/property-header-bg.jpg +0 -0
  348. data/spec/dummy/public/img/property-view-2.jpg +0 -0
  349. data/spec/dummy/public/img/signin-bg.jpg +0 -0
  350. data/spec/dummy/public/img/slider/1.jpg +0 -0
  351. data/spec/dummy/public/img/slider/2.jpg +0 -0
  352. data/spec/dummy/public/img/slider/3.jpg +0 -0
  353. data/spec/dummy/public/img/slider/4.jpg +0 -0
  354. data/spec/dummy/public/img/slider/5.jpg +0 -0
  355. data/spec/dummy/public/img/slider/6.jpg +0 -0
  356. data/spec/dummy/public/img/testimonial-1.png +0 -0
  357. data/spec/dummy/public/img/testimonial-2.png +0 -0
  358. data/spec/dummy/public/img/testimonial-3.png +0 -0
  359. data/spec/dummy/public/img/testimonial-bg.jpg +0 -0
  360. data/spec/dummy/public/js/bootstrap.js +0 -2363
  361. data/spec/dummy/public/js/custom.js +0 -355
  362. data/spec/dummy/public/js/jquery.fancybox.pack.js +0 -46
  363. data/spec/dummy/public/js/jquery.min.js +0 -5
  364. data/spec/dummy/public/js/jquery.mixitup.js +0 -2098
  365. data/spec/dummy/public/js/nouislider.js +0 -1899
  366. data/spec/dummy/public/js/slick.js +0 -2670
  367. data/spec/dummy/public/system/comfy/cms/files/files/000/000/003/cms_thumb/rerenting-landing_framed.png +0 -0
@@ -1,1899 +0,0 @@
1
- /*! nouislider - 8.3.0 - 2016-02-14 17:37:19 */
2
-
3
- (function (factory) {
4
-
5
- if ( typeof define === 'function' && define.amd ) {
6
-
7
- // AMD. Register as an anonymous module.
8
- define([], factory);
9
-
10
- } else if ( typeof exports === 'object' ) {
11
-
12
- // Node/CommonJS
13
- module.exports = factory();
14
-
15
- } else {
16
-
17
- // Browser globals
18
- window.noUiSlider = factory();
19
- }
20
-
21
- }(function( ){
22
-
23
- 'use strict';
24
-
25
-
26
- // Removes duplicates from an array.
27
- function unique(array) {
28
- return array.filter(function(a){
29
- return !this[a] ? this[a] = true : false;
30
- }, {});
31
- }
32
-
33
- // Round a value to the closest 'to'.
34
- function closest ( value, to ) {
35
- return Math.round(value / to) * to;
36
- }
37
-
38
- // Current position of an element relative to the document.
39
- function offset ( elem ) {
40
-
41
- var rect = elem.getBoundingClientRect(),
42
- doc = elem.ownerDocument,
43
- docElem = doc.documentElement,
44
- pageOffset = getPageOffset();
45
-
46
- // getBoundingClientRect contains left scroll in Chrome on Android.
47
- // I haven't found a feature detection that proves this. Worst case
48
- // scenario on mis-match: the 'tap' feature on horizontal sliders breaks.
49
- if ( /webkit.*Chrome.*Mobile/i.test(navigator.userAgent) ) {
50
- pageOffset.x = 0;
51
- }
52
-
53
- return {
54
- top: rect.top + pageOffset.y - docElem.clientTop,
55
- left: rect.left + pageOffset.x - docElem.clientLeft
56
- };
57
- }
58
-
59
- // Checks whether a value is numerical.
60
- function isNumeric ( a ) {
61
- return typeof a === 'number' && !isNaN( a ) && isFinite( a );
62
- }
63
-
64
- // Rounds a number to 7 supported decimals.
65
- function accurateNumber( number ) {
66
- var p = Math.pow(10, 7);
67
- return Number((Math.round(number*p)/p).toFixed(7));
68
- }
69
-
70
- // Sets a class and removes it after [duration] ms.
71
- function addClassFor ( element, className, duration ) {
72
- addClass(element, className);
73
- setTimeout(function(){
74
- removeClass(element, className);
75
- }, duration);
76
- }
77
-
78
- // Limits a value to 0 - 100
79
- function limit ( a ) {
80
- return Math.max(Math.min(a, 100), 0);
81
- }
82
-
83
- // Wraps a variable as an array, if it isn't one yet.
84
- function asArray ( a ) {
85
- return Array.isArray(a) ? a : [a];
86
- }
87
-
88
- // Counts decimals
89
- function countDecimals ( numStr ) {
90
- var pieces = numStr.split(".");
91
- return pieces.length > 1 ? pieces[1].length : 0;
92
- }
93
-
94
- // http://youmightnotneedjquery.com/#add_class
95
- function addClass ( el, className ) {
96
- if ( el.classList ) {
97
- el.classList.add(className);
98
- } else {
99
- el.className += ' ' + className;
100
- }
101
- }
102
-
103
- // http://youmightnotneedjquery.com/#remove_class
104
- function removeClass ( el, className ) {
105
- if ( el.classList ) {
106
- el.classList.remove(className);
107
- } else {
108
- el.className = el.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' ');
109
- }
110
- }
111
-
112
- // https://plainjs.com/javascript/attributes/adding-removing-and-testing-for-classes-9/
113
- function hasClass ( el, className ) {
114
- return el.classList ? el.classList.contains(className) : new RegExp('\\b' + className + '\\b').test(el.className);
115
- }
116
-
117
- // https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollY#Notes
118
- function getPageOffset ( ) {
119
-
120
- var supportPageOffset = window.pageXOffset !== undefined,
121
- isCSS1Compat = ((document.compatMode || "") === "CSS1Compat"),
122
- x = supportPageOffset ? window.pageXOffset : isCSS1Compat ? document.documentElement.scrollLeft : document.body.scrollLeft,
123
- y = supportPageOffset ? window.pageYOffset : isCSS1Compat ? document.documentElement.scrollTop : document.body.scrollTop;
124
-
125
- return {
126
- x: x,
127
- y: y
128
- };
129
- }
130
-
131
- // Shorthand for stopPropagation so we don't have to create a dynamic method
132
- function stopPropagation ( e ) {
133
- e.stopPropagation();
134
- }
135
-
136
- // todo
137
- function addCssPrefix(cssPrefix) {
138
- return function(className) {
139
- return cssPrefix + className;
140
- };
141
- }
142
-
143
-
144
- var
145
- // Determine the events to bind. IE11 implements pointerEvents without
146
- // a prefix, which breaks compatibility with the IE10 implementation.
147
- /** @const */
148
- actions = window.navigator.pointerEnabled ? {
149
- start: 'pointerdown',
150
- move: 'pointermove',
151
- end: 'pointerup'
152
- } : window.navigator.msPointerEnabled ? {
153
- start: 'MSPointerDown',
154
- move: 'MSPointerMove',
155
- end: 'MSPointerUp'
156
- } : {
157
- start: 'mousedown touchstart',
158
- move: 'mousemove touchmove',
159
- end: 'mouseup touchend'
160
- },
161
- defaultCssPrefix = 'noUi-';
162
-
163
-
164
- // Value calculation
165
-
166
- // Determine the size of a sub-range in relation to a full range.
167
- function subRangeRatio ( pa, pb ) {
168
- return (100 / (pb - pa));
169
- }
170
-
171
- // (percentage) How many percent is this value of this range?
172
- function fromPercentage ( range, value ) {
173
- return (value * 100) / ( range[1] - range[0] );
174
- }
175
-
176
- // (percentage) Where is this value on this range?
177
- function toPercentage ( range, value ) {
178
- return fromPercentage( range, range[0] < 0 ?
179
- value + Math.abs(range[0]) :
180
- value - range[0] );
181
- }
182
-
183
- // (value) How much is this percentage on this range?
184
- function isPercentage ( range, value ) {
185
- return ((value * ( range[1] - range[0] )) / 100) + range[0];
186
- }
187
-
188
-
189
- // Range conversion
190
-
191
- function getJ ( value, arr ) {
192
-
193
- var j = 1;
194
-
195
- while ( value >= arr[j] ){
196
- j += 1;
197
- }
198
-
199
- return j;
200
- }
201
-
202
- // (percentage) Input a value, find where, on a scale of 0-100, it applies.
203
- function toStepping ( xVal, xPct, value ) {
204
-
205
- if ( value >= xVal.slice(-1)[0] ){
206
- return 100;
207
- }
208
-
209
- var j = getJ( value, xVal ), va, vb, pa, pb;
210
-
211
- va = xVal[j-1];
212
- vb = xVal[j];
213
- pa = xPct[j-1];
214
- pb = xPct[j];
215
-
216
- return pa + (toPercentage([va, vb], value) / subRangeRatio (pa, pb));
217
- }
218
-
219
- // (value) Input a percentage, find where it is on the specified range.
220
- function fromStepping ( xVal, xPct, value ) {
221
-
222
- // There is no range group that fits 100
223
- if ( value >= 100 ){
224
- return xVal.slice(-1)[0];
225
- }
226
-
227
- var j = getJ( value, xPct ), va, vb, pa, pb;
228
-
229
- va = xVal[j-1];
230
- vb = xVal[j];
231
- pa = xPct[j-1];
232
- pb = xPct[j];
233
-
234
- return isPercentage([va, vb], (value - pa) * subRangeRatio (pa, pb));
235
- }
236
-
237
- // (percentage) Get the step that applies at a certain value.
238
- function getStep ( xPct, xSteps, snap, value ) {
239
-
240
- if ( value === 100 ) {
241
- return value;
242
- }
243
-
244
- var j = getJ( value, xPct ), a, b;
245
-
246
- // If 'snap' is set, steps are used as fixed points on the slider.
247
- if ( snap ) {
248
-
249
- a = xPct[j-1];
250
- b = xPct[j];
251
-
252
- // Find the closest position, a or b.
253
- if ((value - a) > ((b-a)/2)){
254
- return b;
255
- }
256
-
257
- return a;
258
- }
259
-
260
- if ( !xSteps[j-1] ){
261
- return value;
262
- }
263
-
264
- return xPct[j-1] + closest(
265
- value - xPct[j-1],
266
- xSteps[j-1]
267
- );
268
- }
269
-
270
-
271
- // Entry parsing
272
-
273
- function handleEntryPoint ( index, value, that ) {
274
-
275
- var percentage;
276
-
277
- // Wrap numerical input in an array.
278
- if ( typeof value === "number" ) {
279
- value = [value];
280
- }
281
-
282
- // Reject any invalid input, by testing whether value is an array.
283
- if ( Object.prototype.toString.call( value ) !== '[object Array]' ){
284
- throw new Error("noUiSlider: 'range' contains invalid value.");
285
- }
286
-
287
- // Covert min/max syntax to 0 and 100.
288
- if ( index === 'min' ) {
289
- percentage = 0;
290
- } else if ( index === 'max' ) {
291
- percentage = 100;
292
- } else {
293
- percentage = parseFloat( index );
294
- }
295
-
296
- // Check for correct input.
297
- if ( !isNumeric( percentage ) || !isNumeric( value[0] ) ) {
298
- throw new Error("noUiSlider: 'range' value isn't numeric.");
299
- }
300
-
301
- // Store values.
302
- that.xPct.push( percentage );
303
- that.xVal.push( value[0] );
304
-
305
- // NaN will evaluate to false too, but to keep
306
- // logging clear, set step explicitly. Make sure
307
- // not to override the 'step' setting with false.
308
- if ( !percentage ) {
309
- if ( !isNaN( value[1] ) ) {
310
- that.xSteps[0] = value[1];
311
- }
312
- } else {
313
- that.xSteps.push( isNaN(value[1]) ? false : value[1] );
314
- }
315
- }
316
-
317
- function handleStepPoint ( i, n, that ) {
318
-
319
- // Ignore 'false' stepping.
320
- if ( !n ) {
321
- return true;
322
- }
323
-
324
- // Factor to range ratio
325
- that.xSteps[i] = fromPercentage([
326
- that.xVal[i]
327
- ,that.xVal[i+1]
328
- ], n) / subRangeRatio (
329
- that.xPct[i],
330
- that.xPct[i+1] );
331
- }
332
-
333
-
334
- // Interface
335
-
336
- // The interface to Spectrum handles all direction-based
337
- // conversions, so the above values are unaware.
338
-
339
- function Spectrum ( entry, snap, direction, singleStep ) {
340
-
341
- this.xPct = [];
342
- this.xVal = [];
343
- this.xSteps = [ singleStep || false ];
344
- this.xNumSteps = [ false ];
345
-
346
- this.snap = snap;
347
- this.direction = direction;
348
-
349
- var index, ordered = [ /* [0, 'min'], [1, '50%'], [2, 'max'] */ ];
350
-
351
- // Map the object keys to an array.
352
- for ( index in entry ) {
353
- if ( entry.hasOwnProperty(index) ) {
354
- ordered.push([entry[index], index]);
355
- }
356
- }
357
-
358
- // Sort all entries by value (numeric sort).
359
- if ( ordered.length && typeof ordered[0][0] === "object" ) {
360
- ordered.sort(function(a, b) { return a[0][0] - b[0][0]; });
361
- } else {
362
- ordered.sort(function(a, b) { return a[0] - b[0]; });
363
- }
364
-
365
-
366
- // Convert all entries to subranges.
367
- for ( index = 0; index < ordered.length; index++ ) {
368
- handleEntryPoint(ordered[index][1], ordered[index][0], this);
369
- }
370
-
371
- // Store the actual step values.
372
- // xSteps is sorted in the same order as xPct and xVal.
373
- this.xNumSteps = this.xSteps.slice(0);
374
-
375
- // Convert all numeric steps to the percentage of the subrange they represent.
376
- for ( index = 0; index < this.xNumSteps.length; index++ ) {
377
- handleStepPoint(index, this.xNumSteps[index], this);
378
- }
379
- }
380
-
381
- Spectrum.prototype.getMargin = function ( value ) {
382
- return this.xPct.length === 2 ? fromPercentage(this.xVal, value) : false;
383
- };
384
-
385
- Spectrum.prototype.toStepping = function ( value ) {
386
-
387
- value = toStepping( this.xVal, this.xPct, value );
388
-
389
- // Invert the value if this is a right-to-left slider.
390
- if ( this.direction ) {
391
- value = 100 - value;
392
- }
393
-
394
- return value;
395
- };
396
-
397
- Spectrum.prototype.fromStepping = function ( value ) {
398
-
399
- // Invert the value if this is a right-to-left slider.
400
- if ( this.direction ) {
401
- value = 100 - value;
402
- }
403
-
404
- return accurateNumber(fromStepping( this.xVal, this.xPct, value ));
405
- };
406
-
407
- Spectrum.prototype.getStep = function ( value ) {
408
-
409
- // Find the proper step for rtl sliders by search in inverse direction.
410
- // Fixes issue #262.
411
- if ( this.direction ) {
412
- value = 100 - value;
413
- }
414
-
415
- value = getStep(this.xPct, this.xSteps, this.snap, value );
416
-
417
- if ( this.direction ) {
418
- value = 100 - value;
419
- }
420
-
421
- return value;
422
- };
423
-
424
- Spectrum.prototype.getApplicableStep = function ( value ) {
425
-
426
- // If the value is 100%, return the negative step twice.
427
- var j = getJ(value, this.xPct), offset = value === 100 ? 2 : 1;
428
- return [this.xNumSteps[j-2], this.xVal[j-offset], this.xNumSteps[j-offset]];
429
- };
430
-
431
- // Outside testing
432
- Spectrum.prototype.convert = function ( value ) {
433
- return this.getStep(this.toStepping(value));
434
- };
435
-
436
- /* Every input option is tested and parsed. This'll prevent
437
- endless validation in internal methods. These tests are
438
- structured with an item for every option available. An
439
- option can be marked as required by setting the 'r' flag.
440
- The testing function is provided with three arguments:
441
- - The provided value for the option;
442
- - A reference to the options object;
443
- - The name for the option;
444
-
445
- The testing function returns false when an error is detected,
446
- or true when everything is OK. It can also modify the option
447
- object, to make sure all values can be correctly looped elsewhere. */
448
-
449
- var defaultFormatter = { 'to': function( value ){
450
- return value !== undefined && value.toFixed(2);
451
- }, 'from': Number };
452
-
453
- function testStep ( parsed, entry ) {
454
-
455
- if ( !isNumeric( entry ) ) {
456
- throw new Error("noUiSlider: 'step' is not numeric.");
457
- }
458
-
459
- // The step option can still be used to set stepping
460
- // for linear sliders. Overwritten if set in 'range'.
461
- parsed.singleStep = entry;
462
- }
463
-
464
- function testRange ( parsed, entry ) {
465
-
466
- // Filter incorrect input.
467
- if ( typeof entry !== 'object' || Array.isArray(entry) ) {
468
- throw new Error("noUiSlider: 'range' is not an object.");
469
- }
470
-
471
- // Catch missing start or end.
472
- if ( entry.min === undefined || entry.max === undefined ) {
473
- throw new Error("noUiSlider: Missing 'min' or 'max' in 'range'.");
474
- }
475
-
476
- // Catch equal start or end.
477
- if ( entry.min === entry.max ) {
478
- throw new Error("noUiSlider: 'range' 'min' and 'max' cannot be equal.");
479
- }
480
-
481
- parsed.spectrum = new Spectrum(entry, parsed.snap, parsed.dir, parsed.singleStep);
482
- }
483
-
484
- function testStart ( parsed, entry ) {
485
-
486
- entry = asArray(entry);
487
-
488
- // Validate input. Values aren't tested, as the public .val method
489
- // will always provide a valid location.
490
- if ( !Array.isArray( entry ) || !entry.length || entry.length > 2 ) {
491
- throw new Error("noUiSlider: 'start' option is incorrect.");
492
- }
493
-
494
- // Store the number of handles.
495
- parsed.handles = entry.length;
496
-
497
- // When the slider is initialized, the .val method will
498
- // be called with the start options.
499
- parsed.start = entry;
500
- }
501
-
502
- function testSnap ( parsed, entry ) {
503
-
504
- // Enforce 100% stepping within subranges.
505
- parsed.snap = entry;
506
-
507
- if ( typeof entry !== 'boolean' ){
508
- throw new Error("noUiSlider: 'snap' option must be a boolean.");
509
- }
510
- }
511
-
512
- function testAnimate ( parsed, entry ) {
513
-
514
- // Enforce 100% stepping within subranges.
515
- parsed.animate = entry;
516
-
517
- if ( typeof entry !== 'boolean' ){
518
- throw new Error("noUiSlider: 'animate' option must be a boolean.");
519
- }
520
- }
521
-
522
- function testConnect ( parsed, entry ) {
523
-
524
- if ( entry === 'lower' && parsed.handles === 1 ) {
525
- parsed.connect = 1;
526
- } else if ( entry === 'upper' && parsed.handles === 1 ) {
527
- parsed.connect = 2;
528
- } else if ( entry === true && parsed.handles === 2 ) {
529
- parsed.connect = 3;
530
- } else if ( entry === false ) {
531
- parsed.connect = 0;
532
- } else {
533
- throw new Error("noUiSlider: 'connect' option doesn't match handle count.");
534
- }
535
- }
536
-
537
- function testOrientation ( parsed, entry ) {
538
-
539
- // Set orientation to an a numerical value for easy
540
- // array selection.
541
- switch ( entry ){
542
- case 'horizontal':
543
- parsed.ort = 0;
544
- break;
545
- case 'vertical':
546
- parsed.ort = 1;
547
- break;
548
- default:
549
- throw new Error("noUiSlider: 'orientation' option is invalid.");
550
- }
551
- }
552
-
553
- function testMargin ( parsed, entry ) {
554
-
555
- if ( !isNumeric(entry) ){
556
- throw new Error("noUiSlider: 'margin' option must be numeric.");
557
- }
558
-
559
- // Issue #582
560
- if ( entry === 0 ) {
561
- return;
562
- }
563
-
564
- parsed.margin = parsed.spectrum.getMargin(entry);
565
-
566
- if ( !parsed.margin ) {
567
- throw new Error("noUiSlider: 'margin' option is only supported on linear sliders.");
568
- }
569
- }
570
-
571
- function testLimit ( parsed, entry ) {
572
-
573
- if ( !isNumeric(entry) ){
574
- throw new Error("noUiSlider: 'limit' option must be numeric.");
575
- }
576
-
577
- parsed.limit = parsed.spectrum.getMargin(entry);
578
-
579
- if ( !parsed.limit ) {
580
- throw new Error("noUiSlider: 'limit' option is only supported on linear sliders.");
581
- }
582
- }
583
-
584
- function testDirection ( parsed, entry ) {
585
-
586
- // Set direction as a numerical value for easy parsing.
587
- // Invert connection for RTL sliders, so that the proper
588
- // handles get the connect/background classes.
589
- switch ( entry ) {
590
- case 'ltr':
591
- parsed.dir = 0;
592
- break;
593
- case 'rtl':
594
- parsed.dir = 1;
595
- parsed.connect = [0,2,1,3][parsed.connect];
596
- break;
597
- default:
598
- throw new Error("noUiSlider: 'direction' option was not recognized.");
599
- }
600
- }
601
-
602
- function testBehaviour ( parsed, entry ) {
603
-
604
- // Make sure the input is a string.
605
- if ( typeof entry !== 'string' ) {
606
- throw new Error("noUiSlider: 'behaviour' must be a string containing options.");
607
- }
608
-
609
- // Check if the string contains any keywords.
610
- // None are required.
611
- var tap = entry.indexOf('tap') >= 0,
612
- drag = entry.indexOf('drag') >= 0,
613
- fixed = entry.indexOf('fixed') >= 0,
614
- snap = entry.indexOf('snap') >= 0,
615
- hover = entry.indexOf('hover') >= 0;
616
-
617
- // Fix #472
618
- if ( drag && !parsed.connect ) {
619
- throw new Error("noUiSlider: 'drag' behaviour must be used with 'connect': true.");
620
- }
621
-
622
- parsed.events = {
623
- tap: tap || snap,
624
- drag: drag,
625
- fixed: fixed,
626
- snap: snap,
627
- hover: hover
628
- };
629
- }
630
-
631
- function testTooltips ( parsed, entry ) {
632
-
633
- var i;
634
-
635
- if ( entry === false ) {
636
- return;
637
- } else if ( entry === true ) {
638
-
639
- parsed.tooltips = [];
640
-
641
- for ( i = 0; i < parsed.handles; i++ ) {
642
- parsed.tooltips.push(true);
643
- }
644
-
645
- } else {
646
-
647
- parsed.tooltips = asArray(entry);
648
-
649
- if ( parsed.tooltips.length !== parsed.handles ) {
650
- throw new Error("noUiSlider: must pass a formatter for all handles.");
651
- }
652
-
653
- parsed.tooltips.forEach(function(formatter){
654
- if ( typeof formatter !== 'boolean' && (typeof formatter !== 'object' || typeof formatter.to !== 'function') ) {
655
- throw new Error("noUiSlider: 'tooltips' must be passed a formatter or 'false'.");
656
- }
657
- });
658
- }
659
- }
660
-
661
- function testFormat ( parsed, entry ) {
662
-
663
- parsed.format = entry;
664
-
665
- // Any object with a to and from method is supported.
666
- if ( typeof entry.to === 'function' && typeof entry.from === 'function' ) {
667
- return true;
668
- }
669
-
670
- throw new Error( "noUiSlider: 'format' requires 'to' and 'from' methods.");
671
- }
672
-
673
- function testCssPrefix ( parsed, entry ) {
674
-
675
- if ( entry !== undefined && typeof entry !== 'string' ) {
676
- throw new Error( "noUiSlider: 'cssPrefix' must be a string.");
677
- }
678
-
679
- parsed.cssPrefix = entry;
680
- }
681
-
682
- // Test all developer settings and parse to assumption-safe values.
683
- function testOptions ( options ) {
684
-
685
- // To prove a fix for #537, freeze options here.
686
- // If the object is modified, an error will be thrown.
687
- // Object.freeze(options);
688
-
689
- var parsed = {
690
- margin: 0,
691
- limit: 0,
692
- animate: true,
693
- format: defaultFormatter
694
- }, tests;
695
-
696
- // Tests are executed in the order they are presented here.
697
- tests = {
698
- 'step': { r: false, t: testStep },
699
- 'start': { r: true, t: testStart },
700
- 'connect': { r: true, t: testConnect },
701
- 'direction': { r: true, t: testDirection },
702
- 'snap': { r: false, t: testSnap },
703
- 'animate': { r: false, t: testAnimate },
704
- 'range': { r: true, t: testRange },
705
- 'orientation': { r: false, t: testOrientation },
706
- 'margin': { r: false, t: testMargin },
707
- 'limit': { r: false, t: testLimit },
708
- 'behaviour': { r: true, t: testBehaviour },
709
- 'format': { r: false, t: testFormat },
710
- 'tooltips': { r: false, t: testTooltips },
711
- 'cssPrefix': { r: false, t: testCssPrefix }
712
- };
713
-
714
- var defaults = {
715
- 'connect': false,
716
- 'direction': 'ltr',
717
- 'behaviour': 'tap',
718
- 'orientation': 'horizontal'
719
- };
720
-
721
- // Run all options through a testing mechanism to ensure correct
722
- // input. It should be noted that options might get modified to
723
- // be handled properly. E.g. wrapping integers in arrays.
724
- Object.keys(tests).forEach(function( name ){
725
-
726
- // If the option isn't set, but it is required, throw an error.
727
- if ( options[name] === undefined && defaults[name] === undefined ) {
728
-
729
- if ( tests[name].r ) {
730
- throw new Error("noUiSlider: '" + name + "' is required.");
731
- }
732
-
733
- return true;
734
- }
735
-
736
- tests[name].t( parsed, options[name] === undefined ? defaults[name] : options[name] );
737
- });
738
-
739
- // Forward pips options
740
- parsed.pips = options.pips;
741
-
742
- // Pre-define the styles.
743
- parsed.style = parsed.ort ? 'top' : 'left';
744
-
745
- return parsed;
746
- }
747
-
748
-
749
- function closure ( target, options ){
750
-
751
- // All variables local to 'closure' are prefixed with 'scope_'
752
- var scope_Target = target,
753
- scope_Locations = [-1, -1],
754
- scope_Base,
755
- scope_Handles,
756
- scope_Spectrum = options.spectrum,
757
- scope_Values = [],
758
- scope_Events = {},
759
- scope_Self;
760
-
761
- var cssClasses = [
762
- /* 0 */ 'target'
763
- /* 1 */ ,'base'
764
- /* 2 */ ,'origin'
765
- /* 3 */ ,'handle'
766
- /* 4 */ ,'horizontal'
767
- /* 5 */ ,'vertical'
768
- /* 6 */ ,'background'
769
- /* 7 */ ,'connect'
770
- /* 8 */ ,'ltr'
771
- /* 9 */ ,'rtl'
772
- /* 10 */ ,'draggable'
773
- /* 11 */ ,''
774
- /* 12 */ ,'state-drag'
775
- /* 13 */ ,''
776
- /* 14 */ ,'state-tap'
777
- /* 15 */ ,'active'
778
- /* 16 */ ,''
779
- /* 17 */ ,'stacking'
780
- /* 18 */ ,'tooltip'
781
- /* 19 */ ,''
782
- /* 20 */ ,'pips'
783
- /* 21 */ ,'marker'
784
- /* 22 */ ,'value'
785
- ].map(addCssPrefix(options.cssPrefix || defaultCssPrefix));
786
-
787
-
788
- // Delimit proposed values for handle positions.
789
- function getPositions ( a, b, delimit ) {
790
-
791
- // Add movement to current position.
792
- var c = a + b[0], d = a + b[1];
793
-
794
- // Only alter the other position on drag,
795
- // not on standard sliding.
796
- if ( delimit ) {
797
- if ( c < 0 ) {
798
- d += Math.abs(c);
799
- }
800
- if ( d > 100 ) {
801
- c -= ( d - 100 );
802
- }
803
-
804
- // Limit values to 0 and 100.
805
- return [limit(c), limit(d)];
806
- }
807
-
808
- return [c,d];
809
- }
810
-
811
- // Provide a clean event with standardized offset values.
812
- function fixEvent ( e, pageOffset ) {
813
-
814
- // Prevent scrolling and panning on touch events, while
815
- // attempting to slide. The tap event also depends on this.
816
- e.preventDefault();
817
-
818
- // Filter the event to register the type, which can be
819
- // touch, mouse or pointer. Offset changes need to be
820
- // made on an event specific basis.
821
- var touch = e.type.indexOf('touch') === 0,
822
- mouse = e.type.indexOf('mouse') === 0,
823
- pointer = e.type.indexOf('pointer') === 0,
824
- x,y, event = e;
825
-
826
- // IE10 implemented pointer events with a prefix;
827
- if ( e.type.indexOf('MSPointer') === 0 ) {
828
- pointer = true;
829
- }
830
-
831
- if ( touch ) {
832
- // noUiSlider supports one movement at a time,
833
- // so we can select the first 'changedTouch'.
834
- x = e.changedTouches[0].pageX;
835
- y = e.changedTouches[0].pageY;
836
- }
837
-
838
- pageOffset = pageOffset || getPageOffset();
839
-
840
- if ( mouse || pointer ) {
841
- x = e.clientX + pageOffset.x;
842
- y = e.clientY + pageOffset.y;
843
- }
844
-
845
- event.pageOffset = pageOffset;
846
- event.points = [x, y];
847
- event.cursor = mouse || pointer; // Fix #435
848
-
849
- return event;
850
- }
851
-
852
- // Append a handle to the base.
853
- function addHandle ( direction, index ) {
854
-
855
- var origin = document.createElement('div'),
856
- handle = document.createElement('div'),
857
- additions = [ '-lower', '-upper' ];
858
-
859
- if ( direction ) {
860
- additions.reverse();
861
- }
862
-
863
- addClass(handle, cssClasses[3]);
864
- addClass(handle, cssClasses[3] + additions[index]);
865
-
866
- addClass(origin, cssClasses[2]);
867
- origin.appendChild(handle);
868
-
869
- return origin;
870
- }
871
-
872
- // Add the proper connection classes.
873
- function addConnection ( connect, target, handles ) {
874
-
875
- // Apply the required connection classes to the elements
876
- // that need them. Some classes are made up for several
877
- // segments listed in the class list, to allow easy
878
- // renaming and provide a minor compression benefit.
879
- switch ( connect ) {
880
- case 1: addClass(target, cssClasses[7]);
881
- addClass(handles[0], cssClasses[6]);
882
- break;
883
- case 3: addClass(handles[1], cssClasses[6]);
884
- /* falls through */
885
- case 2: addClass(handles[0], cssClasses[7]);
886
- /* falls through */
887
- case 0: addClass(target, cssClasses[6]);
888
- break;
889
- }
890
- }
891
-
892
- // Add handles to the slider base.
893
- function addHandles ( nrHandles, direction, base ) {
894
-
895
- var index, handles = [];
896
-
897
- // Append handles.
898
- for ( index = 0; index < nrHandles; index += 1 ) {
899
-
900
- // Keep a list of all added handles.
901
- handles.push( base.appendChild(addHandle( direction, index )) );
902
- }
903
-
904
- return handles;
905
- }
906
-
907
- // Initialize a single slider.
908
- function addSlider ( direction, orientation, target ) {
909
-
910
- // Apply classes and data to the target.
911
- addClass(target, cssClasses[0]);
912
- addClass(target, cssClasses[8 + direction]);
913
- addClass(target, cssClasses[4 + orientation]);
914
-
915
- var div = document.createElement('div');
916
- addClass(div, cssClasses[1]);
917
- target.appendChild(div);
918
- return div;
919
- }
920
-
921
-
922
- function addTooltip ( handle, index ) {
923
-
924
- if ( !options.tooltips[index] ) {
925
- return false;
926
- }
927
-
928
- var element = document.createElement('div');
929
- element.className = cssClasses[18];
930
- return handle.firstChild.appendChild(element);
931
- }
932
-
933
- // The tooltips option is a shorthand for using the 'update' event.
934
- function tooltips ( ) {
935
-
936
- if ( options.dir ) {
937
- options.tooltips.reverse();
938
- }
939
-
940
- // Tooltips are added with options.tooltips in original order.
941
- var tips = scope_Handles.map(addTooltip);
942
-
943
- if ( options.dir ) {
944
- tips.reverse();
945
- options.tooltips.reverse();
946
- }
947
-
948
- bindEvent('update', function(f, o, r) {
949
- if ( tips[o] ) {
950
- tips[o].innerHTML = options.tooltips[o] === true ? f[o] : options.tooltips[o].to(r[o]);
951
- }
952
- });
953
- }
954
-
955
-
956
- function getGroup ( mode, values, stepped ) {
957
-
958
- // Use the range.
959
- if ( mode === 'range' || mode === 'steps' ) {
960
- return scope_Spectrum.xVal;
961
- }
962
-
963
- if ( mode === 'count' ) {
964
-
965
- // Divide 0 - 100 in 'count' parts.
966
- var spread = ( 100 / (values-1) ), v, i = 0;
967
- values = [];
968
-
969
- // List these parts and have them handled as 'positions'.
970
- while ((v=i++*spread) <= 100 ) {
971
- values.push(v);
972
- }
973
-
974
- mode = 'positions';
975
- }
976
-
977
- if ( mode === 'positions' ) {
978
-
979
- // Map all percentages to on-range values.
980
- return values.map(function( value ){
981
- return scope_Spectrum.fromStepping( stepped ? scope_Spectrum.getStep( value ) : value );
982
- });
983
- }
984
-
985
- if ( mode === 'values' ) {
986
-
987
- // If the value must be stepped, it needs to be converted to a percentage first.
988
- if ( stepped ) {
989
-
990
- return values.map(function( value ){
991
-
992
- // Convert to percentage, apply step, return to value.
993
- return scope_Spectrum.fromStepping( scope_Spectrum.getStep( scope_Spectrum.toStepping( value ) ) );
994
- });
995
-
996
- }
997
-
998
- // Otherwise, we can simply use the values.
999
- return values;
1000
- }
1001
- }
1002
-
1003
- function generateSpread ( density, mode, group ) {
1004
-
1005
- function safeIncrement(value, increment) {
1006
- // Avoid floating point variance by dropping the smallest decimal places.
1007
- return (value + increment).toFixed(7) / 1;
1008
- }
1009
-
1010
- var originalSpectrumDirection = scope_Spectrum.direction,
1011
- indexes = {},
1012
- firstInRange = scope_Spectrum.xVal[0],
1013
- lastInRange = scope_Spectrum.xVal[scope_Spectrum.xVal.length-1],
1014
- ignoreFirst = false,
1015
- ignoreLast = false,
1016
- prevPct = 0;
1017
-
1018
- // This function loops the spectrum in an ltr linear fashion,
1019
- // while the toStepping method is direction aware. Trick it into
1020
- // believing it is ltr.
1021
- scope_Spectrum.direction = 0;
1022
-
1023
- // Create a copy of the group, sort it and filter away all duplicates.
1024
- group = unique(group.slice().sort(function(a, b){ return a - b; }));
1025
-
1026
- // Make sure the range starts with the first element.
1027
- if ( group[0] !== firstInRange ) {
1028
- group.unshift(firstInRange);
1029
- ignoreFirst = true;
1030
- }
1031
-
1032
- // Likewise for the last one.
1033
- if ( group[group.length - 1] !== lastInRange ) {
1034
- group.push(lastInRange);
1035
- ignoreLast = true;
1036
- }
1037
-
1038
- group.forEach(function ( current, index ) {
1039
-
1040
- // Get the current step and the lower + upper positions.
1041
- var step, i, q,
1042
- low = current,
1043
- high = group[index+1],
1044
- newPct, pctDifference, pctPos, type,
1045
- steps, realSteps, stepsize;
1046
-
1047
- // When using 'steps' mode, use the provided steps.
1048
- // Otherwise, we'll step on to the next subrange.
1049
- if ( mode === 'steps' ) {
1050
- step = scope_Spectrum.xNumSteps[ index ];
1051
- }
1052
-
1053
- // Default to a 'full' step.
1054
- if ( !step ) {
1055
- step = high-low;
1056
- }
1057
-
1058
- // Low can be 0, so test for false. If high is undefined,
1059
- // we are at the last subrange. Index 0 is already handled.
1060
- if ( low === false || high === undefined ) {
1061
- return;
1062
- }
1063
-
1064
- // Find all steps in the subrange.
1065
- for ( i = low; i <= high; i = safeIncrement(i, step) ) {
1066
-
1067
- // Get the percentage value for the current step,
1068
- // calculate the size for the subrange.
1069
- newPct = scope_Spectrum.toStepping( i );
1070
- pctDifference = newPct - prevPct;
1071
-
1072
- steps = pctDifference / density;
1073
- realSteps = Math.round(steps);
1074
-
1075
- // This ratio represents the ammount of percentage-space a point indicates.
1076
- // For a density 1 the points/percentage = 1. For density 2, that percentage needs to be re-devided.
1077
- // Round the percentage offset to an even number, then divide by two
1078
- // to spread the offset on both sides of the range.
1079
- stepsize = pctDifference/realSteps;
1080
-
1081
- // Divide all points evenly, adding the correct number to this subrange.
1082
- // Run up to <= so that 100% gets a point, event if ignoreLast is set.
1083
- for ( q = 1; q <= realSteps; q += 1 ) {
1084
-
1085
- // The ratio between the rounded value and the actual size might be ~1% off.
1086
- // Correct the percentage offset by the number of points
1087
- // per subrange. density = 1 will result in 100 points on the
1088
- // full range, 2 for 50, 4 for 25, etc.
1089
- pctPos = prevPct + ( q * stepsize );
1090
- indexes[pctPos.toFixed(5)] = ['x', 0];
1091
- }
1092
-
1093
- // Determine the point type.
1094
- type = (group.indexOf(i) > -1) ? 1 : ( mode === 'steps' ? 2 : 0 );
1095
-
1096
- // Enforce the 'ignoreFirst' option by overwriting the type for 0.
1097
- if ( !index && ignoreFirst ) {
1098
- type = 0;
1099
- }
1100
-
1101
- if ( !(i === high && ignoreLast)) {
1102
- // Mark the 'type' of this point. 0 = plain, 1 = real value, 2 = step value.
1103
- indexes[newPct.toFixed(5)] = [i, type];
1104
- }
1105
-
1106
- // Update the percentage count.
1107
- prevPct = newPct;
1108
- }
1109
- });
1110
-
1111
- // Reset the spectrum.
1112
- scope_Spectrum.direction = originalSpectrumDirection;
1113
-
1114
- return indexes;
1115
- }
1116
-
1117
- function addMarking ( spread, filterFunc, formatter ) {
1118
-
1119
- var style = ['horizontal', 'vertical'][options.ort],
1120
- element = document.createElement('div'),
1121
- out = '';
1122
-
1123
- addClass(element, cssClasses[20]);
1124
- addClass(element, cssClasses[20] + '-' + style);
1125
-
1126
- function getSize( type ){
1127
- return [ '-normal', '-large', '-sub' ][type];
1128
- }
1129
-
1130
- function getTags( offset, source, values ) {
1131
- return 'class="' + source + ' ' +
1132
- source + '-' + style + ' ' +
1133
- source + getSize(values[1]) +
1134
- '" style="' + options.style + ': ' + offset + '%"';
1135
- }
1136
-
1137
- function addSpread ( offset, values ){
1138
-
1139
- if ( scope_Spectrum.direction ) {
1140
- offset = 100 - offset;
1141
- }
1142
-
1143
- // Apply the filter function, if it is set.
1144
- values[1] = (values[1] && filterFunc) ? filterFunc(values[0], values[1]) : values[1];
1145
-
1146
- // Add a marker for every point
1147
- out += '<div ' + getTags(offset, cssClasses[21], values) + '></div>';
1148
-
1149
- // Values are only appended for points marked '1' or '2'.
1150
- if ( values[1] ) {
1151
- out += '<div '+getTags(offset, cssClasses[22], values)+'>' + formatter.to(values[0]) + '</div>';
1152
- }
1153
- }
1154
-
1155
- // Append all points.
1156
- Object.keys(spread).forEach(function(a){
1157
- addSpread(a, spread[a]);
1158
- });
1159
- element.innerHTML = out;
1160
-
1161
- return element;
1162
- }
1163
-
1164
- function pips ( grid ) {
1165
-
1166
- var mode = grid.mode,
1167
- density = grid.density || 1,
1168
- filter = grid.filter || false,
1169
- values = grid.values || false,
1170
- stepped = grid.stepped || false,
1171
- group = getGroup( mode, values, stepped ),
1172
- spread = generateSpread( density, mode, group ),
1173
- format = grid.format || {
1174
- to: Math.round
1175
- };
1176
-
1177
- return scope_Target.appendChild(addMarking(
1178
- spread,
1179
- filter,
1180
- format
1181
- ));
1182
- }
1183
-
1184
-
1185
- // Shorthand for base dimensions.
1186
- function baseSize ( ) {
1187
- var rect = scope_Base.getBoundingClientRect(), alt = 'offset' + ['Width', 'Height'][options.ort];
1188
- return options.ort === 0 ? (rect.width||scope_Base[alt]) : (rect.height||scope_Base[alt]);
1189
- }
1190
-
1191
- // External event handling
1192
- function fireEvent ( event, handleNumber, tap ) {
1193
-
1194
- if ( handleNumber !== undefined && options.handles !== 1 ) {
1195
- handleNumber = Math.abs(handleNumber - options.dir);
1196
- }
1197
-
1198
- Object.keys(scope_Events).forEach(function( targetEvent ) {
1199
-
1200
- var eventType = targetEvent.split('.')[0];
1201
-
1202
- if ( event === eventType ) {
1203
- scope_Events[targetEvent].forEach(function( callback ) {
1204
-
1205
- callback.call(
1206
- // Use the slider public API as the scope ('this')
1207
- scope_Self,
1208
- // Return values as array, so arg_1[arg_2] is always valid.
1209
- asArray(valueGet()),
1210
- // Handle index, 0 or 1
1211
- handleNumber,
1212
- // Unformatted slider values
1213
- asArray(inSliderOrder(Array.prototype.slice.call(scope_Values))),
1214
- // Event is fired by tap, true or false
1215
- tap || false,
1216
- // Left offset of the handle, in relation to the slider
1217
- scope_Locations
1218
- );
1219
- });
1220
- }
1221
- });
1222
- }
1223
-
1224
- // Returns the input array, respecting the slider direction configuration.
1225
- function inSliderOrder ( values ) {
1226
-
1227
- // If only one handle is used, return a single value.
1228
- if ( values.length === 1 ){
1229
- return values[0];
1230
- }
1231
-
1232
- if ( options.dir ) {
1233
- return values.reverse();
1234
- }
1235
-
1236
- return values;
1237
- }
1238
-
1239
-
1240
- // Handler for attaching events trough a proxy.
1241
- function attach ( events, element, callback, data ) {
1242
-
1243
- // This function can be used to 'filter' events to the slider.
1244
- // element is a node, not a nodeList
1245
-
1246
- var method = function ( e ){
1247
-
1248
- if ( scope_Target.hasAttribute('disabled') ) {
1249
- return false;
1250
- }
1251
-
1252
- // Stop if an active 'tap' transition is taking place.
1253
- if ( hasClass(scope_Target, cssClasses[14]) ) {
1254
- return false;
1255
- }
1256
-
1257
- e = fixEvent(e, data.pageOffset);
1258
-
1259
- // Ignore right or middle clicks on start #454
1260
- if ( events === actions.start && e.buttons !== undefined && e.buttons > 1 ) {
1261
- return false;
1262
- }
1263
-
1264
- // Ignore right or middle clicks on start #454
1265
- if ( data.hover && e.buttons ) {
1266
- return false;
1267
- }
1268
-
1269
- e.calcPoint = e.points[ options.ort ];
1270
-
1271
- // Call the event handler with the event [ and additional data ].
1272
- callback ( e, data );
1273
-
1274
- }, methods = [];
1275
-
1276
- // Bind a closure on the target for every event type.
1277
- events.split(' ').forEach(function( eventName ){
1278
- element.addEventListener(eventName, method, false);
1279
- methods.push([eventName, method]);
1280
- });
1281
-
1282
- return methods;
1283
- }
1284
-
1285
- // Handle movement on document for handle and range drag.
1286
- function move ( event, data ) {
1287
-
1288
- // Fix #498
1289
- // Check value of .buttons in 'start' to work around a bug in IE10 mobile (data.buttonsProperty).
1290
- // https://connect.microsoft.com/IE/feedback/details/927005/mobile-ie10-windows-phone-buttons-property-of-pointermove-event-always-zero
1291
- // IE9 has .buttons and .which zero on mousemove.
1292
- // Firefox breaks the spec MDN defines.
1293
- if ( navigator.appVersion.indexOf("MSIE 9") === -1 && event.buttons === 0 && data.buttonsProperty !== 0 ) {
1294
- return end(event, data);
1295
- }
1296
-
1297
- var handles = data.handles || scope_Handles, positions, state = false,
1298
- proposal = ((event.calcPoint - data.start) * 100) / data.baseSize,
1299
- handleNumber = handles[0] === scope_Handles[0] ? 0 : 1, i;
1300
-
1301
- // Calculate relative positions for the handles.
1302
- positions = getPositions( proposal, data.positions, handles.length > 1);
1303
-
1304
- state = setHandle ( handles[0], positions[handleNumber], handles.length === 1 );
1305
-
1306
- if ( handles.length > 1 ) {
1307
-
1308
- state = setHandle ( handles[1], positions[handleNumber?0:1], false ) || state;
1309
-
1310
- if ( state ) {
1311
- // fire for both handles
1312
- for ( i = 0; i < data.handles.length; i++ ) {
1313
- fireEvent('slide', i);
1314
- }
1315
- }
1316
- } else if ( state ) {
1317
- // Fire for a single handle
1318
- fireEvent('slide', handleNumber);
1319
- }
1320
- }
1321
-
1322
- // Unbind move events on document, call callbacks.
1323
- function end ( event, data ) {
1324
-
1325
- // The handle is no longer active, so remove the class.
1326
- var active = scope_Base.querySelector( '.' + cssClasses[15] ),
1327
- handleNumber = data.handles[0] === scope_Handles[0] ? 0 : 1;
1328
-
1329
- if ( active !== null ) {
1330
- removeClass(active, cssClasses[15]);
1331
- }
1332
-
1333
- // Remove cursor styles and text-selection events bound to the body.
1334
- if ( event.cursor ) {
1335
- document.body.style.cursor = '';
1336
- document.body.removeEventListener('selectstart', document.body.noUiListener);
1337
- }
1338
-
1339
- var d = document.documentElement;
1340
-
1341
- // Unbind the move and end events, which are added on 'start'.
1342
- d.noUiListeners.forEach(function( c ) {
1343
- d.removeEventListener(c[0], c[1]);
1344
- });
1345
-
1346
- // Remove dragging class.
1347
- removeClass(scope_Target, cssClasses[12]);
1348
-
1349
- // Fire the change and set events.
1350
- fireEvent('set', handleNumber);
1351
- fireEvent('change', handleNumber);
1352
-
1353
- // If this is a standard handle movement, fire the end event.
1354
- if ( data.handleNumber !== undefined ) {
1355
- fireEvent('end', data.handleNumber);
1356
- }
1357
- }
1358
-
1359
- // Fire 'end' when a mouse or pen leaves the document.
1360
- function documentLeave ( event, data ) {
1361
- if ( event.type === "mouseout" && event.target.nodeName === "HTML" && event.relatedTarget === null ){
1362
- end ( event, data );
1363
- }
1364
- }
1365
-
1366
- // Bind move events on document.
1367
- function start ( event, data ) {
1368
-
1369
- var d = document.documentElement;
1370
-
1371
- // Mark the handle as 'active' so it can be styled.
1372
- if ( data.handles.length === 1 ) {
1373
- addClass(data.handles[0].children[0], cssClasses[15]);
1374
-
1375
- // Support 'disabled' handles
1376
- if ( data.handles[0].hasAttribute('disabled') ) {
1377
- return false;
1378
- }
1379
- }
1380
-
1381
- // Fix #551, where a handle gets selected instead of dragged.
1382
- event.preventDefault();
1383
-
1384
- // A drag should never propagate up to the 'tap' event.
1385
- event.stopPropagation();
1386
-
1387
- // Attach the move and end events.
1388
- var moveEvent = attach(actions.move, d, move, {
1389
- start: event.calcPoint,
1390
- baseSize: baseSize(),
1391
- pageOffset: event.pageOffset,
1392
- handles: data.handles,
1393
- handleNumber: data.handleNumber,
1394
- buttonsProperty: event.buttons,
1395
- positions: [
1396
- scope_Locations[0],
1397
- scope_Locations[scope_Handles.length - 1]
1398
- ]
1399
- }), endEvent = attach(actions.end, d, end, {
1400
- handles: data.handles,
1401
- handleNumber: data.handleNumber
1402
- });
1403
-
1404
- var outEvent = attach("mouseout", d, documentLeave, {
1405
- handles: data.handles,
1406
- handleNumber: data.handleNumber
1407
- });
1408
-
1409
- d.noUiListeners = moveEvent.concat(endEvent, outEvent);
1410
-
1411
- // Text selection isn't an issue on touch devices,
1412
- // so adding cursor styles can be skipped.
1413
- if ( event.cursor ) {
1414
-
1415
- // Prevent the 'I' cursor and extend the range-drag cursor.
1416
- document.body.style.cursor = getComputedStyle(event.target).cursor;
1417
-
1418
- // Mark the target with a dragging state.
1419
- if ( scope_Handles.length > 1 ) {
1420
- addClass(scope_Target, cssClasses[12]);
1421
- }
1422
-
1423
- var f = function(){
1424
- return false;
1425
- };
1426
-
1427
- document.body.noUiListener = f;
1428
-
1429
- // Prevent text selection when dragging the handles.
1430
- document.body.addEventListener('selectstart', f, false);
1431
- }
1432
-
1433
- if ( data.handleNumber !== undefined ) {
1434
- fireEvent('start', data.handleNumber);
1435
- }
1436
- }
1437
-
1438
- // Move closest handle to tapped location.
1439
- function tap ( event ) {
1440
-
1441
- var location = event.calcPoint, total = 0, handleNumber, to;
1442
-
1443
- // The tap event shouldn't propagate up and cause 'edge' to run.
1444
- event.stopPropagation();
1445
-
1446
- // Add up the handle offsets.
1447
- scope_Handles.forEach(function(a){
1448
- total += offset(a)[ options.style ];
1449
- });
1450
-
1451
- // Find the handle closest to the tapped position.
1452
- handleNumber = ( location < total/2 || scope_Handles.length === 1 ) ? 0 : 1;
1453
-
1454
- // Check if handler is not disablet if yes set number to the next handler
1455
- if (scope_Handles[handleNumber].hasAttribute('disabled')) {
1456
- handleNumber = handleNumber ? 0 : 1;
1457
- }
1458
-
1459
- location -= offset(scope_Base)[ options.style ];
1460
-
1461
- // Calculate the new position.
1462
- to = ( location * 100 ) / baseSize();
1463
-
1464
- if ( !options.events.snap ) {
1465
- // Flag the slider as it is now in a transitional state.
1466
- // Transition takes 300 ms, so re-enable the slider afterwards.
1467
- addClassFor( scope_Target, cssClasses[14], 300 );
1468
- }
1469
-
1470
- // Support 'disabled' handles
1471
- if ( scope_Handles[handleNumber].hasAttribute('disabled') ) {
1472
- return false;
1473
- }
1474
-
1475
- // Find the closest handle and calculate the tapped point.
1476
- // The set handle to the new position.
1477
- setHandle( scope_Handles[handleNumber], to );
1478
-
1479
- fireEvent('slide', handleNumber, true);
1480
- fireEvent('set', handleNumber, true);
1481
- fireEvent('change', handleNumber, true);
1482
-
1483
- if ( options.events.snap ) {
1484
- start(event, { handles: [scope_Handles[handleNumber]] });
1485
- }
1486
- }
1487
-
1488
- // Fires a 'hover' event for a hovered mouse/pen position.
1489
- function hover ( event ) {
1490
-
1491
- var location = event.calcPoint - offset(scope_Base)[ options.style ],
1492
- to = scope_Spectrum.getStep(( location * 100 ) / baseSize()),
1493
- value = scope_Spectrum.fromStepping( to );
1494
-
1495
- Object.keys(scope_Events).forEach(function( targetEvent ) {
1496
- if ( 'hover' === targetEvent.split('.')[0] ) {
1497
- scope_Events[targetEvent].forEach(function( callback ) {
1498
- callback.call( scope_Self, value );
1499
- });
1500
- }
1501
- });
1502
- }
1503
-
1504
- // Attach events to several slider parts.
1505
- function events ( behaviour ) {
1506
-
1507
- var i, drag;
1508
-
1509
- // Attach the standard drag event to the handles.
1510
- if ( !behaviour.fixed ) {
1511
-
1512
- for ( i = 0; i < scope_Handles.length; i += 1 ) {
1513
-
1514
- // These events are only bound to the visual handle
1515
- // element, not the 'real' origin element.
1516
- attach ( actions.start, scope_Handles[i].children[0], start, {
1517
- handles: [ scope_Handles[i] ],
1518
- handleNumber: i
1519
- });
1520
- }
1521
- }
1522
-
1523
- // Attach the tap event to the slider base.
1524
- if ( behaviour.tap ) {
1525
-
1526
- attach ( actions.start, scope_Base, tap, {
1527
- handles: scope_Handles
1528
- });
1529
- }
1530
-
1531
- // Fire hover events
1532
- if ( behaviour.hover ) {
1533
- attach ( actions.move, scope_Base, hover, { hover: true } );
1534
- for ( i = 0; i < scope_Handles.length; i += 1 ) {
1535
- ['mousemove MSPointerMove pointermove'].forEach(function( eventName ){
1536
- scope_Handles[i].children[0].addEventListener(eventName, stopPropagation, false);
1537
- });
1538
- }
1539
- }
1540
-
1541
- // Make the range draggable.
1542
- if ( behaviour.drag ){
1543
-
1544
- drag = [scope_Base.querySelector( '.' + cssClasses[7] )];
1545
- addClass(drag[0], cssClasses[10]);
1546
-
1547
- // When the range is fixed, the entire range can
1548
- // be dragged by the handles. The handle in the first
1549
- // origin will propagate the start event upward,
1550
- // but it needs to be bound manually on the other.
1551
- if ( behaviour.fixed ) {
1552
- drag.push(scope_Handles[(drag[0] === scope_Handles[0] ? 1 : 0)].children[0]);
1553
- }
1554
-
1555
- drag.forEach(function( element ) {
1556
- attach ( actions.start, element, start, {
1557
- handles: scope_Handles
1558
- });
1559
- });
1560
- }
1561
- }
1562
-
1563
-
1564
- // Test suggested values and apply margin, step.
1565
- function setHandle ( handle, to, noLimitOption ) {
1566
-
1567
- var trigger = handle !== scope_Handles[0] ? 1 : 0,
1568
- lowerMargin = scope_Locations[0] + options.margin,
1569
- upperMargin = scope_Locations[1] - options.margin,
1570
- lowerLimit = scope_Locations[0] + options.limit,
1571
- upperLimit = scope_Locations[1] - options.limit;
1572
-
1573
- // For sliders with multiple handles,
1574
- // limit movement to the other handle.
1575
- // Apply the margin option by adding it to the handle positions.
1576
- if ( scope_Handles.length > 1 ) {
1577
- to = trigger ? Math.max( to, lowerMargin ) : Math.min( to, upperMargin );
1578
- }
1579
-
1580
- // The limit option has the opposite effect, limiting handles to a
1581
- // maximum distance from another. Limit must be > 0, as otherwise
1582
- // handles would be unmoveable. 'noLimitOption' is set to 'false'
1583
- // for the .val() method, except for pass 4/4.
1584
- if ( noLimitOption !== false && options.limit && scope_Handles.length > 1 ) {
1585
- to = trigger ? Math.min ( to, lowerLimit ) : Math.max( to, upperLimit );
1586
- }
1587
-
1588
- // Handle the step option.
1589
- to = scope_Spectrum.getStep( to );
1590
-
1591
- // Limit to 0/100 for .val input, trim anything beyond 7 digits, as
1592
- // JavaScript has some issues in its floating point implementation.
1593
- to = limit(parseFloat(to.toFixed(7)));
1594
-
1595
- // Return false if handle can't move
1596
- if ( to === scope_Locations[trigger] ) {
1597
- return false;
1598
- }
1599
-
1600
- // Set the handle to the new position.
1601
- // Use requestAnimationFrame for efficient painting.
1602
- // No significant effect in Chrome, Edge sees dramatic
1603
- // performace improvements.
1604
- if ( window.requestAnimationFrame ) {
1605
- window.requestAnimationFrame(function(){
1606
- handle.style[options.style] = to + '%';
1607
- });
1608
- } else {
1609
- handle.style[options.style] = to + '%';
1610
- }
1611
-
1612
- // Force proper handle stacking
1613
- if ( !handle.previousSibling ) {
1614
- removeClass(handle, cssClasses[17]);
1615
- if ( to > 50 ) {
1616
- addClass(handle, cssClasses[17]);
1617
- }
1618
- }
1619
-
1620
- // Update locations.
1621
- scope_Locations[trigger] = to;
1622
-
1623
- // Convert the value to the slider stepping/range.
1624
- scope_Values[trigger] = scope_Spectrum.fromStepping( to );
1625
-
1626
- fireEvent('update', trigger);
1627
-
1628
- return true;
1629
- }
1630
-
1631
- // Loop values from value method and apply them.
1632
- function setValues ( count, values ) {
1633
-
1634
- var i, trigger, to;
1635
-
1636
- // With the limit option, we'll need another limiting pass.
1637
- if ( options.limit ) {
1638
- count += 1;
1639
- }
1640
-
1641
- // If there are multiple handles to be set run the setting
1642
- // mechanism twice for the first handle, to make sure it
1643
- // can be bounced of the second one properly.
1644
- for ( i = 0; i < count; i += 1 ) {
1645
-
1646
- trigger = i%2;
1647
-
1648
- // Get the current argument from the array.
1649
- to = values[trigger];
1650
-
1651
- // Setting with null indicates an 'ignore'.
1652
- // Inputting 'false' is invalid.
1653
- if ( to !== null && to !== false ) {
1654
-
1655
- // If a formatted number was passed, attemt to decode it.
1656
- if ( typeof to === 'number' ) {
1657
- to = String(to);
1658
- }
1659
-
1660
- to = options.format.from( to );
1661
-
1662
- // Request an update for all links if the value was invalid.
1663
- // Do so too if setting the handle fails.
1664
- if ( to === false || isNaN(to) || setHandle( scope_Handles[trigger], scope_Spectrum.toStepping( to ), i === (3 - options.dir) ) === false ) {
1665
- fireEvent('update', trigger);
1666
- }
1667
- }
1668
- }
1669
- }
1670
-
1671
- // Set the slider value.
1672
- function valueSet ( input ) {
1673
-
1674
- var count, values = asArray( input ), i;
1675
-
1676
- // The RTL settings is implemented by reversing the front-end,
1677
- // internal mechanisms are the same.
1678
- if ( options.dir && options.handles > 1 ) {
1679
- values.reverse();
1680
- }
1681
-
1682
- // Animation is optional.
1683
- // Make sure the initial values where set before using animated placement.
1684
- if ( options.animate && scope_Locations[0] !== -1 ) {
1685
- addClassFor( scope_Target, cssClasses[14], 300 );
1686
- }
1687
-
1688
- // Determine how often to set the handles.
1689
- count = scope_Handles.length > 1 ? 3 : 1;
1690
-
1691
- if ( values.length === 1 ) {
1692
- count = 1;
1693
- }
1694
-
1695
- setValues ( count, values );
1696
-
1697
- // Fire the 'set' event for both handles.
1698
- for ( i = 0; i < scope_Handles.length; i++ ) {
1699
-
1700
- // Fire the event only for handles that received a new value, as per #579
1701
- if ( values[i] !== null ) {
1702
- fireEvent('set', i);
1703
- }
1704
- }
1705
- }
1706
-
1707
- // Get the slider value.
1708
- function valueGet ( ) {
1709
-
1710
- var i, retour = [];
1711
-
1712
- // Get the value from all handles.
1713
- for ( i = 0; i < options.handles; i += 1 ){
1714
- retour[i] = options.format.to( scope_Values[i] );
1715
- }
1716
-
1717
- return inSliderOrder( retour );
1718
- }
1719
-
1720
- // Removes classes from the root and empties it.
1721
- function destroy ( ) {
1722
-
1723
- cssClasses.forEach(function(cls){
1724
- if ( !cls ) { return; } // Ignore empty classes
1725
- removeClass(scope_Target, cls);
1726
- });
1727
-
1728
- while (scope_Target.firstChild) {
1729
- scope_Target.removeChild(scope_Target.firstChild);
1730
- }
1731
-
1732
- delete scope_Target.noUiSlider;
1733
- }
1734
-
1735
- // Get the current step size for the slider.
1736
- function getCurrentStep ( ) {
1737
-
1738
- // Check all locations, map them to their stepping point.
1739
- // Get the step point, then find it in the input list.
1740
- var retour = scope_Locations.map(function( location, index ){
1741
-
1742
- var step = scope_Spectrum.getApplicableStep( location ),
1743
-
1744
- // As per #391, the comparison for the decrement step can have some rounding issues.
1745
- // Round the value to the precision used in the step.
1746
- stepDecimals = countDecimals(String(step[2])),
1747
-
1748
- // Get the current numeric value
1749
- value = scope_Values[index],
1750
-
1751
- // To move the slider 'one step up', the current step value needs to be added.
1752
- // Use null if we are at the maximum slider value.
1753
- increment = location === 100 ? null : step[2],
1754
-
1755
- // Going 'one step down' might put the slider in a different sub-range, so we
1756
- // need to switch between the current or the previous step.
1757
- prev = Number((value - step[2]).toFixed(stepDecimals)),
1758
-
1759
- // If the value fits the step, return the current step value. Otherwise, use the
1760
- // previous step. Return null if the slider is at its minimum value.
1761
- decrement = location === 0 ? null : (prev >= step[1]) ? step[2] : (step[0] || false);
1762
-
1763
- return [decrement, increment];
1764
- });
1765
-
1766
- // Return values in the proper order.
1767
- return inSliderOrder( retour );
1768
- }
1769
-
1770
- // Attach an event to this slider, possibly including a namespace
1771
- function bindEvent ( namespacedEvent, callback ) {
1772
- scope_Events[namespacedEvent] = scope_Events[namespacedEvent] || [];
1773
- scope_Events[namespacedEvent].push(callback);
1774
-
1775
- // If the event bound is 'update,' fire it immediately for all handles.
1776
- if ( namespacedEvent.split('.')[0] === 'update' ) {
1777
- scope_Handles.forEach(function(a, index){
1778
- fireEvent('update', index);
1779
- });
1780
- }
1781
- }
1782
-
1783
- // Undo attachment of event
1784
- function removeEvent ( namespacedEvent ) {
1785
-
1786
- var event = namespacedEvent.split('.')[0],
1787
- namespace = namespacedEvent.substring(event.length);
1788
-
1789
- Object.keys(scope_Events).forEach(function( bind ){
1790
-
1791
- var tEvent = bind.split('.')[0],
1792
- tNamespace = bind.substring(tEvent.length);
1793
-
1794
- if ( (!event || event === tEvent) && (!namespace || namespace === tNamespace) ) {
1795
- delete scope_Events[bind];
1796
- }
1797
- });
1798
- }
1799
-
1800
- // Updateable: margin, limit, step, range, animate, snap
1801
- function updateOptions ( optionsToUpdate ) {
1802
-
1803
- var v = valueGet(), i, newOptions = testOptions({
1804
- start: [0, 0],
1805
- margin: optionsToUpdate.margin,
1806
- limit: optionsToUpdate.limit,
1807
- step: optionsToUpdate.step,
1808
- range: optionsToUpdate.range,
1809
- animate: optionsToUpdate.animate,
1810
- snap: optionsToUpdate.snap === undefined ? options.snap : optionsToUpdate.snap
1811
- });
1812
-
1813
- ['margin', 'limit', 'step', 'range', 'animate'].forEach(function(name){
1814
- if ( optionsToUpdate[name] !== undefined ) {
1815
- options[name] = optionsToUpdate[name];
1816
- }
1817
- });
1818
-
1819
- // Save current spectrum direction as testOptions in testRange call
1820
- // doesn't rely on current direction
1821
- newOptions.spectrum.direction = scope_Spectrum.direction;
1822
- scope_Spectrum = newOptions.spectrum;
1823
-
1824
- // Invalidate the current positioning so valueSet forces an update.
1825
- scope_Locations = [-1, -1];
1826
- valueSet(v);
1827
-
1828
- for ( i = 0; i < scope_Handles.length; i++ ) {
1829
- fireEvent('update', i);
1830
- }
1831
- }
1832
-
1833
-
1834
- // Throw an error if the slider was already initialized.
1835
- if ( scope_Target.noUiSlider ) {
1836
- throw new Error('Slider was already initialized.');
1837
- }
1838
-
1839
- // Create the base element, initialise HTML and set classes.
1840
- // Add handles and links.
1841
- scope_Base = addSlider( options.dir, options.ort, scope_Target );
1842
- scope_Handles = addHandles( options.handles, options.dir, scope_Base );
1843
-
1844
- // Set the connect classes.
1845
- addConnection ( options.connect, scope_Target, scope_Handles );
1846
-
1847
- if ( options.pips ) {
1848
- pips(options.pips);
1849
- }
1850
-
1851
- if ( options.tooltips ) {
1852
- tooltips();
1853
- }
1854
-
1855
- scope_Self = {
1856
- destroy: destroy,
1857
- steps: getCurrentStep,
1858
- on: bindEvent,
1859
- off: removeEvent,
1860
- get: valueGet,
1861
- set: valueSet,
1862
- updateOptions: updateOptions,
1863
- options: options, // Issue #600
1864
- target: scope_Target, // Issue #597
1865
- pips: pips // Issue #594
1866
- };
1867
-
1868
- // Attach user events.
1869
- events( options.events );
1870
-
1871
- return scope_Self;
1872
-
1873
- }
1874
-
1875
-
1876
- // Run the standard initializer
1877
- function initialize ( target, originalOptions ) {
1878
-
1879
- if ( !target.nodeName ) {
1880
- throw new Error('noUiSlider.create requires a single element.');
1881
- }
1882
-
1883
- // Test the options and create the slider environment;
1884
- var options = testOptions( originalOptions, target ),
1885
- slider = closure( target, options );
1886
-
1887
- // Use the public value method to set the start values.
1888
- slider.set(options.start);
1889
-
1890
- target.noUiSlider = slider;
1891
- return slider;
1892
- }
1893
-
1894
- // Use an object instead of a function for future expansibility;
1895
- return {
1896
- create: initialize
1897
- };
1898
-
1899
- }));