locomotive_cms 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (607) hide show
  1. data/Gemfile +45 -0
  2. data/README.textile +23 -0
  3. data/app/controllers/admin/accounts_controller.rb +24 -0
  4. data/app/controllers/admin/asset_collections_controller.rb +66 -0
  5. data/app/controllers/admin/assets_controller.rb +48 -0
  6. data/app/controllers/admin/base_controller.rb +55 -0
  7. data/app/controllers/admin/content_types_controller.rb +52 -0
  8. data/app/controllers/admin/contents_controller.rb +72 -0
  9. data/app/controllers/admin/current_sites_controller.rb +33 -0
  10. data/app/controllers/admin/layouts_controller.rb +56 -0
  11. data/app/controllers/admin/memberships_controller.rb +39 -0
  12. data/app/controllers/admin/my_accounts_controller.rb +21 -0
  13. data/app/controllers/admin/page_parts_controller.rb +12 -0
  14. data/app/controllers/admin/pages_controller.rb +70 -0
  15. data/app/controllers/admin/passwords_controller.rb +11 -0
  16. data/app/controllers/admin/rendering_controller.rb +15 -0
  17. data/app/controllers/admin/sessions_controller.rb +17 -0
  18. data/app/controllers/admin/sites_controller.rb +48 -0
  19. data/app/controllers/admin/snippets_controller.rb +56 -0
  20. data/app/controllers/admin/theme_assets_controller.rb +79 -0
  21. data/app/controllers/application_controller.rb +3 -0
  22. data/app/controllers/home_controller.rb +7 -0
  23. data/app/helpers/admin/accounts_helper.rb +8 -0
  24. data/app/helpers/admin/assets_helper.rb +15 -0
  25. data/app/helpers/admin/base_helper.rb +54 -0
  26. data/app/helpers/admin/custom_fields_helper.rb +24 -0
  27. data/app/helpers/admin/login_helper.rb +17 -0
  28. data/app/helpers/admin/pages_helper.rb +23 -0
  29. data/app/helpers/admin/sites_helper.rb +24 -0
  30. data/app/models/account.rb +46 -0
  31. data/app/models/asset.rb +38 -0
  32. data/app/models/asset_collection.rb +60 -0
  33. data/app/models/content_instance.rb +29 -0
  34. data/app/models/content_type.rb +63 -0
  35. data/app/models/extensions/asset/vignette.rb +40 -0
  36. data/app/models/extensions/page/parts.rb +54 -0
  37. data/app/models/extensions/page/render.rb +19 -0
  38. data/app/models/extensions/page/tree.rb +97 -0
  39. data/app/models/layout.rb +49 -0
  40. data/app/models/liquid_template.rb +32 -0
  41. data/app/models/membership.rb +36 -0
  42. data/app/models/page.rb +87 -0
  43. data/app/models/page_part.rb +38 -0
  44. data/app/models/site.rb +93 -0
  45. data/app/models/snippet.rb +3 -0
  46. data/app/models/theme_asset.rb +101 -0
  47. data/app/uploaders/asset_uploader.rb +68 -0
  48. data/app/uploaders/theme_asset_uploader.rb +42 -0
  49. data/app/views/admin/accounts/new.html.haml +22 -0
  50. data/app/views/admin/asset_collections/_asset.html.haml +7 -0
  51. data/app/views/admin/asset_collections/edit.html.haml +30 -0
  52. data/app/views/admin/asset_collections/index.html.haml +8 -0
  53. data/app/views/admin/asset_collections/new.html.haml +17 -0
  54. data/app/views/admin/assets/_form.html.haml +18 -0
  55. data/app/views/admin/assets/edit.html.haml +15 -0
  56. data/app/views/admin/assets/new.html.haml +12 -0
  57. data/app/views/admin/content_types/_form.html.haml +13 -0
  58. data/app/views/admin/content_types/edit.html.haml +16 -0
  59. data/app/views/admin/content_types/new.html.haml +15 -0
  60. data/app/views/admin/contents/_form.html.haml +10 -0
  61. data/app/views/admin/contents/edit.html.haml +16 -0
  62. data/app/views/admin/contents/index.html.haml +35 -0
  63. data/app/views/admin/contents/new.html.haml +15 -0
  64. data/app/views/admin/current_sites/_form.html.haml +45 -0
  65. data/app/views/admin/current_sites/edit.html.haml +15 -0
  66. data/app/views/admin/layouts/_form.html.haml +10 -0
  67. data/app/views/admin/layouts/_layout.html.haml +7 -0
  68. data/app/views/admin/layouts/edit.html.haml +18 -0
  69. data/app/views/admin/layouts/index.html.haml +15 -0
  70. data/app/views/admin/layouts/new.html.haml +15 -0
  71. data/app/views/admin/memberships/new.html.haml +15 -0
  72. data/app/views/admin/my_accounts/edit.html.haml +42 -0
  73. data/app/views/admin/pages/_form.html.haml +37 -0
  74. data/app/views/admin/pages/_page.html.haml +16 -0
  75. data/app/views/admin/pages/edit.html.haml +15 -0
  76. data/app/views/admin/pages/index.html.haml +18 -0
  77. data/app/views/admin/pages/new.html.haml +12 -0
  78. data/app/views/admin/passwords/edit.html.haml +18 -0
  79. data/app/views/admin/passwords/new.html.haml +17 -0
  80. data/app/views/admin/sessions/new.html.haml +15 -0
  81. data/app/views/admin/shared/_custom_fields.html.haml +47 -0
  82. data/app/views/admin/shared/_footer.html.haml +5 -0
  83. data/app/views/admin/shared/_form_actions.html.haml +15 -0
  84. data/app/views/admin/shared/_head.html.haml +18 -0
  85. data/app/views/admin/shared/_header.html.haml +8 -0
  86. data/app/views/admin/shared/_menu.html.haml +5 -0
  87. data/app/views/admin/shared/menu/_assets.html.haml +7 -0
  88. data/app/views/admin/shared/menu/_contents.html.haml +27 -0
  89. data/app/views/admin/shared/menu/_settings.html.haml +6 -0
  90. data/app/views/admin/sites/_form.html.haml +35 -0
  91. data/app/views/admin/sites/new.html.haml +12 -0
  92. data/app/views/admin/snippets/_form.html.haml +11 -0
  93. data/app/views/admin/snippets/_snippet.html.haml +7 -0
  94. data/app/views/admin/snippets/edit.html.haml +15 -0
  95. data/app/views/admin/snippets/index.html.haml +15 -0
  96. data/app/views/admin/snippets/new.html.haml +12 -0
  97. data/app/views/admin/theme_assets/_asset.html.haml +12 -0
  98. data/app/views/admin/theme_assets/_form.html.haml +39 -0
  99. data/app/views/admin/theme_assets/edit.html.haml +15 -0
  100. data/app/views/admin/theme_assets/images.html.haml +15 -0
  101. data/app/views/admin/theme_assets/index.html.haml +27 -0
  102. data/app/views/admin/theme_assets/new.html.haml +12 -0
  103. data/app/views/devise/confirmations/new.html.haml +12 -0
  104. data/app/views/devise/mailer/confirmation_instructions.html.haml +8 -0
  105. data/app/views/devise/mailer/reset_password_instructions.html.haml +12 -0
  106. data/app/views/devise/mailer/unlock_instructions.html.haml +10 -0
  107. data/app/views/devise/registrations/edit.html.haml +35 -0
  108. data/app/views/devise/registrations/new.html.haml +20 -0
  109. data/app/views/devise/sessions/new.html.haml +22 -0
  110. data/app/views/devise/shared/_links.haml +20 -0
  111. data/app/views/devise/unlocks/new.html.haml +12 -0
  112. data/app/views/home/show.html.haml +4 -0
  113. data/app/views/layouts/admin/application.html.haml +26 -0
  114. data/app/views/layouts/admin/login.html.haml +17 -0
  115. data/app/views/layouts/application.html.haml +7 -0
  116. data/config/application.rb +48 -0
  117. data/config/boot.rb +17 -0
  118. data/config/cucumber.yml +8 -0
  119. data/config/database.yml +20 -0
  120. data/config/environment.rb +5 -0
  121. data/config/environments/development.rb +35 -0
  122. data/config/environments/production.rb +33 -0
  123. data/config/environments/test.rb +33 -0
  124. data/config/initializers/backtrace_silencers.rb +7 -0
  125. data/config/initializers/carrierwave.rb +57 -0
  126. data/config/initializers/devise.rb +119 -0
  127. data/config/initializers/formtastic.rb +5 -0
  128. data/config/initializers/inflections.rb +10 -0
  129. data/config/initializers/locomotive.rb +7 -0
  130. data/config/initializers/mime_types.rb +5 -0
  131. data/config/initializers/mongoid.rb +61 -0
  132. data/config/initializers/rspec_generator.rb +8 -0
  133. data/config/locales/admin_ui_en.yml +211 -0
  134. data/config/locales/admin_ui_fr.yml +21 -0
  135. data/config/locales/carrierwave_en.yml +4 -0
  136. data/config/locales/carrierwave_fr.yml +4 -0
  137. data/config/locales/default_en.yml +29 -0
  138. data/config/locales/default_fr.yml +30 -0
  139. data/config/locales/devise.en.yml +36 -0
  140. data/config/routes.rb +57 -0
  141. data/lib/core_ext.rb +32 -0
  142. data/lib/generators/locomotive_generator.rb +14 -0
  143. data/lib/locomotive.rb +35 -0
  144. data/lib/locomotive/configuration.rb +67 -0
  145. data/lib/locomotive/devise/sessions_controller.rb +2 -0
  146. data/lib/locomotive/engine.rb +21 -0
  147. data/lib/locomotive/liquid.rb +5 -0
  148. data/lib/locomotive/liquid/db_file_system.rb +18 -0
  149. data/lib/locomotive/liquid/drops/asset_collections.rb +19 -0
  150. data/lib/locomotive/liquid/drops/base.rb +50 -0
  151. data/lib/locomotive/liquid/drops/content.rb +19 -0
  152. data/lib/locomotive/liquid/drops/contents.rb +63 -0
  153. data/lib/locomotive/liquid/drops/javascripts.rb +18 -0
  154. data/lib/locomotive/liquid/drops/stylesheets.rb +19 -0
  155. data/lib/locomotive/liquid/filters/date.rb +30 -0
  156. data/lib/locomotive/liquid/filters/html.rb +114 -0
  157. data/lib/locomotive/liquid/filters/misc.rb +30 -0
  158. data/lib/locomotive/liquid/liquify_template.rb +57 -0
  159. data/lib/locomotive/liquid/tags/blueprint.rb +21 -0
  160. data/lib/locomotive/liquid/tags/jquery.rb +17 -0
  161. data/lib/locomotive/liquid/tags/paginate.rb +100 -0
  162. data/lib/locomotive/liquid/tags/snippet.rb +42 -0
  163. data/lib/locomotive/liquid/tags/with_scope.rb +39 -0
  164. data/lib/locomotive/mongoid.rb +2 -0
  165. data/lib/locomotive/mongoid/document.rb +20 -0
  166. data/lib/locomotive/mongoid/model_extensions.rb +1 -0
  167. data/lib/locomotive/patches.rb +2 -0
  168. data/lib/locomotive/regexps.rb +13 -0
  169. data/lib/locomotive/render.rb +59 -0
  170. data/lib/locomotive/routing/default_constraint.rb +45 -0
  171. data/lib/locomotive/routing/site_dispatcher.rb +48 -0
  172. data/lib/misc_form_builder.rb +35 -0
  173. data/lib/tasks/cucumber.rake +53 -0
  174. data/lib/tasks/rspec.rake +69 -0
  175. data/public/images/admin/background/body.png +0 -0
  176. data/public/images/admin/background/footer.png +0 -0
  177. data/public/images/admin/background/light.png +0 -0
  178. data/public/images/admin/buttons/action-left.png +0 -0
  179. data/public/images/admin/buttons/action-right.png +0 -0
  180. data/public/images/admin/buttons/add-left.png +0 -0
  181. data/public/images/admin/buttons/add-right.png +0 -0
  182. data/public/images/admin/buttons/dark-gray-left.png +0 -0
  183. data/public/images/admin/buttons/dark-gray-right.png +0 -0
  184. data/public/images/admin/buttons/emboss-left.png +0 -0
  185. data/public/images/admin/buttons/emboss-right.png +0 -0
  186. data/public/images/admin/buttons/gray-left.png +0 -0
  187. data/public/images/admin/buttons/gray-right.png +0 -0
  188. data/public/images/admin/buttons/light-gray-left.png +0 -0
  189. data/public/images/admin/buttons/light-gray-right.png +0 -0
  190. data/public/images/admin/buttons/search.png +0 -0
  191. data/public/images/admin/buttons/transparent-left.png +0 -0
  192. data/public/images/admin/buttons/transparent-right.png +0 -0
  193. data/public/images/admin/form/big_item.png +0 -0
  194. data/public/images/admin/form/error-arrow.png +0 -0
  195. data/public/images/admin/form/field.png +0 -0
  196. data/public/images/admin/form/folded-arrow-off.png +0 -0
  197. data/public/images/admin/form/folded-arrow-on.png +0 -0
  198. data/public/images/admin/form/folded.png +0 -0
  199. data/public/images/admin/form/footer.png +0 -0
  200. data/public/images/admin/form/growl-error.png +0 -0
  201. data/public/images/admin/form/growl-notice.png +0 -0
  202. data/public/images/admin/form/header-first-on.png +0 -0
  203. data/public/images/admin/form/header-left-on.png +0 -0
  204. data/public/images/admin/form/header-on.png +0 -0
  205. data/public/images/admin/form/header-right-on.png +0 -0
  206. data/public/images/admin/form/header.png +0 -0
  207. data/public/images/admin/form/icons/drag.png +0 -0
  208. data/public/images/admin/form/icons/spinner.gif +0 -0
  209. data/public/images/admin/form/icons/trash.png +0 -0
  210. data/public/images/admin/form/item.png +0 -0
  211. data/public/images/admin/form/pen.png +0 -0
  212. data/public/images/admin/icons/filetype/medium/AC3.png +0 -0
  213. data/public/images/admin/icons/filetype/medium/ACE.png +0 -0
  214. data/public/images/admin/icons/filetype/medium/ADE.png +0 -0
  215. data/public/images/admin/icons/filetype/medium/ADP.png +0 -0
  216. data/public/images/admin/icons/filetype/medium/AI.png +0 -0
  217. data/public/images/admin/icons/filetype/medium/AIFF.png +0 -0
  218. data/public/images/admin/icons/filetype/medium/AU.png +0 -0
  219. data/public/images/admin/icons/filetype/medium/AVI.png +0 -0
  220. data/public/images/admin/icons/filetype/medium/BAT.png +0 -0
  221. data/public/images/admin/icons/filetype/medium/BIN.png +0 -0
  222. data/public/images/admin/icons/filetype/medium/BMP.png +0 -0
  223. data/public/images/admin/icons/filetype/medium/BUP.png +0 -0
  224. data/public/images/admin/icons/filetype/medium/CAB.png +0 -0
  225. data/public/images/admin/icons/filetype/medium/CAT.png +0 -0
  226. data/public/images/admin/icons/filetype/medium/CHM.png +0 -0
  227. data/public/images/admin/icons/filetype/medium/CSS.png +0 -0
  228. data/public/images/admin/icons/filetype/medium/CUE.png +0 -0
  229. data/public/images/admin/icons/filetype/medium/DAT.png +0 -0
  230. data/public/images/admin/icons/filetype/medium/DCR.png +0 -0
  231. data/public/images/admin/icons/filetype/medium/DER.png +0 -0
  232. data/public/images/admin/icons/filetype/medium/DIC.png +0 -0
  233. data/public/images/admin/icons/filetype/medium/DIVX.png +0 -0
  234. data/public/images/admin/icons/filetype/medium/DIZ.png +0 -0
  235. data/public/images/admin/icons/filetype/medium/DLL.png +0 -0
  236. data/public/images/admin/icons/filetype/medium/DOC.png +0 -0
  237. data/public/images/admin/icons/filetype/medium/DOCX.png +0 -0
  238. data/public/images/admin/icons/filetype/medium/DOS.png +0 -0
  239. data/public/images/admin/icons/filetype/medium/DVD.png +0 -0
  240. data/public/images/admin/icons/filetype/medium/DWG.png +0 -0
  241. data/public/images/admin/icons/filetype/medium/DWT.png +0 -0
  242. data/public/images/admin/icons/filetype/medium/EMF.png +0 -0
  243. data/public/images/admin/icons/filetype/medium/EXC.png +0 -0
  244. data/public/images/admin/icons/filetype/medium/FON.png +0 -0
  245. data/public/images/admin/icons/filetype/medium/GIF.png +0 -0
  246. data/public/images/admin/icons/filetype/medium/HLP.png +0 -0
  247. data/public/images/admin/icons/filetype/medium/HTML.png +0 -0
  248. data/public/images/admin/icons/filetype/medium/IFO.png +0 -0
  249. data/public/images/admin/icons/filetype/medium/INF.png +0 -0
  250. data/public/images/admin/icons/filetype/medium/INI.png +0 -0
  251. data/public/images/admin/icons/filetype/medium/INS.png +0 -0
  252. data/public/images/admin/icons/filetype/medium/IP.png +0 -0
  253. data/public/images/admin/icons/filetype/medium/ISO.png +0 -0
  254. data/public/images/admin/icons/filetype/medium/ISP.png +0 -0
  255. data/public/images/admin/icons/filetype/medium/JAVA.png +0 -0
  256. data/public/images/admin/icons/filetype/medium/JFIF.png +0 -0
  257. data/public/images/admin/icons/filetype/medium/JPEG.png +0 -0
  258. data/public/images/admin/icons/filetype/medium/JPG.png +0 -0
  259. data/public/images/admin/icons/filetype/medium/LOG.png +0 -0
  260. data/public/images/admin/icons/filetype/medium/M4A.png +0 -0
  261. data/public/images/admin/icons/filetype/medium/MID.png +0 -0
  262. data/public/images/admin/icons/filetype/medium/MMF.png +0 -0
  263. data/public/images/admin/icons/filetype/medium/MMM.png +0 -0
  264. data/public/images/admin/icons/filetype/medium/MOV.png +0 -0
  265. data/public/images/admin/icons/filetype/medium/MOVIE.png +0 -0
  266. data/public/images/admin/icons/filetype/medium/MP2.png +0 -0
  267. data/public/images/admin/icons/filetype/medium/MP2V.png +0 -0
  268. data/public/images/admin/icons/filetype/medium/MP3.png +0 -0
  269. data/public/images/admin/icons/filetype/medium/MP4.png +0 -0
  270. data/public/images/admin/icons/filetype/medium/MPE.png +0 -0
  271. data/public/images/admin/icons/filetype/medium/MPEG.png +0 -0
  272. data/public/images/admin/icons/filetype/medium/MPG.png +0 -0
  273. data/public/images/admin/icons/filetype/medium/MPV2.png +0 -0
  274. data/public/images/admin/icons/filetype/medium/NFO.png +0 -0
  275. data/public/images/admin/icons/filetype/medium/PDD.png +0 -0
  276. data/public/images/admin/icons/filetype/medium/PDF.png +0 -0
  277. data/public/images/admin/icons/filetype/medium/PHP.png +0 -0
  278. data/public/images/admin/icons/filetype/medium/PNG.png +0 -0
  279. data/public/images/admin/icons/filetype/medium/PPT.png +0 -0
  280. data/public/images/admin/icons/filetype/medium/PPTX.png +0 -0
  281. data/public/images/admin/icons/filetype/medium/PSD.png +0 -0
  282. data/public/images/admin/icons/filetype/medium/RAR.png +0 -0
  283. data/public/images/admin/icons/filetype/medium/REG.png +0 -0
  284. data/public/images/admin/icons/filetype/medium/RTF.png +0 -0
  285. data/public/images/admin/icons/filetype/medium/SCP.png +0 -0
  286. data/public/images/admin/icons/filetype/medium/THEME.png +0 -0
  287. data/public/images/admin/icons/filetype/medium/TIF.png +0 -0
  288. data/public/images/admin/icons/filetype/medium/TIFF.png +0 -0
  289. data/public/images/admin/icons/filetype/medium/TLB.png +0 -0
  290. data/public/images/admin/icons/filetype/medium/TTF.png +0 -0
  291. data/public/images/admin/icons/filetype/medium/TXT.png +0 -0
  292. data/public/images/admin/icons/filetype/medium/Thumbs.db +0 -0
  293. data/public/images/admin/icons/filetype/medium/UIS.png +0 -0
  294. data/public/images/admin/icons/filetype/medium/URL.png +0 -0
  295. data/public/images/admin/icons/filetype/medium/VBS.png +0 -0
  296. data/public/images/admin/icons/filetype/medium/VCR.png +0 -0
  297. data/public/images/admin/icons/filetype/medium/VOB.png +0 -0
  298. data/public/images/admin/icons/filetype/medium/WAV.png +0 -0
  299. data/public/images/admin/icons/filetype/medium/WBA.png +0 -0
  300. data/public/images/admin/icons/filetype/medium/WMA.png +0 -0
  301. data/public/images/admin/icons/filetype/medium/WMV.png +0 -0
  302. data/public/images/admin/icons/filetype/medium/WPL.png +0 -0
  303. data/public/images/admin/icons/filetype/medium/WRI.png +0 -0
  304. data/public/images/admin/icons/filetype/medium/WTX.png +0 -0
  305. data/public/images/admin/icons/filetype/medium/XLS.png +0 -0
  306. data/public/images/admin/icons/filetype/medium/XLSX.png +0 -0
  307. data/public/images/admin/icons/filetype/medium/XML.png +0 -0
  308. data/public/images/admin/icons/filetype/medium/XSL.png +0 -0
  309. data/public/images/admin/icons/filetype/medium/ZAP.png +0 -0
  310. data/public/images/admin/icons/filetype/medium/ZIP.png +0 -0
  311. data/public/images/admin/icons/filetype/medium/unknown.png +0 -0
  312. data/public/images/admin/icons/filetype/thumb/AC3.png +0 -0
  313. data/public/images/admin/icons/filetype/thumb/ACE.png +0 -0
  314. data/public/images/admin/icons/filetype/thumb/ADE.png +0 -0
  315. data/public/images/admin/icons/filetype/thumb/ADP.png +0 -0
  316. data/public/images/admin/icons/filetype/thumb/AI.png +0 -0
  317. data/public/images/admin/icons/filetype/thumb/AIFF.png +0 -0
  318. data/public/images/admin/icons/filetype/thumb/AU.png +0 -0
  319. data/public/images/admin/icons/filetype/thumb/AVI.png +0 -0
  320. data/public/images/admin/icons/filetype/thumb/BAT.png +0 -0
  321. data/public/images/admin/icons/filetype/thumb/BIN.png +0 -0
  322. data/public/images/admin/icons/filetype/thumb/BMP.png +0 -0
  323. data/public/images/admin/icons/filetype/thumb/BUP.png +0 -0
  324. data/public/images/admin/icons/filetype/thumb/CAB.png +0 -0
  325. data/public/images/admin/icons/filetype/thumb/CAT.png +0 -0
  326. data/public/images/admin/icons/filetype/thumb/CHM.png +0 -0
  327. data/public/images/admin/icons/filetype/thumb/CSS.png +0 -0
  328. data/public/images/admin/icons/filetype/thumb/CUE.png +0 -0
  329. data/public/images/admin/icons/filetype/thumb/DAT.png +0 -0
  330. data/public/images/admin/icons/filetype/thumb/DCR.png +0 -0
  331. data/public/images/admin/icons/filetype/thumb/DER.png +0 -0
  332. data/public/images/admin/icons/filetype/thumb/DIC.png +0 -0
  333. data/public/images/admin/icons/filetype/thumb/DIVX.png +0 -0
  334. data/public/images/admin/icons/filetype/thumb/DIZ.png +0 -0
  335. data/public/images/admin/icons/filetype/thumb/DLL.png +0 -0
  336. data/public/images/admin/icons/filetype/thumb/DOC.png +0 -0
  337. data/public/images/admin/icons/filetype/thumb/DOCX.png +0 -0
  338. data/public/images/admin/icons/filetype/thumb/DOS.png +0 -0
  339. data/public/images/admin/icons/filetype/thumb/DVD.png +0 -0
  340. data/public/images/admin/icons/filetype/thumb/DWG.png +0 -0
  341. data/public/images/admin/icons/filetype/thumb/DWT.png +0 -0
  342. data/public/images/admin/icons/filetype/thumb/EMF.png +0 -0
  343. data/public/images/admin/icons/filetype/thumb/EXC.png +0 -0
  344. data/public/images/admin/icons/filetype/thumb/FON.png +0 -0
  345. data/public/images/admin/icons/filetype/thumb/GIF.png +0 -0
  346. data/public/images/admin/icons/filetype/thumb/HLP.png +0 -0
  347. data/public/images/admin/icons/filetype/thumb/HTML.png +0 -0
  348. data/public/images/admin/icons/filetype/thumb/IFO.png +0 -0
  349. data/public/images/admin/icons/filetype/thumb/INF.png +0 -0
  350. data/public/images/admin/icons/filetype/thumb/INI.png +0 -0
  351. data/public/images/admin/icons/filetype/thumb/INS.png +0 -0
  352. data/public/images/admin/icons/filetype/thumb/IP.png +0 -0
  353. data/public/images/admin/icons/filetype/thumb/ISO.png +0 -0
  354. data/public/images/admin/icons/filetype/thumb/ISP.png +0 -0
  355. data/public/images/admin/icons/filetype/thumb/JAVA.png +0 -0
  356. data/public/images/admin/icons/filetype/thumb/JFIF.png +0 -0
  357. data/public/images/admin/icons/filetype/thumb/JPEG.png +0 -0
  358. data/public/images/admin/icons/filetype/thumb/JPG.png +0 -0
  359. data/public/images/admin/icons/filetype/thumb/LOG.png +0 -0
  360. data/public/images/admin/icons/filetype/thumb/M4A.png +0 -0
  361. data/public/images/admin/icons/filetype/thumb/MID.png +0 -0
  362. data/public/images/admin/icons/filetype/thumb/MMF.png +0 -0
  363. data/public/images/admin/icons/filetype/thumb/MMM.png +0 -0
  364. data/public/images/admin/icons/filetype/thumb/MOV.png +0 -0
  365. data/public/images/admin/icons/filetype/thumb/MOVIE.png +0 -0
  366. data/public/images/admin/icons/filetype/thumb/MP2.png +0 -0
  367. data/public/images/admin/icons/filetype/thumb/MP2V.png +0 -0
  368. data/public/images/admin/icons/filetype/thumb/MP3.png +0 -0
  369. data/public/images/admin/icons/filetype/thumb/MP4.png +0 -0
  370. data/public/images/admin/icons/filetype/thumb/MPE.png +0 -0
  371. data/public/images/admin/icons/filetype/thumb/MPEG.png +0 -0
  372. data/public/images/admin/icons/filetype/thumb/MPG.png +0 -0
  373. data/public/images/admin/icons/filetype/thumb/MPV2.png +0 -0
  374. data/public/images/admin/icons/filetype/thumb/NFO.png +0 -0
  375. data/public/images/admin/icons/filetype/thumb/PDD.png +0 -0
  376. data/public/images/admin/icons/filetype/thumb/PDF.png +0 -0
  377. data/public/images/admin/icons/filetype/thumb/PHP.png +0 -0
  378. data/public/images/admin/icons/filetype/thumb/PNG.png +0 -0
  379. data/public/images/admin/icons/filetype/thumb/PPT.png +0 -0
  380. data/public/images/admin/icons/filetype/thumb/PPTX.png +0 -0
  381. data/public/images/admin/icons/filetype/thumb/PSD.png +0 -0
  382. data/public/images/admin/icons/filetype/thumb/RAR.png +0 -0
  383. data/public/images/admin/icons/filetype/thumb/REG.png +0 -0
  384. data/public/images/admin/icons/filetype/thumb/RTF.png +0 -0
  385. data/public/images/admin/icons/filetype/thumb/SCP.png +0 -0
  386. data/public/images/admin/icons/filetype/thumb/THEME.png +0 -0
  387. data/public/images/admin/icons/filetype/thumb/TIF.png +0 -0
  388. data/public/images/admin/icons/filetype/thumb/TIFF.png +0 -0
  389. data/public/images/admin/icons/filetype/thumb/TLB.png +0 -0
  390. data/public/images/admin/icons/filetype/thumb/TTF.png +0 -0
  391. data/public/images/admin/icons/filetype/thumb/TXT.png +0 -0
  392. data/public/images/admin/icons/filetype/thumb/UIS.png +0 -0
  393. data/public/images/admin/icons/filetype/thumb/URL.png +0 -0
  394. data/public/images/admin/icons/filetype/thumb/VBS.png +0 -0
  395. data/public/images/admin/icons/filetype/thumb/VCR.png +0 -0
  396. data/public/images/admin/icons/filetype/thumb/VOB.png +0 -0
  397. data/public/images/admin/icons/filetype/thumb/WAV.png +0 -0
  398. data/public/images/admin/icons/filetype/thumb/WBA.png +0 -0
  399. data/public/images/admin/icons/filetype/thumb/WMA.png +0 -0
  400. data/public/images/admin/icons/filetype/thumb/WMV.png +0 -0
  401. data/public/images/admin/icons/filetype/thumb/WPL.png +0 -0
  402. data/public/images/admin/icons/filetype/thumb/WRI.png +0 -0
  403. data/public/images/admin/icons/filetype/thumb/WTX.png +0 -0
  404. data/public/images/admin/icons/filetype/thumb/XLS.png +0 -0
  405. data/public/images/admin/icons/filetype/thumb/XLSX.png +0 -0
  406. data/public/images/admin/icons/filetype/thumb/XML.png +0 -0
  407. data/public/images/admin/icons/filetype/thumb/XSL.png +0 -0
  408. data/public/images/admin/icons/filetype/thumb/ZAP.png +0 -0
  409. data/public/images/admin/icons/filetype/thumb/ZIP.png +0 -0
  410. data/public/images/admin/icons/filetype/thumb/unknown.png +0 -0
  411. data/public/images/admin/icons/flags/en.png +0 -0
  412. data/public/images/admin/icons/flags/fr.png +0 -0
  413. data/public/images/admin/list/empty.png +0 -0
  414. data/public/images/admin/list/icons/cross.png +0 -0
  415. data/public/images/admin/list/icons/drag.png +0 -0
  416. data/public/images/admin/list/icons/node_closed.png +0 -0
  417. data/public/images/admin/list/icons/node_open.png +0 -0
  418. data/public/images/admin/list/icons/trash.png +0 -0
  419. data/public/images/admin/list/item-left.png +0 -0
  420. data/public/images/admin/list/item-right.png +0 -0
  421. data/public/images/admin/list/item.png +0 -0
  422. data/public/images/admin/list/none.png +0 -0
  423. data/public/images/admin/list/thumb.png +0 -0
  424. data/public/images/admin/login/bottom_panel_bg.png +0 -0
  425. data/public/images/admin/login/buttons/left_bg.png +0 -0
  426. data/public/images/admin/login/buttons/right_bg.png +0 -0
  427. data/public/images/admin/login/content_panel_bg.png +0 -0
  428. data/public/images/admin/login/input_bg.png +0 -0
  429. data/public/images/admin/login/light_bg.png +0 -0
  430. data/public/images/admin/login/top_panel_bg.png +0 -0
  431. data/public/images/admin/login/wrapper_bg.png +0 -0
  432. data/public/images/admin/menu/arrow.png +0 -0
  433. data/public/images/admin/menu/blue-bg.png +0 -0
  434. data/public/images/admin/menu/blue-border.png +0 -0
  435. data/public/images/admin/menu/gray-bg.png +0 -0
  436. data/public/images/admin/menu/gray-border.png +0 -0
  437. data/public/images/admin/menu/green-bg.png +0 -0
  438. data/public/images/admin/menu/green-border.png +0 -0
  439. data/public/images/admin/menu/icons/add.png +0 -0
  440. data/public/images/admin/menu/icons/bullet.png +0 -0
  441. data/public/images/admin/menu/icons/folder.png +0 -0
  442. data/public/images/admin/menu/icons/settings.png +0 -0
  443. data/public/images/admin/menu/left.png +0 -0
  444. data/public/images/admin/menu/popup-body.png +0 -0
  445. data/public/images/admin/menu/popup-footer.png +0 -0
  446. data/public/images/admin/menu/popup-header.png +0 -0
  447. data/public/images/admin/menu/right.png +0 -0
  448. data/public/images/admin/menu/shadow.png +0 -0
  449. data/public/images/admin/menu/top-left.png +0 -0
  450. data/public/images/admin/menu/top.png +0 -0
  451. data/public/images/admin/nocoffee.gif +0 -0
  452. data/public/images/admin/plugins/fancybox/blank.gif +0 -0
  453. data/public/images/admin/plugins/fancybox/fancy_close.png +0 -0
  454. data/public/images/admin/plugins/fancybox/fancy_loading.png +0 -0
  455. data/public/images/admin/plugins/fancybox/fancy_nav_left.png +0 -0
  456. data/public/images/admin/plugins/fancybox/fancy_nav_right.png +0 -0
  457. data/public/images/admin/plugins/fancybox/fancy_shadow_e.png +0 -0
  458. data/public/images/admin/plugins/fancybox/fancy_shadow_n.png +0 -0
  459. data/public/images/admin/plugins/fancybox/fancy_shadow_ne.png +0 -0
  460. data/public/images/admin/plugins/fancybox/fancy_shadow_nw.png +0 -0
  461. data/public/images/admin/plugins/fancybox/fancy_shadow_s.png +0 -0
  462. data/public/images/admin/plugins/fancybox/fancy_shadow_se.png +0 -0
  463. data/public/images/admin/plugins/fancybox/fancy_shadow_sw.png +0 -0
  464. data/public/images/admin/plugins/fancybox/fancy_shadow_w.png +0 -0
  465. data/public/images/admin/plugins/fancybox/fancy_title_left.png +0 -0
  466. data/public/images/admin/plugins/fancybox/fancy_title_main.png +0 -0
  467. data/public/images/admin/plugins/fancybox/fancy_title_over.png +0 -0
  468. data/public/images/admin/plugins/fancybox/fancy_title_right.png +0 -0
  469. data/public/images/admin/plugins/fancybox/fancybox-x.png +0 -0
  470. data/public/images/admin/plugins/fancybox/fancybox-y.png +0 -0
  471. data/public/images/admin/plugins/fancybox/fancybox.png +0 -0
  472. data/public/images/admin/plugins/toggle_handle-bg.png +0 -0
  473. data/public/images/admin/plugins/toggle_handle_left-bg.png +0 -0
  474. data/public/images/admin/plugins/toggle_handle_right-bg.png +0 -0
  475. data/public/images/admin/plugins/toggle_shadow-bg.png +0 -0
  476. data/public/images/admin/rails.png +0 -0
  477. data/public/javascripts/admin/application.js +105 -0
  478. data/public/javascripts/admin/asset_collections.js +50 -0
  479. data/public/javascripts/admin/content_types.js +16 -0
  480. data/public/javascripts/admin/contents.js +17 -0
  481. data/public/javascripts/admin/custom_fields.js +113 -0
  482. data/public/javascripts/admin/jquery.js +154 -0
  483. data/public/javascripts/admin/jquery.ui.js +404 -0
  484. data/public/javascripts/admin/page_parts.js +83 -0
  485. data/public/javascripts/admin/pages.js +67 -0
  486. data/public/javascripts/admin/plugins/codemirror/codemirror.js +469 -0
  487. data/public/javascripts/admin/plugins/codemirror/editor.js +1465 -0
  488. data/public/javascripts/admin/plugins/codemirror/highlight.js +68 -0
  489. data/public/javascripts/admin/plugins/codemirror/mirrorframe.js +81 -0
  490. data/public/javascripts/admin/plugins/codemirror/parsecss.js +155 -0
  491. data/public/javascripts/admin/plugins/codemirror/parsedummy.js +32 -0
  492. data/public/javascripts/admin/plugins/codemirror/parsehtmlmixed.js +74 -0
  493. data/public/javascripts/admin/plugins/codemirror/parsejavascript.js +352 -0
  494. data/public/javascripts/admin/plugins/codemirror/parseliquid.js +409 -0
  495. data/public/javascripts/admin/plugins/codemirror/parsesparql.js +162 -0
  496. data/public/javascripts/admin/plugins/codemirror/parsexml.js +286 -0
  497. data/public/javascripts/admin/plugins/codemirror/select.js +619 -0
  498. data/public/javascripts/admin/plugins/codemirror/stringstream.js +140 -0
  499. data/public/javascripts/admin/plugins/codemirror/tokenize.js +57 -0
  500. data/public/javascripts/admin/plugins/codemirror/tokenizejavascript.js +174 -0
  501. data/public/javascripts/admin/plugins/codemirror/undo.js +410 -0
  502. data/public/javascripts/admin/plugins/codemirror/util.js +130 -0
  503. data/public/javascripts/admin/plugins/cookie.js +96 -0
  504. data/public/javascripts/admin/plugins/fancybox.js +1077 -0
  505. data/public/javascripts/admin/plugins/growl.js +143 -0
  506. data/public/javascripts/admin/plugins/json2.js +478 -0
  507. data/public/javascripts/admin/plugins/plupload/gears_init.js +86 -0
  508. data/public/javascripts/admin/plugins/plupload/jquery.plupload.queue.min.js +1 -0
  509. data/public/javascripts/admin/plugins/plupload/plupload.browserplus.min.js +1 -0
  510. data/public/javascripts/admin/plugins/plupload/plupload.flash.min.js +1 -0
  511. data/public/javascripts/admin/plugins/plupload/plupload.flash.swf +0 -0
  512. data/public/javascripts/admin/plugins/plupload/plupload.full.js +1 -0
  513. data/public/javascripts/admin/plugins/plupload/plupload.gears.min.js +1 -0
  514. data/public/javascripts/admin/plugins/plupload/plupload.html4.min.js +1 -0
  515. data/public/javascripts/admin/plugins/plupload/plupload.html5.min.js +1 -0
  516. data/public/javascripts/admin/plugins/plupload/plupload.js +1 -0
  517. data/public/javascripts/admin/plugins/plupload/plupload.silverlight.min.js +1 -0
  518. data/public/javascripts/admin/plugins/plupload/plupload.silverlight.xap +0 -0
  519. data/public/javascripts/admin/plugins/scrollTo.js +11 -0
  520. data/public/javascripts/admin/plugins/toggle.js +109 -0
  521. data/public/javascripts/admin/plugins/wslide.js +125 -0
  522. data/public/javascripts/admin/rails.js +127 -0
  523. data/public/javascripts/admin/site.js +36 -0
  524. data/public/javascripts/admin/snippets.js +16 -0
  525. data/public/javascripts/admin/theme_assets.js +103 -0
  526. data/public/stylesheets/admin/application.css +257 -0
  527. data/public/stylesheets/admin/blueprint/ie.css +26 -0
  528. data/public/stylesheets/admin/blueprint/plugins/buttons/icons/cross.png +0 -0
  529. data/public/stylesheets/admin/blueprint/plugins/buttons/icons/key.png +0 -0
  530. data/public/stylesheets/admin/blueprint/plugins/buttons/icons/tick.png +0 -0
  531. data/public/stylesheets/admin/blueprint/plugins/buttons/readme.txt +32 -0
  532. data/public/stylesheets/admin/blueprint/plugins/buttons/screen.css +97 -0
  533. data/public/stylesheets/admin/blueprint/plugins/fancy-type/readme.txt +14 -0
  534. data/public/stylesheets/admin/blueprint/plugins/fancy-type/screen.css +71 -0
  535. data/public/stylesheets/admin/blueprint/plugins/link-icons/icons/doc.png +0 -0
  536. data/public/stylesheets/admin/blueprint/plugins/link-icons/icons/email.png +0 -0
  537. data/public/stylesheets/admin/blueprint/plugins/link-icons/icons/external.png +0 -0
  538. data/public/stylesheets/admin/blueprint/plugins/link-icons/icons/feed.png +0 -0
  539. data/public/stylesheets/admin/blueprint/plugins/link-icons/icons/im.png +0 -0
  540. data/public/stylesheets/admin/blueprint/plugins/link-icons/icons/pdf.png +0 -0
  541. data/public/stylesheets/admin/blueprint/plugins/link-icons/icons/visited.png +0 -0
  542. data/public/stylesheets/admin/blueprint/plugins/link-icons/icons/xls.png +0 -0
  543. data/public/stylesheets/admin/blueprint/plugins/link-icons/readme.txt +18 -0
  544. data/public/stylesheets/admin/blueprint/plugins/link-icons/screen.css +40 -0
  545. data/public/stylesheets/admin/blueprint/plugins/rtl/readme.txt +10 -0
  546. data/public/stylesheets/admin/blueprint/plugins/rtl/screen.css +109 -0
  547. data/public/stylesheets/admin/blueprint/print.css +30 -0
  548. data/public/stylesheets/admin/blueprint/screen.css +253 -0
  549. data/public/stylesheets/admin/blueprint/src/forms.css +49 -0
  550. data/public/stylesheets/admin/blueprint/src/grid.css +213 -0
  551. data/public/stylesheets/admin/blueprint/src/grid.png +0 -0
  552. data/public/stylesheets/admin/blueprint/src/ie.css +59 -0
  553. data/public/stylesheets/admin/blueprint/src/print.css +85 -0
  554. data/public/stylesheets/admin/blueprint/src/reset.css +38 -0
  555. data/public/stylesheets/admin/blueprint/src/typography.css +105 -0
  556. data/public/stylesheets/admin/box.css +14 -0
  557. data/public/stylesheets/admin/buttons.css +67 -0
  558. data/public/stylesheets/admin/formtastic.css +137 -0
  559. data/public/stylesheets/admin/formtastic_changes.css +461 -0
  560. data/public/stylesheets/admin/layout.css +175 -0
  561. data/public/stylesheets/admin/login.css +141 -0
  562. data/public/stylesheets/admin/menu.css +241 -0
  563. data/public/stylesheets/admin/page_parts.css +60 -0
  564. data/public/stylesheets/admin/plugins/codemirror/csscolors.css +51 -0
  565. data/public/stylesheets/admin/plugins/codemirror/docs.css +50 -0
  566. data/public/stylesheets/admin/plugins/codemirror/javascriptcolors.css +56 -0
  567. data/public/stylesheets/admin/plugins/codemirror/jscolors.css +59 -0
  568. data/public/stylesheets/admin/plugins/codemirror/liquidcolors.css +35 -0
  569. data/public/stylesheets/admin/plugins/codemirror/people.jpg +0 -0
  570. data/public/stylesheets/admin/plugins/codemirror/sparqlcolors.css +43 -0
  571. data/public/stylesheets/admin/plugins/codemirror/xmlcolors.css +55 -0
  572. data/public/stylesheets/admin/plugins/fancybox.css +363 -0
  573. data/public/stylesheets/admin/plugins/toggle.css +42 -0
  574. data/spec/factories.rb +77 -0
  575. data/spec/lib/locomotive/liquid/filters/html_spec.rb +82 -0
  576. data/spec/lib/locomotive/liquid/filters/misc_spec.rb +36 -0
  577. data/spec/lib/locomotive/liquid/tags/paginate_spec.rb +99 -0
  578. data/spec/lib/locomotive/liquid/tags/snippet_spec.rb +20 -0
  579. data/spec/lib/locomotive/liquid/tags/with_scope_spec.rb +20 -0
  580. data/spec/lib/locomotive/render_spec.rb +85 -0
  581. data/spec/models/account_spec.rb +65 -0
  582. data/spec/models/asset_collections_spec.rb +174 -0
  583. data/spec/models/content_instance_spec.rb +33 -0
  584. data/spec/models/content_type_spec.rb +49 -0
  585. data/spec/models/layout_spec.rb +64 -0
  586. data/spec/models/liquid_template_spec.rb +19 -0
  587. data/spec/models/membership_spec.rb +55 -0
  588. data/spec/models/page_spec.rb +329 -0
  589. data/spec/models/site_spec.rb +143 -0
  590. data/spec/models/snippet_spec.rb +9 -0
  591. data/spec/models/theme_asset_spec.rb +89 -0
  592. data/spec/spec_helper.rb +17 -0
  593. data/spec/support/be_valid.rb +31 -0
  594. data/spec/support/carrierwave.rb +32 -0
  595. data/spec/support/locomotive.rb +41 -0
  596. data/vendor/plugins/custom_fields/MIT-LICENSE +20 -0
  597. data/vendor/plugins/custom_fields/README +13 -0
  598. data/vendor/plugins/custom_fields/Rakefile +23 -0
  599. data/vendor/plugins/custom_fields/init.rb +2 -0
  600. data/vendor/plugins/custom_fields/install.rb +1 -0
  601. data/vendor/plugins/custom_fields/lib/custom_fields.rb +14 -0
  602. data/vendor/plugins/custom_fields/lib/custom_fields/custom_field.rb +84 -0
  603. data/vendor/plugins/custom_fields/lib/custom_fields/custom_fields_for.rb +49 -0
  604. data/vendor/plugins/custom_fields/lib/custom_fields/extensions/mongoid/associations/embeds_many.rb +24 -0
  605. data/vendor/plugins/custom_fields/lib/custom_fields/extensions/mongoid/document.rb +35 -0
  606. data/vendor/plugins/custom_fields/uninstall.rb +1 -0
  607. metadata +848 -0
