coalla-cms 0.4.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (300) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +81 -0
  3. data/Gemfile +4 -0
  4. data/Gemfile.lock +168 -0
  5. data/Rakefile +29 -0
  6. data/app/assets/fonts/glyphicons/glyphicons-halflings-regular.eot +0 -0
  7. data/app/assets/fonts/glyphicons/glyphicons-halflings-regular.svg +229 -0
  8. data/app/assets/fonts/glyphicons/glyphicons-halflings-regular.ttf +0 -0
  9. data/app/assets/fonts/glyphicons/glyphicons-halflings-regular.woff +0 -0
  10. data/app/assets/images/ajax-loader.gif +0 -0
  11. data/app/assets/images/blank.gif +0 -0
  12. data/app/assets/images/bootstrap/glyphicons-halflings-white.png +0 -0
  13. data/app/assets/images/bootstrap/glyphicons-halflings.png +0 -0
  14. data/app/assets/javascripts/admin/admin.js +295 -0
  15. data/app/assets/javascripts/admin/custom_admin.js +0 -0
  16. data/app/assets/javascripts/admin/jquery-migrate.min.js +2 -0
  17. data/app/assets/javascripts/admin/photo_uploader.js +67 -0
  18. data/app/assets/javascripts/admin/vendor/bootstrap.min.js +7 -0
  19. data/app/assets/javascripts/admin/vendor/jquery-ui-timepicker-addon-ru.js +40 -0
  20. data/app/assets/javascripts/admin/vendor/jquery.tagsinput.js +365 -0
  21. data/app/assets/javascripts/admin/vendor/jquery.tokeninput.patched.js +875 -0
  22. data/app/assets/javascripts/admin/vendor/underscore-min.js +5 -0
  23. data/app/assets/javascripts/ckeditor/plugins/autogrow/plugin.js +209 -0
  24. data/app/assets/javascripts/ckeditor/plugins/mediaembed/icons/hidpi/mediaembed.png +0 -0
  25. data/app/assets/javascripts/ckeditor/plugins/mediaembed/icons/mediaembed.png +0 -0
  26. data/app/assets/javascripts/ckeditor/plugins/mediaembed/plugin.js +64 -0
  27. data/app/assets/javascripts/ckeditor/plugins/slideshow/3rdParty/ad-gallery/LICENSE.txt +303 -0
  28. data/app/assets/javascripts/ckeditor/plugins/slideshow/3rdParty/ad-gallery/ad-gallery-css-diff.htm +831 -0
  29. data/app/assets/javascripts/ckeditor/plugins/slideshow/3rdParty/ad-gallery/ad_next.png +0 -0
  30. data/app/assets/javascripts/ckeditor/plugins/slideshow/3rdParty/ad-gallery/ad_prev.png +0 -0
  31. data/app/assets/javascripts/ckeditor/plugins/slideshow/3rdParty/ad-gallery/ad_scroll_back.png +0 -0
  32. data/app/assets/javascripts/ckeditor/plugins/slideshow/3rdParty/ad-gallery/ad_scroll_forward.png +0 -0
  33. data/app/assets/javascripts/ckeditor/plugins/slideshow/3rdParty/ad-gallery/jquery.ad-gallery.css +185 -0
  34. data/app/assets/javascripts/ckeditor/plugins/slideshow/3rdParty/ad-gallery/jquery.ad-gallery.js +984 -0
  35. data/app/assets/javascripts/ckeditor/plugins/slideshow/3rdParty/ad-gallery/jquery.ad-gallery.min - ref.js +10 -0
  36. data/app/assets/javascripts/ckeditor/plugins/slideshow/3rdParty/ad-gallery/jquery.ad-gallery.min.js +1 -0
  37. data/app/assets/javascripts/ckeditor/plugins/slideshow/3rdParty/ad-gallery/loader.gif +0 -0
  38. data/app/assets/javascripts/ckeditor/plugins/slideshow/3rdParty/ad-gallery/opa75.png +0 -0
  39. data/app/assets/javascripts/ckeditor/plugins/slideshow/3rdParty/ad-gallery/placeholder.png +0 -0
  40. data/app/assets/javascripts/ckeditor/plugins/slideshow/3rdParty/ad-gallery/trans.gif +0 -0
  41. data/app/assets/javascripts/ckeditor/plugins/slideshow/3rdParty/fancybox2/blank.gif +0 -0
  42. data/app/assets/javascripts/ckeditor/plugins/slideshow/3rdParty/fancybox2/fancybox_loading.gif +0 -0
  43. data/app/assets/javascripts/ckeditor/plugins/slideshow/3rdParty/fancybox2/fancybox_loading@2x.gif +0 -0
  44. data/app/assets/javascripts/ckeditor/plugins/slideshow/3rdParty/fancybox2/fancybox_overlay.png +0 -0
  45. data/app/assets/javascripts/ckeditor/plugins/slideshow/3rdParty/fancybox2/fancybox_sprite.png +0 -0
  46. data/app/assets/javascripts/ckeditor/plugins/slideshow/3rdParty/fancybox2/fancybox_sprite@2x.png +0 -0
  47. data/app/assets/javascripts/ckeditor/plugins/slideshow/3rdParty/fancybox2/helpers/fancybox_buttons.png +0 -0
  48. data/app/assets/javascripts/ckeditor/plugins/slideshow/3rdParty/fancybox2/helpers/jquery.fancybox-buttons.css +97 -0
  49. data/app/assets/javascripts/ckeditor/plugins/slideshow/3rdParty/fancybox2/helpers/jquery.fancybox-buttons.js +122 -0
  50. data/app/assets/javascripts/ckeditor/plugins/slideshow/3rdParty/fancybox2/helpers/jquery.fancybox-media.js +199 -0
  51. data/app/assets/javascripts/ckeditor/plugins/slideshow/3rdParty/fancybox2/helpers/jquery.fancybox-thumbs.css +55 -0
  52. data/app/assets/javascripts/ckeditor/plugins/slideshow/3rdParty/fancybox2/helpers/jquery.fancybox-thumbs.js +162 -0
  53. data/app/assets/javascripts/ckeditor/plugins/slideshow/3rdParty/fancybox2/jquery.fancybox.css +274 -0
  54. data/app/assets/javascripts/ckeditor/plugins/slideshow/3rdParty/fancybox2/jquery.fancybox.js +2020 -0
  55. data/app/assets/javascripts/ckeditor/plugins/slideshow/3rdParty/fancybox2/jquery.fancybox.pack.js +46 -0
  56. data/app/assets/javascripts/ckeditor/plugins/slideshow/README.md +66 -0
  57. data/app/assets/javascripts/ckeditor/plugins/slideshow/dialogs/slideshow.js +1396 -0
  58. data/app/assets/javascripts/ckeditor/plugins/slideshow/dialogs/slideshow.min.js +1 -0
  59. data/app/assets/javascripts/ckeditor/plugins/slideshow/icons/placeholder.png +0 -0
  60. data/app/assets/javascripts/ckeditor/plugins/slideshow/icons/slideshow.png +0 -0
  61. data/app/assets/javascripts/ckeditor/plugins/slideshow/lang/Serbian_translation.txt +9 -0
  62. data/app/assets/javascripts/ckeditor/plugins/slideshow/lang/el.js +37 -0
  63. data/app/assets/javascripts/ckeditor/plugins/slideshow/lang/en.js +35 -0
  64. data/app/assets/javascripts/ckeditor/plugins/slideshow/lang/fr.js +35 -0
  65. data/app/assets/javascripts/ckeditor/plugins/slideshow/lang/ru.js +35 -0
  66. data/app/assets/javascripts/ckeditor/plugins/slideshow/lang/sr-latn.js +35 -0
  67. data/app/assets/javascripts/ckeditor/plugins/slideshow/lang/sr.js +35 -0
  68. data/app/assets/javascripts/ckeditor/plugins/slideshow/plugin.js +217 -0
  69. data/app/assets/stylesheets/admin/admin.scss +302 -0
  70. data/app/assets/stylesheets/admin/custom_admin.scss +1 -0
  71. data/app/assets/stylesheets/admin/vendor/bootstrap.min.css +14 -0
  72. data/app/assets/stylesheets/admin/vendor/jquery.tagsinput.css +99 -0
  73. data/app/assets/stylesheets/admin/vendor/token-input-facebook.patched.css +126 -0
  74. data/app/assets/stylesheets/admin/vendor/token-input.patched.css +116 -0
  75. data/app/controllers/admin/autocomplete_controller.rb +14 -0
  76. data/app/controllers/admin/image_upload_controller.rb +27 -0
  77. data/app/controllers/admin/lookups_controller.rb +47 -0
  78. data/app/controllers/admin/sortable_controller.rb +26 -0
  79. data/app/controllers/concerns/admin/path_history.rb +39 -0
  80. data/app/helpers/admin/search_helper.rb +59 -0
  81. data/app/helpers/admin_helper.rb +29 -0
  82. data/app/helpers/common_helper.rb +16 -0
  83. data/app/helpers/lookup_helper.rb +45 -0
  84. data/app/helpers/nested_fields_helper.rb +12 -0
  85. data/app/helpers/static_text_formatter.rb +25 -0
  86. data/app/helpers/twitter_builder_helper.rb +253 -0
  87. data/app/helpers/twitter_form_builder.rb +196 -0
  88. data/app/models/file_upload.rb +19 -0
  89. data/app/models/lookup.rb +6 -0
  90. data/app/uploaders/file_uploader.rb +10 -0
  91. data/app/uploaders/generic_image_uploader.rb +74 -0
  92. data/app/utils/admin_structure.rb +67 -0
  93. data/app/utils/bootstrap_link_renderer.rb +40 -0
  94. data/app/utils/table_helpers.rb +196 -0
  95. data/app/views/admin/base/_sort.haml +34 -0
  96. data/app/views/admin/common/_file_upload_template.haml +14 -0
  97. data/app/views/admin/common/_header.html.haml +27 -0
  98. data/app/views/admin/common/_image_upload_template.html.haml +40 -0
  99. data/app/views/admin/common/_menu.html.haml +2 -0
  100. data/app/views/admin/common/_menu_section.haml +10 -0
  101. data/app/views/admin/common/_menu_separator.haml +1 -0
  102. data/app/views/admin/common/_nested_fields_for.html.haml +5 -0
  103. data/app/views/admin/common/_nested_fields_for_element.html.haml +5 -0
  104. data/app/views/admin/common/_slide.haml +41 -0
  105. data/app/views/admin/common/_slides.html.haml +17 -0
  106. data/app/views/admin/common/_table_template.html.haml +14 -0
  107. data/app/views/admin/common/_upload_form.html.haml +5 -0
  108. data/app/views/admin/common/image_uploaded.js.haml +7 -0
  109. data/app/views/admin/common/upload_failed.js.erb +11 -0
  110. data/app/views/admin/common/upload_image.js.erb +6 -0
  111. data/app/views/admin/home/dashboard.html.haml +5 -0
  112. data/app/views/admin/lookups/_form.html.haml +16 -0
  113. data/app/views/admin/lookups/edit.html.haml +5 -0
  114. data/app/views/admin/lookups/index.html.haml +6 -0
  115. data/app/views/layouts/admin.html.haml +38 -0
  116. data/app/views/structure/_section.haml +16 -0
  117. data/coalla-cms.gemspec +39 -0
  118. data/config/locales/devise.ru.yml +59 -0
  119. data/config/locales/will_paginate.ru.yml +6 -0
  120. data/lib/coalla/cms/engine.rb +16 -0
  121. data/lib/coalla/cms/version.rb +5 -0
  122. data/lib/coalla/ext/mapper.rb +14 -0
  123. data/lib/coalla/orm/page_slider.rb +53 -0
  124. data/lib/coalla/orm/relation.rb +32 -0
  125. data/lib/coalla/orm/sanitized.rb +16 -0
  126. data/lib/coalla/sanitize/config/default.rb +526 -0
  127. data/lib/coalla-cms.rb +16 -0
  128. data/lib/generators/coalla/cms/create_admin_generator.rb +50 -0
  129. data/lib/generators/coalla/cms/create_admin_login_view_generator.rb +23 -0
  130. data/lib/generators/coalla/cms/file_uploads/install_generator.rb +35 -0
  131. data/lib/generators/coalla/cms/file_uploads/mount_generator.rb +34 -0
  132. data/lib/generators/coalla/cms/file_uploads/templates/add_column_migration.rb.erb +5 -0
  133. data/lib/generators/coalla/cms/file_uploads/templates/migration.rb +17 -0
  134. data/lib/generators/coalla/cms/image/install_generator.rb +39 -0
  135. data/lib/generators/coalla/cms/image/mount_generator.rb +50 -0
  136. data/lib/generators/coalla/cms/image/templates/migration.rb.erb +9 -0
  137. data/lib/generators/coalla/cms/image/templates/model.rb.erb +5 -0
  138. data/lib/generators/coalla/cms/image/templates/mount/migration.rb.erb +6 -0
  139. data/lib/generators/coalla/cms/image/templates/mount/uploader.rb.erb +3 -0
  140. data/lib/generators/coalla/cms/image/templates/uploader.rb.erb +3 -0
  141. data/lib/generators/coalla/cms/init_generator.rb +113 -0
  142. data/lib/generators/coalla/cms/lookups/install_generator.rb +43 -0
  143. data/lib/generators/coalla/cms/lookups/templates/migration.rb +13 -0
  144. data/lib/generators/coalla/cms/market/install_generator.rb +71 -0
  145. data/lib/generators/coalla/cms/market/templates/controllers/categories_controller.rb +47 -0
  146. data/lib/generators/coalla/cms/market/templates/controllers/products_controller.rb +50 -0
  147. data/lib/generators/coalla/cms/market/templates/controllers/properties_controller.rb +59 -0
  148. data/lib/generators/coalla/cms/market/templates/market.rb +5 -0
  149. data/lib/generators/coalla/cms/market/templates/market.ru.yml +53 -0
  150. data/lib/generators/coalla/cms/market/templates/migrations/create_categories.rb +15 -0
  151. data/lib/generators/coalla/cms/market/templates/migrations/create_product_properties.rb +18 -0
  152. data/lib/generators/coalla/cms/market/templates/migrations/create_products.rb +18 -0
  153. data/lib/generators/coalla/cms/market/templates/migrations/create_properties.rb +11 -0
  154. data/lib/generators/coalla/cms/market/templates/models/category.rb +36 -0
  155. data/lib/generators/coalla/cms/market/templates/models/product.rb +16 -0
  156. data/lib/generators/coalla/cms/market/templates/models/product_property.rb +14 -0
  157. data/lib/generators/coalla/cms/market/templates/models/property.rb +7 -0
  158. data/lib/generators/coalla/cms/market/templates/views/categories/_form.html.haml +10 -0
  159. data/lib/generators/coalla/cms/market/templates/views/categories/edit.html.haml +5 -0
  160. data/lib/generators/coalla/cms/market/templates/views/categories/index.html.haml +17 -0
  161. data/lib/generators/coalla/cms/market/templates/views/categories/new.html.haml +4 -0
  162. data/lib/generators/coalla/cms/market/templates/views/products/_form.html.haml +17 -0
  163. data/lib/generators/coalla/cms/market/templates/views/products/_product_property_fields.html.haml +13 -0
  164. data/lib/generators/coalla/cms/market/templates/views/products/edit.html.haml +5 -0
  165. data/lib/generators/coalla/cms/market/templates/views/products/index.html.haml +17 -0
  166. data/lib/generators/coalla/cms/market/templates/views/products/new.html.haml +4 -0
  167. data/lib/generators/coalla/cms/market/templates/views/properties/_form.html.haml +9 -0
  168. data/lib/generators/coalla/cms/market/templates/views/properties/edit.html.haml +5 -0
  169. data/lib/generators/coalla/cms/market/templates/views/properties/index.html.haml +15 -0
  170. data/lib/generators/coalla/cms/market/templates/views/properties/new.html.haml +4 -0
  171. data/lib/generators/coalla/cms/news/scaffold_generator.rb +50 -0
  172. data/lib/generators/coalla/cms/news/templates/entity.rb.erb +10 -0
  173. data/lib/generators/coalla/cms/news/templates/entity_controller_template.rb.erb +47 -0
  174. data/lib/generators/coalla/cms/news/templates/entity_image_uploader.rb.erb +7 -0
  175. data/lib/generators/coalla/cms/news/templates/migration.rb.erb +15 -0
  176. data/lib/generators/coalla/cms/news/templates/views/_form.haml.erb +16 -0
  177. data/lib/generators/coalla/cms/news/templates/views/edit.haml.erb +5 -0
  178. data/lib/generators/coalla/cms/news/templates/views/index.haml.erb +18 -0
  179. data/lib/generators/coalla/cms/news/templates/views/new.haml.erb +5 -0
  180. data/lib/generators/coalla/cms/orm_helpers.rb +31 -0
  181. data/lib/generators/coalla/cms/scaffold_generator.rb +53 -0
  182. data/lib/generators/coalla/cms/scaffold_helper.rb +11 -0
  183. data/lib/generators/coalla/cms/setup_admin_generator.rb +60 -0
  184. data/lib/generators/coalla/cms/setup_routes_generator.rb +28 -0
  185. data/lib/generators/coalla/cms/slider/init_generator.rb +41 -0
  186. data/lib/generators/coalla/cms/slider/templates/migration.rb.erb +25 -0
  187. data/lib/generators/coalla/cms/slider/templates/slider_image.rb.erb +10 -0
  188. data/lib/generators/coalla/cms/slider/templates/slider_image_uploader.rb.erb +7 -0
  189. data/lib/generators/coalla/cms/slider/templates/slider_upload_controller.rb.erb +19 -0
  190. data/lib/generators/coalla/cms/templates/.gitattributes +4 -0
  191. data/lib/generators/coalla/cms/templates/.gitignore +86 -0
  192. data/lib/generators/coalla/cms/templates/activerecord.ru.yml +13 -0
  193. data/lib/generators/coalla/cms/templates/assets.rb +13 -0
  194. data/lib/generators/coalla/cms/templates/controllers/admin/base_controller.rb.erb +35 -0
  195. data/lib/generators/coalla/cms/templates/controllers/admin/home_controller.rb.erb +6 -0
  196. data/lib/generators/coalla/cms/templates/controllers/admin/scaffold_controller_template.rb.erb +45 -0
  197. data/lib/generators/coalla/cms/templates/controllers/home_controller.rb.erb +6 -0
  198. data/lib/generators/coalla/cms/templates/database.yml.erb +35 -0
  199. data/lib/generators/coalla/cms/templates/devise.ru.yml +59 -0
  200. data/lib/generators/coalla/cms/templates/initializers/carrierwave.rb +51 -0
  201. data/lib/generators/coalla/cms/templates/migration.rb +11 -0
  202. data/lib/generators/coalla/cms/templates/migration_existing.rb +15 -0
  203. data/lib/generators/coalla/cms/templates/schedule.rb +3 -0
  204. data/lib/generators/coalla/cms/templates/structure.rb +0 -0
  205. data/lib/generators/coalla/cms/templates/views/admin/scaffold_template/_form.html.haml.erb +14 -0
  206. data/lib/generators/coalla/cms/templates/views/admin/scaffold_template/edit.html.haml.erb +5 -0
  207. data/lib/generators/coalla/cms/templates/views/admin/scaffold_template/index.html.haml.erb +15 -0
  208. data/lib/generators/coalla/cms/templates/views/admin/scaffold_template/new.html.haml.erb +4 -0
  209. data/lib/generators/coalla/cms/templates/views/administrators/sessions/new.html.haml +19 -0
  210. data/lib/generators/coalla/cms/templates/views/home/index.html.haml.erb +1 -0
  211. data/lib/generators/coalla/cms/wysiwyg/ckeditor_generator.rb +17 -0
  212. data/lib/generators/coalla/cms/wysiwyg/templates/ckeditor/plugins/mediaembed/icons/hidpi/mediaembed.png +0 -0
  213. data/lib/generators/coalla/cms/wysiwyg/templates/ckeditor/plugins/mediaembed/icons/mediaembed.png +0 -0
  214. data/lib/generators/coalla/cms/wysiwyg/templates/ckeditor/plugins/mediaembed/plugin.js +64 -0
  215. data/lib/generators/coalla/cms/wysiwyg/templates/ckeditor/plugins/slideshow/3rdParty/ad-gallery/LICENSE.txt +303 -0
  216. data/lib/generators/coalla/cms/wysiwyg/templates/ckeditor/plugins/slideshow/3rdParty/ad-gallery/ad-gallery-css-diff.htm +831 -0
  217. data/lib/generators/coalla/cms/wysiwyg/templates/ckeditor/plugins/slideshow/3rdParty/ad-gallery/ad_next.png +0 -0
  218. data/lib/generators/coalla/cms/wysiwyg/templates/ckeditor/plugins/slideshow/3rdParty/ad-gallery/ad_prev.png +0 -0
  219. data/lib/generators/coalla/cms/wysiwyg/templates/ckeditor/plugins/slideshow/3rdParty/ad-gallery/ad_scroll_back.png +0 -0
  220. data/lib/generators/coalla/cms/wysiwyg/templates/ckeditor/plugins/slideshow/3rdParty/ad-gallery/ad_scroll_forward.png +0 -0
  221. data/lib/generators/coalla/cms/wysiwyg/templates/ckeditor/plugins/slideshow/3rdParty/ad-gallery/jquery.ad-gallery.css +185 -0
  222. data/lib/generators/coalla/cms/wysiwyg/templates/ckeditor/plugins/slideshow/3rdParty/ad-gallery/jquery.ad-gallery.js +984 -0
  223. data/lib/generators/coalla/cms/wysiwyg/templates/ckeditor/plugins/slideshow/3rdParty/ad-gallery/jquery.ad-gallery.min - ref.js +10 -0
  224. data/lib/generators/coalla/cms/wysiwyg/templates/ckeditor/plugins/slideshow/3rdParty/ad-gallery/jquery.ad-gallery.min.js +1 -0
  225. data/lib/generators/coalla/cms/wysiwyg/templates/ckeditor/plugins/slideshow/3rdParty/ad-gallery/loader.gif +0 -0
  226. data/lib/generators/coalla/cms/wysiwyg/templates/ckeditor/plugins/slideshow/3rdParty/ad-gallery/opa75.png +0 -0
  227. data/lib/generators/coalla/cms/wysiwyg/templates/ckeditor/plugins/slideshow/3rdParty/ad-gallery/placeholder.png +0 -0
  228. data/lib/generators/coalla/cms/wysiwyg/templates/ckeditor/plugins/slideshow/3rdParty/ad-gallery/trans.gif +0 -0
  229. data/lib/generators/coalla/cms/wysiwyg/templates/ckeditor/plugins/slideshow/3rdParty/fancybox2/blank.gif +0 -0
  230. data/lib/generators/coalla/cms/wysiwyg/templates/ckeditor/plugins/slideshow/3rdParty/fancybox2/fancybox_loading.gif +0 -0
  231. data/lib/generators/coalla/cms/wysiwyg/templates/ckeditor/plugins/slideshow/3rdParty/fancybox2/fancybox_loading@2x.gif +0 -0
  232. data/lib/generators/coalla/cms/wysiwyg/templates/ckeditor/plugins/slideshow/3rdParty/fancybox2/fancybox_overlay.png +0 -0
  233. data/lib/generators/coalla/cms/wysiwyg/templates/ckeditor/plugins/slideshow/3rdParty/fancybox2/fancybox_sprite.png +0 -0
  234. data/lib/generators/coalla/cms/wysiwyg/templates/ckeditor/plugins/slideshow/3rdParty/fancybox2/fancybox_sprite@2x.png +0 -0
  235. data/lib/generators/coalla/cms/wysiwyg/templates/ckeditor/plugins/slideshow/3rdParty/fancybox2/helpers/fancybox_buttons.png +0 -0
  236. data/lib/generators/coalla/cms/wysiwyg/templates/ckeditor/plugins/slideshow/3rdParty/fancybox2/helpers/jquery.fancybox-buttons.css +97 -0
  237. data/lib/generators/coalla/cms/wysiwyg/templates/ckeditor/plugins/slideshow/3rdParty/fancybox2/helpers/jquery.fancybox-buttons.js +122 -0
  238. data/lib/generators/coalla/cms/wysiwyg/templates/ckeditor/plugins/slideshow/3rdParty/fancybox2/helpers/jquery.fancybox-media.js +199 -0
  239. data/lib/generators/coalla/cms/wysiwyg/templates/ckeditor/plugins/slideshow/3rdParty/fancybox2/helpers/jquery.fancybox-thumbs.css +55 -0
  240. data/lib/generators/coalla/cms/wysiwyg/templates/ckeditor/plugins/slideshow/3rdParty/fancybox2/helpers/jquery.fancybox-thumbs.js +162 -0
  241. data/lib/generators/coalla/cms/wysiwyg/templates/ckeditor/plugins/slideshow/3rdParty/fancybox2/jquery.fancybox.css +274 -0
  242. data/lib/generators/coalla/cms/wysiwyg/templates/ckeditor/plugins/slideshow/3rdParty/fancybox2/jquery.fancybox.js +2020 -0
  243. data/lib/generators/coalla/cms/wysiwyg/templates/ckeditor/plugins/slideshow/3rdParty/fancybox2/jquery.fancybox.pack.js +46 -0
  244. data/lib/generators/coalla/cms/wysiwyg/templates/ckeditor/plugins/slideshow/README.md +66 -0
  245. data/lib/generators/coalla/cms/wysiwyg/templates/ckeditor/plugins/slideshow/dialogs/slideshow.js +1396 -0
  246. data/lib/generators/coalla/cms/wysiwyg/templates/ckeditor/plugins/slideshow/dialogs/slideshow.min.js +1 -0
  247. data/lib/generators/coalla/cms/wysiwyg/templates/ckeditor/plugins/slideshow/icons/placeholder.png +0 -0
  248. data/lib/generators/coalla/cms/wysiwyg/templates/ckeditor/plugins/slideshow/icons/slideshow.png +0 -0
  249. data/lib/generators/coalla/cms/wysiwyg/templates/ckeditor/plugins/slideshow/lang/Serbian_translation.txt +9 -0
  250. data/lib/generators/coalla/cms/wysiwyg/templates/ckeditor/plugins/slideshow/lang/el.js +37 -0
  251. data/lib/generators/coalla/cms/wysiwyg/templates/ckeditor/plugins/slideshow/lang/en.js +35 -0
  252. data/lib/generators/coalla/cms/wysiwyg/templates/ckeditor/plugins/slideshow/lang/fr.js +35 -0
  253. data/lib/generators/coalla/cms/wysiwyg/templates/ckeditor/plugins/slideshow/lang/ru.js +35 -0
  254. data/lib/generators/coalla/cms/wysiwyg/templates/ckeditor/plugins/slideshow/lang/sr-latn.js +35 -0
  255. data/lib/generators/coalla/cms/wysiwyg/templates/ckeditor/plugins/slideshow/lang/sr.js +35 -0
  256. data/lib/generators/coalla/cms/wysiwyg/templates/ckeditor/plugins/slideshow/plugin.js +217 -0
  257. data/lib/generators/coalla/cms/wysiwyg/templates/wymeditor/iframe/default/lbl-blockquote.png +0 -0
  258. data/lib/generators/coalla/cms/wysiwyg/templates/wymeditor/iframe/default/lbl-h1.png +0 -0
  259. data/lib/generators/coalla/cms/wysiwyg/templates/wymeditor/iframe/default/lbl-h2.png +0 -0
  260. data/lib/generators/coalla/cms/wysiwyg/templates/wymeditor/iframe/default/lbl-h3.png +0 -0
  261. data/lib/generators/coalla/cms/wysiwyg/templates/wymeditor/iframe/default/lbl-h4.png +0 -0
  262. data/lib/generators/coalla/cms/wysiwyg/templates/wymeditor/iframe/default/lbl-h5.png +0 -0
  263. data/lib/generators/coalla/cms/wysiwyg/templates/wymeditor/iframe/default/lbl-h6.png +0 -0
  264. data/lib/generators/coalla/cms/wysiwyg/templates/wymeditor/iframe/default/lbl-p.png +0 -0
  265. data/lib/generators/coalla/cms/wysiwyg/templates/wymeditor/iframe/default/lbl-pre.png +0 -0
  266. data/lib/generators/coalla/cms/wysiwyg/templates/wymeditor/iframe/default/wymiframe.css +276 -0
  267. data/lib/generators/coalla/cms/wysiwyg/templates/wymeditor/iframe/default/wymiframe.html +26 -0
  268. data/lib/generators/coalla/cms/wysiwyg/templates/wymeditor/jquery.wymeditor.js +4819 -0
  269. data/lib/generators/coalla/cms/wysiwyg/templates/wymeditor/lang/en.js +45 -0
  270. data/lib/generators/coalla/cms/wysiwyg/templates/wymeditor/lang/ru.js +55 -0
  271. data/lib/generators/coalla/cms/wysiwyg/templates/wymeditor/plugins/imageupload/icons.png +0 -0
  272. data/lib/generators/coalla/cms/wysiwyg/templates/wymeditor/plugins/imageupload/jquery.wymeditor.imageupload.js +150 -0
  273. data/lib/generators/coalla/cms/wysiwyg/templates/wymeditor/plugins/resizable/jquery.wymeditor.resizable.js +91 -0
  274. data/lib/generators/coalla/cms/wysiwyg/templates/wymeditor/plugins/resizable/readme.txt +124 -0
  275. data/lib/generators/coalla/cms/wysiwyg/templates/wymeditor/skins/compact/icons.png +0 -0
  276. data/lib/generators/coalla/cms/wysiwyg/templates/wymeditor/skins/compact/skin.css +134 -0
  277. data/lib/generators/coalla/cms/wysiwyg/templates/wymeditor/skins/compact/skin.js +35 -0
  278. data/lib/generators/coalla/cms/wysiwyg/templates/wymeditor/skins/default/icons.png +0 -0
  279. data/lib/generators/coalla/cms/wysiwyg/templates/wymeditor/skins/default/skin.css +341 -0
  280. data/lib/generators/coalla/cms/wysiwyg/templates/wymeditor/skins/default/skin.js +40 -0
  281. data/lib/generators/coalla/cms/wysiwyg/templates/wymeditor/skins/minimal/images/bg.header.gif +0 -0
  282. data/lib/generators/coalla/cms/wysiwyg/templates/wymeditor/skins/minimal/images/bg.selector.silver.gif +0 -0
  283. data/lib/generators/coalla/cms/wysiwyg/templates/wymeditor/skins/minimal/images/bg.wymeditor.png +0 -0
  284. data/lib/generators/coalla/cms/wysiwyg/templates/wymeditor/skins/minimal/images/icons.silver.gif +0 -0
  285. data/lib/generators/coalla/cms/wysiwyg/templates/wymeditor/skins/minimal/skin.css +131 -0
  286. data/lib/generators/coalla/cms/wysiwyg/templates/wymeditor/skins/minimal/skin.js +30 -0
  287. data/lib/generators/coalla/cms/wysiwyg/templates/wymeditor/skins/silver/COPYING +674 -0
  288. data/lib/generators/coalla/cms/wysiwyg/templates/wymeditor/skins/silver/README +27 -0
  289. data/lib/generators/coalla/cms/wysiwyg/templates/wymeditor/skins/silver/images/bg.header.gif +0 -0
  290. data/lib/generators/coalla/cms/wysiwyg/templates/wymeditor/skins/silver/images/bg.selector.silver.gif +0 -0
  291. data/lib/generators/coalla/cms/wysiwyg/templates/wymeditor/skins/silver/images/bg.wymeditor.png +0 -0
  292. data/lib/generators/coalla/cms/wysiwyg/templates/wymeditor/skins/silver/images/icons.silver.gif +0 -0
  293. data/lib/generators/coalla/cms/wysiwyg/templates/wymeditor/skins/silver/skin.css +297 -0
  294. data/lib/generators/coalla/cms/wysiwyg/templates/wymeditor/skins/silver/skin.js +61 -0
  295. data/lib/generators/coalla/cms/wysiwyg/templates/wymeditor/skins/twopanels/icons.png +0 -0
  296. data/lib/generators/coalla/cms/wysiwyg/templates/wymeditor/skins/twopanels/skin.css +134 -0
  297. data/lib/generators/coalla/cms/wysiwyg/templates/wymeditor/skins/twopanels/skin.js +39 -0
  298. data/lib/generators/coalla/cms/wysiwyg/templates/wymeditor/skins/wymeditor_icon.png +0 -0
  299. data/lib/generators/coalla/cms/wysiwyg/wymeditor_generator.rb +17 -0
  300. metadata +581 -0
