Skip to content

Instantly share code, notes, and snippets.

@luiseduardobraschi
Last active December 9, 2017 20:14
Show Gist options
  • Save luiseduardobraschi/73b9f65eb4f8728858f7e0e43f876de3 to your computer and use it in GitHub Desktop.
Save luiseduardobraschi/73b9f65eb4f8728858f7e0e43f876de3 to your computer and use it in GitHub Desktop.
A bookmarklet to quickly toggle admin bar in WordPress .
javascript: (function() {
var htmlStyle = document.documentElement.style;
var adminBarStyle = document.getElementById('wpadminbar').style;
if(undefined == window.hasAdminBar){
window.hasAdminBar = true;
}
var cssText, display;
if(window.hasAdminBar) {
cssText = 'margin-top:0px !important';
display = 'none';
} else {
cssText = 'margin-top:32px !important';
display = 'block';
}
htmlStyle.cssText = cssText;
adminBarStyle.display = display;
window.hasAdminBar = !window.hasAdminBar;
})();
javascript:(function(){var htmlStyle=document.documentElement.style,adminBarStyle=document.getElementById("wpadminbar").style;void 0==window.hasAdminBar&&(window.hasAdminBar=!0);var cssText,display;window.hasAdminBar?(cssText="margin-top:0px !important",display="none"):(cssText="margin-top:32px !important",display="block"),htmlStyle.cssText=cssText,adminBarStyle.display=display,window.hasAdminBar=!window.hasAdminBar})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment