locomotivecms 3.1.2 → 3.2.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (1076) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/app/api/locomotive/api/entities/content_type_entity.rb +1 -1
  4. data/app/api/locomotive/api/exception_rescuers.rb +1 -1
  5. data/app/api/locomotive/api/forms/content_type_form.rb +2 -1
  6. data/app/api/locomotive/api/resources/content_type_resource.rb +2 -0
  7. data/app/assets/javascripts/locomotive/views/editable_elements/iframe_view.js.coffee +13 -9
  8. data/app/assets/javascripts/locomotive/views/inputs/rte_view.js.coffee.erb +11 -6
  9. data/app/assets/stylesheets/locomotive/application.scss +1 -0
  10. data/app/assets/stylesheets/locomotive/new/_flags.scss.erb +21 -0
  11. data/app/assets/stylesheets/locomotive/old/form/_popover.scss +14 -10
  12. data/app/assets/stylesheets/locomotive/old/form/_select2.scss +2 -2
  13. data/app/helpers/locomotive/base_helper.rb +19 -7
  14. data/app/helpers/locomotive/content_types_helper.rb +1 -1
  15. data/app/helpers/locomotive/editable_elements_helper.rb +15 -0
  16. data/app/helpers/locomotive/my_account_helper.rb +6 -10
  17. data/app/helpers/locomotive/pages_helper.rb +2 -1
  18. data/app/helpers/locomotive/shared/pages_helper.rb +21 -26
  19. data/app/helpers/locomotive/sites_helper.rb +11 -10
  20. data/app/jobs/locomotive/send_pony_email_job.rb +37 -0
  21. data/app/models/locomotive/concerns/content_entry/counter.rb +13 -2
  22. data/app/models/locomotive/concerns/content_type/filter_fields.rb +26 -0
  23. data/app/models/locomotive/concerns/page/layout.rb +4 -0
  24. data/app/models/locomotive/concerns/page/to_steam.rb +20 -0
  25. data/app/models/locomotive/concerns/site/access_points.rb +1 -0
  26. data/app/models/locomotive/concerns/site/metafields.rb +1 -1
  27. data/app/models/locomotive/content_type.rb +1 -10
  28. data/app/models/locomotive/page.rb +1 -0
  29. data/app/models/locomotive/site.rb +0 -4
  30. data/app/policies/locomotive/site_policy.rb +2 -2
  31. data/app/services/locomotive/content_entry_service.rb +2 -3
  32. data/app/services/locomotive/page_parsing_service.rb +11 -7
  33. data/app/views/locomotive/current_site/_locale.html.slim +2 -2
  34. data/app/views/locomotive/current_site/form/_access_points.html.slim +1 -0
  35. data/app/views/locomotive/editable_elements/_edit.html.slim +1 -1
  36. data/app/views/locomotive/editable_elements/index_without_preview.html.slim +1 -1
  37. data/app/views/locomotive/layouts/account.html.slim +1 -2
  38. data/app/views/locomotive/layouts/application.html.slim +0 -10
  39. data/app/views/locomotive/pages/_header.html.slim +1 -1
  40. data/app/views/locomotive/shared/_head.html.slim +2 -2
  41. data/app/views/locomotive/shared/_locale_picker_link.html.slim +2 -1
  42. data/app/views/locomotive/shared/rte/_image_popover.html.slim +17 -15
  43. data/app/views/locomotive/shared/rte/_link_popover.html.slim +17 -15
  44. data/app/views/locomotive/shared/rte/_markdown_toolbar.html.slim +1 -1
  45. data/app/views/locomotive/shared/rte/_table_popover.html.slim +15 -13
  46. data/app/views/locomotive/shared/sidebar/_page.html.slim +6 -6
  47. data/app/views/locomotive/sites/_site.html.slim +1 -1
  48. data/config/locales/carrierwave.es.yml +4 -0
  49. data/config/locales/carrierwave.sv.yml +4 -0
  50. data/config/locales/carrierwave.uk.yml +4 -0
  51. data/config/locales/de.yml +10 -0
  52. data/config/locales/default.es.yml +13 -0
  53. data/config/locales/default.sv.yml +13 -0
  54. data/config/locales/default.uk.yml +13 -0
  55. data/config/locales/devise.es.yml +61 -0
  56. data/config/locales/devise.sv.yml +61 -0
  57. data/config/locales/devise.uk.yml +61 -0
  58. data/config/locales/es.yml +332 -0
  59. data/config/locales/flash.es.yml +82 -0
  60. data/config/locales/flash.sv.yml +82 -0
  61. data/config/locales/flash.uk.yml +82 -0
  62. data/config/locales/inputs.es.yml +19 -0
  63. data/config/locales/inputs.sv.yml +19 -0
  64. data/config/locales/inputs.uk.yml +19 -0
  65. data/config/locales/mongoid.es.yml +47 -0
  66. data/config/locales/mongoid.sv.yml +47 -0
  67. data/config/locales/mongoid.uk.yml +47 -0
  68. data/config/locales/pt-BR.yml +4 -0
  69. data/config/locales/ru.yml +4 -0
  70. data/config/locales/simple_form.en.yml +1 -0
  71. data/config/locales/simple_form.es.yml +153 -0
  72. data/config/locales/simple_form.fr.yml +1 -0
  73. data/config/locales/simple_form.sv.yml +153 -0
  74. data/config/locales/simple_form.uk.yml +153 -0
  75. data/config/locales/sv.yml +332 -0
  76. data/config/locales/uk.yml +332 -0
  77. data/config/locales/zh-CN.yml +5 -1
  78. data/lib/generators/locomotive/install/templates/locomotive.rb +2 -2
  79. data/lib/locomotive/middlewares/site.rb +4 -3
  80. data/lib/locomotive/steam/middlewares/page_editing.rb +10 -0
  81. data/lib/locomotive/steam/services/api_content_entry_service.rb +58 -0
  82. data/lib/locomotive/steam/services/api_entry_submission_service.rb +20 -18
  83. data/lib/locomotive/steam/services/async_email_service.rb +36 -0
  84. data/lib/locomotive/steam/services/liquid_parser_with_cache_service.rb +16 -0
  85. data/lib/locomotive/steam_adaptor.rb +8 -4
  86. data/lib/locomotive/version.rb +1 -1
  87. data/lib/tasks/locomotive.rake +5 -0
  88. data/spec/dummy/config/initializers/locomotive.rb +1 -1
  89. data/spec/lib/locomotive/steam/services/api_entry_submission_service_spec.rb +6 -3
  90. data/spec/lib/locomotive/steam/services/async_email_service_spec.rb +45 -0
  91. data/spec/models/locomotive/concerns/page/layout_spec.rb +26 -0
  92. data/spec/models/locomotive/concerns/site/metafields_spec.rb +1 -1
  93. data/spec/requests/locomotive/steam/cache_spec.rb +1 -1
  94. data/vendor/assets/components/locomotive_sources/backbone/LICENSE +22 -0
  95. data/vendor/assets/components/locomotive_sources/backbone/backbone-min.js +2 -0
  96. data/vendor/assets/components/locomotive_sources/backbone/backbone-min.map +1 -0
  97. data/vendor/assets/components/locomotive_sources/backbone/backbone.js +1894 -0
  98. data/vendor/assets/components/locomotive_sources/backbone/bower.json +8 -0
  99. data/vendor/assets/components/locomotive_sources/bootstrap-tagsinput/Gruntfile.js +82 -0
  100. data/vendor/assets/components/locomotive_sources/bootstrap-tagsinput/LICENSE +20 -0
  101. data/vendor/assets/components/locomotive_sources/bootstrap-tagsinput/README.md +92 -0
  102. data/vendor/assets/components/locomotive_sources/bootstrap-tagsinput/bootstrap-tagsinput.jquery.json +27 -0
  103. data/vendor/assets/components/locomotive_sources/bootstrap-tagsinput/bower.json +42 -0
  104. data/vendor/assets/components/locomotive_sources/bootstrap-tagsinput/dist/bootstrap-tagsinput-angular.js +87 -0
  105. data/vendor/assets/components/locomotive_sources/bootstrap-tagsinput/dist/bootstrap-tagsinput-angular.min.js +7 -0
  106. data/vendor/assets/components/locomotive_sources/bootstrap-tagsinput/dist/bootstrap-tagsinput-angular.min.js.map +1 -0
  107. data/vendor/assets/components/locomotive_sources/bootstrap-tagsinput/dist/bootstrap-tagsinput-typeahead.css +49 -0
  108. data/vendor/assets/components/locomotive_sources/bootstrap-tagsinput/dist/bootstrap-tagsinput.css +55 -0
  109. data/vendor/assets/components/locomotive_sources/bootstrap-tagsinput/dist/bootstrap-tagsinput.js +663 -0
  110. data/vendor/assets/components/locomotive_sources/bootstrap-tagsinput/dist/bootstrap-tagsinput.less +50 -0
  111. data/vendor/assets/components/locomotive_sources/bootstrap-tagsinput/dist/bootstrap-tagsinput.min.js +7 -0
  112. data/vendor/assets/components/locomotive_sources/bootstrap-tagsinput/dist/bootstrap-tagsinput.min.js.map +1 -0
  113. data/vendor/assets/components/locomotive_sources/bootstrap-tagsinput/dist/bootstrap-tagsinput.zip +0 -0
  114. data/vendor/assets/components/locomotive_sources/bootstrap-tagsinput/examples/assets/app.css +67 -0
  115. data/vendor/assets/components/locomotive_sources/bootstrap-tagsinput/examples/assets/app.js +15 -0
  116. data/vendor/assets/components/locomotive_sources/bootstrap-tagsinput/examples/assets/app_bs2.js +74 -0
  117. data/vendor/assets/components/locomotive_sources/bootstrap-tagsinput/examples/assets/app_bs3.js +95 -0
  118. data/vendor/assets/components/locomotive_sources/bootstrap-tagsinput/examples/assets/cities.json +16 -0
  119. data/vendor/assets/components/locomotive_sources/bootstrap-tagsinput/examples/assets/citynames.json +16 -0
  120. data/vendor/assets/components/locomotive_sources/bootstrap-tagsinput/examples/bootstrap-2.3.2.html +666 -0
  121. data/vendor/assets/components/locomotive_sources/bootstrap-tagsinput/examples/index.html +742 -0
  122. data/vendor/assets/components/locomotive_sources/bootstrap-tagsinput/karma.conf.js +20 -0
  123. data/vendor/assets/components/locomotive_sources/bootstrap-tagsinput/package.json +47 -0
  124. data/vendor/assets/components/locomotive_sources/bootstrap-tagsinput/src/bootstrap-tagsinput-angular.js +87 -0
  125. data/vendor/assets/components/locomotive_sources/bootstrap-tagsinput/src/bootstrap-tagsinput-typeahead.css +49 -0
  126. data/vendor/assets/components/locomotive_sources/bootstrap-tagsinput/src/bootstrap-tagsinput.css +55 -0
  127. data/vendor/assets/components/locomotive_sources/bootstrap-tagsinput/src/bootstrap-tagsinput.js +663 -0
  128. data/vendor/assets/components/locomotive_sources/eonasdan-bootstrap-datetimepicker/CONTRIBUTING.md +38 -0
  129. data/vendor/assets/components/locomotive_sources/eonasdan-bootstrap-datetimepicker/Gruntfile.js +191 -0
  130. data/vendor/assets/components/locomotive_sources/eonasdan-bootstrap-datetimepicker/LICENSE +21 -0
  131. data/vendor/assets/components/locomotive_sources/eonasdan-bootstrap-datetimepicker/README.md +37 -0
  132. data/vendor/assets/components/locomotive_sources/eonasdan-bootstrap-datetimepicker/bower.json +35 -0
  133. data/vendor/assets/components/locomotive_sources/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker-standalone.css +103 -0
  134. data/vendor/assets/components/locomotive_sources/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.css +373 -0
  135. data/vendor/assets/components/locomotive_sources/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css +5 -0
  136. data/vendor/assets/components/locomotive_sources/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js +9 -0
  137. data/vendor/assets/components/locomotive_sources/eonasdan-bootstrap-datetimepicker/component.json +9 -0
  138. data/vendor/assets/components/locomotive_sources/eonasdan-bootstrap-datetimepicker/composer.json +28 -0
  139. data/vendor/assets/components/locomotive_sources/eonasdan-bootstrap-datetimepicker/docs/ChangeLog.md +222 -0
  140. data/vendor/assets/components/locomotive_sources/eonasdan-bootstrap-datetimepicker/docs/ContributorsGuide.md +126 -0
  141. data/vendor/assets/components/locomotive_sources/eonasdan-bootstrap-datetimepicker/docs/Events.md +96 -0
  142. data/vendor/assets/components/locomotive_sources/eonasdan-bootstrap-datetimepicker/docs/Extras.md +95 -0
  143. data/vendor/assets/components/locomotive_sources/eonasdan-bootstrap-datetimepicker/docs/FAQ.md +22 -0
  144. data/vendor/assets/components/locomotive_sources/eonasdan-bootstrap-datetimepicker/docs/Functions.md +670 -0
  145. data/vendor/assets/components/locomotive_sources/eonasdan-bootstrap-datetimepicker/docs/Installing.md +161 -0
  146. data/vendor/assets/components/locomotive_sources/eonasdan-bootstrap-datetimepicker/docs/Options.md +473 -0
  147. data/vendor/assets/components/locomotive_sources/eonasdan-bootstrap-datetimepicker/docs/Version 4 Changelog.md +6 -0
  148. data/vendor/assets/components/locomotive_sources/eonasdan-bootstrap-datetimepicker/docs/Version 4 Contributors guide.md +6 -0
  149. data/vendor/assets/components/locomotive_sources/eonasdan-bootstrap-datetimepicker/docs/index.md +592 -0
  150. data/vendor/assets/components/locomotive_sources/eonasdan-bootstrap-datetimepicker/mkdocs.yml +17 -0
  151. data/vendor/assets/components/locomotive_sources/eonasdan-bootstrap-datetimepicker/package.json +43 -0
  152. data/vendor/assets/components/locomotive_sources/eonasdan-bootstrap-datetimepicker/src/js/bootstrap-datetimepicker.js +2552 -0
  153. data/vendor/assets/components/locomotive_sources/eonasdan-bootstrap-datetimepicker/src/less/_bootstrap-datetimepicker.less +352 -0
  154. data/vendor/assets/components/locomotive_sources/eonasdan-bootstrap-datetimepicker/src/less/bootstrap-datetimepicker-build.less +17 -0
  155. data/vendor/assets/components/locomotive_sources/eonasdan-bootstrap-datetimepicker/src/nuget/Bootstrap.v3.Datetimepicker.CSS.nuspec +34 -0
  156. data/vendor/assets/components/locomotive_sources/eonasdan-bootstrap-datetimepicker/src/nuget/Bootstrap.v3.Datetimepicker.nuspec +34 -0
  157. data/vendor/assets/components/locomotive_sources/eonasdan-bootstrap-datetimepicker/src/nuget/NuGet.exe +0 -0
  158. data/vendor/assets/components/locomotive_sources/eonasdan-bootstrap-datetimepicker/src/nuget/install.ps1 +2 -0
  159. data/vendor/assets/components/locomotive_sources/eonasdan-bootstrap-datetimepicker/src/sass/_bootstrap-datetimepicker.scss +343 -0
  160. data/vendor/assets/components/locomotive_sources/eonasdan-bootstrap-datetimepicker/src/sass/bootstrap-datetimepicker-build.scss +16 -0
  161. data/vendor/assets/components/locomotive_sources/eonasdan-bootstrap-datetimepicker/tasks/bump_version.js +88 -0
  162. data/vendor/assets/components/locomotive_sources/jquery-timeago/CNAME +1 -0
  163. data/vendor/assets/components/locomotive_sources/jquery-timeago/CONTRIBUTING.md +37 -0
  164. data/vendor/assets/components/locomotive_sources/jquery-timeago/LICENSE.txt +22 -0
  165. data/vendor/assets/components/locomotive_sources/jquery-timeago/README.markdown +119 -0
  166. data/vendor/assets/components/locomotive_sources/jquery-timeago/Rakefile +22 -0
  167. data/vendor/assets/components/locomotive_sources/jquery-timeago/bower.json +12 -0
  168. data/vendor/assets/components/locomotive_sources/jquery-timeago/clock.png +0 -0
  169. data/vendor/assets/components/locomotive_sources/jquery-timeago/composer.json +32 -0
  170. data/vendor/assets/components/locomotive_sources/jquery-timeago/contrib/timeago-koext.js +14 -0
  171. data/vendor/assets/components/locomotive_sources/jquery-timeago/index.html +221 -0
  172. data/vendor/assets/components/locomotive_sources/jquery-timeago/jquery.timeago.js +225 -0
  173. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/README.md +27 -0
  174. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.af.js +20 -0
  175. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.ar.js +96 -0
  176. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.bg.js +18 -0
  177. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.bs.js +49 -0
  178. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.ca.js +18 -0
  179. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.cs.js +24 -0
  180. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.cy.js +20 -0
  181. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.da.js +18 -0
  182. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.de.js +18 -0
  183. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.dv.js +22 -0
  184. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.el.js +18 -0
  185. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.en-short.js +20 -0
  186. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.en.js +20 -0
  187. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.es-short.js +20 -0
  188. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.es.js +18 -0
  189. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.et.js +18 -0
  190. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.eu.js +17 -0
  191. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.fa-short.js +20 -0
  192. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.fa.js +22 -0
  193. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.fi.js +28 -0
  194. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.fr-short.js +16 -0
  195. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.fr.js +17 -0
  196. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.gl.js +18 -0
  197. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.he.js +16 -0
  198. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.hr.js +49 -0
  199. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.hu.js +18 -0
  200. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.hy.js +18 -0
  201. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.id.js +18 -0
  202. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.is.js +19 -0
  203. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.it-short.js +20 -0
  204. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.it.js +16 -0
  205. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.ja.js +19 -0
  206. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.jv.js +18 -0
  207. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.ko.js +20 -0
  208. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.ky.js +34 -0
  209. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.lt.js +20 -0
  210. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.lv.js +20 -0
  211. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.mk.js +20 -0
  212. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.nl.js +20 -0
  213. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.no.js +18 -0
  214. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.pl.js +31 -0
  215. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.pt-br-short.js +20 -0
  216. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.pt-br.js +18 -0
  217. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.pt-short.js +20 -0
  218. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.pt.js +16 -0
  219. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.ro.js +18 -0
  220. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.rs.js +49 -0
  221. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.ru.js +34 -0
  222. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.rw.js +20 -0
  223. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.si.js +18 -0
  224. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.sk.js +18 -0
  225. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.sl.js +40 -0
  226. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.sr.js +49 -0
  227. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.sv.js +18 -0
  228. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.th.js +20 -0
  229. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.tr.js +16 -0
  230. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.uk.js +34 -0
  231. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.uz.js +19 -0
  232. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.vi.js +20 -0
  233. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.zh-CN.js +20 -0
  234. data/vendor/assets/components/locomotive_sources/jquery-timeago/locales/jquery.timeago.zh-TW.js +20 -0
  235. data/vendor/assets/components/locomotive_sources/jquery-timeago/package.json +37 -0
  236. data/vendor/assets/components/locomotive_sources/jquery-timeago/timeago.jquery.json +30 -0
  237. data/vendor/assets/components/locomotive_sources/jquery/MIT-LICENSE.txt +21 -0
  238. data/vendor/assets/components/locomotive_sources/jquery/bower.json +28 -0
  239. data/vendor/assets/components/locomotive_sources/jquery/dist/jquery.js +9210 -0
  240. data/vendor/assets/components/locomotive_sources/jquery/dist/jquery.min.js +5 -0
  241. data/vendor/assets/components/locomotive_sources/jquery/dist/jquery.min.map +1 -0
  242. data/vendor/assets/components/locomotive_sources/jquery/src/ajax.js +786 -0
  243. data/vendor/assets/components/locomotive_sources/jquery/src/ajax/jsonp.js +89 -0
  244. data/vendor/assets/components/locomotive_sources/jquery/src/ajax/load.js +75 -0
  245. data/vendor/assets/components/locomotive_sources/jquery/src/ajax/parseJSON.js +13 -0
  246. data/vendor/assets/components/locomotive_sources/jquery/src/ajax/parseXML.js +28 -0
  247. data/vendor/assets/components/locomotive_sources/jquery/src/ajax/script.js +64 -0
  248. data/vendor/assets/components/locomotive_sources/jquery/src/ajax/var/nonce.js +5 -0
  249. data/vendor/assets/components/locomotive_sources/jquery/src/ajax/var/rquery.js +3 -0
  250. data/vendor/assets/components/locomotive_sources/jquery/src/ajax/xhr.js +136 -0
  251. data/vendor/assets/components/locomotive_sources/jquery/src/attributes.js +11 -0
  252. data/vendor/assets/components/locomotive_sources/jquery/src/attributes/attr.js +141 -0
  253. data/vendor/assets/components/locomotive_sources/jquery/src/attributes/classes.js +158 -0
  254. data/vendor/assets/components/locomotive_sources/jquery/src/attributes/prop.js +94 -0
  255. data/vendor/assets/components/locomotive_sources/jquery/src/attributes/support.js +35 -0
  256. data/vendor/assets/components/locomotive_sources/jquery/src/attributes/val.js +161 -0
  257. data/vendor/assets/components/locomotive_sources/jquery/src/callbacks.js +205 -0
  258. data/vendor/assets/components/locomotive_sources/jquery/src/core.js +502 -0
  259. data/vendor/assets/components/locomotive_sources/jquery/src/core/access.js +60 -0
  260. data/vendor/assets/components/locomotive_sources/jquery/src/core/init.js +123 -0
  261. data/vendor/assets/components/locomotive_sources/jquery/src/core/parseHTML.js +39 -0
  262. data/vendor/assets/components/locomotive_sources/jquery/src/core/ready.js +97 -0
  263. data/vendor/assets/components/locomotive_sources/jquery/src/core/var/rsingleTag.js +4 -0
  264. data/vendor/assets/components/locomotive_sources/jquery/src/css.js +450 -0
  265. data/vendor/assets/components/locomotive_sources/jquery/src/css/addGetHookIf.js +22 -0
  266. data/vendor/assets/components/locomotive_sources/jquery/src/css/curCSS.js +57 -0
  267. data/vendor/assets/components/locomotive_sources/jquery/src/css/defaultDisplay.js +70 -0
  268. data/vendor/assets/components/locomotive_sources/jquery/src/css/hiddenVisibleSelectors.js +15 -0
  269. data/vendor/assets/components/locomotive_sources/jquery/src/css/support.js +96 -0
  270. data/vendor/assets/components/locomotive_sources/jquery/src/css/swap.js +28 -0
  271. data/vendor/assets/components/locomotive_sources/jquery/src/css/var/cssExpand.js +3 -0
  272. data/vendor/assets/components/locomotive_sources/jquery/src/css/var/getStyles.js +12 -0
  273. data/vendor/assets/components/locomotive_sources/jquery/src/css/var/isHidden.js +13 -0
  274. data/vendor/assets/components/locomotive_sources/jquery/src/css/var/rmargin.js +3 -0
  275. data/vendor/assets/components/locomotive_sources/jquery/src/css/var/rnumnonpx.js +5 -0
  276. data/vendor/assets/components/locomotive_sources/jquery/src/data.js +178 -0
  277. data/vendor/assets/components/locomotive_sources/jquery/src/data/Data.js +181 -0
  278. data/vendor/assets/components/locomotive_sources/jquery/src/data/accepts.js +20 -0
  279. data/vendor/assets/components/locomotive_sources/jquery/src/data/var/data_priv.js +5 -0
  280. data/vendor/assets/components/locomotive_sources/jquery/src/data/var/data_user.js +5 -0
  281. data/vendor/assets/components/locomotive_sources/jquery/src/deferred.js +149 -0
  282. data/vendor/assets/components/locomotive_sources/jquery/src/deprecated.js +13 -0
  283. data/vendor/assets/components/locomotive_sources/jquery/src/dimensions.js +50 -0
  284. data/vendor/assets/components/locomotive_sources/jquery/src/effects.js +648 -0
  285. data/vendor/assets/components/locomotive_sources/jquery/src/effects/Tween.js +114 -0
  286. data/vendor/assets/components/locomotive_sources/jquery/src/effects/animatedSelector.js +13 -0
  287. data/vendor/assets/components/locomotive_sources/jquery/src/event.js +868 -0
  288. data/vendor/assets/components/locomotive_sources/jquery/src/event/ajax.js +13 -0
  289. data/vendor/assets/components/locomotive_sources/jquery/src/event/alias.js +39 -0
  290. data/vendor/assets/components/locomotive_sources/jquery/src/event/support.js +9 -0
  291. data/vendor/assets/components/locomotive_sources/jquery/src/exports/amd.js +24 -0
  292. data/vendor/assets/components/locomotive_sources/jquery/src/exports/global.js +32 -0
  293. data/vendor/assets/components/locomotive_sources/jquery/src/intro.js +44 -0
  294. data/vendor/assets/components/locomotive_sources/jquery/src/jquery.js +37 -0
  295. data/vendor/assets/components/locomotive_sources/jquery/src/manipulation.js +580 -0
  296. data/vendor/assets/components/locomotive_sources/jquery/src/manipulation/_evalUrl.js +18 -0
  297. data/vendor/assets/components/locomotive_sources/jquery/src/manipulation/support.js +32 -0
  298. data/vendor/assets/components/locomotive_sources/jquery/src/manipulation/var/rcheckableType.js +3 -0
  299. data/vendor/assets/components/locomotive_sources/jquery/src/offset.js +207 -0
  300. data/vendor/assets/components/locomotive_sources/jquery/src/outro.js +1 -0
  301. data/vendor/assets/components/locomotive_sources/jquery/src/queue.js +142 -0
  302. data/vendor/assets/components/locomotive_sources/jquery/src/queue/delay.js +22 -0
  303. data/vendor/assets/components/locomotive_sources/jquery/src/selector-native.js +172 -0
  304. data/vendor/assets/components/locomotive_sources/jquery/src/selector-sizzle.js +14 -0
  305. data/vendor/assets/components/locomotive_sources/jquery/src/selector.js +1 -0
  306. data/vendor/assets/components/locomotive_sources/jquery/src/serialize.js +111 -0
  307. data/vendor/assets/components/locomotive_sources/jquery/src/sizzle/dist/sizzle.js +2067 -0
  308. data/vendor/assets/components/locomotive_sources/jquery/src/sizzle/dist/sizzle.min.js +3 -0
  309. data/vendor/assets/components/locomotive_sources/jquery/src/sizzle/dist/sizzle.min.map +1 -0
  310. data/vendor/assets/components/locomotive_sources/jquery/src/traversing.js +199 -0
  311. data/vendor/assets/components/locomotive_sources/jquery/src/traversing/findFilter.js +100 -0
  312. data/vendor/assets/components/locomotive_sources/jquery/src/traversing/var/rneedsContext.js +6 -0
  313. data/vendor/assets/components/locomotive_sources/jquery/src/var/arr.js +3 -0
  314. data/vendor/assets/components/locomotive_sources/jquery/src/var/class2type.js +4 -0
  315. data/vendor/assets/components/locomotive_sources/jquery/src/var/concat.js +5 -0
  316. data/vendor/assets/components/locomotive_sources/jquery/src/var/hasOwn.js +5 -0
  317. data/vendor/assets/components/locomotive_sources/jquery/src/var/indexOf.js +5 -0
  318. data/vendor/assets/components/locomotive_sources/jquery/src/var/pnum.js +3 -0
  319. data/vendor/assets/components/locomotive_sources/jquery/src/var/push.js +5 -0
  320. data/vendor/assets/components/locomotive_sources/jquery/src/var/rnotwhite.js +3 -0
  321. data/vendor/assets/components/locomotive_sources/jquery/src/var/slice.js +5 -0
  322. data/vendor/assets/components/locomotive_sources/jquery/src/var/strundefined.js +3 -0
  323. data/vendor/assets/components/locomotive_sources/jquery/src/var/support.js +4 -0
  324. data/vendor/assets/components/locomotive_sources/jquery/src/var/toString.js +5 -0
  325. data/vendor/assets/components/locomotive_sources/jquery/src/wrap.js +79 -0
  326. data/vendor/assets/components/locomotive_sources/moment-timezone/LICENSE +20 -0
  327. data/vendor/assets/components/locomotive_sources/moment-timezone/README.md +36 -0
  328. data/vendor/assets/components/locomotive_sources/moment-timezone/bower.json +18 -0
  329. data/vendor/assets/components/locomotive_sources/moment-timezone/builds/moment-timezone-with-data-2010-2020.js +1189 -0
  330. data/vendor/assets/components/locomotive_sources/moment-timezone/builds/moment-timezone-with-data-2010-2020.min.js +7 -0
  331. data/vendor/assets/components/locomotive_sources/moment-timezone/builds/moment-timezone-with-data.js +1189 -0
  332. data/vendor/assets/components/locomotive_sources/moment-timezone/builds/moment-timezone-with-data.min.js +7 -0
  333. data/vendor/assets/components/locomotive_sources/moment-timezone/builds/moment-timezone.min.js +6 -0
  334. data/vendor/assets/components/locomotive_sources/moment-timezone/changelog.md +101 -0
  335. data/vendor/assets/components/locomotive_sources/moment-timezone/composer.json +43 -0
  336. data/vendor/assets/components/locomotive_sources/moment-timezone/data/meta/latest.json +5012 -0
  337. data/vendor/assets/components/locomotive_sources/moment-timezone/data/packed/latest.json +590 -0
  338. data/vendor/assets/components/locomotive_sources/moment-timezone/data/unpacked/latest.json +124081 -0
  339. data/vendor/assets/components/locomotive_sources/moment-timezone/moment-timezone-utils.js +316 -0
  340. data/vendor/assets/components/locomotive_sources/moment-timezone/moment-timezone.js +599 -0
  341. data/vendor/assets/components/locomotive_sources/moment/CHANGELOG.md +496 -0
  342. data/vendor/assets/components/locomotive_sources/moment/LICENSE +22 -0
  343. data/vendor/assets/components/locomotive_sources/moment/README.md +58 -0
  344. data/vendor/assets/components/locomotive_sources/moment/bower.json +22 -0
  345. data/vendor/assets/components/locomotive_sources/moment/locale/af.js +73 -0
  346. data/vendor/assets/components/locomotive_sources/moment/locale/ar-ma.js +59 -0
  347. data/vendor/assets/components/locomotive_sources/moment/locale/ar-sa.js +103 -0
  348. data/vendor/assets/components/locomotive_sources/moment/locale/ar-tn.js +57 -0
  349. data/vendor/assets/components/locomotive_sources/moment/locale/ar.js +136 -0
  350. data/vendor/assets/components/locomotive_sources/moment/locale/az.js +104 -0
  351. data/vendor/assets/components/locomotive_sources/moment/locale/be.js +134 -0
  352. data/vendor/assets/components/locomotive_sources/moment/locale/bg.js +90 -0
  353. data/vendor/assets/components/locomotive_sources/moment/locale/bn.js +113 -0
  354. data/vendor/assets/components/locomotive_sources/moment/locale/bo.js +110 -0
  355. data/vendor/assets/components/locomotive_sources/moment/locale/br.js +107 -0
  356. data/vendor/assets/components/locomotive_sources/moment/locale/bs.js +141 -0
  357. data/vendor/assets/components/locomotive_sources/moment/locale/ca.js +79 -0
  358. data/vendor/assets/components/locomotive_sources/moment/locale/cs.js +171 -0
  359. data/vendor/assets/components/locomotive_sources/moment/locale/cv.js +63 -0
  360. data/vendor/assets/components/locomotive_sources/moment/locale/cy.js +79 -0
  361. data/vendor/assets/components/locomotive_sources/moment/locale/da.js +60 -0
  362. data/vendor/assets/components/locomotive_sources/moment/locale/de-at.js +77 -0
  363. data/vendor/assets/components/locomotive_sources/moment/locale/de.js +76 -0
  364. data/vendor/assets/components/locomotive_sources/moment/locale/dv.js +99 -0
  365. data/vendor/assets/components/locomotive_sources/moment/locale/el.js +98 -0
  366. data/vendor/assets/components/locomotive_sources/moment/locale/en-au.js +66 -0
  367. data/vendor/assets/components/locomotive_sources/moment/locale/en-ca.js +63 -0
  368. data/vendor/assets/components/locomotive_sources/moment/locale/en-gb.js +67 -0
  369. data/vendor/assets/components/locomotive_sources/moment/locale/en-ie.js +67 -0
  370. data/vendor/assets/components/locomotive_sources/moment/locale/en-nz.js +66 -0
  371. data/vendor/assets/components/locomotive_sources/moment/locale/eo.js +73 -0
  372. data/vendor/assets/components/locomotive_sources/moment/locale/es.js +79 -0
  373. data/vendor/assets/components/locomotive_sources/moment/locale/et.js +80 -0
  374. data/vendor/assets/components/locomotive_sources/moment/locale/eu.js +64 -0
  375. data/vendor/assets/components/locomotive_sources/moment/locale/fa.js +105 -0
  376. data/vendor/assets/components/locomotive_sources/moment/locale/fi.js +107 -0
  377. data/vendor/assets/components/locomotive_sources/moment/locale/fo.js +60 -0
  378. data/vendor/assets/components/locomotive_sources/moment/locale/fr-ca.js +58 -0
  379. data/vendor/assets/components/locomotive_sources/moment/locale/fr-ch.js +62 -0
  380. data/vendor/assets/components/locomotive_sources/moment/locale/fr.js +62 -0
  381. data/vendor/assets/components/locomotive_sources/moment/locale/fy.js +71 -0
  382. data/vendor/assets/components/locomotive_sources/moment/locale/gd.js +76 -0
  383. data/vendor/assets/components/locomotive_sources/moment/locale/gl.js +75 -0
  384. data/vendor/assets/components/locomotive_sources/moment/locale/he.js +82 -0
  385. data/vendor/assets/components/locomotive_sources/moment/locale/hi.js +123 -0
  386. data/vendor/assets/components/locomotive_sources/moment/locale/hr.js +143 -0
  387. data/vendor/assets/components/locomotive_sources/moment/locale/hu.js +109 -0
  388. data/vendor/assets/components/locomotive_sources/moment/locale/hy-am.js +95 -0
  389. data/vendor/assets/components/locomotive_sources/moment/locale/id.js +83 -0
  390. data/vendor/assets/components/locomotive_sources/moment/locale/is.js +127 -0
  391. data/vendor/assets/components/locomotive_sources/moment/locale/it.js +70 -0
  392. data/vendor/assets/components/locomotive_sources/moment/locale/ja.js +65 -0
  393. data/vendor/assets/components/locomotive_sources/moment/locale/jv.js +83 -0
  394. data/vendor/assets/components/locomotive_sources/moment/locale/ka.js +89 -0
  395. data/vendor/assets/components/locomotive_sources/moment/locale/kk.js +87 -0
  396. data/vendor/assets/components/locomotive_sources/moment/locale/km.js +58 -0
  397. data/vendor/assets/components/locomotive_sources/moment/locale/ko.js +68 -0
  398. data/vendor/assets/components/locomotive_sources/moment/locale/lb.js +134 -0
  399. data/vendor/assets/components/locomotive_sources/moment/locale/lo.js +69 -0
  400. data/vendor/assets/components/locomotive_sources/moment/locale/lt.js +115 -0
  401. data/vendor/assets/components/locomotive_sources/moment/locale/lv.js +96 -0
  402. data/vendor/assets/components/locomotive_sources/moment/locale/me.js +109 -0
  403. data/vendor/assets/components/locomotive_sources/moment/locale/mk.js +90 -0
  404. data/vendor/assets/components/locomotive_sources/moment/locale/ml.js +71 -0
  405. data/vendor/assets/components/locomotive_sources/moment/locale/mr.js +158 -0
  406. data/vendor/assets/components/locomotive_sources/moment/locale/ms-my.js +82 -0
  407. data/vendor/assets/components/locomotive_sources/moment/locale/ms.js +82 -0
  408. data/vendor/assets/components/locomotive_sources/moment/locale/my.js +93 -0
  409. data/vendor/assets/components/locomotive_sources/moment/locale/nb.js +61 -0
  410. data/vendor/assets/components/locomotive_sources/moment/locale/ne.js +121 -0
  411. data/vendor/assets/components/locomotive_sources/moment/locale/nl.js +71 -0
  412. data/vendor/assets/components/locomotive_sources/moment/locale/nn.js +60 -0
  413. data/vendor/assets/components/locomotive_sources/moment/locale/pl.js +105 -0
  414. data/vendor/assets/components/locomotive_sources/moment/locale/pt-br.js +60 -0
  415. data/vendor/assets/components/locomotive_sources/moment/locale/pt.js +64 -0
  416. data/vendor/assets/components/locomotive_sources/moment/locale/ro.js +74 -0
  417. data/vendor/assets/components/locomotive_sources/moment/locale/ru.js +166 -0
  418. data/vendor/assets/components/locomotive_sources/moment/locale/se.js +61 -0
  419. data/vendor/assets/components/locomotive_sources/moment/locale/si.js +66 -0
  420. data/vendor/assets/components/locomotive_sources/moment/locale/sk.js +150 -0
  421. data/vendor/assets/components/locomotive_sources/moment/locale/sl.js +160 -0
  422. data/vendor/assets/components/locomotive_sources/moment/locale/sq.js +69 -0
  423. data/vendor/assets/components/locomotive_sources/moment/locale/sr-cyrl.js +108 -0
  424. data/vendor/assets/components/locomotive_sources/moment/locale/sr.js +108 -0
  425. data/vendor/assets/components/locomotive_sources/moment/locale/sv.js +67 -0
  426. data/vendor/assets/components/locomotive_sources/moment/locale/sw.js +58 -0
  427. data/vendor/assets/components/locomotive_sources/moment/locale/ta.js +129 -0
  428. data/vendor/assets/components/locomotive_sources/moment/locale/te.js +88 -0
  429. data/vendor/assets/components/locomotive_sources/moment/locale/th.js +65 -0
  430. data/vendor/assets/components/locomotive_sources/moment/locale/tl-ph.js +62 -0
  431. data/vendor/assets/components/locomotive_sources/moment/locale/tlh.js +119 -0
  432. data/vendor/assets/components/locomotive_sources/moment/locale/tr.js +90 -0
  433. data/vendor/assets/components/locomotive_sources/moment/locale/tzl.js +87 -0
  434. data/vendor/assets/components/locomotive_sources/moment/locale/tzm-latn.js +58 -0
  435. data/vendor/assets/components/locomotive_sources/moment/locale/tzm.js +58 -0
  436. data/vendor/assets/components/locomotive_sources/moment/locale/uk.js +146 -0
  437. data/vendor/assets/components/locomotive_sources/moment/locale/uz.js +58 -0
  438. data/vendor/assets/components/locomotive_sources/moment/locale/vi.js +66 -0
  439. data/vendor/assets/components/locomotive_sources/moment/locale/zh-cn.js +127 -0
  440. data/vendor/assets/components/locomotive_sources/moment/locale/zh-tw.js +101 -0
  441. data/vendor/assets/components/locomotive_sources/moment/min/locales.js +7548 -0
  442. data/vendor/assets/components/locomotive_sources/moment/min/locales.min.js +72 -0
  443. data/vendor/assets/components/locomotive_sources/moment/min/moment-with-locales.js +11144 -0
  444. data/vendor/assets/components/locomotive_sources/moment/min/moment-with-locales.min.js +74 -0
  445. data/vendor/assets/components/locomotive_sources/moment/min/moment.min.js +7 -0
  446. data/vendor/assets/components/locomotive_sources/moment/min/tests.js +46196 -0
  447. data/vendor/assets/components/locomotive_sources/moment/moment.js +3606 -0
  448. data/vendor/assets/components/locomotive_sources/moment/src/lib/create/check-overflow.js +34 -0
  449. data/vendor/assets/components/locomotive_sources/moment/src/lib/create/date-from-array.js +21 -0
  450. data/vendor/assets/components/locomotive_sources/moment/src/lib/create/from-anything.js +101 -0
  451. data/vendor/assets/components/locomotive_sources/moment/src/lib/create/from-array.js +136 -0
  452. data/vendor/assets/components/locomotive_sources/moment/src/lib/create/from-object.js +16 -0
  453. data/vendor/assets/components/locomotive_sources/moment/src/lib/create/from-string-and-array.js +50 -0
  454. data/vendor/assets/components/locomotive_sources/moment/src/lib/create/from-string-and-format.js +104 -0
  455. data/vendor/assets/components/locomotive_sources/moment/src/lib/create/from-string.js +120 -0
  456. data/vendor/assets/components/locomotive_sources/moment/src/lib/create/local.js +5 -0
  457. data/vendor/assets/components/locomotive_sources/moment/src/lib/create/parsing-flags.js +22 -0
  458. data/vendor/assets/components/locomotive_sources/moment/src/lib/create/utc.js +5 -0
  459. data/vendor/assets/components/locomotive_sources/moment/src/lib/create/valid.js +37 -0
  460. data/vendor/assets/components/locomotive_sources/moment/src/lib/duration/abs.js +18 -0
  461. data/vendor/assets/components/locomotive_sources/moment/src/lib/duration/add-subtract.js +21 -0
  462. data/vendor/assets/components/locomotive_sources/moment/src/lib/duration/as.js +55 -0
  463. data/vendor/assets/components/locomotive_sources/moment/src/lib/duration/bubble.js +61 -0
  464. data/vendor/assets/components/locomotive_sources/moment/src/lib/duration/constructor.js +41 -0
  465. data/vendor/assets/components/locomotive_sources/moment/src/lib/duration/create.js +117 -0
  466. data/vendor/assets/components/locomotive_sources/moment/src/lib/duration/duration.js +12 -0
  467. data/vendor/assets/components/locomotive_sources/moment/src/lib/duration/get.js +25 -0
  468. data/vendor/assets/components/locomotive_sources/moment/src/lib/duration/humanize.js +64 -0
  469. data/vendor/assets/components/locomotive_sources/moment/src/lib/duration/iso-string.js +52 -0
  470. data/vendor/assets/components/locomotive_sources/moment/src/lib/duration/prototype.js +48 -0
  471. data/vendor/assets/components/locomotive_sources/moment/src/lib/format/format.js +92 -0
  472. data/vendor/assets/components/locomotive_sources/moment/src/lib/locale/calendar.js +15 -0
  473. data/vendor/assets/components/locomotive_sources/moment/src/lib/locale/constructor.js +2 -0
  474. data/vendor/assets/components/locomotive_sources/moment/src/lib/locale/en.js +15 -0
  475. data/vendor/assets/components/locomotive_sources/moment/src/lib/locale/formats.js +23 -0
  476. data/vendor/assets/components/locomotive_sources/moment/src/lib/locale/invalid.js +5 -0
  477. data/vendor/assets/components/locomotive_sources/moment/src/lib/locale/lists.js +48 -0
  478. data/vendor/assets/components/locomotive_sources/moment/src/lib/locale/locale.js +35 -0
  479. data/vendor/assets/components/locomotive_sources/moment/src/lib/locale/locales.js +118 -0
  480. data/vendor/assets/components/locomotive_sources/moment/src/lib/locale/ordinal.js +7 -0
  481. data/vendor/assets/components/locomotive_sources/moment/src/lib/locale/pre-post-format.js +3 -0
  482. data/vendor/assets/components/locomotive_sources/moment/src/lib/locale/prototype.js +76 -0
  483. data/vendor/assets/components/locomotive_sources/moment/src/lib/locale/relative.js +29 -0
  484. data/vendor/assets/components/locomotive_sources/moment/src/lib/locale/set.js +16 -0
  485. data/vendor/assets/components/locomotive_sources/moment/src/lib/moment/add-subtract.js +52 -0
  486. data/vendor/assets/components/locomotive_sources/moment/src/lib/moment/calendar.js +21 -0
  487. data/vendor/assets/components/locomotive_sources/moment/src/lib/moment/clone.js +5 -0
  488. data/vendor/assets/components/locomotive_sources/moment/src/lib/moment/compare.js +57 -0
  489. data/vendor/assets/components/locomotive_sources/moment/src/lib/moment/constructor.js +74 -0
  490. data/vendor/assets/components/locomotive_sources/moment/src/lib/moment/creation-data.js +9 -0
  491. data/vendor/assets/components/locomotive_sources/moment/src/lib/moment/diff.js +61 -0
  492. data/vendor/assets/components/locomotive_sources/moment/src/lib/moment/format.js +28 -0
  493. data/vendor/assets/components/locomotive_sources/moment/src/lib/moment/from.js +17 -0
  494. data/vendor/assets/components/locomotive_sources/moment/src/lib/moment/get-set.js +43 -0
  495. data/vendor/assets/components/locomotive_sources/moment/src/lib/moment/locale.js +34 -0
  496. data/vendor/assets/components/locomotive_sources/moment/src/lib/moment/min-max.js +63 -0
  497. data/vendor/assets/components/locomotive_sources/moment/src/lib/moment/moment.js +28 -0
  498. data/vendor/assets/components/locomotive_sources/moment/src/lib/moment/now.js +3 -0
  499. data/vendor/assets/components/locomotive_sources/moment/src/lib/moment/prototype.js +149 -0
  500. data/vendor/assets/components/locomotive_sources/moment/src/lib/moment/start-end-of.js +52 -0
  501. data/vendor/assets/components/locomotive_sources/moment/src/lib/moment/to-type.js +34 -0
  502. data/vendor/assets/components/locomotive_sources/moment/src/lib/moment/to.js +17 -0
  503. data/vendor/assets/components/locomotive_sources/moment/src/lib/moment/valid.js +15 -0
  504. data/vendor/assets/components/locomotive_sources/moment/src/lib/parse/regex.js +54 -0
  505. data/vendor/assets/components/locomotive_sources/moment/src/lib/parse/token.js +32 -0
  506. data/vendor/assets/components/locomotive_sources/moment/src/lib/units/aliases.js +29 -0
  507. data/vendor/assets/components/locomotive_sources/moment/src/lib/units/constants.js +9 -0
  508. data/vendor/assets/components/locomotive_sources/moment/src/lib/units/day-of-month.js +32 -0
  509. data/vendor/assets/components/locomotive_sources/moment/src/lib/units/day-of-week.js +162 -0
  510. data/vendor/assets/components/locomotive_sources/moment/src/lib/units/day-of-year.js +32 -0
  511. data/vendor/assets/components/locomotive_sources/moment/src/lib/units/hour.js +129 -0
  512. data/vendor/assets/components/locomotive_sources/moment/src/lib/units/millisecond.js +64 -0
  513. data/vendor/assets/components/locomotive_sources/moment/src/lib/units/minute.js +24 -0
  514. data/vendor/assets/components/locomotive_sources/moment/src/lib/units/month.js +209 -0
  515. data/vendor/assets/components/locomotive_sources/moment/src/lib/units/offset.js +219 -0
  516. data/vendor/assets/components/locomotive_sources/moment/src/lib/units/quarter.js +27 -0
  517. data/vendor/assets/components/locomotive_sources/moment/src/lib/units/second.js +24 -0
  518. data/vendor/assets/components/locomotive_sources/moment/src/lib/units/timestamp.js +20 -0
  519. data/vendor/assets/components/locomotive_sources/moment/src/lib/units/timezone.js +16 -0
  520. data/vendor/assets/components/locomotive_sources/moment/src/lib/units/units.js +20 -0
  521. data/vendor/assets/components/locomotive_sources/moment/src/lib/units/week-calendar-utils.js +65 -0
  522. data/vendor/assets/components/locomotive_sources/moment/src/lib/units/week-year.js +101 -0
  523. data/vendor/assets/components/locomotive_sources/moment/src/lib/units/week.js +61 -0
  524. data/vendor/assets/components/locomotive_sources/moment/src/lib/units/year.js +70 -0
  525. data/vendor/assets/components/locomotive_sources/moment/src/lib/utils/abs-ceil.js +7 -0
  526. data/vendor/assets/components/locomotive_sources/moment/src/lib/utils/abs-floor.js +7 -0
  527. data/vendor/assets/components/locomotive_sources/moment/src/lib/utils/compare-arrays.js +16 -0
  528. data/vendor/assets/components/locomotive_sources/moment/src/lib/utils/defaults.js +10 -0
  529. data/vendor/assets/components/locomotive_sources/moment/src/lib/utils/deprecate.js +33 -0
  530. data/vendor/assets/components/locomotive_sources/moment/src/lib/utils/extend.js +19 -0
  531. data/vendor/assets/components/locomotive_sources/moment/src/lib/utils/has-own-prop.js +3 -0
  532. data/vendor/assets/components/locomotive_sources/moment/src/lib/utils/hooks.js +13 -0
  533. data/vendor/assets/components/locomotive_sources/moment/src/lib/utils/is-array.js +3 -0
  534. data/vendor/assets/components/locomotive_sources/moment/src/lib/utils/is-date.js +3 -0
  535. data/vendor/assets/components/locomotive_sources/moment/src/lib/utils/is-function.js +3 -0
  536. data/vendor/assets/components/locomotive_sources/moment/src/lib/utils/is-undefined.js +3 -0
  537. data/vendor/assets/components/locomotive_sources/moment/src/lib/utils/map.js +7 -0
  538. data/vendor/assets/components/locomotive_sources/moment/src/lib/utils/to-int.js +12 -0
  539. data/vendor/assets/components/locomotive_sources/moment/src/lib/utils/zero-fill.js +7 -0
  540. data/vendor/assets/components/locomotive_sources/moment/src/locale/af.js +63 -0
  541. data/vendor/assets/components/locomotive_sources/moment/src/locale/ar-ma.js +50 -0
  542. data/vendor/assets/components/locomotive_sources/moment/src/locale/ar-sa.js +94 -0
  543. data/vendor/assets/components/locomotive_sources/moment/src/locale/ar-tn.js +48 -0
  544. data/vendor/assets/components/locomotive_sources/moment/src/locale/ar.js +127 -0
  545. data/vendor/assets/components/locomotive_sources/moment/src/locale/az.js +95 -0
  546. data/vendor/assets/components/locomotive_sources/moment/src/locale/be.js +125 -0
  547. data/vendor/assets/components/locomotive_sources/moment/src/locale/bg.js +81 -0
  548. data/vendor/assets/components/locomotive_sources/moment/src/locale/bn.js +104 -0
  549. data/vendor/assets/components/locomotive_sources/moment/src/locale/bo.js +101 -0
  550. data/vendor/assets/components/locomotive_sources/moment/src/locale/br.js +98 -0
  551. data/vendor/assets/components/locomotive_sources/moment/src/locale/bs.js +132 -0
  552. data/vendor/assets/components/locomotive_sources/moment/src/locale/ca.js +70 -0
  553. data/vendor/assets/components/locomotive_sources/moment/src/locale/cs.js +162 -0
  554. data/vendor/assets/components/locomotive_sources/moment/src/locale/cv.js +53 -0
  555. data/vendor/assets/components/locomotive_sources/moment/src/locale/cy.js +70 -0
  556. data/vendor/assets/components/locomotive_sources/moment/src/locale/da.js +51 -0
  557. data/vendor/assets/components/locomotive_sources/moment/src/locale/de-at.js +67 -0
  558. data/vendor/assets/components/locomotive_sources/moment/src/locale/de.js +66 -0
  559. data/vendor/assets/components/locomotive_sources/moment/src/locale/dv.js +89 -0
  560. data/vendor/assets/components/locomotive_sources/moment/src/locale/el.js +86 -0
  561. data/vendor/assets/components/locomotive_sources/moment/src/locale/en-au.js +57 -0
  562. data/vendor/assets/components/locomotive_sources/moment/src/locale/en-ca.js +54 -0
  563. data/vendor/assets/components/locomotive_sources/moment/src/locale/en-gb.js +58 -0
  564. data/vendor/assets/components/locomotive_sources/moment/src/locale/en-ie.js +58 -0
  565. data/vendor/assets/components/locomotive_sources/moment/src/locale/en-nz.js +56 -0
  566. data/vendor/assets/components/locomotive_sources/moment/src/locale/eo.js +64 -0
  567. data/vendor/assets/components/locomotive_sources/moment/src/locale/es.js +70 -0
  568. data/vendor/assets/components/locomotive_sources/moment/src/locale/et.js +71 -0
  569. data/vendor/assets/components/locomotive_sources/moment/src/locale/eu.js +55 -0
  570. data/vendor/assets/components/locomotive_sources/moment/src/locale/fa.js +96 -0
  571. data/vendor/assets/components/locomotive_sources/moment/src/locale/fi.js +98 -0
  572. data/vendor/assets/components/locomotive_sources/moment/src/locale/fo.js +51 -0
  573. data/vendor/assets/components/locomotive_sources/moment/src/locale/fr-ca.js +49 -0
  574. data/vendor/assets/components/locomotive_sources/moment/src/locale/fr-ch.js +53 -0
  575. data/vendor/assets/components/locomotive_sources/moment/src/locale/fr.js +53 -0
  576. data/vendor/assets/components/locomotive_sources/moment/src/locale/fy.js +62 -0
  577. data/vendor/assets/components/locomotive_sources/moment/src/locale/gd.js +67 -0
  578. data/vendor/assets/components/locomotive_sources/moment/src/locale/gl.js +66 -0
  579. data/vendor/assets/components/locomotive_sources/moment/src/locale/he.js +73 -0
  580. data/vendor/assets/components/locomotive_sources/moment/src/locale/hi.js +114 -0
  581. data/vendor/assets/components/locomotive_sources/moment/src/locale/hr.js +134 -0
  582. data/vendor/assets/components/locomotive_sources/moment/src/locale/hu.js +100 -0
  583. data/vendor/assets/components/locomotive_sources/moment/src/locale/hy-am.js +86 -0
  584. data/vendor/assets/components/locomotive_sources/moment/src/locale/id.js +74 -0
  585. data/vendor/assets/components/locomotive_sources/moment/src/locale/is.js +118 -0
  586. data/vendor/assets/components/locomotive_sources/moment/src/locale/it.js +61 -0
  587. data/vendor/assets/components/locomotive_sources/moment/src/locale/ja.js +56 -0
  588. data/vendor/assets/components/locomotive_sources/moment/src/locale/jv.js +73 -0
  589. data/vendor/assets/components/locomotive_sources/moment/src/locale/ka.js +80 -0
  590. data/vendor/assets/components/locomotive_sources/moment/src/locale/kk.js +77 -0
  591. data/vendor/assets/components/locomotive_sources/moment/src/locale/km.js +49 -0
  592. data/vendor/assets/components/locomotive_sources/moment/src/locale/ko.js +59 -0
  593. data/vendor/assets/components/locomotive_sources/moment/src/locale/lb.js +125 -0
  594. data/vendor/assets/components/locomotive_sources/moment/src/locale/lo.js +60 -0
  595. data/vendor/assets/components/locomotive_sources/moment/src/locale/lt.js +106 -0
  596. data/vendor/assets/components/locomotive_sources/moment/src/locale/lv.js +87 -0
  597. data/vendor/assets/components/locomotive_sources/moment/src/locale/me.js +99 -0
  598. data/vendor/assets/components/locomotive_sources/moment/src/locale/mk.js +81 -0
  599. data/vendor/assets/components/locomotive_sources/moment/src/locale/ml.js +62 -0
  600. data/vendor/assets/components/locomotive_sources/moment/src/locale/mr.js +149 -0
  601. data/vendor/assets/components/locomotive_sources/moment/src/locale/ms-my.js +73 -0
  602. data/vendor/assets/components/locomotive_sources/moment/src/locale/ms.js +73 -0
  603. data/vendor/assets/components/locomotive_sources/moment/src/locale/my.js +84 -0
  604. data/vendor/assets/components/locomotive_sources/moment/src/locale/nb.js +52 -0
  605. data/vendor/assets/components/locomotive_sources/moment/src/locale/ne.js +112 -0
  606. data/vendor/assets/components/locomotive_sources/moment/src/locale/nl.js +62 -0
  607. data/vendor/assets/components/locomotive_sources/moment/src/locale/nn.js +51 -0
  608. data/vendor/assets/components/locomotive_sources/moment/src/locale/pl.js +95 -0
  609. data/vendor/assets/components/locomotive_sources/moment/src/locale/pt-br.js +51 -0
  610. data/vendor/assets/components/locomotive_sources/moment/src/locale/pt.js +55 -0
  611. data/vendor/assets/components/locomotive_sources/moment/src/locale/ro.js +65 -0
  612. data/vendor/assets/components/locomotive_sources/moment/src/locale/ru.js +156 -0
  613. data/vendor/assets/components/locomotive_sources/moment/src/locale/se.js +51 -0
  614. data/vendor/assets/components/locomotive_sources/moment/src/locale/si.js +56 -0
  615. data/vendor/assets/components/locomotive_sources/moment/src/locale/sk.js +141 -0
  616. data/vendor/assets/components/locomotive_sources/moment/src/locale/sl.js +150 -0
  617. data/vendor/assets/components/locomotive_sources/moment/src/locale/sq.js +60 -0
  618. data/vendor/assets/components/locomotive_sources/moment/src/locale/sr-cyrl.js +99 -0
  619. data/vendor/assets/components/locomotive_sources/moment/src/locale/sr.js +99 -0
  620. data/vendor/assets/components/locomotive_sources/moment/src/locale/sv.js +58 -0
  621. data/vendor/assets/components/locomotive_sources/moment/src/locale/sw.js +49 -0
  622. data/vendor/assets/components/locomotive_sources/moment/src/locale/ta.js +120 -0
  623. data/vendor/assets/components/locomotive_sources/moment/src/locale/te.js +78 -0
  624. data/vendor/assets/components/locomotive_sources/moment/src/locale/th.js +56 -0
  625. data/vendor/assets/components/locomotive_sources/moment/src/locale/tl-ph.js +53 -0
  626. data/vendor/assets/components/locomotive_sources/moment/src/locale/tlh.js +109 -0
  627. data/vendor/assets/components/locomotive_sources/moment/src/locale/tr.js +81 -0
  628. data/vendor/assets/components/locomotive_sources/moment/src/locale/tzl.js +78 -0
  629. data/vendor/assets/components/locomotive_sources/moment/src/locale/tzm-latn.js +49 -0
  630. data/vendor/assets/components/locomotive_sources/moment/src/locale/tzm.js +49 -0
  631. data/vendor/assets/components/locomotive_sources/moment/src/locale/uk.js +137 -0
  632. data/vendor/assets/components/locomotive_sources/moment/src/locale/uz.js +49 -0
  633. data/vendor/assets/components/locomotive_sources/moment/src/locale/vi.js +57 -0
  634. data/vendor/assets/components/locomotive_sources/moment/src/locale/zh-cn.js +118 -0
  635. data/vendor/assets/components/locomotive_sources/moment/src/locale/zh-tw.js +91 -0
  636. data/vendor/assets/components/locomotive_sources/moment/src/moment.js +71 -0
  637. data/vendor/assets/components/locomotive_sources/moment/templates/amd-named.js +7 -0
  638. data/vendor/assets/components/locomotive_sources/moment/templates/amd.js +7 -0
  639. data/vendor/assets/components/locomotive_sources/moment/templates/default.js +5 -0
  640. data/vendor/assets/components/locomotive_sources/moment/templates/globals.js +5 -0
  641. data/vendor/assets/components/locomotive_sources/moment/templates/locale-header.js +6 -0
  642. data/vendor/assets/components/locomotive_sources/moment/templates/test-header.js +6 -0
  643. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/Gemfile +3 -0
  644. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/Gruntfile.js +110 -0
  645. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/LICENSE +8 -0
  646. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/README.md +91 -0
  647. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/_jekyll/3.3.2.html +4 -0
  648. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/_jekyll/3.4.1.html +4 -0
  649. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/_jekyll/3.4.2.html +4 -0
  650. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/_jekyll/3.4.3.html +4 -0
  651. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/_jekyll/3.4.4.html +4 -0
  652. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/_jekyll/3.4.5.html +4 -0
  653. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/_jekyll/3.5.1.html +4 -0
  654. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/_jekyll/3.5.2.html +4 -0
  655. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/_jekyll/_config.yml +13 -0
  656. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/_jekyll/_includes/footer-links.html +9 -0
  657. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/_jekyll/_includes/footer.html +10 -0
  658. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/_jekyll/_includes/head.html +13 -0
  659. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/_jekyll/_includes/navbar.html +21 -0
  660. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/_jekyll/_includes/select2-select.html +55 -0
  661. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/_jekyll/_layouts/default.html +489 -0
  662. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/_jekyll/_layouts/minimal.html +7 -0
  663. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/_jekyll/_sass/_extends.sass +4 -0
  664. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/_jekyll/_sass/_mixins.sass +9 -0
  665. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/_jekyll/_sass/_select2-result-repository.sass +40 -0
  666. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/_jekyll/_sass/_variables.sass +1 -0
  667. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/_jekyll/css/bootstrap.min.css +5 -0
  668. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/_jekyll/css/gh-pages.sass +103 -0
  669. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/_jekyll/css/select2-bootstrap.css +495 -0
  670. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/_jekyll/favicon.ico +0 -0
  671. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/_jekyll/fonts/glyphicons-halflings-regular.eot +0 -0
  672. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/_jekyll/fonts/glyphicons-halflings-regular.svg +288 -0
  673. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/_jekyll/fonts/glyphicons-halflings-regular.ttf +0 -0
  674. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/_jekyll/fonts/glyphicons-halflings-regular.woff +0 -0
  675. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/_jekyll/fonts/glyphicons-halflings-regular.woff2 +0 -0
  676. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/_jekyll/index.html +77 -0
  677. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/_jekyll/js/bootstrap.min.js +7 -0
  678. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/_jekyll/js/respond.min.js +5 -0
  679. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/_jekyll/master.html +4 -0
  680. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/bower.json +20 -0
  681. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/compass/stylesheets/select2-bootstrap.scss +1 -0
  682. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/docs/3.3.2.html +1668 -0
  683. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/docs/3.4.1.html +1662 -0
  684. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/docs/3.4.2.html +1662 -0
  685. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/docs/3.4.3.html +1662 -0
  686. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/docs/3.4.4.html +1662 -0
  687. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/docs/3.4.5.html +1662 -0
  688. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/docs/3.5.1.html +1662 -0
  689. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/docs/3.5.2.html +1662 -0
  690. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/docs/css/bootstrap.min.css +5 -0
  691. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/docs/css/gh-pages.css +142 -0
  692. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/docs/css/select2-bootstrap.css +495 -0
  693. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/docs/favicon.ico +0 -0
  694. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/docs/fonts/glyphicons-halflings-regular.eot +0 -0
  695. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/docs/fonts/glyphicons-halflings-regular.svg +288 -0
  696. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/docs/fonts/glyphicons-halflings-regular.ttf +0 -0
  697. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/docs/fonts/glyphicons-halflings-regular.woff +0 -0
  698. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/docs/fonts/glyphicons-halflings-regular.woff2 +0 -0
  699. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/docs/index.html +293 -0
  700. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/docs/js/bootstrap.min.js +7 -0
  701. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/docs/js/respond.min.js +5 -0
  702. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/docs/master.html +1662 -0
  703. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/lib/build.less +3 -0
  704. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/lib/build.scss +3 -0
  705. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/lib/select2-bootstrap-css.rb +11 -0
  706. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/lib/select2-bootstrap.less +480 -0
  707. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/lib/select2-bootstrap.scss +480 -0
  708. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/lib/select2-bootstrap/version.rb +9 -0
  709. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/package.json +48 -0
  710. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/select2-bootstrap-css.gemspec +22 -0
  711. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/select2-bootstrap.css +495 -0
  712. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/select2-bootstrap.min.css +1 -0
  713. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/test/less_test.js +25 -0
  714. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/test/scss_test.js +25 -0
  715. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/test/support/less.patch +416 -0
  716. data/vendor/assets/components/locomotive_sources/select2-bootstrap-css/test/support/scss.patch +4 -0
  717. data/vendor/assets/components/locomotive_sources/select2/CONTRIBUTING.md +204 -0
  718. data/vendor/assets/components/locomotive_sources/select2/Gruntfile.js +370 -0
  719. data/vendor/assets/components/locomotive_sources/select2/LICENSE.md +21 -0
  720. data/vendor/assets/components/locomotive_sources/select2/README.md +105 -0
  721. data/vendor/assets/components/locomotive_sources/select2/bower.json +12 -0
  722. data/vendor/assets/components/locomotive_sources/select2/component.json +19 -0
  723. data/vendor/assets/components/locomotive_sources/select2/composer.json +25 -0
  724. data/vendor/assets/components/locomotive_sources/select2/dist/css/select2.css +482 -0
  725. data/vendor/assets/components/locomotive_sources/select2/dist/css/select2.min.css +1 -0
  726. data/vendor/assets/components/locomotive_sources/select2/dist/js/i18n/ar.js +3 -0
  727. data/vendor/assets/components/locomotive_sources/select2/dist/js/i18n/az.js +3 -0
  728. data/vendor/assets/components/locomotive_sources/select2/dist/js/i18n/bg.js +3 -0
  729. data/vendor/assets/components/locomotive_sources/select2/dist/js/i18n/ca.js +3 -0
  730. data/vendor/assets/components/locomotive_sources/select2/dist/js/i18n/cs.js +3 -0
  731. data/vendor/assets/components/locomotive_sources/select2/dist/js/i18n/da.js +3 -0
  732. data/vendor/assets/components/locomotive_sources/select2/dist/js/i18n/de.js +3 -0
  733. data/vendor/assets/components/locomotive_sources/select2/dist/js/i18n/en.js +3 -0
  734. data/vendor/assets/components/locomotive_sources/select2/dist/js/i18n/es.js +3 -0
  735. data/vendor/assets/components/locomotive_sources/select2/dist/js/i18n/et.js +3 -0
  736. data/vendor/assets/components/locomotive_sources/select2/dist/js/i18n/eu.js +3 -0
  737. data/vendor/assets/components/locomotive_sources/select2/dist/js/i18n/fa.js +3 -0
  738. data/vendor/assets/components/locomotive_sources/select2/dist/js/i18n/fi.js +3 -0
  739. data/vendor/assets/components/locomotive_sources/select2/dist/js/i18n/fr.js +3 -0
  740. data/vendor/assets/components/locomotive_sources/select2/dist/js/i18n/gl.js +3 -0
  741. data/vendor/assets/components/locomotive_sources/select2/dist/js/i18n/he.js +3 -0
  742. data/vendor/assets/components/locomotive_sources/select2/dist/js/i18n/hi.js +3 -0
  743. data/vendor/assets/components/locomotive_sources/select2/dist/js/i18n/hr.js +3 -0
  744. data/vendor/assets/components/locomotive_sources/select2/dist/js/i18n/hu.js +3 -0
  745. data/vendor/assets/components/locomotive_sources/select2/dist/js/i18n/id.js +3 -0
  746. data/vendor/assets/components/locomotive_sources/select2/dist/js/i18n/is.js +3 -0
  747. data/vendor/assets/components/locomotive_sources/select2/dist/js/i18n/it.js +3 -0
  748. data/vendor/assets/components/locomotive_sources/select2/dist/js/i18n/ja.js +3 -0
  749. data/vendor/assets/components/locomotive_sources/select2/dist/js/i18n/ko.js +3 -0
  750. data/vendor/assets/components/locomotive_sources/select2/dist/js/i18n/lt.js +3 -0
  751. data/vendor/assets/components/locomotive_sources/select2/dist/js/i18n/lv.js +3 -0
  752. data/vendor/assets/components/locomotive_sources/select2/dist/js/i18n/mk.js +3 -0
  753. data/vendor/assets/components/locomotive_sources/select2/dist/js/i18n/ms.js +3 -0
  754. data/vendor/assets/components/locomotive_sources/select2/dist/js/i18n/nb.js +3 -0
  755. data/vendor/assets/components/locomotive_sources/select2/dist/js/i18n/nl.js +3 -0
  756. data/vendor/assets/components/locomotive_sources/select2/dist/js/i18n/pl.js +3 -0
  757. data/vendor/assets/components/locomotive_sources/select2/dist/js/i18n/pt-BR.js +3 -0
  758. data/vendor/assets/components/locomotive_sources/select2/dist/js/i18n/pt.js +3 -0
  759. data/vendor/assets/components/locomotive_sources/select2/dist/js/i18n/ro.js +3 -0
  760. data/vendor/assets/components/locomotive_sources/select2/dist/js/i18n/ru.js +3 -0
  761. data/vendor/assets/components/locomotive_sources/select2/dist/js/i18n/sk.js +3 -0
  762. data/vendor/assets/components/locomotive_sources/select2/dist/js/i18n/sr-Cyrl.js +3 -0
  763. data/vendor/assets/components/locomotive_sources/select2/dist/js/i18n/sr.js +3 -0
  764. data/vendor/assets/components/locomotive_sources/select2/dist/js/i18n/sv.js +3 -0
  765. data/vendor/assets/components/locomotive_sources/select2/dist/js/i18n/th.js +3 -0
  766. data/vendor/assets/components/locomotive_sources/select2/dist/js/i18n/tr.js +3 -0
  767. data/vendor/assets/components/locomotive_sources/select2/dist/js/i18n/uk.js +3 -0
  768. data/vendor/assets/components/locomotive_sources/select2/dist/js/i18n/vi.js +3 -0
  769. data/vendor/assets/components/locomotive_sources/select2/dist/js/i18n/zh-CN.js +3 -0
  770. data/vendor/assets/components/locomotive_sources/select2/dist/js/i18n/zh-TW.js +3 -0
  771. data/vendor/assets/components/locomotive_sources/select2/dist/js/select2.full.js +6281 -0
  772. data/vendor/assets/components/locomotive_sources/select2/dist/js/select2.full.min.js +3 -0
  773. data/vendor/assets/components/locomotive_sources/select2/dist/js/select2.js +5571 -0
  774. data/vendor/assets/components/locomotive_sources/select2/dist/js/select2.min.js +2 -0
  775. data/vendor/assets/components/locomotive_sources/select2/docs/README.md +38 -0
  776. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/examples/basics.html +65 -0
  777. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/examples/data.html +128 -0
  778. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/examples/disabled-mode.html +43 -0
  779. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/examples/disabled-results.html +32 -0
  780. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/examples/hide-search.html +25 -0
  781. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/examples/localization-rtl-diacritics.html +90 -0
  782. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/examples/matcher.html +43 -0
  783. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/examples/multiple-max.html +28 -0
  784. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/examples/placeholders.html +37 -0
  785. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/examples/programmatic-control.html +156 -0
  786. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/examples/tags.html +33 -0
  787. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/examples/themes-templating-responsive-design.html +111 -0
  788. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/examples/tokenizer.html +36 -0
  789. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/footer.html +20 -0
  790. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/ga.html +9 -0
  791. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/head.html +19 -0
  792. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/js-source-states.html +62 -0
  793. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/nav/announcements-4.0.html +26 -0
  794. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/nav/examples.html +96 -0
  795. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/nav/options-old.html +55 -0
  796. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/nav/options.html +77 -0
  797. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/navigation.html +53 -0
  798. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/notice-previous.html +7 -0
  799. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/options-old/adapters.html +209 -0
  800. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/options-old/backwards-compatibility.html +200 -0
  801. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/options-old/core-options.html +790 -0
  802. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/options-old/dropdown.html +308 -0
  803. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/options-old/events.html +50 -0
  804. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/options-old/setting-default-options.html +37 -0
  805. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/options/compatibility.html +10 -0
  806. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/options/compatibility/initial-selection.html +50 -0
  807. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/options/compatibility/introduction.html +18 -0
  808. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/options/compatibility/matcher.html +50 -0
  809. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/options/compatibility/query-function.html +50 -0
  810. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/options/compatibility/text-input.html +32 -0
  811. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/options/core.html +9 -0
  812. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/options/core/amd-support.html +38 -0
  813. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/options/core/data-attributes.html +72 -0
  814. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/options/core/options.html +58 -0
  815. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/options/data.html +9 -0
  816. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/options/data/ajax.html +109 -0
  817. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/options/data/array.html +53 -0
  818. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/options/data/select.html +57 -0
  819. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/options/dropdown.html +9 -0
  820. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/options/dropdown/filtering.html +23 -0
  821. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/options/dropdown/placement.html +29 -0
  822. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/options/dropdown/selections.html +17 -0
  823. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/options/events.html +8 -0
  824. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/options/events/internal.html +9 -0
  825. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/options/events/jquery.html +29 -0
  826. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/options/introduction.html +9 -0
  827. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/options/not-written.html +3 -0
  828. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/options/selections.html +10 -0
  829. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/options/selections/clearing-selections.html +17 -0
  830. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/options/selections/multiple.html +17 -0
  831. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/options/selections/placeholder.html +53 -0
  832. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/options/selections/templating.html +23 -0
  833. data/vendor/assets/components/locomotive_sources/select2/docs/_includes/social-buttons.html +10 -0
  834. data/vendor/assets/components/locomotive_sources/select2/docs/_layouts/default.html +57 -0
  835. data/vendor/assets/components/locomotive_sources/select2/docs/_layouts/home.html +23 -0
  836. data/vendor/assets/components/locomotive_sources/select2/docs/_sass/_alert.scss +47 -0
  837. data/vendor/assets/components/locomotive_sources/select2/docs/_sass/_anchorjs.scss +27 -0
  838. data/vendor/assets/components/locomotive_sources/select2/docs/_sass/_buttons.scss +20 -0
  839. data/vendor/assets/components/locomotive_sources/select2/docs/_sass/_code.scss +16 -0
  840. data/vendor/assets/components/locomotive_sources/select2/docs/_sass/_examples.scss +90 -0
  841. data/vendor/assets/components/locomotive_sources/select2/docs/_sass/_featurette.scss +16 -0
  842. data/vendor/assets/components/locomotive_sources/select2/docs/_sass/_footer.scss +42 -0
  843. data/vendor/assets/components/locomotive_sources/select2/docs/_sass/_hamburger.scss +49 -0
  844. data/vendor/assets/components/locomotive_sources/select2/docs/_sass/_home.scss +31 -0
  845. data/vendor/assets/components/locomotive_sources/select2/docs/_sass/_jumbotron.scss +24 -0
  846. data/vendor/assets/components/locomotive_sources/select2/docs/_sass/_layout.scss +14 -0
  847. data/vendor/assets/components/locomotive_sources/select2/docs/_sass/_nav.scss +58 -0
  848. data/vendor/assets/components/locomotive_sources/select2/docs/_sass/_prettify.scss +51 -0
  849. data/vendor/assets/components/locomotive_sources/select2/docs/_sass/_result-repository.scss +62 -0
  850. data/vendor/assets/components/locomotive_sources/select2/docs/_sass/_sidenav.scss +152 -0
  851. data/vendor/assets/components/locomotive_sources/select2/docs/_sass/_social.scss +35 -0
  852. data/vendor/assets/components/locomotive_sources/select2/docs/_sass/_typography.scss +6 -0
  853. data/vendor/assets/components/locomotive_sources/select2/docs/announcements-4.0.html +752 -0
  854. data/vendor/assets/components/locomotive_sources/select2/docs/community.html +154 -0
  855. data/vendor/assets/components/locomotive_sources/select2/docs/css/s2-docs.scss +19 -0
  856. data/vendor/assets/components/locomotive_sources/select2/docs/examples.html +254 -0
  857. data/vendor/assets/components/locomotive_sources/select2/docs/images/logo.png +0 -0
  858. data/vendor/assets/components/locomotive_sources/select2/docs/index.html +238 -0
  859. data/vendor/assets/components/locomotive_sources/select2/docs/options-old.html +37 -0
  860. data/vendor/assets/components/locomotive_sources/select2/docs/options.html +37 -0
  861. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/css/bootstrap.min.css +5 -0
  862. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/css/font-awesome.min.css +4 -0
  863. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/fonts/FontAwesome.otf +0 -0
  864. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/fonts/fontawesome-webfont.eot +0 -0
  865. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/fonts/fontawesome-webfont.svg +655 -0
  866. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/fonts/fontawesome-webfont.ttf +0 -0
  867. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/fonts/fontawesome-webfont.woff +0 -0
  868. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/fonts/fontawesome-webfont.woff2 +0 -0
  869. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/ak.png +0 -0
  870. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/al.png +0 -0
  871. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/ar.png +0 -0
  872. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/az.png +0 -0
  873. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/ca.png +0 -0
  874. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/co.png +0 -0
  875. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/ct.png +0 -0
  876. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/de.png +0 -0
  877. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/fl.png +0 -0
  878. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/ga.png +0 -0
  879. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/hi.png +0 -0
  880. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/ia.png +0 -0
  881. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/id.png +0 -0
  882. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/il.png +0 -0
  883. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/in.png +0 -0
  884. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/ks.png +0 -0
  885. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/ky.png +0 -0
  886. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/la.png +0 -0
  887. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/ma.png +0 -0
  888. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/md.png +0 -0
  889. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/me.png +0 -0
  890. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/mi.png +0 -0
  891. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/mn.png +0 -0
  892. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/mo.png +0 -0
  893. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/ms.png +0 -0
  894. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/mt.png +0 -0
  895. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/nc.png +0 -0
  896. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/nd.png +0 -0
  897. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/ne.png +0 -0
  898. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/nh.png +0 -0
  899. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/nj.png +0 -0
  900. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/nm.png +0 -0
  901. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/nv.png +0 -0
  902. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/ny.png +0 -0
  903. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/oh.png +0 -0
  904. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/ok.png +0 -0
  905. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/or.png +0 -0
  906. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/pa.png +0 -0
  907. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/ri.png +0 -0
  908. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/sc.png +0 -0
  909. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/sd.png +0 -0
  910. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/tn.png +0 -0
  911. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/tx.png +0 -0
  912. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/ut.png +0 -0
  913. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/va.png +0 -0
  914. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/vt.png +0 -0
  915. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/wa.png +0 -0
  916. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/wi.png +0 -0
  917. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/wv.png +0 -0
  918. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/images/flags/wy.png +0 -0
  919. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/js/anchor.min.js +6 -0
  920. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/js/bootstrap.min.js +6 -0
  921. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/js/jquery.min.js +4 -0
  922. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/js/placeholders.jquery.min.js +2 -0
  923. data/vendor/assets/components/locomotive_sources/select2/docs/vendor/js/prettify.min.js +28 -0
  924. data/vendor/assets/components/locomotive_sources/select2/package.json +66 -0
  925. data/vendor/assets/components/locomotive_sources/select2/select2.jquery.json +32 -0
  926. data/vendor/assets/components/locomotive_sources/select2/src/js/banner.end.js +6 -0
  927. data/vendor/assets/components/locomotive_sources/select2/src/js/banner.start.js +6 -0
  928. data/vendor/assets/components/locomotive_sources/select2/src/js/jquery.mousewheel.shim.js +6 -0
  929. data/vendor/assets/components/locomotive_sources/select2/src/js/jquery.select2.js +58 -0
  930. data/vendor/assets/components/locomotive_sources/select2/src/js/jquery.shim.js +14 -0
  931. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/compat/containerCss.js +56 -0
  932. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/compat/dropdownCss.js +56 -0
  933. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/compat/initSelection.js +42 -0
  934. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/compat/inputData.js +127 -0
  935. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/compat/matcher.js +42 -0
  936. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/compat/query.js +26 -0
  937. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/compat/utils.js +43 -0
  938. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/core.js +545 -0
  939. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/data/ajax.js +101 -0
  940. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/data/array.js +79 -0
  941. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/data/base.js +40 -0
  942. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/data/maximumInputLength.js +31 -0
  943. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/data/maximumSelectionLength.js +31 -0
  944. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/data/minimumInputLength.js +30 -0
  945. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/data/select.js +285 -0
  946. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/data/tags.js +119 -0
  947. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/data/tokenizer.js +93 -0
  948. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/defaults.js +396 -0
  949. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/diacritics.js +847 -0
  950. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/dropdown.js +42 -0
  951. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/dropdown/attachBody.js +216 -0
  952. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/dropdown/attachContainer.js +18 -0
  953. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/dropdown/closeOnSelect.js +32 -0
  954. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/dropdown/hidePlaceholder.js +42 -0
  955. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/dropdown/infiniteScroll.js +89 -0
  956. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/dropdown/minimumResultsForSearch.js +39 -0
  957. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/dropdown/search.js +95 -0
  958. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/dropdown/selectOnClose.js +40 -0
  959. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/dropdown/stopPropagation.js +38 -0
  960. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/i18n/ar.js +36 -0
  961. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/i18n/az.js +27 -0
  962. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/i18n/bg.js +47 -0
  963. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/i18n/ca.js +52 -0
  964. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/i18n/cs.js +61 -0
  965. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/i18n/da.js +40 -0
  966. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/i18n/de.js +37 -0
  967. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/i18n/en.js +44 -0
  968. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/i18n/es.js +52 -0
  969. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/i18n/et.js +53 -0
  970. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/i18n/eu.js +51 -0
  971. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/i18n/fa.js +38 -0
  972. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/i18n/fi.js +27 -0
  973. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/i18n/fr.js +46 -0
  974. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/i18n/gl.js +51 -0
  975. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/i18n/he.js +56 -0
  976. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/i18n/hi.js +39 -0
  977. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/i18n/hr.js +44 -0
  978. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/i18n/hu.js +27 -0
  979. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/i18n/id.js +30 -0
  980. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/i18n/is.js +41 -0
  981. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/i18n/it.js +48 -0
  982. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/i18n/ja.js +36 -0
  983. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/i18n/ko.js +36 -0
  984. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/i18n/lt.js +51 -0
  985. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/i18n/lv.js +51 -0
  986. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/i18n/mk.js +47 -0
  987. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/i18n/ms.js +30 -0
  988. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/i18n/nb.js +35 -0
  989. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/i18n/nl.js +43 -0
  990. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/i18n/pl.js +45 -0
  991. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/i18n/pt-BR.js +46 -0
  992. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/i18n/pt.js +40 -0
  993. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/i18n/ro.js +48 -0
  994. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/i18n/ru.js +58 -0
  995. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/i18n/sk.js +56 -0
  996. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/i18n/sr-Cyrl.js +55 -0
  997. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/i18n/sr.js +55 -0
  998. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/i18n/sv.js +37 -0
  999. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/i18n/th.js +33 -0
  1000. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/i18n/tr.js +33 -0
  1001. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/i18n/uk.js +43 -0
  1002. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/i18n/vi.js +37 -0
  1003. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/i18n/zh-CN.js +36 -0
  1004. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/i18n/zh-TW.js +33 -0
  1005. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/keys.js +25 -0
  1006. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/options.js +122 -0
  1007. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/results.js +516 -0
  1008. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/selection/allowClear.js +97 -0
  1009. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/selection/base.js +158 -0
  1010. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/selection/clickMask.js +29 -0
  1011. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/selection/eventRelay.js +45 -0
  1012. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/selection/multiple.js +109 -0
  1013. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/selection/placeholder.js +49 -0
  1014. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/selection/search.js +222 -0
  1015. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/selection/single.js +93 -0
  1016. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/selection/stopPropagation.js +38 -0
  1017. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/translation.js +36 -0
  1018. data/vendor/assets/components/locomotive_sources/select2/src/js/select2/utils.js +262 -0
  1019. data/vendor/assets/components/locomotive_sources/select2/src/js/wrapper.end.js +12 -0
  1020. data/vendor/assets/components/locomotive_sources/select2/src/js/wrapper.start.js +23 -0
  1021. data/vendor/assets/components/locomotive_sources/select2/src/scss/_dropdown.scss +73 -0
  1022. data/vendor/assets/components/locomotive_sources/select2/src/scss/_multiple.scss +35 -0
  1023. data/vendor/assets/components/locomotive_sources/select2/src/scss/_single.scss +34 -0
  1024. data/vendor/assets/components/locomotive_sources/select2/src/scss/core.scss +48 -0
  1025. data/vendor/assets/components/locomotive_sources/select2/src/scss/mixins/_gradients.scss +13 -0
  1026. data/vendor/assets/components/locomotive_sources/select2/src/scss/theme/classic/_defaults.scss +34 -0
  1027. data/vendor/assets/components/locomotive_sources/select2/src/scss/theme/classic/_multiple.scss +93 -0
  1028. data/vendor/assets/components/locomotive_sources/select2/src/scss/theme/classic/_single.scss +124 -0
  1029. data/vendor/assets/components/locomotive_sources/select2/src/scss/theme/classic/layout.scss +64 -0
  1030. data/vendor/assets/components/locomotive_sources/select2/src/scss/theme/default/_multiple.scss +94 -0
  1031. data/vendor/assets/components/locomotive_sources/select2/src/scss/theme/default/_single.scss +83 -0
  1032. data/vendor/assets/components/locomotive_sources/select2/src/scss/theme/default/layout.scss +97 -0
  1033. data/vendor/assets/components/locomotive_sources/select2/tests/a11y/search-tests.js +51 -0
  1034. data/vendor/assets/components/locomotive_sources/select2/tests/a11y/selection-tests.js +154 -0
  1035. data/vendor/assets/components/locomotive_sources/select2/tests/data/array-tests.js +290 -0
  1036. data/vendor/assets/components/locomotive_sources/select2/tests/data/base-tests.js +29 -0
  1037. data/vendor/assets/components/locomotive_sources/select2/tests/data/inputData-tests.js +158 -0
  1038. data/vendor/assets/components/locomotive_sources/select2/tests/data/maximumInputLength-tests.js +138 -0
  1039. data/vendor/assets/components/locomotive_sources/select2/tests/data/maximumSelectionLength-tests.js +202 -0
  1040. data/vendor/assets/components/locomotive_sources/select2/tests/data/minimumInputLength-tests.js +138 -0
  1041. data/vendor/assets/components/locomotive_sources/select2/tests/data/select-tests.js +457 -0
  1042. data/vendor/assets/components/locomotive_sources/select2/tests/data/tags-tests.js +241 -0
  1043. data/vendor/assets/components/locomotive_sources/select2/tests/data/tokenizer-tests.js +171 -0
  1044. data/vendor/assets/components/locomotive_sources/select2/tests/dropdown/dropdownCss-tests.js +104 -0
  1045. data/vendor/assets/components/locomotive_sources/select2/tests/dropdown/selectOnClose-tests.js +137 -0
  1046. data/vendor/assets/components/locomotive_sources/select2/tests/dropdown/stopPropagation-tests.js +33 -0
  1047. data/vendor/assets/components/locomotive_sources/select2/tests/helpers.js +46 -0
  1048. data/vendor/assets/components/locomotive_sources/select2/tests/integration.html +19 -0
  1049. data/vendor/assets/components/locomotive_sources/select2/tests/integration/select2-methods.js +139 -0
  1050. data/vendor/assets/components/locomotive_sources/select2/tests/options/data-tests.js +44 -0
  1051. data/vendor/assets/components/locomotive_sources/select2/tests/options/deprecated-tests.js +250 -0
  1052. data/vendor/assets/components/locomotive_sources/select2/tests/options/translation-tests.js +28 -0
  1053. data/vendor/assets/components/locomotive_sources/select2/tests/options/width-tests.js +66 -0
  1054. data/vendor/assets/components/locomotive_sources/select2/tests/selection/allowClear-tests.js +218 -0
  1055. data/vendor/assets/components/locomotive_sources/select2/tests/selection/containerCss-tests.js +104 -0
  1056. data/vendor/assets/components/locomotive_sources/select2/tests/selection/multiple-tests.js +149 -0
  1057. data/vendor/assets/components/locomotive_sources/select2/tests/selection/placeholder-tests.js +74 -0
  1058. data/vendor/assets/components/locomotive_sources/select2/tests/selection/search-tests.js +139 -0
  1059. data/vendor/assets/components/locomotive_sources/select2/tests/selection/single-tests.js +117 -0
  1060. data/vendor/assets/components/locomotive_sources/select2/tests/selection/stopPropagation-tests.js +33 -0
  1061. data/vendor/assets/components/locomotive_sources/select2/tests/unit.html +91 -0
  1062. data/vendor/assets/components/locomotive_sources/select2/tests/utils/decorator-tests.js +189 -0
  1063. data/vendor/assets/components/locomotive_sources/select2/tests/utils/escapeMarkup-tests.js +36 -0
  1064. data/vendor/assets/components/locomotive_sources/select2/tests/vendor/jquery-1.7.2.js +9404 -0
  1065. data/vendor/assets/components/locomotive_sources/select2/tests/vendor/qunit-1.14.0.css +237 -0
  1066. data/vendor/assets/components/locomotive_sources/select2/tests/vendor/qunit-1.14.0.js +2288 -0
  1067. data/vendor/assets/components/locomotive_sources/select2/vendor/jquery-2.1.0.js +9111 -0
  1068. data/vendor/assets/components/locomotive_sources/underscore/LICENSE +23 -0
  1069. data/vendor/assets/components/locomotive_sources/underscore/README.md +22 -0
  1070. data/vendor/assets/components/locomotive_sources/underscore/bower.json +7 -0
  1071. data/vendor/assets/components/locomotive_sources/underscore/underscore-min.js +6 -0
  1072. data/vendor/assets/components/locomotive_sources/underscore/underscore-min.map +1 -0
  1073. data/vendor/assets/components/locomotive_sources/underscore/underscore.js +1548 -0
  1074. data/vendor/assets/javascripts/locomotive/datepicker_i18n.js.erb +1 -1
  1075. data/vendor/assets/javascripts/locomotive/wysihtml5/parser_rules/advanced.js +10 -1
  1076. metadata +1020 -6
