houston 2.2.3 → 2.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/Gemfile.lock +27 -24
  4. data/LICENSE +1 -1
  5. data/README.md +60 -15
  6. data/Rakefile +4 -8
  7. data/coverage/assets/{0.8.0 → 0.10.0}/application.css +0 -0
  8. data/coverage/assets/{0.8.0 → 0.10.0}/application.js +1079 -931
  9. data/coverage/assets/{0.8.0 → 0.10.0}/colorbox/border.png +0 -0
  10. data/coverage/assets/{0.8.0 → 0.10.0}/colorbox/controls.png +0 -0
  11. data/coverage/assets/{0.8.0 → 0.10.0}/colorbox/loading.gif +0 -0
  12. data/coverage/assets/{0.8.0 → 0.10.0}/colorbox/loading_background.png +0 -0
  13. data/coverage/assets/{0.7.1 → 0.10.0}/favicon_green.png +0 -0
  14. data/coverage/assets/{0.7.1 → 0.10.0}/favicon_red.png +0 -0
  15. data/coverage/assets/{0.7.1 → 0.10.0}/favicon_yellow.png +0 -0
  16. data/coverage/assets/{0.7.1 → 0.10.0}/loading.gif +0 -0
  17. data/coverage/assets/{0.7.1 → 0.10.0}/magnify.png +0 -0
  18. data/coverage/assets/{0.7.1 → 0.10.0}/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  19. data/coverage/assets/{0.7.1 → 0.10.0}/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  20. data/coverage/assets/{0.7.1 → 0.10.0}/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  21. data/coverage/assets/{0.7.1 → 0.10.0}/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  22. data/coverage/assets/{0.7.1 → 0.10.0}/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  23. data/coverage/assets/{0.7.1 → 0.10.0}/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  24. data/coverage/assets/{0.7.1 → 0.10.0}/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  25. data/coverage/assets/{0.7.1 → 0.10.0}/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  26. data/coverage/assets/{0.7.1 → 0.10.0}/smoothness/images/ui-icons_222222_256x240.png +0 -0
  27. data/coverage/assets/{0.7.1 → 0.10.0}/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  28. data/coverage/assets/{0.7.1 → 0.10.0}/smoothness/images/ui-icons_454545_256x240.png +0 -0
  29. data/coverage/assets/{0.7.1 → 0.10.0}/smoothness/images/ui-icons_888888_256x240.png +0 -0
  30. data/coverage/assets/{0.7.1 → 0.10.0}/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  31. data/coverage/index.html +296 -184
  32. data/houston.gemspec +17 -17
  33. data/lib/houston/client.rb +16 -8
  34. data/lib/houston/connection.rb +1 -1
  35. data/lib/houston/notification.rb +33 -30
  36. data/lib/houston/version.rb +1 -1
  37. data/spec/client_spec.rb +13 -13
  38. data/spec/notification_spec.rb +25 -21
  39. data/spec/spec_helper.rb +2 -2
  40. metadata +56 -97
  41. data/coverage/assets/0.7.1/application.css +0 -1110
  42. data/coverage/assets/0.7.1/application.js +0 -626
  43. data/coverage/assets/0.7.1/fancybox/blank.gif +0 -0
  44. data/coverage/assets/0.7.1/fancybox/fancy_close.png +0 -0
  45. data/coverage/assets/0.7.1/fancybox/fancy_loading.png +0 -0
  46. data/coverage/assets/0.7.1/fancybox/fancy_nav_left.png +0 -0
  47. data/coverage/assets/0.7.1/fancybox/fancy_nav_right.png +0 -0
  48. data/coverage/assets/0.7.1/fancybox/fancy_shadow_e.png +0 -0
  49. data/coverage/assets/0.7.1/fancybox/fancy_shadow_n.png +0 -0
  50. data/coverage/assets/0.7.1/fancybox/fancy_shadow_ne.png +0 -0
  51. data/coverage/assets/0.7.1/fancybox/fancy_shadow_nw.png +0 -0
  52. data/coverage/assets/0.7.1/fancybox/fancy_shadow_s.png +0 -0
  53. data/coverage/assets/0.7.1/fancybox/fancy_shadow_se.png +0 -0
  54. data/coverage/assets/0.7.1/fancybox/fancy_shadow_sw.png +0 -0
  55. data/coverage/assets/0.7.1/fancybox/fancy_shadow_w.png +0 -0
  56. data/coverage/assets/0.7.1/fancybox/fancy_title_left.png +0 -0
  57. data/coverage/assets/0.7.1/fancybox/fancy_title_main.png +0 -0
  58. data/coverage/assets/0.7.1/fancybox/fancy_title_over.png +0 -0
  59. data/coverage/assets/0.7.1/fancybox/fancy_title_right.png +0 -0
  60. data/coverage/assets/0.7.1/fancybox/fancybox-x.png +0 -0
  61. data/coverage/assets/0.7.1/fancybox/fancybox-y.png +0 -0
  62. data/coverage/assets/0.7.1/fancybox/fancybox.png +0 -0
  63. data/coverage/assets/0.8.0/favicon_green.png +0 -0
  64. data/coverage/assets/0.8.0/favicon_red.png +0 -0
  65. data/coverage/assets/0.8.0/favicon_yellow.png +0 -0
  66. data/coverage/assets/0.8.0/loading.gif +0 -0
  67. data/coverage/assets/0.8.0/magnify.png +0 -0
  68. data/coverage/assets/0.8.0/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  69. data/coverage/assets/0.8.0/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  70. data/coverage/assets/0.8.0/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  71. data/coverage/assets/0.8.0/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  72. data/coverage/assets/0.8.0/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  73. data/coverage/assets/0.8.0/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  74. data/coverage/assets/0.8.0/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  75. data/coverage/assets/0.8.0/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  76. data/coverage/assets/0.8.0/smoothness/images/ui-icons_222222_256x240.png +0 -0
  77. data/coverage/assets/0.8.0/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  78. data/coverage/assets/0.8.0/smoothness/images/ui-icons_454545_256x240.png +0 -0
  79. data/coverage/assets/0.8.0/smoothness/images/ui-icons_888888_256x240.png +0 -0
  80. data/coverage/assets/0.8.0/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  81. data/houston-2.2.2.gem +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 70de85597ce7bd9b4388fb4afcb03dc3b4140bb8
4
- data.tar.gz: 8be926f82276d5c006a17eb0949dd64867238508
3
+ metadata.gz: 62b98bdcafd6d8dc99ba994deb3ff5b5963bcb12
4
+ data.tar.gz: 58e6036255edb8a4e6403c3b8e63eea765e587e3
5
5
  SHA512:
6
- metadata.gz: d60978d2f9862254305a44b924f4ee4c315d1a67581b17a6a1bfd59cb0b52ce6743292829a57ceacc6d0ee32333c1523d4257f15b53f7ce11107ca0e3a0ad79e
7
- data.tar.gz: a12e4f5ae6c893e725aeae6f38215d6321bae7a8a6f02af88e287e70f7f2bb313722653136cc294c228c116c12db6181bacddda62eba9f635d292b790752ce31
6
+ metadata.gz: 82355e5daa760f2fc1d8998d9f5aad92842fd65db661e9fc1f58c6ca32a8da3b492ee303f6a98e0aab487e383ebf31ded16ad65689d4dbad0c228167937c1c76
7
+ data.tar.gz: 7592018c066df70f1bd37b65d7fd387fd921975e7a4ec6893e94d6e57d8692cc01386f14c1ace277db5d9251ca3f910daaebf0f50dbb05f72dca1fd17ea8f0ba
data/Gemfile CHANGED
@@ -1,3 +1,3 @@
1
- source "https://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
@@ -1,38 +1,38 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- houston (2.2.3)
5
- commander (~> 4.1)
4
+ houston (2.2.4)
5
+ commander (~> 4.4)
6
6
  json
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- commander (4.2.0)
12
- highline (~> 1.6.11)
11
+ commander (4.4.3)
12
+ highline (~> 1.7.2)
13
13
  diff-lcs (1.2.5)
14
14
  docile (1.1.5)
15
- highline (1.6.21)
16
- json (1.8.1)
17
- multi_json (1.10.1)
18
- rake (10.3.2)
19
- rspec (3.0.0)
20
- rspec-core (~> 3.0.0)
21
- rspec-expectations (~> 3.0.0)
22
- rspec-mocks (~> 3.0.0)
23
- rspec-core (3.0.3)
24
- rspec-support (~> 3.0.0)
25
- rspec-expectations (3.0.3)
15
+ highline (1.7.8)
16
+ json (2.0.2)
17
+ rake (12.0.0)
18
+ rspec (3.5.0)
19
+ rspec-core (~> 3.5.0)
20
+ rspec-expectations (~> 3.5.0)
21
+ rspec-mocks (~> 3.5.0)
22
+ rspec-core (3.5.4)
23
+ rspec-support (~> 3.5.0)
24
+ rspec-expectations (3.5.0)
26
25
  diff-lcs (>= 1.2.0, < 2.0)
27
- rspec-support (~> 3.0.0)
28
- rspec-mocks (3.0.3)
29
- rspec-support (~> 3.0.0)
30
- rspec-support (3.0.3)
31
- simplecov (0.9.0)
26
+ rspec-support (~> 3.5.0)
27
+ rspec-mocks (3.5.0)
28
+ diff-lcs (>= 1.2.0, < 2.0)
29
+ rspec-support (~> 3.5.0)
30
+ rspec-support (3.5.0)
31
+ simplecov (0.12.0)
32
32
  docile (~> 1.1.0)
33
- multi_json
34
- simplecov-html (~> 0.8.0)
35
- simplecov-html (0.8.0)
33
+ json (>= 1.8, < 3)
34
+ simplecov-html (~> 0.10.0)
35
+ simplecov-html (0.10.0)
36
36
 
37
37
  PLATFORMS
38
38
  ruby
@@ -40,5 +40,8 @@ PLATFORMS
40
40
  DEPENDENCIES
41
41
  houston!
42
42
  rake
43
- rspec (~> 3.0)
43
+ rspec (~> 3.5)
44
44
  simplecov
45
+
46
+ BUNDLED WITH
47
+ 1.13.7
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012 Mattt Thompson (http://mattt.me/)
1
+ Copyright (c) 2012–2015 Mattt Thompson (http://mattt.me/)
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -4,15 +4,15 @@ Push Notifications don't have to be difficult.
4
4
 
5
5
  Houston is a simple gem for sending Apple Push Notifications. Pass your credentials, construct your message, and send it.
6
6
 
7
- In a production application, you will probably want to schedule or queue notifications into a background job. Whether you're using [queue_classic](https://github.com/ryandotsmith/queue_classic), [resque](https://github.com/defunkt/resque), or rolling you own infrastructure, integrating Houston couldn't be simpler.
7
+ In a production application, you will probably want to schedule or queue notifications into a background job. Whether you're using [queue_classic](https://github.com/ryandotsmith/queue_classic), [resque](https://github.com/resque/resque), or rolling you own infrastructure, integrating Houston couldn't be simpler.
8
8
 
9
- Another caveat is that Houston doesn't manage device tokens for you. For that, you should check out [Helios](http://helios.io)
9
+ Another caveat is that Houston doesn't manage device tokens for you. For that, you should check out [Helios](http://github.com/helios-framework/helios).
10
10
 
11
11
  > Houston is named for [Houston, TX](http://en.wikipedia.org/wiki/Houston), the metonymical home of [NASA's Johnson Space Center](http://en.wikipedia.org/wiki/Lyndon_B._Johnson_Space_Center), as in _Houston, We Have Liftoff!_.
12
12
 
13
- > It's part of a series of world-class command-line utilities for iOS development, which includes [Cupertino](https://github.com/mattt/cupertino) (Apple Dev Center management), [Shenzhen](https://github.com/mattt/shenzhen) (Building & Distribution), [Venice](https://github.com/mattt/venice) (In-App Purchase Receipt Verification), [Dubai](https://github.com/mattt/dubai) (Passbook pass generation), and [Nashville](https://github.com/nomad/nashville) (iTunes Store API).
13
+ > It's part of a series of world-class command-line utilities for iOS development, which includes [Cupertino](https://github.com/nomad/cupertino) (Apple Dev Center management), [Shenzhen](https://github.com/nomad/shenzhen) (Building & Distribution), [Venice](https://github.com/nomad/venice) (In-App Purchase Receipt Verification), [Dubai](https://github.com/nomad/dubai) (Passbook pass generation), and [Nashville](https://github.com/nomad/nashville) (iTunes Store API).
14
14
 
15
- > This project is also part of a series of open source libraries covering the mission-critical aspects of an iOS app's infrastructure. Be sure to check out its sister projects: [GroundControl](https://github.com/mattt/GroundControl), [SkyLab](https://github.com/mattt/SkyLab), [houston](https://github.com/mattt/houston), and [Orbiter](https://github.com/mattt/Orbiter).
15
+ > This project is also part of a series of open source libraries covering the mission-critical aspects of an iOS app's infrastructure. Be sure to check out its sister projects: [GroundControl](https://github.com/mattt/GroundControl), [SkyLab](https://github.com/mattt/SkyLab), [houston](https://github.com/nomad/houston), and [Orbiter](https://github.com/mattt/Orbiter).
16
16
 
17
17
  ## Installation
18
18
 
@@ -40,12 +40,28 @@ notification.badge = 57
40
40
  notification.sound = "sosumi.aiff"
41
41
  notification.category = "INVITE_CATEGORY"
42
42
  notification.content_available = true
43
- notification.custom_data = {foo: "bar"}
43
+ notification.mutable_content = true
44
+ notification.custom_data = { foo: "bar" }
44
45
 
45
46
  # And... sent! That's all it takes.
46
47
  APN.push(notification)
47
48
  ```
48
49
 
50
+ To generate a `.pem` file, it is recommended to use [fastlane pem](https://fastlane.tools/pem), which completely automates the process of creating the certificate.
51
+
52
+ ## Configuration
53
+
54
+ Houston will attempt to load configuration data from environment variables, if they're present. The following variables will be used.
55
+
56
+ | Environment Variable | Description |
57
+ | --- | --- |
58
+ | `APN_GATEWAY_URI` | The base URI for the APNS service to use. If left blank, will use the default APNS Production Gateway URI. |
59
+ | `APN_FEEDBACK_URI` | The base URI for the APNS feedback service to use. If left blank, will use the default APNS Production Feedback URI. |
60
+ | `APN_CERTIFICATE` | The file path to a valid APNS push certificate in `.pem` format (see "[Converting Your Certificate](#converting-your-certificate)" below). |
61
+ | `APN_CERTIFICATE_DATA` | The contents of a valid APNS push certificate in `.pem` format (see "[Converting Your Certificate](#converting-your-certificate)" below); used in lieu of `APN_CERTIFICATE` if that variable is not provided. |
62
+ | `APN_CERTIFICATE_PASSPHRASE` | If the APNS certificate is protected by a passphrase, provide this variable to use when decrypting it. |
63
+ | `APN_TIMEOUT` | The timeout used when communicating with APNS. If not provided, the default of 0.5 seconds is used. |
64
+
49
65
  ### Error Handling
50
66
 
51
67
  If an error occurs when sending a particular notification, its `error` attribute will be populated:
@@ -56,11 +72,18 @@ puts "Error: #{notification.error}." if notification.error
56
72
 
57
73
  ### Silent Notifications
58
74
 
59
- To send a silent push notification, set `sound` to an empty string (`''`):
75
+ To send a silent push notification, set `sound` to an empty string (`""`):
76
+
77
+ ```ruby
78
+ Houston::Notification.new(sound: "", content_available: true)
79
+ ```
80
+
81
+ ### Mutable Notifications
82
+
83
+ To send a mutable push notification (supported by iOS 10+), set `mutable_content` to `true`:
60
84
 
61
85
  ```ruby
62
- Houston::Notification.new(:sound => '',
63
- :content_available => true)
86
+ Houston::Notification.new(mutable_content: true)
64
87
  ```
65
88
 
66
89
  ### Persistent Connections
@@ -88,6 +111,24 @@ Apple provides a feedback service to query for unregistered device tokens, these
88
111
  Houston::Client.development.devices
89
112
  ```
90
113
 
114
+ In practice, you'll use a reference to instance of the APN object you create (see the Usage section). Here's a rake job that marks device tokens as invalid based on the feedback service from Apple. This example assumes devices are tracked in a model called Device (i.e. `User.devices`).
115
+
116
+ In `lib/tasks/notifications.rake`:
117
+
118
+ ```ruby
119
+ namespace :notifications do
120
+ task device_token_feedback: [:environment] do
121
+ APN.devices.each do |device_hash|
122
+ # Format: { token: token, timestamp: timestamp }
123
+ device = Device.find_by(token: device_hash['token'])
124
+ next unless device.present?
125
+ # Remove device token
126
+ device.update_attribute(:device_token, nil)
127
+ end
128
+ end
129
+ end
130
+ ```
131
+
91
132
  ## Versioning
92
133
 
93
134
  Houston 2.0 supports the new [enhanced notification format](https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/CommunicatingWIthAPS.html#//apple_ref/doc/uid/TP40008194-CH101-SW4). Support for the legacy notification format is available in 1.x releases.
@@ -96,7 +137,7 @@ Houston 2.0 supports the new [enhanced notification format](https://developer.ap
96
137
 
97
138
  Houston also comes with the `apn` binary, which provides a convenient way to test notifications from the command line.
98
139
 
99
- $ apn push "<token>" -c /path/to/apple_push_notification.pem -m "Hello from the command line!"
140
+ $ apn push "<token>" -c /path/to/apple_push_notification.pem -m "Hello from the command line! "
100
141
 
101
142
  ## Enabling Push Notifications on iOS
102
143
 
@@ -135,17 +176,21 @@ and the apple certificate as p12 files. Here is a quick walkthrough on how to do
135
176
  2. Right click and choose `Export 2 items…`.
136
177
  3. Choose the p12 format from the drop down and name it `cert.p12`.
137
178
 
138
- Now covert the p12 file to a pem file:
179
+ Now convert the p12 file to a pem file:
180
+
181
+ **Unencrypted private key (do not store this certificate in version control)**
139
182
 
140
183
  $ openssl pkcs12 -in cert.p12 -out apple_push_notification.pem -nodes -clcerts
141
184
 
142
- ## Contact
185
+ **Encrypted private key**
186
+
187
+ $ openssl pkcs12 -in cert.p12 -out apple_push_notification.pem -aes256 -clcerts
188
+
189
+ You'll have to specify the password in the `APN_CERTIFICATE_PASSPHRASE` environment variable if you use the encrypted option.
143
190
 
144
- Mattt Thompson
191
+ ## Creator
145
192
 
146
- - http://github.com/mattt
147
- - http://twitter.com/mattt
148
- - m@mattt.me
193
+ Mattt Thompson ([@mattt](https://twitter.com/mattt))
149
194
 
150
195
  ## License
151
196
 
data/Rakefile CHANGED
@@ -1,10 +1,6 @@
1
- require "bundler"
2
- Bundler.setup
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
3
 
4
- gemspec = eval(File.read("houston.gemspec"))
4
+ RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- task :build => "#{gemspec.full_name}.gem"
7
-
8
- file "#{gemspec.full_name}.gem" => gemspec.files + ["houston.gemspec"] do
9
- system "gem build houston.gemspec"
10
- end
6
+ task default: :spec
@@ -18,956 +18,1095 @@
18
18
  shift(),i.sort());if(!!e&&!f.event.customEvent[h]||!!f.event.global[h]){c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.exclusive=j,c.namespace=i.join("."),c.namespace_re=new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)");if(g||!e)c.preventDefault(),c.stopPropagation();if(!e){f.each(f.cache,function(){var a=f.expando,b=this[a];b&&b.events&&b.events[h]&&f.event.trigger(c,d,b.handle.elem)});return}if(e.nodeType===3||e.nodeType===8)return;c.result=b,c.target=e,d=d!=null?f.makeArray(d):[],d.unshift(c);var k=e,l=h.indexOf(":")<0?"on"+h:"";do{var m=f._data(k,"handle");c.currentTarget=k,m&&m.apply(k,d),l&&f.acceptData(k)&&k[l]&&k[l].apply(k,d)===!1&&(c.result=!1,c.preventDefault()),k=k.parentNode||k.ownerDocument||k===c.target.ownerDocument&&a}while(k&&!c.isPropagationStopped());if(!c.isDefaultPrevented()){var n,o=f.event.special[h]||{};if((!o._default||o._default.call(e.ownerDocument,c)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)){try{l&&e[h]&&(n=e[l],n&&(e[l]=null),f.event.triggered=h,e[h]())}catch(p){}n&&(e[l]=n),f.event.triggered=b}}return c.result}},handle:function(c){c=f.event.fix(c||a.event);var d=((f._data(this,"events")||{})[c.type]||[]).slice(0),e=!c.exclusive&&!c.namespace,g=Array.prototype.slice.call(arguments,0);g[0]=c,c.currentTarget=this;for(var h=0,i=d.length;h<i;h++){var j=d[h];if(e||c.namespace_re.test(j.namespace)){c.handler=j.handler,c.data=j.data,c.handleObj=j;var k=j.handler.apply(this,g);k!==b&&(c.result=k,k===!1&&(c.preventDefault(),c.stopPropagation()));if(c.isImmediatePropagationStopped())break}}return c.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(a){if(a[f.expando])return a;var d=a;a=f.Event(d);for(var e=this.props.length,g;e;)g=this.props[--e],a[g]=d[g];a.target||(a.target=a.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),!a.relatedTarget&&a.fromElement&&(a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement);if(a.pageX==null&&a.clientX!=null){var h=a.target.ownerDocument||c,i=h.documentElement,j=h.body;a.pageX=a.clientX+(i&&i.scrollLeft||j&&j.scrollLeft||0)-(i&&i.clientLeft||j&&j.clientLeft||0),a.pageY=a.clientY+(i&&i.scrollTop||j&&j.scrollTop||0)-(i&&i.clientTop||j&&j.clientTop||0)}a.which==null&&(a.charCode!=null||a.keyCode!=null)&&(a.which=a.charCode!=null?a.charCode:a.keyCode),!a.metaKey&&a.ctrlKey&&(a.metaKey=a.ctrlKey),!a.which&&a.button!==b&&(a.which=a.button&1?1:a.button&2?3:a.button&4?2:0);return a},guid:1e8,proxy:f.proxy,special:{ready:{setup:f.bindReady,teardown:f.noop},live:{add:function(a){f.event.add(this,N(a.origType,a.selector),f.extend({},a,{handler:M,guid:a.handler.guid}))},remove:function(a){f.event.remove(this,N(a.origType,a.selector),a)}},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}}},f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!this.preventDefault)return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?E:D):this.type=a,b&&f.extend(this,b),this.timeStamp=f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=E;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=E;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=E,this.stopPropagation()},isDefaultPrevented:D,isPropagationStopped:D,isImmediatePropagationStopped:D};var F=function(a){var b=a.relatedTarget,c=!1,d=a.type;a.type=a.data,b!==this&&(b&&(c=f.contains(this,b)),c||(f.event.handle.apply(this,arguments),a.type=d))},G=function(a){a.type=a.data,f.event.handle.apply(this,arguments)};f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]={setup:function(c){f.event.add(this,b,c&&c.selector?G:F,a)},teardown:function(a){f.event.remove(this,b,a&&a.selector?G:F)}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(a,b){if(!f.nodeName(this,"form"))f.event.add(this,"click.specialSubmit",function(a){var b=a.target,c=b.type;(c==="submit"||c==="image")&&f(b).closest("form").length&&K("submit",this,arguments)}),f.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,c=b.type;(c==="text"||c==="password")&&f(b).closest("form").length&&a.keyCode===13&&K("submit",this,arguments)});else return!1},teardown:function(a){f.event.remove(this,".specialSubmit")}});if(!f.support.changeBubbles){var H,I=function(a){var b=a.type,c=a.value;b==="radio"||b==="checkbox"?c=a.checked:b==="select-multiple"?c=a.selectedIndex>-1?f.map(a.options,function(a){return a.selected}).join("-"):"":f.nodeName(a,"select")&&(c=a.selectedIndex);return c},J=function(c){var d=c.target,e,g;if(!!y.test(d.nodeName)&&!d.readOnly){e=f._data(d,"_change_data"),g=I(d),(c.type!=="focusout"||d.type!=="radio")&&f._data(d,"_change_data",g);if(e===b||g===e)return;if(e!=null||g)c.type="change",c.liveFired=b,f.event.trigger(c,arguments[1],d)}};f.event.special.change={filters:{focusout:J,beforedeactivate:J,click:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(c==="radio"||c==="checkbox"||f.nodeName(b,"select"))&&J.call(this,a)},keydown:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(a.keyCode===13&&!f.nodeName(b,"textarea")||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&J.call(this,a)},beforeactivate:function(a){var b=a.target;f._data(b,"_change_data",I(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in H)f.event.add(this,c+".specialChange",H[c]);return y.test(this.nodeName)},teardown:function(a){f.event.remove(this,".specialChange");return y.test(this.nodeName)}},H=f.event.special.change.filters,H.focus=H.beforeactivate}f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){function e(a){var c=f.event.fix(a);c.type=b,c.originalEvent={},f.event.trigger(c,null,c.target),c.isDefaultPrevented()&&a.preventDefault()}var d=0;f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.each(["bind","one"],function(a,c){f.fn[c]=function(a,d,e){var g;if(typeof a=="object"){for(var h in a)this[c](h,d,a[h],e);return this}if(arguments.length===2||d===!1)e=d,d=b;c==="one"?(g=function(a){f(this).unbind(a,g);return e.apply(this,arguments)},g.guid=e.guid||f.guid++):g=e;if(a==="unload"&&c!=="one")this.one(a,d,e);else for(var i=0,j=this.length;i<j;i++)f.event.add(this[i],a,g,d);return this}}),f.fn.extend({unbind:function(a,b){if(typeof a=="object"&&!a.preventDefault)for(var c in a)this.unbind(c,a[c]);else for(var d=0,e=this.length;d<e;d++)f.event.remove(this[d],a,b);return this},delegate:function(a,b,c,d){return this.live(b,c,d,a)},undelegate:function(a,b,c){return arguments.length===0?this.unbind("live"):this.die(b,null,c,a)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f.data(this,"lastToggle"+a.guid)||0)%d;f.data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var L={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};f.each(["live","die"],function(a,c){f.fn[c]=function(a,d,e,g){var h,i=0,j,k,l,m=g||this.selector,n=g?this:f(this.context);if(typeof a=="object"&&!a.preventDefault){for(var o in a)n[c](o,d,a[o],m);return this}if(c==="die"&&!a&&g&&g.charAt(0)==="."){n.unbind(g);return this}if(d===!1||f.isFunction(d))e=d||D,d=b;a=(a||"").split(" ");while((h=a[i++])!=null){j=x.exec(h),k="",j&&(k=j[0],h=h.replace(x,""));if(h==="hover"){a.push("mouseenter"+k,"mouseleave"+k);continue}l=h,L[h]?(a.push(L[h]+k),h=h+k):h=(L[h]||h)+k;if(c==="live")for(var p=0,q=n.length;p<q;p++)f.event.add(n[p],"live."+N(h,m),{data:d,selector:m,handler:e,origType:h,origHandler:e,preType:l});else n.unbind("live."+N(h,m),e)}return this}}),f.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.bind(b,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}if(i.nodeType===1){f||(i.sizcache=c,i.sizset=g);if(typeof b!="string"){if(i===b){j=!0;break}}else if(k.filter(b,[i]).length>0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}i.nodeType===1&&!f&&(i.sizcache=c,i.sizset=g);if(i.nodeName.toLowerCase()===b){j=i;break}i=i[a]}d[g]=j}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d=0,e=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,f,g){f=f||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return f;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(e.call(n)==="[object Array]")if(!u)f.push.apply(f,n);else if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&f.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&f.push(j[t]);else p(n,f);o&&(k(o,h,f,g),k.uniqueSort(f));return f};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},k.matches=function(a,b){return k(a,null,null,b)},k.matchesSelector=function(a,b){return k(b,null,null,[a]).length>0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e<f;e++){var g,h=l.order[e];if(g=l.leftMatch[h].exec(a)){var j=g[1];g.splice(1,1);if(j.substr(j.length-1)!=="\\"){g[1]=(g[1]||"").replace(i,""),d=l.find[h](g,b,c);if(d!=null){a=a.replace(l.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},k.filter=function(a,c,d,e){var f,g,h=a,i=[],j=c,m=c&&c[0]&&k.isXML(c[0]);while(a&&c.length){for(var n in l.filter)if((f=l.leftMatch[n].exec(a))!=null&&f[2]){var o,p,q=l.filter[n],r=f[1];g=!1,f.splice(1,1);if(r.substr(r.length-1)==="\\")continue;j===i&&(i=[]);if(l.preFilter[n]){f=l.preFilter[n](f,j,d,i,e,m);if(!f)g=o=!0;else if(f===!0)continue}if(f)for(var s=0;(p=j[s])!=null;s++)if(p){o=q(p,f,s,j);var t=e^!!o;d&&o!=null?t?g=!0:j[s]=!1:t&&(i.push(p),g=!0)}if(o!==b){d||(j=i),a=a.replace(l.match[n],"");if(!g)return[];break}}if(a===h)if(g==null)k.error(a);else break;h=a}return j},k.error=function(a){throw"Syntax error, unrecognized expression: "+a};var l=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!j.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&k.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&k.filter(b,a,!0)}},"":function(a,b,c){var e,f=d++,g=u;typeof b=="string"&&!j.test(b)&&(b=b.toLowerCase(),e=b,g=t),g("parentNode",b,f,a,e,c)},"~":function(a,b,c){var e,f=d++,g=u;typeof b=="string"&&!j.test(b)&&(b=b.toLowerCase(),e=b,g=t),g("previousSibling",b,f,a,e,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(i,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=d++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}k.error(e)},CHILD:function(a,b){var c=b[1],d=a;switch(c){case"only":case"first":while(d=d.previousSibling)if(d.nodeType===1)return!1;if(c==="first")return!0;d=a;case"last":while(d=d.nextSibling)if(d.nodeType===1)return!1;return!0;case"nth":var e=b[2],f=b[3];if(e===1&&f===0)return!0;var g=b[0],h=a.parentNode;if(h&&(h.sizcache!==g||!a.nodeIndex)){var i=0;for(d=h.firstChild;d;d=d.nextSibling)d.nodeType===1&&(d.nodeIndex=++i);h.sizcache=g}var j=a.nodeIndex-f;return e===0?j===0:j%e===0&&j/e>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(e.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var f=a.length;c<f;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var r,s;c.documentElement.compareDocumentPosition?r=function(a,b){if(a===b){g=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(r=function(a,b){if(a===b){g=!0;return 0}if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],h=a.parentNode,i=b.parentNode,j=h;if(h===i)return s(a,b);if(!h)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return s(e[k],f[k]);return k===c?s(a,f[k],-1):s(e[k],b,1)},s=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),k.getText=function(a){var b="",c;for(var d=0;a[d];d++)c=a[d],c.nodeType===3||c.nodeType===4?b+=c.nodeValue:c.nodeType!==8&&(b+=k.getText(c.childNodes));return b},function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(e||!l.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return k(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g<h;g++)k(a,f[g],d);return k.filter(e,d)};f.find=k,f.expr=k.selectors,f.expr[":"]=f.expr.filters,f.unique=k.uniqueSort,f.text=k.getText,f.isXMLDoc=k.isXML,f.contains=k.contains}();var O=/Until$/,P=/^(?:parents|prevUntil|prevAll)/,Q=/,/,R=/^.[^:#\[\.,]*$/,S=Array.prototype.slice,T=f.expr.match.POS,U={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack("","find",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(W(this,a,!1),"not",a)},filter:function(a){return this.pushStack(W(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(d=0,e=a.length;d<e;d++)i=a[d],j[i]||(j[i]=T.test(i)?f(i,b||this.context):i);while(g&&g.ownerDocument&&g!==b){for(i in j)h=j[i],(h.jquery?h.index(g)>-1:f(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=T.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(l?l.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a||typeof a=="string")return f.inArray(this[0],a?f(a):this.parent().children());return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(V(c[0])||V(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c),g=S.call(arguments);O.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!U[a]?f.unique(e):e,(this.length>1||Q.test(d))&&P.test(a)&&(e=e.reverse());return this.pushStack(e,a,g.join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var X=/ jQuery\d+="(?:\d+|null)"/g,Y=/^\s+/,Z=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,$=/<([\w:]+)/,_=/<tbody/i,ba=/<|&#?\w+;/,bb=/<(?:script|object|embed|option|style)/i,bc=/checked\s*(?:[^=]|=\s*.checked.)/i,bd=/\/(java|ecma)script/i,be=/^\s*<!(?:\[CDATA\[|\-\-)/,bf={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};bf.optgroup=bf.option,bf.tbody=bf.tfoot=bf.colgroup=bf.caption=bf.thead,bf.th=bf.td,f.support.htmlSerialize||(bf._default=[1,"div<div>","</div>"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){f(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(X,""):null;if(typeof a=="string"&&!bb.test(a)&&(f.support.leadingWhitespace||!Y.test(a))&&!bf[($.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Z,"<$1></$2>");try{for(var c=0,d=this.length;c<d;c++)this[c].nodeType===1&&(f.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(e){this.empty().append(a)}}else f.isFunction(a)?this.each(function(b){var c=f(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bc.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(function(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bg(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,bm)}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i;b&&b[0]&&(i=b[0].ownerDocument||b[0]),i.createDocumentFragment||(i=c),a.length===1&&typeof a[0]=="string"&&a[0].length<512&&i===c&&a[0].charAt(0)==="<"&&!bb.test(a[0])&&(f.support.checkClone||!bc.test(a[0]))&&(g=!0,h=f.fragments[a[0]],h&&h!==1&&(e=h)),e||(e=i.createDocumentFragment(),f.clean(a,i,e,d)),g&&(f.fragments[a[0]]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j
19
19
  )}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d=a.cloneNode(!0),e,g,h;if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bi(a,d),e=bj(a),g=bj(d);for(h=0;e[h];++h)bi(e[h],g[h])}if(b){bh(a,d);if(c){e=bj(a),g=bj(d);for(h=0;e[h];++h)bh(e[h],g[h])}}e=g=null;return d},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!ba.test(k))k=b.createTextNode(k);else{k=k.replace(Z,"<$1></$2>");var l=($.exec(k)||["",""])[1].toLowerCase(),m=bf[l]||bf._default,n=m[0],o=b.createElement("div");o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=_.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]==="<table>"&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&Y.test(k)&&o.insertBefore(b.createTextNode(Y.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i<r;i++)bl(k[i]);else bl(k);k.nodeType?h.push(k):h=f.merge(h,k)}if(d){g=function(a){return!a.type||bd.test(a.type)};for(j=0;h[j];j++)if(e&&f.nodeName(h[j],"script")&&(!h[j].type||h[j].type.toLowerCase()==="text/javascript"))e.push(h[j].parentNode?h[j].parentNode.removeChild(h[j]):h[j]);else{if(h[j].nodeType===1){var s=f.grep(h[j].getElementsByTagName("script"),g);h.splice.apply(h,[j+1,0].concat(s))}d.appendChild(h[j])}}return h},cleanData:function(a){var b,c,d=f.cache,e=f.expando,g=f.event.special,h=f.support.deleteExpando;for(var i=0,j;(j=a[i])!=null;i++){if(j.nodeName&&f.noData[j.nodeName.toLowerCase()])continue;c=j[f.expando];if(c){b=d[c]&&d[c][e];if(b&&b.events){for(var k in b.events)g[k]?f.event.remove(j,k):f.removeEvent(j,k,b.handle);b.handle&&(b.handle.elem=null)}h?delete j[f.expando]:j.removeAttribute&&j.removeAttribute(f.expando),delete d[c]}}}});var bn=/alpha\([^)]*\)/i,bo=/opacity=([^)]*)/,bp=/([A-Z]|^ms)/g,bq=/^-?\d+(?:px)?$/i,br=/^-?\d/,bs=/^[+\-]=/,bt=/[^+\-\.\de]+/g,bu={position:"absolute",visibility:"hidden",display:"block"},bv=["Left","Right"],bw=["Top","Bottom"],bx,by,bz;f.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return f.access(this,a,c,!0,function(a,c,d){return d!==b?f.style(a,c,d):f.css(a,c)})},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bx(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d;if(h==="number"&&isNaN(d)||d==null)return;h==="string"&&bs.test(d)&&(d=+d.replace(bt,"")+parseFloat(f.css(a,c)),h="number"),h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(bx)return bx(a,c)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]}}),f.curCSS=f.css,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){var e;if(c){if(a.offsetWidth!==0)return bA(a,b,d);f.swap(a,bu,function(){e=bA(a,b,d)});return e}},set:function(a,b){if(!bq.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bo.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle;c.zoom=1;var e=f.isNaN(b)?"":"alpha(opacity="+b*100+")",g=d&&d.filter||c.filter||"";c.filter=bn.test(g)?g.replace(bn,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bx(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(by=function(a,c){var d,e,g;c=c.replace(bp,"-$1").toLowerCase();if(!(e=a.ownerDocument.defaultView))return b;if(g=e.getComputedStyle(a,null))d=g.getPropertyValue(c),d===""&&!f.contains(a.ownerDocument.documentElement,a)&&(d=f.style(a,c));return d}),c.documentElement.currentStyle&&(bz=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bq.test(d)&&br.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bx=by||bz,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bB=/%20/g,bC=/\[\]$/,bD=/\r?\n/g,bE=/#.*$/,bF=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bG=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bH=/^(?:about|app|app\-storage|.+\-extension|file|widget):$/,bI=/^(?:GET|HEAD)$/,bJ=/^\/\//,bK=/\?/,bL=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bM=/^(?:select|textarea)/i,bN=/\s+/,bO=/([?&])_=[^&]*/,bP=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bQ=f.fn.load,bR={},bS={},bT,bU;try{bT=e.href}catch(bV){bT=c.createElement("a"),bT.href="",bT=bT.href}bU=bP.exec(bT.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bQ)return bQ.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("<div>").append(c.replace(bL,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bM.test(this.nodeName)||bG.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bD,"\r\n")}}):{name:b.name,value:c.replace(bD,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.bind(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?f.extend(!0,a,f.ajaxSettings,b):(b=a,a=f.extend(!0,f.ajaxSettings,b));for(var c in{context:1,url:1})c in b?a[c]=b[c]:c in f.ajaxSettings&&(a[c]=f.ajaxSettings[c]);return a},ajaxSettings:{url:bT,isLocal:bH.test(bU[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML}},ajaxPrefilter:bW(bR),ajaxTransport:bW(bS),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a?4:0;var o,r,u,w=l?bZ(d,v,l):b,x,y;if(a>=200&&a<300||a===304){if(d.ifModified){if(x=v.getResponseHeader("Last-Modified"))f.lastModified[k]=x;if(y=v.getResponseHeader("Etag"))f.etag[k]=y}if(a===304)c="notmodified",o=!0;else try{r=b$(d,w),c="success",o=!0}catch(z){c="parsererror",u=z}}else{u=c;if(!c||a)c="error",a<0&&(a=0)}v.status=a,v.statusText=c,o?h.resolveWith(e,[r,c,v]):h.rejectWith(e,[v,c,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.resolveWith(e,[v,c]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f._Deferred(),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bF.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.done,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bE,"").replace(bJ,bU[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bN),d.crossDomain==null&&(r=bP.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bU[1]&&r[2]==bU[2]&&(r[3]||(r[1]==="http:"?80:443))==(bU[3]||(bU[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),bX(bR,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bI.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bK.test(d.url)?"&":"?")+d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bO,"$1_="+x);d.url=y+(y===d.url?(bK.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", */*; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=bX(bS,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){status<2?w(-1,z):f.error(z)}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)bY(g,a[g],c,e);return d.join("&").replace(bB,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var b_=f.now(),ca=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+b_++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ca.test(b.url)||e&&ca.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ca,l),b.url===j&&(e&&(k=k.replace(ca,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cb=a.ActiveXObject?function(){for(var a in cd)cd[a](0,1)}:!1,cc=0,cd;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ce()||cf()}:ce,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cb&&delete cd[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cc,cb&&(cd||(cd={},f(a).unload(cb)),cd[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cg={},ch,ci,cj=/^(?:toggle|show|hide)$/,ck=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cl,cm=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cn,co=a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||a.oRequestAnimationFrame;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cr("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)d=this[g],d.style&&(e=d.style.display,!f._data(d,"olddisplay")&&e==="none"&&(e=d.style.display=""),e===""&&f.css(d,"display")==="none"&&f._data(d,"olddisplay",cs(d.nodeName)));for(g=0;g<h;g++){d=this[g];if(d.style){e=d.style.display;if(e===""||e==="none")d.style.display=f._data(d,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(cr("hide",3),a,b,c);for(var d=0,e=this.length;d<e;d++)if(this[d].style){var g=f.css(this[d],"display");g!=="none"&&!f._data(this[d],"olddisplay")&&f._data(this[d],"olddisplay",g)}for(d=0;d<e;d++)this[d].style&&(this[d].style.display="none");return this},_toggle:f.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";f.isFunction(a)&&f.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:f(this).is(":hidden");f(this)[b?"show":"hide"]()}):this.animate(cr("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=f.speed(b,c,d);if(f.isEmptyObject(a))return this.each(e.complete,[!1]);a=f.extend({},a);return this[e.queue===!1?"each":"queue"](function(){e.queue===!1&&f._mark(this);var b=f.extend({},e),c=this.nodeType===1,d=c&&f(this).is(":hidden"),g,h,i,j,k,l,m,n,o;b.animatedProperties={};for(i in a){g=f.camelCase(i),i!==g&&(a[g]=a[i],delete a[i]),h=a[g],f.isArray(h)?(b.animatedProperties[g]=h[1],h=a[g]=h[0]):b.animatedProperties[g]=b.specialEasing&&b.specialEasing[g]||b.easing||"swing";if(h==="hide"&&d||h==="show"&&!d)return b.complete.call(this);c&&(g==="height"||g==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],f.css(this,"display")==="inline"&&f.css(this,"float")==="none"&&(f.support.inlineBlockNeedsLayout?(j=cs(this.nodeName),j==="inline"?this.style.display="inline-block":(this.style.display="inline",this.style.zoom=1)):this.style.display="inline-block"))}b.overflow!=null&&(this.style.overflow="hidden");for(i in a)k=new f.fx(this,b,i),h=a[i],cj.test(h)?k[h==="toggle"?d?"show":"hide":h]():(l=ck.exec(h),m=k.cur(),l?(n=parseFloat(l[2]),o=l[3]||(f.cssNumber[i]?"":"px"),o!=="px"&&(f.style(this,i,(n||1)+o),m=(n||1)/k.cur()*m,f.style(this,i,m+o)),l[1]&&(n=(l[1]==="-="?-1:1)*n+m),k.custom(m,n,o)):k.custom(m,h,""));return!0})},stop:function(a,b){a&&this.queue([]),this.each(function(){var a=f.timers,c=a.length;b||f._unmark(!0,this);while(c--)a[c].elem===this&&(b&&a[c](!0),a.splice(c,1))}),b||this.dequeue();return this}}),f.each({slideDown:cr("show",1),slideUp:cr("hide",1),slideToggle:cr("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){f.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),f.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?f.extend({},a):{complete:c||!c&&b||f.isFunction(a)&&a,duration:a,easing:c&&b||b&&!f.isFunction(b)&&b};d.duration=f.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in f.fx.speeds?f.fx.speeds[d.duration]:f.fx.speeds._default,d.old=d.complete,d.complete=function(a){f.isFunction(d.old)&&d.old.call(this),d.queue!==!1?f.dequeue(this):a!==!1&&f._unmark(this)};return d},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),f.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(f.fx.step[this.prop]||f.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=f.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,b,c){function h(a){return d.step(a)}var d=this,e=f.fx,g;this.startTime=cn||cp(),this.start=a,this.end=b,this.unit=c||this.unit||(f.cssNumber[this.prop]?"":"px"),this.now=this.start,this.pos=this.state=0,h.elem=this.elem,h()&&f.timers.push(h)&&!cl&&(co?(cl=!0,g=function(){cl&&(co(g),e.tick())},co(g)):cl=setInterval(e.tick,e.interval))},show:function(){this.options.orig[this.prop]=f.style(this.elem,this.prop),this.options.show=!0,this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),f(this.elem).show()},hide:function(){this.options.orig[this.prop]=f.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b=cn||cp(),c=!0,d=this.elem,e=this.options,g,h;if(a||b>=e.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),e.animatedProperties[this.prop]=!0;for(g in e.animatedProperties)e.animatedProperties[g]!==!0&&(c=!1);if(c){e.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){d.style["overflow"+b]=e.overflow[a]}),e.hide&&f(d).hide();if(e.hide||e.show)for(var i in e.animatedProperties)f.style(d,i,e.orig[i]);e.complete.call(d)}return!1}e.duration==Infinity?this.now=b:(h=b-this.startTime,this.state=h/e.duration,this.pos=f.easing[e.animatedProperties[this.prop]](this.state,h,0,1,e.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){for(var a=f.timers,b=0;b<a.length;++b)a[b]()||a.splice(b--,1);a.length||f.fx.stop()},interval:13,stop:function(){clearInterval(cl),cl=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){f.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit:a.elem[a.prop]=a.now}}}),f.expr&&f.expr.filters&&(f.expr.filters.animated=function(a){return f.grep(f.timers,function(b){return a===b.elem}).length});var ct=/^t(?:able|d|h)$/i,cu=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?f.fn.offset=function(a){var b=this[0],c;if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(d){}var e=b.ownerDocument,g=e.documentElement;if(!c||!f.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};var h=e.body,i=cv(e),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||f.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||f.support.boxModel&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:f.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);f.offset.initialize();var c,d=b.offsetParent,e=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(f.offset.supportsFixedPosition&&k.position==="fixed")break;c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===d&&(l+=b.offsetTop,m+=b.offsetLeft,f.offset.doesNotAddBorder&&(!f.offset.doesAddBorderForTableAndCells||!ct.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),e=d,d=b.offsetParent),f.offset.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),k=c}if(k.position==="relative"||k.position==="static")l+=i.offsetTop,m+=i.offsetLeft;f.offset.supportsFixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},f.offset={initialize:function(){var a=c.body,b=c.createElement("div"),d,e,g,h,i=parseFloat(f.css(a,"marginTop"))||0,j="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";f.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),d=b.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,this.doesNotAddBorder=e.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,e.style.position="fixed",e.style.top="20px",this.supportsFixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",this.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),f.offset.initialize=f.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.offset.initialize(),f.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cu.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cu.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cv(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cv(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a&&a.style?parseFloat(f.css(a,d,"padding")):null},f.fn["outer"+c]=function(a){var b=this[0];return b&&b.style?parseFloat(f.css(b,d,a?"margin":"border")):null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c];return e.document.compatMode==="CSS1Compat"&&g||e.document.body["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var h=f.css(e,d),i=parseFloat(h);return f.isNaN(i)?h:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f})(window);
20
20
  var hljs=new function(){function l(o){return o.replace(/&/gm,"&amp;").replace(/</gm,"&lt;")}function c(q,p,o){return RegExp(p,"m"+(q.cI?"i":"")+(o?"g":""))}function i(q){for(var o=0;o<q.childNodes.length;o++){var p=q.childNodes[o];if(p.nodeName=="CODE"){return p}if(!(p.nodeType==3&&p.nodeValue.match(/\s+/))){break}}}function g(s,r){var q="";for(var p=0;p<s.childNodes.length;p++){if(s.childNodes[p].nodeType==3){var o=s.childNodes[p].nodeValue;if(r){o=o.replace(/\n/g,"")}q+=o}else{if(s.childNodes[p].nodeName=="BR"){q+="\n"}else{q+=g(s.childNodes[p])}}}if(/MSIE [678]/.test(navigator.userAgent)){q=q.replace(/\r/g,"\n")}return q}function a(r){var p=r.className.split(/\s+/);p=p.concat(r.parentNode.className.split(/\s+/));for(var o=0;o<p.length;o++){var q=p[o].replace(/^language-/,"");if(d[q]||q=="no-highlight"){return q}}}function b(o){var p=[];(function(r,s){for(var q=0;q<r.childNodes.length;q++){if(r.childNodes[q].nodeType==3){s+=r.childNodes[q].nodeValue.length}else{if(r.childNodes[q].nodeName=="BR"){s+=1}else{p.push({event:"start",offset:s,node:r.childNodes[q]});s=arguments.callee(r.childNodes[q],s);p.push({event:"stop",offset:s,node:r.childNodes[q]})}}}return s})(o,0);return p}function k(x,y,w){var q=0;var v="";var s=[];function t(){if(x.length&&y.length){if(x[0].offset!=y[0].offset){return(x[0].offset<y[0].offset)?x:y}else{return y[0].event=="start"?x:y}}else{return x.length?x:y}}function r(B){var C="<"+B.nodeName.toLowerCase();for(var z=0;z<B.attributes.length;z++){var A=B.attributes[z];C+=" "+A.nodeName.toLowerCase();if(A.nodeValue!=undefined){C+='="'+l(A.nodeValue)+'"'}}return C+">"}while(x.length||y.length){var u=t().splice(0,1)[0];v+=l(w.substr(q,u.offset-q));q=u.offset;if(u.event=="start"){v+=r(u.node);s.push(u.node)}else{if(u.event=="stop"){var p=s.length;do{p--;var o=s[p];v+=("</"+o.nodeName.toLowerCase()+">")}while(o!=u.node);s.splice(p,1);while(p<s.length){v+=r(s[p]);p++}}}}v+=w.substr(q);return v}function f(I,C){function y(r,L){for(var K=0;K<L.c.length;K++){if(L.c[K].bR.test(r)){return L.c[K]}}}function v(K,r){if(B[K].e&&B[K].eR.test(r)){return 1}if(B[K].eW){var L=v(K-1,r);return L?L+1:0}return 0}function w(r,K){return K.iR&&K.iR.test(r)}function z(N,M){var L=[];for(var K=0;K<N.c.length;K++){L.push(N.c[K].b)}var r=B.length-1;do{if(B[r].e){L.push(B[r].e)}r--}while(B[r+1].eW);if(N.i){L.push(N.i)}return c(M,"("+L.join("|")+")",true)}function q(L,K){var M=B[B.length-1];if(!M.t){M.t=z(M,G)}M.t.lastIndex=K;var r=M.t.exec(L);if(r){return[L.substr(K,r.index-K),r[0],false]}else{return[L.substr(K),"",true]}}function o(N,r){var K=G.cI?r[0].toLowerCase():r[0];for(var M in N.kG){if(!N.kG.hasOwnProperty(M)){continue}var L=N.kG[M].hasOwnProperty(K);if(L){return[M,L]}}return false}function E(L,N){if(!N.k){return l(L)}var M="";var O=0;N.lR.lastIndex=0;var K=N.lR.exec(L);while(K){M+=l(L.substr(O,K.index-O));var r=o(N,K);if(r){s+=r[1];M+='<span class="'+r[0]+'">'+l(K[0])+"</span>"}else{M+=l(K[0])}O=N.lR.lastIndex;K=N.lR.exec(L)}M+=l(L.substr(O,L.length-O));return M}function J(r,L){if(L.sL&&d[L.sL]){var K=f(L.sL,r);s+=K.keyword_count;return K.value}else{return E(r,L)}}function H(L,r){var K=L.cN?'<span class="'+L.cN+'">':"";if(L.rB){p+=K;L.buffer=""}else{if(L.eB){p+=l(r)+K;L.buffer=""}else{p+=K;L.buffer=r}}B.push(L);A+=L.r}function D(N,K,P){var Q=B[B.length-1];if(P){p+=J(Q.buffer+N,Q);return false}var L=y(K,Q);if(L){p+=J(Q.buffer+N,Q);H(L,K);return L.rB}var r=v(B.length-1,K);if(r){var M=Q.cN?"</span>":"";if(Q.rE){p+=J(Q.buffer+N,Q)+M}else{if(Q.eE){p+=J(Q.buffer+N,Q)+M+l(K)}else{p+=J(Q.buffer+N+K,Q)+M}}while(r>1){M=B[B.length-2].cN?"</span>":"";p+=M;r--;B.length--}var O=B[B.length-1];B.length--;B[B.length-1].buffer="";if(O.starts){H(O.starts,"")}return Q.rE}if(w(K,Q)){throw"Illegal"}}var G=d[I];var B=[G.dM];var A=0;var s=0;var p="";try{var u=0;G.dM.buffer="";do{var x=q(C,u);var t=D(x[0],x[1],x[2]);u+=x[0].length;if(!t){u+=x[1].length}}while(!x[2]);if(B.length>1){throw"Illegal"}return{language:I,r:A,keyword_count:s,value:p}}catch(F){if(F=="Illegal"){return{language:null,r:0,keyword_count:0,value:l(C)}}else{throw F}}}function h(){function o(t,s,u){if(t.compiled){return}if(!u){t.bR=c(s,t.b?t.b:"\\B|\\b");if(!t.e&&!t.eW){t.e="\\B|\\b"}if(t.e){t.eR=c(s,t.e)}}if(t.i){t.iR=c(s,t.i)}if(t.r==undefined){t.r=1}if(t.k){t.lR=c(s,t.l||hljs.IR,true)}for(var r in t.k){if(!t.k.hasOwnProperty(r)){continue}if(t.k[r] instanceof Object){t.kG=t.k}else{t.kG={keyword:t.k}}break}if(!t.c){t.c=[]}t.compiled=true;for(var q=0;q<t.c.length;q++){o(t.c[q],s,false)}if(t.starts){o(t.starts,s,false)}}for(var p in d){if(!d.hasOwnProperty(p)){continue}o(d[p].dM,d[p],true)}}function e(){if(e.called){return}e.called=true;h()}function n(t,y,p){e();var A=g(t,p);var r=a(t);if(r=="no-highlight"){return}if(r){var w=f(r,A)}else{var w={language:"",keyword_count:0,r:0,value:l(A)};var x=w;for(var z in d){if(!d.hasOwnProperty(z)){continue}var u=f(z,A);if(u.keyword_count+u.r>x.keyword_count+x.r){x=u}if(u.keyword_count+u.r>w.keyword_count+w.r){x=w;w=u}}}var s=t.className;if(!s.match(w.language)){s=s?(s+" "+w.language):w.language}var o=b(t);if(o.length){var q=document.createElement("pre");q.innerHTML=w.value;w.value=k(o,b(q),A)}if(y){w.value=w.value.replace(/^((<[^>]+>|\t)+)/gm,function(B,E,D,C){return E.replace(/\t/g,y)})}if(p){w.value=w.value.replace(/\n/g,"<br>")}if(/MSIE [678]/.test(navigator.userAgent)&&t.tagName=="CODE"&&t.parentNode.tagName=="PRE"){var q=t.parentNode;var v=document.createElement("div");v.innerHTML="<pre><code>"+w.value+"</code></pre>";t=v.firstChild.firstChild;v.firstChild.cN=q.cN;q.parentNode.replaceChild(v.firstChild,q)}else{t.innerHTML=w.value}t.className=s;t.dataset={};t.dataset.result={language:w.language,kw:w.keyword_count,re:w.r};if(x&&x.language){t.dataset.second_best={language:x.language,kw:x.keyword_count,re:x.r}}}function j(){if(j.called){return}j.called=true;e();var q=document.getElementsByTagName("pre");for(var o=0;o<q.length;o++){var p=i(q[o]);if(p){n(p,hljs.tabReplace)}}}function m(){var o=arguments;var p=function(){j.apply(null,o)};if(window.addEventListener){window.addEventListener("DOMContentLoaded",p,false);window.addEventListener("load",p,false)}else{if(window.attachEvent){window.attachEvent("onload",p)}else{window.onload=p}}}var d={};this.LANGUAGES=d;this.initHighlightingOnLoad=m;this.highlightBlock=n;this.initHighlighting=j;this.IR="[a-zA-Z][a-zA-Z0-9_]*";this.UIR="[a-zA-Z_][a-zA-Z0-9_]*";this.NR="\\b\\d+(\\.\\d+)?";this.CNR="\\b(0x[A-Za-z0-9]+|\\d+(\\.\\d+)?)";this.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|\\.|-|-=|/|/=|:|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~";this.BE={b:"\\\\.",r:0};this.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[this.BE],r:0};this.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[this.BE],r:0};this.CLCM={cN:"comment",b:"//",e:"$"};this.CBLCLM={cN:"comment",b:"/\\*",e:"\\*/"};this.HCM={cN:"comment",b:"#",e:"$"};this.NM={cN:"number",b:this.NR,r:0};this.CNM={cN:"number",b:this.CNR,r:0};this.inherit=function(o,r){var q={};for(var p in o){q[p]=o[p]}if(r){for(var p in r){q[p]=r[p]}}return q}}();hljs.LANGUAGES.ruby=function(){var g="[a-zA-Z_][a-zA-Z0-9_]*(\\!|\\?)?";var a="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?";var n={keyword:{and:1,"false":1,then:1,defined:1,module:1,"in":1,"return":1,redo:1,"if":1,BEGIN:1,retry:1,end:1,"for":1,"true":1,self:1,when:1,next:1,until:1,"do":1,begin:1,unless:1,END:1,rescue:1,nil:1,"else":1,"break":1,undef:1,not:1,"super":1,"class":1,"case":1,require:1,yield:1,alias:1,"while":1,ensure:1,elsif:1,or:1,def:1},keymethods:{__id__:1,__send__:1,abort:1,abs:1,"all?":1,allocate:1,ancestors:1,"any?":1,arity:1,assoc:1,at:1,at_exit:1,autoload:1,"autoload?":1,"between?":1,binding:1,binmode:1,"block_given?":1,call:1,callcc:1,caller:1,capitalize:1,"capitalize!":1,casecmp:1,"catch":1,ceil:1,center:1,chomp:1,"chomp!":1,chop:1,"chop!":1,chr:1,"class":1,class_eval:1,"class_variable_defined?":1,class_variables:1,clear:1,clone:1,close:1,close_read:1,close_write:1,"closed?":1,coerce:1,collect:1,"collect!":1,compact:1,"compact!":1,concat:1,"const_defined?":1,const_get:1,const_missing:1,const_set:1,constants:1,count:1,crypt:1,"default":1,default_proc:1,"delete":1,"delete!":1,delete_at:1,delete_if:1,detect:1,display:1,div:1,divmod:1,downcase:1,"downcase!":1,downto:1,dump:1,dup:1,each:1,each_byte:1,each_index:1,each_key:1,each_line:1,each_pair:1,each_value:1,each_with_index:1,"empty?":1,entries:1,eof:1,"eof?":1,"eql?":1,"equal?":1,"eval":1,exec:1,exit:1,"exit!":1,extend:1,fail:1,fcntl:1,fetch:1,fileno:1,fill:1,find:1,find_all:1,first:1,flatten:1,"flatten!":1,floor:1,flush:1,for_fd:1,foreach:1,fork:1,format:1,freeze:1,"frozen?":1,fsync:1,getc:1,gets:1,global_variables:1,grep:1,gsub:1,"gsub!":1,"has_key?":1,"has_value?":1,hash:1,hex:1,id:1,include:1,"include?":1,included_modules:1,index:1,indexes:1,indices:1,induced_from:1,inject:1,insert:1,inspect:1,instance_eval:1,instance_method:1,instance_methods:1,"instance_of?":1,"instance_variable_defined?":1,instance_variable_get:1,instance_variable_set:1,instance_variables:1,"integer?":1,intern:1,invert:1,ioctl:1,"is_a?":1,isatty:1,"iterator?":1,join:1,"key?":1,keys:1,"kind_of?":1,lambda:1,last:1,length:1,lineno:1,ljust:1,load:1,local_variables:1,loop:1,lstrip:1,"lstrip!":1,map:1,"map!":1,match:1,max:1,"member?":1,merge:1,"merge!":1,method:1,"method_defined?":1,method_missing:1,methods:1,min:1,module_eval:1,modulo:1,name:1,nesting:1,"new":1,next:1,"next!":1,"nil?":1,nitems:1,"nonzero?":1,object_id:1,oct:1,open:1,pack:1,partition:1,pid:1,pipe:1,pop:1,popen:1,pos:1,prec:1,prec_f:1,prec_i:1,print:1,printf:1,private_class_method:1,private_instance_methods:1,"private_method_defined?":1,private_methods:1,proc:1,protected_instance_methods:1,"protected_method_defined?":1,protected_methods:1,public_class_method:1,public_instance_methods:1,"public_method_defined?":1,public_methods:1,push:1,putc:1,puts:1,quo:1,raise:1,rand:1,rassoc:1,read:1,read_nonblock:1,readchar:1,readline:1,readlines:1,readpartial:1,rehash:1,reject:1,"reject!":1,remainder:1,reopen:1,replace:1,require:1,"respond_to?":1,reverse:1,"reverse!":1,reverse_each:1,rewind:1,rindex:1,rjust:1,round:1,rstrip:1,"rstrip!":1,scan:1,seek:1,select:1,send:1,set_trace_func:1,shift:1,singleton_method_added:1,singleton_methods:1,size:1,sleep:1,slice:1,"slice!":1,sort:1,"sort!":1,sort_by:1,split:1,sprintf:1,squeeze:1,"squeeze!":1,srand:1,stat:1,step:1,store:1,strip:1,"strip!":1,sub:1,"sub!":1,succ:1,"succ!":1,sum:1,superclass:1,swapcase:1,"swapcase!":1,sync:1,syscall:1,sysopen:1,sysread:1,sysseek:1,system:1,syswrite:1,taint:1,"tainted?":1,tell:1,test:1,"throw":1,times:1,to_a:1,to_ary:1,to_f:1,to_hash:1,to_i:1,to_int:1,to_io:1,to_proc:1,to_s:1,to_str:1,to_sym:1,tr:1,"tr!":1,tr_s:1,"tr_s!":1,trace_var:1,transpose:1,trap:1,truncate:1,"tty?":1,type:1,ungetc:1,uniq:1,"uniq!":1,unpack:1,unshift:1,untaint:1,untrace_var:1,upcase:1,"upcase!":1,update:1,upto:1,"value?":1,values:1,values_at:1,warn:1,write:1,write_nonblock:1,"zero?":1,zip:1}};var h={cN:"yardoctag",b:"@[A-Za-z]+"};var d={cN:"comment",b:"#",e:"$",c:[h]};var c={cN:"comment",b:"^\\=begin",e:"^\\=end",c:[h],r:10};var b={cN:"comment",b:"^__END__",e:"\\n$"};var u={cN:"subst",b:"#\\{",e:"}",l:g,k:n};var p=[hljs.BE,u];var s={cN:"string",b:"'",e:"'",c:p,r:0};var r={cN:"string",b:'"',e:'"',c:p,r:0};var q={cN:"string",b:"%[qw]?\\(",e:"\\)",c:p,r:10};var o={cN:"string",b:"%[qw]?\\[",e:"\\]",c:p,r:10};var m={cN:"string",b:"%[qw]?{",e:"}",c:p,r:10};var l={cN:"string",b:"%[qw]?<",e:">",c:p,r:10};var k={cN:"string",b:"%[qw]?/",e:"/",c:p,r:10};var j={cN:"string",b:"%[qw]?%",e:"%",c:p,r:10};var i={cN:"string",b:"%[qw]?-",e:"-",c:p,r:10};var t={cN:"string",b:"%[qw]?\\|",e:"\\|",c:p,r:10};var e={cN:"function",b:"\\bdef\\s+",e:" |$|;",l:g,k:n,c:[{cN:"title",b:a,l:g,k:n},{cN:"params",b:"\\(",e:"\\)",l:g,k:n},d,c,b]};var f={cN:"identifier",b:g,l:g,k:n,r:0};var v=[d,c,b,s,r,q,o,m,l,k,j,i,t,{cN:"class",b:"\\b(class|module)\\b",e:"$|;",k:{"class":1,module:1},c:[{cN:"title",b:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?",r:0},{cN:"inheritance",b:"<\\s*",c:[{cN:"parent",b:"("+hljs.IR+"::)?"+hljs.IR}]},d,c,b]},e,{cN:"constant",b:"(::)?([A-Z]\\w*(::)?)+",r:0},{cN:"symbol",b:":",c:[s,r,q,o,m,l,k,j,i,t,f],r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{cN:"number",b:"\\?\\w"},{cN:"variable",b:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))"},f,{b:"("+hljs.RSR+")\\s*",c:[d,c,b,{cN:"regexp",b:"/",e:"/[a-z]*",i:"\\n",c:[hljs.BE]}],r:0}];u.c=v;e.c[1].c=v;return{dM:{l:g,k:n,c:v}}}();
21
- // ColorBox v1.3.20.1 - jQuery lightbox plugin
22
- // (c) 2011 Jack Moore - jacklmoore.com
23
- // License: http://www.opensource.org/licenses/mit-license.php
21
+ /*!
22
+ Colorbox v1.5.13 - 2014-08-04
23
+ jQuery lightbox and modal window plugin
24
+ (c) 2014 Jack Moore - http://www.jacklmoore.com/colorbox
25
+ license: http://www.opensource.org/licenses/mit-license.php
26
+ */
27
+
24
28
  (function ($, document, window) {
25
- var
26
- // Default settings object.
27
- // See http://jacklmoore.com/colorbox for details.
28
- defaults = {
29
- transition: "elastic",
30
- speed: 300,
31
- width: false,
32
- initialWidth: "600",
33
- innerWidth: false,
34
- maxWidth: false,
35
- height: false,
36
- initialHeight: "450",
37
- innerHeight: false,
38
- maxHeight: false,
39
- scalePhotos: true,
40
- scrolling: true,
41
- inline: false,
42
- html: false,
43
- iframe: false,
44
- fastIframe: true,
45
- photo: false,
46
- href: false,
47
- title: false,
48
- rel: false,
49
- opacity: 0.9,
50
- preloading: true,
51
-
52
- current: "image {current} of {total}",
53
- previous: "previous",
54
- next: "next",
55
- close: "close",
56
- xhrError: "This content failed to load.",
57
- imgError: "This image failed to load.",
58
-
59
- open: false,
60
- returnFocus: true,
61
- reposition: true,
62
- loop: true,
63
- slideshow: false,
64
- slideshowAuto: true,
65
- slideshowSpeed: 2500,
66
- slideshowStart: "start slideshow",
67
- slideshowStop: "stop slideshow",
68
- onOpen: false,
69
- onLoad: false,
70
- onComplete: false,
71
- onCleanup: false,
72
- onClosed: false,
73
- overlayClose: true,
74
- escKey: true,
75
- arrowKey: true,
76
- top: false,
77
- bottom: false,
78
- left: false,
79
- right: false,
80
- fixed: false,
81
- data: undefined
82
- },
83
-
84
- // Abstracting the HTML and event identifiers for easy rebranding
85
- colorbox = 'colorbox',
86
- prefix = 'cbox',
87
- boxElement = prefix + 'Element',
88
-
89
- // Events
90
- event_open = prefix + '_open',
91
- event_load = prefix + '_load',
92
- event_complete = prefix + '_complete',
93
- event_cleanup = prefix + '_cleanup',
94
- event_closed = prefix + '_closed',
95
- event_purge = prefix + '_purge',
96
-
97
- // Special Handling for IE
98
- isIE = !$.support.opacity && !$.support.style, // IE7 & IE8
99
- isIE6 = isIE && !window.XMLHttpRequest, // IE6
100
- event_ie6 = prefix + '_IE6',
101
-
102
- // Cached jQuery Object Variables
103
- $overlay,
104
- $box,
105
- $wrap,
106
- $content,
107
- $topBorder,
108
- $leftBorder,
109
- $rightBorder,
110
- $bottomBorder,
111
- $related,
112
- $window,
113
- $loaded,
114
- $loadingBay,
115
- $loadingOverlay,
116
- $title,
117
- $current,
118
- $slideshow,
119
- $next,
120
- $prev,
121
- $close,
122
- $groupControls,
123
-
124
- // Variables for cached values or use across multiple functions
125
- settings,
126
- interfaceHeight,
127
- interfaceWidth,
128
- loadedHeight,
129
- loadedWidth,
130
- element,
131
- index,
132
- photo,
133
- open,
134
- active,
135
- closing,
136
- loadingTimer,
137
- publicMethod,
138
- div = "div",
139
- init;
140
-
141
- // ****************
142
- // HELPER FUNCTIONS
143
- // ****************
144
-
145
- // Convience function for creating new jQuery objects
146
- function $tag(tag, id, css) {
147
- var element = document.createElement(tag);
29
+ var
30
+ // Default settings object.
31
+ // See http://jacklmoore.com/colorbox for details.
32
+ defaults = {
33
+ // data sources
34
+ html: false,
35
+ photo: false,
36
+ iframe: false,
37
+ inline: false,
38
+
39
+ // behavior and appearance
40
+ transition: "elastic",
41
+ speed: 300,
42
+ fadeOut: 300,
43
+ width: false,
44
+ initialWidth: "600",
45
+ innerWidth: false,
46
+ maxWidth: false,
47
+ height: false,
48
+ initialHeight: "450",
49
+ innerHeight: false,
50
+ maxHeight: false,
51
+ scalePhotos: true,
52
+ scrolling: true,
53
+ opacity: 0.9,
54
+ preloading: true,
55
+ className: false,
56
+ overlayClose: true,
57
+ escKey: true,
58
+ arrowKey: true,
59
+ top: false,
60
+ bottom: false,
61
+ left: false,
62
+ right: false,
63
+ fixed: false,
64
+ data: undefined,
65
+ closeButton: true,
66
+ fastIframe: true,
67
+ open: false,
68
+ reposition: true,
69
+ loop: true,
70
+ slideshow: false,
71
+ slideshowAuto: true,
72
+ slideshowSpeed: 2500,
73
+ slideshowStart: "start slideshow",
74
+ slideshowStop: "stop slideshow",
75
+ photoRegex: /\.(gif|png|jp(e|g|eg)|bmp|ico|webp|jxr|svg)((#|\?).*)?$/i,
76
+
77
+ // alternate image paths for high-res displays
78
+ retinaImage: false,
79
+ retinaUrl: false,
80
+ retinaSuffix: '@2x.$1',
81
+
82
+ // internationalization
83
+ current: "image {current} of {total}",
84
+ previous: "previous",
85
+ next: "next",
86
+ close: "close",
87
+ xhrError: "This content failed to load.",
88
+ imgError: "This image failed to load.",
89
+
90
+ // accessbility
91
+ returnFocus: true,
92
+ trapFocus: true,
93
+
94
+ // callbacks
95
+ onOpen: false,
96
+ onLoad: false,
97
+ onComplete: false,
98
+ onCleanup: false,
99
+ onClosed: false,
100
+
101
+ rel: function() {
102
+ return this.rel;
103
+ },
104
+ href: function() {
105
+ // using this.href would give the absolute url, when the href may have been inteded as a selector (e.g. '#container')
106
+ return $(this).attr('href');
107
+ },
108
+ title: function() {
109
+ return this.title;
110
+ }
111
+ },
112
+
113
+ // Abstracting the HTML and event identifiers for easy rebranding
114
+ colorbox = 'colorbox',
115
+ prefix = 'cbox',
116
+ boxElement = prefix + 'Element',
117
+
118
+ // Events
119
+ event_open = prefix + '_open',
120
+ event_load = prefix + '_load',
121
+ event_complete = prefix + '_complete',
122
+ event_cleanup = prefix + '_cleanup',
123
+ event_closed = prefix + '_closed',
124
+ event_purge = prefix + '_purge',
125
+
126
+ // Cached jQuery Object Variables
127
+ $overlay,
128
+ $box,
129
+ $wrap,
130
+ $content,
131
+ $topBorder,
132
+ $leftBorder,
133
+ $rightBorder,
134
+ $bottomBorder,
135
+ $related,
136
+ $window,
137
+ $loaded,
138
+ $loadingBay,
139
+ $loadingOverlay,
140
+ $title,
141
+ $current,
142
+ $slideshow,
143
+ $next,
144
+ $prev,
145
+ $close,
146
+ $groupControls,
147
+ $events = $('<a/>'), // $({}) would be prefered, but there is an issue with jQuery 1.4.2
148
+
149
+ // Variables for cached values or use across multiple functions
150
+ settings,
151
+ interfaceHeight,
152
+ interfaceWidth,
153
+ loadedHeight,
154
+ loadedWidth,
155
+ index,
156
+ photo,
157
+ open,
158
+ active,
159
+ closing,
160
+ loadingTimer,
161
+ publicMethod,
162
+ div = "div",
163
+ requests = 0,
164
+ previousCSS = {},
165
+ init;
166
+
167
+ // ****************
168
+ // HELPER FUNCTIONS
169
+ // ****************
170
+
171
+ // Convenience function for creating new jQuery objects
172
+ function $tag(tag, id, css) {
173
+ var element = document.createElement(tag);
174
+
175
+ if (id) {
176
+ element.id = prefix + id;
177
+ }
148
178
 
149
- if (id) {
150
- element.id = prefix + id;
151
- }
179
+ if (css) {
180
+ element.style.cssText = css;
181
+ }
152
182
 
153
- if (css) {
154
- element.style.cssText = css;
155
- }
183
+ return $(element);
184
+ }
156
185
 
157
- return $(element);
158
- }
186
+ // Get the window height using innerHeight when available to avoid an issue with iOS
187
+ // http://bugs.jquery.com/ticket/6724
188
+ function winheight() {
189
+ return window.innerHeight ? window.innerHeight : $(window).height();
190
+ }
159
191
 
160
- // Determine the next and previous members in a group.
161
- function getIndex(increment) {
162
- var
163
- max = $related.length,
164
- newIndex = (index + increment) % max;
165
-
166
- return (newIndex < 0) ? max + newIndex : newIndex;
167
- }
192
+ function Settings(element, options) {
193
+ if (options !== Object(options)) {
194
+ options = {};
195
+ }
168
196
 
169
- // Convert '%' and 'px' values to integers
170
- function setSize(size, dimension) {
171
- return Math.round((/%/.test(size) ? ((dimension === 'x' ? winWidth() : winHeight()) / 100) : 1) * parseInt(size, 10));
172
- }
173
-
174
- // Checks an href to see if it is a photo.
175
- // There is a force photo option (photo: true) for hrefs that cannot be matched by this regex.
176
- function isImage(url) {
177
- return settings.photo || /\.(gif|png|jp(e|g|eg)|bmp|ico)((#|\?).*)?$/i.test(url);
178
- }
179
-
180
- function winWidth() {
181
- // $(window).width() is incorrect for some mobile browsers, but
182
- // window.innerWidth is unsupported in IE8 and lower.
183
- return window.innerWidth || $window.width();
184
- }
185
-
186
- function winHeight() {
187
- return window.innerHeight || $window.height();
188
- }
189
-
190
- // Assigns function results to their respective properties
191
- function makeSettings() {
192
- var i,
193
- data = $.data(element, colorbox);
194
-
195
- if (data == null) {
196
- settings = $.extend({}, defaults);
197
- if (console && console.log) {
198
- console.log('Error: cboxElement missing settings object');
199
- }
200
- } else {
201
- settings = $.extend({}, data);
202
- }
203
-
204
- for (i in settings) {
205
- if ($.isFunction(settings[i]) && i.slice(0, 2) !== 'on') { // checks to make sure the function isn't one of the callbacks, they will be handled at the appropriate time.
206
- settings[i] = settings[i].call(element);
207
- }
208
- }
209
-
210
- settings.rel = settings.rel || element.rel || $(element).data('rel') || 'nofollow';
211
- settings.href = settings.href || $(element).attr('href');
212
- settings.title = settings.title || element.title;
213
-
214
- if (typeof settings.href === "string") {
215
- settings.href = $.trim(settings.href);
216
- }
217
- }
197
+ this.cache = {};
198
+ this.el = element;
218
199
 
219
- function trigger(event, callback) {
220
- $.event.trigger(event);
221
- if (callback) {
222
- callback.call(element);
223
- }
224
- }
225
-
226
- // Slideshow functionality
227
- function slideshow() {
228
- var
229
- timeOut,
230
- className = prefix + "Slideshow_",
231
- click = "click." + prefix,
232
- start,
233
- stop,
234
- clear;
235
-
236
- if (settings.slideshow && $related[1]) {
237
- start = function () {
238
- $slideshow
239
- .html(settings.slideshowStop)
240
- .unbind(click)
241
- .bind(event_complete, function () {
242
- if (settings.loop || $related[index + 1]) {
243
- timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed);
244
- }
245
- })
246
- .bind(event_load, function () {
247
- clearTimeout(timeOut);
248
- })
249
- .one(click + ' ' + event_cleanup, stop);
250
- $box.removeClass(className + "off").addClass(className + "on");
251
- timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed);
252
- };
253
-
254
- stop = function () {
255
- clearTimeout(timeOut);
256
- $slideshow
257
- .html(settings.slideshowStart)
258
- .unbind([event_complete, event_load, event_cleanup, click].join(' '))
259
- .one(click, function () {
260
- publicMethod.next();
261
- start();
262
- });
263
- $box.removeClass(className + "on").addClass(className + "off");
264
- };
265
-
266
- if (settings.slideshowAuto) {
267
- start();
268
- } else {
269
- stop();
270
- }
271
- } else {
272
- $box.removeClass(className + "off " + className + "on");
273
- }
274
- }
275
-
276
- function launch(target) {
277
- if (!closing) {
278
-
279
- element = target;
280
-
281
- makeSettings();
282
-
283
- $related = $(element);
284
-
285
- index = 0;
286
-
287
- if (settings.rel !== 'nofollow') {
288
- $related = $('.' + boxElement).filter(function () {
289
- var data = $.data(this, colorbox),
290
- relRelated;
291
-
292
- if (data) {
293
- relRelated = $(this).data('rel') || data.rel || this.rel;
294
- }
295
-
296
- return (relRelated === settings.rel);
297
- });
298
- index = $related.index(element);
299
-
300
- // Check direct calls to ColorBox.
301
- if (index === -1) {
302
- $related = $related.add(element);
303
- index = $related.length - 1;
304
- }
305
- }
306
-
307
- if (!open) {
308
- open = active = true; // Prevents the page-change action from queuing up if the visitor holds down the left or right keys.
309
-
310
- $box.show();
311
-
312
- if (settings.returnFocus) {
313
- $(element).blur().one(event_closed, function () {
314
- $(this).focus();
315
- });
316
- }
317
-
318
- // +settings.opacity avoids a problem in IE when using non-zero-prefixed-string-values, like '.5'
319
- $overlay.css({"opacity": +settings.opacity, "cursor": settings.overlayClose ? "pointer" : "auto"}).show();
320
-
321
- // Opens inital empty ColorBox prior to content being loaded.
322
- settings.w = setSize(settings.initialWidth, 'x');
323
- settings.h = setSize(settings.initialHeight, 'y');
324
- publicMethod.position();
325
-
326
- if (isIE6) {
327
- $window.bind('resize.' + event_ie6 + ' scroll.' + event_ie6, function () {
328
- $overlay.css({width: winWidth(), height: winHeight(), top: $window.scrollTop(), left: $window.scrollLeft()});
329
- }).trigger('resize.' + event_ie6);
330
- }
331
-
332
- trigger(event_open, settings.onOpen);
333
-
334
- $groupControls.add($title).hide();
335
-
336
- $close.html(settings.close).show();
337
- }
338
-
339
- publicMethod.load(true);
340
- }
341
- }
342
-
343
- // ColorBox's markup needs to be added to the DOM prior to being called
344
- // so that the browser will go ahead and load the CSS background images.
345
- function appendHTML() {
346
- if (!$box && document.body) {
347
- init = false;
348
-
349
- $window = $(window);
350
- $box = $tag(div).attr({id: colorbox, 'class': isIE ? prefix + (isIE6 ? 'IE6' : 'IE') : ''}).hide();
351
- $overlay = $tag(div, "Overlay", isIE6 ? 'position:absolute' : '').hide();
352
- $loadingOverlay = $tag(div, "LoadingOverlay").add($tag(div, "LoadingGraphic"));
353
- $wrap = $tag(div, "Wrapper");
354
- $content = $tag(div, "Content").append(
355
- $loaded = $tag(div, "LoadedContent", 'width:0; height:0; overflow:hidden'),
356
- $title = $tag(div, "Title"),
357
- $current = $tag(div, "Current"),
358
- $next = $tag(div, "Next"),
359
- $prev = $tag(div, "Previous"),
360
- $slideshow = $tag(div, "Slideshow").bind(event_open, slideshow),
361
- $close = $tag(div, "Close")
362
- );
363
-
364
- $wrap.append( // The 3x3 Grid that makes up ColorBox
365
- $tag(div).append(
366
- $tag(div, "TopLeft"),
367
- $topBorder = $tag(div, "TopCenter"),
368
- $tag(div, "TopRight")
369
- ),
370
- $tag(div, false, 'clear:left').append(
371
- $leftBorder = $tag(div, "MiddleLeft"),
372
- $content,
373
- $rightBorder = $tag(div, "MiddleRight")
374
- ),
375
- $tag(div, false, 'clear:left').append(
376
- $tag(div, "BottomLeft"),
377
- $bottomBorder = $tag(div, "BottomCenter"),
378
- $tag(div, "BottomRight")
379
- )
380
- ).find('div div').css({'float': 'left'});
381
-
382
- $loadingBay = $tag(div, false, 'position:absolute; width:9999px; visibility:hidden; display:none');
383
-
384
- $groupControls = $next.add($prev).add($current).add($slideshow);
385
-
386
- $(document.body).append($overlay, $box.append($wrap, $loadingBay));
387
- }
388
- }
389
-
390
- // Add ColorBox's event bindings
391
- function addBindings() {
392
- if ($box) {
393
- if (!init) {
394
- init = true;
395
-
396
- // Cache values needed for size calculations
397
- interfaceHeight = $topBorder.height() + $bottomBorder.height() + $content.outerHeight(true) - $content.height();//Subtraction needed for IE6
398
- interfaceWidth = $leftBorder.width() + $rightBorder.width() + $content.outerWidth(true) - $content.width();
399
- loadedHeight = $loaded.outerHeight(true);
400
- loadedWidth = $loaded.outerWidth(true);
401
-
402
- // Setting padding to remove the need to do size conversions during the animation step.
403
- $box.css({"padding-bottom": interfaceHeight, "padding-right": interfaceWidth});
404
-
405
- // Anonymous functions here keep the public method from being cached, thereby allowing them to be redefined on the fly.
406
- $next.click(function () {
407
- publicMethod.next();
408
- });
409
- $prev.click(function () {
410
- publicMethod.prev();
411
- });
412
- $close.click(function () {
413
- publicMethod.close();
414
- });
415
- $overlay.click(function () {
416
- if (settings.overlayClose) {
417
- publicMethod.close();
418
- }
419
- });
420
-
421
- // Key Bindings
422
- $(document).bind('keydown.' + prefix, function (e) {
423
- var key = e.keyCode;
424
- if (open && settings.escKey && key === 27) {
425
- e.preventDefault();
426
- publicMethod.close();
427
- }
428
- if (open && settings.arrowKey && $related[1]) {
429
- if (key === 37) {
430
- e.preventDefault();
431
- $prev.click();
432
- } else if (key === 39) {
433
- e.preventDefault();
434
- $next.click();
435
- }
436
- }
437
- });
438
-
439
- $('.' + boxElement, document).live('click', function (e) {
440
- // ignore non-left-mouse-clicks and clicks modified with ctrl / command, shift, or alt.
441
- // See: http://jacklmoore.com/notes/click-events/
442
- if (!(e.which > 1 || e.shiftKey || e.altKey || e.metaKey)) {
443
- e.preventDefault();
444
- launch(this);
445
- }
446
- });
447
- }
448
- return true;
449
- }
450
- return false;
451
- }
200
+ this.value = function(key) {
201
+ var dataAttr;
452
202
 
453
- // Don't do anything if ColorBox already exists.
454
- if ($.colorbox) {
455
- return;
456
- }
203
+ if (this.cache[key] === undefined) {
204
+ dataAttr = $(this.el).attr('data-cbox-'+key);
457
205
 
458
- // Append the HTML when the DOM loads
459
- $(appendHTML);
206
+ if (dataAttr !== undefined) {
207
+ this.cache[key] = dataAttr;
208
+ } else if (options[key] !== undefined) {
209
+ this.cache[key] = options[key];
210
+ } else if (defaults[key] !== undefined) {
211
+ this.cache[key] = defaults[key];
212
+ }
213
+ }
460
214
 
215
+ return this.cache[key];
216
+ };
461
217
 
462
- // ****************
463
- // PUBLIC FUNCTIONS
464
- // Usage format: $.fn.colorbox.close();
465
- // Usage from within an iframe: parent.$.fn.colorbox.close();
466
- // ****************
467
-
468
- publicMethod = $.fn[colorbox] = $[colorbox] = function (options, callback) {
469
- var $this = this;
470
-
471
- options = options || {};
472
-
473
- appendHTML();
474
-
475
- if (addBindings()) {
476
- if (!$this[0]) {
477
- if ($this.selector) { // if a selector was given and it didn't match any elements, go ahead and exit.
478
- return $this;
479
- }
480
- // if no selector was given (ie. $.colorbox()), create a temporary element to work with
481
- $this = $('<a/>');
482
- options.open = true; // assume an immediate open
483
- }
484
-
485
- if (callback) {
486
- options.onComplete = callback;
487
- }
488
-
489
- $this.each(function () {
490
- $.data(this, colorbox, $.extend({}, $.data(this, colorbox) || defaults, options));
491
- }).addClass(boxElement);
492
-
493
- if (($.isFunction(options.open) && options.open.call($this)) || options.open) {
494
- launch($this[0]);
495
- }
496
- }
497
-
498
- return $this;
499
- };
218
+ this.get = function(key) {
219
+ var value = this.value(key);
220
+ return $.isFunction(value) ? value.call(this.el, this) : value;
221
+ };
222
+ }
500
223
 
501
- publicMethod.position = function (speed, loadedCallback) {
502
- var
503
- css,
504
- top = 0,
505
- left = 0,
506
- offset = $box.offset(),
507
- scrollTop,
508
- scrollLeft;
509
-
510
- $window.unbind('resize.' + prefix);
511
-
512
- // remove the modal so that it doesn't influence the document width/height
513
- $box.css({top: -9e4, left: -9e4});
514
-
515
- scrollTop = $window.scrollTop();
516
- scrollLeft = $window.scrollLeft();
517
-
518
- if (settings.fixed && !isIE6) {
519
- offset.top -= scrollTop;
520
- offset.left -= scrollLeft;
521
- $box.css({position: 'fixed'});
522
- } else {
523
- top = scrollTop;
524
- left = scrollLeft;
525
- $box.css({position: 'absolute'});
526
- }
224
+ // Determine the next and previous members in a group.
225
+ function getIndex(increment) {
226
+ var
227
+ max = $related.length,
228
+ newIndex = (index + increment) % max;
527
229
 
528
- // keeps the top and left positions within the browser's viewport.
529
- if (settings.right !== false) {
530
- left += Math.max(winWidth() - settings.w - loadedWidth - interfaceWidth - setSize(settings.right, 'x'), 0);
531
- } else if (settings.left !== false) {
532
- left += setSize(settings.left, 'x');
533
- } else {
534
- left += Math.round(Math.max(winWidth() - settings.w - loadedWidth - interfaceWidth, 0) / 2);
535
- }
536
-
537
- if (settings.bottom !== false) {
538
- top += Math.max(winHeight() - settings.h - loadedHeight - interfaceHeight - setSize(settings.bottom, 'y'), 0);
539
- } else if (settings.top !== false) {
540
- top += setSize(settings.top, 'y');
541
- } else {
542
- top += Math.round(Math.max(winHeight() - settings.h - loadedHeight - interfaceHeight, 0) / 2);
543
- }
230
+ return (newIndex < 0) ? max + newIndex : newIndex;
231
+ }
544
232
 
545
- $box.css({top: offset.top, left: offset.left});
233
+ // Convert '%' and 'px' values to integers
234
+ function setSize(size, dimension) {
235
+ return Math.round((/%/.test(size) ? ((dimension === 'x' ? $window.width() : winheight()) / 100) : 1) * parseInt(size, 10));
236
+ }
546
237
 
547
- // setting the speed to 0 to reduce the delay between same-sized content.
548
- speed = ($box.width() === settings.w + loadedWidth && $box.height() === settings.h + loadedHeight) ? 0 : speed || 0;
549
-
550
- // this gives the wrapper plenty of breathing room so it's floated contents can move around smoothly,
551
- // but it has to be shrank down around the size of div#colorbox when it's done. If not,
552
- // it can invoke an obscure IE bug when using iframes.
553
- $wrap[0].style.width = $wrap[0].style.height = "9999px";
554
-
555
- function modalDimensions(that) {
556
- $topBorder[0].style.width = $bottomBorder[0].style.width = $content[0].style.width = that.style.width;
557
- $content[0].style.height = $leftBorder[0].style.height = $rightBorder[0].style.height = that.style.height;
558
- }
238
+ // Checks an href to see if it is a photo.
239
+ // There is a force photo option (photo: true) for hrefs that cannot be matched by the regex.
240
+ function isImage(settings, url) {
241
+ return settings.get('photo') || settings.get('photoRegex').test(url);
242
+ }
559
243
 
560
- css = {width: settings.w + loadedWidth, height: settings.h + loadedHeight, top: top, left: left};
561
- if(speed===0){ // temporary workaround to side-step jQuery-UI 1.8 bug (http://bugs.jquery.com/ticket/12273)
562
- $box.css(css);
563
- }
564
- $box.dequeue().animate(css, {
565
- duration: speed,
566
- complete: function () {
567
- modalDimensions(this);
568
-
569
- active = false;
570
-
571
- // shrink the wrapper down to exactly the size of colorbox to avoid a bug in IE's iframe implementation.
572
- $wrap[0].style.width = (settings.w + loadedWidth + interfaceWidth) + "px";
573
- $wrap[0].style.height = (settings.h + loadedHeight + interfaceHeight) + "px";
574
-
575
- if (settings.reposition) {
576
- setTimeout(function () { // small delay before binding onresize due to an IE8 bug.
577
- $window.bind('resize.' + prefix, publicMethod.position);
578
- }, 1);
579
- }
580
-
581
- if (loadedCallback) {
582
- loadedCallback();
583
- }
584
- },
585
- step: function () {
586
- modalDimensions(this);
587
- }
588
- });
589
- };
244
+ function retinaUrl(settings, url) {
245
+ return settings.get('retinaUrl') && window.devicePixelRatio > 1 ? url.replace(settings.get('photoRegex'), settings.get('retinaSuffix')) : url;
246
+ }
590
247
 
591
- publicMethod.resize = function (options) {
592
- if (open) {
593
- options = options || {};
594
-
595
- if (options.width) {
596
- settings.w = setSize(options.width, 'x') - loadedWidth - interfaceWidth;
597
- }
598
- if (options.innerWidth) {
599
- settings.w = setSize(options.innerWidth, 'x');
600
- }
601
- $loaded.css({width: settings.w});
602
-
603
- if (options.height) {
604
- settings.h = setSize(options.height, 'y') - loadedHeight - interfaceHeight;
605
- }
606
- if (options.innerHeight) {
607
- settings.h = setSize(options.innerHeight, 'y');
608
- }
609
- if (!options.innerHeight && !options.height) {
610
- $loaded.css({height: "auto"});
611
- settings.h = $loaded.height();
612
- }
613
- $loaded.css({height: settings.h});
614
-
615
- publicMethod.position(settings.transition === "none" ? 0 : settings.speed);
616
- }
617
- };
248
+ function trapFocus(e) {
249
+ if ('contains' in $box[0] && !$box[0].contains(e.target) && e.target !== $overlay[0]) {
250
+ e.stopPropagation();
251
+ $box.focus();
252
+ }
253
+ }
618
254
 
619
- publicMethod.prep = function (object) {
620
- if (!open) {
621
- return;
622
- }
623
-
624
- var callback, speed = settings.transition === "none" ? 0 : settings.speed;
625
-
626
- $loaded.remove();
627
- $loaded = $tag(div, 'LoadedContent').append(object);
628
-
629
- function getWidth() {
630
- settings.w = settings.w || $loaded.width();
631
- settings.w = settings.mw && settings.mw < settings.w ? settings.mw : settings.w;
632
- return settings.w;
633
- }
634
- function getHeight() {
635
- settings.h = settings.h || $loaded.height();
636
- settings.h = settings.mh && settings.mh < settings.h ? settings.mh : settings.h;
637
- return settings.h;
638
- }
639
-
640
- $loaded.hide()
641
- .appendTo($loadingBay.show())// content has to be appended to the DOM for accurate size calculations.
642
- .css({width: getWidth(), overflow: settings.scrolling ? 'auto' : 'hidden'})
643
- .css({height: getHeight()})// sets the height independently from the width in case the new width influences the value of height.
644
- .prependTo($content);
645
-
646
- $loadingBay.hide();
647
-
648
- // floating the IMG removes the bottom line-height and fixed a problem where IE miscalculates the width of the parent element as 100% of the document width.
649
- //$(photo).css({'float': 'none', marginLeft: 'auto', marginRight: 'auto'});
650
-
651
- $(photo).css({'float': 'none'});
652
-
653
- // Hides SELECT elements in IE6 because they would otherwise sit on top of the overlay.
654
- if (isIE6) {
655
- $('select').not($box.find('select')).filter(function () {
656
- return this.style.visibility !== 'hidden';
657
- }).css({'visibility': 'hidden'}).one(event_cleanup, function () {
658
- this.style.visibility = 'inherit';
659
- });
660
- }
661
-
662
- callback = function () {
663
- var preload,
664
- i,
665
- total = $related.length,
666
- iframe,
667
- frameBorder = 'frameBorder',
668
- allowTransparency = 'allowTransparency',
669
- complete,
670
- src,
671
- img,
672
- data;
673
-
674
- if (!open) {
675
- return;
676
- }
677
-
678
- function removeFilter() {
679
- if (isIE) {
680
- $box[0].style.removeAttribute('filter');
681
- }
682
- }
683
-
684
- complete = function () {
685
- clearTimeout(loadingTimer);
686
- // Detaching forces Andriod stock browser to redraw the area underneat the loading overlay. Hiding alone isn't enough.
687
- $loadingOverlay.detach().hide();
688
- trigger(event_complete, settings.onComplete);
689
- };
690
-
691
- if (isIE) {
692
- //This fadeIn helps the bicubic resampling to kick-in.
693
- if (photo) {
694
- $loaded.fadeIn(100);
695
- }
696
- }
697
-
698
- $title.html(settings.title).add($loaded).show();
699
-
700
- if (total > 1) { // handle grouping
701
- if (typeof settings.current === "string") {
702
- $current.html(settings.current.replace('{current}', index + 1).replace('{total}', total)).show();
703
- }
704
-
705
- $next[(settings.loop || index < total - 1) ? "show" : "hide"]().html(settings.next);
706
- $prev[(settings.loop || index) ? "show" : "hide"]().html(settings.previous);
707
-
708
- if (settings.slideshow) {
709
- $slideshow.show();
710
- }
711
-
712
- // Preloads images within a rel group
713
- if (settings.preloading) {
714
- preload = [
715
- getIndex(-1),
716
- getIndex(1)
717
- ];
718
- while (i = $related[preload.pop()]) {
719
- data = $.data(i, colorbox);
720
-
721
- if (data && data.href) {
722
- src = data.href;
723
- if ($.isFunction(src)) {
724
- src = src.call(i);
725
- }
726
- } else {
727
- src = i.href;
728
- }
729
-
730
- if (isImage(src)) {
731
- img = new Image();
732
- img.src = src;
733
- }
734
- }
735
- }
736
- } else {
737
- $groupControls.hide();
738
- }
739
-
740
- if (settings.iframe) {
741
- iframe = $tag('iframe')[0];
742
-
743
- if (frameBorder in iframe) {
744
- iframe[frameBorder] = 0;
745
- }
746
-
747
- if (allowTransparency in iframe) {
748
- iframe[allowTransparency] = "true";
749
- }
750
-
751
- if (!settings.scrolling) {
752
- iframe.scrolling = "no";
753
- }
754
-
755
- $(iframe)
756
- .attr({
757
- src: settings.href,
758
- name: (new Date()).getTime(), // give the iframe a unique name to prevent caching
759
- 'class': prefix + 'Iframe',
760
- allowFullScreen : true, // allow HTML5 video to go fullscreen
761
- webkitAllowFullScreen : true,
762
- mozallowfullscreen : true
763
- })
764
- .one('load', complete)
765
- .one(event_purge, function () {
766
- iframe.src = "//about:blank";
767
- })
768
- .appendTo($loaded);
769
-
770
- if (settings.fastIframe) {
771
- $(iframe).trigger('load');
772
- }
773
- } else {
774
- complete();
775
- }
776
-
777
- if (settings.transition === 'fade') {
778
- $box.fadeTo(speed, 1, removeFilter);
779
- } else {
780
- removeFilter();
781
- }
782
- };
783
-
784
- if (settings.transition === 'fade') {
785
- $box.fadeTo(speed, 0, function () {
786
- publicMethod.position(0, callback);
787
- });
788
- } else {
789
- publicMethod.position(speed, callback);
790
- }
791
- };
255
+ function setClass(str) {
256
+ if (setClass.str !== str) {
257
+ $box.add($overlay).removeClass(setClass.str).addClass(str);
258
+ setClass.str = str;
259
+ }
260
+ }
792
261
 
793
- publicMethod.load = function (launched) {
794
- var href, setResize, prep = publicMethod.prep;
795
-
796
- active = true;
797
-
798
- photo = false;
799
-
800
- element = $related[index];
801
-
802
- if (!launched) {
803
- makeSettings();
804
- }
805
-
806
- trigger(event_purge);
807
-
808
- trigger(event_load, settings.onLoad);
809
-
810
- settings.h = settings.height ?
811
- setSize(settings.height, 'y') - loadedHeight - interfaceHeight :
812
- settings.innerHeight && setSize(settings.innerHeight, 'y');
813
-
814
- settings.w = settings.width ?
815
- setSize(settings.width, 'x') - loadedWidth - interfaceWidth :
816
- settings.innerWidth && setSize(settings.innerWidth, 'x');
817
-
818
- // Sets the minimum dimensions for use in image scaling
819
- settings.mw = settings.w;
820
- settings.mh = settings.h;
821
-
822
- // Re-evaluate the minimum width and height based on maxWidth and maxHeight values.
823
- // If the width or height exceed the maxWidth or maxHeight, use the maximum values instead.
824
- if (settings.maxWidth) {
825
- settings.mw = setSize(settings.maxWidth, 'x') - loadedWidth - interfaceWidth;
826
- settings.mw = settings.w && settings.w < settings.mw ? settings.w : settings.mw;
827
- }
828
- if (settings.maxHeight) {
829
- settings.mh = setSize(settings.maxHeight, 'y') - loadedHeight - interfaceHeight;
830
- settings.mh = settings.h && settings.h < settings.mh ? settings.h : settings.mh;
831
- }
832
-
833
- href = settings.href;
834
-
835
- loadingTimer = setTimeout(function () {
836
- $loadingOverlay.show().appendTo($content);
837
- }, 100);
838
-
839
- if (settings.inline) {
840
- // Inserts an empty placeholder where inline content is being pulled from.
841
- // An event is bound to put inline content back when ColorBox closes or loads new content.
842
- $tag(div).hide().insertBefore($(href)[0]).one(event_purge, function () {
843
- $(this).replaceWith($loaded.children());
844
- });
845
- prep($(href));
846
- } else if (settings.iframe) {
847
- // IFrame element won't be added to the DOM until it is ready to be displayed,
848
- // to avoid problems with DOM-ready JS that might be trying to run in that iframe.
849
- prep(" ");
850
- } else if (settings.html) {
851
- prep(settings.html);
852
- } else if (isImage(href)) {
853
- $(photo = new Image())
854
- .addClass(prefix + 'Photo')
855
- .error(function () {
856
- settings.title = false;
857
- prep($tag(div, 'Error').html(settings.imgError));
858
- })
859
- .load(function () {
860
- var percent;
861
- photo.onload = null; //stops animated gifs from firing the onload repeatedly.
862
-
863
- if (settings.scalePhotos) {
864
- setResize = function () {
865
- photo.height -= photo.height * percent;
866
- photo.width -= photo.width * percent;
867
- };
868
- if (settings.mw && photo.width > settings.mw) {
869
- percent = (photo.width - settings.mw) / photo.width;
870
- setResize();
871
- }
872
- if (settings.mh && photo.height > settings.mh) {
873
- percent = (photo.height - settings.mh) / photo.height;
874
- setResize();
875
- }
876
- }
877
-
878
- if (settings.h) {
879
- photo.style.marginTop = Math.max(settings.h - photo.height, 0) / 2 + 'px';
880
- }
881
-
882
- if ($related[1] && (settings.loop || $related[index + 1])) {
883
- photo.style.cursor = 'pointer';
884
- photo.onclick = function () {
885
- publicMethod.next();
886
- };
887
- }
888
-
889
- if (isIE) {
890
- photo.style.msInterpolationMode = 'bicubic';
891
- }
892
-
893
- setTimeout(function () { // A pause because Chrome will sometimes report a 0 by 0 size otherwise.
894
- prep(photo);
895
- }, 1);
896
- });
897
-
898
- setTimeout(function () { // A pause because Opera 10.6+ will sometimes not run the onload function otherwise.
899
- photo.src = href;
900
- }, 1);
901
- } else if (href) {
902
- $loadingBay.load(href, settings.data, function (data, status, xhr) {
903
- prep(status === 'error' ? $tag(div, 'Error').html(settings.xhrError) : $(this).contents());
904
- });
905
- }
906
- };
907
-
908
- // Navigates to the next page/image in a set.
909
- publicMethod.next = function () {
910
- if (!active && $related[1] && (settings.loop || $related[index + 1])) {
911
- index = getIndex(1);
912
- publicMethod.load();
913
- }
914
- };
915
-
916
- publicMethod.prev = function () {
917
- if (!active && $related[1] && (settings.loop || index)) {
918
- index = getIndex(-1);
919
- publicMethod.load();
920
- }
921
- };
262
+ function getRelated(rel) {
263
+ index = 0;
264
+
265
+ if (rel && rel !== false && rel !== 'nofollow') {
266
+ $related = $('.' + boxElement).filter(function () {
267
+ var options = $.data(this, colorbox);
268
+ var settings = new Settings(this, options);
269
+ return (settings.get('rel') === rel);
270
+ });
271
+ index = $related.index(settings.el);
272
+
273
+ // Check direct calls to Colorbox.
274
+ if (index === -1) {
275
+ $related = $related.add(settings.el);
276
+ index = $related.length - 1;
277
+ }
278
+ } else {
279
+ $related = $(settings.el);
280
+ }
281
+ }
922
282
 
923
- // Note: to use this within an iframe use the following format: parent.$.fn.colorbox.close();
924
- publicMethod.close = function () {
925
- if (open && !closing) {
926
-
927
- closing = true;
928
-
929
- open = false;
930
-
931
- trigger(event_cleanup, settings.onCleanup);
932
-
933
- $window.unbind('.' + prefix + ' .' + event_ie6);
934
-
935
- $overlay.fadeTo(200, 0);
936
-
937
- $box.stop().fadeTo(300, 0, function () {
938
-
939
- $box.add($overlay).css({'opacity': 1, cursor: 'auto'}).hide();
940
-
941
- trigger(event_purge);
942
-
943
- $loaded.remove();
944
-
945
- setTimeout(function () {
946
- closing = false;
947
- trigger(event_closed, settings.onClosed);
948
- }, 1);
949
- });
950
- }
951
- };
283
+ function trigger(event) {
284
+ // for external use
285
+ $(document).trigger(event);
286
+ // for internal use
287
+ $events.triggerHandler(event);
288
+ }
952
289
 
953
- // Removes changes ColorBox made to the document, but does not remove the plugin
954
- // from jQuery.
955
- publicMethod.remove = function () {
956
- $([]).add($box).add($overlay).remove();
957
- $box = null;
958
- $('.' + boxElement)
959
- .removeData(colorbox)
960
- .removeClass(boxElement)
961
- .die();
962
- };
290
+ var slideshow = (function(){
291
+ var active,
292
+ className = prefix + "Slideshow_",
293
+ click = "click." + prefix,
294
+ timeOut;
963
295
 
964
- // A method for fetching the current element ColorBox is referencing.
965
- // returns a jQuery object.
966
- publicMethod.element = function () {
967
- return $(element);
968
- };
296
+ function clear () {
297
+ clearTimeout(timeOut);
298
+ }
299
+
300
+ function set() {
301
+ if (settings.get('loop') || $related[index + 1]) {
302
+ clear();
303
+ timeOut = setTimeout(publicMethod.next, settings.get('slideshowSpeed'));
304
+ }
305
+ }
306
+
307
+ function start() {
308
+ $slideshow
309
+ .html(settings.get('slideshowStop'))
310
+ .unbind(click)
311
+ .one(click, stop);
312
+
313
+ $events
314
+ .bind(event_complete, set)
315
+ .bind(event_load, clear);
316
+
317
+ $box.removeClass(className + "off").addClass(className + "on");
318
+ }
319
+
320
+ function stop() {
321
+ clear();
322
+
323
+ $events
324
+ .unbind(event_complete, set)
325
+ .unbind(event_load, clear);
969
326
 
970
- publicMethod.settings = defaults;
327
+ $slideshow
328
+ .html(settings.get('slideshowStart'))
329
+ .unbind(click)
330
+ .one(click, function () {
331
+ publicMethod.next();
332
+ start();
333
+ });
334
+
335
+ $box.removeClass(className + "on").addClass(className + "off");
336
+ }
337
+
338
+ function reset() {
339
+ active = false;
340
+ $slideshow.hide();
341
+ clear();
342
+ $events
343
+ .unbind(event_complete, set)
344
+ .unbind(event_load, clear);
345
+ $box.removeClass(className + "off " + className + "on");
346
+ }
347
+
348
+ return function(){
349
+ if (active) {
350
+ if (!settings.get('slideshow')) {
351
+ $events.unbind(event_cleanup, reset);
352
+ reset();
353
+ }
354
+ } else {
355
+ if (settings.get('slideshow') && $related[1]) {
356
+ active = true;
357
+ $events.one(event_cleanup, reset);
358
+ if (settings.get('slideshowAuto')) {
359
+ start();
360
+ } else {
361
+ stop();
362
+ }
363
+ $slideshow.show();
364
+ }
365
+ }
366
+ };
367
+
368
+ }());
369
+
370
+
371
+ function launch(element) {
372
+ var options;
373
+
374
+ if (!closing) {
375
+
376
+ options = $(element).data(colorbox);
377
+
378
+ settings = new Settings(element, options);
379
+
380
+ getRelated(settings.get('rel'));
381
+
382
+ if (!open) {
383
+ open = active = true; // Prevents the page-change action from queuing up if the visitor holds down the left or right keys.
384
+
385
+ setClass(settings.get('className'));
386
+
387
+ // Show colorbox so the sizes can be calculated in older versions of jQuery
388
+ $box.css({visibility:'hidden', display:'block', opacity:''});
389
+
390
+ $loaded = $tag(div, 'LoadedContent', 'width:0; height:0; overflow:hidden; visibility:hidden');
391
+ $content.css({width:'', height:''}).append($loaded);
392
+
393
+ // Cache values needed for size calculations
394
+ interfaceHeight = $topBorder.height() + $bottomBorder.height() + $content.outerHeight(true) - $content.height();
395
+ interfaceWidth = $leftBorder.width() + $rightBorder.width() + $content.outerWidth(true) - $content.width();
396
+ loadedHeight = $loaded.outerHeight(true);
397
+ loadedWidth = $loaded.outerWidth(true);
398
+
399
+ // Opens inital empty Colorbox prior to content being loaded.
400
+ var initialWidth = setSize(settings.get('initialWidth'), 'x');
401
+ var initialHeight = setSize(settings.get('initialHeight'), 'y');
402
+ var maxWidth = settings.get('maxWidth');
403
+ var maxHeight = settings.get('maxHeight');
404
+
405
+ settings.w = (maxWidth !== false ? Math.min(initialWidth, setSize(maxWidth, 'x')) : initialWidth) - loadedWidth - interfaceWidth;
406
+ settings.h = (maxHeight !== false ? Math.min(initialHeight, setSize(maxHeight, 'y')) : initialHeight) - loadedHeight - interfaceHeight;
407
+
408
+ $loaded.css({width:'', height:settings.h});
409
+ publicMethod.position();
410
+
411
+ trigger(event_open);
412
+ settings.get('onOpen');
413
+
414
+ $groupControls.add($title).hide();
415
+
416
+ $box.focus();
417
+
418
+ if (settings.get('trapFocus')) {
419
+ // Confine focus to the modal
420
+ // Uses event capturing that is not supported in IE8-
421
+ if (document.addEventListener) {
422
+
423
+ document.addEventListener('focus', trapFocus, true);
424
+
425
+ $events.one(event_closed, function () {
426
+ document.removeEventListener('focus', trapFocus, true);
427
+ });
428
+ }
429
+ }
430
+
431
+ // Return focus on closing
432
+ if (settings.get('returnFocus')) {
433
+ $events.one(event_closed, function () {
434
+ $(settings.el).focus();
435
+ });
436
+ }
437
+ }
438
+
439
+ var opacity = parseFloat(settings.get('opacity'));
440
+ $overlay.css({
441
+ opacity: opacity === opacity ? opacity : '',
442
+ cursor: settings.get('overlayClose') ? 'pointer' : '',
443
+ visibility: 'visible'
444
+ }).show();
445
+
446
+ if (settings.get('closeButton')) {
447
+ $close.html(settings.get('close')).appendTo($content);
448
+ } else {
449
+ $close.appendTo('<div/>'); // replace with .detach() when dropping jQuery < 1.4
450
+ }
451
+
452
+ load();
453
+ }
454
+ }
455
+
456
+ // Colorbox's markup needs to be added to the DOM prior to being called
457
+ // so that the browser will go ahead and load the CSS background images.
458
+ function appendHTML() {
459
+ if (!$box && document.body) {
460
+ init = false;
461
+ $window = $(window);
462
+ $box = $tag(div).attr({
463
+ id: colorbox,
464
+ 'class': $.support.opacity === false ? prefix + 'IE' : '', // class for optional IE8 & lower targeted CSS.
465
+ role: 'dialog',
466
+ tabindex: '-1'
467
+ }).hide();
468
+ $overlay = $tag(div, "Overlay").hide();
469
+ $loadingOverlay = $([$tag(div, "LoadingOverlay")[0],$tag(div, "LoadingGraphic")[0]]);
470
+ $wrap = $tag(div, "Wrapper");
471
+ $content = $tag(div, "Content").append(
472
+ $title = $tag(div, "Title"),
473
+ $current = $tag(div, "Current"),
474
+ $prev = $('<button type="button"/>').attr({id:prefix+'Previous'}),
475
+ $next = $('<button type="button"/>').attr({id:prefix+'Next'}),
476
+ $slideshow = $tag('button', "Slideshow"),
477
+ $loadingOverlay
478
+ );
479
+
480
+ $close = $('<button type="button"/>').attr({id:prefix+'Close'});
481
+
482
+ $wrap.append( // The 3x3 Grid that makes up Colorbox
483
+ $tag(div).append(
484
+ $tag(div, "TopLeft"),
485
+ $topBorder = $tag(div, "TopCenter"),
486
+ $tag(div, "TopRight")
487
+ ),
488
+ $tag(div, false, 'clear:left').append(
489
+ $leftBorder = $tag(div, "MiddleLeft"),
490
+ $content,
491
+ $rightBorder = $tag(div, "MiddleRight")
492
+ ),
493
+ $tag(div, false, 'clear:left').append(
494
+ $tag(div, "BottomLeft"),
495
+ $bottomBorder = $tag(div, "BottomCenter"),
496
+ $tag(div, "BottomRight")
497
+ )
498
+ ).find('div div').css({'float': 'left'});
499
+
500
+ $loadingBay = $tag(div, false, 'position:absolute; width:9999px; visibility:hidden; display:none; max-width:none;');
501
+
502
+ $groupControls = $next.add($prev).add($current).add($slideshow);
503
+
504
+ $(document.body).append($overlay, $box.append($wrap, $loadingBay));
505
+ }
506
+ }
507
+
508
+ // Add Colorbox's event bindings
509
+ function addBindings() {
510
+ function clickHandler(e) {
511
+ // ignore non-left-mouse-clicks and clicks modified with ctrl / command, shift, or alt.
512
+ // See: http://jacklmoore.com/notes/click-events/
513
+ if (!(e.which > 1 || e.shiftKey || e.altKey || e.metaKey || e.ctrlKey)) {
514
+ e.preventDefault();
515
+ launch(this);
516
+ }
517
+ }
518
+
519
+ if ($box) {
520
+ if (!init) {
521
+ init = true;
522
+
523
+ // Anonymous functions here keep the public method from being cached, thereby allowing them to be redefined on the fly.
524
+ $next.click(function () {
525
+ publicMethod.next();
526
+ });
527
+ $prev.click(function () {
528
+ publicMethod.prev();
529
+ });
530
+ $close.click(function () {
531
+ publicMethod.close();
532
+ });
533
+ $overlay.click(function () {
534
+ if (settings.get('overlayClose')) {
535
+ publicMethod.close();
536
+ }
537
+ });
538
+
539
+ // Key Bindings
540
+ $(document).bind('keydown.' + prefix, function (e) {
541
+ var key = e.keyCode;
542
+ if (open && settings.get('escKey') && key === 27) {
543
+ e.preventDefault();
544
+ publicMethod.close();
545
+ }
546
+ if (open && settings.get('arrowKey') && $related[1] && !e.altKey) {
547
+ if (key === 37) {
548
+ e.preventDefault();
549
+ $prev.click();
550
+ } else if (key === 39) {
551
+ e.preventDefault();
552
+ $next.click();
553
+ }
554
+ }
555
+ });
556
+
557
+ if ($.isFunction($.fn.on)) {
558
+ // For jQuery 1.7+
559
+ $(document).on('click.'+prefix, '.'+boxElement, clickHandler);
560
+ } else {
561
+ // For jQuery 1.3.x -> 1.6.x
562
+ // This code is never reached in jQuery 1.9, so do not contact me about 'live' being removed.
563
+ // This is not here for jQuery 1.9, it's here for legacy users.
564
+ $('.'+boxElement).live('click.'+prefix, clickHandler);
565
+ }
566
+ }
567
+ return true;
568
+ }
569
+ return false;
570
+ }
571
+
572
+ // Don't do anything if Colorbox already exists.
573
+ if ($[colorbox]) {
574
+ return;
575
+ }
576
+
577
+ // Append the HTML when the DOM loads
578
+ $(appendHTML);
579
+
580
+
581
+ // ****************
582
+ // PUBLIC FUNCTIONS
583
+ // Usage format: $.colorbox.close();
584
+ // Usage from within an iframe: parent.jQuery.colorbox.close();
585
+ // ****************
586
+
587
+ publicMethod = $.fn[colorbox] = $[colorbox] = function (options, callback) {
588
+ var settings;
589
+ var $obj = this;
590
+
591
+ options = options || {};
592
+
593
+ if ($.isFunction($obj)) { // assume a call to $.colorbox
594
+ $obj = $('<a/>');
595
+ options.open = true;
596
+ } else if (!$obj[0]) { // colorbox being applied to empty collection
597
+ return $obj;
598
+ }
599
+
600
+
601
+ if (!$obj[0]) { // colorbox being applied to empty collection
602
+ return $obj;
603
+ }
604
+
605
+ appendHTML();
606
+
607
+ if (addBindings()) {
608
+
609
+ if (callback) {
610
+ options.onComplete = callback;
611
+ }
612
+
613
+ $obj.each(function () {
614
+ var old = $.data(this, colorbox) || {};
615
+ $.data(this, colorbox, $.extend(old, options));
616
+ }).addClass(boxElement);
617
+
618
+ settings = new Settings($obj[0], options);
619
+
620
+ if (settings.get('open')) {
621
+ launch($obj[0]);
622
+ }
623
+ }
624
+
625
+ return $obj;
626
+ };
627
+
628
+ publicMethod.position = function (speed, loadedCallback) {
629
+ var
630
+ css,
631
+ top = 0,
632
+ left = 0,
633
+ offset = $box.offset(),
634
+ scrollTop,
635
+ scrollLeft;
636
+
637
+ $window.unbind('resize.' + prefix);
638
+
639
+ // remove the modal so that it doesn't influence the document width/height
640
+ $box.css({top: -9e4, left: -9e4});
641
+
642
+ scrollTop = $window.scrollTop();
643
+ scrollLeft = $window.scrollLeft();
644
+
645
+ if (settings.get('fixed')) {
646
+ offset.top -= scrollTop;
647
+ offset.left -= scrollLeft;
648
+ $box.css({position: 'fixed'});
649
+ } else {
650
+ top = scrollTop;
651
+ left = scrollLeft;
652
+ $box.css({position: 'absolute'});
653
+ }
654
+
655
+ // keeps the top and left positions within the browser's viewport.
656
+ if (settings.get('right') !== false) {
657
+ left += Math.max($window.width() - settings.w - loadedWidth - interfaceWidth - setSize(settings.get('right'), 'x'), 0);
658
+ } else if (settings.get('left') !== false) {
659
+ left += setSize(settings.get('left'), 'x');
660
+ } else {
661
+ left += Math.round(Math.max($window.width() - settings.w - loadedWidth - interfaceWidth, 0) / 2);
662
+ }
663
+
664
+ if (settings.get('bottom') !== false) {
665
+ top += Math.max(winheight() - settings.h - loadedHeight - interfaceHeight - setSize(settings.get('bottom'), 'y'), 0);
666
+ } else if (settings.get('top') !== false) {
667
+ top += setSize(settings.get('top'), 'y');
668
+ } else {
669
+ top += Math.round(Math.max(winheight() - settings.h - loadedHeight - interfaceHeight, 0) / 2);
670
+ }
671
+
672
+ $box.css({top: offset.top, left: offset.left, visibility:'visible'});
673
+
674
+ // this gives the wrapper plenty of breathing room so it's floated contents can move around smoothly,
675
+ // but it has to be shrank down around the size of div#colorbox when it's done. If not,
676
+ // it can invoke an obscure IE bug when using iframes.
677
+ $wrap[0].style.width = $wrap[0].style.height = "9999px";
678
+
679
+ function modalDimensions() {
680
+ $topBorder[0].style.width = $bottomBorder[0].style.width = $content[0].style.width = (parseInt($box[0].style.width,10) - interfaceWidth)+'px';
681
+ $content[0].style.height = $leftBorder[0].style.height = $rightBorder[0].style.height = (parseInt($box[0].style.height,10) - interfaceHeight)+'px';
682
+ }
683
+
684
+ css = {width: settings.w + loadedWidth + interfaceWidth, height: settings.h + loadedHeight + interfaceHeight, top: top, left: left};
685
+
686
+ // setting the speed to 0 if the content hasn't changed size or position
687
+ if (speed) {
688
+ var tempSpeed = 0;
689
+ $.each(css, function(i){
690
+ if (css[i] !== previousCSS[i]) {
691
+ tempSpeed = speed;
692
+ return;
693
+ }
694
+ });
695
+ speed = tempSpeed;
696
+ }
697
+
698
+ previousCSS = css;
699
+
700
+ if (!speed) {
701
+ $box.css(css);
702
+ }
703
+
704
+ $box.dequeue().animate(css, {
705
+ duration: speed || 0,
706
+ complete: function () {
707
+ modalDimensions();
708
+
709
+ active = false;
710
+
711
+ // shrink the wrapper down to exactly the size of colorbox to avoid a bug in IE's iframe implementation.
712
+ $wrap[0].style.width = (settings.w + loadedWidth + interfaceWidth) + "px";
713
+ $wrap[0].style.height = (settings.h + loadedHeight + interfaceHeight) + "px";
714
+
715
+ if (settings.get('reposition')) {
716
+ setTimeout(function () { // small delay before binding onresize due to an IE8 bug.
717
+ $window.bind('resize.' + prefix, publicMethod.position);
718
+ }, 1);
719
+ }
720
+
721
+ if ($.isFunction(loadedCallback)) {
722
+ loadedCallback();
723
+ }
724
+ },
725
+ step: modalDimensions
726
+ });
727
+ };
728
+
729
+ publicMethod.resize = function (options) {
730
+ var scrolltop;
731
+
732
+ if (open) {
733
+ options = options || {};
734
+
735
+ if (options.width) {
736
+ settings.w = setSize(options.width, 'x') - loadedWidth - interfaceWidth;
737
+ }
738
+
739
+ if (options.innerWidth) {
740
+ settings.w = setSize(options.innerWidth, 'x');
741
+ }
742
+
743
+ $loaded.css({width: settings.w});
744
+
745
+ if (options.height) {
746
+ settings.h = setSize(options.height, 'y') - loadedHeight - interfaceHeight;
747
+ }
748
+
749
+ if (options.innerHeight) {
750
+ settings.h = setSize(options.innerHeight, 'y');
751
+ }
752
+
753
+ if (!options.innerHeight && !options.height) {
754
+ scrolltop = $loaded.scrollTop();
755
+ $loaded.css({height: "auto"});
756
+ settings.h = $loaded.height();
757
+ }
758
+
759
+ $loaded.css({height: settings.h});
760
+
761
+ if(scrolltop) {
762
+ $loaded.scrollTop(scrolltop);
763
+ }
764
+
765
+ publicMethod.position(settings.get('transition') === "none" ? 0 : settings.get('speed'));
766
+ }
767
+ };
768
+
769
+ publicMethod.prep = function (object) {
770
+ if (!open) {
771
+ return;
772
+ }
773
+
774
+ var callback, speed = settings.get('transition') === "none" ? 0 : settings.get('speed');
775
+
776
+ $loaded.remove();
777
+
778
+ $loaded = $tag(div, 'LoadedContent').append(object);
779
+
780
+ function getWidth() {
781
+ settings.w = settings.w || $loaded.width();
782
+ settings.w = settings.mw && settings.mw < settings.w ? settings.mw : settings.w;
783
+ return settings.w;
784
+ }
785
+ function getHeight() {
786
+ settings.h = settings.h || $loaded.height();
787
+ settings.h = settings.mh && settings.mh < settings.h ? settings.mh : settings.h;
788
+ return settings.h;
789
+ }
790
+
791
+ $loaded.hide()
792
+ .appendTo($loadingBay.show())// content has to be appended to the DOM for accurate size calculations.
793
+ .css({width: getWidth(), overflow: settings.get('scrolling') ? 'auto' : 'hidden'})
794
+ .css({height: getHeight()})// sets the height independently from the width in case the new width influences the value of height.
795
+ .prependTo($content);
796
+
797
+ $loadingBay.hide();
798
+
799
+ // floating the IMG removes the bottom line-height and fixed a problem where IE miscalculates the width of the parent element as 100% of the document width.
800
+
801
+ $(photo).css({'float': 'none'});
802
+
803
+ setClass(settings.get('className'));
804
+
805
+ callback = function () {
806
+ var total = $related.length,
807
+ iframe,
808
+ complete;
809
+
810
+ if (!open) {
811
+ return;
812
+ }
813
+
814
+ function removeFilter() { // Needed for IE8 in versions of jQuery prior to 1.7.2
815
+ if ($.support.opacity === false) {
816
+ $box[0].style.removeAttribute('filter');
817
+ }
818
+ }
819
+
820
+ complete = function () {
821
+ clearTimeout(loadingTimer);
822
+ $loadingOverlay.hide();
823
+ trigger(event_complete);
824
+ settings.get('onComplete');
825
+ };
826
+
827
+
828
+ $title.html(settings.get('title')).show();
829
+ $loaded.show();
830
+
831
+ if (total > 1) { // handle grouping
832
+ if (typeof settings.get('current') === "string") {
833
+ $current.html(settings.get('current').replace('{current}', index + 1).replace('{total}', total)).show();
834
+ }
835
+
836
+ $next[(settings.get('loop') || index < total - 1) ? "show" : "hide"]().html(settings.get('next'));
837
+ $prev[(settings.get('loop') || index) ? "show" : "hide"]().html(settings.get('previous'));
838
+
839
+ slideshow();
840
+
841
+ // Preloads images within a rel group
842
+ if (settings.get('preloading')) {
843
+ $.each([getIndex(-1), getIndex(1)], function(){
844
+ var img,
845
+ i = $related[this],
846
+ settings = new Settings(i, $.data(i, colorbox)),
847
+ src = settings.get('href');
848
+
849
+ if (src && isImage(settings, src)) {
850
+ src = retinaUrl(settings, src);
851
+ img = document.createElement('img');
852
+ img.src = src;
853
+ }
854
+ });
855
+ }
856
+ } else {
857
+ $groupControls.hide();
858
+ }
859
+
860
+ if (settings.get('iframe')) {
861
+ iframe = document.createElement('iframe');
862
+
863
+ if ('frameBorder' in iframe) {
864
+ iframe.frameBorder = 0;
865
+ }
866
+
867
+ if ('allowTransparency' in iframe) {
868
+ iframe.allowTransparency = "true";
869
+ }
870
+
871
+ if (!settings.get('scrolling')) {
872
+ iframe.scrolling = "no";
873
+ }
874
+
875
+ $(iframe)
876
+ .attr({
877
+ src: settings.get('href'),
878
+ name: (new Date()).getTime(), // give the iframe a unique name to prevent caching
879
+ 'class': prefix + 'Iframe',
880
+ allowFullScreen : true // allow HTML5 video to go fullscreen
881
+ })
882
+ .one('load', complete)
883
+ .appendTo($loaded);
884
+
885
+ $events.one(event_purge, function () {
886
+ iframe.src = "//about:blank";
887
+ });
888
+
889
+ if (settings.get('fastIframe')) {
890
+ $(iframe).trigger('load');
891
+ }
892
+ } else {
893
+ complete();
894
+ }
895
+
896
+ if (settings.get('transition') === 'fade') {
897
+ $box.fadeTo(speed, 1, removeFilter);
898
+ } else {
899
+ removeFilter();
900
+ }
901
+ };
902
+
903
+ if (settings.get('transition') === 'fade') {
904
+ $box.fadeTo(speed, 0, function () {
905
+ publicMethod.position(0, callback);
906
+ });
907
+ } else {
908
+ publicMethod.position(speed, callback);
909
+ }
910
+ };
911
+
912
+ function load () {
913
+ var href, setResize, prep = publicMethod.prep, $inline, request = ++requests;
914
+
915
+ active = true;
916
+
917
+ photo = false;
918
+
919
+ trigger(event_purge);
920
+ trigger(event_load);
921
+ settings.get('onLoad');
922
+
923
+ settings.h = settings.get('height') ?
924
+ setSize(settings.get('height'), 'y') - loadedHeight - interfaceHeight :
925
+ settings.get('innerHeight') && setSize(settings.get('innerHeight'), 'y');
926
+
927
+ settings.w = settings.get('width') ?
928
+ setSize(settings.get('width'), 'x') - loadedWidth - interfaceWidth :
929
+ settings.get('innerWidth') && setSize(settings.get('innerWidth'), 'x');
930
+
931
+ // Sets the minimum dimensions for use in image scaling
932
+ settings.mw = settings.w;
933
+ settings.mh = settings.h;
934
+
935
+ // Re-evaluate the minimum width and height based on maxWidth and maxHeight values.
936
+ // If the width or height exceed the maxWidth or maxHeight, use the maximum values instead.
937
+ if (settings.get('maxWidth')) {
938
+ settings.mw = setSize(settings.get('maxWidth'), 'x') - loadedWidth - interfaceWidth;
939
+ settings.mw = settings.w && settings.w < settings.mw ? settings.w : settings.mw;
940
+ }
941
+ if (settings.get('maxHeight')) {
942
+ settings.mh = setSize(settings.get('maxHeight'), 'y') - loadedHeight - interfaceHeight;
943
+ settings.mh = settings.h && settings.h < settings.mh ? settings.h : settings.mh;
944
+ }
945
+
946
+ href = settings.get('href');
947
+
948
+ loadingTimer = setTimeout(function () {
949
+ $loadingOverlay.show();
950
+ }, 100);
951
+
952
+ if (settings.get('inline')) {
953
+ var $target = $(href);
954
+ // Inserts an empty placeholder where inline content is being pulled from.
955
+ // An event is bound to put inline content back when Colorbox closes or loads new content.
956
+ $inline = $('<div>').hide().insertBefore($target);
957
+
958
+ $events.one(event_purge, function () {
959
+ $inline.replaceWith($target);
960
+ });
961
+
962
+ prep($target);
963
+ } else if (settings.get('iframe')) {
964
+ // IFrame element won't be added to the DOM until it is ready to be displayed,
965
+ // to avoid problems with DOM-ready JS that might be trying to run in that iframe.
966
+ prep(" ");
967
+ } else if (settings.get('html')) {
968
+ prep(settings.get('html'));
969
+ } else if (isImage(settings, href)) {
970
+
971
+ href = retinaUrl(settings, href);
972
+
973
+ photo = new Image();
974
+
975
+ $(photo)
976
+ .addClass(prefix + 'Photo')
977
+ .bind('error',function () {
978
+ prep($tag(div, 'Error').html(settings.get('imgError')));
979
+ })
980
+ .one('load', function () {
981
+ if (request !== requests) {
982
+ return;
983
+ }
984
+
985
+ // A small pause because some browsers will occassionaly report a
986
+ // img.width and img.height of zero immediately after the img.onload fires
987
+ setTimeout(function(){
988
+ var percent;
989
+
990
+ $.each(['alt', 'longdesc', 'aria-describedby'], function(i,val){
991
+ var attr = $(settings.el).attr(val) || $(settings.el).attr('data-'+val);
992
+ if (attr) {
993
+ photo.setAttribute(val, attr);
994
+ }
995
+ });
996
+
997
+ if (settings.get('retinaImage') && window.devicePixelRatio > 1) {
998
+ photo.height = photo.height / window.devicePixelRatio;
999
+ photo.width = photo.width / window.devicePixelRatio;
1000
+ }
1001
+
1002
+ if (settings.get('scalePhotos')) {
1003
+ setResize = function () {
1004
+ photo.height -= photo.height * percent;
1005
+ photo.width -= photo.width * percent;
1006
+ };
1007
+ if (settings.mw && photo.width > settings.mw) {
1008
+ percent = (photo.width - settings.mw) / photo.width;
1009
+ setResize();
1010
+ }
1011
+ if (settings.mh && photo.height > settings.mh) {
1012
+ percent = (photo.height - settings.mh) / photo.height;
1013
+ setResize();
1014
+ }
1015
+ }
1016
+
1017
+ if (settings.h) {
1018
+ photo.style.marginTop = Math.max(settings.mh - photo.height, 0) / 2 + 'px';
1019
+ }
1020
+
1021
+ if ($related[1] && (settings.get('loop') || $related[index + 1])) {
1022
+ photo.style.cursor = 'pointer';
1023
+ photo.onclick = function () {
1024
+ publicMethod.next();
1025
+ };
1026
+ }
1027
+
1028
+ photo.style.width = photo.width + 'px';
1029
+ photo.style.height = photo.height + 'px';
1030
+ prep(photo);
1031
+ }, 1);
1032
+ });
1033
+
1034
+ photo.src = href;
1035
+
1036
+ } else if (href) {
1037
+ $loadingBay.load(href, settings.get('data'), function (data, status) {
1038
+ if (request === requests) {
1039
+ prep(status === 'error' ? $tag(div, 'Error').html(settings.get('xhrError')) : $(this).contents());
1040
+ }
1041
+ });
1042
+ }
1043
+ }
1044
+
1045
+ // Navigates to the next page/image in a set.
1046
+ publicMethod.next = function () {
1047
+ if (!active && $related[1] && (settings.get('loop') || $related[index + 1])) {
1048
+ index = getIndex(1);
1049
+ launch($related[index]);
1050
+ }
1051
+ };
1052
+
1053
+ publicMethod.prev = function () {
1054
+ if (!active && $related[1] && (settings.get('loop') || index)) {
1055
+ index = getIndex(-1);
1056
+ launch($related[index]);
1057
+ }
1058
+ };
1059
+
1060
+ // Note: to use this within an iframe use the following format: parent.jQuery.colorbox.close();
1061
+ publicMethod.close = function () {
1062
+ if (open && !closing) {
1063
+
1064
+ closing = true;
1065
+ open = false;
1066
+ trigger(event_cleanup);
1067
+ settings.get('onCleanup');
1068
+ $window.unbind('.' + prefix);
1069
+ $overlay.fadeTo(settings.get('fadeOut') || 0, 0);
1070
+
1071
+ $box.stop().fadeTo(settings.get('fadeOut') || 0, 0, function () {
1072
+ $box.hide();
1073
+ $overlay.hide();
1074
+ trigger(event_purge);
1075
+ $loaded.remove();
1076
+
1077
+ setTimeout(function () {
1078
+ closing = false;
1079
+ trigger(event_closed);
1080
+ settings.get('onClosed');
1081
+ }, 1);
1082
+ });
1083
+ }
1084
+ };
1085
+
1086
+ // Removes changes Colorbox made to the document, but does not remove the plugin.
1087
+ publicMethod.remove = function () {
1088
+ if (!$box) { return; }
1089
+
1090
+ $box.stop();
1091
+ $[colorbox].close();
1092
+ $box.stop(false, true).remove();
1093
+ $overlay.remove();
1094
+ closing = false;
1095
+ $box = null;
1096
+ $('.' + boxElement)
1097
+ .removeData(colorbox)
1098
+ .removeClass(boxElement);
1099
+
1100
+ $(document).unbind('click.'+prefix).unbind('keydown.'+prefix);
1101
+ };
1102
+
1103
+ // A method for fetching the current element Colorbox is referencing.
1104
+ // returns a jQuery object.
1105
+ publicMethod.element = function () {
1106
+ return $(settings.el);
1107
+ };
1108
+
1109
+ publicMethod.settings = defaults;
971
1110
 
972
1111
  }(jQuery, document, window));
973
1112
  /*
@@ -1486,14 +1625,12 @@ $(document).ready(function() {
1486
1625
  width: "95%",
1487
1626
  height: "95%",
1488
1627
  onLoad: function() {
1489
- if (prev_anchor) {
1490
- prev_anchor = jQuery.url.attr('anchor');
1491
- }
1628
+ prev_anchor = curr_anchor ? curr_anchor : jQuery.url.attr('anchor');
1492
1629
  curr_anchor = this.href.split('#')[1];
1493
1630
  window.location.hash = curr_anchor;
1494
1631
  },
1495
1632
  onCleanup: function() {
1496
- if (prev_anchor) {
1633
+ if (prev_anchor && prev_anchor != curr_anchor) {
1497
1634
  $('a[href="#'+prev_anchor+'"]').click();
1498
1635
  curr_anchor = prev_anchor;
1499
1636
  } else {
@@ -1505,6 +1642,17 @@ $(document).ready(function() {
1505
1642
  }
1506
1643
  });
1507
1644
 
1645
+ window.onpopstate = function(event){
1646
+ if (location.hash.substring(0,2) == "#_") {
1647
+ $.colorbox.close();
1648
+ curr_anchor = jQuery.url.attr('anchor');
1649
+ } else {
1650
+ if ($('#colorbox').is(':hidden')) {
1651
+ $('a.src_link[href="'+location.hash+'"]').colorbox({ open: true });
1652
+ }
1653
+ }
1654
+ };
1655
+
1508
1656
  // Hide src files and file list container after load
1509
1657
  $('.source_files').hide();
1510
1658
  $('.file_list_container').hide();