stylish 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (458) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +7 -10
  3. data/ARCHITECTURE.md +96 -0
  4. data/Gemfile +8 -0
  5. data/README.md +25 -29
  6. data/Rakefile +24 -0
  7. data/bin/stylish +33 -0
  8. data/lib/stylish.rb +36 -1
  9. data/lib/stylish/configuration.rb +37 -0
  10. data/lib/stylish/core_ext.rb +20 -0
  11. data/lib/stylish/developer.rb +13 -0
  12. data/lib/stylish/developer/config.rb +19 -0
  13. data/lib/stylish/developer/environment.rb +75 -0
  14. data/lib/stylish/developer/listing.rb +85 -0
  15. data/lib/stylish/developer/model_delegator.rb +51 -0
  16. data/lib/stylish/developer/modification.rb +139 -0
  17. data/lib/stylish/developer/path.rb +168 -0
  18. data/lib/stylish/developer/route.rb +97 -0
  19. data/lib/stylish/developer/server.rb +40 -0
  20. data/lib/stylish/engine.rb +12 -0
  21. data/lib/stylish/fs.rb +59 -0
  22. data/lib/stylish/manifest.rb +100 -0
  23. data/lib/stylish/models.rb +119 -0
  24. data/lib/stylish/models/component.rb +19 -0
  25. data/lib/stylish/models/layout.rb +19 -0
  26. data/lib/stylish/models/library.rb +134 -0
  27. data/lib/stylish/models/package.rb +156 -0
  28. data/lib/stylish/models/script.rb +10 -0
  29. data/lib/stylish/models/stylesheet.rb +9 -0
  30. data/lib/stylish/models/template.rb +9 -0
  31. data/lib/stylish/models/theme.rb +8 -0
  32. data/lib/stylish/util.rb +20 -0
  33. data/lib/stylish/version.rb +1 -1
  34. data/library/config.json +4 -0
  35. data/library/second-theme/manifest.json +8 -0
  36. data/library/second-theme/manifest.yml +6 -0
  37. data/library/second-theme/templates/footers/footer-01.html +3 -0
  38. data/library/second-theme/templates/footers/footer-02.html +3 -0
  39. data/library/second-theme/templates/headers/header-01.html +3 -0
  40. data/library/second-theme/templates/headers/header-02.html +3 -0
  41. data/library/second-theme/templates/landing-page-blocks/landing-page-block-01.html +3 -0
  42. data/library/second-theme/templates/landing-page-blocks/landing-page-block-02.html +3 -0
  43. data/library/test-theme/components/footers/footer-01.json +5 -0
  44. data/library/test-theme/components/footers/footer-02.json +5 -0
  45. data/library/test-theme/components/headers/header-01.json +5 -0
  46. data/library/test-theme/components/headers/header-02.json +5 -0
  47. data/library/test-theme/components/landing-page-blocks/landing-page-01.json +5 -0
  48. data/library/test-theme/components/landing-page-blocks/landing-page-02.json +5 -0
  49. data/library/test-theme/manifest.json +8 -0
  50. data/library/test-theme/manifest.yml +6 -0
  51. data/library/test-theme/pages/page-01.json +11 -0
  52. data/library/test-theme/templates/footers/footer-01.html +3 -0
  53. data/library/test-theme/templates/footers/footer-02.html +3 -0
  54. data/library/test-theme/templates/headers/header-01.html +3 -0
  55. data/library/test-theme/templates/headers/header-02.html +3 -0
  56. data/library/test-theme/templates/landing-page-blocks/landing-page-block-01.html +3 -0
  57. data/library/test-theme/templates/landing-page-blocks/landing-page-block-02.html +3 -0
  58. data/library/test-theme/templates/layouts/standard-layout.html +10 -0
  59. data/spec/acceptance/listing_assets_spec.rb +20 -0
  60. data/spec/acceptance/model_browsing_spec.rb +21 -0
  61. data/spec/acceptance/model_creation_spec.rb +16 -0
  62. data/spec/acceptance/model_deleting_spec.rb +10 -0
  63. data/spec/acceptance/model_updating_spec.rb +12 -0
  64. data/spec/acceptance/modifying_assets_spec.rb +50 -0
  65. data/spec/acceptance/server_info_spec.rb +10 -0
  66. data/spec/dummy/README.rdoc +28 -0
  67. data/spec/dummy/Rakefile +6 -0
  68. data/spec/dummy/app/assets/images/.keep +0 -0
  69. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  70. data/spec/dummy/app/assets/javascripts/test.coffee +4 -0
  71. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  72. data/spec/dummy/app/assets/stylesheets/test.css.scss +6 -0
  73. data/spec/dummy/app/assets/stylesheets/writable/existing.scss.css +0 -0
  74. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  75. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  76. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  77. data/spec/dummy/app/mailers/.keep +0 -0
  78. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  79. data/spec/dummy/bin/bundle +3 -0
  80. data/spec/dummy/bin/rails +4 -0
  81. data/spec/dummy/bin/rake +4 -0
  82. data/spec/dummy/config.ru +4 -0
  83. data/spec/dummy/config/application.rb +30 -0
  84. data/spec/dummy/config/boot.rb +5 -0
  85. data/spec/dummy/config/database.yml +25 -0
  86. data/spec/dummy/config/environment.rb +5 -0
  87. data/spec/dummy/config/environments/development.rb +37 -0
  88. data/spec/dummy/config/environments/production.rb +82 -0
  89. data/spec/dummy/config/environments/test.rb +39 -0
  90. data/spec/dummy/config/initializers/assets.rb +8 -0
  91. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  92. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  93. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  94. data/spec/dummy/config/initializers/inflections.rb +16 -0
  95. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  96. data/spec/dummy/config/initializers/session_store.rb +3 -0
  97. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  98. data/spec/dummy/config/locales/en.yml +23 -0
  99. data/spec/dummy/config/routes.rb +3 -0
  100. data/spec/dummy/config/secrets.yml +22 -0
  101. data/spec/dummy/db/migrate/20140822065900_create_books.rb +11 -0
  102. data/spec/dummy/db/migrate/20140822065916_create_authors.rb +9 -0
  103. data/spec/dummy/db/migrate/20140824215902_create_users.rb +10 -0
  104. data/spec/dummy/db/migrate/20140826193259_create_libraries.rb +10 -0
  105. data/spec/dummy/db/schema.rb +37 -0
  106. data/spec/dummy/db/test.sqlite3 +0 -0
  107. data/spec/dummy/lib/assets/.keep +0 -0
  108. data/spec/dummy/log/.keep +0 -0
  109. data/spec/dummy/public/404.html +67 -0
  110. data/spec/dummy/public/422.html +67 -0
  111. data/spec/dummy/public/500.html +66 -0
  112. data/spec/dummy/public/favicon.ico +0 -0
  113. data/spec/fixtures/config.json +3 -0
  114. data/spec/fixtures/test-theme/components/footers/footer-01.json +5 -0
  115. data/spec/fixtures/test-theme/components/footers/footer-02.json +5 -0
  116. data/spec/fixtures/test-theme/components/headers/header-01.json +5 -0
  117. data/spec/fixtures/test-theme/components/headers/header-02.json +5 -0
  118. data/spec/fixtures/test-theme/components/landing-page-blocks/landing-page-01.json +5 -0
  119. data/spec/fixtures/test-theme/components/landing-page-blocks/landing-page-02.json +5 -0
  120. data/spec/fixtures/test-theme/manifest.json +8 -0
  121. data/spec/fixtures/test-theme/manifest.yml +6 -0
  122. data/spec/fixtures/test-theme/pages/page-01.json +11 -0
  123. data/spec/fixtures/test-theme/templates/footers/footer-01.html +3 -0
  124. data/spec/fixtures/test-theme/templates/footers/footer-02.html +3 -0
  125. data/spec/fixtures/test-theme/templates/headers/header-01.html +3 -0
  126. data/spec/fixtures/test-theme/templates/headers/header-02.html +3 -0
  127. data/spec/fixtures/test-theme/templates/landing-page-blocks/landing-page-block-01.html +3 -0
  128. data/spec/fixtures/test-theme/templates/landing-page-blocks/landing-page-block-02.html +3 -0
  129. data/spec/fixtures/test-theme/templates/layouts/standard-01.html +9 -0
  130. data/spec/lib/stylish/configuration_spec.rb +8 -0
  131. data/spec/lib/stylish/developer/path_spec.rb +36 -0
  132. data/spec/lib/stylish/developer/route_spec.rb +5 -0
  133. data/spec/lib/stylish/manifest_spec.rb +48 -0
  134. data/spec/lib/stylish/models/library_spec.rb +38 -0
  135. data/spec/lib/stylish/models/package_spec.rb +35 -0
  136. data/spec/lib/stylish/models_spec.rb +12 -0
  137. data/spec/spec_helper.rb +38 -0
  138. data/spec/support/json_helper.rb +7 -0
  139. data/spec/test.css.scss +6 -0
  140. data/stylish.gemspec +17 -2
  141. data/support/editor-app/.gitignore +2 -0
  142. data/support/editor-app/development/bower.json +9 -0
  143. data/support/editor-app/development/package.json +28 -0
  144. data/support/editor-app/development/semantic/components/accordion.css +257 -0
  145. data/support/editor-app/development/semantic/components/accordion.js +558 -0
  146. data/support/editor-app/development/semantic/components/accordion.min.css +11 -0
  147. data/support/editor-app/development/semantic/components/accordion.min.js +11 -0
  148. data/support/editor-app/development/semantic/components/ad.css +277 -0
  149. data/support/editor-app/development/semantic/components/ad.min.css +11 -0
  150. data/support/editor-app/development/semantic/components/api.js +851 -0
  151. data/support/editor-app/development/semantic/components/api.min.js +11 -0
  152. data/support/editor-app/development/semantic/components/breadcrumb.css +125 -0
  153. data/support/editor-app/development/semantic/components/breadcrumb.min.css +11 -0
  154. data/support/editor-app/development/semantic/components/button.css +2391 -0
  155. data/support/editor-app/development/semantic/components/button.min.css +11 -0
  156. data/support/editor-app/development/semantic/components/card.css +758 -0
  157. data/support/editor-app/development/semantic/components/card.min.css +11 -0
  158. data/support/editor-app/development/semantic/components/checkbox.css +514 -0
  159. data/support/editor-app/development/semantic/components/checkbox.js +507 -0
  160. data/support/editor-app/development/semantic/components/checkbox.min.css +11 -0
  161. data/support/editor-app/development/semantic/components/checkbox.min.js +11 -0
  162. data/support/editor-app/development/semantic/components/comment.css +260 -0
  163. data/support/editor-app/development/semantic/components/comment.min.css +11 -0
  164. data/support/editor-app/development/semantic/components/dimmer.css +187 -0
  165. data/support/editor-app/development/semantic/components/dimmer.js +627 -0
  166. data/support/editor-app/development/semantic/components/dimmer.min.css +11 -0
  167. data/support/editor-app/development/semantic/components/dimmer.min.js +11 -0
  168. data/support/editor-app/development/semantic/components/divider.css +244 -0
  169. data/support/editor-app/development/semantic/components/divider.min.css +11 -0
  170. data/support/editor-app/development/semantic/components/dropdown.css +1085 -0
  171. data/support/editor-app/development/semantic/components/dropdown.js +1757 -0
  172. data/support/editor-app/development/semantic/components/dropdown.min.css +11 -0
  173. data/support/editor-app/development/semantic/components/dropdown.min.js +11 -0
  174. data/support/editor-app/development/semantic/components/feed.css +277 -0
  175. data/support/editor-app/development/semantic/components/feed.min.css +11 -0
  176. data/support/editor-app/development/semantic/components/flag.css +1017 -0
  177. data/support/editor-app/development/semantic/components/flag.min.css +11 -0
  178. data/support/editor-app/development/semantic/components/form.css +875 -0
  179. data/support/editor-app/development/semantic/components/form.js +1039 -0
  180. data/support/editor-app/development/semantic/components/form.min.css +11 -0
  181. data/support/editor-app/development/semantic/components/form.min.js +11 -0
  182. data/support/editor-app/development/semantic/components/grid.css +1816 -0
  183. data/support/editor-app/development/semantic/components/grid.min.css +11 -0
  184. data/support/editor-app/development/semantic/components/header.css +572 -0
  185. data/support/editor-app/development/semantic/components/header.min.css +11 -0
  186. data/support/editor-app/development/semantic/components/icon.css +2127 -0
  187. data/support/editor-app/development/semantic/components/icon.min.css +11 -0
  188. data/support/editor-app/development/semantic/components/image.css +275 -0
  189. data/support/editor-app/development/semantic/components/image.min.css +11 -0
  190. data/support/editor-app/development/semantic/components/input.css +455 -0
  191. data/support/editor-app/development/semantic/components/input.min.css +11 -0
  192. data/support/editor-app/development/semantic/components/item.css +458 -0
  193. data/support/editor-app/development/semantic/components/item.min.css +11 -0
  194. data/support/editor-app/development/semantic/components/label.css +930 -0
  195. data/support/editor-app/development/semantic/components/label.min.css +11 -0
  196. data/support/editor-app/development/semantic/components/list.css +879 -0
  197. data/support/editor-app/development/semantic/components/list.min.css +11 -0
  198. data/support/editor-app/development/semantic/components/loader.css +279 -0
  199. data/support/editor-app/development/semantic/components/loader.min.css +11 -0
  200. data/support/editor-app/development/semantic/components/menu.css +1596 -0
  201. data/support/editor-app/development/semantic/components/menu.min.css +11 -0
  202. data/support/editor-app/development/semantic/components/message.css +422 -0
  203. data/support/editor-app/development/semantic/components/message.min.css +11 -0
  204. data/support/editor-app/development/semantic/components/modal.css +431 -0
  205. data/support/editor-app/development/semantic/components/modal.js +860 -0
  206. data/support/editor-app/development/semantic/components/modal.min.css +11 -0
  207. data/support/editor-app/development/semantic/components/modal.min.js +11 -0
  208. data/support/editor-app/development/semantic/components/nag.css +149 -0
  209. data/support/editor-app/development/semantic/components/nag.js +477 -0
  210. data/support/editor-app/development/semantic/components/nag.min.css +11 -0
  211. data/support/editor-app/development/semantic/components/nag.min.js +11 -0
  212. data/support/editor-app/development/semantic/components/popup.css +294 -0
  213. data/support/editor-app/development/semantic/components/popup.js +1187 -0
  214. data/support/editor-app/development/semantic/components/popup.min.css +11 -0
  215. data/support/editor-app/development/semantic/components/popup.min.js +11 -0
  216. data/support/editor-app/development/semantic/components/progress.css +449 -0
  217. data/support/editor-app/development/semantic/components/progress.js +785 -0
  218. data/support/editor-app/development/semantic/components/progress.min.css +11 -0
  219. data/support/editor-app/development/semantic/components/progress.min.js +11 -0
  220. data/support/editor-app/development/semantic/components/rail.css +125 -0
  221. data/support/editor-app/development/semantic/components/rail.min.css +11 -0
  222. data/support/editor-app/development/semantic/components/rating.css +262 -0
  223. data/support/editor-app/development/semantic/components/rating.js +451 -0
  224. data/support/editor-app/development/semantic/components/rating.min.css +11 -0
  225. data/support/editor-app/development/semantic/components/rating.min.js +11 -0
  226. data/support/editor-app/development/semantic/components/reset.css +430 -0
  227. data/support/editor-app/development/semantic/components/reset.min.css +11 -0
  228. data/support/editor-app/development/semantic/components/reveal.css +294 -0
  229. data/support/editor-app/development/semantic/components/reveal.min.css +11 -0
  230. data/support/editor-app/development/semantic/components/search.css +330 -0
  231. data/support/editor-app/development/semantic/components/search.js +1055 -0
  232. data/support/editor-app/development/semantic/components/search.min.css +11 -0
  233. data/support/editor-app/development/semantic/components/search.min.js +11 -0
  234. data/support/editor-app/development/semantic/components/segment.css +590 -0
  235. data/support/editor-app/development/semantic/components/segment.min.css +11 -0
  236. data/support/editor-app/development/semantic/components/shape.css +155 -0
  237. data/support/editor-app/development/semantic/components/shape.js +830 -0
  238. data/support/editor-app/development/semantic/components/shape.min.css +11 -0
  239. data/support/editor-app/development/semantic/components/shape.min.js +11 -0
  240. data/support/editor-app/development/semantic/components/sidebar.css +621 -0
  241. data/support/editor-app/development/semantic/components/sidebar.js +1084 -0
  242. data/support/editor-app/development/semantic/components/sidebar.min.css +11 -0
  243. data/support/editor-app/development/semantic/components/sidebar.min.js +11 -0
  244. data/support/editor-app/development/semantic/components/site.css +147 -0
  245. data/support/editor-app/development/semantic/components/site.js +487 -0
  246. data/support/editor-app/development/semantic/components/site.min.css +11 -0
  247. data/support/editor-app/development/semantic/components/site.min.js +11 -0
  248. data/support/editor-app/development/semantic/components/state.js +690 -0
  249. data/support/editor-app/development/semantic/components/state.min.js +11 -0
  250. data/support/editor-app/development/semantic/components/statistic.css +410 -0
  251. data/support/editor-app/development/semantic/components/statistic.min.css +11 -0
  252. data/support/editor-app/development/semantic/components/step.css +433 -0
  253. data/support/editor-app/development/semantic/components/step.min.css +11 -0
  254. data/support/editor-app/development/semantic/components/sticky.css +80 -0
  255. data/support/editor-app/development/semantic/components/sticky.js +775 -0
  256. data/support/editor-app/development/semantic/components/sticky.min.css +11 -0
  257. data/support/editor-app/development/semantic/components/sticky.min.js +11 -0
  258. data/support/editor-app/development/semantic/components/tab.css +93 -0
  259. data/support/editor-app/development/semantic/components/tab.js +787 -0
  260. data/support/editor-app/development/semantic/components/tab.min.css +11 -0
  261. data/support/editor-app/development/semantic/components/tab.min.js +11 -0
  262. data/support/editor-app/development/semantic/components/table.css +999 -0
  263. data/support/editor-app/development/semantic/components/table.min.css +11 -0
  264. data/support/editor-app/development/semantic/components/transition.css +2152 -0
  265. data/support/editor-app/development/semantic/components/transition.js +936 -0
  266. data/support/editor-app/development/semantic/components/transition.min.css +11 -0
  267. data/support/editor-app/development/semantic/components/transition.min.js +11 -0
  268. data/support/editor-app/development/semantic/components/video.css +126 -0
  269. data/support/editor-app/development/semantic/components/video.js +540 -0
  270. data/support/editor-app/development/semantic/components/video.min.css +11 -0
  271. data/support/editor-app/development/semantic/components/video.min.js +11 -0
  272. data/support/editor-app/development/semantic/components/visibility.js +970 -0
  273. data/support/editor-app/development/semantic/components/visibility.min.js +11 -0
  274. data/support/editor-app/development/semantic/semantic.css +31768 -0
  275. data/support/editor-app/development/semantic/semantic.js +18317 -0
  276. data/support/editor-app/development/semantic/semantic.min.css +11 -0
  277. data/support/editor-app/development/semantic/semantic.min.js +17 -0
  278. data/support/editor-app/development/semantic/themes/basic/assets/fonts/icons.eot +0 -0
  279. data/support/editor-app/development/semantic/themes/basic/assets/fonts/icons.svg +450 -0
  280. data/support/editor-app/development/semantic/themes/basic/assets/fonts/icons.ttf +0 -0
  281. data/support/editor-app/development/semantic/themes/basic/assets/fonts/icons.woff +0 -0
  282. data/support/editor-app/development/semantic/themes/default/assets/fonts/icons.eot +0 -0
  283. data/support/editor-app/development/semantic/themes/default/assets/fonts/icons.otf +0 -0
  284. data/support/editor-app/development/semantic/themes/default/assets/fonts/icons.svg +504 -0
  285. data/support/editor-app/development/semantic/themes/default/assets/fonts/icons.ttf +0 -0
  286. data/support/editor-app/development/semantic/themes/default/assets/fonts/icons.woff +0 -0
  287. data/support/editor-app/development/semantic/themes/default/assets/images/flags.png +0 -0
  288. data/support/editor-app/development/src/apis/index.coffee +35 -0
  289. data/support/editor-app/development/src/components/editor.cjsx +58 -0
  290. data/support/editor-app/development/src/components/editor_drawer.cjsx +7 -0
  291. data/support/editor-app/development/src/components/header.cjsx +12 -0
  292. data/support/editor-app/development/src/components/index.coffee +9 -0
  293. data/support/editor-app/development/src/components/menus/icon_grid.cjsx +0 -0
  294. data/support/editor-app/development/src/components/sidebar.cjsx +24 -0
  295. data/support/editor-app/development/src/components/tiled_grid.cjsx +35 -0
  296. data/support/editor-app/development/src/index.cjsx +82 -0
  297. data/support/editor-app/development/src/lib/util.coffee +48 -0
  298. data/support/editor-app/development/src/pages/home.cjsx +46 -0
  299. data/support/editor-app/development/src/pages/index.coffee +6 -0
  300. data/support/editor-app/development/src/pages/package_details.cjsx +55 -0
  301. data/support/editor-app/development/src/registry.coffee +35 -0
  302. data/support/editor-app/development/src/styles/components/tiled_grid.css.scss +5 -0
  303. data/support/editor-app/development/src/styles/index.css.scss +240 -0
  304. data/support/editor-app/development/src/sugar.cjsx +126 -0
  305. data/support/editor-app/development/webpack.config.js +53 -0
  306. data/support/editor-app/dist/base.css +0 -0
  307. data/support/editor-app/dist/toolit.js +62 -0
  308. data/support/editor-app/dist/toolkit.js +44573 -0
  309. data/support/editor-app/index.html +50 -0
  310. data/support/editor-app/package.json +15 -0
  311. data/support/editor-app/semantic/components/accordion.css +257 -0
  312. data/support/editor-app/semantic/components/accordion.js +558 -0
  313. data/support/editor-app/semantic/components/accordion.min.css +11 -0
  314. data/support/editor-app/semantic/components/accordion.min.js +11 -0
  315. data/support/editor-app/semantic/components/ad.css +277 -0
  316. data/support/editor-app/semantic/components/ad.min.css +11 -0
  317. data/support/editor-app/semantic/components/api.js +851 -0
  318. data/support/editor-app/semantic/components/api.min.js +11 -0
  319. data/support/editor-app/semantic/components/breadcrumb.css +125 -0
  320. data/support/editor-app/semantic/components/breadcrumb.min.css +11 -0
  321. data/support/editor-app/semantic/components/button.css +2391 -0
  322. data/support/editor-app/semantic/components/button.min.css +11 -0
  323. data/support/editor-app/semantic/components/card.css +758 -0
  324. data/support/editor-app/semantic/components/card.min.css +11 -0
  325. data/support/editor-app/semantic/components/checkbox.css +514 -0
  326. data/support/editor-app/semantic/components/checkbox.js +507 -0
  327. data/support/editor-app/semantic/components/checkbox.min.css +11 -0
  328. data/support/editor-app/semantic/components/checkbox.min.js +11 -0
  329. data/support/editor-app/semantic/components/comment.css +260 -0
  330. data/support/editor-app/semantic/components/comment.min.css +11 -0
  331. data/support/editor-app/semantic/components/dimmer.css +187 -0
  332. data/support/editor-app/semantic/components/dimmer.js +627 -0
  333. data/support/editor-app/semantic/components/dimmer.min.css +11 -0
  334. data/support/editor-app/semantic/components/dimmer.min.js +11 -0
  335. data/support/editor-app/semantic/components/divider.css +244 -0
  336. data/support/editor-app/semantic/components/divider.min.css +11 -0
  337. data/support/editor-app/semantic/components/dropdown.css +1085 -0
  338. data/support/editor-app/semantic/components/dropdown.js +1757 -0
  339. data/support/editor-app/semantic/components/dropdown.min.css +11 -0
  340. data/support/editor-app/semantic/components/dropdown.min.js +11 -0
  341. data/support/editor-app/semantic/components/feed.css +277 -0
  342. data/support/editor-app/semantic/components/feed.min.css +11 -0
  343. data/support/editor-app/semantic/components/flag.css +1017 -0
  344. data/support/editor-app/semantic/components/flag.min.css +11 -0
  345. data/support/editor-app/semantic/components/form.css +875 -0
  346. data/support/editor-app/semantic/components/form.js +1039 -0
  347. data/support/editor-app/semantic/components/form.min.css +11 -0
  348. data/support/editor-app/semantic/components/form.min.js +11 -0
  349. data/support/editor-app/semantic/components/grid.css +1816 -0
  350. data/support/editor-app/semantic/components/grid.min.css +11 -0
  351. data/support/editor-app/semantic/components/header.css +572 -0
  352. data/support/editor-app/semantic/components/header.min.css +11 -0
  353. data/support/editor-app/semantic/components/icon.css +2127 -0
  354. data/support/editor-app/semantic/components/icon.min.css +11 -0
  355. data/support/editor-app/semantic/components/image.css +275 -0
  356. data/support/editor-app/semantic/components/image.min.css +11 -0
  357. data/support/editor-app/semantic/components/input.css +455 -0
  358. data/support/editor-app/semantic/components/input.min.css +11 -0
  359. data/support/editor-app/semantic/components/item.css +458 -0
  360. data/support/editor-app/semantic/components/item.min.css +11 -0
  361. data/support/editor-app/semantic/components/label.css +930 -0
  362. data/support/editor-app/semantic/components/label.min.css +11 -0
  363. data/support/editor-app/semantic/components/list.css +879 -0
  364. data/support/editor-app/semantic/components/list.min.css +11 -0
  365. data/support/editor-app/semantic/components/loader.css +279 -0
  366. data/support/editor-app/semantic/components/loader.min.css +11 -0
  367. data/support/editor-app/semantic/components/menu.css +1596 -0
  368. data/support/editor-app/semantic/components/menu.min.css +11 -0
  369. data/support/editor-app/semantic/components/message.css +422 -0
  370. data/support/editor-app/semantic/components/message.min.css +11 -0
  371. data/support/editor-app/semantic/components/modal.css +431 -0
  372. data/support/editor-app/semantic/components/modal.js +860 -0
  373. data/support/editor-app/semantic/components/modal.min.css +11 -0
  374. data/support/editor-app/semantic/components/modal.min.js +11 -0
  375. data/support/editor-app/semantic/components/nag.css +149 -0
  376. data/support/editor-app/semantic/components/nag.js +477 -0
  377. data/support/editor-app/semantic/components/nag.min.css +11 -0
  378. data/support/editor-app/semantic/components/nag.min.js +11 -0
  379. data/support/editor-app/semantic/components/popup.css +294 -0
  380. data/support/editor-app/semantic/components/popup.js +1187 -0
  381. data/support/editor-app/semantic/components/popup.min.css +11 -0
  382. data/support/editor-app/semantic/components/popup.min.js +11 -0
  383. data/support/editor-app/semantic/components/progress.css +449 -0
  384. data/support/editor-app/semantic/components/progress.js +785 -0
  385. data/support/editor-app/semantic/components/progress.min.css +11 -0
  386. data/support/editor-app/semantic/components/progress.min.js +11 -0
  387. data/support/editor-app/semantic/components/rail.css +125 -0
  388. data/support/editor-app/semantic/components/rail.min.css +11 -0
  389. data/support/editor-app/semantic/components/rating.css +262 -0
  390. data/support/editor-app/semantic/components/rating.js +451 -0
  391. data/support/editor-app/semantic/components/rating.min.css +11 -0
  392. data/support/editor-app/semantic/components/rating.min.js +11 -0
  393. data/support/editor-app/semantic/components/reset.css +430 -0
  394. data/support/editor-app/semantic/components/reset.min.css +11 -0
  395. data/support/editor-app/semantic/components/reveal.css +294 -0
  396. data/support/editor-app/semantic/components/reveal.min.css +11 -0
  397. data/support/editor-app/semantic/components/search.css +330 -0
  398. data/support/editor-app/semantic/components/search.js +1055 -0
  399. data/support/editor-app/semantic/components/search.min.css +11 -0
  400. data/support/editor-app/semantic/components/search.min.js +11 -0
  401. data/support/editor-app/semantic/components/segment.css +590 -0
  402. data/support/editor-app/semantic/components/segment.min.css +11 -0
  403. data/support/editor-app/semantic/components/shape.css +155 -0
  404. data/support/editor-app/semantic/components/shape.js +830 -0
  405. data/support/editor-app/semantic/components/shape.min.css +11 -0
  406. data/support/editor-app/semantic/components/shape.min.js +11 -0
  407. data/support/editor-app/semantic/components/sidebar.css +621 -0
  408. data/support/editor-app/semantic/components/sidebar.js +1084 -0
  409. data/support/editor-app/semantic/components/sidebar.min.css +11 -0
  410. data/support/editor-app/semantic/components/sidebar.min.js +11 -0
  411. data/support/editor-app/semantic/components/site.css +147 -0
  412. data/support/editor-app/semantic/components/site.js +487 -0
  413. data/support/editor-app/semantic/components/site.min.css +11 -0
  414. data/support/editor-app/semantic/components/site.min.js +11 -0
  415. data/support/editor-app/semantic/components/state.js +690 -0
  416. data/support/editor-app/semantic/components/state.min.js +11 -0
  417. data/support/editor-app/semantic/components/statistic.css +410 -0
  418. data/support/editor-app/semantic/components/statistic.min.css +11 -0
  419. data/support/editor-app/semantic/components/step.css +433 -0
  420. data/support/editor-app/semantic/components/step.min.css +11 -0
  421. data/support/editor-app/semantic/components/sticky.css +80 -0
  422. data/support/editor-app/semantic/components/sticky.js +775 -0
  423. data/support/editor-app/semantic/components/sticky.min.css +11 -0
  424. data/support/editor-app/semantic/components/sticky.min.js +11 -0
  425. data/support/editor-app/semantic/components/tab.css +93 -0
  426. data/support/editor-app/semantic/components/tab.js +787 -0
  427. data/support/editor-app/semantic/components/tab.min.css +11 -0
  428. data/support/editor-app/semantic/components/tab.min.js +11 -0
  429. data/support/editor-app/semantic/components/table.css +999 -0
  430. data/support/editor-app/semantic/components/table.min.css +11 -0
  431. data/support/editor-app/semantic/components/transition.css +2152 -0
  432. data/support/editor-app/semantic/components/transition.js +936 -0
  433. data/support/editor-app/semantic/components/transition.min.css +11 -0
  434. data/support/editor-app/semantic/components/transition.min.js +11 -0
  435. data/support/editor-app/semantic/components/video.css +126 -0
  436. data/support/editor-app/semantic/components/video.js +540 -0
  437. data/support/editor-app/semantic/components/video.min.css +11 -0
  438. data/support/editor-app/semantic/components/video.min.js +11 -0
  439. data/support/editor-app/semantic/components/visibility.js +970 -0
  440. data/support/editor-app/semantic/components/visibility.min.js +11 -0
  441. data/support/editor-app/semantic/semantic.css +31768 -0
  442. data/support/editor-app/semantic/semantic.js +18317 -0
  443. data/support/editor-app/semantic/semantic.min.css +11 -0
  444. data/support/editor-app/semantic/semantic.min.js +17 -0
  445. data/support/editor-app/semantic/themes/basic/assets/fonts/icons.eot +0 -0
  446. data/support/editor-app/semantic/themes/basic/assets/fonts/icons.svg +450 -0
  447. data/support/editor-app/semantic/themes/basic/assets/fonts/icons.ttf +0 -0
  448. data/support/editor-app/semantic/themes/basic/assets/fonts/icons.woff +0 -0
  449. data/support/editor-app/semantic/themes/default/assets/fonts/icons.eot +0 -0
  450. data/support/editor-app/semantic/themes/default/assets/fonts/icons.otf +0 -0
  451. data/support/editor-app/semantic/themes/default/assets/fonts/icons.svg +504 -0
  452. data/support/editor-app/semantic/themes/default/assets/fonts/icons.ttf +0 -0
  453. data/support/editor-app/semantic/themes/default/assets/fonts/icons.woff +0 -0
  454. data/support/editor-app/semantic/themes/default/assets/images/flags.png +0 -0
  455. data/support/editor-app/vendor/jquery.js +8829 -0
  456. data/support/library-server/Gemfile +0 -0
  457. data/support/library-server/config.ru +4 -0
  458. metadata +740 -7
