From 57e6a0cbcd881dd2e3922a406fc147c6f666a951 Mon Sep 17 00:00:00 2001 From: Christoph Date: Wed, 14 Dec 2016 23:43:23 +0100 Subject: [PATCH] version 1.1.2, fixed bug, changed keyboard shortcuts --- README.md | 20 ++++++++++++++++++-- apermo-adminbar.php | 13 ++++++++++++- js/keycodes.js | 26 ++++++++++++++++++-------- 3 files changed, 48 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 20d8bde..328a0d2 100755 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ * Tags: admin bar, adminbar, admin, developer, development, staging, robots, keyboard, shortcut * Requires at least: 4.0 * Tested up to: 4.7.0 -* Stable tag: 1.1.1 +* Stable tag: 1.1.2 * License: GNU General Public License v2 or later * License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -22,6 +22,14 @@ If you want to participate in the development [head over to GitHub](https://gith 2. Activate the 'Apermo AdminBar' plugin through the 'Plugins' menu in WordPress 3. Open Settings -> Apermo AdminBar to set up the links and colors (currently you have to repeat this on all sites) +== Screenshots == + +1. The basic idea of the plugin, 3 instances of a website, with 3 distinct color schemes and quicklinks between the instances. +2. The Adminbar on the frontend, showing the info panel on the right and the watermark for a draft post. The info panel can be hidden with a click. And there are keyboard shortcuts to hide the whole adminbar and the watermark to see what the site looks like for a regular user. +3. The settings page, with the options for the first of the 3 default stages. +4. The import and export function on the settings page. +5. The settings page when the settings are set using the filter `add_filter( 'apermo-adminbar-sites', 'sites_filter' );` + ## Frequently Asked Questions ## ### I have more than 3 sites, can I add more? ### @@ -67,8 +75,16 @@ Head over to the [GitHub Repository](https://github.com/apermo/apermo-adminbar) ## Changelog ## + + +### 1.1.2 ### +* changed: Keyboard shortcuts had to be changed as they colided with windows standards +* Hide Watermark: Mac: CMD + CTRL + W - Win/Linux: ALT + SHIFT + W +* Hide Adminbar: Mac: CMD + CTRL + A - Win/Linux: ALT + SHIFT + A +* fixed: backend color scheme was overwritten if being set by a user prior to plugin activation + ### 1.1.1 ### -* fixed: keyboard shortcut for watermark is now CTRL + +* fixed: keyboard shortcut for watermark is now CTRL + D * changed: made status icons bigger & clearer, changed color for scheduled status ### 1.1.0 ### diff --git a/apermo-adminbar.php b/apermo-adminbar.php index 4901456..2159016 100755 --- a/apermo-adminbar.php +++ b/apermo-adminbar.php @@ -7,7 +7,7 @@ * @wordpress-plugin * Plugin Name: Apermo AdminBar * Plugin URI: https://wordpress.org/plugins/apermo-adminbar/ - * Version: 1.1.1 + * Version: 1.1.2 * Description: A simple plugin that enhances the AdminBar with navigation links between your different stages, a statusbox about the current post and keyboard shortcuts to hide or show the adminbar * Author: Christoph Daum * Author URI: http://apermo.de/ @@ -122,6 +122,8 @@ public function __construct() { //has to be loaded as early as possible to ensure that the css does not overwrite theme css. add_action( 'admin_bar_init', array( $this, 'color_scheme' ), 1 ); + add_filter( 'get_user_option_admin_color', array( $this, 'filter_admin_color' ) ); + add_action( 'admin_enqueue_scripts', array( $this, 'options_reading' ) ); add_filter( 'pre_option_blog_public', array( $this, 'blog_public' ), 99, 2 ); @@ -313,6 +315,15 @@ public function color_scheme() { } } + /** + * Filters the User defined admin_color and sets it to default. + * + * @return string + */ + public function filter_admin_color() { + return 'fresh'; + } + public function js_keycodes() { wp_enqueue_script( 'apermo-adminbar-js-keycodes', plugins_url( 'js/keycodes.js', __FILE__ ), array( 'jquery' ) ); } diff --git a/js/keycodes.js b/js/keycodes.js index 7f0307d..d21d4d8 100644 --- a/js/keycodes.js +++ b/js/keycodes.js @@ -16,15 +16,25 @@ jQuery(document).ready(function ($) { $(document).on('keydown', function ( e ) { - if ( e.ctrlKey ) { - switch ( e.which ) { - case 69: //e - adminbar_toggle(); - break; - case 68: //d - watermark_toggle(); - break; + if ( navigator.platform == 'MacIntel' || navigator.platform == 'iPhone' || navigator.platform == 'iPad' ) { + // Mac/iPhone + if ( ! ( e.metaKey && e.ctrlKey ) ) { + return; } + } else { + // Anything else + if ( ! ( e.altKey && e.shiftKey ) ) { + return; + } + } + + switch ( e.which ) { + case 65: //a + adminbar_toggle(); + break; + case 87: //w + watermark_toggle(); + break; } }); }); \ No newline at end of file