bootstrap_it 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (289) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +11 -0
  3. data/.rspec +2 -0
  4. data/.rubocop.yml +5 -0
  5. data/Gemfile +9 -0
  6. data/README.md +582 -0
  7. data/Rakefile +6 -0
  8. data/bootstrap_it.gemspec +33 -0
  9. data/config.ru +7 -0
  10. data/lib/bootstrap_it.rb +9 -0
  11. data/lib/bootstrap_it/assets.rb +67 -0
  12. data/lib/bootstrap_it/config.rb +50 -0
  13. data/lib/bootstrap_it/engine.rb +25 -0
  14. data/lib/bootstrap_it/locales/en.yml +4 -0
  15. data/lib/bootstrap_it/locales/ru.yml +4 -0
  16. data/lib/bootstrap_it/version.rb +6 -0
  17. data/lib/bootstrap_it/view_helpers.rb +55 -0
  18. data/lib/bootstrap_it/view_helpers/breadcrumb.rb +19 -0
  19. data/lib/bootstrap_it/view_helpers/button.rb +116 -0
  20. data/lib/bootstrap_it/view_helpers/button_group.rb +32 -0
  21. data/lib/bootstrap_it/view_helpers/button_toolbar.rb +21 -0
  22. data/lib/bootstrap_it/view_helpers/dropdown_menu.rb +30 -0
  23. data/lib/bootstrap_it/view_helpers/form.rb +127 -0
  24. data/lib/bootstrap_it/view_helpers/grid.rb +75 -0
  25. data/lib/bootstrap_it/view_helpers/icon.rb +24 -0
  26. data/lib/bootstrap_it/view_helpers/list.rb +47 -0
  27. data/lib/bootstrap_it/view_helpers/misc.rb +144 -0
  28. data/lib/bootstrap_it/view_helpers/mixin.rb +279 -0
  29. data/lib/bootstrap_it/view_helpers/nav.rb +96 -0
  30. data/lib/bootstrap_it/view_helpers/pagination.rb +34 -0
  31. data/lib/bootstrap_it/view_helpers/table.rb +72 -0
  32. data/lib/bootstrap_it/view_helpers/text.rb +46 -0
  33. data/spec/assets/assets_spec.rb +51 -0
  34. data/spec/internal/app/assets/javascript/application.js +7 -0
  35. data/spec/internal/app/assets/javascript/user.js +1 -0
  36. data/spec/internal/app/assets/javascript/userfont.eot +0 -0
  37. data/spec/internal/app/assets/stylesheets/application.css +6 -0
  38. data/spec/internal/app/assets/stylesheets/user.css +1 -0
  39. data/spec/internal/config/database.yml +3 -0
  40. data/spec/internal/config/routes.rb +3 -0
  41. data/spec/internal/db/schema.rb +3 -0
  42. data/spec/internal/log/.gitignore +1 -0
  43. data/spec/internal/public/favicon.ico +0 -0
  44. data/spec/lib/config_spec.rb +10 -0
  45. data/spec/lib/view_helpers_spec.rb +12 -0
  46. data/spec/spec_helper.rb +37 -0
  47. data/spec/support/example_groups/assets_example_group.rb +84 -0
  48. data/spec/support/example_groups/view_helpers_example_group.rb +124 -0
  49. data/spec/view_helpers/breadcrumb_spec.rb +12 -0
  50. data/spec/view_helpers/button_group_spec.rb +40 -0
  51. data/spec/view_helpers/button_spec.rb +169 -0
  52. data/spec/view_helpers/button_toolbar_spec.rb +14 -0
  53. data/spec/view_helpers/dropdown_menu_spec.rb +41 -0
  54. data/spec/view_helpers/form_spec.rb +27 -0
  55. data/spec/view_helpers/grid_spec.rb +47 -0
  56. data/spec/view_helpers/icon_spec.rb +6 -0
  57. data/spec/view_helpers/list_spec.rb +50 -0
  58. data/spec/view_helpers/misc_spec.rb +117 -0
  59. data/spec/view_helpers/mixin_spec.rb +177 -0
  60. data/spec/view_helpers/nav_spec.rb +63 -0
  61. data/spec/view_helpers/pagination_spec.rb +36 -0
  62. data/spec/view_helpers/table_spec.rb +59 -0
  63. data/spec/view_helpers/text_spec.rb +13 -0
  64. data/spec/views/examples_spec.rb +250 -0
  65. data/upstream/bootstrap-3.0.3-dist.zip +0 -0
  66. data/upstream/bootstrap/3.0.3/fonts/glyphicons-halflings-regular.eot +0 -0
  67. data/upstream/bootstrap/3.0.3/fonts/glyphicons-halflings-regular.svg +229 -0
  68. data/upstream/bootstrap/3.0.3/fonts/glyphicons-halflings-regular.ttf +0 -0
  69. data/upstream/bootstrap/3.0.3/fonts/glyphicons-halflings-regular.woff +0 -0
  70. data/upstream/bootstrap/3.0.3/javascript/bootstrap.js +2006 -0
  71. data/upstream/bootstrap/3.0.3/javascript/bootstrap.min.js +7 -0
  72. data/upstream/bootstrap/3.0.3/src/.editorconfig +11 -0
  73. data/upstream/bootstrap/3.0.3/src/.gitattributes +8 -0
  74. data/upstream/bootstrap/3.0.3/src/.gitignore +42 -0
  75. data/upstream/bootstrap/3.0.3/src/.travis.yml +10 -0
  76. data/upstream/bootstrap/3.0.3/src/CNAME +1 -0
  77. data/upstream/bootstrap/3.0.3/src/CONTRIBUTING.md +79 -0
  78. data/upstream/bootstrap/3.0.3/src/DOCS-LICENSE +319 -0
  79. data/upstream/bootstrap/3.0.3/src/Gruntfile.js +337 -0
  80. data/upstream/bootstrap/3.0.3/src/LICENSE +176 -0
  81. data/upstream/bootstrap/3.0.3/src/LICENSE-MIT +21 -0
  82. data/upstream/bootstrap/3.0.3/src/README.md +166 -0
  83. data/upstream/bootstrap/3.0.3/src/_config.yml +25 -0
  84. data/upstream/bootstrap/3.0.3/src/_includes/ads.html +1 -0
  85. data/upstream/bootstrap/3.0.3/src/_includes/footer.html +48 -0
  86. data/upstream/bootstrap/3.0.3/src/_includes/header.html +42 -0
  87. data/upstream/bootstrap/3.0.3/src/_includes/nav-about.html +12 -0
  88. data/upstream/bootstrap/3.0.3/src/_includes/nav-components.html +137 -0
  89. data/upstream/bootstrap/3.0.3/src/_includes/nav-css.html +99 -0
  90. data/upstream/bootstrap/3.0.3/src/_includes/nav-customize.html +40 -0
  91. data/upstream/bootstrap/3.0.3/src/_includes/nav-getting-started.html +48 -0
  92. data/upstream/bootstrap/3.0.3/src/_includes/nav-javascript.html +88 -0
  93. data/upstream/bootstrap/3.0.3/src/_includes/nav-main.html +37 -0
  94. data/upstream/bootstrap/3.0.3/src/_includes/old-bs-docs.html +8 -0
  95. data/upstream/bootstrap/3.0.3/src/_includes/social-buttons.html +16 -0
  96. data/upstream/bootstrap/3.0.3/src/_layouts/default.html +79 -0
  97. data/upstream/bootstrap/3.0.3/src/_layouts/home.html +47 -0
  98. data/upstream/bootstrap/3.0.3/src/about.html +94 -0
  99. data/upstream/bootstrap/3.0.3/src/bower.json +30 -0
  100. data/upstream/bootstrap/3.0.3/src/components.html +3714 -0
  101. data/upstream/bootstrap/3.0.3/src/composer.json +25 -0
  102. data/upstream/bootstrap/3.0.3/src/css.html +2673 -0
  103. data/upstream/bootstrap/3.0.3/src/customize.html +1715 -0
  104. data/upstream/bootstrap/3.0.3/src/dist/css/bootstrap-theme.css +397 -0
  105. data/upstream/bootstrap/3.0.3/src/dist/css/bootstrap-theme.min.css +7 -0
  106. data/upstream/bootstrap/3.0.3/src/dist/css/bootstrap.css +7118 -0
  107. data/upstream/bootstrap/3.0.3/src/dist/css/bootstrap.min.css +7 -0
  108. data/upstream/bootstrap/3.0.3/src/dist/fonts/glyphicons-halflings-regular.eot +0 -0
  109. data/upstream/bootstrap/3.0.3/src/dist/fonts/glyphicons-halflings-regular.svg +229 -0
  110. data/upstream/bootstrap/3.0.3/src/dist/fonts/glyphicons-halflings-regular.ttf +0 -0
  111. data/upstream/bootstrap/3.0.3/src/dist/fonts/glyphicons-halflings-regular.woff +0 -0
  112. data/upstream/bootstrap/3.0.3/src/dist/js/bootstrap.js +2006 -0
  113. data/upstream/bootstrap/3.0.3/src/dist/js/bootstrap.min.js +7 -0
  114. data/upstream/bootstrap/3.0.3/src/docs-assets/css/docs.css +1196 -0
  115. data/upstream/bootstrap/3.0.3/src/docs-assets/css/pygments-manni.css +66 -0
  116. data/upstream/bootstrap/3.0.3/src/docs-assets/ico/apple-touch-icon-144-precomposed.png +0 -0
  117. data/upstream/bootstrap/3.0.3/src/docs-assets/ico/favicon.png +0 -0
  118. data/upstream/bootstrap/3.0.3/src/docs-assets/js/application.js +103 -0
  119. data/upstream/bootstrap/3.0.3/src/docs-assets/js/customizer.js +332 -0
  120. data/upstream/bootstrap/3.0.3/src/docs-assets/js/filesaver.js +399 -0
  121. data/upstream/bootstrap/3.0.3/src/docs-assets/js/holder.js +500 -0
  122. data/upstream/bootstrap/3.0.3/src/docs-assets/js/ie8-responsive-file-warning.js +12 -0
  123. data/upstream/bootstrap/3.0.3/src/docs-assets/js/jszip.js +1474 -0
  124. data/upstream/bootstrap/3.0.3/src/docs-assets/js/less.js +9 -0
  125. data/upstream/bootstrap/3.0.3/src/docs-assets/js/raw-files.js +3 -0
  126. data/upstream/bootstrap/3.0.3/src/docs-assets/js/uglify.js +14 -0
  127. data/upstream/bootstrap/3.0.3/src/examples/carousel/carousel.css +148 -0
  128. data/upstream/bootstrap/3.0.3/src/examples/carousel/index.html +206 -0
  129. data/upstream/bootstrap/3.0.3/src/examples/grid/grid.css +28 -0
  130. data/upstream/bootstrap/3.0.3/src/examples/grid/index.html +148 -0
  131. data/upstream/bootstrap/3.0.3/src/examples/jumbotron-narrow/index.html +82 -0
  132. data/upstream/bootstrap/3.0.3/src/examples/jumbotron-narrow/jumbotron-narrow.css +79 -0
  133. data/upstream/bootstrap/3.0.3/src/examples/jumbotron/index.html +99 -0
  134. data/upstream/bootstrap/3.0.3/src/examples/jumbotron/jumbotron.css +5 -0
  135. data/upstream/bootstrap/3.0.3/src/examples/justified-nav/index.html +84 -0
  136. data/upstream/bootstrap/3.0.3/src/examples/justified-nav/justified-nav.css +88 -0
  137. data/upstream/bootstrap/3.0.3/src/examples/navbar-fixed-top/index.html +91 -0
  138. data/upstream/bootstrap/3.0.3/src/examples/navbar-fixed-top/navbar-fixed-top.css +4 -0
  139. data/upstream/bootstrap/3.0.3/src/examples/navbar-static-top/index.html +92 -0
  140. data/upstream/bootstrap/3.0.3/src/examples/navbar-static-top/navbar-static-top.css +7 -0
  141. data/upstream/bootstrap/3.0.3/src/examples/navbar/index.html +88 -0
  142. data/upstream/bootstrap/3.0.3/src/examples/navbar/navbar.css +8 -0
  143. data/upstream/bootstrap/3.0.3/src/examples/non-responsive/index.html +101 -0
  144. data/upstream/bootstrap/3.0.3/src/examples/non-responsive/non-responsive.css +120 -0
  145. data/upstream/bootstrap/3.0.3/src/examples/offcanvas/index.html +130 -0
  146. data/upstream/bootstrap/3.0.3/src/examples/offcanvas/offcanvas.css +51 -0
  147. data/upstream/bootstrap/3.0.3/src/examples/offcanvas/offcanvas.js +5 -0
  148. data/upstream/bootstrap/3.0.3/src/examples/screenshots/carousel.jpg +0 -0
  149. data/upstream/bootstrap/3.0.3/src/examples/screenshots/grid.jpg +0 -0
  150. data/upstream/bootstrap/3.0.3/src/examples/screenshots/jumbotron-narrow.jpg +0 -0
  151. data/upstream/bootstrap/3.0.3/src/examples/screenshots/jumbotron.jpg +0 -0
  152. data/upstream/bootstrap/3.0.3/src/examples/screenshots/justified-nav.jpg +0 -0
  153. data/upstream/bootstrap/3.0.3/src/examples/screenshots/navbar-fixed.jpg +0 -0
  154. data/upstream/bootstrap/3.0.3/src/examples/screenshots/navbar-static.jpg +0 -0
  155. data/upstream/bootstrap/3.0.3/src/examples/screenshots/navbar.jpg +0 -0
  156. data/upstream/bootstrap/3.0.3/src/examples/screenshots/non-responsive.jpg +0 -0
  157. data/upstream/bootstrap/3.0.3/src/examples/screenshots/offcanvas.jpg +0 -0
  158. data/upstream/bootstrap/3.0.3/src/examples/screenshots/sign-in.jpg +0 -0
  159. data/upstream/bootstrap/3.0.3/src/examples/screenshots/starter-template.jpg +0 -0
  160. data/upstream/bootstrap/3.0.3/src/examples/screenshots/sticky-footer-navbar.jpg +0 -0
  161. data/upstream/bootstrap/3.0.3/src/examples/screenshots/sticky-footer.jpg +0 -0
  162. data/upstream/bootstrap/3.0.3/src/examples/screenshots/theme.jpg +0 -0
  163. data/upstream/bootstrap/3.0.3/src/examples/signin/index.html +50 -0
  164. data/upstream/bootstrap/3.0.3/src/examples/signin/signin.css +40 -0
  165. data/upstream/bootstrap/3.0.3/src/examples/starter-template/index.html +68 -0
  166. data/upstream/bootstrap/3.0.3/src/examples/starter-template/starter-template.css +7 -0
  167. data/upstream/bootstrap/3.0.3/src/examples/sticky-footer-navbar/index.html +91 -0
  168. data/upstream/bootstrap/3.0.3/src/examples/sticky-footer-navbar/sticky-footer-navbar.css +45 -0
  169. data/upstream/bootstrap/3.0.3/src/examples/sticky-footer/index.html +55 -0
  170. data/upstream/bootstrap/3.0.3/src/examples/sticky-footer/sticky-footer.css +38 -0
  171. data/upstream/bootstrap/3.0.3/src/examples/theme/index.html +384 -0
  172. data/upstream/bootstrap/3.0.3/src/examples/theme/theme.css +14 -0
  173. data/upstream/bootstrap/3.0.3/src/fonts/glyphicons-halflings-regular.eot +0 -0
  174. data/upstream/bootstrap/3.0.3/src/fonts/glyphicons-halflings-regular.svg +229 -0
  175. data/upstream/bootstrap/3.0.3/src/fonts/glyphicons-halflings-regular.ttf +0 -0
  176. data/upstream/bootstrap/3.0.3/src/fonts/glyphicons-halflings-regular.woff +0 -0
  177. data/upstream/bootstrap/3.0.3/src/getting-started.html +1057 -0
  178. data/upstream/bootstrap/3.0.3/src/index.html +16 -0
  179. data/upstream/bootstrap/3.0.3/src/javascript.html +1995 -0
  180. data/upstream/bootstrap/3.0.3/src/js/.jshintrc +14 -0
  181. data/upstream/bootstrap/3.0.3/src/js/affix.js +126 -0
  182. data/upstream/bootstrap/3.0.3/src/js/alert.js +98 -0
  183. data/upstream/bootstrap/3.0.3/src/js/button.js +115 -0
  184. data/upstream/bootstrap/3.0.3/src/js/carousel.js +217 -0
  185. data/upstream/bootstrap/3.0.3/src/js/collapse.js +179 -0
  186. data/upstream/bootstrap/3.0.3/src/js/dropdown.js +154 -0
  187. data/upstream/bootstrap/3.0.3/src/js/modal.js +246 -0
  188. data/upstream/bootstrap/3.0.3/src/js/popover.js +117 -0
  189. data/upstream/bootstrap/3.0.3/src/js/scrollspy.js +158 -0
  190. data/upstream/bootstrap/3.0.3/src/js/tab.js +135 -0
  191. data/upstream/bootstrap/3.0.3/src/js/tests/index.html +52 -0
  192. data/upstream/bootstrap/3.0.3/src/js/tests/unit/affix.js +25 -0
  193. data/upstream/bootstrap/3.0.3/src/js/tests/unit/alert.js +62 -0
  194. data/upstream/bootstrap/3.0.3/src/js/tests/unit/button.js +122 -0
  195. data/upstream/bootstrap/3.0.3/src/js/tests/unit/carousel.js +87 -0
  196. data/upstream/bootstrap/3.0.3/src/js/tests/unit/collapse.js +164 -0
  197. data/upstream/bootstrap/3.0.3/src/js/tests/unit/dropdown.js +219 -0
  198. data/upstream/bootstrap/3.0.3/src/js/tests/unit/modal.js +196 -0
  199. data/upstream/bootstrap/3.0.3/src/js/tests/unit/phantom.js +69 -0
  200. data/upstream/bootstrap/3.0.3/src/js/tests/unit/popover.js +133 -0
  201. data/upstream/bootstrap/3.0.3/src/js/tests/unit/scrollspy.js +37 -0
  202. data/upstream/bootstrap/3.0.3/src/js/tests/unit/tab.js +86 -0
  203. data/upstream/bootstrap/3.0.3/src/js/tests/unit/tooltip.js +437 -0
  204. data/upstream/bootstrap/3.0.3/src/js/tests/unit/transition.js +13 -0
  205. data/upstream/bootstrap/3.0.3/src/js/tests/vendor/jquery.js +6 -0
  206. data/upstream/bootstrap/3.0.3/src/js/tests/vendor/qunit.css +232 -0
  207. data/upstream/bootstrap/3.0.3/src/js/tests/vendor/qunit.js +1510 -0
  208. data/upstream/bootstrap/3.0.3/src/js/tooltip.js +386 -0
  209. data/upstream/bootstrap/3.0.3/src/js/transition.js +56 -0
  210. data/upstream/bootstrap/3.0.3/src/less/alerts.less +67 -0
  211. data/upstream/bootstrap/3.0.3/src/less/badges.less +51 -0
  212. data/upstream/bootstrap/3.0.3/src/less/bootstrap.less +49 -0
  213. data/upstream/bootstrap/3.0.3/src/less/breadcrumbs.less +23 -0
  214. data/upstream/bootstrap/3.0.3/src/less/button-groups.less +227 -0
  215. data/upstream/bootstrap/3.0.3/src/less/buttons.less +155 -0
  216. data/upstream/bootstrap/3.0.3/src/less/carousel.less +232 -0
  217. data/upstream/bootstrap/3.0.3/src/less/close.less +33 -0
  218. data/upstream/bootstrap/3.0.3/src/less/code.less +53 -0
  219. data/upstream/bootstrap/3.0.3/src/less/component-animations.less +29 -0
  220. data/upstream/bootstrap/3.0.3/src/less/dropdowns.less +187 -0
  221. data/upstream/bootstrap/3.0.3/src/less/forms.less +375 -0
  222. data/upstream/bootstrap/3.0.3/src/less/glyphicons.less +237 -0
  223. data/upstream/bootstrap/3.0.3/src/less/grid.less +79 -0
  224. data/upstream/bootstrap/3.0.3/src/less/input-groups.less +136 -0
  225. data/upstream/bootstrap/3.0.3/src/less/jumbotron.less +46 -0
  226. data/upstream/bootstrap/3.0.3/src/less/labels.less +64 -0
  227. data/upstream/bootstrap/3.0.3/src/less/list-group.less +88 -0
  228. data/upstream/bootstrap/3.0.3/src/less/media.less +56 -0
  229. data/upstream/bootstrap/3.0.3/src/less/mixins.less +845 -0
  230. data/upstream/bootstrap/3.0.3/src/less/modals.less +129 -0
  231. data/upstream/bootstrap/3.0.3/src/less/navbar.less +612 -0
  232. data/upstream/bootstrap/3.0.3/src/less/navs.less +242 -0
  233. data/upstream/bootstrap/3.0.3/src/less/normalize.less +406 -0
  234. data/upstream/bootstrap/3.0.3/src/less/pager.less +55 -0
  235. data/upstream/bootstrap/3.0.3/src/less/pagination.less +85 -0
  236. data/upstream/bootstrap/3.0.3/src/less/panels.less +182 -0
  237. data/upstream/bootstrap/3.0.3/src/less/popovers.less +133 -0
  238. data/upstream/bootstrap/3.0.3/src/less/print.less +105 -0
  239. data/upstream/bootstrap/3.0.3/src/less/progress-bars.less +80 -0
  240. data/upstream/bootstrap/3.0.3/src/less/responsive-utilities.less +209 -0
  241. data/upstream/bootstrap/3.0.3/src/less/scaffolding.less +119 -0
  242. data/upstream/bootstrap/3.0.3/src/less/tables.less +231 -0
  243. data/upstream/bootstrap/3.0.3/src/less/theme.less +247 -0
  244. data/upstream/bootstrap/3.0.3/src/less/thumbnails.less +36 -0
  245. data/upstream/bootstrap/3.0.3/src/less/tooltip.less +95 -0
  246. data/upstream/bootstrap/3.0.3/src/less/type.less +281 -0
  247. data/upstream/bootstrap/3.0.3/src/less/utilities.less +56 -0
  248. data/upstream/bootstrap/3.0.3/src/less/variables.less +642 -0
  249. data/upstream/bootstrap/3.0.3/src/less/wells.less +29 -0
  250. data/upstream/bootstrap/3.0.3/src/package.json +51 -0
  251. data/upstream/bootstrap/3.0.3/stylesheets/bootstrap-theme.css +397 -0
  252. data/upstream/bootstrap/3.0.3/stylesheets/bootstrap-theme.min.css +7 -0
  253. data/upstream/bootstrap/3.0.3/stylesheets/bootstrap.css +7118 -0
  254. data/upstream/bootstrap/3.0.3/stylesheets/bootstrap.min.css +7 -0
  255. data/upstream/font-awesome-4.0.3.zip +0 -0
  256. data/upstream/font-awesome/4.0.3/fonts/FontAwesome.otf +0 -0
  257. data/upstream/font-awesome/4.0.3/fonts/fontawesome-webfont.eot +0 -0
  258. data/upstream/font-awesome/4.0.3/fonts/fontawesome-webfont.svg +414 -0
  259. data/upstream/font-awesome/4.0.3/fonts/fontawesome-webfont.ttf +0 -0
  260. data/upstream/font-awesome/4.0.3/fonts/fontawesome-webfont.woff +0 -0
  261. data/upstream/font-awesome/4.0.3/stylesheets/font-awesome.css +1338 -0
  262. data/upstream/font-awesome/4.0.3/stylesheets/font-awesome.min.css +4 -0
  263. data/upstream/font-awesome/4.0.3/stylesheets/less/bordered-pulled.less +16 -0
  264. data/upstream/font-awesome/4.0.3/stylesheets/less/core.less +12 -0
  265. data/upstream/font-awesome/4.0.3/stylesheets/less/fixed-width.less +6 -0
  266. data/upstream/font-awesome/4.0.3/stylesheets/less/font-awesome.less +17 -0
  267. data/upstream/font-awesome/4.0.3/stylesheets/less/icons.less +412 -0
  268. data/upstream/font-awesome/4.0.3/stylesheets/less/larger.less +13 -0
  269. data/upstream/font-awesome/4.0.3/stylesheets/less/list.less +19 -0
  270. data/upstream/font-awesome/4.0.3/stylesheets/less/mixins.less +20 -0
  271. data/upstream/font-awesome/4.0.3/stylesheets/less/path.less +14 -0
  272. data/upstream/font-awesome/4.0.3/stylesheets/less/rotated-flipped.less +9 -0
  273. data/upstream/font-awesome/4.0.3/stylesheets/less/spinning.less +30 -0
  274. data/upstream/font-awesome/4.0.3/stylesheets/less/stacked.less +20 -0
  275. data/upstream/font-awesome/4.0.3/stylesheets/less/variables.less +381 -0
  276. data/upstream/font-awesome/4.0.3/stylesheets/scss/_bordered-pulled.scss +16 -0
  277. data/upstream/font-awesome/4.0.3/stylesheets/scss/_core.scss +12 -0
  278. data/upstream/font-awesome/4.0.3/stylesheets/scss/_fixed-width.scss +6 -0
  279. data/upstream/font-awesome/4.0.3/stylesheets/scss/_icons.scss +412 -0
  280. data/upstream/font-awesome/4.0.3/stylesheets/scss/_larger.scss +13 -0
  281. data/upstream/font-awesome/4.0.3/stylesheets/scss/_list.scss +19 -0
  282. data/upstream/font-awesome/4.0.3/stylesheets/scss/_mixins.scss +20 -0
  283. data/upstream/font-awesome/4.0.3/stylesheets/scss/_path.scss +14 -0
  284. data/upstream/font-awesome/4.0.3/stylesheets/scss/_rotated-flipped.scss +9 -0
  285. data/upstream/font-awesome/4.0.3/stylesheets/scss/_spinning.scss +30 -0
  286. data/upstream/font-awesome/4.0.3/stylesheets/scss/_stacked.scss +20 -0
  287. data/upstream/font-awesome/4.0.3/stylesheets/scss/_variables.scss +381 -0
  288. data/upstream/font-awesome/4.0.3/stylesheets/scss/font-awesome.scss +17 -0
  289. metadata +505 -0
