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,11 @@
1
+ /*
2
+ * # Semantic UI - 1.8.1
3
+ * https://github.com/Semantic-Org/Semantic-UI
4
+ * http://www.semantic-ui.com/
5
+ *
6
+ * Copyright 2014 Contributors
7
+ * Released under the MIT license
8
+ * http://opensource.org/licenses/MIT
9
+ *
10
+ */
11
+ .ui.video{background-color:#ddd;position:relative;max-width:100%;padding-bottom:56.25%;height:0;overflow:hidden}.ui.video .placeholder{background-color:#333}.ui.video .play{cursor:pointer;position:absolute;top:0;left:0;z-index:10;width:100%;height:100%;opacity:.8;-webkit-transition:opacity .3s;transition:opacity .3s}.ui.video .play.icon:before{position:absolute;top:50%;left:50%;z-index:11;background:rgba(0,0,0,.3);width:8rem;height:8rem;line-height:8rem;border-radius:500rem;color:#fff;font-size:8rem;text-shadow:none;-webkit-transform:translateX(-50%) translateY(-50%);-ms-transform:translateX(-50%) translateY(-50%);transform:translateX(-50%) translateY(-50%)}.ui.video .placeholder{position:absolute;top:0;left:0;display:block;width:100%;height:100%}.ui.video .embed embed,.ui.video .embed iframe,.ui.video .embed object{position:absolute;border:none;width:100%;height:100%;top:0;left:0;margin:0;padding:0}.ui.video .play:hover{opacity:1}.ui.video.active .placeholder,.ui.video.active .play{display:none}.ui.video.active .embed{display:inline}
@@ -0,0 +1,11 @@
1
+ /*
2
+ * # Semantic UI - 1.8.1
3
+ * https://github.com/Semantic-Org/Semantic-UI
4
+ * http://www.semantic-ui.com/
5
+ *
6
+ * Copyright 2014 Contributors
7
+ * Released under the MIT license
8
+ * http://opensource.org/licenses/MIT
9
+ *
10
+ */
11
+ !function(e,o,t,n){"use strict";e.fn.video=function(t){{var a,i=e(this),r=i.selector||"",l=(new Date).getTime(),c=[],u=arguments[0],s="string"==typeof u,m=[].slice.call(arguments,1);o.requestAnimationFrame||o.mozRequestAnimationFrame||o.webkitRequestAnimationFrame||o.msRequestAnimationFrame||function(e){setTimeout(e,0)}}return i.each(function(){var d,p=e.isPlainObject(t)?e.extend(!0,{},e.fn.video.settings,t):e.extend({},e.fn.video.settings),f=p.selector,g=p.className,h=p.error,b=p.metadata,v=p.namespace,y=p.templates,w="."+v,x="module-"+v,F=(e(o),e(this)),C=F.find(f.placeholder),E=F.find(f.playButton),T=F.find(f.embed),A=this,P=F.data(x);d={initialize:function(){d.debug("Initializing video"),d.create(),C.on("click"+w,d.play),E.on("click"+w,d.play),d.instantiate()},instantiate:function(){d.verbose("Storing instance of module",d),P=d,F.data(x,d)},create:function(){var e=F.data(b.image),o=y.video(e);F.html(o),d.refresh(),e||d.play(),d.debug("Creating html for video element",o)},destroy:function(){d.verbose("Destroying previous instance of video"),d.reset(),F.removeData(x).off(w),C.off(w),E.off(w)},refresh:function(){d.verbose("Refreshing selector cache"),C=F.find(f.placeholder),E=F.find(f.playButton),T=F.find(f.embed)},change:function(e,o,t){d.debug("Changing video to ",e,o,t),F.data(b.source,e).data(b.id,o).data(b.url,t),p.onChange()},reset:function(){d.debug("Clearing video embed and showing placeholder"),F.removeClass(g.active),T.html(" "),C.show(),p.onReset()},play:function(){d.debug("Playing video");var e=F.data(b.source)||!1,o=F.data(b.url)||!1,t=F.data(b.id)||!1;T.html(d.generate.html(e,t,o)),F.addClass(g.active),p.onPlay()},get:{source:function(e){return"string"!=typeof e?!1:-1!==e.search("youtube.com")?"youtube":-1!==e.search("vimeo.com")?"vimeo":!1},id:function(e){return e.match(p.regExp.youtube)?e.match(p.regExp.youtube)[1]:e.match(p.regExp.vimeo)?e.match(p.regExp.vimeo)[2]:!1}},generate:{html:function(e,o,t){d.debug("Generating embed html");var n;return e=e||p.source,o=o||p.id,e&&o||t?(e&&o||(e=d.get.source(t),o=d.get.id(t)),"vimeo"==e?n='<iframe src="//player.vimeo.com/video/'+o+"?="+d.generate.url(e)+'" width="100%" height="100%" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>':"youtube"==e&&(n='<iframe src="//www.youtube.com/embed/'+o+"?="+d.generate.url(e)+'" width="100%" height="100%" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>')):d.error(h.noVideo),n},url:function(e){var o=p.api?1:0,t="auto"===p.autoplay?F.data("image")!==n:p.autoplay,a=p.hd?1:0,i=p.showUI?1:0,r=p.showUI?0:1,l="";return"vimeo"==e&&(l="api="+o+"&amp;title="+i+"&amp;byline="+i+"&amp;portrait="+i+"&amp;autoplay="+t,p.color&&(l+="&amp;color="+p.color)),"ustream"==e?(l="autoplay="+t,p.color&&(l+="&amp;color="+p.color)):"youtube"==e&&(l="enablejsapi="+o+"&amp;autoplay="+t+"&amp;autohide="+r+"&amp;hq="+a+"&amp;modestbranding=1",p.color&&(l+="&amp;color="+p.color)),l}},setting:function(o,t){if(d.debug("Changing setting",o,t),e.isPlainObject(o))e.extend(!0,p,o);else{if(t===n)return p[o];p[o]=t}},internal:function(o,t){if(e.isPlainObject(o))e.extend(!0,d,o);else{if(t===n)return d[o];d[o]=t}},debug:function(){p.debug&&(p.performance?d.performance.log(arguments):(d.debug=Function.prototype.bind.call(console.info,console,p.name+":"),d.debug.apply(console,arguments)))},verbose:function(){p.verbose&&p.debug&&(p.performance?d.performance.log(arguments):(d.verbose=Function.prototype.bind.call(console.info,console,p.name+":"),d.verbose.apply(console,arguments)))},error:function(){d.error=Function.prototype.bind.call(console.error,console,p.name+":"),d.error.apply(console,arguments)},performance:{log:function(e){var o,t,n;p.performance&&(o=(new Date).getTime(),n=l||o,t=o-n,l=o,c.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:A,"Execution Time":t})),clearTimeout(d.performance.timer),d.performance.timer=setTimeout(d.performance.display,100)},display:function(){var o=p.name+":",t=0;l=!1,clearTimeout(d.performance.timer),e.each(c,function(e,o){t+=o["Execution Time"]}),o+=" "+t+"ms",r&&(o+=" '"+r+"'"),i.length>1&&(o+=" ("+i.length+")"),(console.group!==n||console.table!==n)&&c.length>0&&(console.groupCollapsed(o),console.table?console.table(c):e.each(c,function(e,o){console.log(o.Name+": "+o["Execution Time"]+"ms")}),console.groupEnd()),c=[]}},invoke:function(o,t,i){var r,l,c,u=P;return t=t||m,i=A||i,"string"==typeof o&&u!==n&&(o=o.split(/[\. ]/),r=o.length-1,e.each(o,function(t,a){var i=t!=r?a+o[t+1].charAt(0).toUpperCase()+o[t+1].slice(1):o;if(e.isPlainObject(u[i])&&t!=r)u=u[i];else{if(u[i]!==n)return l=u[i],!1;if(!e.isPlainObject(u[a])||t==r)return u[a]!==n?(l=u[a],!1):(d.error(h.method,o),!1);u=u[a]}})),e.isFunction(l)?c=l.apply(i,t):l!==n&&(c=l),e.isArray(a)?a.push(c):a!==n?a=[a,c]:c!==n&&(a=c),l}},s?(P===n&&d.initialize(),d.invoke(u)):(P!==n&&d.destroy(),d.initialize())}),a!==n?a:this},e.fn.video.settings={name:"Video",namespace:"video",debug:!1,verbose:!0,performance:!0,metadata:{id:"id",image:"image",source:"source",url:"url"},source:!1,url:!1,id:!1,aspectRatio:16/9,onPlay:function(){},onReset:function(){},onChange:function(){},onPause:function(){},onStop:function(){},width:"auto",height:"auto",autoplay:"auto",color:"#442359",hd:!0,showUI:!1,api:!0,regExp:{youtube:/^(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/,vimeo:/http:\/\/(www\.)?vimeo.com\/(\d+)($|\/)/},error:{noVideo:"No video specified",method:"The method you called is not defined"},className:{active:"active"},selector:{embed:".embed",placeholder:".placeholder",playButton:".play"}},e.fn.video.settings.templates={video:function(e){var o="";return e&&(o+='<i class="video play icon"></i><img class="placeholder" src="'+e+'">'),o+='<div class="embed"></div>'}}}(jQuery,window,document);
@@ -0,0 +1,970 @@
1
+ /*
2
+ * # Semantic - Visibility
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
+ $.fn.visibility = function(parameters) {
15
+ var
16
+ $allModules = $(this),
17
+ moduleSelector = $allModules.selector || '',
18
+
19
+ time = new Date().getTime(),
20
+ performance = [],
21
+
22
+ query = arguments[0],
23
+ methodInvoked = (typeof query == 'string'),
24
+ queryArguments = [].slice.call(arguments, 1),
25
+ returnedValue
26
+ ;
27
+
28
+ $allModules
29
+ .each(function() {
30
+ var
31
+ settings = $.extend(true, {}, $.fn.visibility.settings, parameters),
32
+
33
+ className = settings.className,
34
+ namespace = settings.namespace,
35
+ error = settings.error,
36
+
37
+ eventNamespace = '.' + namespace,
38
+ moduleNamespace = 'module-' + namespace,
39
+
40
+ $window = $(window),
41
+ $module = $(this),
42
+ $context = $(settings.context),
43
+ $container = $module.offsetParent(),
44
+
45
+ selector = $module.selector || '',
46
+ instance = $module.data(moduleNamespace),
47
+
48
+ requestAnimationFrame = window.requestAnimationFrame
49
+ || window.mozRequestAnimationFrame
50
+ || window.webkitRequestAnimationFrame
51
+ || window.msRequestAnimationFrame
52
+ || function(callback) { setTimeout(callback, 0); },
53
+
54
+ element = this,
55
+ module
56
+ ;
57
+
58
+ module = {
59
+
60
+ initialize: function() {
61
+ module.verbose('Initializing visibility', settings);
62
+
63
+ module.setup.cache();
64
+ module.save.position();
65
+
66
+ if( module.should.trackChanges() ) {
67
+ module.bindEvents();
68
+ if(settings.type == 'image') {
69
+ module.setup.image();
70
+ }
71
+ if(settings.type == 'fixed') {
72
+ module.setup.fixed();
73
+ }
74
+ }
75
+ module.checkVisibility();
76
+ module.instantiate();
77
+ },
78
+
79
+ instantiate: function() {
80
+ module.verbose('Storing instance of module', module);
81
+ instance = module;
82
+ $module
83
+ .data(moduleNamespace, module)
84
+ ;
85
+ },
86
+
87
+ destroy: function() {
88
+ module.verbose('Destroying previous module');
89
+ $module
90
+ .off(eventNamespace)
91
+ .removeData(moduleNamespace)
92
+ ;
93
+ },
94
+
95
+ bindEvents: function() {
96
+ module.verbose('Binding visibility events to scroll and resize');
97
+ $window
98
+ .on('resize' + eventNamespace, module.event.refresh)
99
+ ;
100
+ $context
101
+ .on('scroll' + eventNamespace, module.event.scroll)
102
+ ;
103
+ },
104
+
105
+ event: {
106
+ refresh: function() {
107
+ requestAnimationFrame(module.refresh);
108
+ },
109
+ scroll: function() {
110
+ module.verbose('Scroll position changed');
111
+ if(settings.throttle) {
112
+ clearTimeout(module.timer);
113
+ module.timer = setTimeout(module.checkVisibility, settings.throttle);
114
+ }
115
+ else {
116
+ requestAnimationFrame(module.checkVisibility);
117
+ }
118
+ }
119
+ },
120
+
121
+ precache: function(images, callback) {
122
+ if (!(images instanceof Array)) {
123
+ images = [images];
124
+ }
125
+ var
126
+ imagesLength = images.length,
127
+ loadedCounter = 0,
128
+ cache = [],
129
+ cacheImage = document.createElement('img'),
130
+ handleLoad = function() {
131
+ loadedCounter++;
132
+ if (loadedCounter >= images.length) {
133
+ if ($.isFunction(callback)) {
134
+ callback();
135
+ }
136
+ }
137
+ }
138
+ ;
139
+ while (imagesLength--) {
140
+ cacheImage = document.createElement('img');
141
+ cacheImage.onload = handleLoad;
142
+ cacheImage.onerror = handleLoad;
143
+ cacheImage.src = images[imagesLength];
144
+ cache.push(cacheImage);
145
+ }
146
+ },
147
+
148
+ should: {
149
+
150
+ trackChanges: function() {
151
+ if(methodInvoked && queryArguments.length > 0) {
152
+ module.debug('One time query, no need to bind events');
153
+ return false;
154
+ }
155
+ module.debug('Query is attaching callbacks, watching for changes with scroll');
156
+ return true;
157
+ }
158
+
159
+ },
160
+
161
+ setup: {
162
+ cache: function() {
163
+ module.cache = {
164
+ occurred : {},
165
+ screen : {},
166
+ element : {},
167
+ };
168
+ },
169
+ image: function() {
170
+ var
171
+ src = $module.data('src')
172
+ ;
173
+ if(src) {
174
+ module.verbose('Lazy loading image', src);
175
+ // show when top visible
176
+ module.topVisible(function() {
177
+ module.precache(src, function() {
178
+ module.set.image(src);
179
+ settings.onTopVisible = false;
180
+ });
181
+ });
182
+ }
183
+ },
184
+ fixed: function() {
185
+ module.verbose('Setting up fixed on element pass');
186
+ $module
187
+ .visibility({
188
+ once: false,
189
+ continuous: false,
190
+ onTopPassed: function() {
191
+ $module
192
+ .addClass(className.fixed)
193
+ .css({
194
+ position: 'fixed',
195
+ top: settings.offset + 'px'
196
+ })
197
+ ;
198
+ if(settings.animation && $.fn.transition !== undefined) {
199
+ $module.transition(settings.transition, settings.duration);
200
+ }
201
+ },
202
+ onTopPassedReverse: function() {
203
+ $module
204
+ .removeClass(className.fixed)
205
+ .css({
206
+ position: '',
207
+ top: ''
208
+ })
209
+ ;
210
+ }
211
+ })
212
+ ;
213
+ }
214
+ },
215
+
216
+ set: {
217
+ image: function(src) {
218
+ var
219
+ offScreen = (module.cache.screen.bottom < module.cache.element.top)
220
+ ;
221
+ $module
222
+ .attr('src', src)
223
+ ;
224
+ if(offScreen) {
225
+ module.verbose('Image outside browser, no show animation');
226
+ $module.show();
227
+ }
228
+ else {
229
+ if(settings.transition && $.fn.transition !== undefined) {
230
+ $module.transition(settings.transition, settings.duration);
231
+ }
232
+ else {
233
+ $module.fadeIn(settings.duration);
234
+ }
235
+ }
236
+ }
237
+ },
238
+
239
+ refresh: function() {
240
+ module.debug('Refreshing constants (element width/height)');
241
+ module.reset();
242
+ module.save.position();
243
+ module.checkVisibility();
244
+ settings.onRefresh.call(element);
245
+ },
246
+
247
+ reset: function() {
248
+ module.verbose('Reseting all cached values');
249
+ if( $.isPlainObject(module.cache) ) {
250
+ module.cache.screen = {};
251
+ module.cache.element = {};
252
+ }
253
+ },
254
+
255
+ checkVisibility: function() {
256
+ module.verbose('Checking visibility of element', module.cache.element);
257
+ module.save.calculations();
258
+
259
+ // percentage
260
+ module.passed();
261
+
262
+ // reverse (must be first)
263
+ module.passingReverse();
264
+ module.topVisibleReverse();
265
+ module.bottomVisibleReverse();
266
+ module.topPassedReverse();
267
+ module.bottomPassedReverse();
268
+
269
+ // one time
270
+ module.passing();
271
+ module.topVisible();
272
+ module.bottomVisible();
273
+ module.topPassed();
274
+ module.bottomPassed();
275
+ },
276
+
277
+ passed: function(amount, newCallback) {
278
+ var
279
+ calculations = module.get.elementCalculations(),
280
+ amountInPixels
281
+ ;
282
+ // assign callback
283
+ if(amount !== undefined && newCallback !== undefined) {
284
+ settings.onPassed[amount] = newCallback;
285
+ }
286
+ else if(amount !== undefined) {
287
+ return (module.get.pixelsPassed(amount) > calculations.pixelsPassed);
288
+ }
289
+ else if(calculations.passing) {
290
+ $.each(settings.onPassed, function(amount, callback) {
291
+ if(calculations.bottomVisible || calculations.pixelsPassed > module.get.pixelsPassed(amount)) {
292
+ module.execute(callback, amount);
293
+ }
294
+ else if(!settings.once) {
295
+ module.remove.occurred(callback);
296
+ }
297
+ });
298
+ }
299
+ },
300
+
301
+ passing: function(newCallback) {
302
+ var
303
+ calculations = module.get.elementCalculations(),
304
+ callback = newCallback || settings.onPassing,
305
+ callbackName = 'passing'
306
+ ;
307
+ if(newCallback) {
308
+ module.debug('Adding callback for passing', newCallback);
309
+ settings.onPassing = newCallback;
310
+ }
311
+ if(calculations.passing) {
312
+ module.execute(callback, callbackName);
313
+ }
314
+ else if(!settings.once) {
315
+ module.remove.occurred(callbackName);
316
+ }
317
+ if(newCallback !== undefined) {
318
+ return calculations.passing;
319
+ }
320
+ },
321
+
322
+
323
+ topVisible: function(newCallback) {
324
+ var
325
+ calculations = module.get.elementCalculations(),
326
+ callback = newCallback || settings.onTopVisible,
327
+ callbackName = 'topVisible'
328
+ ;
329
+ if(newCallback) {
330
+ module.debug('Adding callback for top visible', newCallback);
331
+ settings.onTopVisible = newCallback;
332
+ }
333
+ if(calculations.topVisible) {
334
+ module.execute(callback, callbackName);
335
+ }
336
+ else if(!settings.once) {
337
+ module.remove.occurred(callbackName);
338
+ }
339
+ if(newCallback === undefined) {
340
+ return calculations.topVisible;
341
+ }
342
+ },
343
+
344
+ bottomVisible: function(newCallback) {
345
+ var
346
+ calculations = module.get.elementCalculations(),
347
+ callback = newCallback || settings.onBottomVisible,
348
+ callbackName = 'bottomVisible'
349
+ ;
350
+ if(newCallback) {
351
+ module.debug('Adding callback for bottom visible', newCallback);
352
+ settings.onBottomVisible = newCallback;
353
+ }
354
+ if(calculations.bottomVisible) {
355
+ module.execute(callback, callbackName);
356
+ }
357
+ else if(!settings.once) {
358
+ module.remove.occurred(callbackName);
359
+ }
360
+ if(newCallback === undefined) {
361
+ return calculations.bottomVisible;
362
+ }
363
+ },
364
+
365
+ topPassed: function(newCallback) {
366
+ var
367
+ calculations = module.get.elementCalculations(),
368
+ callback = newCallback || settings.onTopPassed,
369
+ callbackName = 'topPassed'
370
+ ;
371
+ if(newCallback) {
372
+ module.debug('Adding callback for top passed', newCallback);
373
+ settings.onTopPassed = newCallback;
374
+ }
375
+ if(calculations.topPassed) {
376
+ module.execute(callback, callbackName);
377
+ }
378
+ else if(!settings.once) {
379
+ module.remove.occurred(callbackName);
380
+ }
381
+ if(newCallback === undefined) {
382
+ return calculations.topPassed;
383
+ }
384
+ },
385
+
386
+ bottomPassed: function(newCallback) {
387
+ var
388
+ calculations = module.get.elementCalculations(),
389
+ callback = newCallback || settings.onBottomPassed,
390
+ callbackName = 'bottomPassed'
391
+ ;
392
+ if(newCallback) {
393
+ module.debug('Adding callback for bottom passed', newCallback);
394
+ settings.onBottomPassed = newCallback;
395
+ }
396
+ if(calculations.bottomPassed) {
397
+ module.execute(callback, callbackName);
398
+ }
399
+ else if(!settings.once) {
400
+ module.remove.occurred(callbackName);
401
+ }
402
+ if(newCallback === undefined) {
403
+ return calculations.bottomPassed;
404
+ }
405
+ },
406
+
407
+ passingReverse: function(newCallback) {
408
+ var
409
+ calculations = module.get.elementCalculations(),
410
+ callback = newCallback || settings.onPassingReverse,
411
+ callbackName = 'passingReverse'
412
+ ;
413
+ if(newCallback) {
414
+ module.debug('Adding callback for passing reverse', newCallback);
415
+ settings.onPassingReverse = newCallback;
416
+ }
417
+ if(!calculations.passing) {
418
+ if(module.get.occurred('passing')) {
419
+ module.execute(callback, callbackName);
420
+ }
421
+ }
422
+ else if(!settings.once) {
423
+ module.remove.occurred(callbackName);
424
+ }
425
+ if(newCallback !== undefined) {
426
+ return !calculations.passing;
427
+ }
428
+ },
429
+
430
+
431
+ topVisibleReverse: function(newCallback) {
432
+ var
433
+ calculations = module.get.elementCalculations(),
434
+ callback = newCallback || settings.onTopVisibleReverse,
435
+ callbackName = 'topVisibleReverse'
436
+ ;
437
+ if(newCallback) {
438
+ module.debug('Adding callback for top visible reverse', newCallback);
439
+ settings.onTopVisibleReverse = newCallback;
440
+ }
441
+ if(!calculations.topVisible) {
442
+ if(module.get.occurred('topVisible')) {
443
+ module.execute(callback, callbackName);
444
+ }
445
+ }
446
+ else if(!settings.once) {
447
+ module.remove.occurred(callbackName);
448
+ }
449
+ if(newCallback === undefined) {
450
+ return !calculations.topVisible;
451
+ }
452
+ },
453
+
454
+ bottomVisibleReverse: function(newCallback) {
455
+ var
456
+ calculations = module.get.elementCalculations(),
457
+ callback = newCallback || settings.onBottomVisibleReverse,
458
+ callbackName = 'bottomVisibleReverse'
459
+ ;
460
+ if(newCallback) {
461
+ module.debug('Adding callback for bottom visible reverse', newCallback);
462
+ settings.onBottomVisibleReverse = newCallback;
463
+ }
464
+ if(!calculations.bottomVisible) {
465
+ if(module.get.occurred('bottomVisible')) {
466
+ module.execute(callback, callbackName);
467
+ }
468
+ }
469
+ else if(!settings.once) {
470
+ module.remove.occurred(callbackName);
471
+ }
472
+ if(newCallback === undefined) {
473
+ return !calculations.bottomVisible;
474
+ }
475
+ },
476
+
477
+ topPassedReverse: function(newCallback) {
478
+ var
479
+ calculations = module.get.elementCalculations(),
480
+ callback = newCallback || settings.onTopPassedReverse,
481
+ callbackName = 'topPassedReverse'
482
+ ;
483
+ if(newCallback) {
484
+ module.debug('Adding callback for top passed reverse', newCallback);
485
+ settings.onTopPassedReverse = newCallback;
486
+ }
487
+ if(!calculations.topPassed) {
488
+ if(module.get.occurred('topPassed')) {
489
+ module.execute(callback, callbackName);
490
+ }
491
+ }
492
+ else if(!settings.once) {
493
+ module.remove.occurred(callbackName);
494
+ }
495
+ if(newCallback === undefined) {
496
+ return !calculations.onTopPassed;
497
+ }
498
+ },
499
+
500
+ bottomPassedReverse: function(newCallback) {
501
+ var
502
+ calculations = module.get.elementCalculations(),
503
+ callback = newCallback || settings.onBottomPassedReverse,
504
+ callbackName = 'bottomPassedReverse'
505
+ ;
506
+ if(newCallback) {
507
+ module.debug('Adding callback for bottom passed reverse', newCallback);
508
+ settings.onBottomPassedReverse = newCallback;
509
+ }
510
+ if(!calculations.bottomPassed) {
511
+ if(module.get.occurred('bottomPassed')) {
512
+ module.execute(callback, callbackName);
513
+ }
514
+ }
515
+ else if(!settings.once) {
516
+ module.remove.occurred(callbackName);
517
+ }
518
+ if(newCallback === undefined) {
519
+ return !calculations.bottomPassed;
520
+ }
521
+ },
522
+
523
+ execute: function(callback, callbackName) {
524
+ var
525
+ calculations = module.get.elementCalculations(),
526
+ screen = module.get.screenCalculations()
527
+ ;
528
+ callback = callback || false;
529
+ if(callback) {
530
+ if(settings.continuous) {
531
+ module.debug('Callback being called continuously', callbackName, calculations);
532
+ callback.call(element, calculations, screen);
533
+ }
534
+ else if(!module.get.occurred(callbackName)) {
535
+ module.debug('Conditions met', callbackName, calculations);
536
+ callback.call(element, calculations, screen);
537
+ }
538
+ }
539
+ module.save.occurred(callbackName);
540
+ },
541
+
542
+ remove: {
543
+ occurred: function(callback) {
544
+ if(callback) {
545
+ if(module.cache.occurred[callback] !== undefined && module.cache.occurred[callback] === true) {
546
+ module.debug('Callback can now be called again', callback);
547
+ module.cache.occurred[callback] = false;
548
+ }
549
+ }
550
+ else {
551
+ module.cache.occurred = {};
552
+ }
553
+ }
554
+ },
555
+
556
+ save: {
557
+ calculations: function() {
558
+ module.verbose('Saving all calculations necessary to determine positioning');
559
+ module.save.scroll();
560
+ module.save.direction();
561
+ module.save.screenCalculations();
562
+ module.save.elementCalculations();
563
+ },
564
+ occurred: function(callback) {
565
+ if(callback) {
566
+ if(module.cache.occurred[callback] === undefined || (module.cache.occurred[callback] !== true)) {
567
+ module.verbose('Saving callback occurred', callback);
568
+ module.cache.occurred[callback] = true;
569
+ }
570
+ }
571
+ },
572
+ scroll: function() {
573
+ module.cache.scroll = $context.scrollTop() + settings.offset;
574
+ },
575
+ direction: function() {
576
+ var
577
+ scroll = module.get.scroll(),
578
+ lastScroll = module.get.lastScroll(),
579
+ direction
580
+ ;
581
+ if(scroll > lastScroll && lastScroll) {
582
+ direction = 'down';
583
+ }
584
+ else if(scroll < lastScroll && lastScroll) {
585
+ direction = 'up';
586
+ }
587
+ else {
588
+ direction = 'static';
589
+ }
590
+ module.cache.direction = direction;
591
+ return module.cache.direction;
592
+ },
593
+ elementPosition: function() {
594
+ var
595
+ screen = module.get.screenSize()
596
+ ;
597
+ module.verbose('Saving element position');
598
+ $.extend(module.cache.element, {
599
+ margin : {
600
+ top : parseInt($module.css('margin-top'), 10),
601
+ bottom : parseInt($module.css('margin-bottom'), 10)
602
+ },
603
+ fits : (element.height < screen.height),
604
+ offset : $module.offset(),
605
+ width : $module.outerWidth(),
606
+ height : $module.outerHeight()
607
+ });
608
+ return module.cache.element;
609
+ },
610
+ elementCalculations: function() {
611
+ var
612
+ screen = module.get.screenCalculations(),
613
+ element = module.get.elementPosition()
614
+ ;
615
+ // offset
616
+ if(settings.includeMargin) {
617
+ $.extend(module.cache.element, {
618
+ top : element.offset.top - element.margin.top,
619
+ bottom : element.offset.top + element.height + element.margin.bottom
620
+ });
621
+ }
622
+ else {
623
+ $.extend(module.cache.element, {
624
+ top : element.offset.top,
625
+ bottom : element.offset.top + element.height
626
+ });
627
+ }
628
+ // visibility
629
+ $.extend(module.cache.element, {
630
+ topVisible : (screen.bottom >= element.top),
631
+ topPassed : (screen.top >= element.top),
632
+ bottomVisible : (screen.bottom >= element.bottom),
633
+ bottomPassed : (screen.top >= element.bottom),
634
+ pixelsPassed : 0,
635
+ percentagePassed : 0
636
+ });
637
+ // meta calculations
638
+ $.extend(module.cache.element, {
639
+ visible : (module.cache.element.topVisible || module.cache.element.bottomVisible),
640
+ passing : (module.cache.element.topPassed && !module.cache.element.bottomPassed),
641
+ hidden : (!module.cache.element.topVisible && !module.cache.element.bottomVisible)
642
+ });
643
+ if(module.cache.element.passing) {
644
+ module.cache.element.pixelsPassed = (screen.top - element.top);
645
+ module.cache.element.percentagePassed = (screen.top - element.top) / element.height;
646
+ }
647
+ module.verbose('Updated element calculations', module.cache.element);
648
+ },
649
+ screenCalculations: function() {
650
+ var
651
+ scroll = $context.scrollTop() + settings.offset
652
+ ;
653
+ if(module.cache.scroll === undefined) {
654
+ module.cache.scroll = $context.scrollTop() + settings.offset;
655
+ }
656
+ module.save.direction();
657
+ $.extend(module.cache.screen, {
658
+ top : scroll,
659
+ bottom : scroll + module.cache.screen.height
660
+ });
661
+ return module.cache.screen;
662
+ },
663
+ screenSize: function() {
664
+ module.verbose('Saving window position');
665
+ module.cache.screen = {
666
+ height: $context.height()
667
+ };
668
+ },
669
+ position: function() {
670
+ module.save.screenSize();
671
+ module.save.elementPosition();
672
+ }
673
+ },
674
+
675
+ get: {
676
+ pixelsPassed: function(amount) {
677
+ var
678
+ element = module.get.elementCalculations()
679
+ ;
680
+ if(amount.search('%') > -1) {
681
+ return ( element.height * (parseInt(amount, 10) / 100) );
682
+ }
683
+ return parseInt(amount, 10);
684
+ },
685
+ occurred: function(callback) {
686
+ return (module.cache.occurred !== undefined)
687
+ ? module.cache.occurred[callback] || false
688
+ : false
689
+ ;
690
+ },
691
+ direction: function() {
692
+ if(module.cache.direction === undefined) {
693
+ module.save.direction();
694
+ }
695
+ return module.cache.direction;
696
+ },
697
+ elementPosition: function() {
698
+ if(module.cache.element === undefined) {
699
+ module.save.elementPosition();
700
+ }
701
+ return module.cache.element;
702
+ },
703
+ elementCalculations: function() {
704
+ if(module.cache.element === undefined) {
705
+ module.save.elementCalculations();
706
+ }
707
+ return module.cache.element;
708
+ },
709
+ screenCalculations: function() {
710
+ if(module.cache.screen === undefined) {
711
+ module.save.screenCalculations();
712
+ }
713
+ return module.cache.screen;
714
+ },
715
+ screenSize: function() {
716
+ if(module.cache.screen === undefined) {
717
+ module.save.screenSize();
718
+ }
719
+ return module.cache.screen;
720
+ },
721
+ scroll: function() {
722
+ if(module.cache.scroll === undefined) {
723
+ module.save.scroll();
724
+ }
725
+ return module.cache.scroll;
726
+ },
727
+ lastScroll: function() {
728
+ if(module.cache.screen === undefined) {
729
+ module.debug('First scroll event, no last scroll could be found');
730
+ return false;
731
+ }
732
+ return module.cache.screen.top;
733
+ }
734
+ },
735
+
736
+ setting: function(name, value) {
737
+ if( $.isPlainObject(name) ) {
738
+ $.extend(true, settings, name);
739
+ }
740
+ else if(value !== undefined) {
741
+ settings[name] = value;
742
+ }
743
+ else {
744
+ return settings[name];
745
+ }
746
+ },
747
+ internal: function(name, value) {
748
+ if( $.isPlainObject(name) ) {
749
+ $.extend(true, module, name);
750
+ }
751
+ else if(value !== undefined) {
752
+ module[name] = value;
753
+ }
754
+ else {
755
+ return module[name];
756
+ }
757
+ },
758
+ debug: function() {
759
+ if(settings.debug) {
760
+ if(settings.performance) {
761
+ module.performance.log(arguments);
762
+ }
763
+ else {
764
+ module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
765
+ module.debug.apply(console, arguments);
766
+ }
767
+ }
768
+ },
769
+ verbose: function() {
770
+ if(settings.verbose && settings.debug) {
771
+ if(settings.performance) {
772
+ module.performance.log(arguments);
773
+ }
774
+ else {
775
+ module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
776
+ module.verbose.apply(console, arguments);
777
+ }
778
+ }
779
+ },
780
+ error: function() {
781
+ module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
782
+ module.error.apply(console, arguments);
783
+ },
784
+ performance: {
785
+ log: function(message) {
786
+ var
787
+ currentTime,
788
+ executionTime,
789
+ previousTime
790
+ ;
791
+ if(settings.performance) {
792
+ currentTime = new Date().getTime();
793
+ previousTime = time || currentTime;
794
+ executionTime = currentTime - previousTime;
795
+ time = currentTime;
796
+ performance.push({
797
+ 'Name' : message[0],
798
+ 'Arguments' : [].slice.call(message, 1) || '',
799
+ 'Element' : element,
800
+ 'Execution Time' : executionTime
801
+ });
802
+ }
803
+ clearTimeout(module.performance.timer);
804
+ module.performance.timer = setTimeout(module.performance.display, 100);
805
+ },
806
+ display: function() {
807
+ var
808
+ title = settings.name + ':',
809
+ totalTime = 0
810
+ ;
811
+ time = false;
812
+ clearTimeout(module.performance.timer);
813
+ $.each(performance, function(index, data) {
814
+ totalTime += data['Execution Time'];
815
+ });
816
+ title += ' ' + totalTime + 'ms';
817
+ if(moduleSelector) {
818
+ title += ' \'' + moduleSelector + '\'';
819
+ }
820
+ if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
821
+ console.groupCollapsed(title);
822
+ if(console.table) {
823
+ console.table(performance);
824
+ }
825
+ else {
826
+ $.each(performance, function(index, data) {
827
+ console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
828
+ });
829
+ }
830
+ console.groupEnd();
831
+ }
832
+ performance = [];
833
+ }
834
+ },
835
+ invoke: function(query, passedArguments, context) {
836
+ var
837
+ object = instance,
838
+ maxDepth,
839
+ found,
840
+ response
841
+ ;
842
+ passedArguments = passedArguments || queryArguments;
843
+ context = element || context;
844
+ if(typeof query == 'string' && object !== undefined) {
845
+ query = query.split(/[\. ]/);
846
+ maxDepth = query.length - 1;
847
+ $.each(query, function(depth, value) {
848
+ var camelCaseValue = (depth != maxDepth)
849
+ ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
850
+ : query
851
+ ;
852
+ if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
853
+ object = object[camelCaseValue];
854
+ }
855
+ else if( object[camelCaseValue] !== undefined ) {
856
+ found = object[camelCaseValue];
857
+ return false;
858
+ }
859
+ else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
860
+ object = object[value];
861
+ }
862
+ else if( object[value] !== undefined ) {
863
+ found = object[value];
864
+ return false;
865
+ }
866
+ else {
867
+ module.error(error.method, query);
868
+ return false;
869
+ }
870
+ });
871
+ }
872
+ if ( $.isFunction( found ) ) {
873
+ response = found.apply(context, passedArguments);
874
+ }
875
+ else if(found !== undefined) {
876
+ response = found;
877
+ }
878
+ if($.isArray(returnedValue)) {
879
+ returnedValue.push(response);
880
+ }
881
+ else if(returnedValue !== undefined) {
882
+ returnedValue = [returnedValue, response];
883
+ }
884
+ else if(response !== undefined) {
885
+ returnedValue = response;
886
+ }
887
+ return found;
888
+ }
889
+ };
890
+
891
+ if(methodInvoked) {
892
+ if(instance === undefined) {
893
+ module.initialize();
894
+ }
895
+ module.invoke(query);
896
+ }
897
+ else {
898
+ if(instance !== undefined) {
899
+ module.destroy();
900
+ }
901
+ module.initialize();
902
+ }
903
+ })
904
+ ;
905
+
906
+ return (returnedValue !== undefined)
907
+ ? returnedValue
908
+ : this
909
+ ;
910
+ };
911
+
912
+ $.fn.visibility.settings = {
913
+
914
+ name : 'Visibility',
915
+ namespace : 'visibility',
916
+
917
+ className: {
918
+ fixed: 'fixed'
919
+ },
920
+
921
+ debug : false,
922
+ verbose : false,
923
+ performance : true,
924
+
925
+ offset : 0,
926
+ includeMargin : false,
927
+
928
+ context : window,
929
+
930
+ // visibility check delay in ms (defaults to animationFrame)
931
+ throttle : false,
932
+
933
+ // special visibility type (image, fixed)
934
+ type : false,
935
+
936
+ // image only animation settings
937
+ transition : false,
938
+ duration : 500,
939
+
940
+ // array of callbacks for percentage
941
+ onPassed : {},
942
+
943
+ // standard callbacks
944
+ onPassing : false,
945
+ onTopVisible : false,
946
+ onBottomVisible : false,
947
+ onTopPassed : false,
948
+ onBottomPassed : false,
949
+
950
+ // reverse callbacks
951
+ onPassingReverse : false,
952
+ onTopVisibleReverse : false,
953
+ onBottomVisibleReverse : false,
954
+ onTopPassedReverse : false,
955
+ onBottomPassedReverse : false,
956
+
957
+ once : true,
958
+ continuous : false,
959
+
960
+ // utility callbacks
961
+ onRefresh : function(){},
962
+ onScroll : function(){},
963
+
964
+ error : {
965
+ method : 'The method you called is not defined.'
966
+ }
967
+
968
+ };
969
+
970
+ })( jQuery, window , document );