Combined multiple <script> tags output into one for readability, and added comments.
This commit is contained in:
1 parent
ed4fed7b48
commit
bbb47aa894
1 file changed
+18
-17
+18
-17
@@ -173,11 +173,13 @@ class auto_thickbox {
|
||||
}
|
||||
|
||||
function custom_scripts() {
|
||||
if ( $this->options['auto_thickbox'] == 'js') {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
jQuery(function($) {
|
||||
<?php
|
||||
if ( $this->options['auto_thickbox'] == 'js') {
|
||||
?>
|
||||
var links = $('a[href][href!=""]').filter(function() {
|
||||
// No ThickBox
|
||||
var nothickbox = ['<?php echo str_replace(' ', '\', \'', trim($this->options['no_thickbox'])); ?>'];
|
||||
@@ -225,41 +227,35 @@ jQuery(function($) {
|
||||
// for WordPress 2.7.x (jQuery 1.2.6)
|
||||
if (!$.isFunction($().live))
|
||||
tb_init('a.thickbox');
|
||||
});
|
||||
/* ]]> */
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
if ( $this->options['wp_gallery'] == 'on') {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
jQuery(function($) {
|
||||
|
||||
// Set a different gallery-id for each WordPress Gallery
|
||||
$('div.gallery').each(function() {
|
||||
var id = $(this).attr('class').match(/galleryid-\d+/);
|
||||
$(this).find('a.thickbox').attr('rel', id);
|
||||
});
|
||||
});
|
||||
/* ]]> */
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
});
|
||||
|
||||
if ( $this->options['builtin_res'] == 'on') {
|
||||
<?php
|
||||
if ($this->options['builtin_res'] == 'on') {
|
||||
if ( version_compare('3.2', get_bloginfo('version')) > 0 ) {
|
||||
$includes_url = includes_url();
|
||||
echo <<<SCRIPT
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
// for ThickBox in WordPress 2.9 to 3.1.4
|
||||
var tb_pathToImage = "{$includes_url}js/thickbox/loadingAnimation.gif";
|
||||
var tb_closeImage = "{$includes_url}js/thickbox/tb-close.png";
|
||||
//]]>
|
||||
</script>
|
||||
|
||||
SCRIPT;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if ( $this->options['builtin_res'] == 'off') {
|
||||
$script = '';
|
||||
|
||||
if ( !$this->is_default_options('auto_resize') )
|
||||
@@ -334,7 +330,12 @@ SCRIPT;
|
||||
$script .= "tb_options.ref_cap = [{$this->options['ref_cap']}];\n";
|
||||
|
||||
if ($script)
|
||||
echo "<script type='text/javascript'>\n/* <![CDATA[ */\njQuery(function() {\n$script});\n/* ]]> */\n</script>\n";
|
||||
echo "// Options for ThickBox Plus\n{$script}";
|
||||
}
|
||||
?>
|
||||
/* ]]> */
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
function custom_styles() {
|
||||
|
||||
Reference in new issue
Block a user