Plugin Directory

Changeset 1497599


Ignore:
Timestamp:
09/18/2016 02:40:46 AM (10 years ago)
Author:
trepmal
Message:

tag 0.4. maintenance release

Location:
discreet-toolbar
Files:
5 added
4 edited

Legend:

Unmodified
Added
Removed
  • discreet-toolbar/trunk/discreet-toolbar.php

    r572104 r1497599  
    33Plugin Name: Discreet Toolbar
    44Plugin URI: http://trepmal.com/plugins/discreet-toolbar
    5 Description: Hide Toolbar till cursor is near it. Front-end only.
    6 Version: 0.3
     5Description: Hide Admin Bar till cursor is near it. Front-end only.
     6Version: 0.4
    77Author: Kailey Lampert
    88Author URI: http://kaileylampert.com/
    99*/
    1010
    11 new Discreet_Toolbar();
     11$discreet_toolbar = new Discreet_Toolbar();
    1212
    1313class Discreet_Toolbar {
    1414
     15    /**
     16     * Hook in (part 1)
     17     *
     18     * @return void
     19     */
    1520    function __construct() {
    16         add_action( 'wp_enqueue_scripts', array( &$this, 'scripts' ) );
     21        add_action( 'init',               array( $this, 'init' ) );
    1722    }
    18    
     23
     24    /**
     25     * Hook in (part 2), when Admin Bar is showing
     26     *
     27     * @return void
     28     */
     29    function init() {
     30        if ( ! is_admin_bar_showing() ) {
     31            return;
     32        }
     33        add_action( 'wp_enqueue_scripts', array( $this, 'scripts' ) );
     34        add_action( 'admin_bar_init',     array( $this, 'admin_bar_init' ) );
     35        add_filter( 'body_class',         array( $this, 'body_class' ), 10, 2 );
     36    }
     37
     38    /**
     39     * Enqueue scripts
     40     *
     41     * @return void
     42     */
    1943    function scripts() {
     44
    2045        $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : '';
    21         wp_enqueue_script( 'jquery' );
    2246        wp_enqueue_script( 'discreet', plugins_url( "discreet$suffix.js", __FILE__ ), array('jquery'), 1, true );
    2347    }
    2448
     49    /**
     50     * Unhook admin bar bumper styles
     51     *
     52     * @return void
     53     */
     54    function admin_bar_init() {
     55        remove_action('wp_head',          '_admin_bar_bump_cb' );
     56    }
     57
     58    /**
     59     * Remove admin-bar class
     60     *
     61     * @param array $classes An array of body classes.
     62     * @param array $class   An array of additional classes added to the body.
     63     * @return array
     64     */
     65    function body_class( $classes, $class ) {
     66        $pos = array_search( 'admin-bar', $classes );
     67        if ( false !== $pos ) {
     68            unset( $classes[ $pos ] );
     69        }
     70        return $classes;
     71    }
     72
    2573}
  • discreet-toolbar/trunk/discreet.dev.js

    r519165 r1497599  
    33    var $tb = $('#wpadminbar'),
    44        $tbh = $tb.height();
    5        
     5
    66    $tb.css( 'top', ($tbh*-1) );
    7     $('html').attr( 'style', 'margin-top: 0px !important' );
    8     $('body').attr( 'style', 'margin-top: -1px !important; padding-top: 1px !important;' );
    9    
     7
    108    $tb.hover( function() {
    119        $tb.addClass('hovering');
     
    1311        $tb.removeClass('hovering');
    1412    });
    15    
     13
    1614    $('body').mousemove( function( ev ) {
    17            
     15
    1816        $tbp = parseInt($tb.css('top'));
    19        
    20         // sanity check
    21         //$('h1').html( ev.clientY + ', ' + ev.clientX + ', ' + $tbp );
    2217
    2318        if ( ev.clientY <= $tbh && $tbp < 0 && !$tb.hasClass('sliding') ) {
  • discreet-toolbar/trunk/discreet.js

    r519165 r1497599  
    1 jQuery(document).ready(function($){var $tb=$('#wpadminbar'),$tbh=$tb.height();$tb.css('top',($tbh*-1));$('html').attr('style','margin-top: 0px !important');$('body').attr('style','margin-top: -1px !important; padding-top: 1px !important;');$tb.hover(function(){$tb.addClass('hovering')},function(){$tb.removeClass('hovering')});$('body').mousemove(function(ev){$tbp=parseInt($tb.css('top'));if(ev.clientY<=$tbh&&$tbp<0&&!$tb.hasClass('sliding')){$tb.addClass('sliding').animate({'top':0},100,function(){$tb.removeClass('sliding')})}else if(ev.clientY>$tbh&&$tbp==0&&!$tb.hasClass('hovering')){$tb.stop().animate({'top':($tbh*-1)},50,function(){$tb.removeClass('sliding')})}else if((ev.clientY<=$tbh&&$tbp==0)||(ev.clientY>$tbh&&$tbp<0)){}})});
     1jQuery(document).ready(function(a){var b=a("#wpadminbar"),c=b.height();b.css("top",c*-1),b.hover(function(){b.addClass("hovering")},function(){b.removeClass("hovering")}),a("body").mousemove(function(a){$tbp=parseInt(b.css("top")),a.clientY<=c&&$tbp<0&&!b.hasClass("sliding")?b.addClass("sliding").animate({top:0},100,function(){b.removeClass("sliding")}):a.clientY>c&&0==$tbp&&!b.hasClass("hovering")?b.stop().animate({top:c*-1},50,function(){b.removeClass("sliding")}):a.clientY<=c&&0==$tbp||a.clientY>c&&$tbp<0})});
  • discreet-toolbar/trunk/readme.txt

    r572104 r1497599  
    44Tags: toolbar, admin bar
    55Requires at least: 2.3
    6 Tested up to: 3.5-alpha
    7 Stable tag: 0.3
     6Tested up to: 4.6
     7Stable tag: 0.4
    88
    9 Hide Toolbar till cursor is near it. Front-end only.
     9Hide Admin Bar till cursor is near it. Front-end only.
    1010
    1111== Description ==
    1212
    13 Hide Toolbar till cursor is near it. Front-end only. [screencast demo](http://screencast.com/t/wQFad1nNe)
    14 
    15 **Beta!!**
     13Hide Admin Bar till cursor is near it. Front-end only.
    1614
    1715Limited browser and theme testing*. Please report bugs before leaving a bad review.
     
    3129== Screenshots ==
    3230
    33 1. Now you see it, now you don't
     312.
    3432
    3533== Upgrade Notice ==
     
    4341== Changelog ==
    4442
     43= 0.4 =
     44* Maintenance
     45* Verified for 4.6
     46
    4547= 0.3 =
    4648* Code improvements
Note: See TracChangeset for help on using the changeset viewer.