carrier 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (257) hide show
  1. data/.document +5 -0
  2. data/.rspec +1 -0
  3. data/Gemfile +27 -0
  4. data/LICENSE.txt +20 -0
  5. data/MIT-LICENSE +20 -0
  6. data/README.textile +111 -0
  7. data/Rakefile +48 -0
  8. data/VERSION +1 -0
  9. data/app/assets/images/.gitkeep +0 -0
  10. data/app/assets/javascripts/autocomplete.js +4 -0
  11. data/app/assets/javascripts/autocomplete/i18n/jquery-ui-i18n.js +1379 -0
  12. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-af.js +23 -0
  13. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-ar-DZ.js +23 -0
  14. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-ar.js +23 -0
  15. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-az.js +23 -0
  16. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-bg.js +24 -0
  17. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-bs.js +23 -0
  18. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-ca.js +23 -0
  19. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-cs.js +23 -0
  20. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-da.js +23 -0
  21. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-de.js +23 -0
  22. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-el.js +23 -0
  23. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-en-AU.js +23 -0
  24. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-en-GB.js +23 -0
  25. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-en-NZ.js +23 -0
  26. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-eo.js +23 -0
  27. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-es.js +23 -0
  28. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-et.js +23 -0
  29. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-eu.js +23 -0
  30. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-fa.js +23 -0
  31. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-fi.js +23 -0
  32. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-fo.js +23 -0
  33. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-fr-CH.js +23 -0
  34. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-fr.js +25 -0
  35. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-gl.js +23 -0
  36. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-he.js +23 -0
  37. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-hr.js +23 -0
  38. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-hu.js +23 -0
  39. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-hy.js +23 -0
  40. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-id.js +23 -0
  41. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-is.js +23 -0
  42. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-it.js +23 -0
  43. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-ja.js +23 -0
  44. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-ko.js +23 -0
  45. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-kz.js +23 -0
  46. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-lt.js +23 -0
  47. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-lv.js +23 -0
  48. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-ml.js +23 -0
  49. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-ms.js +23 -0
  50. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-nl.js +23 -0
  51. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-no.js +23 -0
  52. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-pl.js +23 -0
  53. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-pt-BR.js +23 -0
  54. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-pt.js +22 -0
  55. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-rm.js +21 -0
  56. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-ro.js +26 -0
  57. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-ru.js +23 -0
  58. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-sk.js +23 -0
  59. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-sl.js +24 -0
  60. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-sq.js +23 -0
  61. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-sr-SR.js +23 -0
  62. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-sr.js +23 -0
  63. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-sv.js +23 -0
  64. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-ta.js +23 -0
  65. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-th.js +23 -0
  66. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-tj.js +23 -0
  67. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-tr.js +23 -0
  68. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-uk.js +23 -0
  69. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-vi.js +23 -0
  70. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-zh-CN.js +23 -0
  71. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-zh-HK.js +23 -0
  72. data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-zh-TW.js +23 -0
  73. data/app/assets/javascripts/autocomplete/jquery.ui.autocomplete.min.js +32 -0
  74. data/app/assets/javascripts/autocomplete/jquery.ui.core.min.js +17 -0
  75. data/app/assets/javascripts/autocomplete/jquery.ui.position.min.js +16 -0
  76. data/app/assets/javascripts/autocomplete/jquery.ui.widget.min.js +15 -0
  77. data/app/assets/javascripts/carrier.js +8 -0
  78. data/app/assets/javascripts/jquery.min.js +16 -0
  79. data/app/assets/javascripts/rails.js +169 -0
  80. data/app/assets/javascripts/rich-multiselect/jquery-ui.min.js +405 -0
  81. data/app/assets/javascripts/rich-multiselect/locale/ui-multiselect-de.js +11 -0
  82. data/app/assets/javascripts/rich-multiselect/locale/ui-multiselect-en.js +11 -0
  83. data/app/assets/javascripts/rich-multiselect/locale/ui-multiselect-es.js +11 -0
  84. data/app/assets/javascripts/rich-multiselect/locale/ui-multiselect-fr.js +11 -0
  85. data/app/assets/javascripts/rich-multiselect/locale/ui-multiselect-it.js +13 -0
  86. data/app/assets/javascripts/rich-multiselect/plugins/localisation/jquery.localisation-min.js +7 -0
  87. data/app/assets/javascripts/rich-multiselect/plugins/localisation/jquery.localisation-pack.js +7 -0
  88. data/app/assets/javascripts/rich-multiselect/plugins/localisation/jquery.localisation.js +99 -0
  89. data/app/assets/javascripts/rich-multiselect/plugins/scrollTo/README.txt +37 -0
  90. data/app/assets/javascripts/rich-multiselect/plugins/scrollTo/changes.txt +82 -0
  91. data/app/assets/javascripts/rich-multiselect/plugins/scrollTo/jquery.scrollTo-min.js +11 -0
  92. data/app/assets/javascripts/rich-multiselect/plugins/scrollTo/jquery.scrollTo.js +207 -0
  93. data/app/assets/javascripts/rich-multiselect/ui.multiselect.js +339 -0
  94. data/app/assets/stylesheets/carrier.css +227 -0
  95. data/app/assets/stylesheets/carrier_rich.css +48 -0
  96. data/app/assets/stylesheets/carrier_simple.css +15 -0
  97. data/app/assets/stylesheets/rich-multiselect/ui.multiselect.css +30 -0
  98. data/app/assets/stylesheets/ui-lightness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  99. data/app/assets/stylesheets/ui-lightness/images/ui-bg_flat_55_fbf9ee_40x100.png +0 -0
  100. data/app/assets/stylesheets/ui-lightness/images/ui-bg_flat_65_ffffff_40x100.png +0 -0
  101. data/app/assets/stylesheets/ui-lightness/images/ui-bg_flat_75_cccccc_40x100.png +0 -0
  102. data/app/assets/stylesheets/ui-lightness/images/ui-bg_flat_75_dadada_40x100.png +0 -0
  103. data/app/assets/stylesheets/ui-lightness/images/ui-bg_flat_75_e6e6e6_40x100.png +0 -0
  104. data/app/assets/stylesheets/ui-lightness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  105. data/app/assets/stylesheets/ui-lightness/images/ui-bg_flat_95_fef1ec_40x100.png +0 -0
  106. data/app/assets/stylesheets/ui-lightness/images/ui-icons_222222_256x240.png +0 -0
  107. data/app/assets/stylesheets/ui-lightness/images/ui-icons_2e83ff_256x240.png +0 -0
  108. data/app/assets/stylesheets/ui-lightness/images/ui-icons_454545_256x240.png +0 -0
  109. data/app/assets/stylesheets/ui-lightness/images/ui-icons_888888_256x240.png +0 -0
  110. data/app/assets/stylesheets/ui-lightness/images/ui-icons_cd0a0a_256x240.png +0 -0
  111. data/app/assets/stylesheets/ui-lightness/jquery-ui-1.8.14.custom.css +342 -0
  112. data/app/controllers/carrier/application_controller.rb +5 -0
  113. data/app/controllers/carrier/chains_controller.rb +16 -0
  114. data/app/controllers/carrier/messages_controller.rb +59 -0
  115. data/app/helpers/carrier/application_helper.rb +26 -0
  116. data/app/helpers/carrier/post_helper.rb +4 -0
  117. data/app/models/carrier/chain.rb +59 -0
  118. data/app/models/carrier/message.rb +118 -0
  119. data/app/models/carrier/message/scopes.rb +51 -0
  120. data/app/models/carrier/message/subject.rb +25 -0
  121. data/app/models/carrier/message/validations.rb +7 -0
  122. data/app/validators/recipients/exclude_self.rb +10 -0
  123. data/app/validators/recipients/recipients_validator.rb +10 -0
  124. data/app/views/carrier/chains/archive.js.erb +1 -0
  125. data/app/views/carrier/chains/unarchive.js.erb +1 -0
  126. data/app/views/carrier/messages/_archive_chain.html.erb +6 -0
  127. data/app/views/carrier/messages/_form.html.erb +30 -0
  128. data/app/views/carrier/messages/_head.html.erb +8 -0
  129. data/app/views/carrier/messages/_index_message.html.erb +13 -0
  130. data/app/views/carrier/messages/_message_collapsed.html.erb +12 -0
  131. data/app/views/carrier/messages/_message_expanded.html.erb +10 -0
  132. data/app/views/carrier/messages/_nav_messages.html.erb +15 -0
  133. data/app/views/carrier/messages/_reply.html.erb +19 -0
  134. data/app/views/carrier/messages/as_sent.html.erb +36 -0
  135. data/app/views/carrier/messages/collapsed.js.erb +1 -0
  136. data/app/views/carrier/messages/create.js.erb +1 -0
  137. data/app/views/carrier/messages/expanded.js.erb +1 -0
  138. data/app/views/carrier/messages/index.html.erb +9 -0
  139. data/app/views/carrier/messages/new.html.erb +7 -0
  140. data/app/views/carrier/messages/new.js.erb +1 -0
  141. data/app/views/carrier/messages/reply.js.erb +6 -0
  142. data/app/views/carrier/messages/rich/_multiselect.html.erb +18 -0
  143. data/app/views/carrier/messages/rich/_recipients.html.erb +6 -0
  144. data/app/views/carrier/messages/show.html.erb +35 -0
  145. data/app/views/carrier/messages/simple/_autocomplete.html.erb +45 -0
  146. data/app/views/carrier/messages/simple/_autocomplete_includes.html.erb +7 -0
  147. data/app/views/carrier/messages/simple/_recipients.html.erb +3 -0
  148. data/app/views/layouts/carrier/application.html.erb +16 -0
  149. data/app/views/partials/_error_messages_for.html.erb +9 -0
  150. data/carrier.gemspec +331 -0
  151. data/config/locales/carrier.en.yml +48 -0
  152. data/config/locales/carrier.ru.yml +48 -0
  153. data/config/routes.rb +24 -0
  154. data/db/migrate/001_create_messages.rb +26 -0
  155. data/db/migrate/002_create_chains.rb +34 -0
  156. data/db/migrate/003_create_read_marks +16 -0
  157. data/lib/carrier.rb +22 -0
  158. data/lib/carrier/configuration.rb +35 -0
  159. data/lib/carrier/configuration/models.rb +31 -0
  160. data/lib/carrier/configuration/ui.rb +28 -0
  161. data/lib/carrier/rails.rb +5 -0
  162. data/lib/carrier/rails/engine.rb +50 -0
  163. data/lib/carrier/rails/helpers.rb +30 -0
  164. data/lib/tasks/carrier_tasks.rake +4 -0
  165. data/script/rails +6 -0
  166. data/spec/carrier/app/controllers/application_controller_spec.rb +1 -0
  167. data/spec/carrier/app/models/message_scopes_spec.rb +25 -0
  168. data/spec/carrier/app/models/message_spec.rb +38 -0
  169. data/spec/dummy/Rakefile +7 -0
  170. data/spec/dummy/app/assets/javascripts/application.js +9 -0
  171. data/spec/dummy/app/assets/javascripts/default.js +2 -0
  172. data/spec/dummy/app/assets/javascripts/jquery.js +16 -0
  173. data/spec/dummy/app/assets/javascripts/jquery_ujs.js +169 -0
  174. data/spec/dummy/app/assets/javascripts/posts.js +2 -0
  175. data/spec/dummy/app/assets/stylesheets/application.css +7 -0
  176. data/spec/dummy/app/assets/stylesheets/default.css +4 -0
  177. data/spec/dummy/app/assets/stylesheets/posts.css +4 -0
  178. data/spec/dummy/app/assets/stylesheets/scaffold.css +56 -0
  179. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  180. data/spec/dummy/app/controllers/default_controller.rb +5 -0
  181. data/spec/dummy/app/controllers/posts_controller.rb +83 -0
  182. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  183. data/spec/dummy/app/helpers/default_helper.rb +2 -0
  184. data/spec/dummy/app/helpers/posts_helper.rb +2 -0
  185. data/spec/dummy/app/mailers/.gitkeep +0 -0
  186. data/spec/dummy/app/models/.gitkeep +0 -0
  187. data/spec/dummy/app/models/post.rb +2 -0
  188. data/spec/dummy/app/models/user.rb +15 -0
  189. data/spec/dummy/app/views/default/index.html.erb +4 -0
  190. data/spec/dummy/app/views/devise/confirmations/new.html.erb +12 -0
  191. data/spec/dummy/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
  192. data/spec/dummy/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
  193. data/spec/dummy/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
  194. data/spec/dummy/app/views/devise/passwords/edit.html.erb +16 -0
  195. data/spec/dummy/app/views/devise/passwords/new.html.erb +12 -0
  196. data/spec/dummy/app/views/devise/registrations/edit.html.erb +25 -0
  197. data/spec/dummy/app/views/devise/registrations/new.html.erb +18 -0
  198. data/spec/dummy/app/views/devise/sessions/new.html.erb +17 -0
  199. data/spec/dummy/app/views/devise/shared/_links.erb +25 -0
  200. data/spec/dummy/app/views/devise/unlocks/new.html.erb +12 -0
  201. data/spec/dummy/app/views/layouts/application.html.erb +16 -0
  202. data/spec/dummy/app/views/posts/_form.html.erb +17 -0
  203. data/spec/dummy/app/views/posts/edit.html.erb +6 -0
  204. data/spec/dummy/app/views/posts/index.html.erb +21 -0
  205. data/spec/dummy/app/views/posts/new.html.erb +5 -0
  206. data/spec/dummy/app/views/posts/show.html.erb +5 -0
  207. data/spec/dummy/config.ru +4 -0
  208. data/spec/dummy/config/application.rb +51 -0
  209. data/spec/dummy/config/boot.rb +10 -0
  210. data/spec/dummy/config/database.yml +26 -0
  211. data/spec/dummy/config/database_mysql.yml +29 -0
  212. data/spec/dummy/config/database_pgsql.yml +35 -0
  213. data/spec/dummy/config/environment.rb +5 -0
  214. data/spec/dummy/config/environments/development.rb +24 -0
  215. data/spec/dummy/config/environments/production.rb +52 -0
  216. data/spec/dummy/config/environments/test.rb +39 -0
  217. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  218. data/spec/dummy/config/initializers/carrier.rb +3 -0
  219. data/spec/dummy/config/initializers/devise.rb +204 -0
  220. data/spec/dummy/config/initializers/inflections.rb +10 -0
  221. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  222. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  223. data/spec/dummy/config/initializers/session_store.rb +8 -0
  224. data/spec/dummy/config/initializers/wrap_parameters.rb +12 -0
  225. data/spec/dummy/config/locales/devise.en.yml +53 -0
  226. data/spec/dummy/config/locales/en.yml +5 -0
  227. data/spec/dummy/config/routes.rb +15 -0
  228. data/spec/dummy/db/migrate/007_devise_create_users.rb +29 -0
  229. data/spec/dummy/db/migrate/20110130210000_create_read_marks.rb +16 -0
  230. data/spec/dummy/db/migrate/20110814064637_create_posts.rb +8 -0
  231. data/spec/dummy/db/migrate/20110814164228_create_messages.rb +26 -0
  232. data/spec/dummy/db/migrate/20110814164229_create_chains.rb +34 -0
  233. data/spec/dummy/db/schema.rb +79 -0
  234. data/spec/dummy/db/seeds.rb +26 -0
  235. data/spec/dummy/log/.gitkeep +0 -0
  236. data/spec/dummy/public/404.html +26 -0
  237. data/spec/dummy/public/422.html +26 -0
  238. data/spec/dummy/public/500.html +26 -0
  239. data/spec/dummy/public/favicon.ico +0 -0
  240. data/spec/dummy/script/rails +6 -0
  241. data/spec/dummy/test/fixtures/posts.yml +11 -0
  242. data/spec/dummy/test/fixtures/users.yml +11 -0
  243. data/spec/dummy/test/functional/default_controller_test.rb +9 -0
  244. data/spec/dummy/test/functional/posts_controller_test.rb +49 -0
  245. data/spec/dummy/test/unit/helpers/default_helper_test.rb +4 -0
  246. data/spec/dummy/test/unit/helpers/posts_helper_test.rb +4 -0
  247. data/spec/dummy/test/unit/post_test.rb +7 -0
  248. data/spec/dummy/test/unit/user_test.rb +7 -0
  249. data/spec/dummy_spec_helper.rb +70 -0
  250. data/spec/integration/carrier_spec.rb +71 -0
  251. data/spec/requests/main_spec.rb +31 -0
  252. data/spec/support/controller_macros.rb +10 -0
  253. data/spec/support/factories.rb +47 -0
  254. data/spec/support/rspec_helpers.rb +22 -0
  255. data/test/helper.rb +18 -0
  256. data/test/test_carrier.rb +7 -0
  257. metadata +450 -0
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Localization strings for the UI Multiselect widget
3
+ *
4
+ * @locale de, de-DE, de-AT, de-CH
5
+ */
6
+
7
+ $.extend($.ui.multiselect.locale, {
8
+ addAll:'Alle hinzufügen',
9
+ removeAll:'Alle entfernen',
10
+ itemsCount:'Einträge ausgewählt'
11
+ });
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Localization strings for the UI Multiselect widget
3
+ *
4
+ * @locale en, en-US
5
+ */
6
+
7
+ $.extend($.ui.multiselect.locale, {
8
+ addAll:'Add all',
9
+ removeAll:'Remove all',
10
+ itemsCount:'items selected'
11
+ });
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Localization strings for the UI Multiselect widget
3
+ *
4
+ * @locale es, es-ES
5
+ */
6
+
7
+ $.extend($.ui.multiselect.locale, {
8
+ addAll:'Agregar todos',
9
+ removeAll:'Remover todos',
10
+ itemsCount:'Objetos seleccionados'
11
+ });
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Localization strings for the UI Multiselect widget
3
+ *
4
+ * @locale fr, fr-FR, fr-CA
5
+ */
6
+
7
+ $.extend($.ui.multiselect.locale, {
8
+ addAll:'Ajouter tout',
9
+ removeAll:'Supprimer tout',
10
+ itemsCount:'items sélectionnés'
11
+ });
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Localization strings for the UI Multiselect widget
3
+ *
4
+ * @locale it, it-IT
5
+ */
6
+
7
+ $.extend($.ui.multiselect, {
8
+ locale: {
9
+ addAll:'Aggiungi tutti',
10
+ removeAll:'Rimuovi tutti',
11
+ itemsCount:'elementi selezionati'
12
+ }
13
+ });
@@ -0,0 +1,7 @@
1
+ /* http://keith-wood.name/localisation.html
2
+ Localisation assistance for jQuery v1.0.4.
3
+ Written by Keith Wood (kbwood{at}iinet.com.au) June 2007.
4
+ Dual licensed under the GPL (http://dev.jquery.com/browser/trunk/jquery/GPL-LICENSE.txt) and
5
+ MIT (http://dev.jquery.com/browser/trunk/jquery/MIT-LICENSE.txt) licenses.
6
+ Please attribute the author if you use it. */
7
+ (function($){$.localise=function(c,d,e,f,g){if(typeof d!='object'&&typeof d!='string'){g=f;f=e;e=d;d=''}if(typeof e!='boolean'){g=f;f=e;e=false}if(typeof f!='string'&&!isArray(f)){g=f;f=['','']}var h={async:$.ajaxSettings.async,timeout:$.ajaxSettings.timeout};d=(typeof d!='string'?d||{}:{language:d,loadBase:e,path:f,timeout:g});var j=(!d.path?['','']:(isArray(d.path)?d.path:[d.path,d.path]));$.ajaxSetup({async:false,timeout:(d.timeout||500)});var k=function(a,b){if(d.loadBase){$.getScript(j[0]+a+'.js')}if(b.length>=2){$.getScript(j[1]+a+'-'+b.substring(0,2)+'.js')}if(b.length>=5){$.getScript(j[1]+a+'-'+b.substring(0,5)+'.js')}};var l=normaliseLang(d.language||$.localise.defaultLanguage);c=(isArray(c)?c:[c]);for(i=0;i<c.length;i++){k(c[i],l)}$.ajaxSetup(h)};$.localize=$.localise;$.localise.defaultLanguage=normaliseLang(navigator.language||navigator.userLanguage);function normaliseLang(a){a=a.replace(/_/,'-').toLowerCase();if(a.length>3){a=a.substring(0,3)+a.substring(3).toUpperCase()}return a}function isArray(a){return(a&&a.constructor==Array)}})(jQuery);
@@ -0,0 +1,7 @@
1
+ /* http://keith-wood.name/localisation.html
2
+ Localisation assistance for jQuery v1.0.4.
3
+ Written by Keith Wood (kbwood{at}iinet.com.au) June 2007.
4
+ Dual licensed under the GPL (http://dev.jquery.com/browser/trunk/jquery/GPL-LICENSE.txt) and
5
+ MIT (http://dev.jquery.com/browser/trunk/jquery/MIT-LICENSE.txt) licenses.
6
+ Please attribute the author if you use it. */
7
+ eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(7($){$.m=7(c,d,e,f,g){4(8 d!=\'E\'&&8 d!=\'r\'){g=f;f=e;e=d;d=\'\'}4(8 e!=\'F\'){g=f;f=e;e=x}4(8 f!=\'r\'&&!n(f)){g=f;f=[\'\',\'\']}o h={s:$.y.s,9:$.y.9};d=(8 d!=\'r\'?d||{}:{t:d,z:e,6:f,9:g});o j=(!d.6?[\'\',\'\']:(n(d.6)?d.6:[d.6,d.6]));$.A({s:x,9:(d.9||G)});o k=7(a,b){4(d.z){$.u(j[0]+a+\'.v\')}4(b.p>=2){$.u(j[1]+a+\'-\'+b.q(0,2)+\'.v\')}4(b.p>=5){$.u(j[1]+a+\'-\'+b.q(0,5)+\'.v\')}};o l=w(d.t||$.m.B);c=(n(c)?c:[c]);H(i=0;i<c.p;i++){k(c[i],l)}$.A(h)};$.I=$.m;$.m.B=w(C.t||C.J);7 w(a){a=a.K(/L/,\'-\').M();4(a.p>3){a=a.q(0,3)+a.q(3).N()}D a}7 n(a){D(a&&a.O==P)}})(Q);',53,53,'||||if||path|function|typeof|timeout|||||||||||||localise|isArray|var|length|substring|string|async|language|getScript|js|normaliseLang|false|ajaxSettings|loadBase|ajaxSetup|defaultLanguage|navigator|return|object|boolean|500|for|localize|userLanguage|replace|_|toLowerCase|toUpperCase|constructor|Array|jQuery'.split('|'),0,{}))
@@ -0,0 +1,99 @@
1
+ /* http://keith-wood.name/localisation.html
2
+ Localisation assistance for jQuery v1.0.4.
3
+ Written by Keith Wood (kbwood{at}iinet.com.au) June 2007.
4
+ Dual licensed under the GPL (http://dev.jquery.com/browser/trunk/jquery/GPL-LICENSE.txt) and
5
+ MIT (http://dev.jquery.com/browser/trunk/jquery/MIT-LICENSE.txt) licenses.
6
+ Please attribute the author if you use it. */
7
+
8
+ (function($) { // Hide scope, no $ conflict
9
+
10
+ /* Load applicable localisation package(s) for one or more jQuery packages.
11
+ Assumes that the localisations are named <base>-<lang>.js
12
+ and loads them in order from least to most specific.
13
+ For example, $.localise('mypackage');
14
+ with the browser set to 'en-US' would attempt to load
15
+ mypackage-en.js and mypackage-en-US.js.
16
+ Also accepts an array of package names to process.
17
+ Optionally specify whether or not to include the base file,
18
+ the desired language, and/or the timeout period, e.g.
19
+ $.localise(['mypackage1', 'yourpackage'],
20
+ {loadBase: true; language: 'en-AU', timeout: 300});
21
+ @param packages (string or string[]) names of package(s) to load
22
+ @param settings omit for the current browser language or
23
+ (string) code for the language to load (aa[-AA]) or
24
+ (object} options for the call with
25
+ language (string) the code for the language
26
+ loadBase (boolean) true to also load the base package or false (default) to not
27
+ path (string or string[2]) the paths to the JavaScript,
28
+ either as both or [base, localisations]
29
+ timeout (number) the time period in milliseconds (default 500)
30
+ @param loadBase (boolean, optional) true to also load the base package or false (default) to not -
31
+ omit this if settings is an object
32
+ @param path (string or string[2], optional) the paths to the JavaScript,
33
+ either as both or [base, localisations] -
34
+ omit this if settings is an object
35
+ @param timeout (number, optional) the time period in milliseconds (default 500) -
36
+ omit this if settings is an object */
37
+ $.localise = function(packages, settings, loadBase, path, timeout) {
38
+ if (typeof settings != 'object' && typeof settings != 'string') {
39
+ timeout = path;
40
+ path = loadBase;
41
+ loadBase = settings;
42
+ settings = '';
43
+ }
44
+ if (typeof loadBase != 'boolean') {
45
+ timeout = path;
46
+ path = loadBase;
47
+ loadBase = false;
48
+ }
49
+ if (typeof path != 'string' && !isArray(path)) {
50
+ timeout = path;
51
+ path = ['', ''];
52
+ }
53
+ var saveSettings = {async: $.ajaxSettings.async, timeout: $.ajaxSettings.timeout};
54
+ settings = (typeof settings != 'string' ? settings || {} :
55
+ {language: settings, loadBase: loadBase, path: path, timeout: timeout});
56
+ var paths = (!settings.path ? ['', ''] :
57
+ (isArray(settings.path) ? settings.path : [settings.path, settings.path]));
58
+ $.ajaxSetup({async: false, timeout: (settings.timeout || 500)});
59
+ var localiseOne = function(package, lang) {
60
+ if (settings.loadBase) {
61
+ $.getScript(paths[0] + package + '.js');
62
+ }
63
+ if (lang.length >= 2) {
64
+ $.getScript(paths[1] + package + '-' + lang.substring(0, 2) + '.js');
65
+ }
66
+ if (lang.length >= 5) {
67
+ $.getScript(paths[1] + package + '-' + lang.substring(0, 5) + '.js');
68
+ }
69
+ };
70
+ var lang = normaliseLang(settings.language || $.localise.defaultLanguage);
71
+ packages = (isArray(packages) ? packages : [packages]);
72
+ for (i = 0; i < packages.length; i++) {
73
+ localiseOne(packages[i], lang);
74
+ }
75
+ $.ajaxSetup(saveSettings);
76
+ };
77
+
78
+ // Localise it!
79
+ $.localize = $.localise;
80
+
81
+ /* Retrieve the default language set for the browser. */
82
+ $.localise.defaultLanguage = normaliseLang(navigator.language /* Mozilla */ ||
83
+ navigator.userLanguage /* IE */);
84
+
85
+ /* Ensure language code is in the format aa-AA. */
86
+ function normaliseLang(lang) {
87
+ lang = lang.replace(/_/, '-').toLowerCase();
88
+ if (lang.length > 3) {
89
+ lang = lang.substring(0, 3) + lang.substring(3).toUpperCase();
90
+ }
91
+ return lang;
92
+ }
93
+
94
+ /* Determine whether an object is an array. */
95
+ function isArray(a) {
96
+ return (a && a.constructor == Array);
97
+ }
98
+
99
+ })(jQuery);
@@ -0,0 +1,37 @@
1
+ jQuery.ScrollTo 1.4
2
+
3
+ * Apart from the target and duration, the plugin can receive a hash of settings. Documentation and examples are included in the source file.
4
+
5
+ * If you are interested in animated "same-page-scrolling" using anchors(<a href="#some_id">...), check http://jquery.com/plugins/project/LocalScroll
6
+
7
+ * The target can be specified as:
8
+ * A Number/String specifying a position using px or just the number.
9
+ * A string selector that will be relative, to the element that is going to be scrolled, and must match at least one child.
10
+ * A DOM element, logically child of the element to scroll.
11
+ * A hash { top:x, left:y }, x and y can be any kind of number/string like described above.
12
+
13
+ * The plugin supports relative animations
14
+
15
+ * 'em' and '%' are not supported as part of the target, because they won't work with jQuery.fn.animate.
16
+
17
+ * The plugin might fail to scroll an element, to an inner node that is nested in more scrollable elements. This seems like an odd situation anyway.
18
+
19
+ * Both axes ( x, y -> left, top ) can be scrolled, you can send 'x', 'y', 'xy' or 'yx' as 'axis' inside the settings.
20
+
21
+ * If 2 axis are scrolled, there's an option to queue the animations, so that the second will start once the first ended ('xy' and 'yx' will have different effects)
22
+
23
+ * The option 'margin' can be setted to true, then the margin of the target element, will be taken into account and will be deducted.
24
+
25
+ * 'margin' will only be valid, if the target is a selector, a DOM element, or a jQuery Object.
26
+
27
+ * The option 'offset' allows to scroll less or more than the actual target by a defined amount of pixels. Can be a number(both axes) or { top:x, left:y }.
28
+
29
+ * The option 'over' lets you add or deduct a fraction of the element's height and width from the final position. so over:0.5 will scroll to the middle of the object. can be specified with {top:x, left:y}
30
+
31
+ * Don't forget the callback event is now called 'onAfter', and if queuing is activated, then 'onAfterFirst' can be used.
32
+
33
+ * If the first axis to be scrolled, is already positioned, that animation will be skipped, to avoid a delay in the animation.
34
+
35
+ * The call to the plugin can be made in 2 different ways: $().scrollTo( target, duration, settings ) or $().scrollTo( target, settings ). Where one of the settings is 'duration'.
36
+
37
+ * If you find any bug, or you have any advice, don't hesitate to open a ticket/request at http://jquery.com/plugins/project/ScrollTo .
@@ -0,0 +1,82 @@
1
+ 1.4.1
2
+ [Feature]
3
+ - The target can be 'max' to scroll to the end while keeping it elegant.
4
+ [Enhancement]
5
+ - Default duration is 0 for jquery +1.3. Means sync animation
6
+ - The plugin works on all major browsers, on compat & quirks modes, including iframes.
7
+ - In addition to window/document, if html or body are received, the plugin will choose the right one.
8
+ [Fix]
9
+ - The Regex accepts floating numbers, Thanks Ramin
10
+ - Using jQuery.nodeName where neccessary so that this works on xml+xhtml
11
+ - The max() internal function wasn't completely accurrate, now it is 98% (except for IE on quirks mode and it's not too noticeable).
12
+
13
+ 1.4
14
+ [Fix]
15
+ - Fixed the problem when scrolling the window to absolute positioned elements on Safari.
16
+ - Fixed the problem on Opera 9.5 when scrolling the window. That it always scrolls to 0.
17
+ [Feature]
18
+ - Added the settings object as 2nd argument to the onAfter callback.
19
+ - The 3rd argument of scrollTo can be just a function and it's used as the onAfter.
20
+ - Added full support for iframes (even max scroll calculation).
21
+ - Instead of $.scrollTo, $(window).scrollTo() and $(document).scrollTo() can be used.
22
+ - Added $().scrollable() that returns the real element to scroll, f.e: $(window).scrollable() == [body|html], works for iframes.
23
+ [Enhancement]
24
+ - Cleaned the code a bit, specially the comments
25
+
26
+ 1.3.3
27
+ [Change]
28
+ - Changed the licensing from GPL to GPL+MIT.
29
+
30
+ 1.3.2
31
+ [Enhancement]
32
+ - Small improvements to make the code shorter.
33
+ [Change]
34
+ - Removed the last argument received by onAfter as it was the same as the 'this' but jqueryfied.
35
+
36
+ 1.3.1
37
+ [Feature]
38
+ - Exposed $.scrollTo.window() to get the element that needs to be animated, to scroll the window.
39
+ - Added option 'over'.
40
+ [Enhancement]
41
+ - Made the code as short as possible.
42
+ [Change]
43
+ - Changed the arguments received by onAfter
44
+
45
+ 1.3
46
+ [Enhancement]
47
+ - Added semicolon to the start, for safe file concatenation
48
+ - Added a limit check, values below 0 or over the maximum are fixed.
49
+ - Now it should work faster, only one of html or body go through all the processing, instead of both for all browsers.
50
+ [Fix]
51
+ - Fixed the behavior for Opera, which seemed to react to both changes on <html> and <body>.
52
+ - The border is also reduced, when 'margin' is set to true.
53
+ [Change]
54
+ - The option speed has been renamed to duration.
55
+ [Feature]
56
+ - The duration can be specified with a number as 2nd argument, and the rest of the settings as the third ( like $().animate )
57
+ - Remade the demo
58
+
59
+ 1.2.4
60
+ [Enhancement]
61
+ - The target can be in the form of { top:x, left:y } allowing different position for each axis.
62
+ [Feature]
63
+ - The option 'offset' has been added, to scroll behind or past the target. Can be a number(both axes) or { top:x, left:y }.
64
+
65
+ 1.2.3
66
+ [Feature]
67
+ - Exposed the defaults.
68
+ [Enhancement]
69
+ - Made the callback functions receive more parameters.
70
+
71
+ 1.2.2
72
+ [Fix]
73
+ - Fixed a bug, I didn't have to add the scrolled amount if it was body or html.
74
+
75
+ 1.2
76
+ [Change]
77
+ - The option 'onafter' is now called 'onAfter'.
78
+ [Feature]
79
+ - Two axes can be scrolled together, this is set with the option 'axis'.
80
+ - In case 2 axes are chosen, the scrolling can be queued: one scrolls, and then the other.
81
+ - There's an intermediary event, 'onAfterFirst' called in case the axes are queued, after the first ends.
82
+ - If the option 'margin' is set to true, the plugin will take in account, the margin of the target(no use if target is a value).
@@ -0,0 +1,11 @@
1
+ /**
2
+ * jQuery.ScrollTo - Easy element scrolling using jQuery.
3
+ * Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
4
+ * Dual licensed under MIT and GPL.
5
+ * Date: 3/9/2009
6
+ * @author Ariel Flesler
7
+ * @version 1.4.1
8
+ *
9
+ * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
10
+ */
11
+ ;(function($){var m=$.scrollTo=function(b,h,f){$(window).scrollTo(b,h,f)};m.defaults={axis:'xy',duration:parseFloat($.fn.jquery)>=1.3?0:1};m.window=function(b){return $(window).scrollable()};$.fn.scrollable=function(){return this.map(function(){var b=this,h=!b.nodeName||$.inArray(b.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!h)return b;var f=(b.contentWindow||b).document||b.ownerDocument||b;return $.browser.safari||f.compatMode=='BackCompat'?f.body:f.documentElement})};$.fn.scrollTo=function(l,j,a){if(typeof j=='object'){a=j;j=0}if(typeof a=='function')a={onAfter:a};if(l=='max')l=9e9;a=$.extend({},m.defaults,a);j=j||a.speed||a.duration;a.queue=a.queue&&a.axis.length>1;if(a.queue)j/=2;a.offset=n(a.offset);a.over=n(a.over);return this.scrollable().each(function(){var k=this,o=$(k),d=l,p,g={},q=o.is('html,body');switch(typeof d){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px)?$/.test(d)){d=n(d);break}d=$(d,this);case'object':if(d.is||d.style)p=(d=$(d)).offset()}$.each(a.axis.split(''),function(b,h){var f=h=='x'?'Left':'Top',i=f.toLowerCase(),c='scroll'+f,r=k[c],s=h=='x'?'Width':'Height';if(p){g[c]=p[i]+(q?0:r-o.offset()[i]);if(a.margin){g[c]-=parseInt(d.css('margin'+f))||0;g[c]-=parseInt(d.css('border'+f+'Width'))||0}g[c]+=a.offset[i]||0;if(a.over[i])g[c]+=d[s.toLowerCase()]()*a.over[i]}else g[c]=d[i];if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],u(s));if(!b&&a.queue){if(r!=g[c])t(a.onAfterFirst);delete g[c]}});t(a.onAfter);function t(b){o.animate(g,j,a.easing,b&&function(){b.call(this,l,a)})};function u(b){var h='scroll'+b;if(!q)return k[h];var f='client'+b,i=k.ownerDocument.documentElement,c=k.ownerDocument.body;return Math.max(i[h],c[h])-Math.min(i[f],c[f])}}).end()};function n(b){return typeof b=='object'?b:{top:b,left:b}}})(jQuery);
@@ -0,0 +1,207 @@
1
+ /**
2
+ * jQuery.ScrollTo
3
+ * Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
4
+ * Dual licensed under MIT and GPL.
5
+ * Date: 3/9/2009
6
+ *
7
+ * @projectDescription Easy element scrolling using jQuery.
8
+ * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
9
+ * Works with jQuery +1.2.6. Tested on FF 2/3, IE 6/7, Opera 9.5/6, Safari 3, Chrome 1 on WinXP.
10
+ *
11
+ * @author Ariel Flesler
12
+ * @version 1.4.1
13
+ *
14
+ * @id jQuery.scrollTo
15
+ * @id jQuery.fn.scrollTo
16
+ * @param {String, Number, DOMElement, jQuery, Object} target Where to scroll the matched elements.
17
+ * The different options for target are:
18
+ * - A number position (will be applied to all axes).
19
+ * - A string position ('44', '100px', '+=90', etc ) will be applied to all axes
20
+ * - A jQuery/DOM element ( logically, child of the element to scroll )
21
+ * - A string selector, that will be relative to the element to scroll ( 'li:eq(2)', etc )
22
+ * - A hash { top:x, left:y }, x and y can be any kind of number/string like above.
23
+ * @param {Number} duration The OVERALL length of the animation, this argument can be the settings object instead.
24
+ * @param {Object,Function} settings Optional set of settings or the onAfter callback.
25
+ * @option {String} axis Which axis must be scrolled, use 'x', 'y', 'xy' or 'yx'.
26
+ * @option {Number} duration The OVERALL length of the animation.
27
+ * @option {String} easing The easing method for the animation.
28
+ * @option {Boolean} margin If true, the margin of the target element will be deducted from the final position.
29
+ * @option {Object, Number} offset Add/deduct from the end position. One number for both axes or { top:x, left:y }.
30
+ * @option {Object, Number} over Add/deduct the height/width multiplied by 'over', can be { top:x, left:y } when using both axes.
31
+ * @option {Boolean} queue If true, and both axis are given, the 2nd axis will only be animated after the first one ends.
32
+ * @option {Function} onAfter Function to be called after the scrolling ends.
33
+ * @option {Function} onAfterFirst If queuing is activated, this function will be called after the first scrolling ends.
34
+ * @return {jQuery} Returns the same jQuery object, for chaining.
35
+ *
36
+ * @desc Scroll to a fixed position
37
+ * @example $('div').scrollTo( 340 );
38
+ *
39
+ * @desc Scroll relatively to the actual position
40
+ * @example $('div').scrollTo( '+=340px', { axis:'y' } );
41
+ *
42
+ * @dec Scroll using a selector (relative to the scrolled element)
43
+ * @example $('div').scrollTo( 'p.paragraph:eq(2)', 500, { easing:'swing', queue:true, axis:'xy' } );
44
+ *
45
+ * @ Scroll to a DOM element (same for jQuery object)
46
+ * @example var second_child = document.getElementById('container').firstChild.nextSibling;
47
+ * $('#container').scrollTo( second_child, { duration:500, axis:'x', onAfter:function(){
48
+ * alert('scrolled!!');
49
+ * }});
50
+ *
51
+ * @desc Scroll on both axes, to different values
52
+ * @example $('div').scrollTo( { top: 300, left:'+=200' }, { axis:'xy', offset:-20 } );
53
+ */
54
+ ;(function( $ ){
55
+
56
+ var $scrollTo = $.scrollTo = function( target, duration, settings ){
57
+ $(window).scrollTo( target, duration, settings );
58
+ };
59
+
60
+ $scrollTo.defaults = {
61
+ axis:'xy',
62
+ duration: parseFloat($.fn.jquery) >= 1.3 ? 0 : 1
63
+ };
64
+
65
+ // Returns the element that needs to be animated to scroll the window.
66
+ // Kept for backwards compatibility (specially for localScroll & serialScroll)
67
+ $scrollTo.window = function( scope ){
68
+ return $(window).scrollable();
69
+ };
70
+
71
+ // Hack, hack, hack... stay away!
72
+ // Returns the real elements to scroll (supports window/iframes, documents and regular nodes)
73
+ $.fn.scrollable = function(){
74
+ return this.map(function(){
75
+ var elem = this,
76
+ isWin = !elem.nodeName || $.inArray( elem.nodeName.toLowerCase(), ['iframe','#document','html','body'] ) != -1;
77
+
78
+ if( !isWin )
79
+ return elem;
80
+
81
+ var doc = (elem.contentWindow || elem).document || elem.ownerDocument || elem;
82
+
83
+ return $.browser.safari || doc.compatMode == 'BackCompat' ?
84
+ doc.body :
85
+ doc.documentElement;
86
+ });
87
+ };
88
+
89
+ $.fn.scrollTo = function( target, duration, settings ){
90
+ if( typeof duration == 'object' ){
91
+ settings = duration;
92
+ duration = 0;
93
+ }
94
+ if( typeof settings == 'function' )
95
+ settings = { onAfter:settings };
96
+
97
+ if( target == 'max' )
98
+ target = 9e9;
99
+
100
+ settings = $.extend( {}, $scrollTo.defaults, settings );
101
+ // Speed is still recognized for backwards compatibility
102
+ duration = duration || settings.speed || settings.duration;
103
+ // Make sure the settings are given right
104
+ settings.queue = settings.queue && settings.axis.length > 1;
105
+
106
+ if( settings.queue )
107
+ // Let's keep the overall duration
108
+ duration /= 2;
109
+ settings.offset = both( settings.offset );
110
+ settings.over = both( settings.over );
111
+
112
+ return this.scrollable().each(function(){
113
+ var elem = this,
114
+ $elem = $(elem),
115
+ targ = target, toff, attr = {},
116
+ win = $elem.is('html,body');
117
+
118
+ switch( typeof targ ){
119
+ // A number will pass the regex
120
+ case 'number':
121
+ case 'string':
122
+ if( /^([+-]=)?\d+(\.\d+)?(px)?$/.test(targ) ){
123
+ targ = both( targ );
124
+ // We are done
125
+ break;
126
+ }
127
+ // Relative selector, no break!
128
+ targ = $(targ,this);
129
+ case 'object':
130
+ // DOMElement / jQuery
131
+ if( targ.is || targ.style )
132
+ // Get the real position of the target
133
+ toff = (targ = $(targ)).offset();
134
+ }
135
+ $.each( settings.axis.split(''), function( i, axis ){
136
+ var Pos = axis == 'x' ? 'Left' : 'Top',
137
+ pos = Pos.toLowerCase(),
138
+ key = 'scroll' + Pos,
139
+ old = elem[key],
140
+ Dim = axis == 'x' ? 'Width' : 'Height';
141
+
142
+ if( toff ){// jQuery / DOMElement
143
+ attr[key] = toff[pos] + ( win ? 0 : old - $elem.offset()[pos] );
144
+
145
+ // If it's a dom element, reduce the margin
146
+ if( settings.margin ){
147
+ attr[key] -= parseInt(targ.css('margin'+Pos)) || 0;
148
+ attr[key] -= parseInt(targ.css('border'+Pos+'Width')) || 0;
149
+ }
150
+
151
+ attr[key] += settings.offset[pos] || 0;
152
+
153
+ if( settings.over[pos] )
154
+ // Scroll to a fraction of its width/height
155
+ attr[key] += targ[Dim.toLowerCase()]() * settings.over[pos];
156
+ }else
157
+ attr[key] = targ[pos];
158
+
159
+ // Number or 'number'
160
+ if( /^\d+$/.test(attr[key]) )
161
+ // Check the limits
162
+ attr[key] = attr[key] <= 0 ? 0 : Math.min( attr[key], max(Dim) );
163
+
164
+ // Queueing axes
165
+ if( !i && settings.queue ){
166
+ // Don't waste time animating, if there's no need.
167
+ if( old != attr[key] )
168
+ // Intermediate animation
169
+ animate( settings.onAfterFirst );
170
+ // Don't animate this axis again in the next iteration.
171
+ delete attr[key];
172
+ }
173
+ });
174
+
175
+ animate( settings.onAfter );
176
+
177
+ function animate( callback ){
178
+ $elem.animate( attr, duration, settings.easing, callback && function(){
179
+ callback.call(this, target, settings);
180
+ });
181
+ };
182
+
183
+ // Max scrolling position, works on quirks mode
184
+ // It only fails (not too badly) on IE, quirks mode.
185
+ function max( Dim ){
186
+ var scroll = 'scroll'+Dim;
187
+
188
+ if( !win )
189
+ return elem[scroll];
190
+
191
+ var size = 'client' + Dim,
192
+ html = elem.ownerDocument.documentElement,
193
+ body = elem.ownerDocument.body;
194
+
195
+ return Math.max( html[scroll], body[scroll] )
196
+ - Math.min( html[size] , body[size] );
197
+
198
+ };
199
+
200
+ }).end();
201
+ };
202
+
203
+ function both( val ){
204
+ return typeof val == 'object' ? val : { top:val, left:val };
205
+ };
206
+
207
+ })( jQuery );