@@ -55,7 +55,7 @@ describe Locomotive::Concerns::Site::Metafields do
55
55
  context 'wrong fields types' do
56
56
 
57
57
  let(:schema) { [{ 'label' => 'Social', 'fields' => [{ 'name' => 'facebook_id', 'type' => 'dummy' }] }] }
58
- it { is_expected.to eq(["The property '#/0/fields/0/type' value \"dummy\" did not match one of the following values: string, text, integer, float, file, image, boolean, select, color"]) }
58
+ it { is_expected.to eq(["The property '#/0/fields/0/type' value \"dummy\" did not match one of the following values: string, text, integer, float, image, boolean, select, color"]) }
59
59
 
60
60
  end
61
61
 
@@ -39,7 +39,7 @@ describe Locomotive::Steam::Middlewares::Cache do
39
39
 
40
40
  subject { middleware.send(:cache_key, steam_env) }
41
41
 
42
- it { expect(subject).to eq 'ea334bfeccd1c844730c298efd67257f' }
42
+ it { expect(subject).to eq '9267236b80f8ab7230ea20f9e69a07f6' }
43
43
 
44
44
  end
45
45
 
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2010-2015 Jeremy Ashkenas, DocumentCloud
2
+
3
+ Permission is hereby granted, free of charge, to any person
4
+ obtaining a copy of this software and associated documentation
5
+ files (the "Software"), to deal in the Software without
6
+ restriction, including without limitation the rights to use,
7
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the
9
+ Software is furnished to do so, subject to the following
10
+ conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,2 @@
1
+ (function(t){var e=typeof self=="object"&&self.self==self&&self||typeof global=="object"&&global.global==global&&global;if(typeof define==="function"&&define.amd){define(["underscore","jquery","exports"],function(i,r,n){e.Backbone=t(e,n,i,r)})}else if(typeof exports!=="undefined"){var i=require("underscore"),r;try{r=require("jquery")}catch(n){}t(e,exports,i,r)}else{e.Backbone=t(e,{},e._,e.jQuery||e.Zepto||e.ender||e.$)}})(function(t,e,i,r){var n=t.Backbone;var s=Array.prototype.slice;e.VERSION="1.2.3";e.$=r;e.noConflict=function(){t.Backbone=n;return this};e.emulateHTTP=false;e.emulateJSON=false;var a=function(t,e,r){switch(t){case 1:return function(){return i[e](this[r])};case 2:return function(t){return i[e](this[r],t)};case 3:return function(t,n){return i[e](this[r],h(t,this),n)};case 4:return function(t,n,s){return i[e](this[r],h(t,this),n,s)};default:return function(){var t=s.call(arguments);t.unshift(this[r]);return i[e].apply(i,t)}}};var o=function(t,e,r){i.each(e,function(e,n){if(i[n])t.prototype[n]=a(e,n,r)})};var h=function(t,e){if(i.isFunction(t))return t;if(i.isObject(t)&&!e._isModel(t))return u(t);if(i.isString(t))return function(e){return e.get(t)};return t};var u=function(t){var e=i.matches(t);return function(t){return e(t.attributes)}};var l=e.Events={};var c=/\s+/;var f=function(t,e,r,n,s){var a=0,o;if(r&&typeof r==="object"){if(n!==void 0&&"context"in s&&s.context===void 0)s.context=n;for(o=i.keys(r);a<o.length;a++){e=f(t,e,o[a],r[o[a]],s)}}else if(r&&c.test(r)){for(o=r.split(c);a<o.length;a++){e=t(e,o[a],n,s)}}else{e=t(e,r,n,s)}return e};l.on=function(t,e,i){return d(this,t,e,i)};var d=function(t,e,i,r,n){t._events=f(v,t._events||{},e,i,{context:r,ctx:t,listening:n});if(n){var s=t._listeners||(t._listeners={});s[n.id]=n}return t};l.listenTo=function(t,e,r){if(!t)return this;var n=t._listenId||(t._listenId=i.uniqueId("l"));var s=this._listeningTo||(this._listeningTo={});var a=s[n];if(!a){var o=this._listenId||(this._listenId=i.uniqueId("l"));a=s[n]={obj:t,objId:n,id:o,listeningTo:s,count:0}}d(t,e,r,this,a);return this};var v=function(t,e,i,r){if(i){var n=t[e]||(t[e]=[]);var s=r.context,a=r.ctx,o=r.listening;if(o)o.count++;n.push({callback:i,context:s,ctx:s||a,listening:o})}return t};l.off=function(t,e,i){if(!this._events)return this;this._events=f(g,this._events,t,e,{context:i,listeners:this._listeners});return this};l.stopListening=function(t,e,r){var n=this._listeningTo;if(!n)return this;var s=t?[t._listenId]:i.keys(n);for(var a=0;a<s.length;a++){var o=n[s[a]];if(!o)break;o.obj.off(e,r,this)}if(i.isEmpty(n))this._listeningTo=void 0;return this};var g=function(t,e,r,n){if(!t)return;var s=0,a;var o=n.context,h=n.listeners;if(!e&&!r&&!o){var u=i.keys(h);for(;s<u.length;s++){a=h[u[s]];delete h[a.id];delete a.listeningTo[a.objId]}return}var l=e?[e]:i.keys(t);for(;s<l.length;s++){e=l[s];var c=t[e];if(!c)break;var f=[];for(var d=0;d<c.length;d++){var v=c[d];if(r&&r!==v.callback&&r!==v.callback._callback||o&&o!==v.context){f.push(v)}else{a=v.listening;if(a&&--a.count===0){delete h[a.id];delete a.listeningTo[a.objId]}}}if(f.length){t[e]=f}else{delete t[e]}}if(i.size(t))return t};l.once=function(t,e,r){var n=f(p,{},t,e,i.bind(this.off,this));return this.on(n,void 0,r)};l.listenToOnce=function(t,e,r){var n=f(p,{},e,r,i.bind(this.stopListening,this,t));return this.listenTo(t,n)};var p=function(t,e,r,n){if(r){var s=t[e]=i.once(function(){n(e,s);r.apply(this,arguments)});s._callback=r}return t};l.trigger=function(t){if(!this._events)return this;var e=Math.max(0,arguments.length-1);var i=Array(e);for(var r=0;r<e;r++)i[r]=arguments[r+1];f(m,this._events,t,void 0,i);return this};var m=function(t,e,i,r){if(t){var n=t[e];var s=t.all;if(n&&s)s=s.slice();if(n)_(n,r);if(s)_(s,[e].concat(r))}return t};var _=function(t,e){var i,r=-1,n=t.length,s=e[0],a=e[1],o=e[2];switch(e.length){case 0:while(++r<n)(i=t[r]).callback.call(i.ctx);return;case 1:while(++r<n)(i=t[r]).callback.call(i.ctx,s);return;case 2:while(++r<n)(i=t[r]).callback.call(i.ctx,s,a);return;case 3:while(++r<n)(i=t[r]).callback.call(i.ctx,s,a,o);return;default:while(++r<n)(i=t[r]).callback.apply(i.ctx,e);return}};l.bind=l.on;l.unbind=l.off;i.extend(e,l);var y=e.Model=function(t,e){var r=t||{};e||(e={});this.cid=i.uniqueId(this.cidPrefix);this.attributes={};if(e.collection)this.collection=e.collection;if(e.parse)r=this.parse(r,e)||{};r=i.defaults({},r,i.result(this,"defaults"));this.set(r,e);this.changed={};this.initialize.apply(this,arguments)};i.extend(y.prototype,l,{changed:null,validationError:null,idAttribute:"id",cidPrefix:"c",initialize:function(){},toJSON:function(t){return i.clone(this.attributes)},sync:function(){return e.sync.apply(this,arguments)},get:function(t){return this.attributes[t]},escape:function(t){return i.escape(this.get(t))},has:function(t){return this.get(t)!=null},matches:function(t){return!!i.iteratee(t,this)(this.attributes)},set:function(t,e,r){if(t==null)return this;var n;if(typeof t==="object"){n=t;r=e}else{(n={})[t]=e}r||(r={});if(!this._validate(n,r))return false;var s=r.unset;var a=r.silent;var o=[];var h=this._changing;this._changing=true;if(!h){this._previousAttributes=i.clone(this.attributes);this.changed={}}var u=this.attributes;var l=this.changed;var c=this._previousAttributes;for(var f in n){e=n[f];if(!i.isEqual(u[f],e))o.push(f);if(!i.isEqual(c[f],e)){l[f]=e}else{delete l[f]}s?delete u[f]:u[f]=e}this.id=this.get(this.idAttribute);if(!a){if(o.length)this._pending=r;for(var d=0;d<o.length;d++){this.trigger("change:"+o[d],this,u[o[d]],r)}}if(h)return this;if(!a){while(this._pending){r=this._pending;this._pending=false;this.trigger("change",this,r)}}this._pending=false;this._changing=false;return this},unset:function(t,e){return this.set(t,void 0,i.extend({},e,{unset:true}))},clear:function(t){var e={};for(var r in this.attributes)e[r]=void 0;return this.set(e,i.extend({},t,{unset:true}))},hasChanged:function(t){if(t==null)return!i.isEmpty(this.changed);return i.has(this.changed,t)},changedAttributes:function(t){if(!t)return this.hasChanged()?i.clone(this.changed):false;var e=this._changing?this._previousAttributes:this.attributes;var r={};for(var n in t){var s=t[n];if(i.isEqual(e[n],s))continue;r[n]=s}return i.size(r)?r:false},previous:function(t){if(t==null||!this._previousAttributes)return null;return this._previousAttributes[t]},previousAttributes:function(){return i.clone(this._previousAttributes)},fetch:function(t){t=i.extend({parse:true},t);var e=this;var r=t.success;t.success=function(i){var n=t.parse?e.parse(i,t):i;if(!e.set(n,t))return false;if(r)r.call(t.context,e,i,t);e.trigger("sync",e,i,t)};z(this,t);return this.sync("read",this,t)},save:function(t,e,r){var n;if(t==null||typeof t==="object"){n=t;r=e}else{(n={})[t]=e}r=i.extend({validate:true,parse:true},r);var s=r.wait;if(n&&!s){if(!this.set(n,r))return false}else{if(!this._validate(n,r))return false}var a=this;var o=r.success;var h=this.attributes;r.success=function(t){a.attributes=h;var e=r.parse?a.parse(t,r):t;if(s)e=i.extend({},n,e);if(e&&!a.set(e,r))return false;if(o)o.call(r.context,a,t,r);a.trigger("sync",a,t,r)};z(this,r);if(n&&s)this.attributes=i.extend({},h,n);var u=this.isNew()?"create":r.patch?"patch":"update";if(u==="patch"&&!r.attrs)r.attrs=n;var l=this.sync(u,this,r);this.attributes=h;return l},destroy:function(t){t=t?i.clone(t):{};var e=this;var r=t.success;var n=t.wait;var s=function(){e.stopListening();e.trigger("destroy",e,e.collection,t)};t.success=function(i){if(n)s();if(r)r.call(t.context,e,i,t);if(!e.isNew())e.trigger("sync",e,i,t)};var a=false;if(this.isNew()){i.defer(t.success)}else{z(this,t);a=this.sync("delete",this,t)}if(!n)s();return a},url:function(){var t=i.result(this,"urlRoot")||i.result(this.collection,"url")||F();if(this.isNew())return t;var e=this.get(this.idAttribute);return t.replace(/[^\/]$/,"$&/")+encodeURIComponent(e)},parse:function(t,e){return t},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return!this.has(this.idAttribute)},isValid:function(t){return this._validate({},i.defaults({validate:true},t))},_validate:function(t,e){if(!e.validate||!this.validate)return true;t=i.extend({},this.attributes,t);var r=this.validationError=this.validate(t,e)||null;if(!r)return true;this.trigger("invalid",this,r,i.extend(e,{validationError:r}));return false}});var b={keys:1,values:1,pairs:1,invert:1,pick:0,omit:0,chain:1,isEmpty:1};o(y,b,"attributes");var x=e.Collection=function(t,e){e||(e={});if(e.model)this.model=e.model;if(e.comparator!==void 0)this.comparator=e.comparator;this._reset();this.initialize.apply(this,arguments);if(t)this.reset(t,i.extend({silent:true},e))};var w={add:true,remove:true,merge:true};var E={add:true,remove:false};var k=function(t,e,i){i=Math.min(Math.max(i,0),t.length);var r=Array(t.length-i);var n=e.length;for(var s=0;s<r.length;s++)r[s]=t[s+i];for(s=0;s<n;s++)t[s+i]=e[s];for(s=0;s<r.length;s++)t[s+n+i]=r[s]};i.extend(x.prototype,l,{model:y,initialize:function(){},toJSON:function(t){return this.map(function(e){return e.toJSON(t)})},sync:function(){return e.sync.apply(this,arguments)},add:function(t,e){return this.set(t,i.extend({merge:false},e,E))},remove:function(t,e){e=i.extend({},e);var r=!i.isArray(t);t=r?[t]:i.clone(t);var n=this._removeModels(t,e);if(!e.silent&&n)this.trigger("update",this,e);return r?n[0]:n},set:function(t,e){if(t==null)return;e=i.defaults({},e,w);if(e.parse&&!this._isModel(t))t=this.parse(t,e);var r=!i.isArray(t);t=r?[t]:t.slice();var n=e.at;if(n!=null)n=+n;if(n<0)n+=this.length+1;var s=[];var a=[];var o=[];var h={};var u=e.add;var l=e.merge;var c=e.remove;var f=false;var d=this.comparator&&n==null&&e.sort!==false;var v=i.isString(this.comparator)?this.comparator:null;var g;for(var p=0;p<t.length;p++){g=t[p];var m=this.get(g);if(m){if(l&&g!==m){var _=this._isModel(g)?g.attributes:g;if(e.parse)_=m.parse(_,e);m.set(_,e);if(d&&!f)f=m.hasChanged(v)}if(!h[m.cid]){h[m.cid]=true;s.push(m)}t[p]=m}else if(u){g=t[p]=this._prepareModel(g,e);if(g){a.push(g);this._addReference(g,e);h[g.cid]=true;s.push(g)}}}if(c){for(p=0;p<this.length;p++){g=this.models[p];if(!h[g.cid])o.push(g)}if(o.length)this._removeModels(o,e)}var y=false;var b=!d&&u&&c;if(s.length&&b){y=this.length!=s.length||i.some(this.models,function(t,e){return t!==s[e]});this.models.length=0;k(this.models,s,0);this.length=this.models.length}else if(a.length){if(d)f=true;k(this.models,a,n==null?this.length:n);this.length=this.models.length}if(f)this.sort({silent:true});if(!e.silent){for(p=0;p<a.length;p++){if(n!=null)e.index=n+p;g=a[p];g.trigger("add",g,this,e)}if(f||y)this.trigger("sort",this,e);if(a.length||o.length)this.trigger("update",this,e)}return r?t[0]:t},reset:function(t,e){e=e?i.clone(e):{};for(var r=0;r<this.models.length;r++){this._removeReference(this.models[r],e)}e.previousModels=this.models;this._reset();t=this.add(t,i.extend({silent:true},e));if(!e.silent)this.trigger("reset",this,e);return t},push:function(t,e){return this.add(t,i.extend({at:this.length},e))},pop:function(t){var e=this.at(this.length-1);return this.remove(e,t)},unshift:function(t,e){return this.add(t,i.extend({at:0},e))},shift:function(t){var e=this.at(0);return this.remove(e,t)},slice:function(){return s.apply(this.models,arguments)},get:function(t){if(t==null)return void 0;var e=this.modelId(this._isModel(t)?t.attributes:t);return this._byId[t]||this._byId[e]||this._byId[t.cid]},at:function(t){if(t<0)t+=this.length;return this.models[t]},where:function(t,e){return this[e?"find":"filter"](t)},findWhere:function(t){return this.where(t,true)},sort:function(t){var e=this.comparator;if(!e)throw new Error("Cannot sort a set without a comparator");t||(t={});var r=e.length;if(i.isFunction(e))e=i.bind(e,this);if(r===1||i.isString(e)){this.models=this.sortBy(e)}else{this.models.sort(e)}if(!t.silent)this.trigger("sort",this,t);return this},pluck:function(t){return i.invoke(this.models,"get",t)},fetch:function(t){t=i.extend({parse:true},t);var e=t.success;var r=this;t.success=function(i){var n=t.reset?"reset":"set";r[n](i,t);if(e)e.call(t.context,r,i,t);r.trigger("sync",r,i,t)};z(this,t);return this.sync("read",this,t)},create:function(t,e){e=e?i.clone(e):{};var r=e.wait;t=this._prepareModel(t,e);if(!t)return false;if(!r)this.add(t,e);var n=this;var s=e.success;e.success=function(t,e,i){if(r)n.add(t,i);if(s)s.call(i.context,t,e,i)};t.save(null,e);return t},parse:function(t,e){return t},clone:function(){return new this.constructor(this.models,{model:this.model,comparator:this.comparator})},modelId:function(t){return t[this.model.prototype.idAttribute||"id"]},_reset:function(){this.length=0;this.models=[];this._byId={}},_prepareModel:function(t,e){if(this._isModel(t)){if(!t.collection)t.collection=this;return t}e=e?i.clone(e):{};e.collection=this;var r=new this.model(t,e);if(!r.validationError)return r;this.trigger("invalid",this,r.validationError,e);return false},_removeModels:function(t,e){var i=[];for(var r=0;r<t.length;r++){var n=this.get(t[r]);if(!n)continue;var s=this.indexOf(n);this.models.splice(s,1);this.length--;if(!e.silent){e.index=s;n.trigger("remove",n,this,e)}i.push(n);this._removeReference(n,e)}return i.length?i:false},_isModel:function(t){return t instanceof y},_addReference:function(t,e){this._byId[t.cid]=t;var i=this.modelId(t.attributes);if(i!=null)this._byId[i]=t;t.on("all",this._onModelEvent,this)},_removeReference:function(t,e){delete this._byId[t.cid];var i=this.modelId(t.attributes);if(i!=null)delete this._byId[i];if(this===t.collection)delete t.collection;t.off("all",this._onModelEvent,this)},_onModelEvent:function(t,e,i,r){if((t==="add"||t==="remove")&&i!==this)return;if(t==="destroy")this.remove(e,r);if(t==="change"){var n=this.modelId(e.previousAttributes());var s=this.modelId(e.attributes);if(n!==s){if(n!=null)delete this._byId[n];if(s!=null)this._byId[s]=e}}this.trigger.apply(this,arguments)}});var S={forEach:3,each:3,map:3,collect:3,reduce:4,foldl:4,inject:4,reduceRight:4,foldr:4,find:3,detect:3,filter:3,select:3,reject:3,every:3,all:3,some:3,any:3,include:3,includes:3,contains:3,invoke:0,max:3,min:3,toArray:1,size:1,first:3,head:3,take:3,initial:3,rest:3,tail:3,drop:3,last:3,without:0,difference:0,indexOf:3,shuffle:1,lastIndexOf:3,isEmpty:1,chain:1,sample:3,partition:3,groupBy:3,countBy:3,sortBy:3,indexBy:3};o(x,S,"models");var I=e.View=function(t){this.cid=i.uniqueId("view");i.extend(this,i.pick(t,P));this._ensureElement();this.initialize.apply(this,arguments)};var T=/^(\S+)\s*(.*)$/;var P=["model","collection","el","id","attributes","className","tagName","events"];i.extend(I.prototype,l,{tagName:"div",$:function(t){return this.$el.find(t)},initialize:function(){},render:function(){return this},remove:function(){this._removeElement();this.stopListening();return this},_removeElement:function(){this.$el.remove()},setElement:function(t){this.undelegateEvents();this._setElement(t);this.delegateEvents();return this},_setElement:function(t){this.$el=t instanceof e.$?t:e.$(t);this.el=this.$el[0]},delegateEvents:function(t){t||(t=i.result(this,"events"));if(!t)return this;this.undelegateEvents();for(var e in t){var r=t[e];if(!i.isFunction(r))r=this[r];if(!r)continue;var n=e.match(T);this.delegate(n[1],n[2],i.bind(r,this))}return this},delegate:function(t,e,i){this.$el.on(t+".delegateEvents"+this.cid,e,i);return this},undelegateEvents:function(){if(this.$el)this.$el.off(".delegateEvents"+this.cid);return this},undelegate:function(t,e,i){this.$el.off(t+".delegateEvents"+this.cid,e,i);return this},_createElement:function(t){return document.createElement(t)},_ensureElement:function(){if(!this.el){var t=i.extend({},i.result(this,"attributes"));if(this.id)t.id=i.result(this,"id");if(this.className)t["class"]=i.result(this,"className");this.setElement(this._createElement(i.result(this,"tagName")));this._setAttributes(t)}else{this.setElement(i.result(this,"el"))}},_setAttributes:function(t){this.$el.attr(t)}});e.sync=function(t,r,n){var s=H[t];i.defaults(n||(n={}),{emulateHTTP:e.emulateHTTP,emulateJSON:e.emulateJSON});var a={type:s,dataType:"json"};if(!n.url){a.url=i.result(r,"url")||F()}if(n.data==null&&r&&(t==="create"||t==="update"||t==="patch")){a.contentType="application/json";a.data=JSON.stringify(n.attrs||r.toJSON(n))}if(n.emulateJSON){a.contentType="application/x-www-form-urlencoded";a.data=a.data?{model:a.data}:{}}if(n.emulateHTTP&&(s==="PUT"||s==="DELETE"||s==="PATCH")){a.type="POST";if(n.emulateJSON)a.data._method=s;var o=n.beforeSend;n.beforeSend=function(t){t.setRequestHeader("X-HTTP-Method-Override",s);if(o)return o.apply(this,arguments)}}if(a.type!=="GET"&&!n.emulateJSON){a.processData=false}var h=n.error;n.error=function(t,e,i){n.textStatus=e;n.errorThrown=i;if(h)h.call(n.context,t,e,i)};var u=n.xhr=e.ajax(i.extend(a,n));r.trigger("request",r,u,n);return u};var H={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};e.ajax=function(){return e.$.ajax.apply(e.$,arguments)};var $=e.Router=function(t){t||(t={});if(t.routes)this.routes=t.routes;this._bindRoutes();this.initialize.apply(this,arguments)};var A=/\((.*?)\)/g;var C=/(\(\?)?:\w+/g;var R=/\*\w+/g;var j=/[\-{}\[\]+?.,\\\^$|#\s]/g;i.extend($.prototype,l,{initialize:function(){},route:function(t,r,n){if(!i.isRegExp(t))t=this._routeToRegExp(t);if(i.isFunction(r)){n=r;r=""}if(!n)n=this[r];var s=this;e.history.route(t,function(i){var a=s._extractParameters(t,i);if(s.execute(n,a,r)!==false){s.trigger.apply(s,["route:"+r].concat(a));s.trigger("route",r,a);e.history.trigger("route",s,r,a)}});return this},execute:function(t,e,i){if(t)t.apply(this,e)},navigate:function(t,i){e.history.navigate(t,i);return this},_bindRoutes:function(){if(!this.routes)return;this.routes=i.result(this,"routes");var t,e=i.keys(this.routes);while((t=e.pop())!=null){this.route(t,this.routes[t])}},_routeToRegExp:function(t){t=t.replace(j,"\\$&").replace(A,"(?:$1)?").replace(C,function(t,e){return e?t:"([^/?]+)"}).replace(R,"([^?]*?)");return new RegExp("^"+t+"(?:\\?([\\s\\S]*))?$")},_extractParameters:function(t,e){var r=t.exec(e).slice(1);return i.map(r,function(t,e){if(e===r.length-1)return t||null;return t?decodeURIComponent(t):null})}});var M=e.History=function(){this.handlers=[];this.checkUrl=i.bind(this.checkUrl,this);if(typeof window!=="undefined"){this.location=window.location;this.history=window.history}};var N=/^[#\/]|\s+$/g;var O=/^\/+|\/+$/g;var U=/#.*$/;M.started=false;i.extend(M.prototype,l,{interval:50,atRoot:function(){var t=this.location.pathname.replace(/[^\/]$/,"$&/");return t===this.root&&!this.getSearch()},matchRoot:function(){var t=this.decodeFragment(this.location.pathname);var e=t.slice(0,this.root.length-1)+"/";return e===this.root},decodeFragment:function(t){return decodeURI(t.replace(/%25/g,"%2525"))},getSearch:function(){var t=this.location.href.replace(/#.*/,"").match(/\?.+/);return t?t[0]:""},getHash:function(t){var e=(t||this).location.href.match(/#(.*)$/);return e?e[1]:""},getPath:function(){var t=this.decodeFragment(this.location.pathname+this.getSearch()).slice(this.root.length-1);return t.charAt(0)==="/"?t.slice(1):t},getFragment:function(t){if(t==null){if(this._usePushState||!this._wantsHashChange){t=this.getPath()}else{t=this.getHash()}}return t.replace(N,"")},start:function(t){if(M.started)throw new Error("Backbone.history has already been started");M.started=true;this.options=i.extend({root:"/"},this.options,t);this.root=this.options.root;this._wantsHashChange=this.options.hashChange!==false;this._hasHashChange="onhashchange"in window&&(document.documentMode===void 0||document.documentMode>7);this._useHashChange=this._wantsHashChange&&this._hasHashChange;this._wantsPushState=!!this.options.pushState;this._hasPushState=!!(this.history&&this.history.pushState);this._usePushState=this._wantsPushState&&this._hasPushState;this.fragment=this.getFragment();this.root=("/"+this.root+"/").replace(O,"/");if(this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!this.atRoot()){var e=this.root.slice(0,-1)||"/";this.location.replace(e+"#"+this.getPath());return true}else if(this._hasPushState&&this.atRoot()){this.navigate(this.getHash(),{replace:true})}}if(!this._hasHashChange&&this._wantsHashChange&&!this._usePushState){this.iframe=document.createElement("iframe");this.iframe.src="javascript:0";this.iframe.style.display="none";this.iframe.tabIndex=-1;var r=document.body;var n=r.insertBefore(this.iframe,r.firstChild).contentWindow;n.document.open();n.document.close();n.location.hash="#"+this.fragment}var s=window.addEventListener||function(t,e){return attachEvent("on"+t,e)};if(this._usePushState){s("popstate",this.checkUrl,false)}else if(this._useHashChange&&!this.iframe){s("hashchange",this.checkUrl,false)}else if(this._wantsHashChange){this._checkUrlInterval=setInterval(this.checkUrl,this.interval)}if(!this.options.silent)return this.loadUrl()},stop:function(){var t=window.removeEventListener||function(t,e){return detachEvent("on"+t,e)};if(this._usePushState){t("popstate",this.checkUrl,false)}else if(this._useHashChange&&!this.iframe){t("hashchange",this.checkUrl,false)}if(this.iframe){document.body.removeChild(this.iframe);this.iframe=null}if(this._checkUrlInterval)clearInterval(this._checkUrlInterval);M.started=false},route:function(t,e){this.handlers.unshift({route:t,callback:e})},checkUrl:function(t){var e=this.getFragment();if(e===this.fragment&&this.iframe){e=this.getHash(this.iframe.contentWindow)}if(e===this.fragment)return false;if(this.iframe)this.navigate(e);this.loadUrl()},loadUrl:function(t){if(!this.matchRoot())return false;t=this.fragment=this.getFragment(t);return i.some(this.handlers,function(e){if(e.route.test(t)){e.callback(t);return true}})},navigate:function(t,e){if(!M.started)return false;if(!e||e===true)e={trigger:!!e};t=this.getFragment(t||"");var i=this.root;if(t===""||t.charAt(0)==="?"){i=i.slice(0,-1)||"/"}var r=i+t;t=this.decodeFragment(t.replace(U,""));if(this.fragment===t)return;this.fragment=t;if(this._usePushState){this.history[e.replace?"replaceState":"pushState"]({},document.title,r)}else if(this._wantsHashChange){this._updateHash(this.location,t,e.replace);if(this.iframe&&t!==this.getHash(this.iframe.contentWindow)){var n=this.iframe.contentWindow;if(!e.replace){n.document.open();n.document.close()}this._updateHash(n.location,t,e.replace)}}else{return this.location.assign(r)}if(e.trigger)return this.loadUrl(t)},_updateHash:function(t,e,i){if(i){var r=t.href.replace(/(javascript:|#).*$/,"");t.replace(r+"#"+e)}else{t.hash="#"+e}}});e.history=new M;var q=function(t,e){var r=this;var n;if(t&&i.has(t,"constructor")){n=t.constructor}else{n=function(){return r.apply(this,arguments)}}i.extend(n,r,e);var s=function(){this.constructor=n};s.prototype=r.prototype;n.prototype=new s;if(t)i.extend(n.prototype,t);n.__super__=r.prototype;return n};y.extend=x.extend=$.extend=I.extend=M.extend=q;var F=function(){throw new Error('A "url" property or function must be specified')};var z=function(t,e){var i=e.error;e.error=function(r){if(i)i.call(e.context,t,r,e);t.trigger("error",t,r,e)}};return e});
2
+ //# sourceMappingURL=backbone-min.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backbone-min.js","sources":["backbone.js"],"names":["factory","root","self","global","define","amd","_","$","exports","Backbone","require","e","jQuery","Zepto","ender","previousBackbone","slice","Array","prototype","VERSION","noConflict","this","emulateHTTP","emulateJSON","addMethod","length","method","attribute","value","iteratee","context","cb","defaultVal","args","call","arguments","unshift","apply","addUnderscoreMethods","Class","methods","each","instance","isFunction","isObject","_isModel","modelMatcher","isString","model","get","attrs","matcher","matches","attributes","Events","eventSplitter","eventsApi","events","name","callback","opts","i","names","keys","test","split","on","internalOn","obj","listening","_events","onApi","ctx","listeners","_listeners","id","listenTo","_listenId","uniqueId","listeningTo","_listeningTo","thisId","objId","count","options","handlers","push","off","offApi","stopListening","ids","isEmpty","remaining","j","handler","_callback","size","once","onceMap","bind","listenToOnce","map","offer","trigger","Math","max","triggerApi","objEvents","allEvents","all","triggerEvents","concat","ev","l","a1","a2","a3","unbind","extend","Model","cid","cidPrefix","collection","parse","defaults","result","set","changed","initialize","validationError","idAttribute","toJSON","clone","sync","attr","escape","has","key","val","_validate","unset","silent","changes","changing","_changing","_previousAttributes","current","prev","isEqual","_pending","clear","hasChanged","changedAttributes","diff","old","previous","previousAttributes","fetch","success","resp","serverAttrs","wrapError","save","validate","wait","isNew","patch","xhr","destroy","defer","url","base","urlError","replace","encodeURIComponent","constructor","isValid","error","modelMethods","values","pairs","invert","pick","omit","chain","Collection","models","comparator","_reset","reset","setOptions","add","remove","merge","addOptions","splice","array","insert","at","min","tail","singular","isArray","removed","_removeModels","toAdd","toRemove","modelMap","sort","sortable","sortAttr","existing","_prepareModel","_addReference","orderChanged","some","index","_removeReference","previousModels","pop","shift","modelId","_byId","where","first","findWhere","Error","sortBy","pluck","invoke","create","callbackOpts","indexOf","_onModelEvent","event","prevId","collectionMethods","forEach","collect","reduce","foldl","inject","reduceRight","foldr","find","detect","filter","select","reject","every","any","include","includes","contains","toArray","head","take","initial","rest","drop","last","without","difference","shuffle","lastIndexOf","sample","partition","groupBy","countBy","indexBy","View","viewOptions","_ensureElement","delegateEventSplitter","tagName","selector","$el","render","_removeElement","setElement","element","undelegateEvents","_setElement","delegateEvents","el","match","delegate","eventName","listener","undelegate","_createElement","document","createElement","className","_setAttributes","type","methodMap","params","dataType","data","contentType","JSON","stringify","_method","beforeSend","setRequestHeader","processData","textStatus","errorThrown","ajax","update","delete","read","Router","routes","_bindRoutes","optionalParam","namedParam","splatParam","escapeRegExp","route","isRegExp","_routeToRegExp","router","history","fragment","_extractParameters","execute","navigate","optional","RegExp","exec","param","decodeURIComponent","History","checkUrl","window","location","routeStripper","rootStripper","pathStripper","started","interval","atRoot","path","pathname","getSearch","matchRoot","decodeFragment","decodeURI","href","getHash","getPath","charAt","getFragment","_usePushState","_wantsHashChange","start","hashChange","_hasHashChange","documentMode","_useHashChange","_wantsPushState","pushState","_hasPushState","iframe","src","style","display","tabIndex","body","iWindow","insertBefore","firstChild","contentWindow","open","close","hash","addEventListener","attachEvent","_checkUrlInterval","setInterval","loadUrl","stop","removeEventListener","detachEvent","removeChild","clearInterval","title","_updateHash","assign","protoProps","staticProps","parent","child","Surrogate","__super__"],"mappings":"CAOC,SAASA,GAIR,GAAIC,SAAeC,OAAQ,UAAYA,KAAKA,MAAQ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pB7F,GAAQ6F,MAAQ,SAASlB,GACvB,GAAIkB,EAAOA,EAAM/I,KAAKkD,EAAQtD,QAASkB,EAAO+G,EAAM3E,EACpDpC,GAAMuD,QAAQ,QAASvD,EAAO+G,EAAM3E,IAIxC,OAAO3E"}
@@ -0,0 +1,1894 @@
1
+ // Backbone.js 1.2.3
2
+
3
+ // (c) 2010-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
4
+ // Backbone may be freely distributed under the MIT license.
5
+ // For all details and documentation:
6
+ // http://backbonejs.org
7
+
8
+ (function(factory) {
9
+
10
+ // Establish the root object, `window` (`self`) in the browser, or `global` on the server.
11
+ // We use `self` instead of `window` for `WebWorker` support.
12
+ var root = (typeof self == 'object' && self.self == self && self) ||
13
+ (typeof global == 'object' && global.global == global && global);
14
+
15
+ // Set up Backbone appropriately for the environment. Start with AMD.
16
+ if (typeof define === 'function' && define.amd) {
17
+ define(['underscore', 'jquery', 'exports'], function(_, $, exports) {
18
+ // Export global even in AMD case in case this script is loaded with
19
+ // others that may still expect a global Backbone.
20
+ root.Backbone = factory(root, exports, _, $);
21
+ });
22
+
23
+ // Next for Node.js or CommonJS. jQuery may not be needed as a module.
24
+ } else if (typeof exports !== 'undefined') {
25
+ var _ = require('underscore'), $;
26
+ try { $ = require('jquery'); } catch(e) {}
27
+ factory(root, exports, _, $);
28
+
29
+ // Finally, as a browser global.
30
+ } else {
31
+ root.Backbone = factory(root, {}, root._, (root.jQuery || root.Zepto || root.ender || root.$));
32
+ }
33
+
34
+ }(function(root, Backbone, _, $) {
35
+
36
+ // Initial Setup
37
+ // -------------
38
+
39
+ // Save the previous value of the `Backbone` variable, so that it can be
40
+ // restored later on, if `noConflict` is used.
41
+ var previousBackbone = root.Backbone;
42
+
43
+ // Create a local reference to a common array method we'll want to use later.
44
+ var slice = Array.prototype.slice;
45
+
46
+ // Current version of the library. Keep in sync with `package.json`.
47
+ Backbone.VERSION = '1.2.3';
48
+
49
+ // For Backbone's purposes, jQuery, Zepto, Ender, or My Library (kidding) owns
50
+ // the `$` variable.
51
+ Backbone.$ = $;
52
+
53
+ // Runs Backbone.js in *noConflict* mode, returning the `Backbone` variable
54
+ // to its previous owner. Returns a reference to this Backbone object.
55
+ Backbone.noConflict = function() {
56
+ root.Backbone = previousBackbone;
57
+ return this;
58
+ };
59
+
60
+ // Turn on `emulateHTTP` to support legacy HTTP servers. Setting this option
61
+ // will fake `"PATCH"`, `"PUT"` and `"DELETE"` requests via the `_method` parameter and
62
+ // set a `X-Http-Method-Override` header.
63
+ Backbone.emulateHTTP = false;
64
+
65
+ // Turn on `emulateJSON` to support legacy servers that can't deal with direct
66
+ // `application/json` requests ... this will encode the body as
67
+ // `application/x-www-form-urlencoded` instead and will send the model in a
68
+ // form param named `model`.
69
+ Backbone.emulateJSON = false;
70
+
71
+ // Proxy Backbone class methods to Underscore functions, wrapping the model's
72
+ // `attributes` object or collection's `models` array behind the scenes.
73
+ //
74
+ // collection.filter(function(model) { return model.get('age') > 10 });
75
+ // collection.each(this.addView);
76
+ //
77
+ // `Function#apply` can be slow so we use the method's arg count, if we know it.
78
+ var addMethod = function(length, method, attribute) {
79
+ switch (length) {
80
+ case 1: return function() {
81
+ return _[method](this[attribute]);
82
+ };
83
+ case 2: return function(value) {
84
+ return _[method](this[attribute], value);
85
+ };
86
+ case 3: return function(iteratee, context) {
87
+ return _[method](this[attribute], cb(iteratee, this), context);
88
+ };
89
+ case 4: return function(iteratee, defaultVal, context) {
90
+ return _[method](this[attribute], cb(iteratee, this), defaultVal, context);
91
+ };
92
+ default: return function() {
93
+ var args = slice.call(arguments);
94
+ args.unshift(this[attribute]);
95
+ return _[method].apply(_, args);
96
+ };
97
+ }
98
+ };
99
+ var addUnderscoreMethods = function(Class, methods, attribute) {
100
+ _.each(methods, function(length, method) {
101
+ if (_[method]) Class.prototype[method] = addMethod(length, method, attribute);
102
+ });
103
+ };
104
+
105
+ // Support `collection.sortBy('attr')` and `collection.findWhere({id: 1})`.
106
+ var cb = function(iteratee, instance) {
107
+ if (_.isFunction(iteratee)) return iteratee;
108
+ if (_.isObject(iteratee) && !instance._isModel(iteratee)) return modelMatcher(iteratee);
109
+ if (_.isString(iteratee)) return function(model) { return model.get(iteratee); };
110
+ return iteratee;
111
+ };
112
+ var modelMatcher = function(attrs) {
113
+ var matcher = _.matches(attrs);
114
+ return function(model) {
115
+ return matcher(model.attributes);
116
+ };
117
+ };
118
+
119
+ // Backbone.Events
120
+ // ---------------
121
+
122
+ // A module that can be mixed in to *any object* in order to provide it with
123
+ // a custom event channel. You may bind a callback to an event with `on` or
124
+ // remove with `off`; `trigger`-ing an event fires all callbacks in
125
+ // succession.
126
+ //
127
+ // var object = {};
128
+ // _.extend(object, Backbone.Events);
129
+ // object.on('expand', function(){ alert('expanded'); });
130
+ // object.trigger('expand');
131
+ //
132
+ var Events = Backbone.Events = {};
133
+
134
+ // Regular expression used to split event strings.
135
+ var eventSplitter = /\s+/;
136
+
137
+ // Iterates over the standard `event, callback` (as well as the fancy multiple
138
+ // space-separated events `"change blur", callback` and jQuery-style event
139
+ // maps `{event: callback}`).
140
+ var eventsApi = function(iteratee, events, name, callback, opts) {
141
+ var i = 0, names;
142
+ if (name && typeof name === 'object') {
143
+ // Handle event maps.
144
+ if (callback !== void 0 && 'context' in opts && opts.context === void 0) opts.context = callback;
145
+ for (names = _.keys(name); i < names.length ; i++) {
146
+ events = eventsApi(iteratee, events, names[i], name[names[i]], opts);
147
+ }
148
+ } else if (name && eventSplitter.test(name)) {
149
+ // Handle space separated event names by delegating them individually.
150
+ for (names = name.split(eventSplitter); i < names.length; i++) {
151
+ events = iteratee(events, names[i], callback, opts);
152
+ }
153
+ } else {
154
+ // Finally, standard events.
155
+ events = iteratee(events, name, callback, opts);
156
+ }
157
+ return events;
158
+ };
159
+
160
+ // Bind an event to a `callback` function. Passing `"all"` will bind
161
+ // the callback to all events fired.
162
+ Events.on = function(name, callback, context) {
163
+ return internalOn(this, name, callback, context);
164
+ };
165
+
166
+ // Guard the `listening` argument from the public API.
167
+ var internalOn = function(obj, name, callback, context, listening) {
168
+ obj._events = eventsApi(onApi, obj._events || {}, name, callback, {
169
+ context: context,
170
+ ctx: obj,
171
+ listening: listening
172
+ });
173
+
174
+ if (listening) {
175
+ var listeners = obj._listeners || (obj._listeners = {});
176
+ listeners[listening.id] = listening;
177
+ }
178
+
179
+ return obj;
180
+ };
181
+
182
+ // Inversion-of-control versions of `on`. Tell *this* object to listen to
183
+ // an event in another object... keeping track of what it's listening to
184
+ // for easier unbinding later.
185
+ Events.listenTo = function(obj, name, callback) {
186
+ if (!obj) return this;
187
+ var id = obj._listenId || (obj._listenId = _.uniqueId('l'));
188
+ var listeningTo = this._listeningTo || (this._listeningTo = {});
189
+ var listening = listeningTo[id];
190
+
191
+ // This object is not listening to any other events on `obj` yet.
192
+ // Setup the necessary references to track the listening callbacks.
193
+ if (!listening) {
194
+ var thisId = this._listenId || (this._listenId = _.uniqueId('l'));
195
+ listening = listeningTo[id] = {obj: obj, objId: id, id: thisId, listeningTo: listeningTo, count: 0};
196
+ }
197
+
198
+ // Bind callbacks on obj, and keep track of them on listening.
199
+ internalOn(obj, name, callback, this, listening);
200
+ return this;
201
+ };
202
+
203
+ // The reducing API that adds a callback to the `events` object.
204
+ var onApi = function(events, name, callback, options) {
205
+ if (callback) {
206
+ var handlers = events[name] || (events[name] = []);
207
+ var context = options.context, ctx = options.ctx, listening = options.listening;
208
+ if (listening) listening.count++;
209
+
210
+ handlers.push({ callback: callback, context: context, ctx: context || ctx, listening: listening });
211
+ }
212
+ return events;
213
+ };
214
+
215
+ // Remove one or many callbacks. If `context` is null, removes all
216
+ // callbacks with that function. If `callback` is null, removes all
217
+ // callbacks for the event. If `name` is null, removes all bound
218
+ // callbacks for all events.
219
+ Events.off = function(name, callback, context) {
220
+ if (!this._events) return this;
221
+ this._events = eventsApi(offApi, this._events, name, callback, {
222
+ context: context,
223
+ listeners: this._listeners
224
+ });
225
+ return this;
226
+ };
227
+
228
+ // Tell this object to stop listening to either specific events ... or
229
+ // to every object it's currently listening to.
230
+ Events.stopListening = function(obj, name, callback) {
231
+ var listeningTo = this._listeningTo;
232
+ if (!listeningTo) return this;
233
+
234
+ var ids = obj ? [obj._listenId] : _.keys(listeningTo);
235
+
236
+ for (var i = 0; i < ids.length; i++) {
237
+ var listening = listeningTo[ids[i]];
238
+
239
+ // If listening doesn't exist, this object is not currently
240
+ // listening to obj. Break out early.
241
+ if (!listening) break;
242
+
243
+ listening.obj.off(name, callback, this);
244
+ }
245
+ if (_.isEmpty(listeningTo)) this._listeningTo = void 0;
246
+
247
+ return this;
248
+ };
249
+
250
+ // The reducing API that removes a callback from the `events` object.
251
+ var offApi = function(events, name, callback, options) {
252
+ if (!events) return;
253
+
254
+ var i = 0, listening;
255
+ var context = options.context, listeners = options.listeners;
256
+
257
+ // Delete all events listeners and "drop" events.
258
+ if (!name && !callback && !context) {
259
+ var ids = _.keys(listeners);
260
+ for (; i < ids.length; i++) {
261
+ listening = listeners[ids[i]];
262
+ delete listeners[listening.id];
263
+ delete listening.listeningTo[listening.objId];
264
+ }
265
+ return;
266
+ }
267
+
268
+ var names = name ? [name] : _.keys(events);
269
+ for (; i < names.length; i++) {
270
+ name = names[i];
271
+ var handlers = events[name];
272
+
273
+ // Bail out if there are no events stored.
274
+ if (!handlers) break;
275
+
276
+ // Replace events if there are any remaining. Otherwise, clean up.
277
+ var remaining = [];
278
+ for (var j = 0; j < handlers.length; j++) {
279
+ var handler = handlers[j];
280
+ if (
281
+ callback && callback !== handler.callback &&
282
+ callback !== handler.callback._callback ||
283
+ context && context !== handler.context
284
+ ) {
285
+ remaining.push(handler);
286
+ } else {
287
+ listening = handler.listening;
288
+ if (listening && --listening.count === 0) {
289
+ delete listeners[listening.id];
290
+ delete listening.listeningTo[listening.objId];
291
+ }
292
+ }
293
+ }
294
+
295
+ // Update tail event if the list has any events. Otherwise, clean up.
296
+ if (remaining.length) {
297
+ events[name] = remaining;
298
+ } else {
299
+ delete events[name];
300
+ }
301
+ }
302
+ if (_.size(events)) return events;
303
+ };
304
+
305
+ // Bind an event to only be triggered a single time. After the first time
306
+ // the callback is invoked, its listener will be removed. If multiple events
307
+ // are passed in using the space-separated syntax, the handler will fire
308
+ // once for each event, not once for a combination of all events.
309
+ Events.once = function(name, callback, context) {
310
+ // Map the event into a `{event: once}` object.
311
+ var events = eventsApi(onceMap, {}, name, callback, _.bind(this.off, this));
312
+ return this.on(events, void 0, context);
313
+ };
314
+
315
+ // Inversion-of-control versions of `once`.
316
+ Events.listenToOnce = function(obj, name, callback) {
317
+ // Map the event into a `{event: once}` object.
318
+ var events = eventsApi(onceMap, {}, name, callback, _.bind(this.stopListening, this, obj));
319
+ return this.listenTo(obj, events);
320
+ };
321
+
322
+ // Reduces the event callbacks into a map of `{event: onceWrapper}`.
323
+ // `offer` unbinds the `onceWrapper` after it has been called.
324
+ var onceMap = function(map, name, callback, offer) {
325
+ if (callback) {
326
+ var once = map[name] = _.once(function() {
327
+ offer(name, once);
328
+ callback.apply(this, arguments);
329
+ });
330
+ once._callback = callback;
331
+ }
332
+ return map;
333
+ };
334
+
335
+ // Trigger one or many events, firing all bound callbacks. Callbacks are
336
+ // passed the same arguments as `trigger` is, apart from the event name
337
+ // (unless you're listening on `"all"`, which will cause your callback to
338
+ // receive the true name of the event as the first argument).
339
+ Events.trigger = function(name) {
340
+ if (!this._events) return this;
341
+
342
+ var length = Math.max(0, arguments.length - 1);
343
+ var args = Array(length);
344
+ for (var i = 0; i < length; i++) args[i] = arguments[i + 1];
345
+
346
+ eventsApi(triggerApi, this._events, name, void 0, args);
347
+ return this;
348
+ };
349
+
350
+ // Handles triggering the appropriate event callbacks.
351
+ var triggerApi = function(objEvents, name, cb, args) {
352
+ if (objEvents) {
353
+ var events = objEvents[name];
354
+ var allEvents = objEvents.all;
355
+ if (events && allEvents) allEvents = allEvents.slice();
356
+ if (events) triggerEvents(events, args);
357
+ if (allEvents) triggerEvents(allEvents, [name].concat(args));
358
+ }
359
+ return objEvents;
360
+ };
361
+
362
+ // A difficult-to-believe, but optimized internal dispatch function for
363
+ // triggering events. Tries to keep the usual cases speedy (most internal
364
+ // Backbone events have 3 arguments).
365
+ var triggerEvents = function(events, args) {
366
+ var ev, i = -1, l = events.length, a1 = args[0], a2 = args[1], a3 = args[2];
367
+ switch (args.length) {
368
+ case 0: while (++i < l) (ev = events[i]).callback.call(ev.ctx); return;
369
+ case 1: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1); return;
370
+ case 2: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1, a2); return;
371
+ case 3: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1, a2, a3); return;
372
+ default: while (++i < l) (ev = events[i]).callback.apply(ev.ctx, args); return;
373
+ }
374
+ };
375
+
376
+ // Aliases for backwards compatibility.
377
+ Events.bind = Events.on;
378
+ Events.unbind = Events.off;
379
+
380
+ // Allow the `Backbone` object to serve as a global event bus, for folks who
381
+ // want global "pubsub" in a convenient place.
382
+ _.extend(Backbone, Events);
383
+
384
+ // Backbone.Model
385
+ // --------------
386
+
387
+ // Backbone **Models** are the basic data object in the framework --
388
+ // frequently representing a row in a table in a database on your server.
389
+ // A discrete chunk of data and a bunch of useful, related methods for
390
+ // performing computations and transformations on that data.
391
+
392
+ // Create a new model with the specified attributes. A client id (`cid`)
393
+ // is automatically generated and assigned for you.
394
+ var Model = Backbone.Model = function(attributes, options) {
395
+ var attrs = attributes || {};
396
+ options || (options = {});
397
+ this.cid = _.uniqueId(this.cidPrefix);
398
+ this.attributes = {};
399
+ if (options.collection) this.collection = options.collection;
400
+ if (options.parse) attrs = this.parse(attrs, options) || {};
401
+ attrs = _.defaults({}, attrs, _.result(this, 'defaults'));
402
+ this.set(attrs, options);
403
+ this.changed = {};
404
+ this.initialize.apply(this, arguments);
405
+ };
406
+
407
+ // Attach all inheritable methods to the Model prototype.
408
+ _.extend(Model.prototype, Events, {
409
+
410
+ // A hash of attributes whose current and previous value differ.
411
+ changed: null,
412
+
413
+ // The value returned during the last failed validation.
414
+ validationError: null,
415
+
416
+ // The default name for the JSON `id` attribute is `"id"`. MongoDB and
417
+ // CouchDB users may want to set this to `"_id"`.
418
+ idAttribute: 'id',
419
+
420
+ // The prefix is used to create the client id which is used to identify models locally.
421
+ // You may want to override this if you're experiencing name clashes with model ids.
422
+ cidPrefix: 'c',
423
+
424
+ // Initialize is an empty function by default. Override it with your own
425
+ // initialization logic.
426
+ initialize: function(){},
427
+
428
+ // Return a copy of the model's `attributes` object.
429
+ toJSON: function(options) {
430
+ return _.clone(this.attributes);
431
+ },
432
+
433
+ // Proxy `Backbone.sync` by default -- but override this if you need
434
+ // custom syncing semantics for *this* particular model.
435
+ sync: function() {
436
+ return Backbone.sync.apply(this, arguments);
437
+ },
438
+
439
+ // Get the value of an attribute.
440
+ get: function(attr) {
441
+ return this.attributes[attr];
442
+ },
443
+
444
+ // Get the HTML-escaped value of an attribute.
445
+ escape: function(attr) {
446
+ return _.escape(this.get(attr));
447
+ },
448
+
449
+ // Returns `true` if the attribute contains a value that is not null
450
+ // or undefined.
451
+ has: function(attr) {
452
+ return this.get(attr) != null;
453
+ },
454
+
455
+ // Special-cased proxy to underscore's `_.matches` method.
456
+ matches: function(attrs) {
457
+ return !!_.iteratee(attrs, this)(this.attributes);
458
+ },
459
+
460
+ // Set a hash of model attributes on the object, firing `"change"`. This is
461
+ // the core primitive operation of a model, updating the data and notifying
462
+ // anyone who needs to know about the change in state. The heart of the beast.
463
+ set: function(key, val, options) {
464
+ if (key == null) return this;
465
+
466
+ // Handle both `"key", value` and `{key: value}` -style arguments.
467
+ var attrs;
468
+ if (typeof key === 'object') {
469
+ attrs = key;
470
+ options = val;
471
+ } else {
472
+ (attrs = {})[key] = val;
473
+ }
474
+
475
+ options || (options = {});
476
+
477
+ // Run validation.
478
+ if (!this._validate(attrs, options)) return false;
479
+
480
+ // Extract attributes and options.
481
+ var unset = options.unset;
482
+ var silent = options.silent;
483
+ var changes = [];
484
+ var changing = this._changing;
485
+ this._changing = true;
486
+
487
+ if (!changing) {
488
+ this._previousAttributes = _.clone(this.attributes);
489
+ this.changed = {};
490
+ }
491
+
492
+ var current = this.attributes;
493
+ var changed = this.changed;
494
+ var prev = this._previousAttributes;
495
+
496
+ // For each `set` attribute, update or delete the current value.
497
+ for (var attr in attrs) {
498
+ val = attrs[attr];
499
+ if (!_.isEqual(current[attr], val)) changes.push(attr);
500
+ if (!_.isEqual(prev[attr], val)) {
501
+ changed[attr] = val;
502
+ } else {
503
+ delete changed[attr];
504
+ }
505
+ unset ? delete current[attr] : current[attr] = val;
506
+ }
507
+
508
+ // Update the `id`.
509
+ this.id = this.get(this.idAttribute);
510
+
511
+ // Trigger all relevant attribute changes.
512
+ if (!silent) {
513
+ if (changes.length) this._pending = options;
514
+ for (var i = 0; i < changes.length; i++) {
515
+ this.trigger('change:' + changes[i], this, current[changes[i]], options);
516
+ }
517
+ }
518
+
519
+ // You might be wondering why there's a `while` loop here. Changes can
520
+ // be recursively nested within `"change"` events.
521
+ if (changing) return this;
522
+ if (!silent) {
523
+ while (this._pending) {
524
+ options = this._pending;
525
+ this._pending = false;
526
+ this.trigger('change', this, options);
527
+ }
528
+ }
529
+ this._pending = false;
530
+ this._changing = false;
531
+ return this;
532
+ },
533
+
534
+ // Remove an attribute from the model, firing `"change"`. `unset` is a noop
535
+ // if the attribute doesn't exist.
536
+ unset: function(attr, options) {
537
+ return this.set(attr, void 0, _.extend({}, options, {unset: true}));
538
+ },
539
+
540
+ // Clear all attributes on the model, firing `"change"`.
541
+ clear: function(options) {
542
+ var attrs = {};
543
+ for (var key in this.attributes) attrs[key] = void 0;
544
+ return this.set(attrs, _.extend({}, options, {unset: true}));
545
+ },
546
+
547
+ // Determine if the model has changed since the last `"change"` event.
548
+ // If you specify an attribute name, determine if that attribute has changed.
549
+ hasChanged: function(attr) {
550
+ if (attr == null) return !_.isEmpty(this.changed);
551
+ return _.has(this.changed, attr);
552
+ },
553
+
554
+ // Return an object containing all the attributes that have changed, or
555
+ // false if there are no changed attributes. Useful for determining what
556
+ // parts of a view need to be updated and/or what attributes need to be
557
+ // persisted to the server. Unset attributes will be set to undefined.
558
+ // You can also pass an attributes object to diff against the model,
559
+ // determining if there *would be* a change.
560
+ changedAttributes: function(diff) {
561
+ if (!diff) return this.hasChanged() ? _.clone(this.changed) : false;
562
+ var old = this._changing ? this._previousAttributes : this.attributes;
563
+ var changed = {};
564
+ for (var attr in diff) {
565
+ var val = diff[attr];
566
+ if (_.isEqual(old[attr], val)) continue;
567
+ changed[attr] = val;
568
+ }
569
+ return _.size(changed) ? changed : false;
570
+ },
571
+
572
+ // Get the previous value of an attribute, recorded at the time the last
573
+ // `"change"` event was fired.
574
+ previous: function(attr) {
575
+ if (attr == null || !this._previousAttributes) return null;
576
+ return this._previousAttributes[attr];
577
+ },
578
+
579
+ // Get all of the attributes of the model at the time of the previous
580
+ // `"change"` event.
581
+ previousAttributes: function() {
582
+ return _.clone(this._previousAttributes);
583
+ },
584
+
585
+ // Fetch the model from the server, merging the response with the model's
586
+ // local attributes. Any changed attributes will trigger a "change" event.
587
+ fetch: function(options) {
588
+ options = _.extend({parse: true}, options);
589
+ var model = this;
590
+ var success = options.success;
591
+ options.success = function(resp) {
592
+ var serverAttrs = options.parse ? model.parse(resp, options) : resp;
593
+ if (!model.set(serverAttrs, options)) return false;
594
+ if (success) success.call(options.context, model, resp, options);
595
+ model.trigger('sync', model, resp, options);
596
+ };
597
+ wrapError(this, options);
598
+ return this.sync('read', this, options);
599
+ },
600
+
601
+ // Set a hash of model attributes, and sync the model to the server.
602
+ // If the server returns an attributes hash that differs, the model's
603
+ // state will be `set` again.
604
+ save: function(key, val, options) {
605
+ // Handle both `"key", value` and `{key: value}` -style arguments.
606
+ var attrs;
607
+ if (key == null || typeof key === 'object') {
608
+ attrs = key;
609
+ options = val;
610
+ } else {
611
+ (attrs = {})[key] = val;
612
+ }
613
+
614
+ options = _.extend({validate: true, parse: true}, options);
615
+ var wait = options.wait;
616
+
617
+ // If we're not waiting and attributes exist, save acts as
618
+ // `set(attr).save(null, opts)` with validation. Otherwise, check if
619
+ // the model will be valid when the attributes, if any, are set.
620
+ if (attrs && !wait) {
621
+ if (!this.set(attrs, options)) return false;
622
+ } else {
623
+ if (!this._validate(attrs, options)) return false;
624
+ }
625
+
626
+ // After a successful server-side save, the client is (optionally)
627
+ // updated with the server-side state.
628
+ var model = this;
629
+ var success = options.success;
630
+ var attributes = this.attributes;
631
+ options.success = function(resp) {
632
+ // Ensure attributes are restored during synchronous saves.
633
+ model.attributes = attributes;
634
+ var serverAttrs = options.parse ? model.parse(resp, options) : resp;
635
+ if (wait) serverAttrs = _.extend({}, attrs, serverAttrs);
636
+ if (serverAttrs && !model.set(serverAttrs, options)) return false;
637
+ if (success) success.call(options.context, model, resp, options);
638
+ model.trigger('sync', model, resp, options);
639
+ };
640
+ wrapError(this, options);
641
+
642
+ // Set temporary attributes if `{wait: true}` to properly find new ids.
643
+ if (attrs && wait) this.attributes = _.extend({}, attributes, attrs);
644
+
645
+ var method = this.isNew() ? 'create' : (options.patch ? 'patch' : 'update');
646
+ if (method === 'patch' && !options.attrs) options.attrs = attrs;
647
+ var xhr = this.sync(method, this, options);
648
+
649
+ // Restore attributes.
650
+ this.attributes = attributes;
651
+
652
+ return xhr;
653
+ },
654
+
655
+ // Destroy this model on the server if it was already persisted.
656
+ // Optimistically removes the model from its collection, if it has one.
657
+ // If `wait: true` is passed, waits for the server to respond before removal.
658
+ destroy: function(options) {
659
+ options = options ? _.clone(options) : {};
660
+ var model = this;
661
+ var success = options.success;
662
+ var wait = options.wait;
663
+
664
+ var destroy = function() {
665
+ model.stopListening();
666
+ model.trigger('destroy', model, model.collection, options);
667
+ };
668
+
669
+ options.success = function(resp) {
670
+ if (wait) destroy();
671
+ if (success) success.call(options.context, model, resp, options);
672
+ if (!model.isNew()) model.trigger('sync', model, resp, options);
673
+ };
674
+
675
+ var xhr = false;
676
+ if (this.isNew()) {
677
+ _.defer(options.success);
678
+ } else {
679
+ wrapError(this, options);
680
+ xhr = this.sync('delete', this, options);
681
+ }
682
+ if (!wait) destroy();
683
+ return xhr;
684
+ },
685
+
686
+ // Default URL for the model's representation on the server -- if you're
687
+ // using Backbone's restful methods, override this to change the endpoint
688
+ // that will be called.
689
+ url: function() {
690
+ var base =
691
+ _.result(this, 'urlRoot') ||
692
+ _.result(this.collection, 'url') ||
693
+ urlError();
694
+ if (this.isNew()) return base;
695
+ var id = this.get(this.idAttribute);
696
+ return base.replace(/[^\/]$/, '$&/') + encodeURIComponent(id);
697
+ },
698
+
699
+ // **parse** converts a response into the hash of attributes to be `set` on
700
+ // the model. The default implementation is just to pass the response along.
701
+ parse: function(resp, options) {
702
+ return resp;
703
+ },
704
+
705
+ // Create a new model with identical attributes to this one.
706
+ clone: function() {
707
+ return new this.constructor(this.attributes);
708
+ },
709
+
710
+ // A model is new if it has never been saved to the server, and lacks an id.
711
+ isNew: function() {
712
+ return !this.has(this.idAttribute);
713
+ },
714
+
715
+ // Check if the model is currently in a valid state.
716
+ isValid: function(options) {
717
+ return this._validate({}, _.defaults({validate: true}, options));
718
+ },
719
+
720
+ // Run validation against the next complete set of model attributes,
721
+ // returning `true` if all is well. Otherwise, fire an `"invalid"` event.
722
+ _validate: function(attrs, options) {
723
+ if (!options.validate || !this.validate) return true;
724
+ attrs = _.extend({}, this.attributes, attrs);
725
+ var error = this.validationError = this.validate(attrs, options) || null;
726
+ if (!error) return true;
727
+ this.trigger('invalid', this, error, _.extend(options, {validationError: error}));
728
+ return false;
729
+ }
730
+
731
+ });
732
+
733
+ // Underscore methods that we want to implement on the Model, mapped to the
734
+ // number of arguments they take.
735
+ var modelMethods = { keys: 1, values: 1, pairs: 1, invert: 1, pick: 0,
736
+ omit: 0, chain: 1, isEmpty: 1 };
737
+
738
+ // Mix in each Underscore method as a proxy to `Model#attributes`.
739
+ addUnderscoreMethods(Model, modelMethods, 'attributes');
740
+
741
+ // Backbone.Collection
742
+ // -------------------
743
+
744
+ // If models tend to represent a single row of data, a Backbone Collection is
745
+ // more analogous to a table full of data ... or a small slice or page of that
746
+ // table, or a collection of rows that belong together for a particular reason
747
+ // -- all of the messages in this particular folder, all of the documents
748
+ // belonging to this particular author, and so on. Collections maintain
749
+ // indexes of their models, both in order, and for lookup by `id`.
750
+
751
+ // Create a new **Collection**, perhaps to contain a specific type of `model`.
752
+ // If a `comparator` is specified, the Collection will maintain
753
+ // its models in sort order, as they're added and removed.
754
+ var Collection = Backbone.Collection = function(models, options) {
755
+ options || (options = {});
756
+ if (options.model) this.model = options.model;
757
+ if (options.comparator !== void 0) this.comparator = options.comparator;
758
+ this._reset();
759
+ this.initialize.apply(this, arguments);
760
+ if (models) this.reset(models, _.extend({silent: true}, options));
761
+ };
762
+
763
+ // Default options for `Collection#set`.
764
+ var setOptions = {add: true, remove: true, merge: true};
765
+ var addOptions = {add: true, remove: false};
766
+
767
+ // Splices `insert` into `array` at index `at`.
768
+ var splice = function(array, insert, at) {
769
+ at = Math.min(Math.max(at, 0), array.length);
770
+ var tail = Array(array.length - at);
771
+ var length = insert.length;
772
+ for (var i = 0; i < tail.length; i++) tail[i] = array[i + at];
773
+ for (i = 0; i < length; i++) array[i + at] = insert[i];
774
+ for (i = 0; i < tail.length; i++) array[i + length + at] = tail[i];
775
+ };
776
+
777
+ // Define the Collection's inheritable methods.
778
+ _.extend(Collection.prototype, Events, {
779
+
780
+ // The default model for a collection is just a **Backbone.Model**.
781
+ // This should be overridden in most cases.
782
+ model: Model,
783
+
784
+ // Initialize is an empty function by default. Override it with your own
785
+ // initialization logic.
786
+ initialize: function(){},
787
+
788
+ // The JSON representation of a Collection is an array of the
789
+ // models' attributes.
790
+ toJSON: function(options) {
791
+ return this.map(function(model) { return model.toJSON(options); });
792
+ },
793
+
794
+ // Proxy `Backbone.sync` by default.
795
+ sync: function() {
796
+ return Backbone.sync.apply(this, arguments);
797
+ },
798
+
799
+ // Add a model, or list of models to the set. `models` may be Backbone
800
+ // Models or raw JavaScript objects to be converted to Models, or any
801
+ // combination of the two.
802
+ add: function(models, options) {
803
+ return this.set(models, _.extend({merge: false}, options, addOptions));
804
+ },
805
+
806
+ // Remove a model, or a list of models from the set.
807
+ remove: function(models, options) {
808
+ options = _.extend({}, options);
809
+ var singular = !_.isArray(models);
810
+ models = singular ? [models] : _.clone(models);
811
+ var removed = this._removeModels(models, options);
812
+ if (!options.silent && removed) this.trigger('update', this, options);
813
+ return singular ? removed[0] : removed;
814
+ },
815
+
816
+ // Update a collection by `set`-ing a new list of models, adding new ones,
817
+ // removing models that are no longer present, and merging models that
818
+ // already exist in the collection, as necessary. Similar to **Model#set**,
819
+ // the core operation for updating the data contained by the collection.
820
+ set: function(models, options) {
821
+ if (models == null) return;
822
+
823
+ options = _.defaults({}, options, setOptions);
824
+ if (options.parse && !this._isModel(models)) models = this.parse(models, options);
825
+
826
+ var singular = !_.isArray(models);
827
+ models = singular ? [models] : models.slice();
828
+
829
+ var at = options.at;
830
+ if (at != null) at = +at;
831
+ if (at < 0) at += this.length + 1;
832
+
833
+ var set = [];
834
+ var toAdd = [];
835
+ var toRemove = [];
836
+ var modelMap = {};
837
+
838
+ var add = options.add;
839
+ var merge = options.merge;
840
+ var remove = options.remove;
841
+
842
+ var sort = false;
843
+ var sortable = this.comparator && (at == null) && options.sort !== false;
844
+ var sortAttr = _.isString(this.comparator) ? this.comparator : null;
845
+
846
+ // Turn bare objects into model references, and prevent invalid models
847
+ // from being added.
848
+ var model;
849
+ for (var i = 0; i < models.length; i++) {
850
+ model = models[i];
851
+
852
+ // If a duplicate is found, prevent it from being added and
853
+ // optionally merge it into the existing model.
854
+ var existing = this.get(model);
855
+ if (existing) {
856
+ if (merge && model !== existing) {
857
+ var attrs = this._isModel(model) ? model.attributes : model;
858
+ if (options.parse) attrs = existing.parse(attrs, options);
859
+ existing.set(attrs, options);
860
+ if (sortable && !sort) sort = existing.hasChanged(sortAttr);
861
+ }
862
+ if (!modelMap[existing.cid]) {
863
+ modelMap[existing.cid] = true;
864
+ set.push(existing);
865
+ }
866
+ models[i] = existing;
867
+
868
+ // If this is a new, valid model, push it to the `toAdd` list.
869
+ } else if (add) {
870
+ model = models[i] = this._prepareModel(model, options);
871
+ if (model) {
872
+ toAdd.push(model);
873
+ this._addReference(model, options);
874
+ modelMap[model.cid] = true;
875
+ set.push(model);
876
+ }
877
+ }
878
+ }
879
+
880
+ // Remove stale models.
881
+ if (remove) {
882
+ for (i = 0; i < this.length; i++) {
883
+ model = this.models[i];
884
+ if (!modelMap[model.cid]) toRemove.push(model);
885
+ }
886
+ if (toRemove.length) this._removeModels(toRemove, options);
887
+ }
888
+
889
+ // See if sorting is needed, update `length` and splice in new models.
890
+ var orderChanged = false;
891
+ var replace = !sortable && add && remove;
892
+ if (set.length && replace) {
893
+ orderChanged = this.length != set.length || _.some(this.models, function(model, index) {
894
+ return model !== set[index];
895
+ });
896
+ this.models.length = 0;
897
+ splice(this.models, set, 0);
898
+ this.length = this.models.length;
899
+ } else if (toAdd.length) {
900
+ if (sortable) sort = true;
901
+ splice(this.models, toAdd, at == null ? this.length : at);
902
+ this.length = this.models.length;
903
+ }
904
+
905
+ // Silently sort the collection if appropriate.
906
+ if (sort) this.sort({silent: true});
907
+
908
+ // Unless silenced, it's time to fire all appropriate add/sort events.
909
+ if (!options.silent) {
910
+ for (i = 0; i < toAdd.length; i++) {
911
+ if (at != null) options.index = at + i;
912
+ model = toAdd[i];
913
+ model.trigger('add', model, this, options);
914
+ }
915
+ if (sort || orderChanged) this.trigger('sort', this, options);
916
+ if (toAdd.length || toRemove.length) this.trigger('update', this, options);
917
+ }
918
+
919
+ // Return the added (or merged) model (or models).
920
+ return singular ? models[0] : models;
921
+ },
922
+
923
+ // When you have more items than you want to add or remove individually,
924
+ // you can reset the entire set with a new list of models, without firing
925
+ // any granular `add` or `remove` events. Fires `reset` when finished.
926
+ // Useful for bulk operations and optimizations.
927
+ reset: function(models, options) {
928
+ options = options ? _.clone(options) : {};
929
+ for (var i = 0; i < this.models.length; i++) {
930
+ this._removeReference(this.models[i], options);
931
+ }
932
+ options.previousModels = this.models;
933
+ this._reset();
934
+ models = this.add(models, _.extend({silent: true}, options));
935
+ if (!options.silent) this.trigger('reset', this, options);
936
+ return models;
937
+ },
938
+
939
+ // Add a model to the end of the collection.
940
+ push: function(model, options) {
941
+ return this.add(model, _.extend({at: this.length}, options));
942
+ },
943
+
944
+ // Remove a model from the end of the collection.
945
+ pop: function(options) {
946
+ var model = this.at(this.length - 1);
947
+ return this.remove(model, options);
948
+ },
949
+
950
+ // Add a model to the beginning of the collection.
951
+ unshift: function(model, options) {
952
+ return this.add(model, _.extend({at: 0}, options));
953
+ },
954
+
955
+ // Remove a model from the beginning of the collection.
956
+ shift: function(options) {
957
+ var model = this.at(0);
958
+ return this.remove(model, options);
959
+ },
960
+
961
+ // Slice out a sub-array of models from the collection.
962
+ slice: function() {
963
+ return slice.apply(this.models, arguments);
964
+ },
965
+
966
+ // Get a model from the set by id.
967
+ get: function(obj) {
968
+ if (obj == null) return void 0;
969
+ var id = this.modelId(this._isModel(obj) ? obj.attributes : obj);
970
+ return this._byId[obj] || this._byId[id] || this._byId[obj.cid];
971
+ },
972
+
973
+ // Get the model at the given index.
974
+ at: function(index) {
975
+ if (index < 0) index += this.length;
976
+ return this.models[index];
977
+ },
978
+
979
+ // Return models with matching attributes. Useful for simple cases of
980
+ // `filter`.
981
+ where: function(attrs, first) {
982
+ return this[first ? 'find' : 'filter'](attrs);
983
+ },
984
+
985
+ // Return the first model with matching attributes. Useful for simple cases
986
+ // of `find`.
987
+ findWhere: function(attrs) {
988
+ return this.where(attrs, true);
989
+ },
990
+
991
+ // Force the collection to re-sort itself. You don't need to call this under
992
+ // normal circumstances, as the set will maintain sort order as each item
993
+ // is added.
994
+ sort: function(options) {
995
+ var comparator = this.comparator;
996
+ if (!comparator) throw new Error('Cannot sort a set without a comparator');
997
+ options || (options = {});
998
+
999
+ var length = comparator.length;
1000
+ if (_.isFunction(comparator)) comparator = _.bind(comparator, this);
1001
+
1002
+ // Run sort based on type of `comparator`.
1003
+ if (length === 1 || _.isString(comparator)) {
1004
+ this.models = this.sortBy(comparator);
1005
+ } else {
1006
+ this.models.sort(comparator);
1007
+ }
1008
+ if (!options.silent) this.trigger('sort', this, options);
1009
+ return this;
1010
+ },
1011
+
1012
+ // Pluck an attribute from each model in the collection.
1013
+ pluck: function(attr) {
1014
+ return _.invoke(this.models, 'get', attr);
1015
+ },
1016
+
1017
+ // Fetch the default set of models for this collection, resetting the
1018
+ // collection when they arrive. If `reset: true` is passed, the response
1019
+ // data will be passed through the `reset` method instead of `set`.
1020
+ fetch: function(options) {
1021
+ options = _.extend({parse: true}, options);
1022
+ var success = options.success;
1023
+ var collection = this;
1024
+ options.success = function(resp) {
1025
+ var method = options.reset ? 'reset' : 'set';
1026
+ collection[method](resp, options);
1027
+ if (success) success.call(options.context, collection, resp, options);
1028
+ collection.trigger('sync', collection, resp, options);
1029
+ };
1030
+ wrapError(this, options);
1031
+ return this.sync('read', this, options);
1032
+ },
1033
+
1034
+ // Create a new instance of a model in this collection. Add the model to the
1035
+ // collection immediately, unless `wait: true` is passed, in which case we
1036
+ // wait for the server to agree.
1037
+ create: function(model, options) {
1038
+ options = options ? _.clone(options) : {};
1039
+ var wait = options.wait;
1040
+ model = this._prepareModel(model, options);
1041
+ if (!model) return false;
1042
+ if (!wait) this.add(model, options);
1043
+ var collection = this;
1044
+ var success = options.success;
1045
+ options.success = function(model, resp, callbackOpts) {
1046
+ if (wait) collection.add(model, callbackOpts);
1047
+ if (success) success.call(callbackOpts.context, model, resp, callbackOpts);
1048
+ };
1049
+ model.save(null, options);
1050
+ return model;
1051
+ },
1052
+
1053
+ // **parse** converts a response into a list of models to be added to the
1054
+ // collection. The default implementation is just to pass it through.
1055
+ parse: function(resp, options) {
1056
+ return resp;
1057
+ },
1058
+
1059
+ // Create a new collection with an identical list of models as this one.
1060
+ clone: function() {
1061
+ return new this.constructor(this.models, {
1062
+ model: this.model,
1063
+ comparator: this.comparator
1064
+ });
1065
+ },
1066
+
1067
+ // Define how to uniquely identify models in the collection.
1068
+ modelId: function (attrs) {
1069
+ return attrs[this.model.prototype.idAttribute || 'id'];
1070
+ },
1071
+
1072
+ // Private method to reset all internal state. Called when the collection
1073
+ // is first initialized or reset.
1074
+ _reset: function() {
1075
+ this.length = 0;
1076
+ this.models = [];
1077
+ this._byId = {};
1078
+ },
1079
+
1080
+ // Prepare a hash of attributes (or other model) to be added to this
1081
+ // collection.
1082
+ _prepareModel: function(attrs, options) {
1083
+ if (this._isModel(attrs)) {
1084
+ if (!attrs.collection) attrs.collection = this;
1085
+ return attrs;
1086
+ }
1087
+ options = options ? _.clone(options) : {};
1088
+ options.collection = this;
1089
+ var model = new this.model(attrs, options);
1090
+ if (!model.validationError) return model;
1091
+ this.trigger('invalid', this, model.validationError, options);
1092
+ return false;
1093
+ },
1094
+
1095
+ // Internal method called by both remove and set.
1096
+ _removeModels: function(models, options) {
1097
+ var removed = [];
1098
+ for (var i = 0; i < models.length; i++) {
1099
+ var model = this.get(models[i]);
1100
+ if (!model) continue;
1101
+
1102
+ var index = this.indexOf(model);
1103
+ this.models.splice(index, 1);
1104
+ this.length--;
1105
+
1106
+ if (!options.silent) {
1107
+ options.index = index;
1108
+ model.trigger('remove', model, this, options);
1109
+ }
1110
+
1111
+ removed.push(model);
1112
+ this._removeReference(model, options);
1113
+ }
1114
+ return removed.length ? removed : false;
1115
+ },
1116
+
1117
+ // Method for checking whether an object should be considered a model for
1118
+ // the purposes of adding to the collection.
1119
+ _isModel: function (model) {
1120
+ return model instanceof Model;
1121
+ },
1122
+
1123
+ // Internal method to create a model's ties to a collection.
1124
+ _addReference: function(model, options) {
1125
+ this._byId[model.cid] = model;
1126
+ var id = this.modelId(model.attributes);
1127
+ if (id != null) this._byId[id] = model;
1128
+ model.on('all', this._onModelEvent, this);
1129
+ },
1130
+
1131
+ // Internal method to sever a model's ties to a collection.
1132
+ _removeReference: function(model, options) {
1133
+ delete this._byId[model.cid];
1134
+ var id = this.modelId(model.attributes);
1135
+ if (id != null) delete this._byId[id];
1136
+ if (this === model.collection) delete model.collection;
1137
+ model.off('all', this._onModelEvent, this);
1138
+ },
1139
+
1140
+ // Internal method called every time a model in the set fires an event.
1141
+ // Sets need to update their indexes when models change ids. All other
1142
+ // events simply proxy through. "add" and "remove" events that originate
1143
+ // in other collections are ignored.
1144
+ _onModelEvent: function(event, model, collection, options) {
1145
+ if ((event === 'add' || event === 'remove') && collection !== this) return;
1146
+ if (event === 'destroy') this.remove(model, options);
1147
+ if (event === 'change') {
1148
+ var prevId = this.modelId(model.previousAttributes());
1149
+ var id = this.modelId(model.attributes);
1150
+ if (prevId !== id) {
1151
+ if (prevId != null) delete this._byId[prevId];
1152
+ if (id != null) this._byId[id] = model;
1153
+ }
1154
+ }
1155
+ this.trigger.apply(this, arguments);
1156
+ }
1157
+
1158
+ });
1159
+
1160
+ // Underscore methods that we want to implement on the Collection.
1161
+ // 90% of the core usefulness of Backbone Collections is actually implemented
1162
+ // right here:
1163
+ var collectionMethods = { forEach: 3, each: 3, map: 3, collect: 3, reduce: 4,
1164
+ foldl: 4, inject: 4, reduceRight: 4, foldr: 4, find: 3, detect: 3, filter: 3,
1165
+ select: 3, reject: 3, every: 3, all: 3, some: 3, any: 3, include: 3, includes: 3,
1166
+ contains: 3, invoke: 0, max: 3, min: 3, toArray: 1, size: 1, first: 3,
1167
+ head: 3, take: 3, initial: 3, rest: 3, tail: 3, drop: 3, last: 3,
1168
+ without: 0, difference: 0, indexOf: 3, shuffle: 1, lastIndexOf: 3,
1169
+ isEmpty: 1, chain: 1, sample: 3, partition: 3, groupBy: 3, countBy: 3,
1170
+ sortBy: 3, indexBy: 3};
1171
+
1172
+ // Mix in each Underscore method as a proxy to `Collection#models`.
1173
+ addUnderscoreMethods(Collection, collectionMethods, 'models');
1174
+
1175
+ // Backbone.View
1176
+ // -------------
1177
+
1178
+ // Backbone Views are almost more convention than they are actual code. A View
1179
+ // is simply a JavaScript object that represents a logical chunk of UI in the
1180
+ // DOM. This might be a single item, an entire list, a sidebar or panel, or
1181
+ // even the surrounding frame which wraps your whole app. Defining a chunk of
1182
+ // UI as a **View** allows you to define your DOM events declaratively, without
1183
+ // having to worry about render order ... and makes it easy for the view to
1184
+ // react to specific changes in the state of your models.
1185
+
1186
+ // Creating a Backbone.View creates its initial element outside of the DOM,
1187
+ // if an existing element is not provided...
1188
+ var View = Backbone.View = function(options) {
1189
+ this.cid = _.uniqueId('view');
1190
+ _.extend(this, _.pick(options, viewOptions));
1191
+ this._ensureElement();
1192
+ this.initialize.apply(this, arguments);
1193
+ };
1194
+
1195
+ // Cached regex to split keys for `delegate`.
1196
+ var delegateEventSplitter = /^(\S+)\s*(.*)$/;
1197
+
1198
+ // List of view options to be set as properties.
1199
+ var viewOptions = ['model', 'collection', 'el', 'id', 'attributes', 'className', 'tagName', 'events'];
1200
+
1201
+ // Set up all inheritable **Backbone.View** properties and methods.
1202
+ _.extend(View.prototype, Events, {
1203
+
1204
+ // The default `tagName` of a View's element is `"div"`.
1205
+ tagName: 'div',
1206
+
1207
+ // jQuery delegate for element lookup, scoped to DOM elements within the
1208
+ // current view. This should be preferred to global lookups where possible.
1209
+ $: function(selector) {
1210
+ return this.$el.find(selector);
1211
+ },
1212
+
1213
+ // Initialize is an empty function by default. Override it with your own
1214
+ // initialization logic.
1215
+ initialize: function(){},
1216
+
1217
+ // **render** is the core function that your view should override, in order
1218
+ // to populate its element (`this.el`), with the appropriate HTML. The
1219
+ // convention is for **render** to always return `this`.
1220
+ render: function() {
1221
+ return this;
1222
+ },
1223
+
1224
+ // Remove this view by taking the element out of the DOM, and removing any
1225
+ // applicable Backbone.Events listeners.
1226
+ remove: function() {
1227
+ this._removeElement();
1228
+ this.stopListening();
1229
+ return this;
1230
+ },
1231
+
1232
+ // Remove this view's element from the document and all event listeners
1233
+ // attached to it. Exposed for subclasses using an alternative DOM
1234
+ // manipulation API.
1235
+ _removeElement: function() {
1236
+ this.$el.remove();
1237
+ },
1238
+
1239
+ // Change the view's element (`this.el` property) and re-delegate the
1240
+ // view's events on the new element.
1241
+ setElement: function(element) {
1242
+ this.undelegateEvents();
1243
+ this._setElement(element);
1244
+ this.delegateEvents();
1245
+ return this;
1246
+ },
1247
+
1248
+ // Creates the `this.el` and `this.$el` references for this view using the
1249
+ // given `el`. `el` can be a CSS selector or an HTML string, a jQuery
1250
+ // context or an element. Subclasses can override this to utilize an
1251
+ // alternative DOM manipulation API and are only required to set the
1252
+ // `this.el` property.
1253
+ _setElement: function(el) {
1254
+ this.$el = el instanceof Backbone.$ ? el : Backbone.$(el);
1255
+ this.el = this.$el[0];
1256
+ },
1257
+
1258
+ // Set callbacks, where `this.events` is a hash of
1259
+ //
1260
+ // *{"event selector": "callback"}*
1261
+ //
1262
+ // {
1263
+ // 'mousedown .title': 'edit',
1264
+ // 'click .button': 'save',
1265
+ // 'click .open': function(e) { ... }
1266
+ // }
1267
+ //
1268
+ // pairs. Callbacks will be bound to the view, with `this` set properly.
1269
+ // Uses event delegation for efficiency.
1270
+ // Omitting the selector binds the event to `this.el`.
1271
+ delegateEvents: function(events) {
1272
+ events || (events = _.result(this, 'events'));
1273
+ if (!events) return this;
1274
+ this.undelegateEvents();
1275
+ for (var key in events) {
1276
+ var method = events[key];
1277
+ if (!_.isFunction(method)) method = this[method];
1278
+ if (!method) continue;
1279
+ var match = key.match(delegateEventSplitter);
1280
+ this.delegate(match[1], match[2], _.bind(method, this));
1281
+ }
1282
+ return this;
1283
+ },
1284
+
1285
+ // Add a single event listener to the view's element (or a child element
1286
+ // using `selector`). This only works for delegate-able events: not `focus`,
1287
+ // `blur`, and not `change`, `submit`, and `reset` in Internet Explorer.
1288
+ delegate: function(eventName, selector, listener) {
1289
+ this.$el.on(eventName + '.delegateEvents' + this.cid, selector, listener);
1290
+ return this;
1291
+ },
1292
+
1293
+ // Clears all callbacks previously bound to the view by `delegateEvents`.
1294
+ // You usually don't need to use this, but may wish to if you have multiple
1295
+ // Backbone views attached to the same DOM element.
1296
+ undelegateEvents: function() {
1297
+ if (this.$el) this.$el.off('.delegateEvents' + this.cid);
1298
+ return this;
1299
+ },
1300
+
1301
+ // A finer-grained `undelegateEvents` for removing a single delegated event.
1302
+ // `selector` and `listener` are both optional.
1303
+ undelegate: function(eventName, selector, listener) {
1304
+ this.$el.off(eventName + '.delegateEvents' + this.cid, selector, listener);
1305
+ return this;
1306
+ },
1307
+
1308
+ // Produces a DOM element to be assigned to your view. Exposed for
1309
+ // subclasses using an alternative DOM manipulation API.
1310
+ _createElement: function(tagName) {
1311
+ return document.createElement(tagName);
1312
+ },
1313
+
1314
+ // Ensure that the View has a DOM element to render into.
1315
+ // If `this.el` is a string, pass it through `$()`, take the first
1316
+ // matching element, and re-assign it to `el`. Otherwise, create
1317
+ // an element from the `id`, `className` and `tagName` properties.
1318
+ _ensureElement: function() {
1319
+ if (!this.el) {
1320
+ var attrs = _.extend({}, _.result(this, 'attributes'));
1321
+ if (this.id) attrs.id = _.result(this, 'id');
1322
+ if (this.className) attrs['class'] = _.result(this, 'className');
1323
+ this.setElement(this._createElement(_.result(this, 'tagName')));
1324
+ this._setAttributes(attrs);
1325
+ } else {
1326
+ this.setElement(_.result(this, 'el'));
1327
+ }
1328
+ },
1329
+
1330
+ // Set attributes from a hash on this view's element. Exposed for
1331
+ // subclasses using an alternative DOM manipulation API.
1332
+ _setAttributes: function(attributes) {
1333
+ this.$el.attr(attributes);
1334
+ }
1335
+
1336
+ });
1337
+
1338
+ // Backbone.sync
1339
+ // -------------
1340
+
1341
+ // Override this function to change the manner in which Backbone persists
1342
+ // models to the server. You will be passed the type of request, and the
1343
+ // model in question. By default, makes a RESTful Ajax request
1344
+ // to the model's `url()`. Some possible customizations could be:
1345
+ //
1346
+ // * Use `setTimeout` to batch rapid-fire updates into a single request.
1347
+ // * Send up the models as XML instead of JSON.
1348
+ // * Persist models via WebSockets instead of Ajax.
1349
+ //
1350
+ // Turn on `Backbone.emulateHTTP` in order to send `PUT` and `DELETE` requests
1351
+ // as `POST`, with a `_method` parameter containing the true HTTP method,
1352
+ // as well as all requests with the body as `application/x-www-form-urlencoded`
1353
+ // instead of `application/json` with the model in a param named `model`.
1354
+ // Useful when interfacing with server-side languages like **PHP** that make
1355
+ // it difficult to read the body of `PUT` requests.
1356
+ Backbone.sync = function(method, model, options) {
1357
+ var type = methodMap[method];
1358
+
1359
+ // Default options, unless specified.
1360
+ _.defaults(options || (options = {}), {
1361
+ emulateHTTP: Backbone.emulateHTTP,
1362
+ emulateJSON: Backbone.emulateJSON
1363
+ });
1364
+
1365
+ // Default JSON-request options.
1366
+ var params = {type: type, dataType: 'json'};
1367
+
1368
+ // Ensure that we have a URL.
1369
+ if (!options.url) {
1370
+ params.url = _.result(model, 'url') || urlError();
1371
+ }
1372
+
1373
+ // Ensure that we have the appropriate request data.
1374
+ if (options.data == null && model && (method === 'create' || method === 'update' || method === 'patch')) {
1375
+ params.contentType = 'application/json';
1376
+ params.data = JSON.stringify(options.attrs || model.toJSON(options));
1377
+ }
1378
+
1379
+ // For older servers, emulate JSON by encoding the request into an HTML-form.
1380
+ if (options.emulateJSON) {
1381
+ params.contentType = 'application/x-www-form-urlencoded';
1382
+ params.data = params.data ? {model: params.data} : {};
1383
+ }
1384
+
1385
+ // For older servers, emulate HTTP by mimicking the HTTP method with `_method`
1386
+ // And an `X-HTTP-Method-Override` header.
1387
+ if (options.emulateHTTP && (type === 'PUT' || type === 'DELETE' || type === 'PATCH')) {
1388
+ params.type = 'POST';
1389
+ if (options.emulateJSON) params.data._method = type;
1390
+ var beforeSend = options.beforeSend;
1391
+ options.beforeSend = function(xhr) {
1392
+ xhr.setRequestHeader('X-HTTP-Method-Override', type);
1393
+ if (beforeSend) return beforeSend.apply(this, arguments);
1394
+ };
1395
+ }
1396
+
1397
+ // Don't process data on a non-GET request.
1398
+ if (params.type !== 'GET' && !options.emulateJSON) {
1399
+ params.processData = false;
1400
+ }
1401
+
1402
+ // Pass along `textStatus` and `errorThrown` from jQuery.
1403
+ var error = options.error;
1404
+ options.error = function(xhr, textStatus, errorThrown) {
1405
+ options.textStatus = textStatus;
1406
+ options.errorThrown = errorThrown;
1407
+ if (error) error.call(options.context, xhr, textStatus, errorThrown);
1408
+ };
1409
+
1410
+ // Make the request, allowing the user to override any Ajax options.
1411
+ var xhr = options.xhr = Backbone.ajax(_.extend(params, options));
1412
+ model.trigger('request', model, xhr, options);
1413
+ return xhr;
1414
+ };
1415
+
1416
+ // Map from CRUD to HTTP for our default `Backbone.sync` implementation.
1417
+ var methodMap = {
1418
+ 'create': 'POST',
1419
+ 'update': 'PUT',
1420
+ 'patch': 'PATCH',
1421
+ 'delete': 'DELETE',
1422
+ 'read': 'GET'
1423
+ };
1424
+
1425
+ // Set the default implementation of `Backbone.ajax` to proxy through to `$`.
1426
+ // Override this if you'd like to use a different library.
1427
+ Backbone.ajax = function() {
1428
+ return Backbone.$.ajax.apply(Backbone.$, arguments);
1429
+ };
1430
+
1431
+ // Backbone.Router
1432
+ // ---------------
1433
+
1434
+ // Routers map faux-URLs to actions, and fire events when routes are
1435
+ // matched. Creating a new one sets its `routes` hash, if not set statically.
1436
+ var Router = Backbone.Router = function(options) {
1437
+ options || (options = {});
1438
+ if (options.routes) this.routes = options.routes;
1439
+ this._bindRoutes();
1440
+ this.initialize.apply(this, arguments);
1441
+ };
1442
+
1443
+ // Cached regular expressions for matching named param parts and splatted
1444
+ // parts of route strings.
1445
+ var optionalParam = /\((.*?)\)/g;
1446
+ var namedParam = /(\(\?)?:\w+/g;
1447
+ var splatParam = /\*\w+/g;
1448
+ var escapeRegExp = /[\-{}\[\]+?.,\\\^$|#\s]/g;
1449
+
1450
+ // Set up all inheritable **Backbone.Router** properties and methods.
1451
+ _.extend(Router.prototype, Events, {
1452
+
1453
+ // Initialize is an empty function by default. Override it with your own
1454
+ // initialization logic.
1455
+ initialize: function(){},
1456
+
1457
+ // Manually bind a single named route to a callback. For example:
1458
+ //
1459
+ // this.route('search/:query/p:num', 'search', function(query, num) {
1460
+ // ...
1461
+ // });
1462
+ //
1463
+ route: function(route, name, callback) {
1464
+ if (!_.isRegExp(route)) route = this._routeToRegExp(route);
1465
+ if (_.isFunction(name)) {
1466
+ callback = name;
1467
+ name = '';
1468
+ }
1469
+ if (!callback) callback = this[name];
1470
+ var router = this;
1471
+ Backbone.history.route(route, function(fragment) {
1472
+ var args = router._extractParameters(route, fragment);
1473
+ if (router.execute(callback, args, name) !== false) {
1474
+ router.trigger.apply(router, ['route:' + name].concat(args));
1475
+ router.trigger('route', name, args);
1476
+ Backbone.history.trigger('route', router, name, args);
1477
+ }
1478
+ });
1479
+ return this;
1480
+ },
1481
+
1482
+ // Execute a route handler with the provided parameters. This is an
1483
+ // excellent place to do pre-route setup or post-route cleanup.
1484
+ execute: function(callback, args, name) {
1485
+ if (callback) callback.apply(this, args);
1486
+ },
1487
+
1488
+ // Simple proxy to `Backbone.history` to save a fragment into the history.
1489
+ navigate: function(fragment, options) {
1490
+ Backbone.history.navigate(fragment, options);
1491
+ return this;
1492
+ },
1493
+
1494
+ // Bind all defined routes to `Backbone.history`. We have to reverse the
1495
+ // order of the routes here to support behavior where the most general
1496
+ // routes can be defined at the bottom of the route map.
1497
+ _bindRoutes: function() {
1498
+ if (!this.routes) return;
1499
+ this.routes = _.result(this, 'routes');
1500
+ var route, routes = _.keys(this.routes);
1501
+ while ((route = routes.pop()) != null) {
1502
+ this.route(route, this.routes[route]);
1503
+ }
1504
+ },
1505
+
1506
+ // Convert a route string into a regular expression, suitable for matching
1507
+ // against the current location hash.
1508
+ _routeToRegExp: function(route) {
1509
+ route = route.replace(escapeRegExp, '\\$&')
1510
+ .replace(optionalParam, '(?:$1)?')
1511
+ .replace(namedParam, function(match, optional) {
1512
+ return optional ? match : '([^/?]+)';
1513
+ })
1514
+ .replace(splatParam, '([^?]*?)');
1515
+ return new RegExp('^' + route + '(?:\\?([\\s\\S]*))?$');
1516
+ },
1517
+
1518
+ // Given a route, and a URL fragment that it matches, return the array of
1519
+ // extracted decoded parameters. Empty or unmatched parameters will be
1520
+ // treated as `null` to normalize cross-browser behavior.
1521
+ _extractParameters: function(route, fragment) {
1522
+ var params = route.exec(fragment).slice(1);
1523
+ return _.map(params, function(param, i) {
1524
+ // Don't decode the search params.
1525
+ if (i === params.length - 1) return param || null;
1526
+ return param ? decodeURIComponent(param) : null;
1527
+ });
1528
+ }
1529
+
1530
+ });
1531
+
1532
+ // Backbone.History
1533
+ // ----------------
1534
+
1535
+ // Handles cross-browser history management, based on either
1536
+ // [pushState](http://diveintohtml5.info/history.html) and real URLs, or
1537
+ // [onhashchange](https://developer.mozilla.org/en-US/docs/DOM/window.onhashchange)
1538
+ // and URL fragments. If the browser supports neither (old IE, natch),
1539
+ // falls back to polling.
1540
+ var History = Backbone.History = function() {
1541
+ this.handlers = [];
1542
+ this.checkUrl = _.bind(this.checkUrl, this);
1543
+
1544
+ // Ensure that `History` can be used outside of the browser.
1545
+ if (typeof window !== 'undefined') {
1546
+ this.location = window.location;
1547
+ this.history = window.history;
1548
+ }
1549
+ };
1550
+
1551
+ // Cached regex for stripping a leading hash/slash and trailing space.
1552
+ var routeStripper = /^[#\/]|\s+$/g;
1553
+
1554
+ // Cached regex for stripping leading and trailing slashes.
1555
+ var rootStripper = /^\/+|\/+$/g;
1556
+
1557
+ // Cached regex for stripping urls of hash.
1558
+ var pathStripper = /#.*$/;
1559
+
1560
+ // Has the history handling already been started?
1561
+ History.started = false;
1562
+
1563
+ // Set up all inheritable **Backbone.History** properties and methods.
1564
+ _.extend(History.prototype, Events, {
1565
+
1566
+ // The default interval to poll for hash changes, if necessary, is
1567
+ // twenty times a second.
1568
+ interval: 50,
1569
+
1570
+ // Are we at the app root?
1571
+ atRoot: function() {
1572
+ var path = this.location.pathname.replace(/[^\/]$/, '$&/');
1573
+ return path === this.root && !this.getSearch();
1574
+ },
1575
+
1576
+ // Does the pathname match the root?
1577
+ matchRoot: function() {
1578
+ var path = this.decodeFragment(this.location.pathname);
1579
+ var root = path.slice(0, this.root.length - 1) + '/';
1580
+ return root === this.root;
1581
+ },
1582
+
1583
+ // Unicode characters in `location.pathname` are percent encoded so they're
1584
+ // decoded for comparison. `%25` should not be decoded since it may be part
1585
+ // of an encoded parameter.
1586
+ decodeFragment: function(fragment) {
1587
+ return decodeURI(fragment.replace(/%25/g, '%2525'));
1588
+ },
1589
+
1590
+ // In IE6, the hash fragment and search params are incorrect if the
1591
+ // fragment contains `?`.
1592
+ getSearch: function() {
1593
+ var match = this.location.href.replace(/#.*/, '').match(/\?.+/);
1594
+ return match ? match[0] : '';
1595
+ },
1596
+
1597
+ // Gets the true hash value. Cannot use location.hash directly due to bug
1598
+ // in Firefox where location.hash will always be decoded.
1599
+ getHash: function(window) {
1600
+ var match = (window || this).location.href.match(/#(.*)$/);
1601
+ return match ? match[1] : '';
1602
+ },
1603
+
1604
+ // Get the pathname and search params, without the root.
1605
+ getPath: function() {
1606
+ var path = this.decodeFragment(
1607
+ this.location.pathname + this.getSearch()
1608
+ ).slice(this.root.length - 1);
1609
+ return path.charAt(0) === '/' ? path.slice(1) : path;
1610
+ },
1611
+
1612
+ // Get the cross-browser normalized URL fragment from the path or hash.
1613
+ getFragment: function(fragment) {
1614
+ if (fragment == null) {
1615
+ if (this._usePushState || !this._wantsHashChange) {
1616
+ fragment = this.getPath();
1617
+ } else {
1618
+ fragment = this.getHash();
1619
+ }
1620
+ }
1621
+ return fragment.replace(routeStripper, '');
1622
+ },
1623
+
1624
+ // Start the hash change handling, returning `true` if the current URL matches
1625
+ // an existing route, and `false` otherwise.
1626
+ start: function(options) {
1627
+ if (History.started) throw new Error('Backbone.history has already been started');
1628
+ History.started = true;
1629
+
1630
+ // Figure out the initial configuration. Do we need an iframe?
1631
+ // Is pushState desired ... is it available?
1632
+ this.options = _.extend({root: '/'}, this.options, options);
1633
+ this.root = this.options.root;
1634
+ this._wantsHashChange = this.options.hashChange !== false;
1635
+ this._hasHashChange = 'onhashchange' in window && (document.documentMode === void 0 || document.documentMode > 7);
1636
+ this._useHashChange = this._wantsHashChange && this._hasHashChange;
1637
+ this._wantsPushState = !!this.options.pushState;
1638
+ this._hasPushState = !!(this.history && this.history.pushState);
1639
+ this._usePushState = this._wantsPushState && this._hasPushState;
1640
+ this.fragment = this.getFragment();
1641
+
1642
+ // Normalize root to always include a leading and trailing slash.
1643
+ this.root = ('/' + this.root + '/').replace(rootStripper, '/');
1644
+
1645
+ // Transition from hashChange to pushState or vice versa if both are
1646
+ // requested.
1647
+ if (this._wantsHashChange && this._wantsPushState) {
1648
+
1649
+ // If we've started off with a route from a `pushState`-enabled
1650
+ // browser, but we're currently in a browser that doesn't support it...
1651
+ if (!this._hasPushState && !this.atRoot()) {
1652
+ var root = this.root.slice(0, -1) || '/';
1653
+ this.location.replace(root + '#' + this.getPath());
1654
+ // Return immediately as browser will do redirect to new url
1655
+ return true;
1656
+
1657
+ // Or if we've started out with a hash-based route, but we're currently
1658
+ // in a browser where it could be `pushState`-based instead...
1659
+ } else if (this._hasPushState && this.atRoot()) {
1660
+ this.navigate(this.getHash(), {replace: true});
1661
+ }
1662
+
1663
+ }
1664
+
1665
+ // Proxy an iframe to handle location events if the browser doesn't
1666
+ // support the `hashchange` event, HTML5 history, or the user wants
1667
+ // `hashChange` but not `pushState`.
1668
+ if (!this._hasHashChange && this._wantsHashChange && !this._usePushState) {
1669
+ this.iframe = document.createElement('iframe');
1670
+ this.iframe.src = 'javascript:0';
1671
+ this.iframe.style.display = 'none';
1672
+ this.iframe.tabIndex = -1;
1673
+ var body = document.body;
1674
+ // Using `appendChild` will throw on IE < 9 if the document is not ready.
1675
+ var iWindow = body.insertBefore(this.iframe, body.firstChild).contentWindow;
1676
+ iWindow.document.open();
1677
+ iWindow.document.close();
1678
+ iWindow.location.hash = '#' + this.fragment;
1679
+ }
1680
+
1681
+ // Add a cross-platform `addEventListener` shim for older browsers.
1682
+ var addEventListener = window.addEventListener || function (eventName, listener) {
1683
+ return attachEvent('on' + eventName, listener);
1684
+ };
1685
+
1686
+ // Depending on whether we're using pushState or hashes, and whether
1687
+ // 'onhashchange' is supported, determine how we check the URL state.
1688
+ if (this._usePushState) {
1689
+ addEventListener('popstate', this.checkUrl, false);
1690
+ } else if (this._useHashChange && !this.iframe) {
1691
+ addEventListener('hashchange', this.checkUrl, false);
1692
+ } else if (this._wantsHashChange) {
1693
+ this._checkUrlInterval = setInterval(this.checkUrl, this.interval);
1694
+ }
1695
+
1696
+ if (!this.options.silent) return this.loadUrl();
1697
+ },
1698
+
1699
+ // Disable Backbone.history, perhaps temporarily. Not useful in a real app,
1700
+ // but possibly useful for unit testing Routers.
1701
+ stop: function() {
1702
+ // Add a cross-platform `removeEventListener` shim for older browsers.
1703
+ var removeEventListener = window.removeEventListener || function (eventName, listener) {
1704
+ return detachEvent('on' + eventName, listener);
1705
+ };
1706
+
1707
+ // Remove window listeners.
1708
+ if (this._usePushState) {
1709
+ removeEventListener('popstate', this.checkUrl, false);
1710
+ } else if (this._useHashChange && !this.iframe) {
1711
+ removeEventListener('hashchange', this.checkUrl, false);
1712
+ }
1713
+
1714
+ // Clean up the iframe if necessary.
1715
+ if (this.iframe) {
1716
+ document.body.removeChild(this.iframe);
1717
+ this.iframe = null;
1718
+ }
1719
+
1720
+ // Some environments will throw when clearing an undefined interval.
1721
+ if (this._checkUrlInterval) clearInterval(this._checkUrlInterval);
1722
+ History.started = false;
1723
+ },
1724
+
1725
+ // Add a route to be tested when the fragment changes. Routes added later
1726
+ // may override previous routes.
1727
+ route: function(route, callback) {
1728
+ this.handlers.unshift({route: route, callback: callback});
1729
+ },
1730
+
1731
+ // Checks the current URL to see if it has changed, and if it has,
1732
+ // calls `loadUrl`, normalizing across the hidden iframe.
1733
+ checkUrl: function(e) {
1734
+ var current = this.getFragment();
1735
+
1736
+ // If the user pressed the back button, the iframe's hash will have
1737
+ // changed and we should use that for comparison.
1738
+ if (current === this.fragment && this.iframe) {
1739
+ current = this.getHash(this.iframe.contentWindow);
1740
+ }
1741
+
1742
+ if (current === this.fragment) return false;
1743
+ if (this.iframe) this.navigate(current);
1744
+ this.loadUrl();
1745
+ },
1746
+
1747
+ // Attempt to load the current URL fragment. If a route succeeds with a
1748
+ // match, returns `true`. If no defined routes matches the fragment,
1749
+ // returns `false`.
1750
+ loadUrl: function(fragment) {
1751
+ // If the root doesn't match, no routes can match either.
1752
+ if (!this.matchRoot()) return false;
1753
+ fragment = this.fragment = this.getFragment(fragment);
1754
+ return _.some(this.handlers, function(handler) {
1755
+ if (handler.route.test(fragment)) {
1756
+ handler.callback(fragment);
1757
+ return true;
1758
+ }
1759
+ });
1760
+ },
1761
+
1762
+ // Save a fragment into the hash history, or replace the URL state if the
1763
+ // 'replace' option is passed. You are responsible for properly URL-encoding
1764
+ // the fragment in advance.
1765
+ //
1766
+ // The options object can contain `trigger: true` if you wish to have the
1767
+ // route callback be fired (not usually desirable), or `replace: true`, if
1768
+ // you wish to modify the current URL without adding an entry to the history.
1769
+ navigate: function(fragment, options) {
1770
+ if (!History.started) return false;
1771
+ if (!options || options === true) options = {trigger: !!options};
1772
+
1773
+ // Normalize the fragment.
1774
+ fragment = this.getFragment(fragment || '');
1775
+
1776
+ // Don't include a trailing slash on the root.
1777
+ var root = this.root;
1778
+ if (fragment === '' || fragment.charAt(0) === '?') {
1779
+ root = root.slice(0, -1) || '/';
1780
+ }
1781
+ var url = root + fragment;
1782
+
1783
+ // Strip the hash and decode for matching.
1784
+ fragment = this.decodeFragment(fragment.replace(pathStripper, ''));
1785
+
1786
+ if (this.fragment === fragment) return;
1787
+ this.fragment = fragment;
1788
+
1789
+ // If pushState is available, we use it to set the fragment as a real URL.
1790
+ if (this._usePushState) {
1791
+ this.history[options.replace ? 'replaceState' : 'pushState']({}, document.title, url);
1792
+
1793
+ // If hash changes haven't been explicitly disabled, update the hash
1794
+ // fragment to store history.
1795
+ } else if (this._wantsHashChange) {
1796
+ this._updateHash(this.location, fragment, options.replace);
1797
+ if (this.iframe && (fragment !== this.getHash(this.iframe.contentWindow))) {
1798
+ var iWindow = this.iframe.contentWindow;
1799
+
1800
+ // Opening and closing the iframe tricks IE7 and earlier to push a
1801
+ // history entry on hash-tag change. When replace is true, we don't
1802
+ // want this.
1803
+ if (!options.replace) {
1804
+ iWindow.document.open();
1805
+ iWindow.document.close();
1806
+ }
1807
+
1808
+ this._updateHash(iWindow.location, fragment, options.replace);
1809
+ }
1810
+
1811
+ // If you've told us that you explicitly don't want fallback hashchange-
1812
+ // based history, then `navigate` becomes a page refresh.
1813
+ } else {
1814
+ return this.location.assign(url);
1815
+ }
1816
+ if (options.trigger) return this.loadUrl(fragment);
1817
+ },
1818
+
1819
+ // Update the hash location, either replacing the current entry, or adding
1820
+ // a new one to the browser history.
1821
+ _updateHash: function(location, fragment, replace) {
1822
+ if (replace) {
1823
+ var href = location.href.replace(/(javascript:|#).*$/, '');
1824
+ location.replace(href + '#' + fragment);
1825
+ } else {
1826
+ // Some browsers require that `hash` contains a leading #.
1827
+ location.hash = '#' + fragment;
1828
+ }
1829
+ }
1830
+
1831
+ });
1832
+
1833
+ // Create the default Backbone.history.
1834
+ Backbone.history = new History;
1835
+
1836
+ // Helpers
1837
+ // -------
1838
+
1839
+ // Helper function to correctly set up the prototype chain for subclasses.
1840
+ // Similar to `goog.inherits`, but uses a hash of prototype properties and
1841
+ // class properties to be extended.
1842
+ var extend = function(protoProps, staticProps) {
1843
+ var parent = this;
1844
+ var child;
1845
+
1846
+ // The constructor function for the new subclass is either defined by you
1847
+ // (the "constructor" property in your `extend` definition), or defaulted
1848
+ // by us to simply call the parent constructor.
1849
+ if (protoProps && _.has(protoProps, 'constructor')) {
1850
+ child = protoProps.constructor;
1851
+ } else {
1852
+ child = function(){ return parent.apply(this, arguments); };
1853
+ }
1854
+
1855
+ // Add static properties to the constructor function, if supplied.
1856
+ _.extend(child, parent, staticProps);
1857
+
1858
+ // Set the prototype chain to inherit from `parent`, without calling
1859
+ // `parent` constructor function.
1860
+ var Surrogate = function(){ this.constructor = child; };
1861
+ Surrogate.prototype = parent.prototype;
1862
+ child.prototype = new Surrogate;
1863
+
1864
+ // Add prototype properties (instance properties) to the subclass,
1865
+ // if supplied.
1866
+ if (protoProps) _.extend(child.prototype, protoProps);
1867
+
1868
+ // Set a convenience property in case the parent's prototype is needed
1869
+ // later.
1870
+ child.__super__ = parent.prototype;
1871
+
1872
+ return child;
1873
+ };
1874
+
1875
+ // Set up inheritance for the model, collection, router, view and history.
1876
+ Model.extend = Collection.extend = Router.extend = View.extend = History.extend = extend;
1877
+
1878
+ // Throw an error when a URL is needed, and none is supplied.
1879
+ var urlError = function() {
1880
+ throw new Error('A "url" property or function must be specified');
1881
+ };
1882
+
1883
+ // Wrap an optional error callback with a fallback error event.
1884
+ var wrapError = function(model, options) {
1885
+ var error = options.error;
1886
+ options.error = function(resp) {
1887
+ if (error) error.call(options.context, model, resp, options);
1888
+ model.trigger('error', model, resp, options);
1889
+ };
1890
+ };
1891
+
1892
+ return Backbone;
1893
+
1894
+ }));