mail_engine 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (313) hide show
  1. data/.yardoc/checksums +17 -0
  2. data/.yardoc/objects/ActionMailer/Base/collect_responses_and_parts_order_i.dat +0 -0
  3. data/.yardoc/objects/ActionMailer/Base/mail_i.dat +0 -0
  4. data/.yardoc/objects/ActionMailer/Base/origin_mail_i.dat +0 -0
  5. data/.yardoc/objects/ActionMailer/Base/set_layout_and_partials_i.dat +0 -0
  6. data/.yardoc/objects/ActionMailer/Base.dat +0 -0
  7. data/.yardoc/objects/ActionMailer/Collector/custom_i.dat +0 -0
  8. data/.yardoc/objects/ActionMailer/Collector.dat +0 -0
  9. data/.yardoc/objects/ActionMailer.dat +0 -0
  10. data/.yardoc/objects/MailEngine/ActsAsMailReceiver/ClassMethods/acts_as_mail_receiver_i.dat +0 -0
  11. data/.yardoc/objects/MailEngine/ActsAsMailReceiver/ClassMethods.dat +0 -0
  12. data/.yardoc/objects/MailEngine/ActsAsMailReceiver.dat +0 -0
  13. data/.yardoc/objects/MailEngine/Base/_40_40configurations.dat +0 -0
  14. data/.yardoc/objects/MailEngine/Base/current_config_c.dat +0 -0
  15. data/.yardoc/objects/MailEngine/Base/send_mail_c.dat +0 -0
  16. data/.yardoc/objects/MailEngine/Base.dat +0 -0
  17. data/.yardoc/objects/MailEngine/Configuration/load_c.dat +0 -0
  18. data/.yardoc/objects/MailEngine/Configuration.dat +0 -0
  19. data/.yardoc/objects/MailEngine/CreateConfig/create_config_file_i.dat +0 -0
  20. data/.yardoc/objects/MailEngine/CreateConfig.dat +0 -0
  21. data/.yardoc/objects/MailEngine/CreateMigration/create_migrations_i.dat +0 -0
  22. data/.yardoc/objects/MailEngine/CreateMigration.dat +0 -0
  23. data/.yardoc/objects/MailEngine/Engine.dat +0 -0
  24. data/.yardoc/objects/MailEngine/HtmlDocumentAssetsReplacer/check_21_c.dat +0 -0
  25. data/.yardoc/objects/MailEngine/HtmlDocumentAssetsReplacer/process_c.dat +0 -0
  26. data/.yardoc/objects/MailEngine/HtmlDocumentAssetsReplacer/replace_resource_filename_in_html_c.dat +0 -0
  27. data/.yardoc/objects/MailEngine/HtmlDocumentAssetsReplacer/replace_resource_url_in_html_c.dat +0 -0
  28. data/.yardoc/objects/MailEngine/HtmlDocumentAssetsReplacer.dat +0 -0
  29. data/.yardoc/objects/MailEngine/MailLogSubscriber/deliver_i.dat +0 -0
  30. data/.yardoc/objects/MailEngine/MailLogSubscriber.dat +0 -0
  31. data/.yardoc/objects/MailEngine/Sendgrid/Base/ClassMethods/sendgrid_header_i.dat +0 -0
  32. data/.yardoc/objects/MailEngine/Sendgrid/Base/ClassMethods.dat +0 -0
  33. data/.yardoc/objects/MailEngine/Sendgrid/Base/InstanceMethods.dat +0 -0
  34. data/.yardoc/objects/MailEngine/Sendgrid/Base.dat +0 -0
  35. data/.yardoc/objects/MailEngine/Sendgrid/FilterSetting/data_3D_i.dat +0 -0
  36. data/.yardoc/objects/MailEngine/Sendgrid/FilterSetting/data_i.dat +0 -0
  37. data/.yardoc/objects/MailEngine/Sendgrid/FilterSetting/initialize_i.dat +0 -0
  38. data/.yardoc/objects/MailEngine/Sendgrid/FilterSetting/validate_config_21_i.dat +0 -0
  39. data/.yardoc/objects/MailEngine/Sendgrid/FilterSetting.dat +0 -0
  40. data/.yardoc/objects/MailEngine/Sendgrid/RestApi/blocks_c.dat +0 -0
  41. data/.yardoc/objects/MailEngine/Sendgrid/RestApi/bounces_c.dat +0 -0
  42. data/.yardoc/objects/MailEngine/Sendgrid/RestApi/invalidemails_c.dat +0 -0
  43. data/.yardoc/objects/MailEngine/Sendgrid/RestApi/spamreports_c.dat +0 -0
  44. data/.yardoc/objects/MailEngine/Sendgrid/RestApi/stats_c.dat +0 -0
  45. data/.yardoc/objects/MailEngine/Sendgrid/RestApi.dat +0 -0
  46. data/.yardoc/objects/MailEngine/Sendgrid/RestApiError.dat +0 -0
  47. data/.yardoc/objects/MailEngine/Sendgrid/SmtpApi/add_sub_val_i.dat +0 -0
  48. data/.yardoc/objects/MailEngine/Sendgrid/SmtpApi/add_to_i.dat +0 -0
  49. data/.yardoc/objects/MailEngine/Sendgrid/SmtpApi/category_i.dat +0 -0
  50. data/.yardoc/objects/MailEngine/Sendgrid/SmtpApi/filters_i.dat +0 -0
  51. data/.yardoc/objects/MailEngine/Sendgrid/SmtpApi/initialize_i.dat +0 -0
  52. data/.yardoc/objects/MailEngine/Sendgrid/SmtpApi/set_unique_args_i.dat +0 -0
  53. data/.yardoc/objects/MailEngine/Sendgrid/SmtpApi/to_hash_i.dat +0 -0
  54. data/.yardoc/objects/MailEngine/Sendgrid/SmtpApi/to_json_i.dat +0 -0
  55. data/.yardoc/objects/MailEngine/Sendgrid/SmtpApi/to_s_i.dat +0 -0
  56. data/.yardoc/objects/MailEngine/Sendgrid/SmtpApi.dat +0 -0
  57. data/.yardoc/objects/MailEngine/Sendgrid.dat +0 -0
  58. data/.yardoc/objects/MailEngine/VERSION.dat +0 -0
  59. data/.yardoc/objects/MailEngine/ZipProcessor/extract_all_files_c.dat +0 -0
  60. data/.yardoc/objects/MailEngine/ZipProcessor.dat +0 -0
  61. data/.yardoc/objects/MailEngine.dat +0 -0
  62. data/.yardoc/objects/PLACEHOLDERS_IN_LAYOUT.dat +0 -0
  63. data/.yardoc/objects/root.dat +0 -0
  64. data/.yardoc/proxy_types +0 -0
  65. data/Gemfile +36 -0
  66. data/Gemfile.lock +159 -0
  67. data/MIT-LICENSE +20 -0
  68. data/README.mkd +152 -0
  69. data/Rakefile +57 -0
  70. data/VERSION +1 -0
  71. data/app/controllers/mail_engine/application_controller.rb +7 -0
  72. data/app/controllers/mail_engine/dashboard_controller.rb +9 -0
  73. data/app/controllers/mail_engine/mail_logs_controller.rb +20 -0
  74. data/app/controllers/mail_engine/mail_schedules_controller.rb +56 -0
  75. data/app/controllers/mail_engine/mail_template_files_controller.rb +46 -0
  76. data/app/controllers/mail_engine/mail_templates_controller.rb +141 -0
  77. data/app/controllers/mail_engine/reports_controller.rb +34 -0
  78. data/app/helpers/mail_engine/mail_engine_helper.rb +30 -0
  79. data/app/mailers/mail_engine/mail_dispatcher.rb +59 -0
  80. data/app/models/mail_engine/mail_log.rb +36 -0
  81. data/app/models/mail_engine/mail_schedule.rb +70 -0
  82. data/app/models/mail_engine/mail_template.rb +270 -0
  83. data/app/models/mail_engine/mail_template_file.rb +31 -0
  84. data/app/models/mail_engine/template_partial.rb +9 -0
  85. data/app/uploaders/mail_engine/template_file_uploader.rb +47 -0
  86. data/app/uploaders/mail_engine/zip_file_uploader.rb +47 -0
  87. data/app/views/layouts/mail_engine/mail_engine.html.erb +112 -0
  88. data/app/views/layouts/mail_engine/mail_template_layouts/header_and_footer.html.erb +10 -0
  89. data/app/views/layouts/mail_engine/mail_template_layouts/header_and_footer.text.erb +3 -0
  90. data/app/views/layouts/mail_engine/mail_template_layouts/none.html.erb +8 -0
  91. data/app/views/layouts/mail_engine/mail_template_layouts/none.text.erb +1 -0
  92. data/app/views/layouts/mail_engine/mail_template_layouts/only_footer.html.erb +9 -0
  93. data/app/views/layouts/mail_engine/mail_template_layouts/only_footer.text.erb +2 -0
  94. data/app/views/mail_engine/dashboard/index.html.erb +64 -0
  95. data/app/views/mail_engine/mail_logs/index.html.erb +34 -0
  96. data/app/views/mail_engine/mail_logs/show.html.erb +38 -0
  97. data/app/views/mail_engine/mail_schedules/_form.html.erb +45 -0
  98. data/app/views/mail_engine/mail_schedules/edit.html.erb +16 -0
  99. data/app/views/mail_engine/mail_schedules/index.html.erb +50 -0
  100. data/app/views/mail_engine/mail_schedules/new.html.erb +13 -0
  101. data/app/views/mail_engine/mail_schedules/show.html.erb +44 -0
  102. data/app/views/mail_engine/mail_template_files/_form.html.erb +28 -0
  103. data/app/views/mail_engine/mail_template_files/edit.html.erb +9 -0
  104. data/app/views/mail_engine/mail_template_files/new.html.erb +9 -0
  105. data/app/views/mail_engine/mail_templates/_form.html.erb +97 -0
  106. data/app/views/mail_engine/mail_templates/_layout_selector.html.erb +50 -0
  107. data/app/views/mail_engine/mail_templates/duplicate.html.erb +41 -0
  108. data/app/views/mail_engine/mail_templates/edit.html.erb +16 -0
  109. data/app/views/mail_engine/mail_templates/index.html.erb +69 -0
  110. data/app/views/mail_engine/mail_templates/new.html.erb +12 -0
  111. data/app/views/mail_engine/mail_templates/new_by_upload.html.erb +63 -0
  112. data/app/views/mail_engine/mail_templates/partial_options.html.erb +28 -0
  113. data/app/views/mail_engine/mail_templates/preview.html.erb +1 -0
  114. data/app/views/mail_engine/mail_templates/preview.text.erb +1 -0
  115. data/app/views/mail_engine/mail_templates/show.html.erb +64 -0
  116. data/app/views/mail_engine/reports/charts/blocks.html.erb +21 -0
  117. data/app/views/mail_engine/reports/charts/bounces.html.erb +21 -0
  118. data/app/views/mail_engine/reports/charts/invalidemails.html.erb +19 -0
  119. data/app/views/mail_engine/reports/charts/spamreports.html.erb +17 -0
  120. data/app/views/mail_engine/reports/index.html.erb +67 -0
  121. data/config/routes.rb +48 -0
  122. data/db/migrate/20110114030841_create_table_mail_template.rb +22 -0
  123. data/db/migrate/20110126030525_create_mail_schedules.rb +21 -0
  124. data/db/migrate/20110204114145_create_template_partials.rb +13 -0
  125. data/db/migrate/20110206025002_create_mail_logs.rb +17 -0
  126. data/db/migrate/20110217062316_create_mail_template_files.rb +14 -0
  127. data/doc/_index.html +322 -0
  128. data/doc/class_list.html +36 -0
  129. data/doc/css/common.css +1 -0
  130. data/doc/css/full_list.css +53 -0
  131. data/doc/css/style.css +310 -0
  132. data/doc/file_list.html +38 -0
  133. data/doc/frames.html +13 -0
  134. data/doc/js/app.js +203 -0
  135. data/doc/js/full_list.js +149 -0
  136. data/doc/js/jquery.js +154 -0
  137. data/doc/method_list.html +283 -0
  138. data/lib/mail_engine/action_mailer_patch.rb +104 -0
  139. data/lib/mail_engine/acts_as_mail_receiver.rb +22 -0
  140. data/lib/mail_engine/base.rb +26 -0
  141. data/lib/mail_engine/configuration.rb +11 -0
  142. data/lib/mail_engine/engine.rb +42 -0
  143. data/lib/mail_engine/generators/create_config.rb +20 -0
  144. data/lib/mail_engine/generators/create_migration.rb +20 -0
  145. data/lib/mail_engine/generators/templates/mail_engine_config.yml +14 -0
  146. data/lib/mail_engine/html_document_assets_replacer.rb +86 -0
  147. data/lib/mail_engine/mail_log_subscriber.rb +30 -0
  148. data/lib/mail_engine/placeholders_in_layout.rb +5 -0
  149. data/lib/mail_engine/sendgrid/base.rb +45 -0
  150. data/lib/mail_engine/sendgrid/rest_api.rb +85 -0
  151. data/lib/mail_engine/sendgrid/smtp_api.rb +85 -0
  152. data/lib/mail_engine/sendgrid.rb +9 -0
  153. data/lib/mail_engine/tasks/sendmail.rake +8 -0
  154. data/lib/mail_engine/version.rb +3 -0
  155. data/lib/mail_engine/zip_processor.rb +51 -0
  156. data/lib/mail_engine.rb +17 -0
  157. data/mail_engine.gemspec +422 -0
  158. data/screenshots/bounce_report.png +0 -0
  159. data/screenshots/dashboard.png +0 -0
  160. data/screenshots/editing_mail_template.png +0 -0
  161. data/screenshots/logs.png +0 -0
  162. data/screenshots/new_by_upload.png +0 -0
  163. data/screenshots/reports.png +0 -0
  164. data/screenshots/schedule.png +0 -0
  165. data/screenshots/select_layout_partial.png +0 -0
  166. data/screenshots/templates.png +0 -0
  167. data/test/dummy/Rakefile +7 -0
  168. data/test/dummy/app/controllers/application_controller.rb +11 -0
  169. data/test/dummy/app/helpers/application_helper.rb +2 -0
  170. data/test/dummy/app/mailers/user_mailer.rb +36 -0
  171. data/test/dummy/app/models/user.rb +10 -0
  172. data/test/dummy/config/application.rb +52 -0
  173. data/test/dummy/config/boot.rb +10 -0
  174. data/test/dummy/config/database.yml +52 -0
  175. data/test/dummy/config/environment.rb +5 -0
  176. data/test/dummy/config/environments/development.rb +47 -0
  177. data/test/dummy/config/environments/production.rb +49 -0
  178. data/test/dummy/config/environments/test.rb +43 -0
  179. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  180. data/test/dummy/config/initializers/inflections.rb +10 -0
  181. data/test/dummy/config/initializers/mime_types.rb +5 -0
  182. data/test/dummy/config/initializers/secret_token.rb +7 -0
  183. data/test/dummy/config/initializers/session_store.rb +8 -0
  184. data/test/dummy/config/locales/en.yml +5 -0
  185. data/test/dummy/config/locales/zh.yml +2 -0
  186. data/test/dummy/config/routes.rb +58 -0
  187. data/test/dummy/config.ru +4 -0
  188. data/test/dummy/db/migrate/20110114030841_create_table_mail_template.rb +22 -0
  189. data/test/dummy/db/migrate/20110125094530_create_users.rb +16 -0
  190. data/test/dummy/db/migrate/20110126030525_create_mail_schedules.rb +21 -0
  191. data/test/dummy/db/migrate/20110204114145_create_template_partials.rb +13 -0
  192. data/test/dummy/db/migrate/20110206025002_create_mail_logs.rb +17 -0
  193. data/test/dummy/db/migrate/20110217062316_create_mail_template_files.rb +14 -0
  194. data/test/dummy/db/schema.rb +78 -0
  195. data/test/dummy/public/404.html +26 -0
  196. data/test/dummy/public/422.html +26 -0
  197. data/test/dummy/public/500.html +26 -0
  198. data/test/dummy/public/favicon.ico +0 -0
  199. data/test/dummy/public/images/mail_engine/header_and_footer_layout.png +0 -0
  200. data/test/dummy/public/images/mail_engine/logo.gif +0 -0
  201. data/test/dummy/public/images/mail_engine/logo.png +0 -0
  202. data/test/dummy/public/images/mail_engine/none_layout.png +0 -0
  203. data/test/dummy/public/images/mail_engine/only_footer_layout.png +0 -0
  204. data/test/dummy/public/images/mail_engine/unselect_header_and_footer_layout.png +0 -0
  205. data/test/dummy/public/images/mail_engine/unselect_none_layout.png +0 -0
  206. data/test/dummy/public/images/mail_engine/unselect_only_footer_layout.png +0 -0
  207. data/test/dummy/public/javascripts/jquery.iframe-auto-height.plugin.js +50 -0
  208. data/test/dummy/public/javascripts/jquery.js +16 -0
  209. data/test/dummy/public/javascripts/jquery.nyroModal/img/ajaxLoader.gif +0 -0
  210. data/test/dummy/public/javascripts/jquery.nyroModal/img/close.gif +0 -0
  211. data/test/dummy/public/javascripts/jquery.nyroModal/img/next.gif +0 -0
  212. data/test/dummy/public/javascripts/jquery.nyroModal/img/prev.gif +0 -0
  213. data/test/dummy/public/javascripts/jquery.nyroModal/js/jquery.nyroModal-ie6.js +186 -0
  214. data/test/dummy/public/javascripts/jquery.nyroModal/js/jquery.nyroModal-ie6.min.js +9 -0
  215. data/test/dummy/public/javascripts/jquery.nyroModal/js/jquery.nyroModal.custom.js +1599 -0
  216. data/test/dummy/public/javascripts/jquery.nyroModal/js/jquery.nyroModal.custom.min.js +34 -0
  217. data/test/dummy/public/javascripts/jquery.nyroModal/styles/nyroModal.css +102 -0
  218. data/test/dummy/public/javascripts/jquery.string.js +425 -0
  219. data/test/dummy/public/javascripts/mail_engine_application.js +2 -0
  220. data/test/dummy/public/javascripts/markitup/jquery.markitup.js +564 -0
  221. data/test/dummy/public/javascripts/markitup/sets/css/images/bold.png +0 -0
  222. data/test/dummy/public/javascripts/markitup/sets/css/images/css.png +0 -0
  223. data/test/dummy/public/javascripts/markitup/sets/css/images/italic.png +0 -0
  224. data/test/dummy/public/javascripts/markitup/sets/css/images/picture.png +0 -0
  225. data/test/dummy/public/javascripts/markitup/sets/css/images/stroke.png +0 -0
  226. data/test/dummy/public/javascripts/markitup/sets/css/images/tag.png +0 -0
  227. data/test/dummy/public/javascripts/markitup/sets/css/images/text_align_center.png +0 -0
  228. data/test/dummy/public/javascripts/markitup/sets/css/images/text_align_justify.png +0 -0
  229. data/test/dummy/public/javascripts/markitup/sets/css/images/text_align_left.png +0 -0
  230. data/test/dummy/public/javascripts/markitup/sets/css/images/text_align_right.png +0 -0
  231. data/test/dummy/public/javascripts/markitup/sets/css/images/text_indent.png +0 -0
  232. data/test/dummy/public/javascripts/markitup/sets/css/images/text_letterspacing.png +0 -0
  233. data/test/dummy/public/javascripts/markitup/sets/css/images/text_linespacing.png +0 -0
  234. data/test/dummy/public/javascripts/markitup/sets/css/images/text_lowercase.png +0 -0
  235. data/test/dummy/public/javascripts/markitup/sets/css/images/text_padding_bottom.png +0 -0
  236. data/test/dummy/public/javascripts/markitup/sets/css/images/text_padding_left.png +0 -0
  237. data/test/dummy/public/javascripts/markitup/sets/css/images/text_padding_right.png +0 -0
  238. data/test/dummy/public/javascripts/markitup/sets/css/images/text_padding_top.png +0 -0
  239. data/test/dummy/public/javascripts/markitup/sets/css/images/text_uppercase.png +0 -0
  240. data/test/dummy/public/javascripts/markitup/sets/css/readme.txt +28 -0
  241. data/test/dummy/public/javascripts/markitup/sets/css/set.js +52 -0
  242. data/test/dummy/public/javascripts/markitup/sets/css/style.css +72 -0
  243. data/test/dummy/public/javascripts/markitup/sets/default/images/bold.png +0 -0
  244. data/test/dummy/public/javascripts/markitup/sets/default/images/clean.png +0 -0
  245. data/test/dummy/public/javascripts/markitup/sets/default/images/image.png +0 -0
  246. data/test/dummy/public/javascripts/markitup/sets/default/images/italic.png +0 -0
  247. data/test/dummy/public/javascripts/markitup/sets/default/images/link.png +0 -0
  248. data/test/dummy/public/javascripts/markitup/sets/default/images/picture.png +0 -0
  249. data/test/dummy/public/javascripts/markitup/sets/default/images/preview.png +0 -0
  250. data/test/dummy/public/javascripts/markitup/sets/default/images/stroke.png +0 -0
  251. data/test/dummy/public/javascripts/markitup/sets/default/set.js +27 -0
  252. data/test/dummy/public/javascripts/markitup/sets/default/style.css +27 -0
  253. data/test/dummy/public/javascripts/markitup/sets/html/images/bold.png +0 -0
  254. data/test/dummy/public/javascripts/markitup/sets/html/images/clean.png +0 -0
  255. data/test/dummy/public/javascripts/markitup/sets/html/images/h1.png +0 -0
  256. data/test/dummy/public/javascripts/markitup/sets/html/images/h2.png +0 -0
  257. data/test/dummy/public/javascripts/markitup/sets/html/images/h3.png +0 -0
  258. data/test/dummy/public/javascripts/markitup/sets/html/images/h4.png +0 -0
  259. data/test/dummy/public/javascripts/markitup/sets/html/images/h5.png +0 -0
  260. data/test/dummy/public/javascripts/markitup/sets/html/images/h6.png +0 -0
  261. data/test/dummy/public/javascripts/markitup/sets/html/images/image.png +0 -0
  262. data/test/dummy/public/javascripts/markitup/sets/html/images/italic.png +0 -0
  263. data/test/dummy/public/javascripts/markitup/sets/html/images/link.png +0 -0
  264. data/test/dummy/public/javascripts/markitup/sets/html/images/list-bullet.png +0 -0
  265. data/test/dummy/public/javascripts/markitup/sets/html/images/list-item.png +0 -0
  266. data/test/dummy/public/javascripts/markitup/sets/html/images/list-numeric.png +0 -0
  267. data/test/dummy/public/javascripts/markitup/sets/html/images/paragraph.png +0 -0
  268. data/test/dummy/public/javascripts/markitup/sets/html/images/picture.png +0 -0
  269. data/test/dummy/public/javascripts/markitup/sets/html/images/preview.png +0 -0
  270. data/test/dummy/public/javascripts/markitup/sets/html/images/stroke.png +0 -0
  271. data/test/dummy/public/javascripts/markitup/sets/html/readme.txt +11 -0
  272. data/test/dummy/public/javascripts/markitup/sets/html/set.js +40 -0
  273. data/test/dummy/public/javascripts/markitup/sets/html/style.css +59 -0
  274. data/test/dummy/public/javascripts/markitup/skins/markitup/images/bg-container.png +0 -0
  275. data/test/dummy/public/javascripts/markitup/skins/markitup/images/bg-editor-bbcode.png +0 -0
  276. data/test/dummy/public/javascripts/markitup/skins/markitup/images/bg-editor-dotclear.png +0 -0
  277. data/test/dummy/public/javascripts/markitup/skins/markitup/images/bg-editor-html.png +0 -0
  278. data/test/dummy/public/javascripts/markitup/skins/markitup/images/bg-editor-json.png +0 -0
  279. data/test/dummy/public/javascripts/markitup/skins/markitup/images/bg-editor-markdown.png +0 -0
  280. data/test/dummy/public/javascripts/markitup/skins/markitup/images/bg-editor-textile.png +0 -0
  281. data/test/dummy/public/javascripts/markitup/skins/markitup/images/bg-editor-wiki.png +0 -0
  282. data/test/dummy/public/javascripts/markitup/skins/markitup/images/bg-editor-xml.png +0 -0
  283. data/test/dummy/public/javascripts/markitup/skins/markitup/images/bg-editor.png +0 -0
  284. data/test/dummy/public/javascripts/markitup/skins/markitup/images/handle.png +0 -0
  285. data/test/dummy/public/javascripts/markitup/skins/markitup/images/menu.png +0 -0
  286. data/test/dummy/public/javascripts/markitup/skins/markitup/images/submenu.png +0 -0
  287. data/test/dummy/public/javascripts/markitup/skins/markitup/style.css +147 -0
  288. data/test/dummy/public/javascripts/markitup/skins/simple/images/handle.png +0 -0
  289. data/test/dummy/public/javascripts/markitup/skins/simple/images/menu.png +0 -0
  290. data/test/dummy/public/javascripts/markitup/skins/simple/images/submenu.png +0 -0
  291. data/test/dummy/public/javascripts/markitup/skins/simple/style.css +118 -0
  292. data/test/dummy/public/javascripts/markitup/templates/preview.css +5 -0
  293. data/test/dummy/public/javascripts/markitup/templates/preview.html +11 -0
  294. data/test/dummy/public/javascripts/rails.js +132 -0
  295. data/test/dummy/public/stylesheets/.gitkeep +0 -0
  296. data/test/dummy/public/stylesheets/application.css +0 -0
  297. data/test/dummy/public/stylesheets/style.css +681 -0
  298. data/test/dummy/script/rails +6 -0
  299. data/test/factories.rb +88 -0
  300. data/test/fixtures/files/compress_by_dir.zip +0 -0
  301. data/test/fixtures/files/compress_by_file.zip +0 -0
  302. data/test/fixtures/files/image.png +0 -0
  303. data/test/functional/mail_engine/mail_dispatcher_test.rb +8 -0
  304. data/test/functional/mail_engine/mail_schedules_controller_controller_test.rb +8 -0
  305. data/test/functional/mail_engine/mail_templates_controller_controller_test.rb +8 -0
  306. data/test/support/integration_case.rb +5 -0
  307. data/test/test_helper.rb +35 -0
  308. data/test/unit/mail_engine/mail_log_test.rb +8 -0
  309. data/test/unit/mail_engine/mail_schedule_test.rb +40 -0
  310. data/test/unit/mail_engine/mail_template_file_test.rb +21 -0
  311. data/test/unit/mail_engine/mail_template_test.rb +77 -0
  312. data/test/unit/mail_engine/template_partial_test.rb +8 -0
  313. metadata +597 -0
