Changeset 1497599
- Timestamp:
- 09/18/2016 02:40:46 AM (10 years ago)
- Location:
- discreet-toolbar
- Files:
-
- 5 added
- 4 edited
-
tags/0.4 (added)
-
tags/0.4/discreet-toolbar.php (added)
-
tags/0.4/discreet.dev.js (added)
-
tags/0.4/discreet.js (added)
-
tags/0.4/readme.txt (added)
-
trunk/discreet-toolbar.php (modified) (1 diff)
-
trunk/discreet.dev.js (modified) (2 diffs)
-
trunk/discreet.js (modified) (1 diff)
-
trunk/readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
discreet-toolbar/trunk/discreet-toolbar.php
r572104 r1497599 3 3 Plugin Name: Discreet Toolbar 4 4 Plugin URI: http://trepmal.com/plugins/discreet-toolbar 5 Description: Hide Toolbar till cursor is near it. Front-end only.6 Version: 0. 35 Description: Hide Admin Bar till cursor is near it. Front-end only. 6 Version: 0.4 7 7 Author: Kailey Lampert 8 8 Author URI: http://kaileylampert.com/ 9 9 */ 10 10 11 new Discreet_Toolbar();11 $discreet_toolbar = new Discreet_Toolbar(); 12 12 13 13 class Discreet_Toolbar { 14 14 15 /** 16 * Hook in (part 1) 17 * 18 * @return void 19 */ 15 20 function __construct() { 16 add_action( ' wp_enqueue_scripts', array( &$this, 'scripts' ) );21 add_action( 'init', array( $this, 'init' ) ); 17 22 } 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 */ 19 43 function scripts() { 44 20 45 $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : ''; 21 wp_enqueue_script( 'jquery' );22 46 wp_enqueue_script( 'discreet', plugins_url( "discreet$suffix.js", __FILE__ ), array('jquery'), 1, true ); 23 47 } 24 48 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 25 73 } -
discreet-toolbar/trunk/discreet.dev.js
r519165 r1497599 3 3 var $tb = $('#wpadminbar'), 4 4 $tbh = $tb.height(); 5 5 6 6 $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 10 8 $tb.hover( function() { 11 9 $tb.addClass('hovering'); … … 13 11 $tb.removeClass('hovering'); 14 12 }); 15 13 16 14 $('body').mousemove( function( ev ) { 17 15 18 16 $tbp = parseInt($tb.css('top')); 19 20 // sanity check21 //$('h1').html( ev.clientY + ', ' + ev.clientX + ', ' + $tbp );22 17 23 18 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)){}})});1 jQuery(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 4 4 Tags: toolbar, admin bar 5 5 Requires at least: 2.3 6 Tested up to: 3.5-alpha7 Stable tag: 0. 36 Tested up to: 4.6 7 Stable tag: 0.4 8 8 9 Hide Toolbar till cursor is near it. Front-end only.9 Hide Admin Bar till cursor is near it. Front-end only. 10 10 11 11 == Description == 12 12 13 Hide Toolbar till cursor is near it. Front-end only. [screencast demo](http://screencast.com/t/wQFad1nNe) 14 15 **Beta!!** 13 Hide Admin Bar till cursor is near it. Front-end only. 16 14 17 15 Limited browser and theme testing*. Please report bugs before leaving a bad review. … … 31 29 == Screenshots == 32 30 33 1. Now you see it, now you don't 31 2. 34 32 35 33 == Upgrade Notice == … … 43 41 == Changelog == 44 42 43 = 0.4 = 44 * Maintenance 45 * Verified for 4.6 46 45 47 = 0.3 = 46 48 * Code improvements
Note: See TracChangeset
for help on using the changeset viewer.