Last active
August 29, 2015 14:17
-
-
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
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
// 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