@@ -0,0 +1,1599 @@
1
+ /*
2
+ * nyroModal v2.0.0
3
+ * Core
4
+ *
5
+ *
6
+ * Included parts:
7
+ * - anims.fade
8
+ * - filters.title
9
+ * - filters.gallery
10
+ * - filters.link
11
+ * - filters.dom
12
+ * - filters.data
13
+ * - filters.image
14
+ * - filters.swf
15
+ * - filters.form
16
+ * - filters.formFile
17
+ * - filters.iframe
18
+ * - filters.iframeForm
19
+ * - filters.embedly
20
+ */
21
+ /*
22
+ * nyroModal v2.0.0
23
+ * Core
24
+ *
25
+ */
26
+ jQuery(function($, undefined) {
27
+
28
+ var $w = $(window),
29
+ $d = $(document),
30
+ $b = $('body'),
31
+ baseHref = $('base').attr('href'),
32
+ // nyroModal Object
33
+ _nmObj = {
34
+ filters: [], // List of filters used
35
+ callbacks: {}, // Sepcific callbacks
36
+ loadFilter: undefined, // Name of the filter used for loading
37
+
38
+ modal: false, // Indicates if it's a modal window or not
39
+ closeOnEscape: true, // Indicates if the modal should close on Escape key
40
+ closeOnClick: true, // Indicates if a click on the background should close the modal
41
+ useKeyHandler: false, // Indicates if the modal has to handle key down event
42
+
43
+ showCloseButton: true, // Indicates if the closeButonn should be added
44
+ closeButton: '<a href="#" class="nyroModalClose nyroModalCloseButton nmReposition" title="close">Close</a>', // Close button HTML
45
+
46
+ stack: false, // Indicates if links automatically binded inside the modal should stack or not
47
+
48
+ header: undefined, // header include in every modal
49
+ footer: undefined, // footer include in every modal
50
+
51
+ // Specific confirguation for gallery filter
52
+ galleryLoop: true, // Indicates if the gallery should loop
53
+ galleryCounts: true, // Indicates if the gallery counts should be shown
54
+ ltr: true, // Left to Right by default. Put to false for Hebrew or Right to Left language. Used in gallery filter
55
+
56
+ // Specific confirguation for image filter
57
+ imageRegex: '[^\.]\.(jpg|jpeg|png|tiff|gif|bmp)\s*$', // Regex used to detect image link
58
+
59
+ selIndicator: 'nyroModalSel', // Value added when a form or Ajax is sent with a filter content
60
+
61
+ swf: { // Default SWF attributes
62
+ allowFullScreen: 'true',
63
+ allowscriptaccess: 'always',
64
+ wmode: 'transparent'
65
+ },
66
+
67
+ store: {}, // Storage object for filters.
68
+ errorMsg: 'An error occured', // Error message
69
+ elts: { // HTML elements for the modal
70
+ all: undefined,
71
+ bg: undefined,
72
+ load: undefined,
73
+ cont: undefined,
74
+ hidden: undefined
75
+ },
76
+ sizes: { // Size information
77
+ initW: undefined, // Initial width
78
+ initH: undefined, // Initial height
79
+ w: undefined, // width
80
+ h: undefined, // height
81
+ minW: undefined, // minimum Width
82
+ minH: undefined, // minimum height
83
+ wMargin: undefined, // Horizontal margin
84
+ hMargin: undefined // Vertical margin
85
+ },
86
+ anim: { // Animation names to use
87
+ def: undefined, // Default animation set to use if sspecific are not defined or doesn't exist
88
+ showBg: undefined, // Set to use for showBg animation
89
+ hideBg: undefined, // Set to use for hideBg animation
90
+ showLoad: undefined, // Set to use for showLoad animation
91
+ hideLoad: undefined, // Set to use for hideLoad animation
92
+ showCont: undefined, // Set to use for showCont animation
93
+ hideCont: undefined, // Set to use for hideCont animation
94
+ showTrans: undefined, // Set to use for showTrans animation
95
+ hideTrans: undefined, // Set to use for hideTrans animation
96
+ resize: undefined // Set to use for resize animation
97
+ },
98
+
99
+ _open: false, // Indicates if the modal is open
100
+ _bgReady: false, // Indicates if the background is ready
101
+ _opened: false, // Indicates if the modal was opened (useful for stacking)
102
+ _loading: false, // Indicates if the loading is shown
103
+ _animated: false, // Indicates if the modal is currently animated
104
+ _transition: false, //Indicates if the modal is in transition
105
+ _nmOpener: undefined, // nmObj of the modal that opened the current one in non stacking mode
106
+ _nbContentLoading: 0, // Counter for contentLoading call
107
+ _scripts: '', // Scripts tags to be included
108
+ _scriptsShown: '', //Scripts tags to be included once the modal is swhon
109
+
110
+ // save the object in data
111
+ saveObj: function() {
112
+ this.opener.data('nmObj', this);
113
+ },
114
+ // Open the modal
115
+ open: function() {
116
+ this.getInternal()._pushStack(this.opener);
117
+ this._opened = false;
118
+ this._bgReady = false;
119
+ this._open = true;
120
+ this._initElts();
121
+ this._load();
122
+ this._nbContentLoading = 0;
123
+ this._callAnim('showBg', $.proxy(function() {
124
+ this._bgReady = true;
125
+ if (this._nmOpener) {
126
+ // fake closing of the opener nyroModal
127
+ this._nmOpener._close();
128
+ this._nmOpener._bgReady = false;
129
+ this._nmOpener._loading = false;
130
+ this._nmOpener._animated = false;
131
+ this._nmOpener._opened = false;
132
+ this._nmOpener._open = false;
133
+ this._nmOpener.elts.cont = this._nmOpener.elts.hidden = this._nmOpener.elts.load = this._nmOpener.elts.bg = this._nmOpener.elts.all = undefined;
134
+ this._nmOpener.saveObj();
135
+ this._nmOpener = undefined;
136
+ }
137
+ this._contentLoading();
138
+ }, this));
139
+ },
140
+
141
+ // Resize the modal according to sizes.initW and sizes.initH
142
+ // Will call size function
143
+ resize: function() {
144
+ this.sizes.w = this.sizes.initW;
145
+ this.sizes.h = this.sizes.initH;
146
+ this._unreposition();
147
+ this.size();
148
+ this._callAnim('resize', $.proxy(function() {
149
+ this._reposition();
150
+ }, this));
151
+ },
152
+
153
+ // Update sizes element to not go outsize the viewport.
154
+ // Will call 'size' callback filter
155
+ size: function() {
156
+ var maxHeight = this.getInternal().fullSize.viewH - this.sizes.hMargin,
157
+ maxWidth = this.getInternal().fullSize.viewW - this.sizes.wMargin;
158
+ if (this.sizes.minW && this.sizes.minW > this.sizes.w)
159
+ this.sizes.w = this.sizes.minW;
160
+ if (this.sizes.minH && this.sizes.minH > this.sizes.h)
161
+ this.sizes.h = this.sizes.minH;
162
+ if (this.sizes.h > maxHeight || this.sizes.w > maxWidth) {
163
+ // We're gonna resize the modal as it will goes outside the view port
164
+ this.sizes.h = Math.min(this.sizes.h, maxHeight);
165
+ this.sizes.w = Math.min(this.sizes.w, maxWidth);
166
+ }
167
+ this._callFilters('size');
168
+ },
169
+
170
+ // Get the nmObject for a new nyroModal
171
+ getForNewLinks: function() {
172
+ var ret;
173
+ if (this.stack) {
174
+ ret = $.extend(true, {}, this);
175
+ ret._nmOpener = undefined;
176
+ ret.elts.all = undefined;
177
+ } else {
178
+ ret = $.extend({}, this);
179
+ ret._nmOpener = this;
180
+ }
181
+ ret.filters = [];
182
+ ret.opener = undefined;
183
+ ret._open = false;
184
+ return ret;
185
+ },
186
+
187
+ // key handle function.
188
+ // Will call 'keyHandle' callback filter
189
+ keyHandle: function(e) {
190
+ this.keyEvent = e;
191
+ this._callFilters('keyHandle');
192
+ this.keyEvent = undefined;
193
+ delete(this.keyEvent);
194
+ },
195
+
196
+ // Get the internal object
197
+ getInternal: function() {
198
+ return _internal;
199
+ },
200
+
201
+ // Internal function for closing a nyroModal
202
+ // Will call 'close' callback filter
203
+ _close: function() {
204
+ this.getInternal()._removeStack(this.opener);
205
+ this._opened = false;
206
+ this._open = false;
207
+ this._callFilters('close');
208
+ },
209
+ // Public function for closing a nyroModal
210
+ close: function() {
211
+ this._close();
212
+ this._callFilters('beforeClose');
213
+ var self = this;
214
+ this._unreposition();
215
+ self._callAnim('hideCont', function() {
216
+ self._callAnim('hideLoad', function() {
217
+ self._callAnim('hideBg', function() {
218
+ self._callFilters('afterClose');
219
+ self.elts.cont.remove();
220
+ self.elts.hidden.remove();
221
+ self.elts.load.remove();
222
+ self.elts.bg.remove();
223
+ self.elts.all.remove();
224
+ self.elts.cont = self.elts.hidden = self.elts.load = self.elts.bg = self.elts.all = undefined;
225
+ });
226
+ });
227
+ });
228
+ },
229
+
230
+ // Init HTML elements
231
+ _initElts: function() {
232
+ if (!this.stack && this.getInternal().stack.length > 1)
233
+ this.elts = $(_internal.stack[_internal.stack.length-2]).data('nmObj').elts;
234
+ if (!this.elts.all || this.elts.all.closest('body').length == 0)
235
+ this.elts.all = this.elts.bg = this.elts.cont = this.elts.hidden = this.elts.load = undefined;
236
+ if (!this.elts.all)
237
+ this.elts.all = $('<div />').appendTo(this.getInternal()._container);
238
+ if (!this.elts.bg)
239
+ this.elts.bg = $('<div />').hide().appendTo(this.elts.all);
240
+ if (!this.elts.cont)
241
+ this.elts.cont = $('<div />').hide().appendTo(this.elts.all);
242
+ if (!this.elts.hidden)
243
+ this.elts.hidden = $('<div />').hide().appendTo(this.elts.all);
244
+ this.elts.hidden.empty();
245
+ if (!this.elts.load)
246
+ this.elts.load = $('<div />').hide().appendTo(this.elts.all);
247
+ this._callFilters('initElts');
248
+ },
249
+
250
+ // Trigger the error
251
+ // Will call 'error' callback filter
252
+ _error: function() {
253
+ this._callFilters('error');
254
+ },
255
+
256
+ // Set the HTML content to show.
257
+ // - html: HTML content
258
+ // - selector: selector to filter the content
259
+ // Will init the size and call the 'size' function.
260
+ // Will call 'filledContent' callback filter
261
+ _setCont: function(html, selector) {
262
+ if (selector) {
263
+ var tmp = [],
264
+ i = 0;
265
+ // Looking for script to store them
266
+ html = html
267
+ .replace(/\r\n/gi, 'nyroModalLN')
268
+ .replace(/<script(.|\s)*?\/script>/gi, function(x) {
269
+ tmp[i] = x;
270
+ return '<pre class=nyroModalScript rel="'+(i++)+'"></pre>';
271
+ });
272
+ var cur = $('<div>'+html+'</div>').find(selector);
273
+ if (cur.length) {
274
+ html = cur.html()
275
+ .replace(/<pre class="?nyroModalScript"? rel="?(.?)"?><\/pre>/gi, function(x, y, z) { return tmp[y]; })
276
+ .replace(/nyroModalLN/gi, "\r\n");
277
+ } else {
278
+ // selector not found
279
+ this._error();
280
+ return;
281
+ }
282
+ }
283
+ this.elts.hidden
284
+ .append(this._filterScripts(html))
285
+ .prepend(this.header)
286
+ .append(this.footer)
287
+ .wrapInner('<div class="nyroModal'+ucfirst(this.loadFilter)+'" />');
288
+
289
+ // Store the size of the element
290
+ this.sizes.initW = this.sizes.w = this.elts.hidden.width();
291
+ this.sizes.initH = this.sizes.h = this.elts.hidden.height();
292
+ var outer = this.getInternal()._getOuter(this.elts.cont);
293
+ this.sizes.hMargin = outer.h.total;
294
+ this.sizes.wMargin = outer.w.total;
295
+
296
+ this.size();
297
+
298
+ this.loading = false;
299
+ this._callFilters('filledContent');
300
+ this._contentLoading();
301
+ },
302
+
303
+ // Filter an html content to remove the script[src] and store them appropriately if needed
304
+ // - data: Data to filter
305
+ _filterScripts: function(data) {
306
+ if (typeof data != 'string')
307
+ return data;
308
+
309
+ this._scripts = [];
310
+ this._scriptsShown = [];
311
+ var start = 0,
312
+ stStart = '<script',
313
+ stEnd = '</script>',
314
+ endLn = stEnd.length,
315
+ pos,
316
+ pos2,
317
+ tmp;
318
+ while ((pos = data.indexOf(stStart, start)) > -1) {
319
+ pos2 = data.indexOf(stEnd)+endLn;
320
+ tmp = $(data.substring(pos, pos2));
321
+ if (!tmp.attr('src') || tmp.attr('rel') == 'forceLoad') {
322
+ if (tmp.attr('rev') == 'shown')
323
+ this._scriptsShown.push(tmp.get(0));
324
+ else
325
+ this._scripts.push(tmp.get(0));
326
+ }
327
+ data = data.substring(0, pos)+data.substr(pos2);
328
+ start = pos;
329
+ }
330
+ return data;
331
+ },
332
+
333
+ // Check if the nmObject has a specific filter
334
+ // - filter: Filter name
335
+ _hasFilter: function(filter) {
336
+ var ret = false;
337
+ $.each(this.filters, function(i, f) {
338
+ ret = ret || f == filter;
339
+ });
340
+ return ret;
341
+ },
342
+
343
+ // Remove a specific filter
344
+ // - filter: Filter name
345
+ _delFilter: function(filter) {
346
+ this.filters = $.map(this.filters, function(v) {
347
+ if (v != filter)
348
+ return v;
349
+ });
350
+ },
351
+
352
+ // Call a function against all active filters
353
+ // - fct: Function name
354
+ // return an array of all return of callbacks; keys are filters name
355
+ _callFilters: function(fct) {
356
+ this.getInternal()._debug(fct);
357
+ var ret = [],
358
+ self = this;
359
+ $.each(this.filters, function(i, f) {
360
+ ret[f] = self._callFilter(f, fct);
361
+ });
362
+ if (this.callbacks[fct] && $.isFunction(this.callbacks[fct]))
363
+ this.callbacks[fct](this);
364
+ return ret;
365
+ },
366
+
367
+ // Call a filter function for a specific filter
368
+ // - f: Filter name
369
+ // - fct: Function name
370
+ // return the return of the callback
371
+ _callFilter: function(f, fct) {
372
+ if (_filters[f] && _filters[f][fct] && $.isFunction(_filters[f][fct]))
373
+ return _filters[f][fct](this);
374
+ return undefined;
375
+ },
376
+
377
+ // Call animation callback.
378
+ // Will also call beforeNNN and afterNNN filter callbacks
379
+ // - fct: Animation function name
380
+ // - clb: Callback once the animation is done
381
+ _callAnim: function(fct, clb) {
382
+ this.getInternal()._debug(fct);
383
+ this._callFilters('before'+ucfirst(fct));
384
+ if (!this._animated) {
385
+ this._animated = true;
386
+ if (!$.isFunction(clb)) clb = $.noop;
387
+ var set = this.anim[fct] || this.anim.def || 'basic';
388
+ if (!_animations[set] || !_animations[set][fct] || !$.isFunction(_animations[set][fct]))
389
+ set = 'basic';
390
+ _animations[set][fct](this, $.proxy(function() {
391
+ this._animated = false;
392
+ this._callFilters('after'+ucfirst(fct));
393
+ clb();
394
+ }, this));
395
+ }
396
+ },
397
+
398
+ // Load the content
399
+ // Will call the 'load' function of the filter specified in the loadFilter parameter
400
+ _load: function() {
401
+ this.getInternal()._debug('_load');
402
+ if (!this.loading && this.loadFilter) {
403
+ this.loading = true;
404
+ this._callFilter(this.loadFilter, 'load');
405
+ }
406
+ },
407
+
408
+ // Show the content or the loading according to the current state of the modal
409
+ _contentLoading: function() {
410
+ if (!this._animated && this._bgReady) {
411
+ if (!this._transition && this.elts.cont.html().length > 0)
412
+ this._transition = true;
413
+ this._nbContentLoading++;
414
+ if (!this.loading) {
415
+ if (!this._opened) {
416
+ this._opened = true;
417
+ if (this._transition) {
418
+ var fct = $.proxy(function() {
419
+ this._writeContent();
420
+ this._callFilters('beforeShowCont');
421
+ this._callAnim('hideTrans', $.proxy(function() {
422
+ this._transition = false;
423
+ this.elts.cont.append(this._scriptsShown);
424
+ this._reposition();
425
+ this._callFilters('afterShowCont');
426
+ }, this));
427
+ }, this);
428
+ if (this._nbContentLoading == 1) {
429
+ this._unreposition();
430
+ this._callAnim('showTrans', fct);
431
+ } else {
432
+ fct();
433
+ }
434
+ } else {
435
+ this._callAnim('hideLoad', $.proxy(function() {
436
+ this._writeContent();
437
+ this._callAnim('showCont', $.proxy(function() {
438
+ this.elts.cont.append(this._scriptsShown);
439
+ this._reposition();
440
+ }, this));
441
+ }, this));
442
+ }
443
+ }
444
+ } else if (this._nbContentLoading == 1) {
445
+ var outer = this.getInternal()._getOuter(this.elts.load);
446
+ this.elts.load
447
+ .css({
448
+ position: 'fixed',
449
+ top: (this.getInternal().fullSize.viewH - this.elts.load.height() - outer.h.margin)/2,
450
+ left: (this.getInternal().fullSize.viewW - this.elts.load.width() - outer.w.margin)/2
451
+ });
452
+ if (this._transition) {
453
+ this._unreposition();
454
+ this._callAnim('showTrans', $.proxy(function() {
455
+ this._contentLoading();
456
+ }, this));
457
+ } else {
458
+ this._callAnim('showLoad', $.proxy(function() {
459
+ this._contentLoading();
460
+ }, this));
461
+ }
462
+ }
463
+ }
464
+ },
465
+
466
+ // Write the content in the modal.
467
+ // Content comes from the hidden div, scripts and eventually close button.
468
+ _writeContent: function() {
469
+ this.elts.cont
470
+ .empty()
471
+ .append(this.elts.hidden.contents())
472
+ .append(this._scripts)
473
+ .append(this.showCloseButton ? this.closeButton : '')
474
+ .css({
475
+ position: 'fixed',
476
+ width: this.sizes.w,
477
+ height: this.sizes.h,
478
+ top: (this.getInternal().fullSize.viewH - this.sizes.h - this.sizes.hMargin)/2,
479
+ left: (this.getInternal().fullSize.viewW - this.sizes.w - this.sizes.wMargin)/2
480
+ });
481
+ },
482
+
483
+ // Reposition elements with a class nmReposition
484
+ _reposition: function() {
485
+ var elts = this.elts.cont.find('.nmReposition');
486
+ if (elts.length) {
487
+ var space = this.getInternal()._getSpaceReposition();
488
+ elts.each(function() {
489
+ var me = $(this),
490
+ offset = me.offset();
491
+ me.css({
492
+ position: 'fixed',
493
+ top: offset.top - space.top,
494
+ left: offset.left - space.left
495
+ });
496
+ });
497
+ this.elts.cont.after(elts);
498
+ }
499
+ this.elts.cont.css('overflow', 'auto');
500
+ },
501
+
502
+ // Unreposition elements with a class nmReposition
503
+ // Exaclty the reverse of the _reposition function
504
+ _unreposition: function() {
505
+ this.elts.cont.css('overflow', '');
506
+ var elts = this.elts.all.find('.nmReposition');
507
+ if (elts.length)
508
+ this.elts.cont.append(elts.removeAttr('style'));
509
+ }
510
+ },
511
+ _internal = {
512
+ firstInit: true,
513
+ stack: [],
514
+ fullSize: {
515
+ w: 0,
516
+ h: 0,
517
+ wW: 0,
518
+ wH: 0,
519
+ viewW: 0,
520
+ viewH: 0
521
+ },
522
+ nyroModal: function(opts, fullObj) {
523
+ if (_internal.firstInit) {
524
+ _internal._container = $('<div />').appendTo($b);
525
+ $w.smartresize($.proxy(_internal._resize, _internal));
526
+ $d.bind('keydown.nyroModal', $.proxy(_internal._keyHandler, _internal));
527
+ _internal._calculateFullSize();
528
+ _internal.firstInit = false;
529
+ }
530
+ return this.nmInit(opts, fullObj).each(function() {
531
+ _internal._init($(this).data('nmObj'));
532
+ });
533
+ },
534
+ nmInit: function(opts, fullObj) {
535
+ return this.each(function() {
536
+ var me = $(this);
537
+ if (fullObj)
538
+ me.data('nmObj', $.extend(true, {opener: me}, opts));
539
+ else
540
+ me.data('nmObj',
541
+ me.data('nmObj')
542
+ ? $.extend(true, me.data('nmObj'), opts)
543
+ : $.extend(true, {opener: me}, _nmObj, opts));
544
+ });
545
+ },
546
+ nmCall: function() {
547
+ return this.trigger('nyroModal');
548
+ },
549
+
550
+ nmManual: function(url, opts) {
551
+ $('<a />', {
552
+ href: url
553
+ }).nyroModal(opts).trigger('nyroModal');
554
+ },
555
+ nmData: function(data, opts) {
556
+ this.nmManual('#', $.extend({data: data}, opts));
557
+ },
558
+ nmObj: function(opts) {
559
+ $.extend(true, _nmObj, opts);
560
+ },
561
+ nmInternal: function(opts) {
562
+ $.extend(true, _internal, opts);
563
+ },
564
+ nmAnims: function(opts) {
565
+ $.extend(true, _animations, opts);
566
+ },
567
+ nmFilters: function(opts) {
568
+ $.extend(true, _filters, opts);
569
+ },
570
+ nmTop: function() {
571
+ if (_internal.stack.length)
572
+ return $(_internal.stack[_internal.stack.length-1]).data('nmObj');
573
+ return undefined;
574
+ },
575
+
576
+ _debug: function(msg) {
577
+ if (window.console && window.console.log)
578
+ window.console.log(msg);
579
+ },
580
+
581
+ _container: undefined,
582
+
583
+ _init: function(nm) {
584
+ nm.filters = [];
585
+ $.each(_filters, function(f, obj) {
586
+ if ($.isFunction(obj.is) && obj.is(nm)) {
587
+ nm.filters.push(f);
588
+ }
589
+ });
590
+ nm._callFilters('init');
591
+ nm.opener
592
+ .unbind('nyroModal.nyroModal nmClose.nyroModal nmResize.nyroModal')
593
+ .bind({
594
+ 'nyroModal.nyroModal': function(e) { nm.open(); return false;},
595
+ 'nmClose.nyroModal': function() { nm.close(); return false;},
596
+ 'nmResize.nyroModal': function() { nm.resize(); return false;}
597
+ });
598
+ },
599
+
600
+ _scrollWidth: (function() {
601
+ var scrollbarWidth;
602
+ if ($.browser.msie) {
603
+ var $textarea1 = $('<textarea cols="10" rows="2"></textarea>')
604
+ .css({ position: 'absolute', top: -1000, left: -1000 }).appendTo($b),
605
+ $textarea2 = $('<textarea cols="10" rows="2" style="overflow: hidden;"></textarea>')
606
+ .css({ position: 'absolute', top: -1000, left: -1000 }).appendTo($b);
607
+ scrollbarWidth = $textarea1.width() - $textarea2.width();
608
+ $textarea1.add($textarea2).remove();
609
+ } else {
610
+ var $div = $('<div />')
611
+ .css({ width: 100, height: 100, overflow: 'auto', position: 'absolute', top: -1000, left: -1000 })
612
+ .prependTo($b).append('<div />').find('div')
613
+ .css({ width: '100%', height: 200 });
614
+ scrollbarWidth = 100 - $div.width();
615
+ $div.parent().remove();
616
+ }
617
+ return scrollbarWidth;
618
+ })(),
619
+
620
+ _selNyroModal: function(obj) {
621
+ return $(obj).data('nmObj') ? true : false;
622
+ },
623
+
624
+ _selNyroModalOpen: function(obj) {
625
+ var me = $(obj);
626
+ return me.data('nmObj') ? me.data('nmObj')._open : false;
627
+ },
628
+
629
+ _keyHandler: function(e) {
630
+ var nmTop = $.nmTop();
631
+ if (nmTop && nmTop.useKeyHandler) {
632
+ return nmTop.keyHandle(e);
633
+ }
634
+ },
635
+ _pushStack: function(obj) {
636
+ this.stack = $.map(this.stack, function(elA) {
637
+ if (elA != obj.get(0))
638
+ return elA;
639
+ });
640
+ this.stack.push(obj.get(0));
641
+ },
642
+ _removeStack: function(obj) {
643
+ this.stack = $.map(this.stack, function(elA) {
644
+ if (elA != obj.get(0))
645
+ return elA;
646
+ });
647
+ },
648
+ _resize: function() {
649
+ var opens = $(':nmOpen').each(function() {
650
+ $(this).data('nmObj')._unreposition();
651
+ });
652
+ this._calculateFullSize();
653
+ opens.trigger('nmResize');
654
+ },
655
+ _calculateFullSize: function() {
656
+ this.fullSize = {
657
+ w: $d.width(),
658
+ h: $d.height(),
659
+ wW: $w.width(),
660
+ wH: $w.height()
661
+ };
662
+ this.fullSize.viewW = Math.min(this.fullSize.w, this.fullSize.wW);
663
+ this.fullSize.viewH = Math.min(this.fullSize.h, this.fullSize.wH);
664
+ },
665
+ _getCurCSS: function(elm, name) {
666
+ var ret = parseInt($.curCSS(elm, name, true));
667
+ return isNaN(ret) ? 0 : ret;
668
+ },
669
+ _getOuter: function(elm) {
670
+ elm = elm.get(0);
671
+ var ret = {
672
+ h: {
673
+ margin: this._getCurCSS(elm, 'marginTop') + this._getCurCSS(elm, 'marginBottom'),
674
+ border: this._getCurCSS(elm, 'borderTopWidth') + this._getCurCSS(elm, 'borderBottomWidth'),
675
+ padding: this._getCurCSS(elm, 'paddingTop') + this._getCurCSS(elm, 'paddingBottom')
676
+ },
677
+ w: {
678
+ margin: this._getCurCSS(elm, 'marginLeft') + this._getCurCSS(elm, 'marginRight'),
679
+ border: this._getCurCSS(elm, 'borderLeftWidth') + this._getCurCSS(elm, 'borderRightWidth'),
680
+ padding: this._getCurCSS(elm, 'paddingLeft') + this._getCurCSS(elm, 'paddingRight')
681
+ }
682
+ };
683
+
684
+ ret.h.outer = ret.h.margin + ret.h.border;
685
+ ret.w.outer = ret.w.margin + ret.w.border;
686
+
687
+ ret.h.inner = ret.h.padding + ret.h.border;
688
+ ret.w.inner = ret.w.padding + ret.w.border;
689
+
690
+ ret.h.total = ret.h.outer + ret.h.padding;
691
+ ret.w.total = ret.w.outer + ret.w.padding;
692
+
693
+ return ret;
694
+ },
695
+ _getSpaceReposition: function() {
696
+ var outer = this._getOuter($b),
697
+ ie7 = $.browser.msie && $.browser.version < 8 && !(screen.height <= $w.height()+23);
698
+ return {
699
+ top: $w.scrollTop() - (!ie7 ? outer.h.border / 2 : 0),
700
+ left: $w.scrollLeft() - (!ie7 ? outer.w.border / 2 : 0)
701
+ };
702
+ },
703
+
704
+ _getHash: function(url) {
705
+ if (typeof url == 'string') {
706
+ var hashPos = url.indexOf('#');
707
+ if (hashPos > -1)
708
+ return url.substring(hashPos);
709
+ }
710
+ return '';
711
+ },
712
+ _extractUrl: function(url) {
713
+ var ret = {
714
+ url: undefined,
715
+ sel: undefined
716
+ };
717
+
718
+ if (url) {
719
+ var hash = this._getHash(url),
720
+ hashLoc = this._getHash(window.location.href),
721
+ curLoc = window.location.href.substring(0, window.location.href.length - hashLoc.length),
722
+ req = url.substring(0, url.length - hash.length);
723
+ ret.sel = hash;
724
+ if (req != curLoc && req != baseHref)
725
+ ret.url = req;
726
+ }
727
+ return ret;
728
+ }
729
+ },
730
+ _animations = {
731
+ basic: {
732
+ showBg: function(nm, clb) {
733
+ nm.elts.bg.css({opacity: 0.7}).show();
734
+ clb();
735
+ },
736
+ hideBg: function(nm, clb) {
737
+ nm.elts.bg.hide();
738
+ clb();
739
+ },
740
+ showLoad: function(nm, clb) {
741
+ nm.elts.load.show();
742
+ clb();
743
+ },
744
+ hideLoad: function(nm, clb) {
745
+ nm.elts.load.hide();
746
+ clb();
747
+ },
748
+ showCont: function(nm, clb) {
749
+ nm.elts.cont.show();
750
+ clb();
751
+ },
752
+ hideCont: function(nm, clb) {
753
+ nm.elts.cont.hide();
754
+ clb();
755
+ },
756
+ showTrans: function(nm, clb) {
757
+ nm.elts.cont.hide();
758
+ nm.elts.load.show();
759
+ clb();
760
+ },
761
+ hideTrans: function(nm, clb) {
762
+ nm.elts.cont.show();
763
+ nm.elts.load.hide();
764
+ clb();
765
+ },
766
+ resize: function(nm, clb) {
767
+ nm.elts.cont.css({
768
+ width: nm.sizes.w,
769
+ height: nm.sizes.h,
770
+ top: (nm.getInternal().fullSize.viewH - nm.sizes.h - nm.sizes.hMargin)/2,
771
+ left: (nm.getInternal().fullSize.viewW - nm.sizes.w - nm.sizes.wMargin)/2
772
+ });
773
+ clb();
774
+ }
775
+ }
776
+ },
777
+ _filters = {
778
+ basic: {
779
+ is: function(nm) {
780
+ return true;
781
+ },
782
+ init: function(nm) {
783
+ if (nm.opener.attr('rev') == 'modal')
784
+ nm.modal = true;
785
+ if (nm.modal)
786
+ nm.closeOnEscape = nm.closeOnClick = nm.showCloseButton = false;
787
+ if (nm.closeOnEscape)
788
+ nm.useKeyHandler = true;
789
+ },
790
+ initElts: function(nm) {
791
+ nm.elts.bg.addClass('nyroModalBg');
792
+ if (nm.closeOnClick)
793
+ nm.elts.bg.unbind('click.nyroModal').bind('click.nyroModal', function(e) {
794
+ e.preventDefault();
795
+ nm.close();
796
+ });
797
+ nm.elts.cont.addClass('nyroModalCont');
798
+ nm.elts.hidden.addClass('nyroModalCont nyroModalHidden');
799
+ nm.elts.load.addClass('nyroModalCont nyroModalLoad');
800
+ },
801
+ error: function(nm) {
802
+ nm.elts.hidden.addClass('nyroModalError');
803
+ nm.elts.cont.addClass('nyroModalError');
804
+ nm._setCont(nm.errorMsg);
805
+ },
806
+ beforeShowCont: function(nm) {
807
+ nm.elts.cont
808
+ .find('.nyroModal').nyroModal(nm.getForNewLinks(), true).end()
809
+ .find('.nyroModalClose').bind('click.nyroModal', function(e) {
810
+ e.preventDefault();
811
+ nm.close();
812
+ });
813
+ },
814
+ keyHandle: function(nm) {
815
+ // used for escape key
816
+ if (nm.keyEvent.keyCode == 27 && nm.closeOnEscape) {
817
+ nm.keyEvent.preventDefault();
818
+ nm.close();
819
+ }
820
+ }
821
+ },
822
+
823
+ custom: {
824
+ is: function(nm) {
825
+ return true;
826
+ }
827
+ }
828
+ };
829
+
830
+ // Add jQuery call fucntions
831
+ $.fn.extend({
832
+ nm: _internal.nyroModal,
833
+ nyroModal: _internal.nyroModal,
834
+ nmInit: _internal.nmInit,
835
+ nmCall: _internal.nmCall
836
+ });
837
+
838
+ // Add global jQuery functions
839
+ $.extend({
840
+ nmManual: _internal.nmManual,
841
+ nmData: _internal.nmData,
842
+ nmObj: _internal.nmObj,
843
+ nmInternal: _internal.nmInternal,
844
+ nmAnims: _internal.nmAnims,
845
+ nmFilters: _internal.nmFilters,
846
+ nmTop: _internal.nmTop
847
+ });
848
+
849
+ // Add jQuery selectors
850
+ $.expr[':'].nyroModal = $.expr[':'].nm = _internal._selNyroModal;
851
+ $.expr[':'].nmOpen = _internal._selNyroModalOpen;
852
+ });
853
+
854
+ // Smartresize plugin
855
+ (function($,sr){
856
+
857
+ // debouncing function from John Hann
858
+ // http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/
859
+ var debounce = function (func, threshold, execAsap) {
860
+ var timeout;
861
+
862
+ return function debounced () {
863
+ var obj = this, args = arguments;
864
+ function delayed () {
865
+ if (!execAsap)
866
+ func.apply(obj, args);
867
+ timeout = null;
868
+ };
869
+
870
+ if (timeout)
871
+ clearTimeout(timeout);
872
+ else if (execAsap)
873
+ func.apply(obj, args);
874
+
875
+ timeout = setTimeout(delayed, threshold || 100);
876
+ };
877
+ };
878
+ // smartresize
879
+ jQuery.fn[sr] = function(fn){ return fn ? this.bind('resize', debounce(fn)) : this.trigger(sr); };
880
+
881
+ })(jQuery,'smartresize');
882
+ // ucFirst
883
+ function ucfirst(str) {
884
+ // http://kevin.vanzonneveld.net
885
+ // + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
886
+ // + bugfixed by: Onno Marsman
887
+ // + improved by: Brett Zamir (http://brett-zamir.me)
888
+ // * example 1: ucfirst('kevin van zonneveld');
889
+ // * returns 1: 'Kevin van zonneveld'
890
+ str += '';
891
+ var f = str.charAt(0).toUpperCase();
892
+ return f + str.substr(1);
893
+ }
894
+ /*
895
+ * nyroModal v2.0.0
896
+ *
897
+ * Fade animations
898
+ *
899
+ * Depends:
900
+ *
901
+ */
902
+ jQuery(function($, undefined) {
903
+ $.nmAnims({
904
+ fade: {
905
+ showBg: function(nm, clb) {
906
+ nm.elts.bg.fadeTo(250, 0.7, clb);
907
+ },
908
+ hideBg: function(nm, clb) {
909
+ nm.elts.bg.fadeOut(clb);
910
+ },
911
+ showLoad: function(nm, clb) {
912
+ nm.elts.load.fadeIn(clb);
913
+ },
914
+ hideLoad: function(nm, clb) {
915
+ nm.elts.load.fadeOut(clb);
916
+ },
917
+ showCont: function(nm, clb) {
918
+ nm.elts.cont.fadeIn(clb);
919
+ },
920
+ hideCont: function(nm, clb) {
921
+ nm.elts.cont.css('overflow', 'hidden').fadeOut(clb);
922
+ },
923
+ showTrans: function(nm, clb) {
924
+ nm.elts.load
925
+ .css({
926
+ position: nm.elts.cont.css('position'),
927
+ top: nm.elts.cont.css('top'),
928
+ left: nm.elts.cont.css('left'),
929
+ width: nm.elts.cont.css('width'),
930
+ height: nm.elts.cont.css('height'),
931
+ marginTop: nm.elts.cont.css('marginTop'),
932
+ marginLeft: nm.elts.cont.css('marginLeft')
933
+ })
934
+ .fadeIn(function() {
935
+ nm.elts.cont.hide();
936
+ clb();
937
+ });
938
+ },
939
+ hideTrans: function(nm, clb) {
940
+ nm.elts.cont.css('visibility', 'hidden').show();
941
+ nm.elts.load
942
+ .css('position', nm.elts.cont.css('position'))
943
+ .animate({
944
+ top: nm.elts.cont.css('top'),
945
+ left: nm.elts.cont.css('left'),
946
+ width: nm.elts.cont.css('width'),
947
+ height: nm.elts.cont.css('height'),
948
+ marginTop: nm.elts.cont.css('marginTop'),
949
+ marginLeft: nm.elts.cont.css('marginLeft')
950
+ }, function() {
951
+ nm.elts.cont.css('visibility', '');
952
+ nm.elts.load.fadeOut(clb);
953
+ });
954
+ },
955
+ resize: function(nm, clb) {
956
+ nm.elts.cont.animate({
957
+ width: nm.sizes.w,
958
+ height: nm.sizes.h,
959
+ top: (nm.getInternal().fullSize.viewH - nm.sizes.h - nm.sizes.hMargin)/2,
960
+ left: (nm.getInternal().fullSize.viewW - nm.sizes.w - nm.sizes.wMargin)/2
961
+ }, clb);
962
+ }
963
+ }
964
+ });
965
+ // Define fade aniamtions as default
966
+ $.nmObj({anim: {def: 'fade'}});
967
+ });
968
+ /*
969
+ * nyroModal v2.0.0
970
+ *
971
+ * Title filter
972
+ *
973
+ * Depends:
974
+ *
975
+ * Before:
976
+ */
977
+ jQuery(function($, undefined) {
978
+ $.nmFilters({
979
+ title: {
980
+ is: function(nm) {
981
+ return nm.opener.is('[title]');
982
+ },
983
+ beforeShowCont: function(nm) {
984
+ var offset = nm.elts.cont.offset();
985
+ nm.store.title = $('<h1 />', {
986
+ text: nm.opener.attr('title')
987
+ }).addClass('nyroModalTitle nmReposition');
988
+ nm.elts.cont.prepend(nm.store.title);
989
+ },
990
+ close: function(nm) {
991
+ if (nm.store.title) {
992
+ nm.store.title.remove();
993
+ nm.store.title = undefined;
994
+ delete(nm.store.title);
995
+ }
996
+ }
997
+ }
998
+ });
999
+ });
1000
+ /*
1001
+ * nyroModal v2.0.0
1002
+ *
1003
+ * Gallery filter
1004
+ *
1005
+ * Depends:
1006
+ * - filters.title
1007
+ *
1008
+ * Before: filters.title
1009
+ */
1010
+ jQuery(function($, undefined) {
1011
+ $.nmFilters({
1012
+ gallery: {
1013
+ is: function(nm) {
1014
+ var ret = nm.opener.is('[rel]:not([rel=external], [rel=nofollow])');
1015
+ if (ret && nm.galleryCounts && !nm._hasFilter('title'))
1016
+ nm.filters.push('title');
1017
+ return ret;
1018
+ },
1019
+ init: function(nm) {
1020
+ nm.useKeyHandler = true;
1021
+ },
1022
+ keyHandle: function(nm) {
1023
+ // used for arrows key
1024
+ if (!nm._animated && nm._opened) {
1025
+ if (nm.keyEvent.keyCode == 39 || nm.keyEvent.keyCode == 40) {
1026
+ nm.keyEvent.preventDefault();
1027
+ nm._callFilters('galleryNext');
1028
+ } else if (nm.keyEvent.keyCode == 37 || nm.keyEvent.keyCode == 38) {
1029
+ nm.keyEvent.preventDefault();
1030
+ nm._callFilters('galleryPrev');
1031
+ }
1032
+ }
1033
+ },
1034
+ initElts: function(nm) {
1035
+ var rel = nm.opener.attr('rel'),
1036
+ indexSpace = rel.indexOf(' ');
1037
+ nm.store.gallery = indexSpace > 0 ? rel.substr(0, indexSpace) : rel;
1038
+ nm.store.galleryLinks = $('[href][rel="'+nm.store.gallery+'"], [href][rel^="'+nm.store.gallery+' "]');
1039
+ nm.store.galleryIndex = nm.store.galleryLinks.index(nm.opener);
1040
+ },
1041
+ beforeShowCont: function(nm) {
1042
+ if (nm.galleryCounts && nm.store.title && nm.store.galleryLinks.length > 1) {
1043
+ var curTitle = nm.store.title.html();
1044
+ nm.store.title.html((curTitle.length ? curTitle+' - ' : '')+(nm.store.galleryIndex+1)+'/'+nm.store.galleryLinks.length);
1045
+ }
1046
+ },
1047
+ filledContent: function(nm) {
1048
+ var link = this._getGalleryLink(nm, -1),
1049
+ append = nm.elts.hidden.find(' > div');
1050
+ if (link) {
1051
+ $('<a />', {
1052
+ text: 'previous',
1053
+ href: '#'
1054
+ })
1055
+ .addClass('nyroModalPrev')
1056
+ .bind('click', function(e) {
1057
+ e.preventDefault();
1058
+ nm._callFilters('galleryPrev');
1059
+ })
1060
+ .appendTo(append);
1061
+ }
1062
+ link = this._getGalleryLink(nm, 1);
1063
+ if (link) {
1064
+ $('<a />', {
1065
+ text: 'next',
1066
+ href: '#'
1067
+ })
1068
+ .addClass('nyroModalNext')
1069
+ .bind('click', function(e) {
1070
+ e.preventDefault();
1071
+ nm._callFilters('galleryNext');
1072
+ })
1073
+ .appendTo(append);
1074
+ }
1075
+ },
1076
+ close: function(nm) {
1077
+ nm.store.gallery = undefined;
1078
+ nm.store.galleryLinks = undefined;
1079
+ nm.store.galleryIndex = undefined;
1080
+ delete(nm.store.gallery);
1081
+ delete(nm.store.galleryLinks);
1082
+ delete(nm.store.galleryIndex);
1083
+ if (nm.elts.cont)
1084
+ nm.elts.cont.find('.nyroModalNext, .nyroModalPrev').remove();
1085
+ },
1086
+ galleryNext: function(nm) {
1087
+ this._getGalleryLink(nm, 1).nyroModal(nm.getForNewLinks(), true).click();
1088
+ },
1089
+ galleryPrev: function(nm) {
1090
+ this._getGalleryLink(nm, -1).nyroModal(nm.getForNewLinks(), true).click();
1091
+ },
1092
+ _getGalleryLink: function(nm, dir) {
1093
+ if (nm.store.gallery) {
1094
+ if (!nm.ltr)
1095
+ dir *= -1;
1096
+ var index = nm.store.galleryIndex + dir;
1097
+ if (index >= 0 && index < nm.store.galleryLinks.length)
1098
+ return nm.store.galleryLinks.eq(index);
1099
+ else if (nm.galleryLoop)
1100
+ return nm.store.galleryLinks.eq(index<0 ? nm.store.galleryLinks.length-1 : 0);
1101
+ }
1102
+ return undefined;
1103
+ }
1104
+ }
1105
+ });
1106
+ });
1107
+ /*
1108
+ * nyroModal v2.0.0
1109
+ *
1110
+ * Link filter
1111
+ *
1112
+ * Depends:
1113
+ *
1114
+ * Before: filters.gallery
1115
+ */
1116
+ jQuery(function($, undefined) {
1117
+ $.nmFilters({
1118
+ link: {
1119
+ is: function(nm) {
1120
+ var ret = nm.opener.is('[href]');
1121
+ if (ret)
1122
+ nm.store.link = nm.getInternal()._extractUrl(nm.opener.attr('href'));
1123
+ return ret;
1124
+ },
1125
+ init: function(nm) {
1126
+ nm.loadFilter = 'link';
1127
+ nm.opener.unbind('click.nyroModal').bind('click.nyroModal', function(e) {
1128
+ e.preventDefault();
1129
+ nm.opener.trigger('nyroModal');
1130
+ });
1131
+ },
1132
+ load: function(nm) {
1133
+ $.ajax({
1134
+ url: nm.store.link.url,
1135
+ data: nm.store.link.sel ? [{name: nm.selIndicator, value: nm.store.link.sel.substring(1)}] : undefined,
1136
+ success: function(data) {
1137
+ nm._setCont(data, nm.store.link.sel);
1138
+ },
1139
+ error: function() {
1140
+ nm._error();
1141
+ }
1142
+ });
1143
+ }
1144
+ }
1145
+ });
1146
+ });
1147
+ /*
1148
+ * nyroModal v2.0.0
1149
+ *
1150
+ * Dom filter
1151
+ *
1152
+ * Depends:
1153
+ * - filters.link
1154
+ *
1155
+ * Before: filters.link
1156
+ */
1157
+ jQuery(function($, undefined) {
1158
+ $.nmFilters({
1159
+ dom: {
1160
+ is: function(nm) {
1161
+ return nm._hasFilter('link') && !nm.store.link.url && nm.store.link.sel;
1162
+ },
1163
+ init: function(nm) {
1164
+ nm.loadFilter = 'dom';
1165
+ },
1166
+ load: function(nm) {
1167
+ nm.store.domEl = $(nm.store.link.sel);
1168
+ if (nm.store.domEl.length)
1169
+ nm._setCont(nm.store.domEl.contents());
1170
+ else
1171
+ nm._error();
1172
+ },
1173
+ close: function(nm) {
1174
+ if (nm.store.domEl && nm.elts.cont)
1175
+ nm.store.domEl.append(nm.elts.cont.find('.nyroModalDom').contents());
1176
+ }
1177
+ }
1178
+ });
1179
+ });
1180
+ /*
1181
+ * nyroModal v2.0.0
1182
+ *
1183
+ * Data filter
1184
+ *
1185
+ * Depends:
1186
+ * - filters.link
1187
+ *
1188
+ * Before: filters.dom
1189
+ */
1190
+ jQuery(function($, undefined) {
1191
+ $.nmFilters({
1192
+ data: {
1193
+ is: function(nm) {
1194
+ var ret = nm.data ? true : false;
1195
+ if (ret) {
1196
+ nm._delFilter('dom');
1197
+ }
1198
+ return ret;
1199
+ },
1200
+ init: function(nm) {
1201
+ nm.loadFilter = 'data';
1202
+ },
1203
+ load: function(nm) {
1204
+ nm._setCont(nm.data);
1205
+ }
1206
+ }
1207
+ });
1208
+ });
1209
+ /*
1210
+ * nyroModal v2.0.0
1211
+ *
1212
+ * Image filter
1213
+ *
1214
+ * Depends:
1215
+ * - filters.link
1216
+ *
1217
+ * Before: filters.data
1218
+ */
1219
+ jQuery(function($, undefined) {
1220
+ $.nmFilters({
1221
+ image: {
1222
+ is: function(nm) {
1223
+ return (new RegExp(nm.imageRegex, 'i')).test(nm.opener.attr('href'));
1224
+ },
1225
+ init: function(nm) {
1226
+ nm.loadFilter = 'image';
1227
+ },
1228
+ load: function(nm) {
1229
+ var url = nm.opener.attr('href');
1230
+ $('<img />')
1231
+ .load(function() {
1232
+ nm.elts.cont.addClass('nyroModalImg');
1233
+ nm.elts.hidden.addClass('nyroModalImg');
1234
+ nm._setCont(this);
1235
+ }).error(function() {
1236
+ nm._error();
1237
+ })
1238
+ .attr('src', url);
1239
+ },
1240
+ size: function(nm) {
1241
+ if (nm.sizes.w != nm.sizes.initW || nm.sizes.h != nm.sizes.initH) {
1242
+ var ratio = Math.min(nm.sizes.w/nm.sizes.initW, nm.sizes.h/nm.sizes.initH);
1243
+ nm.sizes.w = nm.sizes.initW * ratio;
1244
+ nm.sizes.h = nm.sizes.initH * ratio;
1245
+ }
1246
+ var img = nm.loading ? nm.elts.hidden.find('img') : nm.elts.cont.find('img');
1247
+ img.attr({
1248
+ width: nm.sizes.w,
1249
+ height: nm.sizes.h
1250
+ });
1251
+ },
1252
+ close: function(nm) {
1253
+ if (nm.elts.cont) {
1254
+ nm.elts.cont.removeClass('nyroModalImg');
1255
+ nm.elts.hidden.removeClass('nyroModalImg');
1256
+ }
1257
+ }
1258
+ }
1259
+ });
1260
+ });
1261
+ /*
1262
+ * nyroModal v2.0.0
1263
+ *
1264
+ * SWF filter
1265
+ *
1266
+ * Depends:
1267
+ * - filters.link
1268
+ *
1269
+ * Before: filters.image
1270
+ */
1271
+ jQuery(function($, undefined) {
1272
+ $.nmFilters({
1273
+ swf: {
1274
+ is: function(nm) {
1275
+ return nm._hasFilter('link') && nm.opener.is('[href$=.swf]');
1276
+ },
1277
+ init: function(nm) {
1278
+ nm.loadFilter = 'swf';
1279
+ },
1280
+ load: function(nm) {
1281
+ var url = nm.store.link.url,
1282
+ cont = '<div><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+nm.sizes.w+'" height="'+nm.sizes.h+'"><param name="movie" value="'+url+'"></param>',
1283
+ tmp = '';
1284
+ $.each(nm.swf, function(name, val) {
1285
+ cont+= '<param name="'+name+'" value="'+val+'"></param>';
1286
+ tmp+= ' '+name+'="'+val+'"';
1287
+ });
1288
+ cont+= '<embed src="'+url+'" type="application/x-shockwave-flash" width="'+nm.sizes.w+'" height="'+nm.sizes.h+'"'+tmp+'></embed></object></div>';
1289
+ nm._setCont(cont);
1290
+ }
1291
+ }
1292
+ });
1293
+ });
1294
+ /*
1295
+ * nyroModal v2.0.0
1296
+ *
1297
+ * Form filter
1298
+ *
1299
+ * Depends:
1300
+ *
1301
+ * Before: filters.swf
1302
+ */
1303
+ jQuery(function($, undefined) {
1304
+ $.nmFilters({
1305
+ form: {
1306
+ is: function(nm) {
1307
+ var ret = nm.opener.is('form');
1308
+ if (ret)
1309
+ nm.store.form = nm.getInternal()._extractUrl(nm.opener.attr('action'));
1310
+ return ret;
1311
+ },
1312
+ init: function(nm) {
1313
+ nm.loadFilter = 'form';
1314
+ nm.opener.unbind('submit.nyroModal').bind('submit.nyroModal', function(e) {
1315
+ e.preventDefault();
1316
+ nm.opener.trigger('nyroModal');
1317
+ });
1318
+ },
1319
+ load: function(nm) {
1320
+ var data = nm.opener.serializeArray();
1321
+ if (nm.store.form.sel)
1322
+ data.push({name: nm.selIndicator, value: nm.store.form.sel.substring(1)});
1323
+ $.ajax({
1324
+ url: nm.store.form.url,
1325
+ data: data,
1326
+ type: nm.opener.attr('method') ? nm.opener.attr('method') : 'get',
1327
+ success: function(data) {
1328
+ nm._setCont(data, nm.store.form.sel);
1329
+ },
1330
+ error: function() {
1331
+ nm._error();
1332
+ }
1333
+ });
1334
+ }
1335
+ }
1336
+ });
1337
+ });
1338
+ /*
1339
+ * nyroModal v2.0.0
1340
+ *
1341
+ * Form file filter
1342
+ *
1343
+ * Depends:
1344
+ *
1345
+ * Before: filters.form
1346
+ */
1347
+ jQuery(function($, undefined) {
1348
+ $.nmFilters({
1349
+ formFile: {
1350
+ is: function(nm) {
1351
+ var ret = nm.opener.is('form[enctype="multipart/form-data"]');
1352
+ if (ret) {
1353
+ nm._delFilter('form');
1354
+ if (!nm.store.form)
1355
+ nm.store.form = nm.getInternal()._extractUrl(nm.opener.attr('action'));
1356
+ }
1357
+ return ret;
1358
+ },
1359
+ init: function(nm) {
1360
+ nm.loadFilter = 'formFile';
1361
+ nm.store.formFileLoading = false;
1362
+ nm.opener.unbind('submit.nyroModal').bind('submit.nyroModal', function(e) {
1363
+ if (!nm.store.formFileIframe) {
1364
+ e.preventDefault();
1365
+ nm.opener.trigger('nyroModal');
1366
+ } else {
1367
+ nm.store.formFileLoading = true;
1368
+ }
1369
+ });
1370
+ },
1371
+ initElts: function(nm) {
1372
+ var inputSel;
1373
+ if (nm.store.form.sel)
1374
+ inputSel = $('<input />', {
1375
+ 'type': 'hidden',
1376
+ name: nm.selIndicator,
1377
+ value: nm.store.form.sel.substring(1)
1378
+ }).appendTo(nm.opener);
1379
+ function rmFormFileElts() {
1380
+ if (inputSel) {
1381
+ inputSel.remove();
1382
+ inputSel = undefined;
1383
+ delete(inputSel);
1384
+ }
1385
+ nm.store.formFileIframe.attr('src', 'about:blank').remove();
1386
+ nm.store.formFileIframe = undefined;
1387
+ delete(nm.store.formFileIframe);
1388
+ }
1389
+ nm.store.formFileIframe = $('<iframe name="nyroModalFormFile" src="javascript:\'\';" id="nyromodal-iframe-'+(new Date().getTime())+'"></iframe>')
1390
+ .hide()
1391
+ .load(function() {
1392
+ if (nm.store.formFileLoading) {
1393
+ nm.store.formFileLoading = false;
1394
+ var content = nm.store.formFileIframe
1395
+ .unbind('load error')
1396
+ .contents().find('body').not('script[src]');
1397
+ if (content && content.html() && content.html().length) {
1398
+ rmFormFileElts();
1399
+ nm._setCont(content.html(), nm.store.form.sel);
1400
+ } else {
1401
+ // Not totally ready, try it in a few secs
1402
+ var nbTry = 0;
1403
+ fct = function() {
1404
+ nbTry++;
1405
+ var content = nm.store.formFileIframe
1406
+ .unbind('load error')
1407
+ .contents().find('body').not('script[src]');
1408
+ if (content && content.html() && content.html().length) {
1409
+ nm._setCont(content.html(), nm.store.form.sel);
1410
+ rmFormFileElts();
1411
+ } else if (nbTry < 5) {
1412
+ setTimeout(fct, 25);
1413
+ } else {
1414
+ rmFormFileElts();
1415
+ nm._error();
1416
+ }
1417
+ };
1418
+ setTimeout(fct, 25);
1419
+ }
1420
+ }
1421
+ })
1422
+ .error(function() {
1423
+ rmFormFileElts();
1424
+ nm._error();
1425
+ });
1426
+ nm.elts.all.append(nm.store.formFileIframe);
1427
+ nm.opener
1428
+ .attr('target', 'nyroModalFormFile')
1429
+ .submit();
1430
+ },
1431
+ close: function(nm) {
1432
+ nm.store.formFileLoading = false;
1433
+ if (nm.store.formFileIframe) {
1434
+ nm.store.formFileIframe.remove();
1435
+ nm.store.formFileIframe = undefined;
1436
+ delete(nm.store.formFileIframe);
1437
+ }
1438
+ }
1439
+ }
1440
+ });
1441
+ });
1442
+ /*
1443
+ * nyroModal v2.0.0
1444
+ *
1445
+ * Iframe filter
1446
+ *
1447
+ * Depends:
1448
+ * - filters.link
1449
+ *
1450
+ * Before: filters.formFile
1451
+ */
1452
+ jQuery(function($, undefined) {
1453
+ $.nmFilters({
1454
+ iframe: {
1455
+ is: function(nm) {
1456
+ var target = nm.opener.attr('target') || '',
1457
+ rel = nm.opener.attr('rel') || '',
1458
+ opener = nm.opener.get(0);
1459
+ return !nm._hasFilter('image') && (target.toLowerCase() == '_blank'
1460
+ || rel.toLowerCase().indexOf('external') > -1
1461
+ || (opener.hostname && opener.hostname.replace(/:\d*$/,'') != window.location.hostname.replace(/:\d*$/,'')));
1462
+ },
1463
+ init: function(nm) {
1464
+ nm.loadFilter = 'iframe';
1465
+ },
1466
+ load: function(nm) {
1467
+ nm.store.iframe = $('<iframe src="javascript:\'\';" id="nyromodal-iframe-'+(new Date().getTime())+'"></iframe>');
1468
+ nm._setCont(nm.store.iframe);
1469
+ },
1470
+ afterShowCont: function(nm) {
1471
+ nm.store.iframe.attr('src', nm.opener.attr('href'));
1472
+ },
1473
+ close: function(nm) {
1474
+ if (nm.store.iframe) {
1475
+ nm.store.iframe.remove();
1476
+ nm.store.iframe = undefined;
1477
+ delete(nm.store.iframe);
1478
+ }
1479
+ }
1480
+ }
1481
+ });
1482
+ });
1483
+ /*
1484
+ * nyroModal v2.0.0
1485
+ *
1486
+ * Iframe form filter
1487
+ *
1488
+ * Depends:
1489
+ * - filters.iframe
1490
+ *
1491
+ * Before: filters.iframe
1492
+ */
1493
+ jQuery(function($, undefined) {
1494
+ $.nmFilters({
1495
+ iframeForm: {
1496
+ is: function(nm) {
1497
+ var ret = nm._hasFilter('iframe') && nm.opener.is('form');
1498
+ if (ret) {
1499
+ nm._delFilter('iframe');
1500
+ nm._delFilter('form');
1501
+ }
1502
+ return ret;
1503
+ },
1504
+ init: function(nm) {
1505
+ nm.loadFilter = 'iframeForm';
1506
+ nm.store.iframeFormLoading = false;
1507
+ nm.store.iframeFormOrgTarget = nm.opener.attr('target');
1508
+ nm.opener.unbind('submit.nyroModal').bind('submit.nyroModal', function(e) {
1509
+ if (!nm.store.iframeFormIframe) {
1510
+ e.preventDefault();
1511
+ nm.opener.trigger('nyroModal');
1512
+ } else {
1513
+ nm.store.iframeFormLoading = true;
1514
+ }
1515
+ });
1516
+ },
1517
+ load: function(nm) {
1518
+ nm.store.iframeFormIframe = $('<iframe name="nyroModalIframeForm" src="javascript:\'\';" id="nyromodal-iframe-'+(new Date().getTime())+'"></iframe>');
1519
+ nm._setCont(nm.store.iframeFormIframe);
1520
+ },
1521
+ afterShowCont: function(nm) {
1522
+ nm.opener
1523
+ .attr('target', 'nyroModalIframeForm')
1524
+ .submit();
1525
+ },
1526
+ close: function(nm) {
1527
+ nm.store.iframeFormOrgTarget ? nm.opener.attr('target', nm.store.iframeFormOrgTarget) : nm.opener.removeAttr('target');
1528
+ delete(nm.store.formFileLoading);
1529
+ delete(nm.store.iframeFormOrgTarget);
1530
+ if (nm.store.iframeFormIframe) {
1531
+ nm.store.iframeFormIframe.remove();
1532
+ nm.store.iframeFormIframe = undefined;
1533
+ delete(nm.store.iframeFormIframe);
1534
+ }
1535
+ }
1536
+ }
1537
+ });
1538
+ });
1539
+ /*
1540
+ * nyroModal v2.0.0
1541
+ *
1542
+ * Embedly filter
1543
+ *
1544
+ * Depends:
1545
+ * - filters.link
1546
+ *
1547
+ * Before: filters.iframeForm
1548
+ */
1549
+ jQuery(function($, undefined) {
1550
+ $.nmFilters({
1551
+ embedly: {
1552
+ is: function(nm) {
1553
+ // Regex from https://github.com/embedly/embedly-jquery
1554
+ var embedlyReg = /http:\/\/(.*youtube\.com\/watch.*|.*\.youtube\.com\/v\/.*|youtu\.be\/.*|.*\.youtube\.com\/user\/.*|.*\.youtube\.com\/.*#.*\/.*|m\.youtube\.com\/watch.*|m\.youtube\.com\/index.*|.*\.youtube\.com\/profile.*|.*justin\.tv\/.*|.*justin\.tv\/.*\/b\/.*|.*justin\.tv\/.*\/w\/.*|www\.ustream\.tv\/recorded\/.*|www\.ustream\.tv\/channel\/.*|www\.ustream\.tv\/.*|qik\.com\/video\/.*|qik\.com\/.*|qik\.ly\/.*|.*revision3\.com\/.*|.*\.dailymotion\.com\/video\/.*|.*\.dailymotion\.com\/.*\/video\/.*|www\.collegehumor\.com\/video:.*|.*twitvid\.com\/.*|www\.break\.com\/.*\/.*|vids\.myspace\.com\/index\.cfm\?fuseaction=vids\.individual&videoid.*|www\.myspace\.com\/index\.cfm\?fuseaction=.*&videoid.*|www\.metacafe\.com\/watch\/.*|www\.metacafe\.com\/w\/.*|blip\.tv\/file\/.*|.*\.blip\.tv\/file\/.*|video\.google\.com\/videoplay\?.*|.*revver\.com\/video\/.*|video\.yahoo\.com\/watch\/.*\/.*|video\.yahoo\.com\/network\/.*|.*viddler\.com\/explore\/.*\/videos\/.*|liveleak\.com\/view\?.*|www\.liveleak\.com\/view\?.*|animoto\.com\/play\/.*|dotsub\.com\/view\/.*|www\.overstream\.net\/view\.php\?oid=.*|www\.livestream\.com\/.*|www\.worldstarhiphop\.com\/videos\/video.*\.php\?v=.*|worldstarhiphop\.com\/videos\/video.*\.php\?v=.*|teachertube\.com\/viewVideo\.php.*|www\.teachertube\.com\/viewVideo\.php.*|www1\.teachertube\.com\/viewVideo\.php.*|www2\.teachertube\.com\/viewVideo\.php.*|bambuser\.com\/v\/.*|bambuser\.com\/channel\/.*|bambuser\.com\/channel\/.*\/broadcast\/.*|www\.schooltube\.com\/video\/.*\/.*|bigthink\.com\/ideas\/.*|bigthink\.com\/series\/.*|sendables\.jibjab\.com\/view\/.*|sendables\.jibjab\.com\/originals\/.*|www\.xtranormal\.com\/watch\/.*|dipdive\.com\/media\/.*|dipdive\.com\/member\/.*\/media\/.*|dipdive\.com\/v\/.*|.*\.dipdive\.com\/media\/.*|.*\.dipdive\.com\/v\/.*|.*yfrog\..*\/.*|tweetphoto\.com\/.*|www\.flickr\.com\/photos\/.*|flic\.kr\/.*|twitpic\.com\/.*|www\.twitpic\.com\/.*|twitpic\.com\/photos\/.*|www\.twitpic\.com\/photos\/.*|.*imgur\.com\/.*|.*\.posterous\.com\/.*|post\.ly\/.*|twitgoo\.com\/.*|i.*\.photobucket\.com\/albums\/.*|s.*\.photobucket\.com\/albums\/.*|phodroid\.com\/.*\/.*\/.*|www\.mobypicture\.com\/user\/.*\/view\/.*|moby\.to\/.*|xkcd\.com\/.*|www\.xkcd\.com\/.*|imgs\.xkcd\.com\/.*|www\.asofterworld\.com\/index\.php\?id=.*|www\.asofterworld\.com\/.*\.jpg|asofterworld\.com\/.*\.jpg|www\.qwantz\.com\/index\.php\?comic=.*|23hq\.com\/.*\/photo\/.*|www\.23hq\.com\/.*\/photo\/.*|.*dribbble\.com\/shots\/.*|drbl\.in\/.*|.*\.smugmug\.com\/.*|.*\.smugmug\.com\/.*#.*|emberapp\.com\/.*\/images\/.*|emberapp\.com\/.*\/images\/.*\/sizes\/.*|emberapp\.com\/.*\/collections\/.*\/.*|emberapp\.com\/.*\/categories\/.*\/.*\/.*|embr\.it\/.*|picasaweb\.google\.com.*\/.*\/.*#.*|picasaweb\.google\.com.*\/lh\/photo\/.*|picasaweb\.google\.com.*\/.*\/.*|dailybooth\.com\/.*\/.*|brizzly\.com\/pic\/.*|pics\.brizzly\.com\/.*\.jpg|img\.ly\/.*|www\.tinypic\.com\/view\.php.*|tinypic\.com\/view\.php.*|www\.tinypic\.com\/player\.php.*|tinypic\.com\/player\.php.*|www\.tinypic\.com\/r\/.*\/.*|tinypic\.com\/r\/.*\/.*|.*\.tinypic\.com\/.*\.jpg|.*\.tinypic\.com\/.*\.png|meadd\.com\/.*\/.*|meadd\.com\/.*|.*\.deviantart\.com\/art\/.*|.*\.deviantart\.com\/gallery\/.*|.*\.deviantart\.com\/#\/.*|fav\.me\/.*|.*\.deviantart\.com|.*\.deviantart\.com\/gallery|.*\.deviantart\.com\/.*\/.*\.jpg|.*\.deviantart\.com\/.*\/.*\.gif|.*\.deviantart\.net\/.*\/.*\.jpg|.*\.deviantart\.net\/.*\/.*\.gif|plixi\.com\/p\/.*|plixi\.com\/profile\/home\/.*|plixi\.com\/.*|www\.fotopedia\.com\/.*\/.*|fotopedia\.com\/.*\/.*|photozou\.jp\/photo\/show\/.*\/.*|photozou\.jp\/photo\/photo_only\/.*\/.*|instagr\.am\/p\/.*|skitch\.com\/.*\/.*\/.*|img\.skitch\.com\/.*|https:\/\/skitch\.com\/.*\/.*\/.*|https:\/\/img\.skitch\.com\/.*|share\.ovi\.com\/media\/.*\/.*|www\.questionablecontent\.net\/|questionablecontent\.net\/|www\.questionablecontent\.net\/view\.php.*|questionablecontent\.net\/view\.php.*|questionablecontent\.net\/comics\/.*\.png|www\.questionablecontent\.net\/comics\/.*\.png|picplz\.com\/user\/.*\/pic\/.*\/|twitrpix\.com\/.*|.*\.twitrpix\.com\/.*|www\.someecards\.com\/.*\/.*|someecards\.com\/.*\/.*|some\.ly\/.*|www\.some\.ly\/.*|pikchur\.com\/.*|achewood\.com\/.*|www\.achewood\.com\/.*|achewood\.com\/index\.php.*|www\.achewood\.com\/index\.php.*|www\.whitehouse\.gov\/photos-and-video\/video\/.*|www\.whitehouse\.gov\/video\/.*|wh\.gov\/photos-and-video\/video\/.*|wh\.gov\/video\/.*|www\.hulu\.com\/watch.*|www\.hulu\.com\/w\/.*|hulu\.com\/watch.*|hulu\.com\/w\/.*|.*crackle\.com\/c\/.*|www\.fancast\.com\/.*\/videos|www\.funnyordie\.com\/videos\/.*|www\.funnyordie\.com\/m\/.*|funnyordie\.com\/videos\/.*|funnyordie\.com\/m\/.*|www\.vimeo\.com\/groups\/.*\/videos\/.*|www\.vimeo\.com\/.*|vimeo\.com\/m\/#\/featured\/.*|vimeo\.com\/groups\/.*\/videos\/.*|vimeo\.com\/.*|vimeo\.com\/m\/#\/featured\/.*|www\.ted\.com\/talks\/.*\.html.*|www\.ted\.com\/talks\/lang\/.*\/.*\.html.*|www\.ted\.com\/index\.php\/talks\/.*\.html.*|www\.ted\.com\/index\.php\/talks\/lang\/.*\/.*\.html.*|.*nfb\.ca\/film\/.*|www\.thedailyshow\.com\/watch\/.*|www\.thedailyshow\.com\/full-episodes\/.*|www\.thedailyshow\.com\/collection\/.*\/.*\/.*|movies\.yahoo\.com\/movie\/.*\/video\/.*|movies\.yahoo\.com\/movie\/.*\/trailer|movies\.yahoo\.com\/movie\/.*\/video|www\.colbertnation\.com\/the-colbert-report-collections\/.*|www\.colbertnation\.com\/full-episodes\/.*|www\.colbertnation\.com\/the-colbert-report-videos\/.*|www\.comedycentral\.com\/videos\/index\.jhtml\?.*|www\.theonion\.com\/video\/.*|theonion\.com\/video\/.*|wordpress\.tv\/.*\/.*\/.*\/.*\/|www\.traileraddict\.com\/trailer\/.*|www\.traileraddict\.com\/clip\/.*|www\.traileraddict\.com\/poster\/.*|www\.escapistmagazine\.com\/videos\/.*|www\.trailerspy\.com\/trailer\/.*\/.*|www\.trailerspy\.com\/trailer\/.*|www\.trailerspy\.com\/view_video\.php.*|www\.atom\.com\/.*\/.*\/|fora\.tv\/.*\/.*\/.*\/.*|www\.spike\.com\/video\/.*|www\.gametrailers\.com\/video\/.*|gametrailers\.com\/video\/.*|www\.koldcast\.tv\/video\/.*|www\.koldcast\.tv\/#video:.*|techcrunch\.tv\/watch.*|techcrunch\.tv\/.*\/watch.*|mixergy\.com\/.*|video\.pbs\.org\/video\/.*|www\.zapiks\.com\/.*|tv\.digg\.com\/diggnation\/.*|tv\.digg\.com\/diggreel\/.*|tv\.digg\.com\/diggdialogg\/.*|www\.trutv\.com\/video\/.*|www\.nzonscreen\.com\/title\/.*|nzonscreen\.com\/title\/.*|app\.wistia\.com\/embed\/medias\/.*|https:\/\/app\.wistia\.com\/embed\/medias\/.*|www\.godtube\.com\/featured\/video\/.*|godtube\.com\/featured\/video\/.*|www\.godtube\.com\/watch\/.*|godtube\.com\/watch\/.*|www\.tangle\.com\/view_video.*|mediamatters\.org\/mmtv\/.*|www\.clikthrough\.com\/theater\/video\/.*|soundcloud\.com\/.*|soundcloud\.com\/.*\/.*|soundcloud\.com\/.*\/sets\/.*|soundcloud\.com\/groups\/.*|snd\.sc\/.*|www\.last\.fm\/music\/.*|www\.last\.fm\/music\/+videos\/.*|www\.last\.fm\/music\/+images\/.*|www\.last\.fm\/music\/.*\/_\/.*|www\.last\.fm\/music\/.*\/.*|www\.mixcloud\.com\/.*\/.*\/|www\.radionomy\.com\/.*\/radio\/.*|radionomy\.com\/.*\/radio\/.*|www\.entertonement\.com\/clips\/.*|www\.rdio\.com\/#\/artist\/.*\/album\/.*|www\.rdio\.com\/artist\/.*\/album\/.*|www\.zero-inch\.com\/.*|.*\.bandcamp\.com\/|.*\.bandcamp\.com\/track\/.*|.*\.bandcamp\.com\/album\/.*|freemusicarchive\.org\/music\/.*|www\.freemusicarchive\.org\/music\/.*|freemusicarchive\.org\/curator\/.*|www\.freemusicarchive\.org\/curator\/.*|www\.npr\.org\/.*\/.*\/.*\/.*\/.*|www\.npr\.org\/.*\/.*\/.*\/.*\/.*\/.*|www\.npr\.org\/.*\/.*\/.*\/.*\/.*\/.*\/.*|www\.npr\.org\/templates\/story\/story\.php.*|huffduffer\.com\/.*\/.*|www\.audioboo\.fm\/boos\/.*|audioboo\.fm\/boos\/.*|boo\.fm\/b.*|www\.xiami\.com\/song\/.*|xiami\.com\/song\/.*|espn\.go\.com\/video\/clip.*|espn\.go\.com\/.*\/story.*|abcnews\.com\/.*\/video\/.*|abcnews\.com\/video\/playerIndex.*|washingtonpost\.com\/wp-dyn\/.*\/video\/.*\/.*\/.*\/.*|www\.washingtonpost\.com\/wp-dyn\/.*\/video\/.*\/.*\/.*\/.*|www\.boston\.com\/video.*|boston\.com\/video.*|www\.facebook\.com\/photo\.php.*|www\.facebook\.com\/video\/video\.php.*|www\.facebook\.com\/v\/.*|cnbc\.com\/id\/.*\?.*video.*|www\.cnbc\.com\/id\/.*\?.*video.*|cnbc\.com\/id\/.*\/play\/1\/video\/.*|www\.cnbc\.com\/id\/.*\/play\/1\/video\/.*|cbsnews\.com\/video\/watch\/.*|www\.google\.com\/buzz\/.*\/.*\/.*|www\.google\.com\/buzz\/.*|www\.google\.com\/profiles\/.*|google\.com\/buzz\/.*\/.*\/.*|google\.com\/buzz\/.*|google\.com\/profiles\/.*|www\.cnn\.com\/video\/.*|edition\.cnn\.com\/video\/.*|money\.cnn\.com\/video\/.*|today\.msnbc\.msn\.com\/id\/.*\/vp\/.*|www\.msnbc\.msn\.com\/id\/.*\/vp\/.*|www\.msnbc\.msn\.com\/id\/.*\/ns\/.*|today\.msnbc\.msn\.com\/id\/.*\/ns\/.*|multimedia\.foxsports\.com\/m\/video\/.*\/.*|msn\.foxsports\.com\/video.*|www\.globalpost\.com\/video\/.*|www\.globalpost\.com\/dispatch\/.*|.*amazon\..*\/gp\/product\/.*|.*amazon\..*\/.*\/dp\/.*|.*amazon\..*\/dp\/.*|.*amazon\..*\/o\/ASIN\/.*|.*amazon\..*\/gp\/offer-listing\/.*|.*amazon\..*\/.*\/ASIN\/.*|.*amazon\..*\/gp\/product\/images\/.*|www\.amzn\.com\/.*|amzn\.com\/.*|www\.shopstyle\.com\/browse.*|www\.shopstyle\.com\/action\/apiVisitRetailer.*|www\.shopstyle\.com\/action\/viewLook.*|gist\.github\.com\/.*|twitter\.com\/.*\/status\/.*|twitter\.com\/.*\/statuses\/.*|mobile\.twitter\.com\/.*\/status\/.*|mobile\.twitter\.com\/.*\/statuses\/.*|www\.crunchbase\.com\/.*\/.*|crunchbase\.com\/.*\/.*|www\.slideshare\.net\/.*\/.*|www\.slideshare\.net\/mobile\/.*\/.*|.*\.scribd\.com\/doc\/.*|screenr\.com\/.*|polldaddy\.com\/community\/poll\/.*|polldaddy\.com\/poll\/.*|answers\.polldaddy\.com\/poll\/.*|www\.5min\.com\/Video\/.*|www\.howcast\.com\/videos\/.*|www\.screencast\.com\/.*\/media\/.*|screencast\.com\/.*\/media\/.*|www\.screencast\.com\/t\/.*|screencast\.com\/t\/.*|issuu\.com\/.*\/docs\/.*|www\.kickstarter\.com\/projects\/.*\/.*|www\.scrapblog\.com\/viewer\/viewer\.aspx.*|ping\.fm\/p\/.*|chart\.ly\/.*|maps\.google\.com\/maps\?.*|maps\.google\.com\/\?.*|maps\.google\.com\/maps\/ms\?.*|.*\.craigslist\.org\/.*\/.*|my\.opera\.com\/.*\/albums\/show\.dml\?id=.*|my\.opera\.com\/.*\/albums\/showpic\.dml\?album=.*&picture=.*|tumblr\.com\/.*|.*\.tumblr\.com\/post\/.*|www\.polleverywhere\.com\/polls\/.*|www\.polleverywhere\.com\/multiple_choice_polls\/.*|www\.polleverywhere\.com\/free_text_polls\/.*|www\.quantcast\.com\/wd:.*|www\.quantcast\.com\/.*|siteanalytics\.compete\.com\/.*|statsheet\.com\/statplot\/charts\/.*\/.*\/.*\/.*|statsheet\.com\/statplot\/charts\/e\/.*|statsheet\.com\/.*\/teams\/.*\/.*|statsheet\.com\/tools\/chartlets\?chart=.*|.*\.status\.net\/notice\/.*|identi\.ca\/notice\/.*|brainbird\.net\/notice\/.*|shitmydadsays\.com\/notice\/.*|www\.studivz\.net\/Profile\/.*|www\.studivz\.net\/l\/.*|www\.studivz\.net\/Groups\/Overview\/.*|www\.studivz\.net\/Gadgets\/Info\/.*|www\.studivz\.net\/Gadgets\/Install\/.*|www\.studivz\.net\/.*|www\.meinvz\.net\/Profile\/.*|www\.meinvz\.net\/l\/.*|www\.meinvz\.net\/Groups\/Overview\/.*|www\.meinvz\.net\/Gadgets\/Info\/.*|www\.meinvz\.net\/Gadgets\/Install\/.*|www\.meinvz\.net\/.*|www\.schuelervz\.net\/Profile\/.*|www\.schuelervz\.net\/l\/.*|www\.schuelervz\.net\/Groups\/Overview\/.*|www\.schuelervz\.net\/Gadgets\/Info\/.*|www\.schuelervz\.net\/Gadgets\/Install\/.*|www\.schuelervz\.net\/.*|myloc\.me\/.*|pastebin\.com\/.*|pastie\.org\/.*|www\.pastie\.org\/.*|redux\.com\/stream\/item\/.*\/.*|redux\.com\/f\/.*\/.*|www\.redux\.com\/stream\/item\/.*\/.*|www\.redux\.com\/f\/.*\/.*|cl\.ly\/.*|cl\.ly\/.*\/content|speakerdeck\.com\/u\/.*\/p\/.*|www\.kiva\.org\/lend\/.*|www\.timetoast\.com\/timelines\/.*|storify\.com\/.*\/.*|.*meetup\.com\/.*|meetu\.ps\/.*|www\.dailymile\.com\/people\/.*\/entries\/.*|.*\.kinomap\.com\/.*|www\.metacdn\.com\/api\/users\/.*\/content\/.*|www\.metacdn\.com\/api\/users\/.*\/media\/.*|prezi\.com\/.*\/.*|.*\.uservoice\.com\/.*\/suggestions\/.*)/i;
1555
+ var ret = nm._hasFilter('link') && nm.opener.attr('href') && nm.opener.attr('href').match(embedlyReg) !== null;
1556
+ if (ret)
1557
+ nm._delFilter('iframe');
1558
+ return ret;
1559
+ },
1560
+ init: function(nm) {
1561
+ nm.loadFilter = 'embedly';
1562
+ nm.store.embedly = {};
1563
+ },
1564
+ load: function(nm) {
1565
+ $.ajax({
1566
+ url: 'http://api.embed.ly/1/oembed',
1567
+ dataType: 'jsonp',
1568
+ data: 'wmode=transparent&url='+nm.opener.attr('href'),
1569
+ success: function(data) {
1570
+ if (data.type == 'error')
1571
+ nm._error();
1572
+ else if (data.type == 'photo') {
1573
+ nm.filters.push('image');
1574
+ $('<img />')
1575
+ .load(function() {
1576
+ nm.elts.cont.addClass('nyroModalImg');
1577
+ nm.elts.hidden.addClass('nyroModalImg');
1578
+ nm._setCont(this);
1579
+ }).error(function() {
1580
+ nm._error();
1581
+ })
1582
+ .attr('src', data.url);
1583
+ } else {
1584
+ nm.store.embedly.w = data.width;
1585
+ nm.store.embedly.h = data.height;
1586
+ nm._setCont('<div>'+data.html+'</div>');
1587
+ }
1588
+ }
1589
+ });
1590
+ },
1591
+ size: function(nm) {
1592
+ if (nm.store.embedly.w && !nm.sizes.h) {
1593
+ nm.sizes.w = nm.store.embedly.w;
1594
+ nm.sizes.h = nm.store.embedly.h;
1595
+ }
1596
+ }
1597
+ }
1598
+ });
1599
+ });