@@ -0,0 +1,399 @@
1
+ /* Blob.js
2
+ * A Blob implementation.
3
+ * 2013-06-20
4
+ *
5
+ * By Eli Grey, http://eligrey.com
6
+ * By Devin Samarin, https://github.com/eboyjr
7
+ * License: X11/MIT
8
+ * See LICENSE.md
9
+ */
10
+
11
+ /*global self, unescape */
12
+ /*jslint bitwise: true, regexp: true, confusion: true, es5: true, vars: true, white: true,
13
+ plusplus: true */
14
+
15
+ /*! @source http://purl.eligrey.com/github/Blob.js/blob/master/Blob.js */
16
+
17
+ if (!(typeof Blob === "function" || typeof Blob === "object") || typeof URL === "undefined")
18
+ if ((typeof Blob === "function" || typeof Blob === "object") && typeof webkitURL !== "undefined") self.URL = webkitURL;
19
+ else var Blob = (function (view) {
20
+ "use strict";
21
+
22
+ var BlobBuilder = view.BlobBuilder || view.WebKitBlobBuilder || view.MozBlobBuilder || view.MSBlobBuilder || (function(view) {
23
+ var
24
+ get_class = function(object) {
25
+ return Object.prototype.toString.call(object).match(/^\[object\s(.*)\]$/)[1];
26
+ }
27
+ , FakeBlobBuilder = function BlobBuilder() {
28
+ this.data = [];
29
+ }
30
+ , FakeBlob = function Blob(data, type, encoding) {
31
+ this.data = data;
32
+ this.size = data.length;
33
+ this.type = type;
34
+ this.encoding = encoding;
35
+ }
36
+ , FBB_proto = FakeBlobBuilder.prototype
37
+ , FB_proto = FakeBlob.prototype
38
+ , FileReaderSync = view.FileReaderSync
39
+ , FileException = function(type) {
40
+ this.code = this[this.name = type];
41
+ }
42
+ , file_ex_codes = (
43
+ "NOT_FOUND_ERR SECURITY_ERR ABORT_ERR NOT_READABLE_ERR ENCODING_ERR "
44
+ + "NO_MODIFICATION_ALLOWED_ERR INVALID_STATE_ERR SYNTAX_ERR"
45
+ ).split(" ")
46
+ , file_ex_code = file_ex_codes.length
47
+ , real_URL = view.URL || view.webkitURL || view
48
+ , real_create_object_URL = real_URL.createObjectURL
49
+ , real_revoke_object_URL = real_URL.revokeObjectURL
50
+ , URL = real_URL
51
+ , btoa = view.btoa
52
+ , atob = view.atob
53
+
54
+ , ArrayBuffer = view.ArrayBuffer
55
+ , Uint8Array = view.Uint8Array
56
+ ;
57
+ FakeBlob.fake = FB_proto.fake = true;
58
+ while (file_ex_code--) {
59
+ FileException.prototype[file_ex_codes[file_ex_code]] = file_ex_code + 1;
60
+ }
61
+ if (!real_URL.createObjectURL) {
62
+ URL = view.URL = {};
63
+ }
64
+ URL.createObjectURL = function(blob) {
65
+ var
66
+ type = blob.type
67
+ , data_URI_header
68
+ ;
69
+ if (type === null) {
70
+ type = "application/octet-stream";
71
+ }
72
+ if (blob instanceof FakeBlob) {
73
+ data_URI_header = "data:" + type;
74
+ if (blob.encoding === "base64") {
75
+ return data_URI_header + ";base64," + blob.data;
76
+ } else if (blob.encoding === "URI") {
77
+ return data_URI_header + "," + decodeURIComponent(blob.data);
78
+ } if (btoa) {
79
+ return data_URI_header + ";base64," + btoa(blob.data);
80
+ } else {
81
+ return data_URI_header + "," + encodeURIComponent(blob.data);
82
+ }
83
+ } else if (real_create_object_URL) {
84
+ return real_create_object_URL.call(real_URL, blob);
85
+ }
86
+ };
87
+ URL.revokeObjectURL = function(object_URL) {
88
+ if (object_URL.substring(0, 5) !== "data:" && real_revoke_object_URL) {
89
+ real_revoke_object_URL.call(real_URL, object_URL);
90
+ }
91
+ };
92
+ FBB_proto.append = function(data/*, endings*/) {
93
+ var bb = this.data;
94
+ // decode data to a binary string
95
+ if (Uint8Array && (data instanceof ArrayBuffer || data instanceof Uint8Array)) {
96
+ var
97
+ str = ""
98
+ , buf = new Uint8Array(data)
99
+ , i = 0
100
+ , buf_len = buf.length
101
+ ;
102
+ for (; i < buf_len; i++) {
103
+ str += String.fromCharCode(buf[i]);
104
+ }
105
+ bb.push(str);
106
+ } else if (get_class(data) === "Blob" || get_class(data) === "File") {
107
+ if (FileReaderSync) {
108
+ var fr = new FileReaderSync;
109
+ bb.push(fr.readAsBinaryString(data));
110
+ } else {
111
+ // async FileReader won't work as BlobBuilder is sync
112
+ throw new FileException("NOT_READABLE_ERR");
113
+ }
114
+ } else if (data instanceof FakeBlob) {
115
+ if (data.encoding === "base64" && atob) {
116
+ bb.push(atob(data.data));
117
+ } else if (data.encoding === "URI") {
118
+ bb.push(decodeURIComponent(data.data));
119
+ } else if (data.encoding === "raw") {
120
+ bb.push(data.data);
121
+ }
122
+ } else {
123
+ if (typeof data !== "string") {
124
+ data += ""; // convert unsupported types to strings
125
+ }
126
+ // decode UTF-16 to binary string
127
+ bb.push(unescape(encodeURIComponent(data)));
128
+ }
129
+ };
130
+ FBB_proto.getBlob = function(type) {
131
+ if (!arguments.length) {
132
+ type = null;
133
+ }
134
+ return new FakeBlob(this.data.join(""), type, "raw");
135
+ };
136
+ FBB_proto.toString = function() {
137
+ return "[object BlobBuilder]";
138
+ };
139
+ FB_proto.slice = function(start, end, type) {
140
+ var args = arguments.length;
141
+ if (args < 3) {
142
+ type = null;
143
+ }
144
+ return new FakeBlob(
145
+ this.data.slice(start, args > 1 ? end : this.data.length)
146
+ , type
147
+ , this.encoding
148
+ );
149
+ };
150
+ FB_proto.toString = function() {
151
+ return "[object Blob]";
152
+ };
153
+ return FakeBlobBuilder;
154
+ }(view));
155
+
156
+ return function Blob(blobParts, options) {
157
+ var type = options ? (options.type || "") : "";
158
+ var builder = new BlobBuilder();
159
+ if (blobParts) {
160
+ for (var i = 0, len = blobParts.length; i < len; i++) {
161
+ builder.append(blobParts[i]);
162
+ }
163
+ }
164
+ return builder.getBlob(type);
165
+ };
166
+ }(self));
167
+
168
+ /* FileSaver.js
169
+ * A saveAs() FileSaver implementation.
170
+ * 2013-10-21
171
+ *
172
+ * By Eli Grey, http://eligrey.com
173
+ * License: X11/MIT
174
+ * See LICENSE.md
175
+ */
176
+
177
+ /*global self */
178
+ /*jslint bitwise: true, regexp: true, confusion: true, es5: true, vars: true, white: true,
179
+ plusplus: true */
180
+
181
+ /*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */
182
+
183
+ var saveAs = saveAs
184
+ || (typeof navigator !== 'undefined' && navigator.msSaveOrOpenBlob && navigator.msSaveOrOpenBlob.bind(navigator))
185
+ || (function(view) {
186
+ "use strict";
187
+ var
188
+ doc = view.document
189
+ // only get URL when necessary in case BlobBuilder.js hasn't overridden it yet
190
+ , get_URL = function() {
191
+ return view.URL || view.webkitURL || view;
192
+ }
193
+ , URL = view.URL || view.webkitURL || view
194
+ , save_link = doc.createElementNS("http://www.w3.org/1999/xhtml", "a")
195
+ , can_use_save_link = !view.externalHost && "download" in save_link
196
+ , click = function(node) {
197
+ var event = doc.createEvent("MouseEvents");
198
+ event.initMouseEvent(
199
+ "click", true, false, view, 0, 0, 0, 0, 0
200
+ , false, false, false, false, 0, null
201
+ );
202
+ node.dispatchEvent(event);
203
+ }
204
+ , webkit_req_fs = view.webkitRequestFileSystem
205
+ , req_fs = view.requestFileSystem || webkit_req_fs || view.mozRequestFileSystem
206
+ , throw_outside = function (ex) {
207
+ (view.setImmediate || view.setTimeout)(function() {
208
+ throw ex;
209
+ }, 0);
210
+ }
211
+ , force_saveable_type = "application/octet-stream"
212
+ , fs_min_size = 0
213
+ , deletion_queue = []
214
+ , process_deletion_queue = function() {
215
+ var i = deletion_queue.length;
216
+ while (i--) {
217
+ var file = deletion_queue[i];
218
+ if (typeof file === "string") { // file is an object URL
219
+ URL.revokeObjectURL(file);
220
+ } else { // file is a File
221
+ file.remove();
222
+ }
223
+ }
224
+ deletion_queue.length = 0; // clear queue
225
+ }
226
+ , dispatch = function(filesaver, event_types, event) {
227
+ event_types = [].concat(event_types);
228
+ var i = event_types.length;
229
+ while (i--) {
230
+ var listener = filesaver["on" + event_types[i]];
231
+ if (typeof listener === "function") {
232
+ try {
233
+ listener.call(filesaver, event || filesaver);
234
+ } catch (ex) {
235
+ throw_outside(ex);
236
+ }
237
+ }
238
+ }
239
+ }
240
+ , FileSaver = function(blob, name) {
241
+ // First try a.download, then web filesystem, then object URLs
242
+ var
243
+ filesaver = this
244
+ , type = blob.type
245
+ , blob_changed = false
246
+ , object_url
247
+ , target_view
248
+ , get_object_url = function() {
249
+ var object_url = get_URL().createObjectURL(blob);
250
+ deletion_queue.push(object_url);
251
+ return object_url;
252
+ }
253
+ , dispatch_all = function() {
254
+ dispatch(filesaver, "writestart progress write writeend".split(" "));
255
+ }
256
+ // on any filesys errors revert to saving with object URLs
257
+ , fs_error = function() {
258
+ // don't create more object URLs than needed
259
+ if (blob_changed || !object_url) {
260
+ object_url = get_object_url(blob);
261
+ }
262
+ if (target_view) {
263
+ target_view.location.href = object_url;
264
+ } else {
265
+ window.open(object_url, "_blank");
266
+ }
267
+ filesaver.readyState = filesaver.DONE;
268
+ dispatch_all();
269
+ }
270
+ , abortable = function(func) {
271
+ return function() {
272
+ if (filesaver.readyState !== filesaver.DONE) {
273
+ return func.apply(this, arguments);
274
+ }
275
+ };
276
+ }
277
+ , create_if_not_found = {create: true, exclusive: false}
278
+ , slice
279
+ ;
280
+ filesaver.readyState = filesaver.INIT;
281
+ if (!name) {
282
+ name = "download";
283
+ }
284
+ if (can_use_save_link) {
285
+ object_url = get_object_url(blob);
286
+ // FF for Android has a nasty garbage collection mechanism
287
+ // that turns all objects that are not pure javascript into 'deadObject'
288
+ // this means `doc` and `save_link` are unusable and need to be recreated
289
+ // `view` is usable though:
290
+ doc = view.document;
291
+ save_link = doc.createElementNS("http://www.w3.org/1999/xhtml", "a");
292
+ save_link.href = object_url;
293
+ save_link.download = name;
294
+ var event = doc.createEvent("MouseEvents");
295
+ event.initMouseEvent(
296
+ "click", true, false, view, 0, 0, 0, 0, 0
297
+ , false, false, false, false, 0, null
298
+ );
299
+ save_link.dispatchEvent(event);
300
+ filesaver.readyState = filesaver.DONE;
301
+ dispatch_all();
302
+ return;
303
+ }
304
+ // Object and web filesystem URLs have a problem saving in Google Chrome when
305
+ // viewed in a tab, so I force save with application/octet-stream
306
+ // http://code.google.com/p/chromium/issues/detail?id=91158
307
+ if (view.chrome && type && type !== force_saveable_type) {
308
+ slice = blob.slice || blob.webkitSlice;
309
+ blob = slice.call(blob, 0, blob.size, force_saveable_type);
310
+ blob_changed = true;
311
+ }
312
+ // Since I can't be sure that the guessed media type will trigger a download
313
+ // in WebKit, I append .download to the filename.
314
+ // https://bugs.webkit.org/show_bug.cgi?id=65440
315
+ if (webkit_req_fs && name !== "download") {
316
+ name += ".download";
317
+ }
318
+ if (type === force_saveable_type || webkit_req_fs) {
319
+ target_view = view;
320
+ }
321
+ if (!req_fs) {
322
+ fs_error();
323
+ return;
324
+ }
325
+ fs_min_size += blob.size;
326
+ req_fs(view.TEMPORARY, fs_min_size, abortable(function(fs) {
327
+ fs.root.getDirectory("saved", create_if_not_found, abortable(function(dir) {
328
+ var save = function() {
329
+ dir.getFile(name, create_if_not_found, abortable(function(file) {
330
+ file.createWriter(abortable(function(writer) {
331
+ writer.onwriteend = function(event) {
332
+ target_view.location.href = file.toURL();
333
+ deletion_queue.push(file);
334
+ filesaver.readyState = filesaver.DONE;
335
+ dispatch(filesaver, "writeend", event);
336
+ };
337
+ writer.onerror = function() {
338
+ var error = writer.error;
339
+ if (error.code !== error.ABORT_ERR) {
340
+ fs_error();
341
+ }
342
+ };
343
+ "writestart progress write abort".split(" ").forEach(function(event) {
344
+ writer["on" + event] = filesaver["on" + event];
345
+ });
346
+ writer.write(blob);
347
+ filesaver.abort = function() {
348
+ writer.abort();
349
+ filesaver.readyState = filesaver.DONE;
350
+ };
351
+ filesaver.readyState = filesaver.WRITING;
352
+ }), fs_error);
353
+ }), fs_error);
354
+ };
355
+ dir.getFile(name, {create: false}, abortable(function(file) {
356
+ // delete file if it already exists
357
+ file.remove();
358
+ save();
359
+ }), abortable(function(ex) {
360
+ if (ex.code === ex.NOT_FOUND_ERR) {
361
+ save();
362
+ } else {
363
+ fs_error();
364
+ }
365
+ }));
366
+ }), fs_error);
367
+ }), fs_error);
368
+ }
369
+ , FS_proto = FileSaver.prototype
370
+ , saveAs = function(blob, name) {
371
+ return new FileSaver(blob, name);
372
+ }
373
+ ;
374
+ FS_proto.abort = function() {
375
+ var filesaver = this;
376
+ filesaver.readyState = filesaver.DONE;
377
+ dispatch(filesaver, "abort");
378
+ };
379
+ FS_proto.readyState = FS_proto.INIT = 0;
380
+ FS_proto.WRITING = 1;
381
+ FS_proto.DONE = 2;
382
+
383
+ FS_proto.error =
384
+ FS_proto.onwritestart =
385
+ FS_proto.onprogress =
386
+ FS_proto.onwrite =
387
+ FS_proto.onabort =
388
+ FS_proto.onerror =
389
+ FS_proto.onwriteend =
390
+ null;
391
+
392
+ view.addEventListener("unload", process_deletion_queue, false);
393
+ return saveAs;
394
+ }(this.self || this.window || this.content));
395
+ // `self` is undefined in Firefox for Android content script context
396
+ // while `this` is nsIContentFrameMessageManager
397
+ // with an attribute `content` that corresponds to the window
398
+
399
+ if (typeof module !== 'undefined') module.exports = saveAs;
@@ -0,0 +1,500 @@
1
+ /*
2
+
3
+ Holder - 2.2 - client side image placeholders
4
+ (c) 2012-2013 Ivan Malopinsky / http://imsky.co
5
+
6
+ Provided under the MIT License.
7
+ Commercial use requires attribution.
8
+
9
+ */
10
+
11
+ var Holder = Holder || {};
12
+ (function (app, win) {
13
+
14
+ var preempted = false,
15
+ fallback = false,
16
+ canvas = document.createElement('canvas');
17
+ var dpr = 1, bsr = 1;
18
+ var resizable_images = [];
19
+
20
+ if (!canvas.getContext) {
21
+ fallback = true;
22
+ } else {
23
+ if (canvas.toDataURL("image/png")
24
+ .indexOf("data:image/png") < 0) {
25
+ //Android doesn't support data URI
26
+ fallback = true;
27
+ } else {
28
+ var ctx = canvas.getContext("2d");
29
+ }
30
+ }
31
+
32
+ if(!fallback){
33
+ dpr = window.devicePixelRatio || 1,
34
+ bsr = ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1;
35
+ }
36
+
37
+ var ratio = dpr / bsr;
38
+
39
+ var settings = {
40
+ domain: "holder.js",
41
+ images: "img",
42
+ bgnodes: ".holderjs",
43
+ themes: {
44
+ "gray": {
45
+ background: "#eee",
46
+ foreground: "#aaa",
47
+ size: 12
48
+ },
49
+ "social": {
50
+ background: "#3a5a97",
51
+ foreground: "#fff",
52
+ size: 12
53
+ },
54
+ "industrial": {
55
+ background: "#434A52",
56
+ foreground: "#C2F200",
57
+ size: 12
58
+ },
59
+ "sky": {
60
+ background: "#0D8FDB",
61
+ foreground: "#fff",
62
+ size: 12
63
+ },
64
+ "vine": {
65
+ background: "#39DBAC",
66
+ foreground: "#1E292C",
67
+ size: 12
68
+ },
69
+ "lava": {
70
+ background: "#F8591A",
71
+ foreground: "#1C2846",
72
+ size: 12
73
+ }
74
+ },
75
+ stylesheet: ""
76
+ };
77
+ app.flags = {
78
+ dimensions: {
79
+ regex: /^(\d+)x(\d+)$/,
80
+ output: function (val) {
81
+ var exec = this.regex.exec(val);
82
+ return {
83
+ width: +exec[1],
84
+ height: +exec[2]
85
+ }
86
+ }
87
+ },
88
+ fluid: {
89
+ regex: /^([0-9%]+)x([0-9%]+)$/,
90
+ output: function (val) {
91
+ var exec = this.regex.exec(val);
92
+ return {
93
+ width: exec[1],
94
+ height: exec[2]
95
+ }
96
+ }
97
+ },
98
+ colors: {
99
+ regex: /#([0-9a-f]{3,})\:#([0-9a-f]{3,})/i,
100
+ output: function (val) {
101
+ var exec = this.regex.exec(val);
102
+ return {
103
+ size: settings.themes.gray.size,
104
+ foreground: "#" + exec[2],
105
+ background: "#" + exec[1]
106
+ }
107
+ }
108
+ },
109
+ text: {
110
+ regex: /text\:(.*)/,
111
+ output: function (val) {
112
+ return this.regex.exec(val)[1];
113
+ }
114
+ },
115
+ font: {
116
+ regex: /font\:(.*)/,
117
+ output: function (val) {
118
+ return this.regex.exec(val)[1];
119
+ }
120
+ },
121
+ auto: {
122
+ regex: /^auto$/
123
+ },
124
+ textmode: {
125
+ regex: /textmode\:(.*)/,
126
+ output: function(val){
127
+ return this.regex.exec(val)[1];
128
+ }
129
+ }
130
+ }
131
+
132
+ //getElementsByClassName polyfill
133
+ document.getElementsByClassName||(document.getElementsByClassName=function(e){var t=document,n,r,i,s=[];if(t.querySelectorAll)return t.querySelectorAll("."+e);if(t.evaluate){r=".//*[contains(concat(' ', @class, ' '), ' "+e+" ')]",n=t.evaluate(r,t,null,0,null);while(i=n.iterateNext())s.push(i)}else{n=t.getElementsByTagName("*"),r=new RegExp("(^|\\s)"+e+"(\\s|$)");for(i=0;i<n.length;i++)r.test(n[i].className)&&s.push(n[i])}return s})
134
+
135
+ //getComputedStyle polyfill
136
+ window.getComputedStyle||(window.getComputedStyle=function(e){return this.el=e,this.getPropertyValue=function(t){var n=/(\-([a-z]){1})/g;return t=="float"&&(t="styleFloat"),n.test(t)&&(t=t.replace(n,function(){return arguments[2].toUpperCase()})),e.currentStyle[t]?e.currentStyle[t]:null},this})
137
+
138
+ //http://javascript.nwbox.com/ContentLoaded by Diego Perini with modifications
139
+ function contentLoaded(n,t){var l="complete",s="readystatechange",u=!1,h=u,c=!0,i=n.document,a=i.documentElement,e=i.addEventListener?"addEventListener":"attachEvent",v=i.addEventListener?"removeEventListener":"detachEvent",f=i.addEventListener?"":"on",r=function(e){(e.type!=s||i.readyState==l)&&((e.type=="load"?n:i)[v](f+e.type,r,u),!h&&(h=!0)&&t.call(n,null))},o=function(){try{a.doScroll("left")}catch(n){setTimeout(o,50);return}r("poll")};if(i.readyState==l)t.call(n,"lazy");else{if(i.createEventObject&&a.doScroll){try{c=!n.frameElement}catch(y){}c&&o()}i[e](f+"DOMContentLoaded",r,u),i[e](f+s,r,u),n[e](f+"load",r,u)}}
140
+
141
+ //https://gist.github.com/991057 by Jed Schmidt with modifications
142
+ function selector(a){
143
+ a=a.match(/^(\W)?(.*)/);var b=document["getElement"+(a[1]?a[1]=="#"?"ById":"sByClassName":"sByTagName")](a[2]);
144
+ var ret=[]; b!==null&&(b.length?ret=b:b.length===0?ret=b:ret=[b]); return ret;
145
+ }
146
+
147
+ //shallow object property extend
148
+ function extend(a,b){
149
+ var c={};
150
+ for(var i in a){
151
+ if(a.hasOwnProperty(i)){
152
+ c[i]=a[i];
153
+ }
154
+ }
155
+ for(var i in b){
156
+ if(b.hasOwnProperty(i)){
157
+ c[i]=b[i];
158
+ }
159
+ }
160
+ return c
161
+ }
162
+
163
+ //hasOwnProperty polyfill
164
+ if (!Object.prototype.hasOwnProperty)
165
+ /*jshint -W001, -W103 */
166
+ Object.prototype.hasOwnProperty = function(prop) {
167
+ var proto = this.__proto__ || this.constructor.prototype;
168
+ return (prop in this) && (!(prop in proto) || proto[prop] !== this[prop]);
169
+ }
170
+ /*jshint +W001, +W103 */
171
+
172
+ function text_size(width, height, template) {
173
+ height = parseInt(height, 10);
174
+ width = parseInt(width, 10);
175
+ var bigSide = Math.max(height, width)
176
+ var smallSide = Math.min(height, width)
177
+ var scale = 1 / 12;
178
+ var newHeight = Math.min(smallSide * 0.75, 0.75 * bigSide * scale);
179
+ return {
180
+ height: Math.round(Math.max(template.size, newHeight))
181
+ }
182
+ }
183
+
184
+ function draw(args) {
185
+ var ctx = args.ctx;
186
+ var dimensions = args.dimensions;
187
+ var template = args.template;
188
+ var ratio = args.ratio;
189
+ var holder = args.holder;
190
+ var literal = holder.textmode == "literal";
191
+ var exact = holder.textmode == "exact";
192
+
193
+ var ts = text_size(dimensions.width, dimensions.height, template);
194
+ var text_height = ts.height;
195
+ var width = dimensions.width * ratio,
196
+ height = dimensions.height * ratio;
197
+ var font = template.font ? template.font : "sans-serif";
198
+ canvas.width = width;
199
+ canvas.height = height;
200
+ ctx.textAlign = "center";
201
+ ctx.textBaseline = "middle";
202
+ ctx.fillStyle = template.background;
203
+ ctx.fillRect(0, 0, width, height);
204
+ ctx.fillStyle = template.foreground;
205
+ ctx.font = "bold " + text_height + "px " + font;
206
+ var text = template.text ? template.text : (Math.floor(dimensions.width) + "x" + Math.floor(dimensions.height));
207
+ if (literal) {
208
+ var dimensions = holder.dimensions;
209
+ text = dimensions.width + "x" + dimensions.height;
210
+ }
211
+ else if(exact && holder.exact_dimensions){
212
+ var dimensions = holder.exact_dimensions;
213
+ text = (Math.floor(dimensions.width) + "x" + Math.floor(dimensions.height));
214
+ }
215
+ var text_width = ctx.measureText(text).width;
216
+ if (text_width / width >= 0.75) {
217
+ text_height = Math.floor(text_height * 0.75 * (width / text_width));
218
+ }
219
+ //Resetting font size if necessary
220
+ ctx.font = "bold " + (text_height * ratio) + "px " + font;
221
+ ctx.fillText(text, (width / 2), (height / 2), width);
222
+ return canvas.toDataURL("image/png");
223
+ }
224
+
225
+ function render(mode, el, holder, src) {
226
+
227
+ var dimensions = holder.dimensions,
228
+ theme = holder.theme,
229
+ text = holder.text ? decodeURIComponent(holder.text) : holder.text;
230
+ var dimensions_caption = dimensions.width + "x" + dimensions.height;
231
+ theme = (text ? extend(theme, {
232
+ text: text
233
+ }) : theme);
234
+ theme = (holder.font ? extend(theme, {
235
+ font: holder.font
236
+ }) : theme);
237
+ el.setAttribute("data-src", src);
238
+ holder.theme = theme;
239
+ el.holder_data = holder;
240
+
241
+ if (mode == "image") {
242
+ el.setAttribute("alt", text ? text : theme.text ? theme.text + " [" + dimensions_caption + "]" : dimensions_caption);
243
+ if (fallback || !holder.auto) {
244
+ el.style.width = dimensions.width + "px";
245
+ el.style.height = dimensions.height + "px";
246
+ }
247
+ if (fallback) {
248
+ el.style.backgroundColor = theme.background;
249
+ } else {
250
+ el.setAttribute("src", draw({ctx: ctx, dimensions: dimensions, template: theme, ratio:ratio, holder: holder}));
251
+
252
+ if(holder.textmode && holder.textmode == "exact"){
253
+ resizable_images.push(el);
254
+ resizable_update(el);
255
+ }
256
+
257
+ }
258
+ } else if (mode == "background") {
259
+ if (!fallback) {
260
+ el.style.backgroundImage = "url(" + draw({ctx:ctx, dimensions: dimensions, template: theme, ratio: ratio, holder: holder}) + ")";
261
+ el.style.backgroundSize = dimensions.width + "px " + dimensions.height + "px";
262
+ }
263
+ } else if (mode == "fluid") {
264
+ el.setAttribute("alt", text ? text : theme.text ? theme.text + " [" + dimensions_caption + "]" : dimensions_caption);
265
+ if (dimensions.height.slice(-1) == "%") {
266
+ el.style.height = dimensions.height
267
+ } else {
268
+ el.style.height = dimensions.height + "px"
269
+ }
270
+ if (dimensions.width.slice(-1) == "%") {
271
+ el.style.width = dimensions.width
272
+ } else {
273
+ el.style.width = dimensions.width + "px"
274
+ }
275
+ if (el.style.display == "inline" || el.style.display === "" || el.style.display == "none") {
276
+ el.style.display = "block";
277
+ }
278
+ if (fallback) {
279
+ el.style.backgroundColor = theme.background;
280
+ } else {
281
+ resizable_images.push(el);
282
+ resizable_update(el);
283
+ }
284
+ }
285
+ }
286
+
287
+ function dimension_check(el, callback) {
288
+ var dimensions = {
289
+ height: el.clientHeight,
290
+ width: el.clientWidth
291
+ };
292
+ if (!dimensions.height && !dimensions.width) {
293
+ if (el.hasAttribute("data-holder-invisible")) {
294
+ throw new Error("Holder: placeholder is not visible");
295
+ } else {
296
+ el.setAttribute("data-holder-invisible", true)
297
+ setTimeout(function () {
298
+ callback.call(this, el)
299
+ }, 1)
300
+ return null;
301
+ }
302
+ } else {
303
+ el.removeAttribute("data-holder-invisible")
304
+ }
305
+ return dimensions;
306
+ }
307
+
308
+ function resizable_update(element) {
309
+ var images;
310
+ if (element.nodeType == null) {
311
+ images = resizable_images;
312
+ } else {
313
+ images = [element]
314
+ }
315
+ for (var i in images) {
316
+ if (!images.hasOwnProperty(i)) {
317
+ continue;
318
+ }
319
+ var el = images[i]
320
+ if (el.holder_data) {
321
+ var holder = el.holder_data;
322
+ var dimensions = dimension_check(el, resizable_update)
323
+ if(dimensions){
324
+ if(holder.fluid){
325
+ el.setAttribute("src", draw({
326
+ ctx: ctx,
327
+ dimensions: dimensions,
328
+ template: holder.theme,
329
+ ratio: ratio,
330
+ holder: holder
331
+ }))
332
+ }
333
+ if(holder.textmode && holder.textmode == "exact"){
334
+ holder.exact_dimensions = dimensions;
335
+ el.setAttribute("src", draw({
336
+ ctx: ctx,
337
+ dimensions: holder.dimensions,
338
+ template: holder.theme,
339
+ ratio: ratio,
340
+ holder: holder
341
+ }))
342
+ }
343
+ }
344
+ }
345
+ }
346
+ }
347
+
348
+ function parse_flags(flags, options) {
349
+ var ret = {
350
+ theme: extend(settings.themes.gray, {})
351
+ };
352
+ var render = false;
353
+ for (sl = flags.length, j = 0; j < sl; j++) {
354
+ var flag = flags[j];
355
+ if (app.flags.dimensions.match(flag)) {
356
+ render = true;
357
+ ret.dimensions = app.flags.dimensions.output(flag);
358
+ } else if (app.flags.fluid.match(flag)) {
359
+ render = true;
360
+ ret.dimensions = app.flags.fluid.output(flag);
361
+ ret.fluid = true;
362
+ } else if (app.flags.textmode.match(flag)) {
363
+ ret.textmode = app.flags.textmode.output(flag)
364
+ } else if (app.flags.colors.match(flag)) {
365
+ ret.theme = app.flags.colors.output(flag);
366
+ } else if (options.themes[flag]) {
367
+ //If a theme is specified, it will override custom colors
368
+ if(options.themes.hasOwnProperty(flag)){
369
+ ret.theme = extend(options.themes[flag], {});
370
+ }
371
+ } else if (app.flags.font.match(flag)) {
372
+ ret.font = app.flags.font.output(flag);
373
+ } else if (app.flags.auto.match(flag)) {
374
+ ret.auto = true;
375
+ } else if (app.flags.text.match(flag)) {
376
+ ret.text = app.flags.text.output(flag);
377
+ }
378
+ }
379
+ return render ? ret : false;
380
+ }
381
+
382
+ for (var flag in app.flags) {
383
+ if (!app.flags.hasOwnProperty(flag)) continue;
384
+ app.flags[flag].match = function (val) {
385
+ return val.match(this.regex)
386
+ }
387
+ }
388
+ app.add_theme = function (name, theme) {
389
+ name != null && theme != null && (settings.themes[name] = theme);
390
+ return app;
391
+ };
392
+ app.add_image = function (src, el) {
393
+ var node = selector(el);
394
+ if (node.length) {
395
+ for (var i = 0, l = node.length; i < l; i++) {
396
+ var img = document.createElement("img")
397
+ img.setAttribute("data-src", src);
398
+ node[i].appendChild(img);
399
+ }
400
+ }
401
+ return app;
402
+ };
403
+ app.run = function (o) {
404
+ preempted = true;
405
+
406
+ var options = extend(settings, o),
407
+ images = [],
408
+ imageNodes = [],
409
+ bgnodes = [];
410
+ if (typeof (options.images) == "string") {
411
+ imageNodes = selector(options.images);
412
+ } else if (window.NodeList && options.images instanceof window.NodeList) {
413
+ imageNodes = options.images;
414
+ } else if (window.Node && options.images instanceof window.Node) {
415
+ imageNodes = [options.images];
416
+ }
417
+
418
+ if (typeof (options.bgnodes) == "string") {
419
+ bgnodes = selector(options.bgnodes);
420
+ } else if (window.NodeList && options.elements instanceof window.NodeList) {
421
+ bgnodes = options.bgnodes;
422
+ } else if (window.Node && options.bgnodes instanceof window.Node) {
423
+ bgnodes = [options.bgnodes];
424
+ }
425
+ for (i = 0, l = imageNodes.length; i < l; i++) images.push(imageNodes[i]);
426
+ var holdercss = document.getElementById("holderjs-style");
427
+ if (!holdercss) {
428
+ holdercss = document.createElement("style");
429
+ holdercss.setAttribute("id", "holderjs-style");
430
+ holdercss.type = "text/css";
431
+ document.getElementsByTagName("head")[0].appendChild(holdercss);
432
+ }
433
+ if (!options.nocss) {
434
+ if (holdercss.styleSheet) {
435
+ holdercss.styleSheet.cssText += options.stylesheet;
436
+ } else {
437
+ holdercss.appendChild(document.createTextNode(options.stylesheet));
438
+ }
439
+ }
440
+ var cssregex = new RegExp(options.domain + "\/(.*?)\"?\\)");
441
+ for (var l = bgnodes.length, i = 0; i < l; i++) {
442
+ var src = window.getComputedStyle(bgnodes[i], null)
443
+ .getPropertyValue("background-image");
444
+ var flags = src.match(cssregex);
445
+ var bgsrc = bgnodes[i].getAttribute("data-background-src");
446
+ if (flags) {
447
+ var holder = parse_flags(flags[1].split("/"), options);
448
+ if (holder) {
449
+ render("background", bgnodes[i], holder, src);
450
+ }
451
+ } else if (bgsrc != null) {
452
+ var holder = parse_flags(bgsrc.substr(bgsrc.lastIndexOf(options.domain) + options.domain.length + 1)
453
+ .split("/"), options);
454
+ if (holder) {
455
+ render("background", bgnodes[i], holder, src);
456
+ }
457
+ }
458
+ }
459
+ for (l = images.length, i = 0; i < l; i++) {
460
+ var attr_data_src, attr_src;
461
+ attr_src = attr_data_src = src = null;
462
+ try {
463
+ attr_src = images[i].getAttribute("src");
464
+ attr_datasrc = images[i].getAttribute("data-src");
465
+ } catch (e) {}
466
+ if (attr_datasrc == null && !! attr_src && attr_src.indexOf(options.domain) >= 0) {
467
+ src = attr_src;
468
+ } else if ( !! attr_datasrc && attr_datasrc.indexOf(options.domain) >= 0) {
469
+ src = attr_datasrc;
470
+ }
471
+ if (src) {
472
+ var holder = parse_flags(src.substr(src.lastIndexOf(options.domain) + options.domain.length + 1)
473
+ .split("/"), options);
474
+ if (holder) {
475
+ if (holder.fluid) {
476
+ render("fluid", images[i], holder, src)
477
+ } else {
478
+ render("image", images[i], holder, src);
479
+ }
480
+ }
481
+ }
482
+ }
483
+ return app;
484
+ };
485
+ contentLoaded(win, function () {
486
+ if (window.addEventListener) {
487
+ window.addEventListener("resize", resizable_update, false);
488
+ window.addEventListener("orientationchange", resizable_update, false);
489
+ } else {
490
+ window.attachEvent("onresize", resizable_update)
491
+ }
492
+ preempted || app.run();
493
+ });
494
+ if (typeof define === "function" && define.amd) {
495
+ define([], function () {
496
+ return app;
497
+ });
498
+ }
499
+
500
+ })(Holder, window);