@@ -0,0 +1,984 @@
1
+ /**
2
+ * Copyright (c) 2012 Anders Ekdahl (http://coffeescripter.com/)
3
+ * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
4
+ * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
5
+ *
6
+ * Version: 1.2.7
7
+ *
8
+ * Demo and documentation: http://coffeescripter.com/code/ad-gallery/
9
+ */
10
+ (function($) {
11
+ $.fn.adGallery = function(options) {
12
+ var defaults = { loader_image: './ckeditor/plugins/slideshow/3rdParty/ad-gallery/loader.gif',
13
+ start_at_index: 0,
14
+ update_window_hash: true,
15
+ description_wrapper: false,
16
+ thumb_opacity: 0.7,
17
+ animate_first_image: false,
18
+ animation_speed: 400,
19
+ width: false,
20
+ height: false,
21
+ display_next_and_prev: true,
22
+ display_back_and_forward: true,
23
+ scroll_jump: 0, // If 0, it jumps the width of the container
24
+ slideshow: {
25
+ enable: true,
26
+ autostart: false,
27
+ speed: 5000,
28
+ start_label: 'Start',
29
+ stop_label: 'Stop',
30
+ stop_on_scroll: true,
31
+ countdown_prefix: '(',
32
+ countdown_sufix: ')',
33
+ onStart: false,
34
+ onStop: false
35
+ },
36
+ effect: 'slide-hori', // or 'slide-vert', 'fade', or 'resize', 'none'
37
+ enable_keyboard_move: true,
38
+ cycle: true,
39
+ hooks: {
40
+ displayDescription: false
41
+ },
42
+ callbacks: {
43
+ init: false,
44
+ afterImageVisible: false,
45
+ beforeImageVisible: false
46
+ }
47
+ };
48
+ var settings = $.extend(false, defaults, options);
49
+ if(options && options.slideshow) {
50
+ settings.slideshow = $.extend(false, defaults.slideshow, options.slideshow);
51
+ };
52
+ if(!settings.slideshow.enable) {
53
+ settings.slideshow.autostart = false;
54
+ };
55
+ var galleries = [];
56
+ $(this).each(function() {
57
+ var gallery = new AdGallery(this, settings);
58
+ galleries[galleries.length] = gallery;
59
+ });
60
+ // Sorry, breaking the jQuery chain because the gallery instances
61
+ // are returned so you can fiddle with them
62
+ return galleries;
63
+ };
64
+
65
+ function VerticalSlideAnimation(img_container, direction, desc) {
66
+ var current_top = parseInt(img_container.css('top'), 10);
67
+ var old_image_top;
68
+ if(direction == 'left') {
69
+ old_image_top = '-'+ this.image_wrapper_height +'px';
70
+ img_container.css('top', this.image_wrapper_height +'px');
71
+ } else {
72
+ old_image_top = this.image_wrapper_height +'px';
73
+ img_container.css('top', '-'+ this.image_wrapper_height +'px');
74
+ };
75
+ if(desc) {
76
+ desc.css('bottom', '-'+ desc[0].offsetHeight +'px');
77
+ desc.animate({bottom: 0}, this.settings.animation_speed * 2);
78
+ };
79
+ if(this.current_description) {
80
+ this.current_description.animate({bottom: '-'+ this.current_description[0].offsetHeight +'px'}, this.settings.animation_speed * 2);
81
+ };
82
+ return {old_image: {top: old_image_top},
83
+ new_image: {top: current_top}};
84
+ };
85
+
86
+ function HorizontalSlideAnimation(img_container, direction, desc) {
87
+ var current_left = parseInt(img_container.css('left'), 10);
88
+ var old_image_left;
89
+ if(direction == 'left') {
90
+ old_image_left = '-'+ this.image_wrapper_width +'px';
91
+ img_container.css('left',this.image_wrapper_width +'px');
92
+ } else {
93
+ old_image_left = this.image_wrapper_width +'px';
94
+ img_container.css('left','-'+ this.image_wrapper_width +'px');
95
+ };
96
+ if(desc) {
97
+ desc.css('bottom', '-'+ desc[0].offsetHeight +'px');
98
+ desc.animate({bottom: 0}, this.settings.animation_speed * 2);
99
+ };
100
+ if(this.current_description) {
101
+ this.current_description.animate({bottom: '-'+ this.current_description[0].offsetHeight +'px'}, this.settings.animation_speed * 2);
102
+ };
103
+ return {old_image: {left: old_image_left},
104
+ new_image: {left: current_left}};
105
+ };
106
+
107
+ function ResizeAnimation(img_container, direction, desc) {
108
+ var image_width = img_container.width();
109
+ var image_height = img_container.height();
110
+ var current_left = parseInt(img_container.css('left'), 10);
111
+ var current_top = parseInt(img_container.css('top'), 10);
112
+ img_container.css({width: 0, height: 0, top: this.image_wrapper_height / 2, left: this.image_wrapper_width / 2});
113
+ return {old_image: {width: 0,
114
+ height: 0,
115
+ top: this.image_wrapper_height / 2,
116
+ left: this.image_wrapper_width / 2},
117
+ new_image: {width: image_width,
118
+ height: image_height,
119
+ top: current_top,
120
+ left: current_left}};
121
+ };
122
+
123
+ function FadeAnimation(img_container, direction, desc) {
124
+ img_container.css('opacity', 0);
125
+ return {old_image: {opacity: 0},
126
+ new_image: {opacity: 1}};
127
+ };
128
+
129
+ // Sort of a hack, will clean this up... eventually
130
+ function NoneAnimation(img_container, direction, desc) {
131
+ img_container.css('opacity', 0);
132
+ return {old_image: {opacity: 0},
133
+ new_image: {opacity: 1},
134
+ speed: 0};
135
+ };
136
+
137
+ function AdGallery(wrapper, settings) {
138
+ this.init(wrapper, settings);
139
+ };
140
+ AdGallery.prototype = {
141
+ // Elements
142
+ wrapper: false,
143
+ image_wrapper: false,
144
+ gallery_info: false,
145
+ nav: false,
146
+ loader: false,
147
+ preloads: false,
148
+ thumbs_wrapper: false,
149
+ thumbs_wrapper_width: 0,
150
+ scroll_back: false,
151
+ scroll_forward: false,
152
+ next_link: false,
153
+ prev_link: false,
154
+
155
+ slideshow: false,
156
+ image_wrapper_width: 0,
157
+ image_wrapper_height: 0,
158
+ current_index: -1,
159
+ current_image: false,
160
+ current_description: false,
161
+ nav_display_width: 0,
162
+ settings: false,
163
+ images: false,
164
+ in_transition: false,
165
+ animations: false,
166
+ init: function(wrapper, settings) {
167
+ var context = this;
168
+ this.wrapper = $(wrapper);
169
+ this.settings = settings;
170
+ this.setupElements();
171
+ this.setupAnimations();
172
+ if(this.settings.width) {
173
+ this.image_wrapper_width = this.settings.width;
174
+ this.image_wrapper.width(this.settings.width);
175
+ this.wrapper.width(this.settings.width);
176
+ } else {
177
+ this.image_wrapper_width = this.image_wrapper.width();
178
+ };
179
+ if(this.settings.height) {
180
+ this.image_wrapper_height = this.settings.height;
181
+ this.image_wrapper.height(this.settings.height);
182
+ } else {
183
+ this.image_wrapper_height = this.image_wrapper.height();
184
+ };
185
+ this.nav_display_width = this.nav.width();
186
+ this.current_index = -1;
187
+ this.current_image = false;
188
+ this.current_description = false;
189
+ this.in_transition = false;
190
+ this.findImages();
191
+ if(this.settings.display_next_and_prev) {
192
+ this.initNextAndPrev();
193
+ };
194
+ // The slideshow needs a callback to trigger the next image to be shown
195
+ // but we don't want to give it access to the whole gallery instance
196
+ var nextimage_callback = function(callback) {
197
+ return context.nextImage(callback);
198
+ };
199
+ this.slideshow = new AdGallerySlideshow(nextimage_callback, this.settings.slideshow);
200
+ this.controls.append(this.slideshow.create());
201
+ if(this.settings.slideshow.enable) {
202
+ this.slideshow.enable();
203
+ } else {
204
+ this.slideshow.disable();
205
+ };
206
+ if(this.settings.display_back_and_forward) {
207
+ this.initBackAndForward();
208
+ };
209
+ if(this.settings.enable_keyboard_move) {
210
+ this.initKeyEvents();
211
+ };
212
+ this.initHashChange();
213
+ var start_at = parseInt(this.settings.start_at_index, 10);
214
+ if(typeof this.getIndexFromHash() != "undefined") {
215
+ start_at = this.getIndexFromHash();
216
+ };
217
+ this.loading(true);
218
+ this.showImage(start_at,
219
+ function() {
220
+ // We don't want to start the slideshow before the image has been
221
+ // displayed
222
+ if(context.settings.slideshow.autostart) {
223
+ context.preloadImage(start_at + 1);
224
+ context.slideshow.start();
225
+ };
226
+ }
227
+ );
228
+ this.fireCallback(this.settings.callbacks.init);
229
+ },
230
+ setupAnimations: function() {
231
+ this.animations = {
232
+ 'slide-vert': VerticalSlideAnimation,
233
+ 'slide-hori': HorizontalSlideAnimation,
234
+ 'resize': ResizeAnimation,
235
+ 'fade': FadeAnimation,
236
+ 'none': NoneAnimation
237
+ };
238
+ },
239
+ setupElements: function() {
240
+ this.controls = this.wrapper.find('.ad-controls');
241
+ this.gallery_info = $('<p class="ad-info"></p>');
242
+ this.controls.append(this.gallery_info);
243
+ this.image_wrapper = this.wrapper.find('.ad-image-wrapper');
244
+ this.image_wrapper.empty();
245
+ this.nav = this.wrapper.find('.ad-nav');
246
+ this.thumbs_wrapper = this.nav.find('.ad-thumbs');
247
+ this.preloads = $('<div class="ad-preloads"></div>');
248
+ this.loader = $('<img class="ad-loader" src="'+ this.settings.loader_image +'">');
249
+ this.image_wrapper.append(this.loader);
250
+ this.loader.hide();
251
+ $(document.body).append(this.preloads);
252
+ },
253
+ loading: function(bool) {
254
+ if(bool) {
255
+ this.loader.show();
256
+ } else {
257
+ this.loader.hide();
258
+ };
259
+ },
260
+ addAnimation: function(name, fn) {
261
+ if($.isFunction(fn)) {
262
+ this.animations[name] = fn;
263
+ };
264
+ },
265
+ findImages: function() {
266
+ var context = this;
267
+ this.images = [];
268
+ var thumbs_loaded = 0;
269
+ var thumbs = this.thumbs_wrapper.find('a');
270
+ var thumb_count = thumbs.length;
271
+ if(this.settings.thumb_opacity < 1) {
272
+ thumbs.find('img').css('opacity', this.settings.thumb_opacity);
273
+ };
274
+ thumbs.each(
275
+ function(i) {
276
+ var link = $(this);
277
+ link.data("ad-i", i);
278
+ var image_src = link.attr('href');
279
+ var thumb = link.find('img');
280
+ context.whenImageLoaded(thumb[0], function() {
281
+ var width = thumb[0].parentNode.parentNode.offsetWidth;
282
+ if(thumb[0].width == 0) {
283
+ // If the browser tells us that the image is loaded, but the width
284
+ // is still 0 for some reason, we default to 100px width.
285
+ // It's not very nice, but it's better than 0.
286
+ width = 50;
287
+ };
288
+ context.thumbs_wrapper_width += width;
289
+ thumbs_loaded++;
290
+ });
291
+ context._initLink(link);
292
+ context.images[i] = context._createImageData(link, image_src);
293
+ }
294
+ );
295
+ // Wait until all thumbs are loaded, and then set the width of the ul
296
+ var inter = setInterval(
297
+ function() {
298
+ if(thumb_count == thumbs_loaded) {
299
+ context._setThumbListWidth(context.thumbs_wrapper_width);
300
+ clearInterval(inter);
301
+ };
302
+ },
303
+ 300
304
+ );
305
+ },
306
+ _setThumbListWidth: function(wrapper_width) {
307
+ wrapper_width += 25;
308
+ var list = this.nav.find('.ad-thumb-list');
309
+ list.css('width', wrapper_width +'px');
310
+ // var list = this.nav.find('.ad-thumb-list');
311
+ // list.css('width', wrapper_width +'px');
312
+ // var i = 1;
313
+ // var last_height = list.height();
314
+ // while(i < 201) {
315
+ // list.css('width', (wrapper_width + i) +'px');
316
+ // if(last_height != list.height()) {
317
+ // break;
318
+ // };
319
+ // last_height = list.height();
320
+ // i++;
321
+ // };
322
+ // if(list.width() < this.nav.width()) {
323
+ // list.width(this.nav.width());
324
+ // };
325
+ },
326
+ _initLink: function(link) {
327
+ var context = this;
328
+ link.click(
329
+ function() {
330
+ context.showImage(link.data("ad-i"));
331
+ context.slideshow.stop();
332
+ return false;
333
+ }
334
+ ).hover(
335
+ function() {
336
+ if(!$(this).is('.ad-active') && context.settings.thumb_opacity < 1) {
337
+ $(this).find('img').fadeTo(300, 1);
338
+ };
339
+ context.preloadImage(link.data("ad-i"));
340
+ },
341
+ function() {
342
+ if(!$(this).is('.ad-active') && context.settings.thumb_opacity < 1) {
343
+ $(this).find('img').fadeTo(300, context.settings.thumb_opacity);
344
+ };
345
+ }
346
+ );
347
+ },
348
+ _createImageData: function(thumb_link, image_src) {
349
+ var link = false;
350
+ var thumb_img = thumb_link.find("img");
351
+ if(thumb_img.data('ad-link')) {
352
+ link = thumb_link.data('ad-link');
353
+ } else if(thumb_img.attr('longdesc') && thumb_img.attr('longdesc').length) {
354
+ link = thumb_img.attr('longdesc');
355
+ };
356
+ var desc = false;
357
+ if(thumb_img.data('ad-desc')) {
358
+ desc = thumb_img.data('ad-desc');
359
+ } else if(thumb_img.attr('alt') && thumb_img.attr('alt').length) {
360
+ desc = thumb_img.attr('alt');
361
+ };
362
+ var title = false;
363
+ if(thumb_img.data('ad-title')) {
364
+ title = thumb_img.data('ad-title');
365
+ } else if(thumb_img.attr('title') && thumb_img.attr('title').length) {
366
+ title = thumb_img.attr('title');
367
+ };
368
+ return { thumb_link: thumb_link, image: image_src, error: false,
369
+ preloaded: false, desc: desc, title: title, size: false,
370
+ link: link };
371
+ },
372
+ initKeyEvents: function() {
373
+ var context = this;
374
+ $(document).keydown(
375
+ function(e) {
376
+ if(e.keyCode == 39) {
377
+ // right arrow
378
+ context.nextImage();
379
+ context.slideshow.stop();
380
+ } else if(e.keyCode == 37) {
381
+ // left arrow
382
+ context.prevImage();
383
+ context.slideshow.stop();
384
+ };
385
+ }
386
+ );
387
+ },
388
+ getIndexFromHash: function() {
389
+ if(window.location.hash && window.location.hash.indexOf('#ad-image-') === 0) {
390
+ var id = window.location.hash.replace(/^#ad-image-/g, '');
391
+ var thumb = this.thumbs_wrapper.find("#"+ id);
392
+ if(thumb.length) {
393
+ return this.thumbs_wrapper.find("a").index(thumb);
394
+ } else if(!isNaN(parseInt(id, 10))) {
395
+ return parseInt(id, 10);
396
+ };
397
+ };
398
+ return undefined;
399
+ },
400
+ removeImage: function(index) {
401
+ if(index < 0 || index >= this.images.length) {
402
+ throw "Cannot remove image for index "+ index;
403
+ };
404
+ var image = this.images[index];
405
+ this.images.splice(index, 1);
406
+ var thumb_link = image.thumb_link;
407
+ var thumb_width = thumb_link[0].parentNode.offsetWidth;
408
+ this.thumbs_wrapper_width -= thumb_width;
409
+ thumb_link.remove();
410
+ this._setThumbListWidth(this.thumbs_wrapper_width);
411
+ this.gallery_info.html((this.current_index + 1) +' / '+ this.images.length);
412
+ this.thumbs_wrapper.find('a').each(
413
+ function(i) {
414
+ $(this).data("ad-i", i);
415
+ }
416
+ );
417
+ if(index == this.current_index && this.images.length != 0) {
418
+ this.showImage(0);
419
+ };
420
+ },
421
+ removeAllImages: function() {
422
+ for (var i = this.images.length - 1; i >= 0; i--) {
423
+ this.removeImage(i);
424
+ };
425
+ },
426
+ addImage: function(thumb_url, image_url, image_id, title, description) {
427
+ image_id = image_id || "";
428
+ title = title || "";
429
+ description = description || "";
430
+ var li = $('<li><a href="'+ image_url +'" id="'+ image_id +'">' +
431
+ '<img src="'+ thumb_url +'" title="'+ title +'" alt="'+ description +'">' +
432
+ '</a></li>');
433
+ var context = this;
434
+ this.thumbs_wrapper.find("ul").append(li);
435
+
436
+ var link = li.find("a");
437
+ var thumb = link.find("img");
438
+ thumb.css('opacity', this.settings.thumb_opacity);
439
+
440
+ this.whenImageLoaded(thumb[0], function() {
441
+ var thumb_width = thumb[0].parentNode.parentNode.offsetWidth;
442
+ if(thumb[0].width == 0) {
443
+ // If the browser tells us that the image is loaded, but the width
444
+ // is still 0 for some reason, we default to 100px width.
445
+ // It's not very nice, but it's better than 0.
446
+ thumb_width = 100;
447
+ };
448
+
449
+ context.thumbs_wrapper_width += thumb_width;
450
+ context._setThumbListWidth(context.thumbs_wrapper_width);
451
+ });
452
+ var i = this.images.length;
453
+ link.data("ad-i", i);
454
+ this._initLink(link);
455
+ this.images[i] = context._createImageData(link, image_url);
456
+ this.gallery_info.html((this.current_index + 1) +' / '+ this.images.length);
457
+ },
458
+ initHashChange: function() {
459
+ var context = this;
460
+ if("onhashchange" in window) {
461
+ $(window).bind("hashchange", function() {
462
+ var index = context.getIndexFromHash();
463
+ if(typeof index != "undefined" && index != context.current_index) {
464
+ context.showImage(index);
465
+ };
466
+ });
467
+ } else {
468
+ var current_hash = window.location.hash;
469
+ setInterval(function() {
470
+ if(window.location.hash != current_hash) {
471
+ current_hash = window.location.hash;
472
+ var index = context.getIndexFromHash();
473
+ if(typeof index != "undefined" && index != context.current_index) {
474
+ context.showImage(index);
475
+ };
476
+ };
477
+ }, 200);
478
+ };
479
+ },
480
+ initNextAndPrev: function() {
481
+ this.next_link = $('<div class="ad-next"><div class="ad-next-image"></div></div>');
482
+ this.prev_link = $('<div class="ad-prev"><div class="ad-prev-image"></div></div>');
483
+ this.image_wrapper.append(this.next_link);
484
+ this.image_wrapper.append(this.prev_link);
485
+ var context = this;
486
+ this.prev_link.add(this.next_link).mouseover(
487
+ function(e) {
488
+ // IE 6 hides the wrapper div, so we have to set it's width
489
+ $(this).css('height', context.image_wrapper_height);
490
+ $(this).find('div').show();
491
+ }
492
+ ).mouseout(
493
+ function(e) {
494
+ $(this).find('div').hide();
495
+ }
496
+ ).click(
497
+ function() {
498
+ if($(this).is('.ad-next')) {
499
+ context.nextImage();
500
+ context.slideshow.stop();
501
+ } else {
502
+ context.prevImage();
503
+ context.slideshow.stop();
504
+ };
505
+ }
506
+ ).find('div').css('opacity', 0.7);
507
+ },
508
+ initBackAndForward: function() {
509
+ var context = this;
510
+ this.scroll_forward = $('<div class="ad-forward"></div>');
511
+ this.scroll_back = $('<div class="ad-back"></div>');
512
+ this.nav.append(this.scroll_forward);
513
+ this.nav.prepend(this.scroll_back);
514
+ var has_scrolled = 0;
515
+ var thumbs_scroll_interval = false;
516
+ $(this.scroll_back).add(this.scroll_forward).click(
517
+ function() {
518
+ // We don't want to jump the whole width, since an image
519
+ // might be cut at the edge
520
+ var width = context.nav_display_width - 50;
521
+ var left;
522
+ if(context.settings.scroll_jump > 0) {
523
+ width = context.settings.scroll_jump;
524
+ };
525
+ if($(this).is('.ad-forward')) {
526
+ left = context.thumbs_wrapper.scrollLeft() + width;
527
+ } else {
528
+ left = context.thumbs_wrapper.scrollLeft() - width;
529
+ };
530
+ if(context.settings.slideshow.stop_on_scroll) {
531
+ context.slideshow.stop();
532
+ };
533
+ context.thumbs_wrapper.animate({scrollLeft: left +'px'});
534
+ return false;
535
+ }
536
+ ).css('opacity', 0.6).hover(
537
+ function() {
538
+ var direction = 'left';
539
+ if($(this).is('.ad-forward')) {
540
+ direction = 'right';
541
+ };
542
+ thumbs_scroll_interval = setInterval(
543
+ function() {
544
+ has_scrolled++;
545
+ // Don't want to stop the slideshow just because we scrolled a pixel or two
546
+ if(has_scrolled > 30 && context.settings.slideshow.stop_on_scroll) {
547
+ context.slideshow.stop();
548
+ };
549
+ var left = context.thumbs_wrapper.scrollLeft() + 1;
550
+ if(direction == 'left') {
551
+ left = context.thumbs_wrapper.scrollLeft() - 1;
552
+ };
553
+ context.thumbs_wrapper.scrollLeft(left);
554
+ },
555
+ 10
556
+ );
557
+ $(this).css('opacity', 1);
558
+ },
559
+ function() {
560
+ has_scrolled = 0;
561
+ clearInterval(thumbs_scroll_interval);
562
+ $(this).css('opacity', 0.6);
563
+ }
564
+ );
565
+ },
566
+ _afterShow: function() {
567
+ this.gallery_info.html((this.current_index + 1) +' / '+ this.images.length);
568
+ if(!this.settings.cycle) {
569
+ // Needed for IE
570
+ this.prev_link.show().css('height', this.image_wrapper_height);
571
+ this.next_link.show().css('height', this.image_wrapper_height);
572
+ if(this.current_index == (this.images.length - 1)) {
573
+ this.next_link.hide();
574
+ };
575
+ if(this.current_index == 0) {
576
+ this.prev_link.hide();
577
+ };
578
+ };
579
+ if(this.settings.update_window_hash) {
580
+ var thumb_link = this.images[this.current_index].thumb_link;
581
+ if (thumb_link.attr("id")) {
582
+ window.location.hash = "#ad-image-"+ thumb_link.attr("id");
583
+ } else {
584
+ window.location.hash = "#ad-image-"+ this.current_index;
585
+ };
586
+ };
587
+ this.fireCallback(this.settings.callbacks.afterImageVisible);
588
+ },
589
+ /**
590
+ * Checks if the image is small enough to fit inside the container
591
+ * If it's not, shrink it proportionally
592
+ */
593
+ _getContainedImageSize: function(image_width, image_height) {
594
+ if(image_height > this.image_wrapper_height) {
595
+ var ratio = image_width / image_height;
596
+ image_height = this.image_wrapper_height;
597
+ image_width = this.image_wrapper_height * ratio;
598
+ };
599
+ if(image_width > this.image_wrapper_width) {
600
+ var ratio = image_height / image_width;
601
+ image_width = this.image_wrapper_width;
602
+ image_height = this.image_wrapper_width * ratio;
603
+ };
604
+ return {width: image_width, height: image_height};
605
+ },
606
+ /**
607
+ * If the image dimensions are smaller than the wrapper, we position
608
+ * it in the middle anyway
609
+ */
610
+ _centerImage: function(img_container, image_width, image_height) {
611
+ //console.log(' Image width :' + image_width);
612
+ //console.log(' Image height :' + image_height);
613
+ //console.log(' Image wrapper width :' + this.image_wrapper_width);
614
+ //console.log(' Image wrapper height:' + this.image_wrapper_height);
615
+ img_container.css('top', '0px');
616
+ if(image_height < this.image_wrapper_height) {
617
+ var dif = this.image_wrapper_height - image_height;
618
+ img_container.css('top', (dif / 2) +'px');
619
+ };
620
+ img_container.css('left', '0px');
621
+ if(image_width < this.image_wrapper_width) {
622
+ var dif = this.image_wrapper_width - image_width;
623
+ img_container.css('left', (dif / 2) +'px');
624
+ };
625
+ },
626
+ _getDescription: function(image) {
627
+ var desc = '';
628
+ if(image.desc.length || image.title.length) {
629
+ var title = '';
630
+ if(image.title.length) {
631
+ title = '<strong class="ad-description-title">'+ image.title +'</strong>';
632
+ };
633
+ desc = '';
634
+ if(image.desc.length) {
635
+ desc = '<span>'+ image.desc +'</span>';
636
+ };
637
+ desc = $('<p class="ad-image-description">'+ title + desc +'</p>');
638
+ };
639
+ return desc;
640
+ },
641
+ /**
642
+ * @param function callback Gets fired when the image has loaded, is displaying
643
+ * and it's animation has finished
644
+ */
645
+ showImage: function(index, callback) {
646
+ if(this.images[index] && !this.in_transition && index != this.current_index) {
647
+ var context = this;
648
+ var image = this.images[index];
649
+ this.in_transition = true;
650
+ if(!image.preloaded) {
651
+ this.loading(true);
652
+ this.preloadImage(index, function() {
653
+ context.loading(false);
654
+ context._showWhenLoaded(index, callback);
655
+ });
656
+ } else {
657
+ this._showWhenLoaded(index, callback);
658
+ };
659
+ };
660
+ },
661
+ /**
662
+ * @param function callback Gets fired when the image has loaded, is displaying
663
+ * and it's animation has finished
664
+ */
665
+ _showWhenLoaded: function(index, callback) {
666
+ if(this.images[index]) {
667
+ var context = this;
668
+ var image = this.images[index];
669
+ var img_container = $(document.createElement('div')).addClass('ad-image');
670
+ var img = $(new Image()).attr('src', image.image);
671
+ if(image.link) {
672
+ var link = $('<a href="'+ image.link +'" target="_blank"></a>');
673
+ link.append(img);
674
+ img_container.append(link);
675
+ } else {
676
+ img_container.append(img);
677
+ };
678
+ this.image_wrapper.prepend(img_container);
679
+ var size = this._getContainedImageSize(image.size.width, image.size.height);
680
+ img.attr('width', size.width);
681
+ img.attr('height', size.height);
682
+ //console.log(' Image width :' + size.width);
683
+ //console.log(' Image height :' + size.height);
684
+ img_container.css({width: size.width +'px', height: size.height +'px'});
685
+ this._centerImage(img_container, size.width, size.height);
686
+ var desc = this._getDescription(image);
687
+ if(desc) {
688
+ if(!this.settings.description_wrapper && !this.settings.hooks.displayDescription) {
689
+ img_container.append(desc);
690
+ var width = size.width - parseInt(desc.css('padding-left'), 10) - parseInt(desc.css('padding-right'), 10);
691
+ desc.css('width', width +'px');
692
+ } else if(this.settings.hooks.displayDescription) {
693
+ this.settings.hooks.displayDescription.call(this, image);
694
+ } else {
695
+ var wrapper = this.settings.description_wrapper;
696
+ wrapper.append(desc);
697
+ };
698
+ };
699
+ this.highLightThumb(this.images[index].thumb_link);
700
+
701
+ var direction = 'right';
702
+ if(this.current_index < index) {
703
+ direction = 'left';
704
+ };
705
+ this.fireCallback(this.settings.callbacks.beforeImageVisible);
706
+ if(this.current_image || this.settings.animate_first_image) {
707
+ var animation_speed = this.settings.animation_speed;
708
+ var easing = 'swing';
709
+ var animation = this.animations[this.settings.effect].call(this, img_container, direction, desc);
710
+ if(typeof animation.speed != 'undefined') {
711
+ animation_speed = animation.speed;
712
+ };
713
+ if(typeof animation.easing != 'undefined') {
714
+ easing = animation.easing;
715
+ };
716
+ if(this.current_image) {
717
+ var old_image = this.current_image;
718
+ var old_description = this.current_description;
719
+ old_image.animate(animation.old_image, animation_speed, easing,
720
+ function() {
721
+ old_image.remove();
722
+ if(old_description) old_description.remove();
723
+ }
724
+ );
725
+ };
726
+ img_container.animate(animation.new_image, animation_speed, easing,
727
+ function() {
728
+ context.current_index = index;
729
+ context.current_image = img_container;
730
+ context.current_description = desc;
731
+ context.in_transition = false;
732
+ context._afterShow();
733
+ context.fireCallback(callback);
734
+ }
735
+ );
736
+ } else {
737
+ this.current_index = index;
738
+ this.current_image = img_container;
739
+ context.current_description = desc;
740
+ this.in_transition = false;
741
+ context._afterShow();
742
+ this.fireCallback(callback);
743
+ };
744
+ };
745
+ },
746
+ nextIndex: function() {
747
+ var next;
748
+ if(this.current_index == (this.images.length - 1)) {
749
+ if(!this.settings.cycle) {
750
+ return false;
751
+ };
752
+ next = 0;
753
+ } else {
754
+ next = this.current_index + 1;
755
+ };
756
+ return next;
757
+ },
758
+ nextImage: function(callback) {
759
+ var next = this.nextIndex();
760
+ if(next === false) return false;
761
+ this.preloadImage(next + 1);
762
+ this.showImage(next, callback);
763
+ return true;
764
+ },
765
+ prevIndex: function() {
766
+ var prev;
767
+ if(this.current_index == 0) {
768
+ if(!this.settings.cycle) {
769
+ return false;
770
+ };
771
+ prev = this.images.length - 1;
772
+ } else {
773
+ prev = this.current_index - 1;
774
+ };
775
+ return prev;
776
+ },
777
+ prevImage: function(callback) {
778
+ var prev = this.prevIndex();
779
+ if(prev === false) return false;
780
+ this.preloadImage(prev - 1);
781
+ this.showImage(prev, callback);
782
+ return true;
783
+ },
784
+ preloadAll: function() {
785
+ var context = this;
786
+ var i = 0;
787
+ function preloadNext() {
788
+ if(i < context.images.length) {
789
+ i++;
790
+ context.preloadImage(i, preloadNext);
791
+ };
792
+ };
793
+ context.preloadImage(i, preloadNext);
794
+ },
795
+ preloadImage: function(index, callback) {
796
+ if(this.images[index]) {
797
+ var image = this.images[index];
798
+ if(!this.images[index].preloaded) {
799
+ var img = $(new Image());
800
+ img.attr('src', image.image);
801
+ if(!this.isImageLoaded(img[0])) {
802
+ this.preloads.append(img);
803
+ var context = this;
804
+ img.load(
805
+ function() {
806
+ image.preloaded = true;
807
+ image.size = { width: this.width, height: this.height };
808
+ context.fireCallback(callback);
809
+ }
810
+ ).error(
811
+ function() {
812
+ image.error = true;
813
+ image.preloaded = false;
814
+ image.size = false;
815
+ }
816
+ );
817
+ } else {
818
+ image.preloaded = true;
819
+ image.size = { width: img[0].width, height: img[0].height };
820
+ this.fireCallback(callback);
821
+ };
822
+ } else {
823
+ this.fireCallback(callback);
824
+ };
825
+ };
826
+ },
827
+ whenImageLoaded: function(img, callback) {
828
+ if (this.isImageLoaded(img)) {
829
+ callback && callback();
830
+ } else {
831
+ $(img).load(callback);
832
+ };
833
+ },
834
+ isImageLoaded: function(img) {
835
+ if(typeof img.complete != 'undefined' && !img.complete) {
836
+ return false;
837
+ };
838
+ if(typeof img.naturalWidth != 'undefined' && img.naturalWidth == 0) {
839
+ return false;
840
+ };
841
+ return true;
842
+ },
843
+ highLightThumb: function(thumb) {
844
+ this.thumbs_wrapper.find('.ad-active').removeClass('ad-active');
845
+ thumb.addClass('ad-active');
846
+ if(this.settings.thumb_opacity < 1) {
847
+ this.thumbs_wrapper.find('a:not(.ad-active) img').fadeTo(300, this.settings.thumb_opacity);
848
+ thumb.find('img').fadeTo(300, 1);
849
+ };
850
+ var left = thumb[0].parentNode.offsetLeft;
851
+ left -= (this.nav_display_width / 2) - (thumb[0].offsetWidth / 2);
852
+ this.thumbs_wrapper.animate({scrollLeft: left +'px'});
853
+ },
854
+ fireCallback: function(fn) {
855
+ if($.isFunction(fn)) {
856
+ fn.call(this);
857
+ };
858
+ }
859
+ };
860
+
861
+ function AdGallerySlideshow(nextimage_callback, settings) {
862
+ this.init(nextimage_callback, settings);
863
+ };
864
+ AdGallerySlideshow.prototype = {
865
+ start_link: false,
866
+ stop_link: false,
867
+ countdown: false,
868
+ controls: false,
869
+
870
+ settings: false,
871
+ nextimage_callback: false,
872
+ enabled: false,
873
+ running: false,
874
+ countdown_interval: false,
875
+ init: function(nextimage_callback, settings) {
876
+ this.nextimage_callback = nextimage_callback;
877
+ this.settings = settings;
878
+ },
879
+ create: function() {
880
+ this.start_link = $('<span class="ad-slideshow-start">'+ this.settings.start_label +'</span>');
881
+ this.stop_link = $('<span class="ad-slideshow-stop">'+ this.settings.stop_label +'</span>');
882
+ this.countdown = $('<span class="ad-slideshow-countdown"></span>');
883
+ this.controls = $('<div class="ad-slideshow-controls"></div>');
884
+ this.controls.append(this.start_link).append(this.stop_link).append(this.countdown);
885
+ this.countdown.hide();
886
+
887
+ var context = this;
888
+ this.start_link.click(
889
+ function() {
890
+ context.start();
891
+ }
892
+ );
893
+ this.stop_link.click(
894
+ function() {
895
+ context.stop();
896
+ }
897
+ );
898
+ $(document).keydown(
899
+ function(e) {
900
+ if(e.keyCode == 83) {
901
+ // 's'
902
+ if(context.running) {
903
+ context.stop();
904
+ } else {
905
+ context.start();
906
+ };
907
+ };
908
+ }
909
+ );
910
+ return this.controls;
911
+ },
912
+ disable: function() {
913
+ this.enabled = false;
914
+ this.stop();
915
+ this.controls.hide();
916
+ },
917
+ enable: function() {
918
+ this.enabled = true;
919
+ this.controls.show();
920
+ },
921
+ toggle: function() {
922
+ if(this.enabled) {
923
+ this.disable();
924
+ } else {
925
+ this.enable();
926
+ };
927
+ },
928
+ start: function() {
929
+ if(this.running || !this.enabled) return false;
930
+ this.running = true;
931
+ this.controls.addClass('ad-slideshow-running');
932
+ this._next();
933
+ this.fireCallback(this.settings.onStart);
934
+ return true;
935
+ },
936
+ stop: function() {
937
+ if(!this.running) return false;
938
+ this.running = false;
939
+ this.countdown.hide();
940
+ this.controls.removeClass('ad-slideshow-running');
941
+ clearInterval(this.countdown_interval);
942
+ this.fireCallback(this.settings.onStop);
943
+ return true;
944
+ },
945
+ _next: function() {
946
+ var context = this;
947
+ var pre = this.settings.countdown_prefix;
948
+ var su = this.settings.countdown_sufix;
949
+ clearInterval(context.countdown_interval);
950
+ this.countdown.show().html(pre + (this.settings.speed / 1000) + su);
951
+ var slide_timer = 0;
952
+ this.countdown_interval = setInterval(
953
+ function() {
954
+ slide_timer += 1000;
955
+ if(slide_timer >= context.settings.speed) {
956
+ var whenNextIsShown = function() {
957
+ // A check so the user hasn't stoped the slideshow during the
958
+ // animation
959
+ if(context.running) {
960
+ context._next();
961
+ };
962
+ slide_timer = 0;
963
+ };
964
+ if(!context.nextimage_callback(whenNextIsShown)) {
965
+ context.stop();
966
+ };
967
+ slide_timer = 0;
968
+ };
969
+ var sec = parseInt(context.countdown.text().replace(/[^0-9]/g, ''), 10);
970
+ sec--;
971
+ if(sec > 0) {
972
+ context.countdown.html(pre + sec + su);
973
+ };
974
+ },
975
+ 1000
976
+ );
977
+ },
978
+ fireCallback: function(fn) {
979
+ if($.isFunction(fn)) {
980
+ fn.call(this);
981
+ };
982
+ }
983
+ };
984
+ })(jQuery);