WordPress.org

Plugin Directory

Changeset 580817


Ignore:
Timestamp:
08/02/12 14:32:07 (21 months ago)
Author:
andy
Message:

Jetpack/Retina: add sparkline scale and 2x version

File:
1 edited

Legend:

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

    r580267 r580817  
    6565        is_admin() && 
    6666        isset( $_GET['page'] ) && $_GET['page'] == 'stats' && 
    67         isset( $_GET['chart'] ) && $_GET['chart'] == 'admin-bar-hours' 
     67        isset( $_GET['chart'] ) && strpos($_GET['chart'], 'admin-bar-hours') === 0 
    6868    ) { 
    6969        global $wp_db_version; 
     
    557557 
    558558<style type='text/css'> 
    559 #wpadminbar .quicklinks li#wp-admin-bar-stats {height:28px} 
    560 #wpadminbar .quicklinks li#wp-admin-bar-stats a {height:28px;padding:0} 
    561 #wpadminbar .quicklinks li#wp-admin-bar-stats a img {padding:4px 11px} 
     559#wpadminbar .quicklinks li#wp-admin-bar-stats { 
     560    height: 28px; 
     561} 
     562#wpadminbar .quicklinks li#wp-admin-bar-stats a { 
     563    height: 28px; 
     564    padding: 0; 
     565} 
     566#wpadminbar .quicklinks li#wp-admin-bar-stats a div { 
     567    height: 28px; 
     568    width: 95px; 
     569    overflow: hidden; 
     570    margin: 0 10px; 
     571} 
     572#wpadminbar .quicklinks li#wp-admin-bar-stats a:hover div { 
     573    width: auto; 
     574    margin: 0 8px 0 10px; 
     575} 
     576#wpadminbar .quicklinks li#wp-admin-bar-stats a img { 
     577    height: 24px; 
     578    padding: 2px 0; 
     579    max-width: none; 
     580    border: none; 
     581} 
    562582</style> 
    563583<?php 
     
    569589    $url = add_query_arg( 'page', 'stats', admin_url( 'admin.php' ) ); // no menu_page_url() blog-side. 
    570590 
    571     $img_src = add_query_arg( array( 'noheader'=>'', 'proxy'=>'', 'chart'=>'admin-bar-hours', 'height'=>20, 'hours'=>48 ), $url ); 
     591    $img_src = esc_attr( add_query_arg( array( 'noheader'=>'', 'proxy'=>'', 'chart'=>'admin-bar-hours-scale' ), $url ) ); 
     592    $img_src_2x = esc_attr( add_query_arg( array( 'noheader'=>'', 'proxy'=>'', 'chart'=>'admin-bar-hours-scale-2x' ), $url ) ); 
    572593 
    573594    $title = __( 'Views over 48 hours. Click for more Site Stats.', 'jetpack' ); 
    574595 
    575     $menu = array( 'id' => 'stats', 'title' => "<img style='width:95px;height:20px' src='$img_src' alt='$title' title='$title' />", 'href' => $url ); 
     596    $menu = array( 'id' => 'stats', 'title' => "<div><script type='text/javascript'>var src;if(typeof(window.devicePixelRatio)=='undefined'||window.devicePixelRatio<2){src='$img_src';}else{src='$img_src_2x';}document.write('<img src=\''+src+'\' alt=\'$alt\' title=\'$title\' />');</script></div>", 'href' => $url ); 
    576597 
    577598    $wp_admin_bar->add_menu( $menu ); 
Note: See TracChangeset for help on using the changeset viewer.