@@ -0,0 +1,1084 @@
1
+ /*
2
+ * # Semantic - Sidebar
3
+ * http://github.com/semantic-org/semantic-ui/
4
+ *
5
+ *
6
+ * Copyright 2014 Contributor
7
+ * Released under the MIT license
8
+ * http://opensource.org/licenses/MIT
9
+ *
10
+ */
11
+
12
+ ;(function ( $, window, document, undefined ) {
13
+
14
+ "use strict";
15
+
16
+ $.fn.sidebar = function(parameters) {
17
+ var
18
+ $allModules = $(this),
19
+ $window = $(window),
20
+ $document = $(document),
21
+ $html = $('html'),
22
+ $head = $('head'),
23
+
24
+ moduleSelector = $allModules.selector || '',
25
+
26
+ time = new Date().getTime(),
27
+ performance = [],
28
+
29
+ query = arguments[0],
30
+ methodInvoked = (typeof query == 'string'),
31
+ queryArguments = [].slice.call(arguments, 1),
32
+
33
+ requestAnimationFrame = window.requestAnimationFrame
34
+ || window.mozRequestAnimationFrame
35
+ || window.webkitRequestAnimationFrame
36
+ || window.msRequestAnimationFrame
37
+ || function(callback) { setTimeout(callback, 0); },
38
+
39
+ returnedValue
40
+ ;
41
+
42
+ $allModules
43
+ .each(function() {
44
+ var
45
+ settings = ( $.isPlainObject(parameters) )
46
+ ? $.extend(true, {}, $.fn.sidebar.settings, parameters)
47
+ : $.extend({}, $.fn.sidebar.settings),
48
+
49
+ selector = settings.selector,
50
+ className = settings.className,
51
+ namespace = settings.namespace,
52
+ regExp = settings.regExp,
53
+ error = settings.error,
54
+
55
+ eventNamespace = '.' + namespace,
56
+ moduleNamespace = 'module-' + namespace,
57
+
58
+ $module = $(this),
59
+ $context = $(settings.context),
60
+
61
+ $sidebars = $module.children(selector.sidebar),
62
+ $fixed = $context.children(selector.fixed),
63
+ $pusher = $context.children(selector.pusher),
64
+ $style,
65
+
66
+ element = this,
67
+ instance = $module.data(moduleNamespace),
68
+
69
+ elementNamespace,
70
+ id,
71
+ currentScroll,
72
+ transitionEvent,
73
+
74
+ module
75
+ ;
76
+
77
+ module = {
78
+
79
+ initialize: function() {
80
+ module.debug('Initializing sidebar', parameters);
81
+
82
+ module.create.id();
83
+
84
+ transitionEvent = module.get.transitionEvent();
85
+
86
+ // cache on initialize
87
+ if( ( settings.useLegacy == 'auto' && module.is.legacy() ) || settings.useLegacy === true) {
88
+ settings.transition = 'overlay';
89
+ settings.useLegacy = true;
90
+ }
91
+
92
+ if(module.is.ios()) {
93
+ module.set.ios();
94
+ }
95
+
96
+ // avoids locking rendering if initialized in onReady
97
+ if(settings.delaySetup) {
98
+ requestAnimationFrame(module.setup.layout);
99
+ }
100
+ else {
101
+ module.setup.layout();
102
+ }
103
+
104
+ module.instantiate();
105
+ },
106
+
107
+ instantiate: function() {
108
+ module.verbose('Storing instance of module', module);
109
+ instance = module;
110
+ $module
111
+ .data(moduleNamespace, module)
112
+ ;
113
+ },
114
+
115
+ create: {
116
+ id: function() {
117
+ module.verbose('Creating unique id for element');
118
+ id = module.get.uniqueID();
119
+ elementNamespace = '.' + id;
120
+ }
121
+ },
122
+
123
+ destroy: function() {
124
+ module.verbose('Destroying previous module for', $module);
125
+ module.remove.direction();
126
+ $module
127
+ .off(eventNamespace)
128
+ .removeData(moduleNamespace)
129
+ ;
130
+ // bound by uuid
131
+ $context.off(elementNamespace);
132
+ $window.off(elementNamespace);
133
+ $document.off(elementNamespace);
134
+ },
135
+
136
+ event: {
137
+ clickaway: function(event) {
138
+ var
139
+ clickedInPusher = ($pusher.find(event.target).length > 0 || $pusher.is(event.target)),
140
+ clickedContext = ($context.is(event.target))
141
+ ;
142
+ if(clickedInPusher) {
143
+ module.verbose('User clicked on dimmed page');
144
+ module.hide();
145
+ }
146
+ if(clickedContext) {
147
+ module.verbose('User clicked on dimmable context (scaled out page)');
148
+ module.hide();
149
+ }
150
+ },
151
+ touch: function(event) {
152
+ //event.stopPropagation();
153
+ },
154
+ containScroll: function(event) {
155
+ if(element.scrollTop <= 0) {
156
+ element.scrollTop = 1;
157
+ }
158
+ if((element.scrollTop + element.offsetHeight) >= element.scrollHeight) {
159
+ element.scrollTop = element.scrollHeight - element.offsetHeight - 1;
160
+ }
161
+ },
162
+ scroll: function(event) {
163
+ if( $(event.target).closest(selector.sidebar).length === 0 ) {
164
+ event.preventDefault();
165
+ }
166
+ }
167
+ },
168
+
169
+ bind: {
170
+ clickaway: function() {
171
+ module.verbose('Adding clickaway events to context', $context);
172
+ if(settings.closable) {
173
+ $context
174
+ .on('click' + elementNamespace, module.event.clickaway)
175
+ .on('touchend' + elementNamespace, module.event.clickaway)
176
+ ;
177
+ }
178
+ },
179
+ scrollLock: function() {
180
+ if(settings.scrollLock) {
181
+ module.debug('Disabling page scroll');
182
+ $window
183
+ .on('DOMMouseScroll' + elementNamespace, module.event.scroll)
184
+ ;
185
+ }
186
+ module.verbose('Adding events to contain sidebar scroll');
187
+ $document
188
+ .on('touchmove' + elementNamespace, module.event.touch)
189
+ ;
190
+ $module
191
+ .on('scroll' + eventNamespace, module.event.containScroll)
192
+ ;
193
+ }
194
+ },
195
+ unbind: {
196
+ clickaway: function() {
197
+ module.verbose('Removing clickaway events from context', $context);
198
+ $context.off(elementNamespace);
199
+ },
200
+ scrollLock: function() {
201
+ module.verbose('Removing scroll lock from page');
202
+ $document.off(elementNamespace);
203
+ $window.off(elementNamespace);
204
+ $module.off('scroll' + eventNamespace);
205
+ }
206
+ },
207
+
208
+ add: {
209
+ bodyCSS: function() {
210
+ var
211
+ width = $module.outerWidth(),
212
+ height = $module.outerHeight(),
213
+ direction = module.get.direction(),
214
+ distance = {
215
+ left : width,
216
+ right : -width,
217
+ top : height,
218
+ bottom : -height
219
+ },
220
+ style
221
+ ;
222
+ if( module.is.rtl() ){
223
+ module.verbose('RTL detected, flipping widths');
224
+ distance.left = -width;
225
+ distance.right = width;
226
+ }
227
+
228
+ style = '<style title="' + namespace + '">';
229
+
230
+ if(direction === 'left' || direction === 'right') {
231
+ module.debug('Adding CSS rules for animation distance', width);
232
+ style += ''
233
+ + ' .ui.visible.' + direction + '.sidebar ~ .fixed,'
234
+ + ' .ui.visible.' + direction + '.sidebar ~ .pusher {'
235
+ + ' -webkit-transform: translate3d('+ distance[direction] + 'px, 0, 0);'
236
+ + ' transform: translate3d('+ distance[direction] + 'px, 0, 0);'
237
+ + ' }'
238
+ ;
239
+ }
240
+ else if(direction === 'top' || direction == 'bottom') {
241
+ style += ''
242
+ + ' .ui.visible.' + direction + '.sidebar ~ .fixed,'
243
+ + ' .ui.visible.' + direction + '.sidebar ~ .pusher {'
244
+ + ' -webkit-transform: translate3d(0, ' + distance[direction] + 'px, 0);'
245
+ + ' transform: translate3d(0, ' + distance[direction] + 'px, 0);'
246
+ + ' }'
247
+ ;
248
+ }
249
+
250
+ /* IE is only browser not to create context with transforms */
251
+ /* https://www.w3.org/Bugs/Public/show_bug.cgi?id=16328 */
252
+ if( module.is.ie() ) {
253
+ if(direction === 'left' || direction === 'right') {
254
+ module.debug('Adding CSS rules for animation distance', width);
255
+ style += ''
256
+ + ' .ui.visible.' + direction + '.sidebar ~ .pusher:after {'
257
+ + ' -webkit-transform: translate3d('+ distance[direction] + 'px, 0, 0);'
258
+ + ' transform: translate3d('+ distance[direction] + 'px, 0, 0);'
259
+ + ' }'
260
+ ;
261
+ }
262
+ else if(direction === 'top' || direction == 'bottom') {
263
+ style += ''
264
+ + ' .ui.visible.' + direction + '.sidebar ~ .pusher:after {'
265
+ + ' -webkit-transform: translate3d(0, ' + distance[direction] + 'px, 0);'
266
+ + ' transform: translate3d(0, ' + distance[direction] + 'px, 0);'
267
+ + ' }'
268
+ ;
269
+ }
270
+ /* opposite sides visible forces content overlay */
271
+ style += ''
272
+ + ' .ui.visible.left.sidebar ~ .ui.visible.right.sidebar ~ .pusher:after,'
273
+ + ' .ui.visible.right.sidebar ~ .ui.visible.left.sidebar ~ .pusher:after {'
274
+ + ' -webkit-transform: translate3d(0px, 0, 0);'
275
+ + ' transform: translate3d(0px, 0, 0);'
276
+ + ' }'
277
+ ;
278
+ }
279
+ style += '</style>';
280
+ $head.append(style);
281
+ $style = $('style[title=' + namespace + ']');
282
+ module.debug('Adding sizing css to head', $style);
283
+ }
284
+ },
285
+
286
+ refresh: function() {
287
+ module.verbose('Refreshing selector cache');
288
+ $context = $(settings.context);
289
+ $sidebars = $context.children(selector.sidebar);
290
+ $pusher = $context.children(selector.pusher);
291
+ $fixed = $context.children(selector.fixed);
292
+ },
293
+
294
+ refreshSidebars: function() {
295
+ module.verbose('Refreshing other sidebars');
296
+ $sidebars = $context.children(selector.sidebar);
297
+ },
298
+
299
+ repaint: function() {
300
+ module.verbose('Forcing repaint event');
301
+ element.style.display='none';
302
+ element.offsetHeight;
303
+ element.scrollTop = element.scrollTop;
304
+ element.style.display='';
305
+ },
306
+
307
+ setup: {
308
+ layout: function() {
309
+ if( $context.children(selector.pusher).length === 0 ) {
310
+ module.debug('Adding wrapper element for sidebar');
311
+ module.error(error.pusher);
312
+ $pusher = $('<div class="pusher" />');
313
+ $context
314
+ .children()
315
+ .not(selector.omitted)
316
+ .not($sidebars)
317
+ .wrapAll($pusher)
318
+ ;
319
+ module.refresh();
320
+ }
321
+ if($module.nextAll(selector.pusher).length === 0 || $module.nextAll(selector.pusher)[0] !== $pusher[0]) {
322
+ module.debug('Moved sidebar to correct parent element');
323
+ module.error(error.movedSidebar, element);
324
+ $module.detach().prependTo($context);
325
+ module.refresh();
326
+ }
327
+ module.set.pushable();
328
+ module.set.direction();
329
+ }
330
+ },
331
+
332
+ attachEvents: function(selector, event) {
333
+ var
334
+ $toggle = $(selector)
335
+ ;
336
+ event = $.isFunction(module[event])
337
+ ? module[event]
338
+ : module.toggle
339
+ ;
340
+ if($toggle.length > 0) {
341
+ module.debug('Attaching sidebar events to element', selector, event);
342
+ $toggle
343
+ .on('click' + eventNamespace, event)
344
+ ;
345
+ }
346
+ else {
347
+ module.error(error.notFound, selector);
348
+ }
349
+ },
350
+
351
+ show: function(callback) {
352
+ var
353
+ animateMethod = (settings.useLegacy === true)
354
+ ? module.legacyPushPage
355
+ : module.pushPage
356
+ ;
357
+ callback = $.isFunction(callback)
358
+ ? callback
359
+ : function(){}
360
+ ;
361
+ if(module.is.hidden()) {
362
+ module.refreshSidebars();
363
+ if(settings.overlay) {
364
+ module.error(error.overlay);
365
+ settings.transition = 'overlay';
366
+ }
367
+ module.refresh();
368
+ if(module.othersActive() && module.get.transition() !== 'overlay') {
369
+ module.debug('Other sidebars currently visible');
370
+ settings.transition = 'overlay';
371
+ if(settings.exclusive) {
372
+ module.hideOthers();
373
+ }
374
+ }
375
+ animateMethod(function() {
376
+ callback.call(element);
377
+ settings.onShow.call(element);
378
+ });
379
+ settings.onChange.call(element);
380
+ settings.onVisible.call(element);
381
+ }
382
+ else {
383
+ module.debug('Sidebar is already visible');
384
+ }
385
+ },
386
+
387
+ hide: function(callback) {
388
+ var
389
+ animateMethod = (settings.useLegacy === true)
390
+ ? module.legacyPullPage
391
+ : module.pullPage
392
+ ;
393
+ callback = $.isFunction(callback)
394
+ ? callback
395
+ : function(){}
396
+ ;
397
+ if(module.is.visible() || module.is.animating()) {
398
+ module.debug('Hiding sidebar', callback);
399
+ module.refreshSidebars();
400
+ animateMethod(function() {
401
+ callback.call(element);
402
+ settings.onHidden.call(element);
403
+ });
404
+ settings.onChange.call(element);
405
+ settings.onHide.call(element);
406
+ }
407
+ },
408
+
409
+ othersAnimating: function() {
410
+ return ($sidebars.not($module).filter('.' + className.animating).length > 0);
411
+ },
412
+ othersVisible: function() {
413
+ return ($sidebars.not($module).filter('.' + className.visible).length > 0);
414
+ },
415
+ othersActive: function() {
416
+ return(module.othersVisible() || module.othersAnimating());
417
+ },
418
+
419
+ hideOthers: function(callback) {
420
+ var
421
+ $otherSidebars = $sidebars.not($module).filter('.' + className.visible),
422
+ sidebarCount = $otherSidebars.length,
423
+ callbackCount = 0
424
+ ;
425
+ callback = callback || function(){};
426
+
427
+ $otherSidebars
428
+ .sidebar('hide', function() {
429
+ callbackCount++;
430
+ if(callbackCount == sidebarCount) {
431
+ callback();
432
+ }
433
+ })
434
+ ;
435
+ },
436
+
437
+ toggle: function() {
438
+ module.verbose('Determining toggled direction');
439
+ if(module.is.hidden()) {
440
+ module.show();
441
+ }
442
+ else {
443
+ module.hide();
444
+ }
445
+ },
446
+
447
+ pushPage: function(callback) {
448
+ var
449
+ transition = module.get.transition(),
450
+ $transition = (transition == 'safe')
451
+ ? $context
452
+ : (transition === 'overlay' || module.othersActive())
453
+ ? $module
454
+ : $pusher,
455
+ animate,
456
+ transitionEnd
457
+ ;
458
+ callback = $.isFunction(callback)
459
+ ? callback
460
+ : function(){}
461
+ ;
462
+ if(settings.transition == 'scale down') {
463
+ module.scrollToTop();
464
+ }
465
+ module.set.transition(transition);
466
+ module.repaint();
467
+ animate = function() {
468
+ module.bind.clickaway();
469
+ module.add.bodyCSS();
470
+ module.set.animating();
471
+ module.set.visible();
472
+ if(!module.othersVisible()) {
473
+ if(settings.dimPage) {
474
+ $pusher.addClass(className.dimmed);
475
+ }
476
+ }
477
+ };
478
+ transitionEnd = function(event) {
479
+ if( event.target == $transition[0] ) {
480
+ $transition.off(transitionEvent + elementNamespace, transitionEnd);
481
+ module.remove.animating();
482
+ module.bind.scrollLock();
483
+ callback.call(element);
484
+ }
485
+ };
486
+ $transition.off(transitionEvent + elementNamespace);
487
+ $transition.on(transitionEvent + elementNamespace, transitionEnd);
488
+ requestAnimationFrame(animate);
489
+ },
490
+
491
+ pullPage: function(callback) {
492
+ var
493
+ transition = module.get.transition(),
494
+ $transition = (transition == 'safe')
495
+ ? $context
496
+ : (transition == 'overlay' || module.othersActive())
497
+ ? $module
498
+ : $pusher,
499
+ animate,
500
+ transitionEnd
501
+ ;
502
+ callback = $.isFunction(callback)
503
+ ? callback
504
+ : function(){}
505
+ ;
506
+ module.verbose('Removing context push state', module.get.direction());
507
+
508
+ module.set.transition(transition);
509
+ module.unbind.clickaway();
510
+ module.unbind.scrollLock();
511
+
512
+ animate = function() {
513
+ module.set.animating();
514
+ module.remove.visible();
515
+ if(settings.dimPage && !module.othersVisible()) {
516
+ $pusher.removeClass(className.dimmed);
517
+ }
518
+ };
519
+ transitionEnd = function(event) {
520
+ if( event.target == $transition[0] ) {
521
+ $transition.off(transitionEvent + elementNamespace, transitionEnd);
522
+ module.remove.animating();
523
+ module.remove.transition();
524
+ module.remove.bodyCSS();
525
+ if(transition == 'scale down' || (settings.returnScroll && module.is.mobile()) ) {
526
+ module.scrollBack();
527
+ }
528
+ callback.call(element);
529
+ }
530
+ };
531
+ $transition.off(transitionEvent + elementNamespace);
532
+ $transition.on(transitionEvent + elementNamespace, transitionEnd);
533
+ requestAnimationFrame(animate);
534
+ },
535
+
536
+ legacyPushPage: function(callback) {
537
+ var
538
+ distance = $module.width(),
539
+ direction = module.get.direction(),
540
+ properties = {}
541
+ ;
542
+ distance = distance || $module.width();
543
+ callback = $.isFunction(callback)
544
+ ? callback
545
+ : function(){}
546
+ ;
547
+ properties[direction] = distance;
548
+ module.debug('Using javascript to push context', properties);
549
+ module.set.visible();
550
+ module.set.transition();
551
+ module.set.animating();
552
+ if(settings.dimPage) {
553
+ $pusher.addClass(className.dimmed);
554
+ }
555
+ $context
556
+ .css('position', 'relative')
557
+ .animate(properties, settings.duration, settings.easing, function() {
558
+ module.remove.animating();
559
+ module.bind.clickaway();
560
+ callback.call(element);
561
+ })
562
+ ;
563
+ },
564
+ legacyPullPage: function(callback) {
565
+ var
566
+ distance = 0,
567
+ direction = module.get.direction(),
568
+ properties = {}
569
+ ;
570
+ distance = distance || $module.width();
571
+ callback = $.isFunction(callback)
572
+ ? callback
573
+ : function(){}
574
+ ;
575
+ properties[direction] = '0px';
576
+ module.debug('Using javascript to pull context', properties);
577
+ module.unbind.clickaway();
578
+ module.set.animating();
579
+ module.remove.visible();
580
+ if(settings.dimPage && !module.othersActive()) {
581
+ $pusher.removeClass(className.dimmed);
582
+ }
583
+ $context
584
+ .css('position', 'relative')
585
+ .animate(properties, settings.duration, settings.easing, function() {
586
+ module.remove.animating();
587
+ callback.call(element);
588
+ })
589
+ ;
590
+ },
591
+
592
+ scrollToTop: function() {
593
+ module.verbose('Scrolling to top of page to avoid animation issues');
594
+ currentScroll = $(window).scrollTop();
595
+ $module.scrollTop(0);
596
+ window.scrollTo(0, 0);
597
+ },
598
+
599
+ scrollBack: function() {
600
+ module.verbose('Scrolling back to original page position');
601
+ window.scrollTo(0, currentScroll);
602
+ },
603
+
604
+ set: {
605
+ // html
606
+ ios: function() {
607
+ $html.addClass(className.ios);
608
+ },
609
+
610
+ // container
611
+ pushed: function() {
612
+ $context.addClass(className.pushed);
613
+ },
614
+ pushable: function() {
615
+ $context.addClass(className.pushable);
616
+ },
617
+
618
+ // sidebar
619
+ active: function() {
620
+ $module.addClass(className.active);
621
+ },
622
+ animating: function() {
623
+ $module.addClass(className.animating);
624
+ },
625
+ transition: function(transition) {
626
+ transition = transition || module.get.transition();
627
+ $module.addClass(transition);
628
+ },
629
+ direction: function(direction) {
630
+ direction = direction || module.get.direction();
631
+ $module.addClass(className[direction]);
632
+ },
633
+ visible: function() {
634
+ $module.addClass(className.visible);
635
+ },
636
+ overlay: function() {
637
+ $module.addClass(className.overlay);
638
+ }
639
+ },
640
+ remove: {
641
+
642
+ bodyCSS: function() {
643
+ module.debug('Removing body css styles', $style);
644
+ if($style && $style.length > 0) {
645
+ $style.remove();
646
+ }
647
+ },
648
+
649
+ // context
650
+ pushed: function() {
651
+ $context.removeClass(className.pushed);
652
+ },
653
+ pushable: function() {
654
+ $context.removeClass(className.pushable);
655
+ },
656
+
657
+ // sidebar
658
+ active: function() {
659
+ $module.removeClass(className.active);
660
+ },
661
+ animating: function() {
662
+ $module.removeClass(className.animating);
663
+ },
664
+ transition: function(transition) {
665
+ transition = transition || module.get.transition();
666
+ $module.removeClass(transition);
667
+ },
668
+ direction: function(direction) {
669
+ direction = direction || module.get.direction();
670
+ $module.removeClass(className[direction]);
671
+ },
672
+ visible: function() {
673
+ $module.removeClass(className.visible);
674
+ },
675
+ overlay: function() {
676
+ $module.removeClass(className.overlay);
677
+ }
678
+ },
679
+
680
+ get: {
681
+ direction: function() {
682
+ if($module.hasClass(className.top)) {
683
+ return className.top;
684
+ }
685
+ else if($module.hasClass(className.right)) {
686
+ return className.right;
687
+ }
688
+ else if($module.hasClass(className.bottom)) {
689
+ return className.bottom;
690
+ }
691
+ return className.left;
692
+ },
693
+ transition: function() {
694
+ var
695
+ direction = module.get.direction(),
696
+ transition
697
+ ;
698
+ transition = ( module.is.mobile() )
699
+ ? (settings.mobileTransition == 'auto')
700
+ ? settings.defaultTransition.mobile[direction]
701
+ : settings.mobileTransition
702
+ : (settings.transition == 'auto')
703
+ ? settings.defaultTransition.computer[direction]
704
+ : settings.transition
705
+ ;
706
+ module.verbose('Determined transition', transition);
707
+ return transition;
708
+ },
709
+ transitionEvent: function() {
710
+ var
711
+ element = document.createElement('element'),
712
+ transitions = {
713
+ 'transition' :'transitionend',
714
+ 'OTransition' :'oTransitionEnd',
715
+ 'MozTransition' :'transitionend',
716
+ 'WebkitTransition' :'webkitTransitionEnd'
717
+ },
718
+ transition
719
+ ;
720
+ for(transition in transitions){
721
+ if( element.style[transition] !== undefined ){
722
+ return transitions[transition];
723
+ }
724
+ }
725
+ },
726
+ uniqueID: function() {
727
+ return (Math.random().toString(16) + '000000000').substr(2,8);
728
+ }
729
+ },
730
+
731
+ is: {
732
+
733
+ ie: function() {
734
+ var
735
+ isIE11 = (!(window.ActiveXObject) && 'ActiveXObject' in window),
736
+ isIE = ('ActiveXObject' in window)
737
+ ;
738
+ return (isIE11 || isIE);
739
+ },
740
+
741
+ legacy: function() {
742
+ var
743
+ element = document.createElement('div'),
744
+ transforms = {
745
+ 'webkitTransform' :'-webkit-transform',
746
+ 'OTransform' :'-o-transform',
747
+ 'msTransform' :'-ms-transform',
748
+ 'MozTransform' :'-moz-transform',
749
+ 'transform' :'transform'
750
+ },
751
+ has3D
752
+ ;
753
+
754
+ // Add it to the body to get the computed style.
755
+ document.body.insertBefore(element, null);
756
+ for (var transform in transforms) {
757
+ if (element.style[transform] !== undefined) {
758
+ element.style[transform] = "translate3d(1px,1px,1px)";
759
+ has3D = window.getComputedStyle(element).getPropertyValue(transforms[transform]);
760
+ }
761
+ }
762
+ document.body.removeChild(element);
763
+ return !(has3D !== undefined && has3D.length > 0 && has3D !== 'none');
764
+ },
765
+ ios: function() {
766
+ var
767
+ userAgent = navigator.userAgent,
768
+ isIOS = userAgent.match(regExp.ios)
769
+ ;
770
+ if(isIOS) {
771
+ module.verbose('Browser was found to be iOS', userAgent);
772
+ return true;
773
+ }
774
+ else {
775
+ return false;
776
+ }
777
+ },
778
+ mobile: function() {
779
+ var
780
+ userAgent = navigator.userAgent,
781
+ isMobile = userAgent.match(regExp.mobile)
782
+ ;
783
+ if(isMobile) {
784
+ module.verbose('Browser was found to be mobile', userAgent);
785
+ return true;
786
+ }
787
+ else {
788
+ module.verbose('Browser is not mobile, using regular transition', userAgent);
789
+ return false;
790
+ }
791
+ },
792
+ hidden: function() {
793
+ return !module.is.visible();
794
+ },
795
+ visible: function() {
796
+ return $module.hasClass(className.visible);
797
+ },
798
+ // alias
799
+ open: function() {
800
+ return module.is.visible();
801
+ },
802
+ closed: function() {
803
+ return module.is.hidden();
804
+ },
805
+ vertical: function() {
806
+ return $module.hasClass(className.top);
807
+ },
808
+ animating: function() {
809
+ return $context.hasClass(className.animating);
810
+ },
811
+ rtl: function () {
812
+ return $module.css('direction') == 'rtl';
813
+ }
814
+ },
815
+
816
+ setting: function(name, value) {
817
+ module.debug('Changing setting', name, value);
818
+ if( $.isPlainObject(name) ) {
819
+ $.extend(true, settings, name);
820
+ }
821
+ else if(value !== undefined) {
822
+ settings[name] = value;
823
+ }
824
+ else {
825
+ return settings[name];
826
+ }
827
+ },
828
+ internal: function(name, value) {
829
+ if( $.isPlainObject(name) ) {
830
+ $.extend(true, module, name);
831
+ }
832
+ else if(value !== undefined) {
833
+ module[name] = value;
834
+ }
835
+ else {
836
+ return module[name];
837
+ }
838
+ },
839
+ debug: function() {
840
+ if(settings.debug) {
841
+ if(settings.performance) {
842
+ module.performance.log(arguments);
843
+ }
844
+ else {
845
+ module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
846
+ module.debug.apply(console, arguments);
847
+ }
848
+ }
849
+ },
850
+ verbose: function() {
851
+ if(settings.verbose && settings.debug) {
852
+ if(settings.performance) {
853
+ module.performance.log(arguments);
854
+ }
855
+ else {
856
+ module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
857
+ module.verbose.apply(console, arguments);
858
+ }
859
+ }
860
+ },
861
+ error: function() {
862
+ module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
863
+ module.error.apply(console, arguments);
864
+ },
865
+ performance: {
866
+ log: function(message) {
867
+ var
868
+ currentTime,
869
+ executionTime,
870
+ previousTime
871
+ ;
872
+ if(settings.performance) {
873
+ currentTime = new Date().getTime();
874
+ previousTime = time || currentTime;
875
+ executionTime = currentTime - previousTime;
876
+ time = currentTime;
877
+ performance.push({
878
+ 'Name' : message[0],
879
+ 'Arguments' : [].slice.call(message, 1) || '',
880
+ 'Element' : element,
881
+ 'Execution Time' : executionTime
882
+ });
883
+ }
884
+ clearTimeout(module.performance.timer);
885
+ module.performance.timer = setTimeout(module.performance.display, 100);
886
+ },
887
+ display: function() {
888
+ var
889
+ title = settings.name + ':',
890
+ totalTime = 0
891
+ ;
892
+ time = false;
893
+ clearTimeout(module.performance.timer);
894
+ $.each(performance, function(index, data) {
895
+ totalTime += data['Execution Time'];
896
+ });
897
+ title += ' ' + totalTime + 'ms';
898
+ if(moduleSelector) {
899
+ title += ' \'' + moduleSelector + '\'';
900
+ }
901
+ if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
902
+ console.groupCollapsed(title);
903
+ if(console.table) {
904
+ console.table(performance);
905
+ }
906
+ else {
907
+ $.each(performance, function(index, data) {
908
+ console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
909
+ });
910
+ }
911
+ console.groupEnd();
912
+ }
913
+ performance = [];
914
+ }
915
+ },
916
+ invoke: function(query, passedArguments, context) {
917
+ var
918
+ object = instance,
919
+ maxDepth,
920
+ found,
921
+ response
922
+ ;
923
+ passedArguments = passedArguments || queryArguments;
924
+ context = element || context;
925
+ if(typeof query == 'string' && object !== undefined) {
926
+ query = query.split(/[\. ]/);
927
+ maxDepth = query.length - 1;
928
+ $.each(query, function(depth, value) {
929
+ var camelCaseValue = (depth != maxDepth)
930
+ ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
931
+ : query
932
+ ;
933
+ if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
934
+ object = object[camelCaseValue];
935
+ }
936
+ else if( object[camelCaseValue] !== undefined ) {
937
+ found = object[camelCaseValue];
938
+ return false;
939
+ }
940
+ else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
941
+ object = object[value];
942
+ }
943
+ else if( object[value] !== undefined ) {
944
+ found = object[value];
945
+ return false;
946
+ }
947
+ else {
948
+ module.error(error.method, query);
949
+ return false;
950
+ }
951
+ });
952
+ }
953
+ if ( $.isFunction( found ) ) {
954
+ response = found.apply(context, passedArguments);
955
+ }
956
+ else if(found !== undefined) {
957
+ response = found;
958
+ }
959
+ if($.isArray(returnedValue)) {
960
+ returnedValue.push(response);
961
+ }
962
+ else if(returnedValue !== undefined) {
963
+ returnedValue = [returnedValue, response];
964
+ }
965
+ else if(response !== undefined) {
966
+ returnedValue = response;
967
+ }
968
+ return found;
969
+ }
970
+ }
971
+ ;
972
+
973
+ if(methodInvoked) {
974
+ if(instance === undefined) {
975
+ module.initialize();
976
+ }
977
+ module.invoke(query);
978
+ }
979
+ else {
980
+ if(instance !== undefined) {
981
+ module.invoke('destroy');
982
+ }
983
+ module.initialize();
984
+ }
985
+ });
986
+
987
+ return (returnedValue !== undefined)
988
+ ? returnedValue
989
+ : this
990
+ ;
991
+ };
992
+
993
+ $.fn.sidebar.settings = {
994
+
995
+ name : 'Sidebar',
996
+ namespace : 'sidebar',
997
+
998
+ debug : false,
999
+ verbose : true,
1000
+ performance : true,
1001
+
1002
+ transition : 'auto',
1003
+ mobileTransition : 'auto',
1004
+
1005
+ defaultTransition : {
1006
+ computer: {
1007
+ left : 'uncover',
1008
+ right : 'uncover',
1009
+ top : 'overlay',
1010
+ bottom : 'overlay'
1011
+ },
1012
+ mobile: {
1013
+ left : 'uncover',
1014
+ right : 'uncover',
1015
+ top : 'overlay',
1016
+ bottom : 'overlay'
1017
+ }
1018
+ },
1019
+
1020
+ context : 'body',
1021
+ exclusive : false,
1022
+ closable : true,
1023
+ dimPage : true,
1024
+ scrollLock : false,
1025
+ returnScroll : false,
1026
+ delaySetup : false,
1027
+
1028
+ useLegacy : 'auto',
1029
+ duration : 500,
1030
+ easing : 'easeInOutQuint',
1031
+
1032
+ onChange : function(){},
1033
+ onShow : function(){},
1034
+ onHide : function(){},
1035
+
1036
+ onHidden : function(){},
1037
+ onVisible : function(){},
1038
+
1039
+ className : {
1040
+ active : 'active',
1041
+ animating : 'animating',
1042
+ dimmed : 'dimmed',
1043
+ ios : 'ios',
1044
+ pushable : 'pushable',
1045
+ pushed : 'pushed',
1046
+ right : 'right',
1047
+ top : 'top',
1048
+ left : 'left',
1049
+ bottom : 'bottom',
1050
+ visible : 'visible'
1051
+ },
1052
+
1053
+ selector: {
1054
+ fixed : '.fixed',
1055
+ omitted : 'script, link, style, .ui.modal, .ui.dimmer, .ui.nag, .ui.fixed',
1056
+ pusher : '.pusher',
1057
+ sidebar : '.ui.sidebar'
1058
+ },
1059
+
1060
+ regExp: {
1061
+ ios : /(iPad|iPhone|iPod)/g,
1062
+ mobile : /Mobile|iP(hone|od|ad)|Android|BlackBerry|IEMobile|Kindle|NetFront|Silk-Accelerated|(hpw|web)OS|Fennec|Minimo|Opera M(obi|ini)|Blazer|Dolfin|Dolphin|Skyfire|Zune/g
1063
+ },
1064
+
1065
+ error : {
1066
+ method : 'The method you called is not defined.',
1067
+ pusher : 'Had to add pusher element. For optimal performance make sure body content is inside a pusher element',
1068
+ movedSidebar : 'Had to move sidebar. For optimal performance make sure sidebar and pusher are direct children of your body tag',
1069
+ overlay : 'The overlay setting is no longer supported, use animation: overlay',
1070
+ notFound : 'There were no elements that matched the specified selector'
1071
+ }
1072
+
1073
+ };
1074
+
1075
+ // Adds easing
1076
+ $.extend( $.easing, {
1077
+ easeInOutQuint: function (x, t, b, c, d) {
1078
+ if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
1079
+ return c/2*((t-=2)*t*t*t*t + 2) + b;
1080
+ }
1081
+ });
1082
+
1083
+
1084
+ })( jQuery, window , document );