@@ -0,0 +1,130 @@
1
+ /* A few useful utility functions. */
2
+
3
+ // Capture a method on an object.
4
+ function method(obj, name) {
5
+ return function() {obj[name].apply(obj, arguments);};
6
+ }
7
+
8
+ // The value used to signal the end of a sequence in iterators.
9
+ var StopIteration = {toString: function() {return "StopIteration"}};
10
+
11
+ // Apply a function to each element in a sequence.
12
+ function forEach(iter, f) {
13
+ if (iter.next) {
14
+ try {while (true) f(iter.next());}
15
+ catch (e) {if (e != StopIteration) throw e;}
16
+ }
17
+ else {
18
+ for (var i = 0; i < iter.length; i++)
19
+ f(iter[i]);
20
+ }
21
+ }
22
+
23
+ // Map a function over a sequence, producing an array of results.
24
+ function map(iter, f) {
25
+ var accum = [];
26
+ forEach(iter, function(val) {accum.push(f(val));});
27
+ return accum;
28
+ }
29
+
30
+ // Create a predicate function that tests a string againsts a given
31
+ // regular expression. No longer used but might be used by 3rd party
32
+ // parsers.
33
+ function matcher(regexp){
34
+ return function(value){return regexp.test(value);};
35
+ }
36
+
37
+ // Test whether a DOM node has a certain CSS class. Much faster than
38
+ // the MochiKit equivalent, for some reason.
39
+ function hasClass(element, className){
40
+ var classes = element.className;
41
+ return classes && new RegExp("(^| )" + className + "($| )").test(classes);
42
+ }
43
+
44
+ // Insert a DOM node after another node.
45
+ function insertAfter(newNode, oldNode) {
46
+ var parent = oldNode.parentNode;
47
+ parent.insertBefore(newNode, oldNode.nextSibling);
48
+ return newNode;
49
+ }
50
+
51
+ function removeElement(node) {
52
+ if (node.parentNode)
53
+ node.parentNode.removeChild(node);
54
+ }
55
+
56
+ function clearElement(node) {
57
+ while (node.firstChild)
58
+ node.removeChild(node.firstChild);
59
+ }
60
+
61
+ // Check whether a node is contained in another one.
62
+ function isAncestor(node, child) {
63
+ while (child = child.parentNode) {
64
+ if (node == child)
65
+ return true;
66
+ }
67
+ return false;
68
+ }
69
+
70
+ // The non-breaking space character.
71
+ var nbsp = "\u00a0";
72
+ var matching = {"{": "}", "[": "]", "(": ")",
73
+ "}": "{", "]": "[", ")": "("};
74
+
75
+ // Standardize a few unportable event properties.
76
+ function normalizeEvent(event) {
77
+ if (!event.stopPropagation) {
78
+ event.stopPropagation = function() {this.cancelBubble = true;};
79
+ event.preventDefault = function() {this.returnValue = false;};
80
+ }
81
+ if (!event.stop) {
82
+ event.stop = function() {
83
+ this.stopPropagation();
84
+ this.preventDefault();
85
+ };
86
+ }
87
+
88
+ if (event.type == "keypress") {
89
+ event.code = (event.charCode == null) ? event.keyCode : event.charCode;
90
+ event.character = String.fromCharCode(event.code);
91
+ }
92
+ return event;
93
+ }
94
+
95
+ // Portably register event handlers.
96
+ function addEventHandler(node, type, handler, removeFunc) {
97
+ function wrapHandler(event) {
98
+ handler(normalizeEvent(event || window.event));
99
+ }
100
+ if (typeof node.addEventListener == "function") {
101
+ node.addEventListener(type, wrapHandler, false);
102
+ if (removeFunc) return function() {node.removeEventListener(type, wrapHandler, false);};
103
+ }
104
+ else {
105
+ node.attachEvent("on" + type, wrapHandler);
106
+ if (removeFunc) return function() {node.detachEvent("on" + type, wrapHandler);};
107
+ }
108
+ }
109
+
110
+ function nodeText(node) {
111
+ return node.textContent || node.innerText || node.nodeValue || "";
112
+ }
113
+
114
+ function nodeTop(node) {
115
+ var top = 0;
116
+ while (node.offsetParent) {
117
+ top += node.offsetTop;
118
+ node = node.offsetParent;
119
+ }
120
+ return top;
121
+ }
122
+
123
+ function isBR(node) {
124
+ var nn = node.nodeName;
125
+ return nn == "BR" || nn == "br";
126
+ }
127
+ function isSpan(node) {
128
+ var nn = node.nodeName;
129
+ return nn == "SPAN" || nn == "span";
130
+ }
@@ -0,0 +1,96 @@
1
+ /**
2
+ * Cookie plugin
3
+ *
4
+ * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
5
+ * Dual licensed under the MIT and GPL licenses:
6
+ * http://www.opensource.org/licenses/mit-license.php
7
+ * http://www.gnu.org/licenses/gpl.html
8
+ *
9
+ */
10
+
11
+ /**
12
+ * Create a cookie with the given name and value and other optional parameters.
13
+ *
14
+ * @example $.cookie('the_cookie', 'the_value');
15
+ * @desc Set the value of a cookie.
16
+ * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
17
+ * @desc Create a cookie with all available options.
18
+ * @example $.cookie('the_cookie', 'the_value');
19
+ * @desc Create a session cookie.
20
+ * @example $.cookie('the_cookie', null);
21
+ * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
22
+ * used when the cookie was set.
23
+ *
24
+ * @param String name The name of the cookie.
25
+ * @param String value The value of the cookie.
26
+ * @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
27
+ * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
28
+ * If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
29
+ * If set to null or omitted, the cookie will be a session cookie and will not be retained
30
+ * when the the browser exits.
31
+ * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
32
+ * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
33
+ * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
34
+ * require a secure protocol (like HTTPS).
35
+ * @type undefined
36
+ *
37
+ * @name $.cookie
38
+ * @cat Plugins/Cookie
39
+ * @author Klaus Hartl/klaus.hartl@stilbuero.de
40
+ */
41
+
42
+ /**
43
+ * Get the value of a cookie with the given name.
44
+ *
45
+ * @example $.cookie('the_cookie');
46
+ * @desc Get the value of a cookie.
47
+ *
48
+ * @param String name The name of the cookie.
49
+ * @return The value of the cookie.
50
+ * @type String
51
+ *
52
+ * @name $.cookie
53
+ * @cat Plugins/Cookie
54
+ * @author Klaus Hartl/klaus.hartl@stilbuero.de
55
+ */
56
+ jQuery.cookie = function(name, value, options) {
57
+ if (typeof value != 'undefined') { // name and value given, set cookie
58
+ options = options || {};
59
+ if (value === null) {
60
+ value = '';
61
+ options.expires = -1;
62
+ }
63
+ var expires = '';
64
+ if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
65
+ var date;
66
+ if (typeof options.expires == 'number') {
67
+ date = new Date();
68
+ date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
69
+ } else {
70
+ date = options.expires;
71
+ }
72
+ expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
73
+ }
74
+ // CAUTION: Needed to parenthesize options.path and options.domain
75
+ // in the following expressions, otherwise they evaluate to undefined
76
+ // in the packed version for some reason...
77
+ var path = options.path ? '; path=' + (options.path) : '';
78
+ var domain = options.domain ? '; domain=' + (options.domain) : '';
79
+ var secure = options.secure ? '; secure' : '';
80
+ document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
81
+ } else { // only name given, get cookie
82
+ var cookieValue = null;
83
+ if (document.cookie && document.cookie != '') {
84
+ var cookies = document.cookie.split(';');
85
+ for (var i = 0; i < cookies.length; i++) {
86
+ var cookie = jQuery.trim(cookies[i]);
87
+ // Does this cookie string begin with the name we want?
88
+ if (cookie.substring(0, name.length + 1) == (name + '=')) {
89
+ cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
90
+ break;
91
+ }
92
+ }
93
+ }
94
+ return cookieValue;
95
+ }
96
+ };
@@ -0,0 +1,1077 @@
1
+ /*
2
+ * FancyBox - jQuery Plugin
3
+ * Simple and fancy lightbox alternative
4
+ *
5
+ * Examples and documentation at: http://fancybox.net
6
+ *
7
+ * Copyright (c) 2008 - 2010 Janis Skarnelis
8
+ *
9
+ * Version: 1.3.1 (05/03/2010)
10
+ * Requires: jQuery v1.3+
11
+ *
12
+ * Dual licensed under the MIT and GPL licenses:
13
+ * http://www.opensource.org/licenses/mit-license.php
14
+ * http://www.gnu.org/licenses/gpl.html
15
+ */
16
+
17
+ (function($) {
18
+
19
+ var tmp, loading, overlay, wrap, outer, inner, close, nav_left, nav_right,
20
+
21
+ selectedIndex = 0, selectedOpts = {}, selectedArray = [], currentIndex = 0, currentOpts = {}, currentArray = [],
22
+
23
+ ajaxLoader = null, imgPreloader = new Image(), imgRegExp = /\.(jpg|gif|png|bmp|jpeg)(.*)?$/i, swfRegExp = /[^\.]\.(swf)\s*$/i,
24
+
25
+ loadingTimer, loadingFrame = 1,
26
+
27
+ start_pos, final_pos, busy = false, shadow = 20, fx = $.extend($('<div/>')[0], { prop: 0 }), titleh = 0,
28
+
29
+ isIE6 = !$.support.opacity && !window.XMLHttpRequest,
30
+
31
+ /*
32
+ * Private methods
33
+ */
34
+
35
+ fancybox_abort = function() {
36
+ loading.hide();
37
+
38
+ imgPreloader.onerror = imgPreloader.onload = null;
39
+
40
+ if (ajaxLoader) {
41
+ ajaxLoader.abort();
42
+ }
43
+
44
+ tmp.empty();
45
+ },
46
+
47
+ fancybox_error = function() {
48
+ $.fancybox('<p id="fancybox_error">The requested content cannot be loaded.<br />Please try again later.</p>', {
49
+ 'scrolling' : 'no',
50
+ 'padding' : 20,
51
+ 'transitionIn' : 'none',
52
+ 'transitionOut' : 'none'
53
+ });
54
+ },
55
+
56
+ fancybox_get_viewport = function() {
57
+ return [ $(window).width(), $(window).height(), $(document).scrollLeft(), $(document).scrollTop() ];
58
+ },
59
+
60
+ fancybox_get_zoom_to = function () {
61
+ var view = fancybox_get_viewport(),
62
+ to = {},
63
+
64
+ margin = currentOpts.margin,
65
+ resize = currentOpts.autoScale,
66
+
67
+ horizontal_space = (shadow + margin) * 2,
68
+ vertical_space = (shadow + margin) * 2,
69
+ double_padding = (currentOpts.padding * 2),
70
+
71
+ ratio;
72
+
73
+ if (currentOpts.width.toString().indexOf('%') > -1) {
74
+ to.width = ((view[0] * parseFloat(currentOpts.width)) / 100) - (shadow * 2) ;
75
+ resize = false;
76
+
77
+ } else {
78
+ to.width = currentOpts.width + double_padding;
79
+ }
80
+
81
+ if (currentOpts.height.toString().indexOf('%') > -1) {
82
+ to.height = ((view[1] * parseFloat(currentOpts.height)) / 100) - (shadow * 2);
83
+ resize = false;
84
+
85
+ } else {
86
+ to.height = currentOpts.height + double_padding;
87
+ }
88
+
89
+ if (resize && (to.width > (view[0] - horizontal_space) || to.height > (view[1] - vertical_space))) {
90
+ if (selectedOpts.type == 'image' || selectedOpts.type == 'swf') {
91
+ horizontal_space += double_padding;
92
+ vertical_space += double_padding;
93
+
94
+ ratio = Math.min(Math.min( view[0] - horizontal_space, currentOpts.width) / currentOpts.width, Math.min( view[1] - vertical_space, currentOpts.height) / currentOpts.height);
95
+
96
+ to.width = Math.round(ratio * (to.width - double_padding)) + double_padding;
97
+ to.height = Math.round(ratio * (to.height - double_padding)) + double_padding;
98
+
99
+ } else {
100
+ to.width = Math.min(to.width, (view[0] - horizontal_space));
101
+ to.height = Math.min(to.height, (view[1] - vertical_space));
102
+ }
103
+ }
104
+
105
+ to.top = view[3] + ((view[1] - (to.height + (shadow * 2 ))) * 0.5);
106
+ to.left = view[2] + ((view[0] - (to.width + (shadow * 2 ))) * 0.5);
107
+
108
+ if (currentOpts.autoScale === false) {
109
+ to.top = Math.max(view[3] + margin, to.top);
110
+ to.left = Math.max(view[2] + margin, to.left);
111
+ }
112
+
113
+ return to;
114
+ },
115
+
116
+ fancybox_format_title = function(title) {
117
+ if (title && title.length) {
118
+ switch (currentOpts.titlePosition) {
119
+ case 'inside':
120
+ return title;
121
+ case 'over':
122
+ return '<span id="fancybox-title-over">' + title + '</span>';
123
+ default:
124
+ return '<span id="fancybox-title-wrap"><span id="fancybox-title-left"></span><span id="fancybox-title-main">' + title + '</span><span id="fancybox-title-right"></span></span>';
125
+ }
126
+ }
127
+
128
+ return false;
129
+ },
130
+
131
+ fancybox_process_title = function() {
132
+ var title = currentOpts.title,
133
+ width = final_pos.width - (currentOpts.padding * 2),
134
+ titlec = 'fancybox-title-' + currentOpts.titlePosition;
135
+
136
+ $('#fancybox-title').remove();
137
+
138
+ titleh = 0;
139
+
140
+ if (currentOpts.titleShow === false) {
141
+ return;
142
+ }
143
+
144
+ title = $.isFunction(currentOpts.titleFormat) ? currentOpts.titleFormat(title, currentArray, currentIndex, currentOpts) : fancybox_format_title(title);
145
+
146
+ if (!title || title === '') {
147
+ return;
148
+ }
149
+
150
+ $('<div id="fancybox-title" class="' + titlec + '" />').css({
151
+ 'width' : width,
152
+ 'paddingLeft' : currentOpts.padding,
153
+ 'paddingRight' : currentOpts.padding
154
+ }).html(title).appendTo('body');
155
+
156
+ switch (currentOpts.titlePosition) {
157
+ case 'inside':
158
+ titleh = $("#fancybox-title").outerHeight(true) - currentOpts.padding;
159
+ final_pos.height += titleh;
160
+ break;
161
+
162
+ case 'over':
163
+ $('#fancybox-title').css('bottom', currentOpts.padding);
164
+ break;
165
+
166
+ default:
167
+ $('#fancybox-title').css('bottom', $("#fancybox-title").outerHeight(true) * -1);
168
+ break;
169
+ }
170
+
171
+ $('#fancybox-title').appendTo( outer ).hide();
172
+ },
173
+
174
+ fancybox_set_navigation = function() {
175
+ $(document).unbind('keydown.fb').bind('keydown.fb', function(e) {
176
+ if (e.keyCode == 27 && currentOpts.enableEscapeButton) {
177
+ e.preventDefault();
178
+ $.fancybox.close();
179
+
180
+ } else if (e.keyCode == 37) {
181
+ e.preventDefault();
182
+ $.fancybox.prev();
183
+
184
+ } else if (e.keyCode == 39) {
185
+ e.preventDefault();
186
+ $.fancybox.next();
187
+ }
188
+ });
189
+
190
+ if ($.fn.mousewheel) {
191
+ wrap.unbind('mousewheel.fb');
192
+
193
+ if (currentArray.length > 1) {
194
+ wrap.bind('mousewheel.fb', function(e, delta) {
195
+ e.preventDefault();
196
+
197
+ if (busy || delta === 0) {
198
+ return;
199
+ }
200
+
201
+ if (delta > 0) {
202
+ $.fancybox.prev();
203
+ } else {
204
+ $.fancybox.next();
205
+ }
206
+ });
207
+ }
208
+ }
209
+
210
+ if (!currentOpts.showNavArrows) { return; }
211
+
212
+ if ((currentOpts.cyclic && currentArray.length > 1) || currentIndex !== 0) {
213
+ nav_left.show();
214
+ }
215
+
216
+ if ((currentOpts.cyclic && currentArray.length > 1) || currentIndex != (currentArray.length -1)) {
217
+ nav_right.show();
218
+ }
219
+ },
220
+
221
+ fancybox_preload_images = function() {
222
+ var href,
223
+ objNext;
224
+
225
+ if ((currentArray.length -1) > currentIndex) {
226
+ href = currentArray[ currentIndex + 1 ].href;
227
+
228
+ if (typeof href !== 'undefined' && href.match(imgRegExp)) {
229
+ objNext = new Image();
230
+ objNext.src = href;
231
+ }
232
+ }
233
+
234
+ if (currentIndex > 0) {
235
+ href = currentArray[ currentIndex - 1 ].href;
236
+
237
+ if (typeof href !== 'undefined' && href.match(imgRegExp)) {
238
+ objNext = new Image();
239
+ objNext.src = href;
240
+ }
241
+ }
242
+ },
243
+
244
+ _finish = function () {
245
+ inner.css('overflow', (currentOpts.scrolling == 'auto' ? (currentOpts.type == 'image' || currentOpts.type == 'iframe' || currentOpts.type == 'swf' ? 'hidden' : 'auto') : (currentOpts.scrolling == 'yes' ? 'auto' : 'visible')));
246
+
247
+ if (!$.support.opacity) {
248
+ inner.get(0).style.removeAttribute('filter');
249
+ wrap.get(0).style.removeAttribute('filter');
250
+ }
251
+
252
+ $('#fancybox-title').show();
253
+
254
+ if (currentOpts.hideOnContentClick) {
255
+ inner.one('click', $.fancybox.close);
256
+ }
257
+ if (currentOpts.hideOnOverlayClick) {
258
+ overlay.one('click', $.fancybox.close);
259
+ }
260
+
261
+ if (currentOpts.showCloseButton) {
262
+ close.show();
263
+ }
264
+
265
+ fancybox_set_navigation();
266
+
267
+ $(window).bind("resize.fb", $.fancybox.center);
268
+
269
+ if (currentOpts.centerOnScroll) {
270
+ $(window).bind("scroll.fb", $.fancybox.center);
271
+ } else {
272
+ $(window).unbind("scroll.fb");
273
+ }
274
+
275
+ if ($.isFunction(currentOpts.onComplete)) {
276
+ currentOpts.onComplete(currentArray, currentIndex, currentOpts);
277
+ }
278
+
279
+ busy = false;
280
+
281
+ fancybox_preload_images();
282
+ },
283
+
284
+ fancybox_draw = function(pos) {
285
+ var width = Math.round(start_pos.width + (final_pos.width - start_pos.width) * pos),
286
+ height = Math.round(start_pos.height + (final_pos.height - start_pos.height) * pos),
287
+
288
+ top = Math.round(start_pos.top + (final_pos.top - start_pos.top) * pos),
289
+ left = Math.round(start_pos.left + (final_pos.left - start_pos.left) * pos);
290
+
291
+ wrap.css({
292
+ 'width' : width + 'px',
293
+ 'height' : height + 'px',
294
+ 'top' : top + 'px',
295
+ 'left' : left + 'px'
296
+ });
297
+
298
+ width = Math.max(width - currentOpts.padding * 2, 0);
299
+ height = Math.max(height - (currentOpts.padding * 2 + (titleh * pos)), 0);
300
+
301
+ inner.css({
302
+ 'width' : width + 'px',
303
+ 'height' : height + 'px'
304
+ });
305
+
306
+ if (typeof final_pos.opacity !== 'undefined') {
307
+ wrap.css('opacity', (pos < 0.5 ? 0.5 : pos));
308
+ }
309
+ },
310
+
311
+ fancybox_get_obj_pos = function(obj) {
312
+ var pos = obj.offset();
313
+
314
+ pos.top += parseFloat( obj.css('paddingTop') ) || 0;
315
+ pos.left += parseFloat( obj.css('paddingLeft') ) || 0;
316
+
317
+ pos.top += parseFloat( obj.css('border-top-width') ) || 0;
318
+ pos.left += parseFloat( obj.css('border-left-width') ) || 0;
319
+
320
+ pos.width = obj.width();
321
+ pos.height = obj.height();
322
+
323
+ return pos;
324
+ },
325
+
326
+ fancybox_get_zoom_from = function() {
327
+ var orig = selectedOpts.orig ? $(selectedOpts.orig) : false,
328
+ from = {},
329
+ pos,
330
+ view;
331
+
332
+ if (orig && orig.length) {
333
+ pos = fancybox_get_obj_pos(orig);
334
+
335
+ from = {
336
+ width : (pos.width + (currentOpts.padding * 2)),
337
+ height : (pos.height + (currentOpts.padding * 2)),
338
+ top : (pos.top - currentOpts.padding - shadow),
339
+ left : (pos.left - currentOpts.padding - shadow)
340
+ };
341
+
342
+ } else {
343
+ view = fancybox_get_viewport();
344
+
345
+ from = {
346
+ width : 1,
347
+ height : 1,
348
+ top : view[3] + view[1] * 0.5,
349
+ left : view[2] + view[0] * 0.5
350
+ };
351
+ }
352
+
353
+ return from;
354
+ },
355
+
356
+ fancybox_show = function() {
357
+ loading.hide();
358
+
359
+ if (wrap.is(":visible") && $.isFunction(currentOpts.onCleanup)) {
360
+ if (currentOpts.onCleanup(currentArray, currentIndex, currentOpts) === false) {
361
+ $.event.trigger('fancybox-cancel');
362
+
363
+ busy = false;
364
+ return;
365
+ }
366
+ }
367
+
368
+ currentArray = selectedArray;
369
+ currentIndex = selectedIndex;
370
+ currentOpts = selectedOpts;
371
+
372
+ inner.get(0).scrollTop = 0;
373
+ inner.get(0).scrollLeft = 0;
374
+
375
+ if (currentOpts.overlayShow) {
376
+ if (isIE6) {
377
+ $('select:not(#fancybox-tmp select)').filter(function() {
378
+ return this.style.visibility !== 'hidden';
379
+ }).css({'visibility':'hidden'}).one('fancybox-cleanup', function() {
380
+ this.style.visibility = 'inherit';
381
+ });
382
+ }
383
+
384
+ overlay.css({
385
+ 'background-color' : currentOpts.overlayColor,
386
+ 'opacity' : currentOpts.overlayOpacity
387
+ }).unbind().show();
388
+ }
389
+
390
+ final_pos = fancybox_get_zoom_to();
391
+
392
+ fancybox_process_title();
393
+
394
+ if (wrap.is(":visible")) {
395
+ $( close.add( nav_left ).add( nav_right ) ).hide();
396
+
397
+ var pos = wrap.position(),
398
+ equal;
399
+
400
+ start_pos = {
401
+ top : pos.top ,
402
+ left : pos.left,
403
+ width : wrap.width(),
404
+ height : wrap.height()
405
+ };
406
+
407
+ equal = (start_pos.width == final_pos.width && start_pos.height == final_pos.height);
408
+
409
+ inner.fadeOut(currentOpts.changeFade, function() {
410
+ var finish_resizing = function() {
411
+ inner.html( tmp.contents() ).fadeIn(currentOpts.changeFade, _finish);
412
+ };
413
+
414
+ $.event.trigger('fancybox-change');
415
+
416
+ inner.empty().css('overflow', 'hidden');
417
+
418
+ if (equal) {
419
+ inner.css({
420
+ top : currentOpts.padding,
421
+ left : currentOpts.padding,
422
+ width : Math.max(final_pos.width - (currentOpts.padding * 2), 1),
423
+ height : Math.max(final_pos.height - (currentOpts.padding * 2) - titleh, 1)
424
+ });
425
+
426
+ finish_resizing();
427
+
428
+ } else {
429
+ inner.css({
430
+ top : currentOpts.padding,
431
+ left : currentOpts.padding,
432
+ width : Math.max(start_pos.width - (currentOpts.padding * 2), 1),
433
+ height : Math.max(start_pos.height - (currentOpts.padding * 2), 1)
434
+ });
435
+
436
+ fx.prop = 0;
437
+
438
+ $(fx).animate({ prop: 1 }, {
439
+ duration : currentOpts.changeSpeed,
440
+ easing : currentOpts.easingChange,
441
+ step : fancybox_draw,
442
+ complete : finish_resizing
443
+ });
444
+ }
445
+ });
446
+
447
+ return;
448
+ }
449
+
450
+ wrap.css('opacity', 1);
451
+
452
+ if (currentOpts.transitionIn == 'elastic') {
453
+ start_pos = fancybox_get_zoom_from();
454
+
455
+ inner.css({
456
+ top : currentOpts.padding,
457
+ left : currentOpts.padding,
458
+ width : Math.max(start_pos.width - (currentOpts.padding * 2), 1),
459
+ height : Math.max(start_pos.height - (currentOpts.padding * 2), 1)
460
+ })
461
+ .html( tmp.contents() );
462
+
463
+ wrap.css(start_pos).show();
464
+
465
+ if (currentOpts.opacity) {
466
+ final_pos.opacity = 0;
467
+ }
468
+
469
+ fx.prop = 0;
470
+
471
+ $(fx).animate({ prop: 1 }, {
472
+ duration : currentOpts.speedIn,
473
+ easing : currentOpts.easingIn,
474
+ step : fancybox_draw,
475
+ complete : _finish
476
+ });
477
+
478
+ } else {
479
+ inner.css({
480
+ top : currentOpts.padding,
481
+ left : currentOpts.padding,
482
+ width : Math.max(final_pos.width - (currentOpts.padding * 2), 1),
483
+ height : Math.max(final_pos.height - (currentOpts.padding * 2) - titleh, 1)
484
+ })
485
+ .html( tmp.contents() );
486
+
487
+ wrap.css( final_pos ).fadeIn( currentOpts.transitionIn == 'none' ? 0 : currentOpts.speedIn, _finish );
488
+ }
489
+ },
490
+
491
+ fancybox_process_inline = function() {
492
+ tmp.width( selectedOpts.width );
493
+ tmp.height( selectedOpts.height );
494
+
495
+ if (selectedOpts.width == 'auto') {
496
+ selectedOpts.width = tmp.width();
497
+ }
498
+ if (selectedOpts.height == 'auto') {
499
+ selectedOpts.height = tmp.height();
500
+ }
501
+
502
+ fancybox_show();
503
+ },
504
+
505
+ fancybox_process_image = function() {
506
+ busy = true;
507
+
508
+ selectedOpts.width = imgPreloader.width;
509
+ selectedOpts.height = imgPreloader.height;
510
+
511
+ $("<img />").attr({
512
+ 'id' : 'fancybox-img',
513
+ 'src' : imgPreloader.src,
514
+ 'alt' : selectedOpts.title
515
+ }).appendTo( tmp );
516
+
517
+ fancybox_show();
518
+ },
519
+
520
+ fancybox_start = function() {
521
+ fancybox_abort();
522
+
523
+ var obj = selectedArray[ selectedIndex ],
524
+ href,
525
+ type,
526
+ title,
527
+ str,
528
+ emb,
529
+ selector,
530
+ data;
531
+
532
+ selectedOpts = $.extend({}, $.fn.fancybox.defaults, (typeof $(obj).data('fancybox') == 'undefined' ? selectedOpts : $(obj).data('fancybox')));
533
+ title = obj.title || $(obj).title || selectedOpts.title || '';
534
+
535
+ if (obj.nodeName && !selectedOpts.orig) {
536
+ selectedOpts.orig = $(obj).children("img:first").length ? $(obj).children("img:first") : $(obj);
537
+ }
538
+
539
+ if (title === '' && selectedOpts.orig) {
540
+ title = selectedOpts.orig.attr('alt');
541
+ }
542
+
543
+ if (obj.nodeName && (/^(?:javascript|#)/i).test(obj.href)) {
544
+ href = selectedOpts.href || null;
545
+ } else {
546
+ href = selectedOpts.href || obj.href || null;
547
+ }
548
+
549
+ if (selectedOpts.type) {
550
+ type = selectedOpts.type;
551
+
552
+ if (!href) {
553
+ href = selectedOpts.content;
554
+ }
555
+
556
+ } else if (selectedOpts.content) {
557
+ type = 'html';
558
+
559
+ } else if (href) {
560
+ if (href.match(imgRegExp)) {
561
+ type = 'image';
562
+
563
+ } else if (href.match(swfRegExp)) {
564
+ type = 'swf';
565
+
566
+ } else if ($(obj).hasClass("iframe")) {
567
+ type = 'iframe';
568
+
569
+ } else if (href.match(/#/)) {
570
+ obj = href.substr(href.indexOf("#"));
571
+
572
+ type = $(obj).length > 0 ? 'inline' : 'ajax';
573
+ } else {
574
+ type = 'ajax';
575
+ }
576
+ } else {
577
+ type = 'inline';
578
+ }
579
+
580
+ selectedOpts.type = type;
581
+ selectedOpts.href = href;
582
+ selectedOpts.title = title;
583
+
584
+ if (selectedOpts.autoDimensions && selectedOpts.type !== 'iframe' && selectedOpts.type !== 'swf') {
585
+ selectedOpts.width = 'auto';
586
+ selectedOpts.height = 'auto';
587
+ }
588
+
589
+ if (selectedOpts.modal) {
590
+ selectedOpts.overlayShow = true;
591
+ selectedOpts.hideOnOverlayClick = false;
592
+ selectedOpts.hideOnContentClick = false;
593
+ selectedOpts.enableEscapeButton = false;
594
+ selectedOpts.showCloseButton = false;
595
+ }
596
+
597
+ if ($.isFunction(selectedOpts.onStart)) {
598
+ if (selectedOpts.onStart(selectedArray, selectedIndex, selectedOpts) === false) {
599
+ busy = false;
600
+ return;
601
+ }
602
+ }
603
+
604
+ tmp.css('padding', (shadow + selectedOpts.padding + selectedOpts.margin));
605
+
606
+ $('.fancybox-inline-tmp').unbind('fancybox-cancel').bind('fancybox-change', function() {
607
+ $(this).replaceWith(inner.children());
608
+ });
609
+
610
+ switch (type) {
611
+ case 'html' :
612
+ tmp.html( selectedOpts.content );
613
+ fancybox_process_inline();
614
+ break;
615
+
616
+ case 'inline' :
617
+ $('<div class="fancybox-inline-tmp" />').hide().insertBefore( $(obj) ).bind('fancybox-cleanup', function() {
618
+ $(this).replaceWith(inner.children());
619
+ }).bind('fancybox-cancel', function() {
620
+ $(this).replaceWith(tmp.children());
621
+ });
622
+
623
+ $(obj).appendTo(tmp);
624
+
625
+ fancybox_process_inline();
626
+ break;
627
+
628
+ case 'image':
629
+ busy = false;
630
+
631
+ $.fancybox.showActivity();
632
+
633
+ imgPreloader = new Image();
634
+
635
+ imgPreloader.onerror = function() {
636
+ fancybox_error();
637
+ };
638
+
639
+ imgPreloader.onload = function() {
640
+ imgPreloader.onerror = null;
641
+ imgPreloader.onload = null;
642
+ fancybox_process_image();
643
+ };
644
+
645
+ imgPreloader.src = href;
646
+
647
+ break;
648
+
649
+ case 'swf':
650
+ str = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + selectedOpts.width + '" height="' + selectedOpts.height + '"><param name="movie" value="' + href + '"></param>';
651
+ emb = '';
652
+
653
+ $.each(selectedOpts.swf, function(name, val) {
654
+ str += '<param name="' + name + '" value="' + val + '"></param>';
655
+ emb += ' ' + name + '="' + val + '"';
656
+ });
657
+
658
+ str += '<embed src="' + href + '" type="application/x-shockwave-flash" width="' + selectedOpts.width + '" height="' + selectedOpts.height + '"' + emb + '></embed></object>';
659
+
660
+ tmp.html(str);
661
+
662
+ fancybox_process_inline();
663
+ break;
664
+
665
+ case 'ajax':
666
+ selector = href.split('#', 2);
667
+ data = selectedOpts.ajax.data || {};
668
+
669
+ if (selector.length > 1) {
670
+ href = selector[0];
671
+
672
+ if (typeof data == "string") {
673
+ data += '&selector=' + selector[1];
674
+ } else {
675
+ data.selector = selector[1];
676
+ }
677
+ }
678
+
679
+ busy = false;
680
+ $.fancybox.showActivity();
681
+
682
+ ajaxLoader = $.ajax($.extend(selectedOpts.ajax, {
683
+ url : href,
684
+ data : data,
685
+ error : fancybox_error,
686
+ success : function(data, textStatus, XMLHttpRequest) {
687
+ if (ajaxLoader.status == 200) {
688
+ tmp.html( data );
689
+ fancybox_process_inline();
690
+ }
691
+ }
692
+ }));
693
+
694
+ break;
695
+
696
+ case 'iframe' :
697
+ $('<iframe id="fancybox-frame" name="fancybox-frame' + new Date().getTime() + '" frameborder="0" hspace="0" scrolling="' + selectedOpts.scrolling + '" src="' + selectedOpts.href + '"></iframe>').appendTo(tmp);
698
+ fancybox_show();
699
+ break;
700
+ }
701
+ },
702
+
703
+ fancybox_animate_loading = function() {
704
+ if (!loading.is(':visible')){
705
+ clearInterval(loadingTimer);
706
+ return;
707
+ }
708
+
709
+ $('div', loading).css('top', (loadingFrame * -40) + 'px');
710
+
711
+ loadingFrame = (loadingFrame + 1) % 12;
712
+ },
713
+
714
+ fancybox_init = function() {
715
+ if ($("#fancybox-wrap").length) {
716
+ return;
717
+ }
718
+
719
+ $('body').append(
720
+ tmp = $('<div id="fancybox-tmp"></div>'),
721
+ loading = $('<div id="fancybox-loading"><div></div></div>'),
722
+ overlay = $('<div id="fancybox-overlay"></div>'),
723
+ wrap = $('<div id="fancybox-wrap"></div>')
724
+ );
725
+
726
+ if (!$.support.opacity) {
727
+ wrap.addClass('fancybox-ie');
728
+ loading.addClass('fancybox-ie');
729
+ }
730
+
731
+ outer = $('<div id="fancybox-outer"></div>')
732
+ .append('<div class="fancy-bg" id="fancy-bg-n"></div><div class="fancy-bg" id="fancy-bg-ne"></div><div class="fancy-bg" id="fancy-bg-e"></div><div class="fancy-bg" id="fancy-bg-se"></div><div class="fancy-bg" id="fancy-bg-s"></div><div class="fancy-bg" id="fancy-bg-sw"></div><div class="fancy-bg" id="fancy-bg-w"></div><div class="fancy-bg" id="fancy-bg-nw"></div>')
733
+ .appendTo( wrap );
734
+
735
+ outer.append(
736
+ inner = $('<div id="fancybox-inner"></div>'),
737
+ close = $('<a id="fancybox-close"></a>'),
738
+
739
+ nav_left = $('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),
740
+ nav_right = $('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>')
741
+ );
742
+
743
+ close.click($.fancybox.close);
744
+ loading.click($.fancybox.cancel);
745
+
746
+ nav_left.click(function(e) {
747
+ e.preventDefault();
748
+ $.fancybox.prev();
749
+ });
750
+
751
+ nav_right.click(function(e) {
752
+ e.preventDefault();
753
+ $.fancybox.next();
754
+ });
755
+
756
+ if (isIE6) {
757
+ overlay.get(0).style.setExpression('height', "document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px'");
758
+ loading.get(0).style.setExpression('top', "(-20 + (document.documentElement.clientHeight ? document.documentElement.clientHeight/2 : document.body.clientHeight/2 ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop )) + 'px'");
759
+
760
+ outer.prepend('<iframe id="fancybox-hide-sel-frame" src="javascript:\'\';" scrolling="no" frameborder="0" ></iframe>');
761
+ }
762
+ };
763
+
764
+ /*
765
+ * Public methods
766
+ */
767
+
768
+ $.fn.fancybox = function(options) {
769
+ $(this)
770
+ .data('fancybox', $.extend({}, options, ($.metadata ? $(this).metadata() : {})))
771
+ .unbind('click.fb').bind('click.fb', function(e) {
772
+ e.preventDefault();
773
+
774
+ if (busy) {
775
+ return;
776
+ }
777
+
778
+ busy = true;
779
+
780
+ $(this).blur();
781
+
782
+ selectedArray = [];
783
+ selectedIndex = 0;
784
+
785
+ var rel = $(this).attr('rel') || '';
786
+
787
+ if (!rel || rel == '' || rel === 'nofollow') {
788
+ selectedArray.push(this);
789
+
790
+ } else {
791
+ selectedArray = $("a[rel=" + rel + "], area[rel=" + rel + "]");
792
+ selectedIndex = selectedArray.index( this );
793
+ }
794
+
795
+ fancybox_start();
796
+
797
+ return false;
798
+ });
799
+
800
+ return this;
801
+ };
802
+
803
+ $.fancybox = function(obj) {
804
+ if (busy) {
805
+ return;
806
+ }
807
+
808
+ busy = true;
809
+
810
+ var opts = typeof arguments[1] !== 'undefined' ? arguments[1] : {};
811
+
812
+ selectedArray = [];
813
+ selectedIndex = opts.index || 0;
814
+
815
+ if ($.isArray(obj)) {
816
+ for (var i = 0, j = obj.length; i < j; i++) {
817
+ if (typeof obj[i] == 'object') {
818
+ $(obj[i]).data('fancybox', $.extend({}, opts, obj[i]));
819
+ } else {
820
+ obj[i] = $({}).data('fancybox', $.extend({content : obj[i]}, opts));
821
+ }
822
+ }
823
+
824
+ selectedArray = jQuery.merge(selectedArray, obj);
825
+
826
+ } else {
827
+ if (typeof obj == 'object') {
828
+ $(obj).data('fancybox', $.extend({}, opts, obj));
829
+ } else {
830
+ obj = $({}).data('fancybox', $.extend({content : obj}, opts));
831
+ }
832
+
833
+ selectedArray.push(obj);
834
+ }
835
+
836
+ if (selectedIndex > selectedArray.length || selectedIndex < 0) {
837
+ selectedIndex = 0;
838
+ }
839
+
840
+ fancybox_start();
841
+ };
842
+
843
+ $.fancybox.showActivity = function() {
844
+ clearInterval(loadingTimer);
845
+
846
+ loading.show();
847
+ loadingTimer = setInterval(fancybox_animate_loading, 66);
848
+ };
849
+
850
+ $.fancybox.hideActivity = function() {
851
+ loading.hide();
852
+ };
853
+
854
+ $.fancybox.next = function() {
855
+ return $.fancybox.pos( currentIndex + 1);
856
+ };
857
+
858
+ $.fancybox.prev = function() {
859
+ return $.fancybox.pos( currentIndex - 1);
860
+ };
861
+
862
+ $.fancybox.pos = function(pos) {
863
+ if (busy) {
864
+ return;
865
+ }
866
+
867
+ pos = parseInt(pos, 10);
868
+
869
+ if (pos > -1 && currentArray.length > pos) {
870
+ selectedIndex = pos;
871
+ fancybox_start();
872
+ }
873
+
874
+ if (currentOpts.cyclic && currentArray.length > 1 && pos < 0) {
875
+ selectedIndex = currentArray.length - 1;
876
+ fancybox_start();
877
+ }
878
+
879
+ if (currentOpts.cyclic && currentArray.length > 1 && pos >= currentArray.length) {
880
+ selectedIndex = 0;
881
+ fancybox_start();
882
+ }
883
+
884
+ return;
885
+ };
886
+
887
+ $.fancybox.cancel = function() {
888
+ if (busy) {
889
+ return;
890
+ }
891
+
892
+ busy = true;
893
+
894
+ $.event.trigger('fancybox-cancel');
895
+
896
+ fancybox_abort();
897
+
898
+ if (selectedOpts && $.isFunction(selectedOpts.onCancel)) {
899
+ selectedOpts.onCancel(selectedArray, selectedIndex, selectedOpts);
900
+ }
901
+
902
+ busy = false;
903
+ };
904
+
905
+ // Note: within an iframe use - parent.$.fancybox.close();
906
+ $.fancybox.close = function() {
907
+ if (busy || wrap.is(':hidden')) {
908
+ return;
909
+ }
910
+
911
+ busy = true;
912
+
913
+ if (currentOpts && $.isFunction(currentOpts.onCleanup)) {
914
+ if (currentOpts.onCleanup(currentArray, currentIndex, currentOpts) === false) {
915
+ busy = false;
916
+ return;
917
+ }
918
+ }
919
+
920
+ fancybox_abort();
921
+
922
+ $(close.add( nav_left ).add( nav_right )).hide();
923
+
924
+ $('#fancybox-title').remove();
925
+
926
+ wrap.add(inner).add(overlay).unbind();
927
+
928
+ $(window).unbind("resize.fb scroll.fb");
929
+ $(document).unbind('keydown.fb');
930
+
931
+ function _cleanup() {
932
+ overlay.fadeOut('fast');
933
+
934
+ wrap.hide();
935
+
936
+ $.event.trigger('fancybox-cleanup');
937
+
938
+ inner.empty();
939
+
940
+ if ($.isFunction(currentOpts.onClosed)) {
941
+ currentOpts.onClosed(currentArray, currentIndex, currentOpts);
942
+ }
943
+
944
+ currentArray = selectedOpts = [];
945
+ currentIndex = selectedIndex = 0;
946
+ currentOpts = selectedOpts = {};
947
+
948
+ busy = false;
949
+ }
950
+
951
+ inner.css('overflow', 'hidden');
952
+
953
+ if (currentOpts.transitionOut == 'elastic') {
954
+ start_pos = fancybox_get_zoom_from();
955
+
956
+ var pos = wrap.position();
957
+
958
+ final_pos = {
959
+ top : pos.top ,
960
+ left : pos.left,
961
+ width : wrap.width(),
962
+ height : wrap.height()
963
+ };
964
+
965
+ if (currentOpts.opacity) {
966
+ final_pos.opacity = 1;
967
+ }
968
+
969
+ fx.prop = 1;
970
+
971
+ $(fx).animate({ prop: 0 }, {
972
+ duration : currentOpts.speedOut,
973
+ easing : currentOpts.easingOut,
974
+ step : fancybox_draw,
975
+ complete : _cleanup
976
+ });
977
+
978
+ } else {
979
+ wrap.fadeOut( currentOpts.transitionOut == 'none' ? 0 : currentOpts.speedOut, _cleanup);
980
+ }
981
+ };
982
+
983
+ $.fancybox.resize = function() {
984
+ var c, h;
985
+
986
+ if (busy || wrap.is(':hidden')) {
987
+ return;
988
+ }
989
+
990
+ busy = true;
991
+
992
+ c = inner.wrapInner("<div style='overflow:auto'></div>").children();
993
+ h = c.height();
994
+
995
+ wrap.css({height: h + (currentOpts.padding * 2) + titleh});
996
+ inner.css({height: h});
997
+
998
+ c.replaceWith(c.children());
999
+
1000
+ $.fancybox.center();
1001
+ };
1002
+
1003
+ $.fancybox.center = function() {
1004
+ busy = true;
1005
+
1006
+ var view = fancybox_get_viewport(),
1007
+ margin = currentOpts.margin,
1008
+ to = {};
1009
+
1010
+ to.top = view[3] + ((view[1] - ((wrap.height() - titleh) + (shadow * 2 ))) * 0.5);
1011
+ to.left = view[2] + ((view[0] - (wrap.width() + (shadow * 2 ))) * 0.5);
1012
+
1013
+ to.top = Math.max(view[3] + margin, to.top);
1014
+ to.left = Math.max(view[2] + margin, to.left);
1015
+
1016
+ wrap.css(to);
1017
+
1018
+ busy = false;
1019
+ };
1020
+
1021
+ $.fn.fancybox.defaults = {
1022
+ padding : 10,
1023
+ margin : 20,
1024
+ opacity : false,
1025
+ modal : false,
1026
+ cyclic : false,
1027
+ scrolling : 'auto', // 'auto', 'yes' or 'no'
1028
+
1029
+ width : 560,
1030
+ height : 340,
1031
+
1032
+ autoScale : true,
1033
+ autoDimensions : true,
1034
+ centerOnScroll : false,
1035
+
1036
+ ajax : {},
1037
+ swf : { wmode: 'transparent' },
1038
+
1039
+ hideOnOverlayClick : true,
1040
+ hideOnContentClick : false,
1041
+
1042
+ overlayShow : true,
1043
+ overlayOpacity : 0.3,
1044
+ overlayColor : '#666',
1045
+
1046
+ titleShow : true,
1047
+ titlePosition : 'outside', // 'outside', 'inside' or 'over'
1048
+ titleFormat : null,
1049
+
1050
+ transitionIn : 'fade', // 'elastic', 'fade' or 'none'
1051
+ transitionOut : 'fade', // 'elastic', 'fade' or 'none'
1052
+
1053
+ speedIn : 300,
1054
+ speedOut : 300,
1055
+
1056
+ changeSpeed : 300,
1057
+ changeFade : 'fast',
1058
+
1059
+ easingIn : 'swing',
1060
+ easingOut : 'swing',
1061
+
1062
+ showCloseButton : true,
1063
+ showNavArrows : true,
1064
+ enableEscapeButton : true,
1065
+
1066
+ onStart : null,
1067
+ onCancel : null,
1068
+ onComplete : null,
1069
+ onCleanup : null,
1070
+ onClosed : null
1071
+ };
1072
+
1073
+ $(document).ready(function() {
1074
+ fancybox_init();
1075
+ });
1076
+
1077
+ })(jQuery);