Created
September 12, 2011 00:06
-
-
Save son0fhobs/1210334 to your computer and use it in GitHub Desktop.
Wordpress Hotkey. Publish Post with firegesture or Bookmarklet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Author: | |
* David Hobson | |
* http://www.virtualidstudios.com | |
* | |
* Goal: In Wordpress Publish Post with Hotkey or Gesture | |
* Details: | |
* Setup for Firegestures, or script for Bookmarklet. | |
* Use appropriate hotkey method per browser to activate bookmarklet | |
* | |
*/ | |
// Firegestures Simple | |
gBrowser.loadURI("javascript:(function(){document.getElementById('publish').click();})();"); | |
// Bookmarklet Simple | |
javascript:(function(){document.getElementById('publish').click();})(); | |
// Firegestures only activate if in wordpress | |
if(window.content.location.href.indexOf('wp-admin')>=0){ | |
gBrowser.loadURI("javascript:(function(){document.getElementById('publish').click();})();"); | |
} | |
// Bookmarklet only activate if in wordpress | |
javascript:(function(){if(window.location.href.indexOf('wp-admin')!=-1){document.getElementById('publish').click();}})(); | |
// Debugging Purposes. If not in wordpress, send alert | |
// If else Firegestures check url | |
const URL = window.content.location.href; | |
if(URL.indexOf('wp-admin')>=0){ | |
gBrowser.loadURI("javascript:(function(){document.getElementById('publish').click();})();"); | |
}else{ | |
alert('not in wordpress'); | |
} | |
// Debugging Purposes. If not in wordpress, send alert | |
// If else Bookmarklet check url | |
javascript:(function(){if(window.location.href.indexOf('wp-admin')!=-1){document.getElementById('publish').click();}else{alert('not in wordpress')};})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment