Skip to content

Instantly share code, notes, and snippets.

@fiskr
Last active August 29, 2015 14:17
Show Gist options
  • Save fiskr/7a34cf4f9caf299aa262 to your computer and use it in GitHub Desktop.
Save fiskr/7a34cf4f9caf299aa262 to your computer and use it in GitHub Desktop.
clean up the preview of CQ page on author and toggle wcmmode=disabled
// get current string location
var loc = document.URL;
// strip cf#/ from it to get rid of that annoying left rail image bar
loc = loc.replace('cf#/', '');
// if wcmmode=disabled is already set
if( loc.match(/[?|&]wcmmode=disabled/)){
// new location is the URL without wcmmode=disabled
loc = loc.replace(/[?|&]wcmmode=disabled/, '');
} else {
// otherwise, add wcmmode=disabled
//(either as ?wcmmode=disabled or &wcmmode=disabled if there is already a first GET variably)
loc += loc.match(/[?]/) ? '&wcmmode=disabled' : '?wcmmode=disabled';
}
// change to the new URL
window.location = loc;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment