jQuery Colorbox - Version 4.2

Version Description

(2011-10-16) = * NEW: Danish translation by Michael Bering Petersen * NEW: Vietnamese translation by Techfacts Computer Magazin * NEW: added option to remove the link to the developers site from the WordPress meta-box. * BUGFIX: "Automate Colorbox for all other images" now again works as intended. (functionality broke in 4.1) * BUGFIX: fixes "Undefined index: colorboxAddClassToLinks" error * BUGFIX: got rid of PHP's XML-RPC methods, also plugin checks now before calling XML-related methods. * CHANGE: Updated Colorbox version to 1.3.18

Download this release

Release Info

Developer techotronic
Plugin Icon 128x128 jQuery Colorbox
Version 4.2
Comparing to
See all releases

Code changes from version 4.1 to 4.2

.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ .idea
2
+ target
3
+ *.iml
includes/debugger.php CHANGED
@@ -21,7 +21,7 @@
21
* global $debugger;
22
* $debugger->dieWithVariable($variable);
23
*/
24
- class Debugger {
25
26
/**
27
* Calls wp_die with the given variable.
@@ -56,6 +56,8 @@ class Debugger {
56
57
// dieWithVariable()
58
59
/**
60
* Dumps the given variable into an HTML container
61
*
21
* global $debugger;
22
* $debugger->dieWithVariable($variable);
23
*/
24
+ class JQueryColorboxDebugger {
25
26
/**
27
* Calls wp_die with the given variable.
56
57
// dieWithVariable()
58
59
+ //=====================================================================================================
60
+
61
/**
62
* Dumps the given variable into an HTML container
63
*
includes/donationloader.php CHANGED
@@ -9,8 +9,7 @@
9
* Object that handles Ajax to Xml RPC calls
10
*/
11
if (!defined('DONATIONLOADER_XMLRPC_URL')) {
12
- //define('DONATIONLOADER_XMLRPC_URL', 'http://xmlrpc.techotronic.de/');
13
- define('DONATIONLOADER_XMLRPC_URL', 'http://www.wpthemetest.de/wordpress/xmlrpc.php');
14
}
15
if (!defined('DONATIONLOADER_CACHETIME')) {
16
//cachetime in seconds
@@ -37,8 +36,8 @@ class JQueryColorboxDonationLoader {
37
//add_action( 'wp_ajax_nopriv_action', 'methodName' );
38
//only logged in users can trigger the action
39
//add_action( 'wp_ajax_action', array($this, 'methodName') );
40
- add_action( 'wp_ajax_load-topDonations', array($this, 'getTopDonations') );
41
- add_action( 'wp_ajax_load-latestDonations', array($this, 'getLatestDonations') );
42
}
43
44
// DonationLoader()
@@ -52,6 +51,7 @@ class JQueryColorboxDonationLoader {
52
*
53
* @return void
54
*/
55
// function getTest() {
56
// $this->doGetDonations(xmlrpc_encode_request('demo.sayHello','doesntMatter'));
57
// }
@@ -67,8 +67,8 @@ class JQueryColorboxDonationLoader {
67
*
68
* @return void
69
*/
70
- //private function getTopDonations() {
71
- function getTopDonations() {
72
$this->getAndReturnDonations('manageDonations.getTopDonations','top');
73
}
74
@@ -83,13 +83,37 @@ class JQueryColorboxDonationLoader {
83
*
84
* @return void
85
*/
86
- //private function getLatestDonations() {
87
- function getLatestDonations() {
88
$this->getAndReturnDonations('manageDonations.getLatestDonations','latest');
89
}
90
91
// getLatestDonations()
92
93
/**
94
* Generic donation getter.
95
* Wrap the XML RPC call and return the value to the Ajax call
@@ -104,7 +128,9 @@ class JQueryColorboxDonationLoader {
104
*
105
* @return void
106
*/
107
function getAndReturnDonations($remoteProcedureCall,$identifier) {
108
// get the submitted parameters
109
$pluginName = $_POST['pluginName'];
110
@@ -114,10 +140,12 @@ class JQueryColorboxDonationLoader {
114
$response = get_transient($key);
115
if ( false == $response ) {
116
// response not found in DB cache, generate response
117
- $xmlRpcRequest = xmlrpc_encode_request($remoteProcedureCall,$pluginName);
118
-
119
- $response = $this->getRemoteXmlRpcContent(DONATIONLOADER_XMLRPC_URL,$this->donationLoaderUserAgent,$xmlRpcRequest);
120
121
set_transient($key, serialize($response), DONATIONLOADER_CACHETIME);
122
} else {
123
$response = unserialize($response);
@@ -134,61 +162,6 @@ class JQueryColorboxDonationLoader {
134
}
135
136
// getDonations()
137
-
138
- /**
139
- * Build JavaScript array for loading donations.
140
- * Also registers JavaScript file.
141
- *
142
- * @since 1.0
143
- * @access public
144
- * @author Arne Franken
145
- *
146
- * @return void
147
- */
148
- //public function registerDonationJavaScript() {
149
- function registerDonationJavaScript() {
150
- $javaScriptArray = array('ajaxurl' => admin_url( 'admin-ajax.php' ),
151
- 'pluginName' => $this->donationLoaderPluginName);
152
-
153
- wp_register_script('donation', $this->donationLoaderPluginUrl . '/js/donation-min.js', array('jquery'));
154
- wp_enqueue_script('donation');
155
- wp_localize_script('donation', 'Donation', $javaScriptArray);
156
- }
157
-
158
- // registerDonationJavaScript()
159
-
160
- /**
161
- * Read XML from a remote url
162
- *
163
- * @since 1.0
164
- * @access private
165
- * @author Arne Franken
166
- *
167
- * @param string $url
168
- * @param string $userAgent
169
- * @param string $xmlRpcRequest
170
- *
171
- * @return the response or FALSE if there was an error
172
- */
173
- //private function getRemoteXmlRpcContent($url) {
174
- function getRemoteXmlRpcContent($url,$userAgent,$xmlRpcRequest) {
175
- $returnValue = false;
176
- if (function_exists('wp_remote_post')) {
177
- $options = array('user-agent' => $userAgent,
178
- 'body' => $xmlRpcRequest);
179
-
180
- $response = wp_remote_post($url, $options);
181
- if (!is_wp_error($response) && 200 == wp_remote_retrieve_response_code($response)) {
182
- $decodedResponse = xmlrpc_decode($response['body'],'utf-8');
183
- if(!xmlrpc_is_fault($decodedResponse)) {
184
- $returnValue = $decodedResponse;
185
- }
186
- }
187
- }
188
- return $returnValue;
189
- }
190
-
191
- // getRemoteXmlRpcContent()
192
}
193
194
// DonationLoader()
9
* Object that handles Ajax to Xml RPC calls
10
*/
11
if (!defined('DONATIONLOADER_XMLRPC_URL')) {
12
+ define('DONATIONLOADER_XMLRPC_URL', 'http://xmlrpc.techotronic.de/');
13
}
14
if (!defined('DONATIONLOADER_CACHETIME')) {
15
//cachetime in seconds
36
//add_action( 'wp_ajax_nopriv_action', 'methodName' );
37
//only logged in users can trigger the action
38
//add_action( 'wp_ajax_action', array($this, 'methodName') );
39
+ add_action( 'wp_ajax_load-JQueryColorboxTopDonations', array($this, 'getJQueryColorboxTopDonations') );
40
+ add_action( 'wp_ajax_load-JQueryColorboxLatestDonations', array($this, 'getJQueryColorboxLatestDonations') );
41
}
42
43
// DonationLoader()
51
*
52
* @return void
53
*/
54
+ //public function getTest() {
55
// function getTest() {
56
// $this->doGetDonations(xmlrpc_encode_request('demo.sayHello','doesntMatter'));
57
// }
67
*
68
* @return void
69
*/
70
+ //public function getJQueryColorboxTopDonations() {
71
+ function getJQueryColorboxTopDonations() {
72
$this->getAndReturnDonations('manageDonations.getTopDonations','top');
73
}
74
83
*
84
* @return void
85
*/
86
+ //public function getJQueryColorboxLatestDonations() {
87
+ function getJQueryColorboxLatestDonations() {
88
$this->getAndReturnDonations('manageDonations.getLatestDonations','latest');
89
}
90
91
// getLatestDonations()
92
93
+ /**
94
+ * Build JavaScript array for loading donations.
95
+ * Also registers JavaScript file.
96
+ *
97
+ * @since 1.0
98
+ * @access public
99
+ * @author Arne Franken
100
+ *
101
+ * @return void
102
+ */
103
+ //public function registerDonationJavaScript() {
104
+ function registerDonationJavaScript() {
105
+ $javaScriptArray = array('ajaxurl' => admin_url( 'admin-ajax.php' ),
106
+ 'pluginName' => $this->donationLoaderPluginName);
107
+
108
+ wp_register_script('donation', $this->donationLoaderPluginUrl . '/js/donation.js', array('jquery'));
109
+ wp_enqueue_script('donation');
110
+ wp_localize_script('donation', 'Donation', $javaScriptArray);
111
+ }
112
+
113
+ // registerDonationJavaScript()
114
+
115
+ //=====================================================================================================
116
+
117
/**
118
* Generic donation getter.
119
* Wrap the XML RPC call and return the value to the Ajax call
128
*
129
* @return void
130
*/
131
+ //private function getAndReturnDonations($remoteProcedureCall,$identifier) {
132
function getAndReturnDonations($remoteProcedureCall,$identifier) {
133
+
134
// get the submitted parameters
135
$pluginName = $_POST['pluginName'];
136
140
$response = get_transient($key);
141
if ( false == $response ) {
142
// response not found in DB cache, generate response
143
+ if(class_exists('IXR_Client')) {
144
+ $ixrClient = new IXR_Client(DONATIONLOADER_XMLRPC_URL);
145
+ $ixrClient->query($remoteProcedureCall,$pluginName);
146
147
+ $response = $ixrClient->getResponse();
148
+ }
149
set_transient($key, serialize($response), DONATIONLOADER_CACHETIME);
150
} else {
151
$response = unserialize($response);
162
}
163
164
// getDonations()
165
}
166
167
// DonationLoader()
includes/jquery-colorbox-backend.php CHANGED
@@ -94,25 +94,6 @@ class JQueryColorboxBackend {
94
95
// registerAdminMenu()
96
97
- /**
98
- * Registers Admin Notices
99
- *
100
- * @since 2.0
101
- * @access private
102
- * @author Arne Franken
103
- *
104
- * @param string $notice to register notice with.
105
- */
106
- //private function registerAdminNotice($notice) {
107
- function registerAdminNotice($notice) {
108
- if ($notice != '') {
109
- $message = '<div class="updated fade"><p>' . $notice . '</p></div>';
110
- add_action('admin_notices', create_function('', "echo '$message';"));
111
- }
112
- }
113
-
114
- // registerAdminNotice()
115
-
116
/**
117
* Registers the warning for admins
118
*
@@ -137,23 +118,6 @@ class JQueryColorboxBackend {
137
138
// registerAdminWarning()
139
140
- /**
141
- * Register the settings page in WordPress
142
- *
143
- * @since 1.0
144
- * @access private
145
- * @author Arne Franken
146
- */
147
- //private function registerSettingsPage() {
148
- function registerSettingsPage() {
149
- if (current_user_can('manage_options')) {
150
- add_filter('plugin_action_links_' . JQUERYCOLORBOX_PLUGIN_BASENAME, array(& $this, 'addPluginActionLinks'));
151
- add_options_page(JQUERYCOLORBOX_NAME, JQUERYCOLORBOX_NAME, 'manage_options', JQUERYCOLORBOX_PLUGIN_BASENAME, array(& $this, 'renderSettingsPage'));
152
- }
153
- }
154
-
155
- //registerSettingsPage()
156
-
157
/**
158
* Add settings link to plugin management page
159
*
@@ -203,22 +167,6 @@ class JQueryColorboxBackend {
203
204
// jQueryColorboxUpdateSettings()
205
206
- /**
207
- * Update plugin settings
208
- *
209
- * handles updating settings in the WordPress database
210
- *
211
- * @since 1.3.3
212
- * @access private
213
- * @author Arne Franken
214
- */
215
- //private function updateSettingsInDatabase() {
216
- function updateSettingsInDatabase() {
217
- update_option(JQUERYCOLORBOX_SETTINGSNAME, $this->colorboxSettings);
218
- }
219
-
220
- //updateSettings()
221
-
222
/**
223
* Delete plugin settings wrapper
224
*
@@ -246,6 +194,102 @@ class JQueryColorboxBackend {
246
247
// jQueryColorboxDeleteSettings()
248
249
/**
250
* Delete plugin settings
251
*
@@ -325,46 +369,6 @@ class JQueryColorboxBackend {
325
326
// getReturnLocation()
327
328
- /**
329
- * adds Colorbox CSS class to TinyMCE style selector dropdown box
330
- *
331
- * @since 3.7
332
- * @access public
333
- * @author Arne Franken
334
- *
335
- * @param array $initialArray
336
- * @return array $modifiedArray
337
- */
338
- //public function addColorboxLinkClass($defaultCss) {
339
- function addColorboxLinkClass($initialArray) {
340
- $modifiedArray = $initialArray;
341
-
342
- $modifiedArray['theme_advanced_styles'] .= ';colorbox-link=colorbox-link;';
343
- //strip first and last character if it matches ";"
344
- $modifiedArray['theme_advanced_styles'] = trim($modifiedArray['theme_advanced_styles'], ';');
345
- return $modifiedArray;
346
- }
347
-
348
- // addColorboxLinkClasses()
349
-
350
- /**
351
- * Adds style selector option to TinyMCE
352
- *
353
- * @since 4.0
354
- * @access public
355
- * @author Arne Franken
356
- *
357
- * @param array $array
358
- * @return array modified array
359
- */
360
- function addStyleSelectorBox($array) {
361
- if (!in_array('styleselect', $array)) {
362
- array_push($array, 'styleselect');
363
- }
364
- return $array;
365
- }
366
-
367
- // addStyleSelectorBox()
368
369
}
370
94
95
// registerAdminMenu()
96
97
/**
98
* Registers the warning for admins
99
*
118
119
// registerAdminWarning()
120
121
/**
122
* Add settings link to plugin management page
123
*
167
168
// jQueryColorboxUpdateSettings()
169
170
/**
171
* Delete plugin settings wrapper
172
*
194
195
// jQueryColorboxDeleteSettings()
196
197
+ /**
198
+ * adds Colorbox CSS class to TinyMCE style selector dropdown box
199
+ *
200
+ * @since 3.7
201
+ * @access public
202
+ * @author Arne Franken
203
+ *
204
+ * @param array $initialArray
205
+ * @return array $modifiedArray
206
+ */
207
+ //public function addColorboxLinkClass($defaultCss) {
208
+ function addColorboxLinkClass($initialArray) {
209
+ $modifiedArray = $initialArray;
210
+
211
+ $modifiedArray['theme_advanced_styles'] .= ';colorbox-link=colorbox-link;';
212
+ //strip first and last character if it matches ";"
213
+ $modifiedArray['theme_advanced_styles'] = trim($modifiedArray['theme_advanced_styles'], ';');
214
+ return $modifiedArray;
215
+ }
216
+
217
+ // addColorboxLinkClasses()
218
+
219
+ /**
220
+ * Adds style selector option to TinyMCE
221
+ *
222
+ * @since 4.0
223
+ * @access public
224
+ * @author Arne Franken
225
+ *
226
+ * @param array $array
227
+ * @return array modified array
228
+ */
229
+ //public function addStyleSelectorBox($array) {
230
+ function addStyleSelectorBox($array) {
231
+ if (!in_array('styleselect', $array)) {
232
+ array_push($array, 'styleselect');
233
+ }
234
+ return $array;
235
+ }
236
+
237
+ // addStyleSelectorBox()
238
+
239
+ //=====================================================================================================
240
+
241
+ /**
242
+ * Registers Admin Notices
243
+ *
244
+ * @since 2.0
245
+ * @access private
246
+ * @author Arne Franken
247
+ *
248
+ * @param string $notice to register notice with.
249
+ */
250
+ //private function registerAdminNotice($notice) {
251
+ function registerAdminNotice($notice) {
252
+ if ($notice != '') {
253
+ $message = '<div class="updated fade"><p>' . $notice . '</p></div>';
254
+ add_action('admin_notices', create_function('', "echo '$message';"));
255
+ }
256
+ }
257
+
258
+ // registerAdminNotice()
259
+
260
+ /**
261
+ * Register the settings page in WordPress
262
+ *
263
+ * @since 1.0
264
+ * @access private
265
+ * @author Arne Franken
266
+ */
267
+ //private function registerSettingsPage() {
268
+ function registerSettingsPage() {
269
+ if (current_user_can('manage_options')) {
270
+ add_filter('plugin_action_links_' . JQUERYCOLORBOX_PLUGIN_BASENAME, array(& $this, 'addPluginActionLinks'));
271
+ add_options_page(JQUERYCOLORBOX_NAME, JQUERYCOLORBOX_NAME, 'manage_options', JQUERYCOLORBOX_PLUGIN_BASENAME, array(& $this, 'renderSettingsPage'));
272
+ }
273
+ }
274
+
275
+ //registerSettingsPage()
276
+
277
+ /**
278
+ * Update plugin settings
279
+ *
280
+ * handles updating settings in the WordPress database
281
+ *
282
+ * @since 1.3.3
283
+ * @access private
284
+ * @author Arne Franken
285
+ */
286
+ //private function updateSettingsInDatabase() {
287
+ function updateSettingsInDatabase() {
288
+ update_option(JQUERYCOLORBOX_SETTINGSNAME, $this->colorboxSettings);
289
+ }
290
+
291
+ //updateSettings()
292
+
293
/**
294
* Delete plugin settings
295
*
369
370
// getReturnLocation()
371
372
373
}
374
includes/jquery-colorbox-frontend.php CHANGED
@@ -216,6 +216,8 @@ class JQueryColorboxFrontend {
216
'colorboxInitialWidth' => $this->colorboxSettings['initialWidth'],
217
'autoColorboxJavaScript' => $this->colorboxSettings['autoColorboxJavaScript'],
218
'autoHideFlash' => $this->colorboxSettings['autoHideFlash'],
219
'colorboxAddClassToLinks' => $this->colorboxSettings['colorboxAddClassToLinks']
220
);
221
wp_localize_script('colorbox', 'Colorbox', $colorboxPropertyArray);
216
'colorboxInitialWidth' => $this->colorboxSettings['initialWidth'],
217
'autoColorboxJavaScript' => $this->colorboxSettings['autoColorboxJavaScript'],
218
'autoHideFlash' => $this->colorboxSettings['autoHideFlash'],
219
+ 'autoColorbox' => $this->colorboxSettings['autoColorbox'],
220
+ 'autoColorboxGalleries' => $this->colorboxSettings['autoColorboxGalleries'],
221
'colorboxAddClassToLinks' => $this->colorboxSettings['colorboxAddClassToLinks']
222
);
223
wp_localize_script('colorbox', 'Colorbox', $colorboxPropertyArray);
includes/settings-page/sp-donations.php CHANGED
@@ -14,10 +14,10 @@
14
<h3><?php _e('Top donations', JQUERYCOLORBOX_TEXTDOMAIN) ?></h3>
15
16
<div class="inside">
17
- <div id="topdonations">
18
- <div id="toploader" align="center"><img src="<?php echo JQUERYCOLORBOX_PLUGIN_URL ?>/images/ajax-loader.gif" alt="loading"/></div>
19
- <div id="topdonationslist" style="display: none;"></div>
20
- <div id="toperror" style="display: none;"><p><?php _e('Thank you for your donation.', JQUERYCOLORBOX_TEXTDOMAIN) ?></p></div>
21
</div>
22
</div>
23
</div>
@@ -27,10 +27,10 @@
27
<h3><?php _e('Latest donations', JQUERYCOLORBOX_TEXTDOMAIN) ?></h3>
28
29
<div class="inside">
30
- <div id="latestdonations">
31
- <div id="latestloader" align="center"><img src="<?php echo JQUERYCOLORBOX_PLUGIN_URL ?>/images/ajax-loader.gif" alt="loading"/></div>
32
- <div id="latestdonationslist" style="display: none;"></div>
33
- <div id="latesterror" style="display: none;"><p><?php _e('Thank you for your donation.', JQUERYCOLORBOX_TEXTDOMAIN) ?></p></div>
34
</div>
35
</div>
36
</div>
14
<h3><?php _e('Top donations', JQUERYCOLORBOX_TEXTDOMAIN) ?></h3>
15
16
<div class="inside">
17
+ <div id="Topdonations">
18
+ <div id="Toploader" align="center"><img src="<?php echo JQUERYCOLORBOX_PLUGIN_URL ?>/images/ajax-loader.gif" alt="loading"/></div>
19
+ <div id="Topdonationslist" style="display: none;"></div>
20
+ <div id="Toperror" style="display: none;"><p><?php _e('Thank you for your donation.', JQUERYCOLORBOX_TEXTDOMAIN) ?></p></div>
21
</div>
22
</div>
23
</div>
27
<h3><?php _e('Latest donations', JQUERYCOLORBOX_TEXTDOMAIN) ?></h3>
28
29
<div class="inside">
30
+ <div id="Latestdonations">
31
+ <div id="Latestloader" align="center"><img src="<?php echo JQUERYCOLORBOX_PLUGIN_URL ?>/images/ajax-loader.gif" alt="loading"/></div>
32
+ <div id="Latestdonationslist" style="display: none;"></div>
33
+ <div id="Latesterror" style="display: none;"><p><?php _e('Thank you for your donation.', JQUERYCOLORBOX_TEXTDOMAIN) ?></p></div>
34
</div>
35
</div>
36
</div>
includes/settings-page/sp-plugin-settings.php CHANGED
@@ -73,15 +73,15 @@
73
<br/><?php __('Add JavaScript to footer instead of the header.', JQUERYCOLORBOX_TEXTDOMAIN); ?>
74
</td>
75
</tr-->
76
- <!--tr>
77
- <th scope="row">
78
- <label for="jquery-colorbox-removeLinkFromMetaBox"><?php __('Remove link from Meta-box', JQUERYCOLORBOX_TEXTDOMAIN); ?>:</label>
79
- </th>
80
- <td>
81
- <input type="checkbox" name="<?php //echo JQUERYCOLORBOX_SETTINGSNAME ?>[removeLinkFromMetaBox]" id="jquery-colorbox-removeLinkFromMetaBox" value="true" <?php //echo ($this->colorboxSettings['removeLinkFromMetaBox']) ? 'checked="checked"' : '';?>/>
82
- <br/><?php __('Remove the link to the developers site from the WordPress meta-box.', JQUERYCOLORBOX_TEXTDOMAIN); ?>
83
- </td>
84
- </tr-->
85
<!--tr>
86
<th scope="row">
87
<label for="jquery-colorbox-debugMode"><?php __('Activate debug mode', JQUERYCOLORBOX_TEXTDOMAIN); ?>:</label>
73
<br/><?php __('Add JavaScript to footer instead of the header.', JQUERYCOLORBOX_TEXTDOMAIN); ?>
74
</td>
75
</tr-->
76
+ <tr>
77
+ <th scope="row">
78
+ <label for="jquery-colorbox-removeLinkFromMetaBox"><?php _e('Remove link from Meta-box', JQUERYCOLORBOX_TEXTDOMAIN); ?>:</label>
79
+ </th>
80
+ <td>
81
+ <input type="checkbox" name="<?php echo JQUERYCOLORBOX_SETTINGSNAME ?>[removeLinkFromMetaBox]" id="jquery-colorbox-removeLinkFromMetaBox" value="true" <?php echo ($this->colorboxSettings['removeLinkFromMetaBox']) ? 'checked="checked"' : '';?>/>
82
+ <br/><?php _e('Remove the link to the developers site from the WordPress meta-box.', JQUERYCOLORBOX_TEXTDOMAIN); ?>
83
+ </td>
84
+ </tr>
85
<!--tr>
86
<th scope="row">
87
<label for="jquery-colorbox-debugMode"><?php __('Activate debug mode', JQUERYCOLORBOX_TEXTDOMAIN); ?>:</label>
jquery-colorbox.php CHANGED
@@ -6,7 +6,7 @@
6
* Plugin Name: jQuery Colorbox
7
* Plugin URI: http://www.techotronic.de/plugins/jquery-colorbox/
8
* Description: Used to overlay images on the current page. Images in one post are grouped automatically.
9
- * Version: 4.1
10
* Author: Arne Franken
11
* Author URI: http://www.techotronic.de/
12
* License: GPL
@@ -19,8 +19,8 @@
19
?>
20
<?php
21
//define constants
22
- define('JQUERYCOLORBOX_VERSION', '4.1');
23
- define('COLORBOXLIBRARY_VERSION', '1.3.17');
24
25
if (!defined('JQUERYCOLORBOX_PLUGIN_BASENAME')) {
26
//jquery-colorbox/jquery-colorbox.php
@@ -83,7 +83,7 @@ class JQueryColorbox {
83
//check whether stored settings are compatible with current plugin version.
84
//if not: overwrite stored settings
85
$validSettings = $this->validateSettingsInDatabase($usersettings);
86
- if(!$validSettings) {
87
$this->colorboxSettings = $defaultArray;
88
update_option(JQUERYCOLORBOX_SETTINGSNAME, $defaultArray);
89
} else {
@@ -143,6 +143,35 @@ class JQueryColorbox {
143
144
// JQueryColorbox()
145
146
/**
147
* This is what an example jQuery Colorbox configuration looks like in the wp_options-table of the database:
148
*
@@ -181,7 +210,6 @@ class JQueryColorbox {
181
* }
182
*/
183
184
-
185
/**
186
* Default array of plugin settings
187
*
@@ -239,38 +267,13 @@ class JQueryColorbox {
239
'javascriptInFooter' => false,
240
'debugMode' => false,
241
'autoColorboxJavaScript' => false,
242
- 'removeLinkFromMetaBox' => false
243
);
244
}
245
246
// jQueryColorboxDefaultSettings()
247
248
- /**
249
- * Checks wheter the settings stored in the database are compatible with current version.
250
- *
251
- * @since 2.0
252
- * @access public
253
- * @author Arne Franken
254
- * @param $colorboxSettings current colorboxSettings.
255
- *
256
- * @return bool true if settings work with this plugin version
257
- */
258
- //public function validateSettingsInDatabase() {
259
- function validateSettingsInDatabase($colorboxSettings) {
260
- if ($colorboxSettings) {
261
- //if jQueryColorboxVersion does not exist, the plugin is a version prior to 2.0
262
- //settings are incompatible with 2.0, restore default settings.
263
- if (!array_key_exists('jQueryColorboxVersion', $colorboxSettings)) {
264
- //in case future versions require resetting the settings
265
- //if($jquery_colorbox_settings['jQueryColorboxVersion'] < JQUERYCOLORBOX_VERSION)
266
- return false;
267
- }
268
- }
269
- return true;
270
- }
271
-
272
- // validateSettingsInDatabase()
273
-
274
/**
275
* Delete plugin settings
276
*
6
* Plugin Name: jQuery Colorbox
7
* Plugin URI: http://www.techotronic.de/plugins/jquery-colorbox/
8
* Description: Used to overlay images on the current page. Images in one post are grouped automatically.
9
+ * Version: 4.2
10
* Author: Arne Franken
11
* Author URI: http://www.techotronic.de/
12
* License: GPL
19
?>
20
<?php
21
//define constants
22
+ define('JQUERYCOLORBOX_VERSION', '4.2');
23
+ define('COLORBOXLIBRARY_VERSION', '1.3.18');
24
25
if (!defined('JQUERYCOLORBOX_PLUGIN_BASENAME')) {
26
//jquery-colorbox/jquery-colorbox.php
83
//check whether stored settings are compatible with current plugin version.
84
//if not: overwrite stored settings
85
$validSettings = $this->validateSettingsInDatabase($usersettings);
86
+ if (!$validSettings) {
87
$this->colorboxSettings = $defaultArray;
88
update_option(JQUERYCOLORBOX_SETTINGSNAME, $defaultArray);
89
} else {
143
144
// JQueryColorbox()
145
146
+
147
+ /**
148
+ * Checks wheter the settings stored in the database are compatible with current version.
149
+ *
150
+ * @since 2.0
151
+ * @access public
152
+ * @author Arne Franken
153
+ * @param $colorboxSettings current colorboxSettings.
154
+ *
155
+ * @return bool true if settings work with this plugin version
156
+ */
157
+ //public function validateSettingsInDatabase() {
158
+ function validateSettingsInDatabase($colorboxSettings) {
159
+ if ($colorboxSettings) {
160
+ //if jQueryColorboxVersion does not exist, the plugin is a version prior to 2.0
161
+ //settings are incompatible with 2.0, restore default settings.
162
+ if (!array_key_exists('jQueryColorboxVersion', $colorboxSettings)) {
163
+ //in case future versions require resetting the settings
164
+ //if($jquery_colorbox_settings['jQueryColorboxVersion'] < JQUERYCOLORBOX_VERSION)
165
+ return false;
166
+ }
167
+ }
168
+ return true;
169
+ }
170
+
171
+ // validateSettingsInDatabase()
172
+
173
+ //=====================================================================================================
174
+
175
/**
176
* This is what an example jQuery Colorbox configuration looks like in the wp_options-table of the database:
177
*
210
* }
211
*/
212
213
/**
214
* Default array of plugin settings
215
*
267
'javascriptInFooter' => false,
268
'debugMode' => false,
269
'autoColorboxJavaScript' => false,
270
+ 'colorboxAddClassToLinks' => false,
271
+ 'removeLinkFromMetaBox' => true
272
);
273
}
274
275
// jQueryColorboxDefaultSettings()
276
277
/**
278
* Delete plugin settings
279
*
js/donation-min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(){loadTopDonations();loadLatestDonations()});(function(a){loadTopDonations=function(){loadDonations("top")}})(jQuery);(function(a){loadLatestDonations=function(){loadDonations("latest")}})(jQuery);(function(a){loadDonations=function(b){var d="#"+b+"donationslist";var f="#"+b+"loader";var c="#"+b+"error";var e="load-"+b+"Donations";a.post(Donation.ajaxurl,{action:e,pluginName:Donation.pluginName,type:b},function(g){if(g!==""){a(f).hide("slow");a(d).empty().html(g).show("slow")}else{a(f).hide("slow");a(c).show("slow")}},"html")}})(jQuery);
1
+ jQuery(document).ready(function(){loadTopDonations();loadLatestDonations()});(function(a){loadTopDonations=function(){loadDonations("Top")}})(jQuery);(function(a){loadLatestDonations=function(){loadDonations("Latest")}})(jQuery);(function(a){loadDonations=function(b){var d="#"+b+"donationslist";var f="#"+b+"loader";var c="#"+b+"error";var e="load-JQueryColorbox"+b+"Donations";a.post(Donation.ajaxurl,{action:e,pluginName:Donation.pluginName,type:b},function(g){if(g!==""){a(f).hide("slow");a(d).empty().html(g).show("slow")}else{a(f).hide("slow");a(c).show("slow")}},"html")}})(jQuery);
js/donation.js CHANGED
@@ -21,7 +21,7 @@ jQuery(document).ready(function() {
21
*/
22
(function(jQuery) {
23
loadTopDonations = function() {
24
- loadDonations('top');
25
}
26
})(jQuery);
27
@@ -32,7 +32,7 @@ jQuery(document).ready(function() {
32
*/
33
(function(jQuery) {
34
loadLatestDonations = function() {
35
- loadDonations('latest');
36
}
37
})(jQuery);
38
@@ -48,7 +48,7 @@ jQuery(document).ready(function() {
48
var listDivId = '#' + $type + 'donationslist';
49
var loaderDivId = '#' + $type +'loader';
50
var errorDivId = '#' + $type + 'error';
51
- var action = 'load-' + $type + 'Donations';
52
jQuery.post(
53
Donation.ajaxurl,
54
{
21
*/
22
(function(jQuery) {
23
loadTopDonations = function() {
24
+ loadDonations('Top');
25
}
26
})(jQuery);
27
32
*/
33
(function(jQuery) {
34
loadLatestDonations = function() {
35
+ loadDonations('Latest');
36
}
37
})(jQuery);
38
48
var listDivId = '#' + $type + 'donationslist';
49
var loaderDivId = '#' + $type +'loader';
50
var errorDivId = '#' + $type + 'error';
51
+ var action = 'load-JQueryColorbox' + $type + 'Donations';
52
jQuery.post(
53
Donation.ajaxurl,
54
{
js/jquery-colorbox-wrapper-min.js CHANGED
@@ -1 +1 @@
1
- var COLORBOX_INTERNAL_LINK_PATTERN=/^#.*/;var COLORBOX_SUFFIX_PATTERN=/\.(?:jpe?g|gif|png|bmp)/i;var COLORBOX_MANUAL="colorbox-manual";var COLORBOX_OFF_CLASS=".colorbox-off";var COLORBOX_LINK_CLASS=".colorbox-link";var COLORBOX_OFF="colorbox-off";var COLORBOX_CLASS_MATCH="colorbox-[0-9]+";jQuery(document).ready(function(){if(Colorbox.autoColorboxJavaScript=="true"){colorboxAddManualClass()}if(Colorbox.colorboxAddClassToLinks=="true"){colorboxAddClassToLinks()}if(Colorbox.autoHideFlash=="true"){colorboxHideFlash();colorboxShowFlash()}colorboxSelector()});(function(a){colorboxShowFlash=function(){a(document).bind("cbox_closed",function(){var c=document.getElementsByTagName("object");for(i=0;i<c.length;i++){c[i].style.visibility="visible"}var b=document.getElementsByTagName("embed");for(i=0;i<b.length;i++){b[i].style.visibility="visible"}})}})(jQuery);(function(a){colorboxHideFlash=function(){a(document).bind("cbox_open",function(){var c=document.getElementsByTagName("object");for(i=0;i<c.length;i++){c[i].style.visibility="hidden"}var b=document.getElementsByTagName("embed");for(i=0;i<b.length;i++){b[i].style.visibility="hidden"}})}})(jQuery);(function(a){colorboxAddClassToLinks=function(){a("a:not(:contains(img))").each(function(d,f){var c=a(f);var b=c.attr("class");if(b!==undefined&&!b.match("colorbox")){var e=c.attr("href");if(e!==undefined&&a(f).attr("href").match(COLORBOX_SUFFIX_PATTERN)){c.addClass("colorbox-link")}}})}})(jQuery);(function(a){colorboxAddManualClass=function(){a("img").each(function(c,e){var d=a(e);var b=d.attr("class");if(b!==undefined&&!b.match("colorbox")){d.addClass("colorbox-manual")}})}})(jQuery);(function(a){colorboxSelector=function(){a("a:has(img[class*=colorbox-]):not(.colorbox-off)").each(function(b,d){ColorboxLocal=a.extend(true,{},Colorbox);ColorboxLocal.colorboxMaxWidth=ColorboxLocal.colorboxImageMaxWidth;ColorboxLocal.colorboxMaxHeight=ColorboxLocal.colorboxImageMaxHeight;ColorboxLocal.colorboxHeight=ColorboxLocal.colorboxImageHeight;ColorboxLocal.colorboxWidth=ColorboxLocal.colorboxImageWidth;var c=a(d).attr("href");if(c!==undefined&&c.match(COLORBOX_SUFFIX_PATTERN)){colorboxImage(b,d)}else{}});a("a[class*=colorbox-link]").each(function(b,d){ColorboxLocal=a.extend(true,{},Colorbox);var c=a(d).attr("href");if(c!==undefined){colorboxLink(b,d,c)}})}})(jQuery);(function(a){colorboxImage=function(b,g){var d=a(g).find("img:first");var e=a(g).attr("class");if(e!==undefined){ColorboxLocal.colorboxGroupId=e.match(COLORBOX_CLASS_MATCH)||e.match(COLORBOX_MANUAL)}if(!ColorboxLocal.colorboxGroupId){var f=d.attr("class");if(f!==undefined&&!f.match(COLORBOX_OFF)){ColorboxLocal.colorboxGroupId=f.match(COLORBOX_CLASS_MATCH)||f.match(COLORBOX_MANUAL)}if(ColorboxLocal.colorboxGroupId){ColorboxLocal.colorboxGroupId=ColorboxLocal.colorboxGroupId.toString().split("-")[1];if(ColorboxLocal.colorboxGroupId==="manual"){ColorboxLocal.colorboxGroupId="nofollow"}var c=d.attr("title");if(c!==undefined){ColorboxLocal.colorboxTitle=c}colorboxWrapper(g)}}}})(jQuery);(function(a){colorboxLink=function(c,f,e){ColorboxLocal.colorboxGroupId="nofollow";var b=a(f);var d=b.attr("title");if(d!==undefined){ColorboxLocal.colorboxTitle=d}else{ColorboxLocal.colorboxTitle=""}if(e.match(COLORBOX_SUFFIX_PATTERN)){ColorboxLocal.colorboxMaxWidth=ColorboxLocal.colorboxImageMaxWidth;ColorboxLocal.colorboxMaxHeight=ColorboxLocal.colorboxImageMaxHeight;ColorboxLocal.colorboxHeight=ColorboxLocal.colorboxImageHeight;ColorboxLocal.colorboxWidth=ColorboxLocal.colorboxImageWidth}else{ColorboxLocal.colorboxMaxWidth=false;ColorboxLocal.colorboxMaxHeight=false;ColorboxLocal.colorboxHeight=ColorboxLocal.colorboxLinkHeight;ColorboxLocal.colorboxWidth=ColorboxLocal.colorboxLinkWidth;if(e.match(COLORBOX_INTERNAL_LINK_PATTERN)){ColorboxLocal.colorboxInline=true}else{ColorboxLocal.colorboxIframe=true}}colorboxWrapper(f)}})(jQuery);(function(a){colorboxWrapper=function(b){a.each(ColorboxLocal,function(c,d){if(d==="false"){ColorboxLocal[c]=false}else{if(d==="true"){ColorboxLocal[c]=true}}});a(b).colorbox({rel:ColorboxLocal.colorboxGroupId,title:ColorboxLocal.colorboxTitle,maxHeight:ColorboxLocal.colorboxMaxHeight,maxWidth:ColorboxLocal.colorboxMaxWidth,initialHeight:ColorboxLocal.colorboxInitialHeight,initialWidth:ColorboxLocal.colorboxInitialWidth,height:ColorboxLocal.colorboxHeight,width:ColorboxLocal.colorboxWidth,slideshow:ColorboxLocal.colorboxSlideshow,slideshowAuto:ColorboxLocal.colorboxSlideshowAuto,scalePhotos:ColorboxLocal.colorboxScalePhotos,preloading:ColorboxLocal.colorboxPreloading,overlayClose:ColorboxLocal.colorboxOverlayClose,loop:ColorboxLocal.colorboxLoop,escKey:ColorboxLocal.colorboxEscKey,arrowKey:ColorboxLocal.colorboxArrowKey,scrolling:ColorboxLocal.colorboxScrolling,opacity:ColorboxLocal.colorboxOpacity,transition:ColorboxLocal.colorboxTransition,speed:parseInt(ColorboxLocal.colorboxSpeed),slideshowSpeed:parseInt(ColorboxLocal.colorboxSlideshowSpeed),close:ColorboxLocal.colorboxClose,next:ColorboxLocal.colorboxNext,previous:ColorboxLocal.colorboxPrevious,slideshowStart:ColorboxLocal.colorboxSlideshowStart,slideshowStop:ColorboxLocal.colorboxSlideshowStop,current:ColorboxLocal.colorboxCurrent,inline:ColorboxLocal.colorboxInline,iframe:ColorboxLocal.colorboxIframe})}})(jQuery);
1
+ var COLORBOX_INTERNAL_LINK_PATTERN=/^#.*/;var COLORBOX_SUFFIX_PATTERN=/\.(?:jpe?g|gif|png|bmp)/i;var COLORBOX_MANUAL="colorbox-manual";var COLORBOX_OFF_CLASS=".colorbox-off";var COLORBOX_LINK_CLASS=".colorbox-link";var COLORBOX_OFF="colorbox-off";var COLORBOX_CLASS_MATCH="colorbox-[0-9]+";jQuery(document).ready(function(){if(Colorbox.autoColorboxJavaScript=="true"){colorboxAddManualClass()}if(Colorbox.colorboxAddClassToLinks=="true"){colorboxAddClassToLinks()}if(Colorbox.autoHideFlash=="true"){colorboxHideFlash();colorboxShowFlash()}colorboxSelector()});(function(a){colorboxShowFlash=function(){a(document).bind("cbox_closed",function(){var c=document.getElementsByTagName("object");for(i=0;i<c.length;i++){c[i].style.visibility="visible"}var b=document.getElementsByTagName("embed");for(i=0;i<b.length;i++){b[i].style.visibility="visible"}})}})(jQuery);(function(a){colorboxHideFlash=function(){a(document).bind("cbox_open",function(){var c=document.getElementsByTagName("object");for(i=0;i<c.length;i++){c[i].style.visibility="hidden"}var b=document.getElementsByTagName("embed");for(i=0;i<b.length;i++){b[i].style.visibility="hidden"}})}})(jQuery);(function(a){colorboxAddClassToLinks=function(){a("a:not(:contains(img))").each(function(d,f){var c=a(f);var b=c.attr("class");if(b!==undefined&&!b.match("colorbox")){var e=c.attr("href");if(e!==undefined&&a(f).attr("href").match(COLORBOX_SUFFIX_PATTERN)){c.addClass("colorbox-link")}}})}})(jQuery);(function(a){colorboxAddManualClass=function(){a("img").each(function(c,e){var d=a(e);var b=d.attr("class");if(b==undefined||!b.match("colorbox")){d.addClass("colorbox-manual")}})}})(jQuery);(function(a){colorboxSelector=function(){a("a:has(img[class*=colorbox-]):not(.colorbox-off)").each(function(b,d){ColorboxLocal=a.extend(true,{},Colorbox);ColorboxLocal.colorboxMaxWidth=ColorboxLocal.colorboxImageMaxWidth;ColorboxLocal.colorboxMaxHeight=ColorboxLocal.colorboxImageMaxHeight;ColorboxLocal.colorboxHeight=ColorboxLocal.colorboxImageHeight;ColorboxLocal.colorboxWidth=ColorboxLocal.colorboxImageWidth;var c=a(d).attr("href");if(c!==undefined&&c.match(COLORBOX_SUFFIX_PATTERN)){colorboxImage(b,d)}else{}});a("a[class*=colorbox-link]").each(function(b,d){ColorboxLocal=a.extend(true,{},Colorbox);var c=a(d).attr("href");if(c!==undefined){colorboxLink(b,d,c)}})}})(jQuery);(function(a){colorboxImage=function(b,g){var d=a(g).find("img:first");var e=a(g).attr("class");if(e!==undefined){ColorboxLocal.colorboxGroupId=e.match(COLORBOX_CLASS_MATCH)||e.match(COLORBOX_MANUAL)}if(!ColorboxLocal.colorboxGroupId){var f=d.attr("class");if(f!==undefined&&!f.match(COLORBOX_OFF)){ColorboxLocal.colorboxGroupId=f.match(COLORBOX_CLASS_MATCH)||f.match(COLORBOX_MANUAL)}if(ColorboxLocal.colorboxGroupId){ColorboxLocal.colorboxGroupId=ColorboxLocal.colorboxGroupId.toString().split("-")[1];if(ColorboxLocal.colorboxGroupId==="manual"){ColorboxLocal.colorboxGroupId="nofollow"}var c=d.attr("title");if(c!==undefined){ColorboxLocal.colorboxTitle=c}colorboxWrapper(g)}}}})(jQuery);(function(a){colorboxLink=function(c,f,e){ColorboxLocal.colorboxGroupId="nofollow";var b=a(f);var d=b.attr("title");if(d!==undefined){ColorboxLocal.colorboxTitle=d}else{ColorboxLocal.colorboxTitle=""}if(e.match(COLORBOX_SUFFIX_PATTERN)){ColorboxLocal.colorboxMaxWidth=ColorboxLocal.colorboxImageMaxWidth;ColorboxLocal.colorboxMaxHeight=ColorboxLocal.colorboxImageMaxHeight;ColorboxLocal.colorboxHeight=ColorboxLocal.colorboxImageHeight;ColorboxLocal.colorboxWidth=ColorboxLocal.colorboxImageWidth}else{ColorboxLocal.colorboxMaxWidth=false;ColorboxLocal.colorboxMaxHeight=false;ColorboxLocal.colorboxHeight=ColorboxLocal.colorboxLinkHeight;ColorboxLocal.colorboxWidth=ColorboxLocal.colorboxLinkWidth;if(e.match(COLORBOX_INTERNAL_LINK_PATTERN)){ColorboxLocal.colorboxInline=true}else{ColorboxLocal.colorboxIframe=true}}colorboxWrapper(f)}})(jQuery);(function(a){colorboxWrapper=function(b){a.each(ColorboxLocal,function(c,d){if(d==="false"){ColorboxLocal[c]=false}else{if(d==="true"){ColorboxLocal[c]=true}}});a(b).colorbox({rel:ColorboxLocal.colorboxGroupId,title:ColorboxLocal.colorboxTitle,maxHeight:ColorboxLocal.colorboxMaxHeight,maxWidth:ColorboxLocal.colorboxMaxWidth,initialHeight:ColorboxLocal.colorboxInitialHeight,initialWidth:ColorboxLocal.colorboxInitialWidth,height:ColorboxLocal.colorboxHeight,width:ColorboxLocal.colorboxWidth,slideshow:ColorboxLocal.colorboxSlideshow,slideshowAuto:ColorboxLocal.colorboxSlideshowAuto,scalePhotos:ColorboxLocal.colorboxScalePhotos,preloading:ColorboxLocal.colorboxPreloading,overlayClose:ColorboxLocal.colorboxOverlayClose,loop:ColorboxLocal.colorboxLoop,escKey:ColorboxLocal.colorboxEscKey,arrowKey:ColorboxLocal.colorboxArrowKey,scrolling:ColorboxLocal.colorboxScrolling,opacity:ColorboxLocal.colorboxOpacity,transition:ColorboxLocal.colorboxTransition,speed:parseInt(ColorboxLocal.colorboxSpeed),slideshowSpeed:parseInt(ColorboxLocal.colorboxSlideshowSpeed),close:ColorboxLocal.colorboxClose,next:ColorboxLocal.colorboxNext,previous:ColorboxLocal.colorboxPrevious,slideshowStart:ColorboxLocal.colorboxSlideshowStart,slideshowStop:ColorboxLocal.colorboxSlideshowStop,current:ColorboxLocal.colorboxCurrent,inline:ColorboxLocal.colorboxInline,iframe:ColorboxLocal.colorboxIframe})}})(jQuery);
js/jquery-colorbox-wrapper.js CHANGED
@@ -111,7 +111,7 @@ jQuery(document).ready(function() {
111
jQuery("img").each(function(index, obj) {
112
var $img = jQuery(obj);
113
var $imgClass = $img.attr("class");
114
- if ($imgClass !== undefined && !$imgClass.match('colorbox')) {
115
$img.addClass('colorbox-manual');
116
}
117
});
111
jQuery("img").each(function(index, obj) {
112
var $img = jQuery(obj);
113
var $imgClass = $img.attr("class");
114
+ if ($imgClass == undefined || !$imgClass.match('colorbox')) {
115
$img.addClass('colorbox-manual');
116
}
117
});
js/jquery.colorbox-min.js CHANGED
@@ -1,4 +1,4 @@
1
- // ColorBox v1.3.17.1 - a full featured, light-weight, customizable lightbox based on jQuery 1.3+
2
- // Copyright (c) 2011 Jack Moore - jack@colorpowered.com
3
- // Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
4
- (function(a,b,c){function bc(b){if(!T){O=b,_(a.extend(J,a.data(O,e))),x=a(O),P=0,J.rel!=="nofollow"&&(x=a("."+X).filter(function(){var b=a.data(this,e).rel||this.rel;return b===J.rel}),P=x.index(O),P===-1&&(x=x.add(O),P=x.length-1));if(!R){R=S=!0,q.show();if(J.returnFocus)try{O.blur(),a(O).one(k,function(){try{this.focus()}catch(a){}})}catch(c){}p.css({opacity:+J.opacity,cursor:J.overlayClose?"pointer":"auto"}).show(),J.w=Z(J.initialWidth,"x"),J.h=Z(J.initialHeight,"y"),W.position(0),n&&y.bind("resize."+o+" scroll."+o,function(){p.css({width:y.width(),height:y.height(),top:y.scrollTop(),left:y.scrollLeft()})}).trigger("resize."+o),ba(g,J.onOpen),I.add(C).hide(),H.html(J.close).show()}W.load(!0)}}function bb(){var a,b=f+"Slideshow_",c="click."+f,d,e,g;J.slideshow&&x[1]?(d=function(){E.text(J.slideshowStop).unbind(c).bind(i,function(){if(P<x.length-1||J.loop)a=setTimeout(W.next,J.slideshowSpeed)}).bind(h,function(){clearTimeout(a)}).one(c+" "+j,e),q.removeClass(b+"off").addClass(b+"on"),a=setTimeout(W.next,J.slideshowSpeed)},e=function(){clearTimeout(a),E.text(J.slideshowStart).unbind([i,h,j,c].join(" ")).one(c,d),q.removeClass(b+"on").addClass(b+"off")},J.slideshowAuto?d():e()):q.removeClass(b+"off "+b+"on")}function ba(b,c){c&&c.call(O),a.event.trigger(b)}function _(b){for(var c in b)a.isFunction(b[c])&&c.substring(0,2)!=="on"&&(b[c]=b[c].call(O));b.rel=b.rel||O.rel||"nofollow",b.href=b.href||a(O).attr("href"),b.title=b.title||O.title,typeof b.href=="string"&&(b.href=a.trim(b.href))}function $(a){return J.photo||/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?#x2F;i.test(a)}function Z(a,b){b=b==="x"?y.width():y.height();return typeof a=="string"?Math.round(/%/.test(a)?b/100*parseInt(a,10):parseInt(a,10)):a}function Y(c,d){var e=b.createElement("div");c&&(e.id=f+c),e.style.cssText=d||"";return a(e)}var d={transition:"elastic",speed:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,inline:!1,html:!1,iframe:!1,fastIframe:!0,photo:!1,href:!1,title:!1,rel:!1,opacity:.9,preloading:!0,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",open:!1,returnFocus:!0,loop:!0,slideshow:!1,slideshowAuto:!0,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1,overlayClose:!0,escKey:!0,arrowKey:!0,top:!1,bottom:!1,left:!1,right:!1,fixed:!1,data:!1},e="colorbox",f="cbox",g=f+"_open",h=f+"_load",i=f+"_complete",j=f+"_cleanup",k=f+"_closed",l=f+"_purge",m=a.browser.msie&&!a.support.opacity,n=m&&a.browser.version<7,o=f+"_IE6",p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J={},K,L,M,N,O,P,Q,R,S,T,U,V,W,X=f+"Element";W=a.fn[e]=a[e]=function(b,c){var f=this,g;if(!f[0]&&f.selector)return f;b=b||{},c&&(b.onComplete=c);if(!f[0]||f.selector===undefined)f=a("<a/>"),b.open=!0;f.each(function(){a.data(this,e,a.extend({},a.data(this,e)||d,b)),a(this).addClass(X)}),g=b.open,a.isFunction(g)&&(g=g.call(f)),g&&bc(f[0]);return f},W.init=function(){y=a(c),q=Y().attr({id:e,"class":m?f+(n?"IE6":"IE"):""}),p=Y("Overlay",n?"position:absolute":"").hide(),r=Y("Wrapper"),s=Y("Content").append(z=Y("LoadedContent","width:0; height:0; overflow:hidden"),B=Y("LoadingOverlay").add(Y("LoadingGraphic")),C=Y("Title"),D=Y("Current"),F=Y("Next"),G=Y("Previous"),E=Y("Slideshow").bind(g,bb),H=Y("Close")),r.append(Y().append(Y("TopLeft"),t=Y("TopCenter"),Y("TopRight")),Y(!1,"clear:left").append(u=Y("MiddleLeft"),s,v=Y("MiddleRight")),Y(!1,"clear:left").append(Y("BottomLeft"),w=Y("BottomCenter"),Y("BottomRight"))).children().children().css({"float":"left"}),A=Y(!1,"position:absolute; width:9999px; visibility:hidden; display:none"),a("body").prepend(p,q.append(r,A)),s.children().hover(function(){a(this).addClass("hover")},function(){a(this).removeClass("hover")}).addClass("hover"),K=t.height()+w.height()+s.outerHeight(!0)-s.height(),L=u.width()+v.width()+s.outerWidth(!0)-s.width(),M=z.outerHeight(!0),N=z.outerWidth(!0),q.css({"padding-bottom":K,"padding-right":L}).hide(),F.click(function(){W.next()}),G.click(function(){W.prev()}),H.click(function(){W.close()}),I=F.add(G).add(D).add(E),s.children().removeClass("hover"),p.click(function(){J.overlayClose&&W.close()}),a(b).bind("keydown."+f,function(a){var b=a.keyCode;R&&J.escKey&&b===27&&(a.preventDefault(),W.close()),R&&J.arrowKey&&x[1]&&(b===37?(a.preventDefault(),G.click()):b===39&&(a.preventDefault(),F.click()))})},W.remove=function(){q.add(p).remove(),a("."+X).removeData(e).removeClass(X)},W.position=function(a,c){function g(a){t[0].style.width=w[0].style.width=s[0].style.width=a.style.width,B[0].style.height=B[1].style.height=s[0].style.height=u[0].style.height=v[0].style.height=a.style.height}var d,e=0,f=0;q.hide(),J.fixed&&!n?q.css({position:"fixed"}):(e=y.scrollTop(),f=y.scrollLeft(),q.css({position:"absolute"})),J.right!==!1?f+=Math.max(y.width()-J.w-N-L-Z(J.right,"x"),0):J.left!==!1?f+=Z(J.left,"x"):f+=Math.max(y.width()-J.w-N-L,0)/2,J.bottom!==!1?e+=Math.max(b.documentElement.clientHeight-J.h-M-K-Z(J.bottom,"y"),0):J.top!==!1?e+=Z(J.top,"y"):e+=Math.max(b.documentElement.clientHeight-J.h-M-K,0)/2,q.show(),d=q.width()===J.w+N&&q.height()===J.h+M?0:a,r[0].style.width=r[0].style.height="9999px",q.dequeue().animate({width:J.w+N,height:J.h+M,top:e,left:f},{duration:d,complete:function(){g(this),S=!1,r[0].style.width=J.w+N+L+"px",r[0].style.height=J.h+M+K+"px",c&&c()},step:function(){g(this)}})},W.resize=function(a){if(R){a=a||{},a.width&&(J.w=Z(a.width,"x")-N-L),a.innerWidth&&(J.w=Z(a.innerWidth,"x")),z.css({width:J.w}),a.height&&(J.h=Z(a.height,"y")-M-K),a.innerHeight&&(J.h=Z(a.innerHeight,"y"));if(!a.innerHeight&&!a.height){var b=z.wrapInner("<div style='overflow:auto'></div>").children();J.h=b.height(),b.replaceWith(b.children())}z.css({height:J.h}),W.position(J.transition==="none"?0:J.speed)}},W.prep=function(b){function h(b){W.position(b,function(){function o(){m&&q[0].style.removeAttribute("filter")}var b,d,g,h,j=x.length,k,n;!R||(n=function(){clearTimeout(V),B.hide(),ba(i,J.onComplete)},m&&Q&&z.fadeIn(100),C.html(J.title).add(z).show(),j>1?(typeof J.current=="string"&&D.html(J.current.replace(/\{current\}/,P+1).replace(/\{total\}/,j)).show(),F[J.loop||P<j-1?"show":"hide"]().html(J.next),G[J.loop||P?"show":"hide"]().html(J.previous),b=P?x[P-1]:x[j-1],g=P<j-1?x[P+1]:x[0],J.slideshow&&E.show(),J.preloading&&(h=a.data(g,e).href||g.href,d=a.data(b,e).href||b.href,h=a.isFunction(h)?h.call(g):h,d=a.isFunction(d)?d.call(b):d,$(h)&&(a("<img/>")[0].src=h),$(d)&&(a("<img/>")[0].src=d))):I.hide(),J.iframe?(k=a("<iframe/>").addClass(f+"Iframe")[0],J.fastIframe?n():a(k).one("load",n),k.name=f+ +(new Date),k.src=J.href,J.scrolling||(k.scrolling="no"),m&&(k.frameBorder=0,k.allowTransparency="true"),a(k).appendTo(z).one(l,function(){k.src="//about:blank"})):n(),J.transition==="fade"?q.fadeTo(c,1,o):o(),y.bind("resize."+f,function(){W.position(0)}))})}function g(){J.h=J.h||z.height(),J.h=J.mh&&J.mh<J.h?J.mh:J.h;return J.h}function d(){J.w=J.w||z.width(),J.w=J.mw&&J.mw<J.w?J.mw:J.w;return J.w}if(!!R){var c=J.transition==="none"?0:J.speed;y.unbind("resize."+f),z.remove(),z=Y("LoadedContent").html(b),z.hide().appendTo(A.show()).css({width:d(),overflow:J.scrolling?"auto":"hidden"}).css({height:g()}).prependTo(s),A.hide(),a(Q).css({"float":"none"}),n&&a("select").not(q.find("select")).filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one(j,function(){this.style.visibility="inherit"}),J.transition==="fade"?q.fadeTo(c,0,function(){h(0)}):h(c)}},W.load=function(b){var c,d,g=W.prep;S=!0,Q=!1,O=x[P],b||_(a.extend(J,a.data(O,e))),ba(l),ba(h,J.onLoad),J.h=J.height?Z(J.height,"y")-M-K:J.innerHeight&&Z(J.innerHeight,"y"),J.w=J.width?Z(J.width,"x")-N-L:J.innerWidth&&Z(J.innerWidth,"x"),J.mw=J.w,J.mh=J.h,J.maxWidth&&(J.mw=Z(J.maxWidth,"x")-N-L,J.mw=J.w&&J.w<J.mw?J.w:J.mw),J.maxHeight&&(J.mh=Z(J.maxHeight,"y")-M-K,J.mh=J.h&&J.h<J.mh?J.h:J.mh),c=J.href,V=setTimeout(function(){B.show()},100),J.inline?(Y().hide().insertBefore(a(c)[0]).one(l,function(){a(this).replaceWith(z.children())}),g(a(c))):J.iframe?g(" "):J.html?g(J.html):$(c)?(a(Q=new Image).addClass(f+"Photo").error(function(){J.title=!1,g(Y("Error").text("This image could not be loaded"))}).load(function(){var a;Q.onload=null,J.scalePhotos&&(d=function(){Q.height-=Q.height*a,Q.width-=Q.width*a},J.mw&&Q.width>J.mw&&(a=(Q.width-J.mw)/Q.width,d()),J.mh&&Q.height>J.mh&&(a=(Q.height-J.mh)/Q.height,d())),J.h&&(Q.style.marginTop=Math.max(J.h-Q.height,0)/2+"px"),x[1]&&(P<x.length-1||J.loop)&&(Q.style.cursor="pointer",Q.onclick=function(){W.next()}),m&&(Q.style.msInterpolationMode="bicubic"),setTimeout(function(){g(Q)},1)}),setTimeout(function(){Q.src=c},1)):c&&A.load(c,J.data,function(b,c,d){g(c==="error"?Y("Error").text("Request unsuccessful: "+d.statusText):a(this).contents())})},W.next=function(){!S&&x[1]&&(P<x.length-1||J.loop)&&(P=P<x.length-1?P+1:0,W.load())},W.prev=function(){!S&&x[1]&&(P||J.loop)&&(P=P?P-1:x.length-1,W.load())},W.close=function(){R&&!T&&(T=!0,R=!1,ba(j,J.onCleanup),y.unbind("."+f+" ."+o),p.fadeTo(200,0),q.stop().fadeTo(300,0,function(){q.add(p).css({opacity:1,cursor:"auto"}).hide(),ba(l),z.remove(),setTimeout(function(){T=!1,ba(k,J.onClosed)},1)}))},W.element=function(){return a(O)},W.settings=d,U=function(a){a.button!==0&&typeof a.button!="undefined"||a.ctrlKey||a.shiftKey||a.altKey||(a.preventDefault(),bc(this))},a.fn.delegate?a(b).delegate("."+X,"click",U):a("."+X).live("click",U),a(W.init)})(jQuery,document,this)
1
+ // ColorBox v1.3.18 - a full featured, light-weight, customizable lightbox based on jQuery 1.3+
2
+ // Copyright (c) 2011 Jack Moore - jack@colorpowered.com
3
+ // Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
4
+ (function(a,b,c){function Y(c,d,e){var g=b.createElement(c);return d&&(g.id=f+d),e&&(g.style.cssText=e),a(g)}function Z(a){var b=y.length,c=(Q+a)%b;return c<0?b+c:c}function $(a,b){return Math.round((/%/.test(a)?(b==="x"?z.width():z.height())/100:1)*parseInt(a,10))}function _(a){return K.photo||/\.(gif|png|jpe?g|bmp|ico)((#|\?).*)?#x2F;i.test(a)}function ba(){var b;K=a.extend({},a.data(P,e));for(b in K)a.isFunction(K[b])&&b.slice(0,2)!=="on"&&(K[b]=K[b].call(P));K.rel=K.rel||P.rel||"nofollow",K.href=K.href||a(P).attr("href"),K.title=K.title||P.title,typeof K.href=="string"&&(K.href=a.trim(K.href))}function bb(b,c){a.event.trigger(b),c&&c.call(P)}function bc(){var a,b=f+"Slideshow_",c="click."+f,d,e,g;K.slideshow&&y[1]?(d=function(){F.text(K.slideshowStop).unbind(c).bind(j,function(){if(Q<y.length-1||K.loop)a=setTimeout(W.next,K.slideshowSpeed)}).bind(i,function(){clearTimeout(a)}).one(c+" "+k,e),r.removeClass(b+"off").addClass(b+"on"),a=setTimeout(W.next,K.slideshowSpeed)},e=function(){clearTimeout(a),F.text(K.slideshowStart).unbind([j,i,k,c].join(" ")).one(c,function(){W.next(),d()}),r.removeClass(b+"on").addClass(b+"off")},K.slideshowAuto?d():e()):r.removeClass(b+"off "+b+"on")}function bd(b){if(!U){P=b,ba(),y=a(P),Q=0,K.rel!=="nofollow"&&(y=a("."+g).filter(function(){var b=a.data(this,e).rel||this.rel;return b===K.rel}),Q=y.index(P),Q===-1&&(y=y.add(P),Q=y.length-1));if(!S){S=T=!0,r.show();if(K.returnFocus)try{P.blur(),a(P).one(l,function(){try{this.focus()}catch(a){}})}catch(c){}q.css({opacity:+K.opacity,cursor:K.overlayClose?"pointer":"auto"}).show(),K.w=$(K.initialWidth,"x"),K.h=$(K.initialHeight,"y"),W.position(),o&&z.bind("resize."+p+" scroll."+p,function(){q.css({width:z.width(),height:z.height(),top:z.scrollTop(),left:z.scrollLeft()})}).trigger("resize."+p),bb(h,K.onOpen),J.add(D).hide(),I.html(K.close).show()}W.load(!0)}}var d={transition:"elastic",speed:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,inline:!1,html:!1,iframe:!1,fastIframe:!0,photo:!1,href:!1,title:!1,rel:!1,opacity:.9,preloading:!0,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",open:!1,returnFocus:!0,loop:!0,slideshow:!1,slideshowAuto:!0,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1,overlayClose:!0,escKey:!0,arrowKey:!0,top:!1,bottom:!1,left:!1,right:!1,fixed:!1,data:undefined},e="colorbox",f="cbox",g=f+"Element",h=f+"_open",i=f+"_load",j=f+"_complete",k=f+"_cleanup",l=f+"_closed",m=f+"_purge",n=a.browser.msie&&!a.support.opacity,o=n&&a.browser.version<7,p=f+"_IE6",q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X="div";W=a.fn[e]=a[e]=function(b,c){var f=this;b=b||{},W.init();if(!f[0]){if(f.selector)return f;f=a("<a/>"),b.open=!0}return c&&(b.onComplete=c),f.each(function(){a.data(this,e,a.extend({},a.data(this,e)||d,b)),a(this).addClass(g)}),(a.isFunction(b.open)&&b.open.call(f)||b.open)&&bd(f[0]),f},W.init=function(){if(!r){if(!a("body")[0]){a(W.init);return}z=a(c),r=Y(X).attr({id:e,"class":n?f+(o?"IE6":"IE"):""}),q=Y(X,"Overlay",o?"position:absolute":"").hide(),s=Y(X,"Wrapper"),t=Y(X,"Content").append(A=Y(X,"LoadedContent","width:0; height:0; overflow:hidden"),C=Y(X,"LoadingOverlay").add(Y(X,"LoadingGraphic")),D=Y(X,"Title"),E=Y(X,"Current"),G=Y(X,"Next"),H=Y(X,"Previous"),F=Y(X,"Slideshow").bind(h,bc),I=Y(X,"Close")),s.append(Y(X).append(Y(X,"TopLeft"),u=Y(X,"TopCenter"),Y(X,"TopRight")),Y(X,!1,"clear:left").append(v=Y(X,"MiddleLeft"),t,w=Y(X,"MiddleRight")),Y(X,!1,"clear:left").append(Y(X,"BottomLeft"),x=Y(X,"BottomCenter"),Y(X,"BottomRight"))).find("div div").css({"float":"left"}),B=Y(X,!1,"position:absolute; width:9999px; visibility:hidden; display:none"),a("body").prepend(q,r.append(s,B)),L=u.height()+x.height()+t.outerHeight(!0)-t.height(),M=v.width()+w.width()+t.outerWidth(!0)-t.width(),N=A.outerHeight(!0),O=A.outerWidth(!0),r.css({"padding-bottom":L,"padding-right":M}).hide(),G.click(function(){W.next()}),H.click(function(){W.prev()}),I.click(function(){W.close()}),J=G.add(H).add(E).add(F),q.click(function(){K.overlayClose&&W.close()}),a(b).bind("keydown."+f,function(a){var b=a.keyCode;S&&K.escKey&&b===27&&(a.preventDefault(),W.close()),S&&K.arrowKey&&y[1]&&(b===37?(a.preventDefault(),H.click()):b===39&&(a.preventDefault(),G.click()))})}},W.remove=function(){r.add(q).remove(),r=null,a("."+g).removeData(e).removeClass(g)},W.position=function(a,b){function g(a){u[0].style.width=x[0].style.width=t[0].style.width=a.style.width,C[0].style.height=C[1].style.height=t[0].style.height=v[0].style.height=w[0].style.height=a.style.height}var c=0,d=0,e=r.offset();z.unbind("resize."+f),r.css({top:-99999,left:-99999}),K.fixed&&!o?r.css({position:"fixed"}):(c=z.scrollTop(),d=z.scrollLeft(),r.css({position:"absolute"})),K.right!==!1?d+=Math.max(z.width()-K.w-O-M-$(K.right,"x"),0):K.left!==!1?d+=$(K.left,"x"):d+=Math.round(Math.max(z.width()-K.w-O-M,0)/2),K.bottom!==!1?c+=Math.max(z.height()-K.h-N-L-$(K.bottom,"y"),0):K.top!==!1?c+=$(K.top,"y"):c+=Math.round(Math.max(z.height()-K.h-N-L,0)/2),r.css({top:e.top,left:e.left}),a=r.width()===K.w+O&&r.height()===K.h+N?0:a||0,s[0].style.width=s[0].style.height="9999px",r.dequeue().animate({width:K.w+O,height:K.h+N,top:c,left:d},{duration:a,complete:function(){g(this),T=!1,s[0].style.width=K.w+O+M+"px",s[0].style.height=K.h+N+L+"px",b&&b(),setTimeout(function(){z.bind("resize."+f,W.position)},1)},step:function(){g(this)}})},W.resize=function(a){S&&(a=a||{},a.width&&(K.w=$(a.width,"x")-O-M),a.innerWidth&&(K.w=$(a.innerWidth,"x")),A.css({width:K.w}),a.height&&(K.h=$(a.height,"y")-N-L),a.innerHeight&&(K.h=$(a.innerHeight,"y")),!a.innerHeight&&!a.height&&(A.css({height:"auto"}),K.h=A.height()),A.css({height:K.h}),W.position(K.transition==="none"?0:K.speed))},W.prep=function(b){function g(){return K.w=K.w||A.width(),K.w=K.mw&&K.mw<K.w?K.mw:K.w,K.w}function h(){return K.h=K.h||A.height(),K.h=K.mh&&K.mh<K.h?K.mh:K.h,K.h}if(!S)return;var c,d=K.transition==="none"?0:K.speed;A.remove(),A=Y(X,"LoadedContent").append(b),A.hide().appendTo(B.show()).css({width:g(),overflow:K.scrolling?"auto":"hidden"}).css({height:h()}).prependTo(t),B.hide(),a(R).css({"float":"none"}),o&&a("select").not(r.find("select")).filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one(k,function(){this.style.visibility="inherit"}),c=function(){function q(){n&&r[0].style.removeAttribute("filter")}var b,c,g=y.length,h,i="frameBorder",k="allowTransparency",l,o,p;if(!S)return;l=function(){clearTimeout(V),C.hide(),bb(j,K.onComplete)},n&&R&&A.fadeIn(100),D.html(K.title).add(A).show();if(g>1){typeof K.current=="string"&&E.html(K.current.replace("{current}",Q+1).replace("{total}",g)).show(),G[K.loop||Q<g-1?"show":"hide"]().html(K.next),H[K.loop||Q?"show":"hide"]().html(K.previous),K.slideshow&&F.show();if(K.preloading){b=[Z(-1),Z(1)];while(c=y[b.pop()])o=a.data(c,e).href||c.href,a.isFunction(o)&&(o=o.call(c)),_(o)&&(p=new Image,p.src=o)}}else J.hide();K.iframe?(h=Y("iframe")[0],i in h&&(h[i]=0),k in h&&(h[k]="true"),h.name=f+ +(new Date),K.fastIframe?l():a(h).one("load",l),h.src=K.href,K.scrolling||(h.scrolling="no"),a(h).addClass(f+"Iframe").appendTo(A).one(m,function(){h.src="//about:blank"})):l(),K.transition==="fade"?r.fadeTo(d,1,q):q()},K.transition==="fade"?r.fadeTo(d,0,function(){W.position(0,c)}):W.position(d,c)},W.load=function(b){var c,d,e=W.prep;T=!0,R=!1,P=y[Q],b||ba(),bb(m),bb(i,K.onLoad),K.h=K.height?$(K.height,"y")-N-L:K.innerHeight&&$(K.innerHeight,"y"),K.w=K.width?$(K.width,"x")-O-M:K.innerWidth&&$(K.innerWidth,"x"),K.mw=K.w,K.mh=K.h,K.maxWidth&&(K.mw=$(K.maxWidth,"x")-O-M,K.mw=K.w&&K.w<K.mw?K.w:K.mw),K.maxHeight&&(K.mh=$(K.maxHeight,"y")-N-L,K.mh=K.h&&K.h<K.mh?K.h:K.mh),c=K.href,V=setTimeout(function(){C.show()},100),K.inline?(Y(X).hide().insertBefore(a(c)[0]).one(m,function(){a(this).replaceWith(A.children())}),e(a(c))):K.iframe?e(" "):K.html?e(K.html):_(c)?(a(R=new Image).addClass(f+"Photo").error(function(){K.title=!1,e(Y(X,"Error").text("This image could not be loaded"))}).load(function(){var a;R.onload=null,K.scalePhotos&&(d=function(){R.height-=R.height*a,R.width-=R.width*a},K.mw&&R.width>K.mw&&(a=(R.width-K.mw)/R.width,d()),K.mh&&R.height>K.mh&&(a=(R.height-K.mh)/R.height,d())),K.h&&(R.style.marginTop=Math.max(K.h-R.height,0)/2+"px"),y[1]&&(Q<y.length-1||K.loop)&&(R.style.cursor="pointer",R.onclick=function(){W.next()}),n&&(R.style.msInterpolationMode="bicubic"),setTimeout(function(){e(R)},1)}),setTimeout(function(){R.src=c},1)):c&&B.load(c,K.data,function(b,c,d){e(c==="error"?Y(X,"Error").text("Request unsuccessful: "+d.statusText):a(this).contents())})},W.next=function(){!T&&y[1]&&(Q<y.length-1||K.loop)&&(Q=Z(1),W.load())},W.prev=function(){!T&&y[1]&&(Q||K.loop)&&(Q=Z(-1),W.load())},W.close=function(){S&&!U&&(U=!0,S=!1,bb(k,K.onCleanup),z.unbind("."+f+" ."+p),q.fadeTo(200,0),r.stop().fadeTo(300,0,function(){r.add(q).css({opacity:1,cursor:"auto"}).hide(),bb(m),A.remove(),setTimeout(function(){U=!1,bb(l,K.onClosed)},1)}))},W.element=function(){return a(P)},W.settings=d,a("."+g,b).live("click",function(a){a.which>1||a.shiftKey||a.altKey||a.metaKey||(a.preventDefault(),bd(this))}),W.init()})(jQuery,document,this);
js/jquery.colorbox.js CHANGED
@@ -1,872 +1,875 @@
1
- // ColorBox v1.3.17.1 - a full featured, light-weight, customizable lightbox based on jQuery 1.3+
2
- // Copyright (c) 2011 Jack Moore - jack@colorpowered.com
3
- // Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
4
- (function ($, document, window) {
5
- var
6
- // ColorBox Default Settings.
7
- // See http://colorpowered.com/colorbox for details.
8
- defaults = {
9
- transition: "elastic",
10
- speed: 300,
11
- width: false,
12
- initialWidth: "600",
13
- innerWidth: false,
14
- maxWidth: false,
15
- height: false,
16
- initialHeight: "450",
17
- innerHeight: false,
18
- maxHeight: false,
19
- scalePhotos: true,
20
- scrolling: true,
21
- inline: false,
22
- html: false,
23
- iframe: false,
24
- fastIframe: true,
25
- photo: false,
26
- href: false,
27
- title: false,
28
- rel: false,
29
- opacity: 0.9,
30
- preloading: true,
31
- current: "image {current} of {total}",
32
- previous: "previous",
33
- next: "next",
34
- close: "close",
35
- open: false,
36
- returnFocus: true,
37
- loop: true,
38
- slideshow: false,
39
- slideshowAuto: true,
40
- slideshowSpeed: 2500,
41
- slideshowStart: "start slideshow",
42
- slideshowStop: "stop slideshow",
43
- onOpen: false,
44
- onLoad: false,
45
- onComplete: false,
46
- onCleanup: false,
47
- onClosed: false,
48
- overlayClose: true,
49
- escKey: true,
50
- arrowKey: true,
51
- top: false,
52
- bottom: false,
53
- left: false,
54
- right: false,
55
- fixed: false,
56
- data: false
57
- },
58
-
59
- // Abstracting the HTML and event identifiers for easy rebranding
60
- colorbox = 'colorbox',
61
- prefix = 'cbox',
62
-
63
- // Events
64
- event_open = prefix + '_open',
65
- event_load = prefix + '_load',
66
- event_complete = prefix + '_complete',
67
- event_cleanup = prefix + '_cleanup',
68
- event_closed = prefix + '_closed',
69
- event_purge = prefix + '_purge',
70
-
71
- // Special Handling for IE
72
- isIE = $.browser.msie && !$.support.opacity, // Detects IE6,7,8. IE9 supports opacity. Feature detection alone gave a false positive on at least one phone browser and on some development versions of Chrome, hence the user-agent test.
73
- isIE6 = isIE && $.browser.version < 7,
74
- event_ie6 = prefix + '_IE6',
75
-
76
- // Cached jQuery Object Variables
77
- $overlay,
78
- $box,
79
- $wrap,
80
- $content,
81
- $topBorder,
82
- $leftBorder,
83
- $rightBorder,
84
- $bottomBorder,
85
- $related,
86
- $window,
87
- $loaded,
88
- $loadingBay,
89
- $loadingOverlay,
90
- $title,
91
- $current,
92
- $slideshow,
93
- $next,
94
- $prev,
95
- $close,
96
- $groupControls,
97
-
98
- // Variables for cached values or use across multiple functions
99
- settings = {},
100
- interfaceHeight,
101
- interfaceWidth,
102
- loadedHeight,
103
- loadedWidth,
104
- element,
105
- index,
106
- photo,
107
- open,
108
- active,
109
- closing,
110
- handler,
111
- loadingTimer,
112
-
113
- publicMethod,
114
- boxElement = prefix + 'Element';
115
-
116
- // ****************
117
- // HELPER FUNCTIONS
118
- // ****************
119
-
120
- // jQuery object generator to reduce code size
121
- function $div(id, cssText) {
122
- var div = document.createElement('div');
123
- if (id) {
124
- div.id = prefix + id;
125
- }
126
- div.style.cssText = cssText || '';
127
- return $(div);
128
- }
129
-
130
- // Convert % values to pixels
131
- function setSize(size, dimension) {
132
- dimension = dimension === 'x' ? $window.width() : $window.height();
133
- return (typeof size === 'string') ? Math.round((/%/.test(size) ? (dimension / 100) * parseInt(size, 10) : parseInt(size, 10))) : size;
134
- }
135
-
136
- // Checks an href to see if it is a photo.
137
- // There is a force photo option (photo: true) for hrefs that cannot be matched by this regex.
138
- function isImage(url) {
139
- return settings.photo || /\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?#x2F;i.test(url);
140
- }
141
-
142
- // Assigns function results to their respective settings. This allows functions to be used as values.
143
- function process(settings) {
144
- for (var i in settings) {
145
- if ($.isFunction(settings[i]) && i.substring(0, 2) !== 'on') { // checks to make sure the function isn't one of the callbacks, they will be handled at the appropriate time.
146
- settings[i] = settings[i].call(element);
147
- }
148
- }
149
-
150
- settings.rel = settings.rel || element.rel || 'nofollow';
151
- settings.href = settings.href || $(element).attr('href');
152
- settings.title = settings.title || element.title;
153
-
154
- if (typeof settings.href === "string") {
155
- settings.href = $.trim(settings.href);
156
- }
157
- }
158
-
159
- function trigger(event, callback) {
160
- if (callback) {
161
- callback.call(element);
162
- }
163
- $.event.trigger(event);
164
- }
165
-
166
- // Slideshow functionality
167
- function slideshow() {
168
- var
169
- timeOut,
170
- className = prefix + "Slideshow_",
171
- click = "click." + prefix,
172
- start,
173
- stop,
174
- clear;
175
-
176
- if (settings.slideshow && $related[1]) {
177
- start = function () {
178
- $slideshow
179
- .text(settings.slideshowStop)
180
- .unbind(click)
181
- .bind(event_complete, function () {
182
- if (index < $related.length - 1 || settings.loop) {
183
- timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed);
184
- }
185
- })
186
- .bind(event_load, function () {
187
- clearTimeout(timeOut);
188
- })
189
- .one(click + ' ' + event_cleanup, stop);
190
- $box.removeClass(className + "off").addClass(className + "on");
191
- timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed);
192
- };
193
-
194
- stop = function () {
195
- clearTimeout(timeOut);
196
- $slideshow
197
- .text(settings.slideshowStart)
198
- .unbind([event_complete, event_load, event_cleanup, click].join(' '))
199
- .one(click, start);
200
- $box.removeClass(className + "on").addClass(className + "off");
201
- };
202
-
203
- if (settings.slideshowAuto) {
204
- start();
205
- } else {
206
- stop();
207
- }
208
- } else {
209
- $box.removeClass(className + "off " + className + "on");
210
- }
211
- }
212
-
213
- function launch(elem) {
214
- if (!closing) {
215
-
216
- element = elem;
217
-
218
- process($.extend(settings, $.data(element, colorbox)));
219
-
220
- $related = $(element);
221
-
222
- index = 0;
223
-
224
- if (settings.rel !== 'nofollow') {
225
- $related = $('.' + boxElement).filter(function () {
226
- var relRelated = $.data(this, colorbox).rel || this.rel;
227
- return (relRelated === settings.rel);
228
- });
229
- index = $related.index(element);
230
-
231
- // Check direct calls to ColorBox.
232
- if (index === -1) {
233
- $related = $related.add(element);
234
- index = $related.length - 1;
235
- }
236
- }
237
-
238
- if (!open) {
239
- open = active = true; // Prevents the page-change action from queuing up if the visitor holds down the left or right keys.
240
-
241
- $box.show();
242
-
243
- if (settings.returnFocus) {
244
- try {
245
- element.blur();
246
- $(element).one(event_closed, function () {
247
- try {
248
- this.focus();
249
- } catch (e) {
250
- // do nothing
251
- }
252
- });
253
- } catch (e) {
254
- // do nothing
255
- }
256
- }
257
-
258
- // +settings.opacity avoids a problem in IE when using non-zero-prefixed-string-values, like '.5'
259
- $overlay.css({"opacity": +settings.opacity, "cursor": settings.overlayClose ? "pointer" : "auto"}).show();
260
-
261
- // Opens inital empty ColorBox prior to content being loaded.
262
- settings.w = setSize(settings.initialWidth, 'x');
263
- settings.h = setSize(settings.initialHeight, 'y');
264
- publicMethod.position(0);
265
-
266
- if (isIE6) {
267
- $window.bind('resize.' + event_ie6 + ' scroll.' + event_ie6, function () {
268
- $overlay.css({width: $window.width(), height: $window.height(), top: $window.scrollTop(), left: $window.scrollLeft()});
269
- }).trigger('resize.' + event_ie6);
270
- }
271
-
272
- trigger(event_open, settings.onOpen);
273
-
274
- $groupControls.add($title).hide();
275
-
276
- $close.html(settings.close).show();
277
- }
278
-
279
- publicMethod.load(true);
280
- }
281
- }
282
-
283
- // ****************
284
- // PUBLIC FUNCTIONS
285
- // Usage format: $.fn.colorbox.close();
286
- // Usage from within an iframe: parent.$.fn.colorbox.close();
287
- // ****************
288
-
289
- publicMethod = $.fn[colorbox] = $[colorbox] = function (options, callback) {
290
- var $this = this, autoOpen;
291
-
292
- if (!$this[0] && $this.selector) { // if a selector was given and it didn't match any elements, go ahead and exit.
293
- return $this;
294
- }
295
-
296
- options = options || {};
297
-
298
- if (callback) {
299
- options.onComplete = callback;
300
- }
301
-
302
- if (!$this[0] || $this.selector === undefined) { // detects $.colorbox() and $.fn.colorbox()
303
- $this = $('<a/>');
304
- options.open = true; // assume an immediate open
305
- }
306
-
307
- $this.each(function () {
308
- $.data(this, colorbox, $.extend({}, $.data(this, colorbox) || defaults, options));
309
- $(this).addClass(boxElement);
310
- });
311
-
312
- autoOpen = options.open;
313
-
314
- if ($.isFunction(autoOpen)) {
315
- autoOpen = autoOpen.call($this);
316
- }
317
-
318
- if (autoOpen) {
319
- launch($this[0]);
320
- }
321
-
322
- return $this;
323
- };
324
-
325
- // Initialize ColorBox: store common calculations, preload the interface graphics, append the html.
326
- // This preps colorbox for a speedy open when clicked, and lightens the burdon on the browser by only
327
- // having to run once, instead of each time colorbox is opened.
328
- publicMethod.init = function () {
329
- // Create & Append jQuery Objects
330
- $window = $(window);
331
- $box = $div().attr({id: colorbox, 'class': isIE ? prefix + (isIE6 ? 'IE6' : 'IE') : ''});
332
- $overlay = $div("Overlay", isIE6 ? 'position:absolute' : '').hide();
333
-
334
- $wrap = $div("Wrapper");
335
- $content = $div("Content").append(
336
- $loaded = $div("LoadedContent", 'width:0; height:0; overflow:hidden'),
337
- $loadingOverlay = $div("LoadingOverlay").add($div("LoadingGraphic")),
338
- $title = $div("Title"),
339
- $current = $div("Current"),
340
- $next = $div("Next"),
341
- $prev = $div("Previous"),
342
- $slideshow = $div("Slideshow").bind(event_open, slideshow),
343
- $close = $div("Close")
344
- );
345
- $wrap.append( // The 3x3 Grid that makes up ColorBox
346
- $div().append(
347
- $div("TopLeft"),
348
- $topBorder = $div("TopCenter"),
349
- $div("TopRight")
350
- ),
351
- $div(false, 'clear:left').append(
352
- $leftBorder = $div("MiddleLeft"),
353
- $content,
354
- $rightBorder = $div("MiddleRight")
355
- ),
356
- $div(false, 'clear:left').append(
357
- $div("BottomLeft"),
358
- $bottomBorder = $div("BottomCenter"),
359
- $div("BottomRight")
360
- )
361
- ).children().children().css({'float': 'left'});
362
-
363
- $loadingBay = $div(false, 'position:absolute; width:9999px; visibility:hidden; display:none');
364
-
365
- $('body').prepend($overlay, $box.append($wrap, $loadingBay));
366
-
367
- $content.children()
368
- .hover(function () {
369
- $(this).addClass('hover');
370
- }, function () {
371
- $(this).removeClass('hover');
372
- }).addClass('hover');
373
-
374
- // Cache values needed for size calculations
375
- interfaceHeight = $topBorder.height() + $bottomBorder.height() + $content.outerHeight(true) - $content.height();//Subtraction needed for IE6
376
- interfaceWidth = $leftBorder.width() + $rightBorder.width() + $content.outerWidth(true) - $content.width();
377
- loadedHeight = $loaded.outerHeight(true);
378
- loadedWidth = $loaded.outerWidth(true);
379
-
380
- // Setting padding to remove the need to do size conversions during the animation step.
381
- $box.css({"padding-bottom": interfaceHeight, "padding-right": interfaceWidth}).hide();
382
-
383
- // Setup button events.
384
- $next.click(function () {
385
- publicMethod.next();
386
- });
387
- $prev.click(function () {
388
- publicMethod.prev();
389
- });
390
- $close.click(function () {
391
- publicMethod.close();
392
- });
393
-
394
- $groupControls = $next.add($prev).add($current).add($slideshow);
395
-
396
- // Adding the 'hover' class allowed the browser to load the hover-state
397
- // background graphics. The class can now can be removed.
398
- $content.children().removeClass('hover');
399
-
400
-
401
-
402
-
403
- $overlay.click(function () {
404
- if (settings.overlayClose) {
405
- publicMethod.close();
406
- }
407
- });
408
-
409
- // Set Navigation Key Bindings
410
- $(document).bind('keydown.' + prefix, function (e) {
411
- var key = e.keyCode;
412
- if (open && settings.escKey && key === 27) {
413
- e.preventDefault();
414
- publicMethod.close();
415
- }
416
- if (open && settings.arrowKey && $related[1]) {
417
- if (key === 37) {
418
- e.preventDefault();
419
- $prev.click();
420
- } else if (key === 39) {
421
- e.preventDefault();
422
- $next.click();
423
- }
424
- }
425
- });
426
- };
427
-
428
- publicMethod.remove = function () {
429
- $box.add($overlay).remove();
430
- $('.' + boxElement).removeData(colorbox).removeClass(boxElement);
431
- };
432
-
433
- publicMethod.position = function (speed, loadedCallback) {
434
- var animate_speed, top = 0, left = 0;
435
-
436
- // remove the modal so that it doesn't influence the document width/height
437
- $box.hide();
438
-
439
- if (settings.fixed && !isIE6) {
440
- $box.css({position: 'fixed'});
441
- } else {
442
- top = $window.scrollTop();
443
- left = $window.scrollLeft();
444
- $box.css({position: 'absolute'});
445
- }
446
-
447
- // keeps the top and left positions within the browser's viewport.
448
- if (settings.right !== false) {
449
- left += Math.max($window.width() - settings.w - loadedWidth - interfaceWidth - setSize(settings.right, 'x'), 0);
450
- } else if (settings.left !== false) {
451
- left += setSize(settings.left, 'x');
452
- } else {
453
- left += Math.max($window.width() - settings.w - loadedWidth - interfaceWidth, 0) / 2;
454
- }
455
-
456
- if (settings.bottom !== false) {
457
- top += Math.max(document.documentElement.clientHeight - settings.h - loadedHeight - interfaceHeight - setSize(settings.bottom, 'y'), 0);
458
- } else if (settings.top !== false) {
459
- top += setSize(settings.top, 'y');
460
- } else {
461
- top += Math.max(document.documentElement.clientHeight - settings.h - loadedHeight - interfaceHeight, 0) / 2;
462
- }
463
-
464
- $box.show();
465
-
466
- // setting the speed to 0 to reduce the delay between same-sized content.
467
- animate_speed = ($box.width() === settings.w + loadedWidth && $box.height() === settings.h + loadedHeight) ? 0 : speed;
468
-
469
- // this gives the wrapper plenty of breathing room so it's floated contents can move around smoothly,
470
- // but it has to be shrank down around the size of div#colorbox when it's done. If not,
471
- // it can invoke an obscure IE bug when using iframes.
472
- $wrap[0].style.width = $wrap[0].style.height = "9999px";
473
-
474
- function modalDimensions(that) {
475
- // loading overlay height has to be explicitly set for IE6.
476
- $topBorder[0].style.width = $bottomBorder[0].style.width = $content[0].style.width = that.style.width;
477
- $loadingOverlay[0].style.height = $loadingOverlay[1].style.height = $content[0].style.height = $leftBorder[0].style.height = $rightBorder[0].style.height = that.style.height;
478
- }
479
-
480
- $box.dequeue().animate({width: settings.w + loadedWidth, height: settings.h + loadedHeight, top: top, left: left}, {
481
- duration: animate_speed,
482
- complete: function () {
483
- modalDimensions(this);
484
-
485
- active = false;
486
-
487
- // shrink the wrapper down to exactly the size of colorbox to avoid a bug in IE's iframe implementation.
488
- $wrap[0].style.width = (settings.w + loadedWidth + interfaceWidth) + "px";
489
- $wrap[0].style.height = (settings.h + loadedHeight + interfaceHeight) + "px";
490
-
491
- if (loadedCallback) {
492
- loadedCallback();
493
- }
494
- },
495
- step: function () {
496
- modalDimensions(this);
497
- }
498
- });
499
- };
500
-
501
- publicMethod.resize = function (options) {
502
- if (open) {
503
- options = options || {};
504
-
505
- if (options.width) {
506
- settings.w = setSize(options.width, 'x') - loadedWidth - interfaceWidth;
507
- }
508
- if (options.innerWidth) {
509
- settings.w = setSize(options.innerWidth, 'x');
510
- }
511
- $loaded.css({width: settings.w});
512
-
513
- if (options.height) {
514
- settings.h = setSize(options.height, 'y') - loadedHeight - interfaceHeight;
515
- }
516
- if (options.innerHeight) {
517
- settings.h = setSize(options.innerHeight, 'y');
518
- }
519
- if (!options.innerHeight && !options.height) {
520
- var $child = $loaded.wrapInner("<div style='overflow:auto'></div>").children(); // temporary wrapper to get an accurate estimate of just how high the total content should be.
521
- settings.h = $child.height();
522
- $child.replaceWith($child.children()); // ditch the temporary wrapper div used in height calculation
523
- }
524
- $loaded.css({height: settings.h});
525
-
526
- publicMethod.position(settings.transition === "none" ? 0 : settings.speed);
527
- }
528
- };
529
-
530
- publicMethod.prep = function (object) {
531
- if (!open) {
532
- return;
533
- }
534
-
535
- var speed = settings.transition === "none" ? 0 : settings.speed;
536
-
537
- $window.unbind('resize.' + prefix);
538
- $loaded.remove();
539
- $loaded = $div('LoadedContent').html(object);
540
-
541
- function getWidth() {
542
- settings.w = settings.w || $loaded.width();
543
- settings.w = settings.mw && settings.mw < settings.w ? settings.mw : settings.w;
544
- return settings.w;
545
- }
546
- function getHeight() {
547
- settings.h = settings.h || $loaded.height();
548
- settings.h = settings.mh && settings.mh < settings.h ? settings.mh : settings.h;
549
- return settings.h;
550
- }
551
-
552
- $loaded.hide()
553
- .appendTo($loadingBay.show())// content has to be appended to the DOM for accurate size calculations.
554
- .css({width: getWidth(), overflow: settings.scrolling ? 'auto' : 'hidden'})
555
- .css({height: getHeight()})// sets the height independently from the width in case the new width influences the value of height.
556
- .prependTo($content);
557
-
558
- $loadingBay.hide();
559
-
560
- // 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.
561
- //$(photo).css({'float': 'none', marginLeft: 'auto', marginRight: 'auto'});
562
-
563
- $(photo).css({'float': 'none'});
564
-
565
- // Hides SELECT elements in IE6 because they would otherwise sit on top of the overlay.
566
- if (isIE6) {
567
- $('select').not($box.find('select')).filter(function () {
568
- return this.style.visibility !== 'hidden';
569
- }).css({'visibility': 'hidden'}).one(event_cleanup, function () {
570
- this.style.visibility = 'inherit';
571
- });
572
- }
573
-
574
- function setPosition(s) {
575
- publicMethod.position(s, function () {
576
- var prev, prevSrc, next, nextSrc, total = $related.length, iframe, complete;
577
-
578
- if (!open) {
579
- return;
580
- }
581
-
582
- function removeFilter() {
583
- if (isIE) {
584
- $box[0].style.removeAttribute('filter');
585
- }
586
- }
587
-
588
- complete = function () {
589
- clearTimeout(loadingTimer);
590
- $loadingOverlay.hide();
591
- trigger(event_complete, settings.onComplete);
592
- };
593
-
594
- if (isIE) {
595
- //This fadeIn helps the bicubic resampling to kick-in.
596
- if (photo) {
597
- $loaded.fadeIn(100);
598
- }
599
- }
600
-
601
- $title.html(settings.title).add($loaded).show();
602
-
603
- if (total > 1) { // handle grouping
604
- if (typeof settings.current === "string") {
605
- $current.html(settings.current.replace(/\{current\}/, index + 1).replace(/\{total\}/, total)).show();
606
- }
607
-
608
- $next[(settings.loop || index < total - 1) ? "show" : "hide"]().html(settings.next);
609
- $prev[(settings.loop || index) ? "show" : "hide"]().html(settings.previous);
610
-
611
- prev = index ? $related[index - 1] : $related[total - 1];
612
- next = index < total - 1 ? $related[index + 1] : $related[0];
613
-
614
- if (settings.slideshow) {
615
- $slideshow.show();
616
- }
617
-
618
- // Preloads images within a rel group
619
- if (settings.preloading) {
620
- nextSrc = $.data(next, colorbox).href || next.href;
621
- prevSrc = $.data(prev, colorbox).href || prev.href;
622
-
623
- nextSrc = $.isFunction(nextSrc) ? nextSrc.call(next) : nextSrc;
624
- prevSrc = $.isFunction(prevSrc) ? prevSrc.call(prev) : prevSrc;
625
-
626
- if (isImage(nextSrc)) {
627
- $('<img/>')[0].src = nextSrc;
628
- }
629
-
630
- if (isImage(prevSrc)) {
631
- $('<img/>')[0].src = prevSrc;
632
- }
633
- }
634
- } else {
635
- $groupControls.hide();
636
- }
637
-
638
- if (settings.iframe) {
639
- iframe = $('<iframe/>').addClass(prefix + 'Iframe')[0];
640
-
641
- if (settings.fastIframe) {
642
- complete();
643
- } else {
644
- $(iframe).one('load', complete);
645
- }
646
- iframe.name = prefix + (+new Date());
647
- iframe.src = settings.href;
648
-
649
- if (!settings.scrolling) {
650
- iframe.scrolling = "no";
651
- }
652
-
653
- if (isIE) {
654
- iframe.frameBorder = 0;
655
- iframe.allowTransparency = "true";
656
- }
657
-
658
- $(iframe).appendTo($loaded).one(event_purge, function () {
659
- iframe.src = "//about:blank";
660
- });
661
- } else {
662
- complete();
663
- }
664
-
665
- if (settings.transition === 'fade') {
666
- $box.fadeTo(speed, 1, removeFilter);
667
- } else {
668
- removeFilter();
669
- }
670
-
671
- $window.bind('resize.' + prefix, function () {
672
- publicMethod.position(0);
673
- });
674
- });
675
- }
676
-
677
- if (settings.transition === 'fade') {
678
- $box.fadeTo(speed, 0, function () {
679
- setPosition(0);
680
- });
681
- } else {
682
- setPosition(speed);
683
- }
684
- };
685
-
686
- publicMethod.load = function (launched) {
687
- var href, setResize, prep = publicMethod.prep;
688
-
689
- active = true;
690
-
691
- photo = false;
692
-
693
- element = $related[index];
694
-
695
- if (!launched) {
696
- process($.extend(settings, $.data(element, colorbox)));
697
- }
698
-
699
- trigger(event_purge);
700
-
701
- trigger(event_load, settings.onLoad);
702
-
703
- settings.h = settings.height ?
704
- setSize(settings.height, 'y') - loadedHeight - interfaceHeight :
705
- settings.innerHeight && setSize(settings.innerHeight, 'y');
706
-
707
- settings.w = settings.width ?
708
- setSize(settings.width, 'x') - loadedWidth - interfaceWidth :
709
- settings.innerWidth && setSize(settings.innerWidth, 'x');
710
-
711
- // Sets the minimum dimensions for use in image scaling
712
- settings.mw = settings.w;
713
- settings.mh = settings.h;
714
-
715
- // Re-evaluate the minimum width and height based on maxWidth and maxHeight values.
716
- // If the width or height exceed the maxWidth or maxHeight, use the maximum values instead.
717
- if (settings.maxWidth) {
718
- settings.mw = setSize(settings.maxWidth, 'x') - loadedWidth - interfaceWidth;
719
- settings.mw = settings.w && settings.w < settings.mw ? settings.w : settings.mw;
720
- }
721
- if (settings.maxHeight) {
722
- settings.mh = setSize(settings.maxHeight, 'y') - loadedHeight - interfaceHeight;
723
- settings.mh = settings.h && settings.h < settings.mh ? settings.h : settings.mh;
724
- }
725
-
726
- href = settings.href;
727
-
728
- loadingTimer = setTimeout(function () {
729
- $loadingOverlay.show();
730
- }, 100);
731
-
732
- if (settings.inline) {
733
- // Inserts an empty placeholder where inline content is being pulled from.
734
- // An event is bound to put inline content back when ColorBox closes or loads new content.
735
- $div().hide().insertBefore($(href)[0]).one(event_purge, function () {
736
- $(this).replaceWith($loaded.children());
737
- });
738
- prep($(href));
739
- } else if (settings.iframe) {
740
- // IFrame element won't be added to the DOM until it is ready to be displayed,
741
- // to avoid problems with DOM-ready JS that might be trying to run in that iframe.
742
- prep(" ");
743
- } else if (settings.html) {
744
- prep(settings.html);
745
- } else if (isImage(href)) {
746
- $(photo = new Image())
747
- .addClass(prefix + 'Photo')
748
- .error(function () {
749
- settings.title = false;
750
- prep($div('Error').text('This image could not be loaded'));
751
- })
752
- .load(function () {
753
- var percent;
754
- photo.onload = null; //stops animated gifs from firing the onload repeatedly.
755
-
756
- if (settings.scalePhotos) {
757
- setResize = function () {
758
- photo.height -= photo.height * percent;
759
- photo.width -= photo.width * percent;
760
- };
761
- if (settings.mw && photo.width > settings.mw) {
762
- percent = (photo.width - settings.mw) / photo.width;
763
- setResize();
764
- }
765
- if (settings.mh && photo.height > settings.mh) {
766
- percent = (photo.height - settings.mh) / photo.height;
767
- setResize();
768
- }
769
- }
770
-
771
- if (settings.h) {
772
- photo.style.marginTop = Math.max(settings.h - photo.height, 0) / 2 + 'px';
773
- }
774
-
775
- if ($related[1] && (index < $related.length - 1 || settings.loop)) {
776
- photo.style.cursor = 'pointer';
777
- photo.onclick = function () {
778
- publicMethod.next();
779
- };
780
- }
781
-
782
- if (isIE) {
783
- photo.style.msInterpolationMode = 'bicubic';
784
- }
785
-
786
- setTimeout(function () { // A pause because Chrome will sometimes report a 0 by 0 size otherwise.
787
- prep(photo);
788
- }, 1);
789
- });
790
-
791
- setTimeout(function () { // A pause because Opera 10.6+ will sometimes not run the onload function otherwise.
792
- photo.src = href;
793
- }, 1);
794
- } else if (href) {
795
- $loadingBay.load(href, settings.data, function (data, status, xhr) {
796
- prep(status === 'error' ? $div('Error').text('Request unsuccessful: ' + xhr.statusText) : $(this).contents());
797
- });
798
- }
799
- };
800
-
801
- // Navigates to the next page/image in a set.
802
- publicMethod.next = function () {
803
- if (!active && $related[1] && (index < $related.length - 1 || settings.loop)) {
804
- index = index < $related.length - 1 ? index + 1 : 0;
805
- publicMethod.load();
806
- }
807
- };
808
-
809
- publicMethod.prev = function () {
810
- if (!active && $related[1] && (index || settings.loop)) {
811
- index = index ? index - 1 : $related.length - 1;
812
- publicMethod.load();
813
- }
814
- };
815
-
816
- // Note: to use this within an iframe use the following format: parent.$.fn.colorbox.close();
817
- publicMethod.close = function () {
818
- if (open && !closing) {
819
-
820
- closing = true;
821
-
822
- open = false;
823
-
824
- trigger(event_cleanup, settings.onCleanup);
825
-
826
- $window.unbind('.' + prefix + ' .' + event_ie6);
827
-
828
- $overlay.fadeTo(200, 0);
829
-
830
- $box.stop().fadeTo(300, 0, function () {
831
-
832
- $box.add($overlay).css({'opacity': 1, cursor: 'auto'}).hide();
833
-
834
- trigger(event_purge);
835
-
836
- $loaded.remove();
837
-
838
- setTimeout(function () {
839
- closing = false;
840
- trigger(event_closed, settings.onClosed);
841
- }, 1);
842
- });
843
- }
844
- };
845
-
846
- // A method for fetching the current element ColorBox is referencing.
847
- // returns a jQuery object.
848
- publicMethod.element = function () {
849
- return $(element);
850
- };
851
-
852
- publicMethod.settings = defaults;
853
-
854
- // Bind the live event before DOM-ready for maximum performance in IE6 & 7.
855
- handler = function (e) {
856
- // checks to see if it was a non-left mouse-click and for clicks modified with ctrl, shift, or alt.
857
- if (!((e.button !== 0 && typeof e.button !== 'undefined') || e.ctrlKey || e.shiftKey || e.altKey)) {
858
- e.preventDefault();
859
- launch(this);
860
- }
861
- };
862
-
863
- if ($.fn.delegate) {
864
- $(document).delegate('.' + boxElement, 'click', handler);
865
- } else {
866
- $('.' + boxElement).live('click', handler);
867
- }
868
-
869
- // Initializes ColorBox when the DOM has loaded
870
- $(publicMethod.init);
871
-
872
}(jQuery, document, this));
1
+ // ColorBox v1.3.18 - a full featured, light-weight, customizable lightbox based on jQuery 1.3+
2
+ // Copyright (c) 2011 Jack Moore - jack@colorpowered.com
3
+ // Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
4
+
5
+ (function ($, document, window) {
6
+ var
7
+ // Default settings object.
8
+ // See http://jacklmoore.com/colorbox for details.
9
+ defaults = {
10
+ transition: "elastic",
11
+ speed: 300,
12
+ width: false,
13
+ initialWidth: "600",
14
+ innerWidth: false,
15
+ maxWidth: false,
16
+ height: false,
17
+ initialHeight: "450",
18
+ innerHeight: false,
19
+ maxHeight: false,
20
+ scalePhotos: true,
21
+ scrolling: true,
22
+ inline: false,
23
+ html: false,
24
+ iframe: false,
25
+ fastIframe: true,
26
+ photo: false,
27
+ href: false,
28
+ title: false,
29
+ rel: false,
30
+ opacity: 0.9,
31
+ preloading: true,
32
+ current: "image {current} of {total}",
33
+ previous: "previous",
34
+ next: "next",
35
+ close: "close",
36
+ open: false,
37
+ returnFocus: true,
38
+ loop: true,
39
+ slideshow: false,
40
+ slideshowAuto: true,
41
+ slideshowSpeed: 2500,
42
+ slideshowStart: "start slideshow",
43
+ slideshowStop: "stop slideshow",
44
+ onOpen: false,
45
+ onLoad: false,
46
+ onComplete: false,
47
+ onCleanup: false,
48
+ onClosed: false,
49
+ overlayClose: true,
50
+ escKey: true,
51
+ arrowKey: true,
52
+ top: false,
53
+ bottom: false,
54
+ left: false,
55
+ right: false,
56
+ fixed: false,
57
+ data: undefined
58
+ },
59
+
60
+ // Abstracting the HTML and event identifiers for easy rebranding
61
+ colorbox = 'colorbox',
62
+ prefix = 'cbox',
63
+ boxElement = prefix + 'Element',
64
+
65
+ // Events
66
+ event_open = prefix + '_open',
67
+ event_load = prefix + '_load',
68
+ event_complete = prefix + '_complete',
69
+ event_cleanup = prefix + '_cleanup',
70
+ event_closed = prefix + '_closed',
71
+ event_purge = prefix + '_purge',
72
+
73
+ // Special Handling for IE
74
+ isIE = $.browser.msie && !$.support.opacity, // Detects IE6,7,8. IE9 supports opacity. Feature detection alone gave a false positive on at least one phone browser and on some development versions of Chrome, hence the user-agent test.
75
+ isIE6 = isIE && $.browser.version < 7,
76
+ event_ie6 = prefix + '_IE6',
77
+
78
+ // Cached jQuery Object Variables
79
+ $overlay,
80
+ $box,
81
+ $wrap,
82
+ $content,
83
+ $topBorder,
84
+ $leftBorder,
85
+ $rightBorder,
86
+ $bottomBorder,
87
+ $related,
88
+ $window,
89
+ $loaded,
90
+ $loadingBay,
91
+ $loadingOverlay,
92
+ $title,
93
+ $current,
94
+ $slideshow,
95
+ $next,
96
+ $prev,
97
+ $close,
98
+ $groupControls,
99
+
100
+ // Variables for cached values or use across multiple functions
101
+ settings,
102
+ interfaceHeight,
103
+ interfaceWidth,
104
+ loadedHeight,
105
+ loadedWidth,
106
+ element,
107
+ index,
108
+ photo,
109
+ open,
110
+ active,
111
+ closing,
112
+ loadingTimer,
113
+ publicMethod,
114
+ div = "div";
115
+
116
+ // ****************
117
+ // HELPER FUNCTIONS
118
+ // ****************
119
+
120
+ // Convience function for creating new jQuery objects
121
+ function $tag(tag, id, css) {
122
+ var element = document.createElement(tag);
123
+
124
+ if (id) {
125
+ element.id = prefix + id;
126
+ }
127
+
128
+ if (css) {
129
+ element.style.cssText = css;
130
+ }
131
+
132
+ return $(element);
133
+ }
134
+
135
+ // Determine the next and previous members in a group.
136
+ function getIndex(increment) {
137
+ var
138
+ max = $related.length,
139
+ newIndex = (index + increment) % max;
140
+
141
+ return (newIndex < 0) ? max + newIndex : newIndex;
142
+ }
143
+
144
+ // Convert '%' and 'px' values to integers
145
+ function setSize(size, dimension) {
146
+ return Math.round((/%/.test(size) ? ((dimension === 'x' ? $window.width() : $window.height()) / 100) : 1) * parseInt(size, 10));
147
+ }
148
+
149
+ // Checks an href to see if it is a photo.
150
+ // There is a force photo option (photo: true) for hrefs that cannot be matched by this regex.
151
+ function isImage(url) {
152
+ return settings.photo || /\.(gif|png|jpe?g|bmp|ico)((#|\?).*)?#x2F;i.test(url);
153
+ }
154
+
155
+ // Assigns function results to their respective properties
156
+ function makeSettings() {
157
+ var i;
158
+ settings = $.extend({}, $.data(element, colorbox));
159
+
160
+ for (i in settings) {
161
+ 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.
162
+ settings[i] = settings[i].call(element);
163
+ }
164
+ }
165
+
166
+ settings.rel = settings.rel || element.rel || 'nofollow';
167
+ settings.href = settings.href || $(element).attr('href');
168
+ settings.title = settings.title || element.title;
169
+
170
+ if (typeof settings.href === "string") {
171
+ settings.href = $.trim(settings.href);
172
+ }
173
+ }
174
+
175
+ function trigger(event, callback) {
176
+ $.event.trigger(event);
177
+ if (callback) {
178
+ callback.call(element);
179
+ }
180
+ }
181
+
182
+ // Slideshow functionality
183
+ function slideshow() {
184
+ var
185
+ timeOut,
186
+ className = prefix + "Slideshow_",
187
+ click = "click." + prefix,
188
+ start,
189
+ stop,
190
+ clear;
191
+
192
+ if (settings.slideshow && $related[1]) {
193
+ start = function () {
194
+ $slideshow
195
+ .text(settings.slideshowStop)
196
+ .unbind(click)
197
+ .bind(event_complete, function () {
198
+ if (index < $related.length - 1 || settings.loop) {
199
+ timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed);
200
+ }
201
+ })
202
+ .bind(event_load, function () {
203
+ clearTimeout(timeOut);
204
+ })
205
+ .one(click + ' ' + event_cleanup, stop);
206
+ $box.removeClass(className + "off").addClass(className + "on");
207
+ timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed);
208
+ };
209
+
210
+ stop = function () {
211
+ clearTimeout(timeOut);
212
+ $slideshow
213
+ .text(settings.slideshowStart)
214
+ .unbind([event_complete, event_load, event_cleanup, click].join(' '))
215
+ .one(click, function () {
216
+ publicMethod.next();
217
+ start();
218
+ });
219
+ $box.removeClass(className + "on").addClass(className + "off");
220
+ };
221
+
222
+ if (settings.slideshowAuto) {
223
+ start();
224
+ } else {
225
+ stop();
226
+ }
227
+ } else {
228
+ $box.removeClass(className + "off " + className + "on");
229
+ }
230
+ }
231
+
232
+ function launch(target) {
233
+ if (!closing) {
234
+
235
+ element = target;
236
+
237
+ makeSettings();
238
+
239
+ $related = $(element);
240
+
241
+ index = 0;
242
+
243
+ if (settings.rel !== 'nofollow') {
244
+ $related = $('.' + boxElement).filter(function () {
245
+ var relRelated = $.data(this, colorbox).rel || this.rel;
246
+ return (relRelated === settings.rel);
247
+ });
248
+ index = $related.index(element);
249
+
250
+ // Check direct calls to ColorBox.
251
+ if (index === -1) {
252
+ $related = $related.add(element);
253
+ index = $related.length - 1;
254
+ }
255
+ }
256
+
257
+ if (!open) {
258
+ open = active = true; // Prevents the page-change action from queuing up if the visitor holds down the left or right keys.
259
+
260
+ $box.show();
261
+
262
+ if (settings.returnFocus) {
263
+ try {
264
+ element.blur();
265
+ $(element).one(event_closed, function () {
266
+ try {
267
+ this.focus();
268
+ } catch (e) {
269
+ // do nothing
270
+ }
271
+ });
272
+ } catch (e) {
273
+ // do nothing
274
+ }
275
+ }
276
+
277
+ // +settings.opacity avoids a problem in IE when using non-zero-prefixed-string-values, like '.5'
278
+ $overlay.css({"opacity": +settings.opacity, "cursor": settings.overlayClose ? "pointer" : "auto"}).show();
279
+
280
+ // Opens inital empty ColorBox prior to content being loaded.
281
+ settings.w = setSize(settings.initialWidth, 'x');
282
+ settings.h = setSize(settings.initialHeight, 'y');
283
+ publicMethod.position();
284
+
285
+ if (isIE6) {
286
+ $window.bind('resize.' + event_ie6 + ' scroll.' + event_ie6, function () {
287
+ $overlay.css({width: $window.width(), height: $window.height(), top: $window.scrollTop(), left: $window.scrollLeft()});
288
+ }).trigger('resize.' + event_ie6);
289
+ }
290
+
291
+ trigger(event_open, settings.onOpen);
292
+
293
+ $groupControls.add($title).hide();
294
+
295
+ $close.html(settings.close).show();
296
+ }
297
+
298
+ publicMethod.load(true);
299
+ }
300
+ }
301
+
302
+ // ****************
303
+ // PUBLIC FUNCTIONS
304
+ // Usage format: $.fn.colorbox.close();
305
+ // Usage from within an iframe: parent.$.fn.colorbox.close();
306
+ // ****************
307
+
308
+ publicMethod = $.fn[colorbox] = $[colorbox] = function (options, callback) {
309
+ var $this = this;
310
+
311
+ options = options || {};
312
+
313
+ publicMethod.init();
314
+
315
+ if (!$this[0]) {
316
+ if ($this.selector) { // if a selector was given and it didn't match any elements, go ahead and exit.
317
+ return $this;
318
+ }
319
+ // if no selector was given (ie. $.colorbox()), create a temporary element to work with
320
+ $this = $('<a/>');
321
+ options.open = true; // assume an immediate open
322
+ }
323
+
324
+ if (callback) {
325
+ options.onComplete = callback;
326
+ }
327
+
328
+ $this.each(function () {
329
+ $.data(this, colorbox, $.extend({}, $.data(this, colorbox) || defaults, options));
330
+ $(this).addClass(boxElement);
331
+ });
332
+
333
+ if (($.isFunction(options.open) && options.open.call($this)) || options.open) {
334
+ launch($this[0]);
335
+ }
336
+
337
+ return $this;
338
+ };
339
+
340
+ // Initialize ColorBox: store common calculations, preload the interface graphics, append the html.
341
+ // This preps ColorBox for a speedy open when clicked, and minimizes the burdon on the browser by only
342
+ // having to run once, instead of each time colorbox is opened.
343
+ publicMethod.init = function () {
344
+ if (!$box) {
345
+
346
+ // If the body is not present yet, wait for DOM ready
347
+ if (!$('body')[0]) {
348
+ $(publicMethod.init);
349
+ return;
350
+ }
351
+
352
+ // Create the markup and append to BODY
353
+ $window = $(window);
354
+ $box = $tag(div).attr({id: colorbox, 'class': isIE ? prefix + (isIE6 ? 'IE6' : 'IE') : ''});
355
+ $overlay = $tag(div, "Overlay", isIE6 ? 'position:absolute' : '').hide();
356
+ $wrap = $tag(div, "Wrapper");
357
+ $content = $tag(div, "Content").append(
358
+ $loaded = $tag(div, "LoadedContent", 'width:0; height:0; overflow:hidden'),
359
+ $loadingOverlay = $tag(div, "LoadingOverlay").add($tag(div, "LoadingGraphic")),
360
+ $title = $tag(div, "Title"),
361
+ $current = $tag(div, "Current"),
362
+ $next = $tag(div, "Next"),
363
+ $prev = $tag(div, "Previous"),
364
+ $slideshow = $tag(div, "Slideshow").bind(event_open, slideshow),
365
+ $close = $tag(div, "Close")
366
+ );
367
+
368
+ $wrap.append( // The 3x3 Grid that makes up ColorBox
369
+ $tag(div).append(
370
+ $tag(div, "TopLeft"),
371
+ $topBorder = $tag(div, "TopCenter"),
372
+ $tag(div, "TopRight")
373
+ ),
374
+ $tag(div, false, 'clear:left').append(
375
+ $leftBorder = $tag(div, "MiddleLeft"),
376
+ $content,
377
+ $rightBorder = $tag(div, "MiddleRight")
378
+ ),
379
+ $tag(div, false, 'clear:left').append(
380
+ $tag(div, "BottomLeft"),
381
+ $bottomBorder = $tag(div, "BottomCenter"),
382
+ $tag(div, "BottomRight")
383
+ )
384
+ ).find('div div').css({'float': 'left'});
385
+
386
+ $loadingBay = $tag(div, false, 'position:absolute; width:9999px; visibility:hidden; display:none');
387
+
388
+ $('body').prepend($overlay, $box.append($wrap, $loadingBay));
389
+
390
+ // Cache values needed for size calculations
391
+ interfaceHeight = $topBorder.height() + $bottomBorder.height() + $content.outerHeight(true) - $content.height();//Subtraction needed for IE6
392
+ interfaceWidth = $leftBorder.width() + $rightBorder.width() + $content.outerWidth(true) - $content.width();
393
+ loadedHeight = $loaded.outerHeight(true);
394
+ loadedWidth = $loaded.outerWidth(true);
395
+
396
+ // Setting padding to remove the need to do size conversions during the animation step.
397
+ $box.css({"padding-bottom": interfaceHeight, "padding-right": interfaceWidth}).hide();
398
+
399
+ // Setup button events.
400
+ // Anonymous functions here keep the public method from being cached, thereby allowing them to be redefined on the fly.
401
+ $next.click(function () {
402
+ publicMethod.next();
403
+ });
404
+ $prev.click(function () {
405
+ publicMethod.prev();
406
+ });
407
+ $close.click(function () {
408
+ publicMethod.close();
409
+ });
410
+
411
+ $groupControls = $next.add($prev).add($current).add($slideshow);
412
+
413
+ $overlay.click(function () {
414
+ if (settings.overlayClose) {
415
+ publicMethod.close();
416
+ }
417
+ });
418
+
419
+ // Set Navigation Key Bindings
420
+ $(document).bind('keydown.' + prefix, function (e) {
421
+ var key = e.keyCode;
422
+ if (open && settings.escKey && key === 27) {
423
+ e.preventDefault();
424
+ publicMethod.close();
425
+ }
426
+ if (open && settings.arrowKey && $related[1]) {
427
+ if (key === 37) {
428
+ e.preventDefault();
429
+ $prev.click();
430
+ } else if (key === 39) {
431
+ e.preventDefault();
432
+ $next.click();
433
+ }
434
+ }
435
+ });
436
+ }
437
+ };
438
+
439
+ publicMethod.remove = function () {
440
+ $box.add($overlay).remove();
441
+ $box = null;
442
+ $('.' + boxElement).removeData(colorbox).removeClass(boxElement);
443
+ };
444
+
445
+ publicMethod.position = function (speed, loadedCallback) {
446
+ var top = 0, left = 0, offset = $box.offset();
447
+
448
+ $window.unbind('resize.' + prefix);
449
+
450
+ // remove the modal so that it doesn't influence the document width/height
451
+ $box.css({top: -99999, left: -99999});
452
+
453
+ if (settings.fixed && !isIE6) {
454
+ $box.css({position: 'fixed'});
455
+ } else {
456
+ top = $window.scrollTop();
457
+ left = $window.scrollLeft();
458
+ $box.css({position: 'absolute'});
459
+ }
460
+
461
+ // keeps the top and left positions within the browser's viewport.
462
+ if (settings.right !== false) {
463
+ left += Math.max($window.width() - settings.w - loadedWidth - interfaceWidth - setSize(settings.right, 'x'), 0);
464
+ } else if (settings.left !== false) {
465
+ left += setSize(settings.left, 'x');
466
+ } else {
467
+ left += Math.round(Math.max($window.width() - settings.w - loadedWidth - interfaceWidth, 0) / 2);
468
+ }
469
+
470
+ if (settings.bottom !== false) {
471
+ top += Math.max($window.height() - settings.h - loadedHeight - interfaceHeight - setSize(settings.bottom, 'y'), 0);
472
+ } else if (settings.top !== false) {
473
+ top += setSize(settings.top, 'y');
474
+ } else {
475
+ top += Math.round(Math.max($window.height() - settings.h - loadedHeight - interfaceHeight, 0) / 2);
476
+ }
477
+
478
+ $box.css({top: offset.top, left: offset.left});
479
+
480
+ // setting the speed to 0 to reduce the delay between same-sized content.
481
+ speed = ($box.width() === settings.w + loadedWidth && $box.height() === settings.h + loadedHeight) ? 0 : speed || 0;
482
+
483
+ // this gives the wrapper plenty of breathing room so it's floated contents can move around smoothly,
484
+ // but it has to be shrank down around the size of div#colorbox when it's done. If not,
485
+ // it can invoke an obscure IE bug when using iframes.
486
+ $wrap[0].style.width = $wrap[0].style.height = "9999px";
487
+
488
+ function modalDimensions(that) {
489
+ // loading overlay height has to be explicitly set for IE6.
490
+ $topBorder[0].style.width = $bottomBorder[0].style.width = $content[0].style.width = that.style.width;
491
+ $loadingOverlay[0].style.height = $loadingOverlay[1].style.height = $content[0].style.height = $leftBorder[0].style.height = $rightBorder[0].style.height = that.style.height;
492
+ }
493
+
494
+ $box.dequeue().animate({width: settings.w + loadedWidth, height: settings.h + loadedHeight, top: top, left: left}, {
495
+ duration: speed,
496
+ complete: function () {
497
+ modalDimensions(this);
498
+
499
+ active = false;
500
+
501
+ // shrink the wrapper down to exactly the size of colorbox to avoid a bug in IE's iframe implementation.
502
+ $wrap[0].style.width = (settings.w + loadedWidth + interfaceWidth) + "px";
503
+ $wrap[0].style.height = (settings.h + loadedHeight + interfaceHeight) + "px";
504
+
505
+ if (loadedCallback) {
506
+ loadedCallback();
507
+ }
508
+
509
+ setTimeout(function () { // small delay before binding onresize due to an IE8 bug.
510
+ $window.bind('resize.' + prefix, publicMethod.position);
511
+ }, 1);
512
+ },
513
+ step: function () {
514
+ modalDimensions(this);
515
+ }
516
+ });
517
+ };
518
+
519
+ publicMethod.resize = function (options) {
520
+ if (open) {
521
+ options = options || {};
522
+
523
+ if (options.width) {
524
+ settings.w = setSize(options.width, 'x') - loadedWidth - interfaceWidth;
525
+ }
526
+ if (options.innerWidth) {
527
+ settings.w = setSize(options.innerWidth, 'x');
528
+ }
529
+ $loaded.css({width: settings.w});
530
+
531
+ if (options.height) {
532
+ settings.h = setSize(options.height, 'y') - loadedHeight - interfaceHeight;
533
+ }
534
+ if (options.innerHeight) {
535
+ settings.h = setSize(options.innerHeight, 'y');
536
+ }
537
+ if (!options.innerHeight && !options.height) {
538
+ $loaded.css({height: "auto"});
539
+ settings.h = $loaded.height();
540
+ }
541
+ $loaded.css({height: settings.h});
542
+
543
+ publicMethod.position(settings.transition === "none" ? 0 : settings.speed);
544
+ }
545
+ };
546
+
547
+ publicMethod.prep = function (object) {
548
+ if (!open) {
549
+ return;
550
+ }
551
+
552
+ var callback, speed = settings.transition === "none" ? 0 : settings.speed;
553
+
554
+ $loaded.remove();
555
+ $loaded = $tag(div, 'LoadedContent').append(object);
556
+
557
+ function getWidth() {
558
+ settings.w = settings.w || $loaded.width();
559
+ settings.w = settings.mw && settings.mw < settings.w ? settings.mw : settings.w;
560
+ return settings.w;
561
+ }
562
+ function getHeight() {
563
+ settings.h = settings.h || $loaded.height();
564
+ settings.h = settings.mh && settings.mh < settings.h ? settings.mh : settings.h;
565
+ return settings.h;
566
+ }
567
+
568
+ $loaded.hide()
569
+ .appendTo($loadingBay.show())// content has to be appended to the DOM for accurate size calculations.
570
+ .css({width: getWidth(), overflow: settings.scrolling ? 'auto' : 'hidden'})
571
+ .css({height: getHeight()})// sets the height independently from the width in case the new width influences the value of height.
572
+ .prependTo($content);
573
+
574
+ $loadingBay.hide();
575
+
576
+ // 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.
577
+ //$(photo).css({'float': 'none', marginLeft: 'auto', marginRight: 'auto'});
578
+
579
+ $(photo).css({'float': 'none'});
580
+
581
+ // Hides SELECT elements in IE6 because they would otherwise sit on top of the overlay.
582
+ if (isIE6) {
583
+ $('select').not($box.find('select')).filter(function () {
584
+ return this.style.visibility !== 'hidden';
585
+ }).css({'visibility': 'hidden'}).one(event_cleanup, function () {
586
+ this.style.visibility = 'inherit';
587
+ });
588
+ }
589
+
590
+ callback = function () {
591
+ var preload, i, total = $related.length, iframe, frameBorder = 'frameBorder', allowTransparency = 'allowTransparency', complete, src, img;
592
+
593
+ if (!open) {
594
+ return;
595
+ }
596
+
597
+ function removeFilter() {
598
+ if (isIE) {
599
+ $box[0].style.removeAttribute('filter');
600
+ }
601
+ }
602
+
603
+ complete = function () {
604
+ clearTimeout(loadingTimer);
605
+ $loadingOverlay.hide();
606
+ trigger(event_complete, settings.onComplete);
607
+ };
608
+
609
+ if (isIE) {
610
+ //This fadeIn helps the bicubic resampling to kick-in.
611
+ if (photo) {
612
+ $loaded.fadeIn(100);
613
+ }
614
+ }
615
+
616
+ $title.html(settings.title).add($loaded).show();
617
+
618
+ if (total > 1) { // handle grouping
619
+ if (typeof settings.current === "string") {
620
+ $current.html(settings.current.replace('{current}', index + 1).replace('{total}', total)).show();
621
+ }
622
+
623
+ $next[(settings.loop || index < total - 1) ? "show" : "hide"]().html(settings.next);
624
+ $prev[(settings.loop || index) ? "show" : "hide"]().html(settings.previous);
625
+
626
+ if (settings.slideshow) {
627
+ $slideshow.show();
628
+ }
629
+
630
+ // Preloads images within a rel group
631
+ if (settings.preloading) {
632
+ preload = [
633
+ getIndex(-1),
634
+ getIndex(1)
635
+ ];
636
+ while ((i = $related[preload.pop()])) {
637
+ src = $.data(i, colorbox).href || i.href;
638
+ if ($.isFunction(src)) {
639
+ src = src.call(i);
640
+ }
641
+ if (isImage(src)) {
642
+ img = new Image();
643
+ img.src = src;
644
+ }
645
+ }
646
+ }
647
+ } else {
648
+ $groupControls.hide();
649
+ }
650
+
651
+ if (settings.iframe) {
652
+ iframe = $tag('iframe')[0];
653
+
654
+ if (frameBorder in iframe) {
655
+ iframe[frameBorder] = 0;
656
+ }
657
+ if (allowTransparency in iframe) {
658
+ iframe[allowTransparency] = "true";
659
+ }
660
+ // give the iframe a unique name to prevent caching
661
+ iframe.name = prefix + (+new Date());
662
+ if (settings.fastIframe) {
663
+ complete();
664
+ } else {
665
+ $(iframe).one('load', complete);
666
+ }
667
+ iframe.src = settings.href;
668
+ if (!settings.scrolling) {
669
+ iframe.scrolling = "no";
670
+ }
671
+ $(iframe).addClass(prefix + 'Iframe').appendTo($loaded).one(event_purge, function () {
672
+ iframe.src = "//about:blank";
673
+ });
674
+ } else {
675
+ complete();
676
+ }
677
+
678
+ if (settings.transition === 'fade') {
679
+ $box.fadeTo(speed, 1, removeFilter);
680
+ } else {
681
+ removeFilter();
682
+ }
683
+ };
684
+
685
+ if (settings.transition === 'fade') {
686
+ $box.fadeTo(speed, 0, function () {
687
+ publicMethod.position(0, callback);
688
+ });
689
+ } else {
690
+ publicMethod.position(speed, callback);
691
+ }
692
+ };
693
+
694
+ publicMethod.load = function (launched) {
695
+ var href, setResize, prep = publicMethod.prep;
696
+
697
+ active = true;
698
+
699
+ photo = false;
700
+
701
+ element = $related[index];
702
+
703
+ if (!launched) {
704
+ makeSettings();
705
+ }
706
+
707
+ trigger(event_purge);
708
+
709
+ trigger(event_load, settings.onLoad);
710
+
711
+ settings.h = settings.height ?
712
+ setSize(settings.height, 'y') - loadedHeight - interfaceHeight :
713
+ settings.innerHeight && setSize(settings.innerHeight, 'y');
714
+
715
+ settings.w = settings.width ?
716
+ setSize(settings.width, 'x') - loadedWidth - interfaceWidth :
717
+ settings.innerWidth && setSize(settings.innerWidth, 'x');
718
+
719
+ // Sets the minimum dimensions for use in image scaling
720
+ settings.mw = settings.w;
721
+ settings.mh = settings.h;
722
+
723
+ // Re-evaluate the minimum width and height based on maxWidth and maxHeight values.
724
+ // If the width or height exceed the maxWidth or maxHeight, use the maximum values instead.
725
+ if (settings.maxWidth) {
726
+ settings.mw = setSize(settings.maxWidth, 'x') - loadedWidth - interfaceWidth;
727
+ settings.mw = settings.w && settings.w < settings.mw ? settings.w : settings.mw;
728
+ }
729
+ if (settings.maxHeight) {
730
+ settings.mh = setSize(settings.maxHeight, 'y') - loadedHeight - interfaceHeight;
731
+ settings.mh = settings.h && settings.h < settings.mh ? settings.h : settings.mh;
732
+ }
733
+
734
+ href = settings.href;
735
+
736
+ loadingTimer = setTimeout(function () {
737
+ $loadingOverlay.show();
738
+ }, 100);
739
+
740
+ if (settings.inline) {
741
+ // Inserts an empty placeholder where inline content is being pulled from.
742
+ // An event is bound to put inline content back when ColorBox closes or loads new content.
743
+ $tag(div).hide().insertBefore($(href)[0]).one(event_purge, function () {
744
+ $(this).replaceWith($loaded.children());
745
+ });
746
+ prep($(href));
747
+ } else if (settings.iframe) {
748
+ // IFrame element won't be added to the DOM until it is ready to be displayed,
749
+ // to avoid problems with DOM-ready JS that might be trying to run in that iframe.
750
+ prep(" ");
751
+ } else if (settings.html) {
752
+ prep(settings.html);
753
+ } else if (isImage(href)) {
754
+ $(photo = new Image())
755
+ .addClass(prefix + 'Photo')
756
+ .error(function () {
757
+ settings.title = false;
758
+ prep($tag(div, 'Error').text('This image could not be loaded'));
759
+ })
760
+ .load(function () {
761
+ var percent;
762
+ photo.onload = null; //stops animated gifs from firing the onload repeatedly.
763
+
764
+ if (settings.scalePhotos) {
765
+ setResize = function () {
766
+ photo.height -= photo.height * percent;
767
+ photo.width -= photo.width * percent;
768
+ };
769
+ if (settings.mw && photo.width > settings.mw) {
770
+ percent = (photo.width - settings.mw) / photo.width;
771
+ setResize();
772
+ }
773
+ if (settings.mh && photo.height > settings.mh) {
774
+ percent = (photo.height - settings.mh) / photo.height;
775
+ setResize();
776
+ }
777
+ }
778
+
779
+ if (settings.h) {
780
+ photo.style.marginTop = Math.max(settings.h - photo.height, 0) / 2 + 'px';
781
+ }
782
+
783
+ if ($related[1] && (index < $related.length - 1 || settings.loop)) {
784
+ photo.style.cursor = 'pointer';
785
+ photo.onclick = function () {
786
+ publicMethod.next();
787
+ };
788
+ }
789
+
790
+ if (isIE) {
791
+ photo.style.msInterpolationMode = 'bicubic';
792
+ }
793
+
794
+ setTimeout(function () { // A pause because Chrome will sometimes report a 0 by 0 size otherwise.
795
+ prep(photo);
796
+ }, 1);
797
+ });
798
+
799
+ setTimeout(function () { // A pause because Opera 10.6+ will sometimes not run the onload function otherwise.
800
+ photo.src = href;
801
+ }, 1);
802
+ } else if (href) {
803
+ $loadingBay.load(href, settings.data, function (data, status, xhr) {
804
+ prep(status === 'error' ? $tag(div, 'Error').text('Request unsuccessful: ' + xhr.statusText) : $(this).contents());
805
+ });
806
+ }
807
+ };
808
+
809
+ // Navigates to the next page/image in a set.
810
+ publicMethod.next = function () {
811
+ if (!active && $related[1] && (index < $related.length - 1 || settings.loop)) {
812
+ index = getIndex(1);
813
+ publicMethod.load();
814
+ }
815
+ };
816
+
817
+ publicMethod.prev = function () {
818
+ if (!active && $related[1] && (index || settings.loop)) {
819
+ index = getIndex(-1);
820
+ publicMethod.load();
821
+ }
822
+ };
823
+
824
+ // Note: to use this within an iframe use the following format: parent.$.fn.colorbox.close();
825
+ publicMethod.close = function () {
826
+ if (open && !closing) {
827
+
828
+ closing = true;
829
+
830
+ open = false;
831
+
832
+ trigger(event_cleanup, settings.onCleanup);
833
+
834
+ $window.unbind('.' + prefix + ' .' + event_ie6);
835
+
836
+ $overlay.fadeTo(200, 0);
837
+
838
+ $box.stop().fadeTo(300, 0, function () {
839
+
840
+ $box.add($overlay).css({'opacity': 1, cursor: 'auto'}).hide();
841
+
842
+ trigger(event_purge);
843
+
844
+ $loaded.remove();
845
+
846
+ setTimeout(function () {
847
+ closing = false;
848
+ trigger(event_closed, settings.onClosed);
849
+ }, 1);
850
+ });
851
+ }
852
+ };
853
+
854
+ // A method for fetching the current element ColorBox is referencing.
855
+ // returns a jQuery object.
856
+ publicMethod.element = function () {
857
+ return $(element);
858
+ };
859
+
860
+ publicMethod.settings = defaults;
861
+
862
+ // Bind the live event before DOM-ready for maximum performance in IE6 & 7.
863
+ $('.' + boxElement, document).live('click', function (e) {
864
+ // ignore non-left-mouse-clicks and clicks modified with ctrl / command, shift, or alt.
865
+ // See: http://jacklmoore.com/notes/click-events/
866
+ if (!(e.which > 1 || e.shiftKey || e.altKey || e.metaKey)) {
867
+ e.preventDefault();
868
+ launch(this);
869
+ }
870
+ });
871
+
872
+ // Setup ColorBox
873
+ publicMethod.init();
874
+
875
}(jQuery, document, this));