Blender-org web-assets v2 upgrade #104116
@ -102,24 +102,26 @@ $style = get_field('style');
|
|||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?
|
<?php
|
||||||
if (!function_exists('js_footer')) {
|
if (!function_exists('js_footer')) {
|
||||||
wp_enqueue_script('hammer', get_template_directory_uri() . '/assets/js/hammer-2.0.8.min.js');
|
function js_footer() {
|
||||||
|
|
||||||
// The images-compare script was modified to work with jQuery 3 (basically replacing .load and .error with .on('load', ...))
|
// The images-compare script was modified to work with jQuery 3 (basically replacing .load and .error with .on('load', ...))
|
||||||
|
wp_enqueue_script('hammer', get_template_directory_uri() . '/assets/js/hammer-2.0.8.min.js');
|
||||||
wp_enqueue_script('media-compare', get_template_directory_uri() . '/assets/js/jquery.images-compare-0.2.5.js');
|
wp_enqueue_script('media-compare', get_template_directory_uri() . '/assets/js/jquery.images-compare-0.2.5.js');
|
||||||
}
|
|
||||||
|
|
||||||
function js_footer();
|
// Execute JavaScript inline after 'media-compare'
|
||||||
?>
|
$inline_script = <<<EOD
|
||||||
<script type='text/javascript'>
|
(function($) {
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('.images-compare').imagesCompare();
|
$('.images-compare').imagesCompare();
|
||||||
});
|
});
|
||||||
</script>
|
})(jQuery);
|
||||||
|
EOD;
|
||||||
|
|
||||||
|
wp_add_inline_script('media-compare', $inline_script);
|
||||||
|
}
|
||||||
|
|
||||||
<?php
|
|
||||||
add_action('wp_footer', 'js_footer');
|
add_action('wp_footer', 'js_footer');
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
endif;
|
||||||
<?php endif; ?>
|
|
@ -477,21 +477,24 @@ $is_latest = (($version_number >= $current_version_number) ? true : false);
|
|||||||
<?php endwhile; // end of the loop. ?>
|
<?php endwhile; // end of the loop. ?>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
// TODO: cleanup function definition and call 'js_footer' if is not needed
|
||||||
|
|||||||
|
function js_footer() {
|
||||||
|
// The images-compare script was modified to work with jQuery 3 (basically replacing .load and .error with .on('load', ...))
|
||||||
wp_enqueue_script('hammer', get_template_directory_uri() . '/assets/js/hammer-2.0.8.min.js');
|
wp_enqueue_script('hammer', get_template_directory_uri() . '/assets/js/hammer-2.0.8.min.js');
|
||||||
|
|
||||||
// The media-compare script was modified to work with jQuery 3 (basically replacing .load and .error with .on('load', ...))
|
|
||||||
wp_enqueue_script('media-compare', get_template_directory_uri() . '/assets/js/jquery.images-compare-0.2.5.js');
|
wp_enqueue_script('media-compare', get_template_directory_uri() . '/assets/js/jquery.images-compare-0.2.5.js');
|
||||||
|
|
||||||
function js_footer(){
|
// Execute JavaScript inline after 'media-compare'
|
||||||
?>
|
$inline_script = <<<EOD
|
||||||
<script type='text/javascript'>
|
(function($) {
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('.images-compare').imagesCompare();
|
$('.images-compare').imagesCompare();
|
||||||
});
|
});
|
||||||
</script>
|
})(jQuery);
|
||||||
|
EOD;
|
||||||
|
|
||||||
|
wp_add_inline_script('media-compare', $inline_script);
|
||||||
|
}
|
||||||
|
|
||||||
<?php }
|
|
||||||
add_action('wp_footer', 'js_footer');
|
add_action('wp_footer', 'js_footer');
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user
I don't see how this relates to v2? I don't think we change any JavaScript other than renaming some classes.
There were some PHP fatal errors happening on the local dev server, likely because of the less permissive PHP error handling, and minor PHP config differences on localhost. (It's just a coincidence that it relates to JavaScript, as the rendered markup broke while calling / working with JS functions.) These changes are related to resolving these issues, which likely exist in production without causing problems. Added todos are for possible JS refactors I noticed while working on the latter.
See #79b158d