Skip to content

Instantly share code, notes, and snippets.

@son0fhobs
Created September 12, 2011 00:06
Show Gist options
  • Save son0fhobs/1210334 to your computer and use it in GitHub Desktop.
Save son0fhobs/1210334 to your computer and use it in GitHub Desktop.
Wordpress Hotkey. Publish Post with firegesture or Bookmarklet
/*
* 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