WordPress.org

Plugin Directory

Changeset 635143


Ignore:
Timestamp:
12/06/12 23:07:56 (17 months ago)
Author:
ethitter
Message:

Jetpack Photon update for retina support

Restore image dimensions after images load so that devicepx-jetpack.js can attempt to retinize if appropriate.

Location:
jetpack/trunk/modules
Files:
2 added
1 edited

Legend:

Unmodified
Added
Removed
  • jetpack/trunk/modules/photon.php

    r632100 r635143  
    6666        // og:image URL 
    6767        add_filter( 'jetpack_open_graph_tags', array( $this, 'filter_open_graph_tags' ), 10, 2 ); 
     68 
     69        // Helpers for maniuplated images 
     70        add_action( 'wp_enqueue_scripts', array( $this, 'action_wp_enqueue_scripts' ), 9 ); 
    6871    } 
    6972 
     
    261264                        $new_tag = str_replace( $images[2][ $index ], jetpack_photon_url( $images[2][ $index ] ), $new_tag ); 
    262265 
     266                    // Tag an image for dimension checking 
     267                    $new_tag = preg_replace( '#/?>(</a>)?$#i', 'data-recalc-dims="1" />', $new_tag ); 
     268 
     269                    // Replace original tag with modified version 
    263270                    $content = str_replace( $tag, $new_tag, $content ); 
    264271                } 
     
    464471        return $tags; 
    465472    } 
     473 
     474    /** 
     475     * Enqueue Photon helper script 
     476     * 
     477     * @uses wp_enqueue_script, plugins_url 
     478     * @action wp_enqueue_script 
     479     * @return null 
     480     */ 
     481    public function action_wp_enqueue_scripts() { 
     482        wp_enqueue_script( 'jetpack-photon', plugins_url( 'photon/photon.js', __FILE__ ), array( 'jquery' ), 20121206, true ); 
     483    } 
    466484} 
    467485 
Note: See TracChangeset for help on using the changeset viewer.