| 1 |
<?php |
| 2 |
/** |
| 3 |
* Loads the devicepx library which improves the resolution of gravatars and |
| 4 |
* wordpress.com uploads on hi-res and zoomed browsers. |
| 5 |
* |
| 6 |
* This feature will only be activated for themes that declare their support. |
| 7 |
* This can be done by adding code similar to the following during the |
| 8 |
* 'after_setup_theme' action: |
| 9 |
* |
| 10 |
* add_theme_support( 'jetpack-devicepx' ); |
| 11 |
*/ |
| 12 |
|
| 13 |
/** |
| 14 |
* Enqueue the devicepx JS library, if enabled. The feature must |
| 15 |
* be enabled earlier during `after_setup_theme`. |
| 16 |
* |
| 17 |
* @uses current_theme_supports, add_action |
| 18 |
*/ |
| 19 |
function jetpack_devicepx_init() { |
| 20 |
if ( current_theme_supports( 'jetpack-devicepx' ) ) { |
| 21 |
add_action( 'wp_enqueue_scripts', 'jetpack_devicepx_enqueue' ); |
| 22 |
add_action( 'customize_controls_enqueue_scripts', 'jetpack_devicepx_enqueue' ); |
| 23 |
add_action( 'admin_enqueue_scripts', 'jetpack_devicepx_enqueue' ); |
| 24 |
} |
| 25 |
} |
| 26 |
|
| 27 |
// Use a late priority to ensure that plugins and themes can enable or disable this feature. |
| 28 |
add_action( 'init', 'jetpack_devicepx_init', 99 ); |
| 29 |
|
| 30 |
/** |
| 31 |
* Enqueue the devicepx JS library. |
| 32 |
* |
| 33 |
* @uses wp_enqueue_script |
| 34 |
*/ |
| 35 |
function jetpack_devicepx_enqueue() { |
| 36 |
wp_enqueue_script( 'devicepx', 'https://s0.wp.com/wp-content/js/devicepx-jetpack.js', array(), gmdate( 'oW' ), true ); |
| 37 |
} |
| 38 |
|