Skip to content

Instantly share code, notes, and snippets.

@asabaylus
Last active December 9, 2015 21:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save asabaylus/4334372 to your computer and use it in GitHub Desktop.
Save asabaylus/4334372 to your computer and use it in GitHub Desktop.
CQ5 Preview Bookmarklet, remove the content frame and runs a page in the author instance with wcmmode=disabled; copy and paster into a bookmark
// paste the following into a new bookmark called CQ5 Preview
javascript:(function(){
function updateQueryStringParameter(uri, key, value) {
var re = new RegExp("([?|&])" + key + "=.*?(&|$)", "i");
separator = uri.indexOf('?') !== -1 ? "&" : "?";
if (uri.match(re)) {
return uri.replace(re, '$1' + key + "=" + value + '$2');
}
else {
return uri + separator + key + "=" + value;
}
}
var url = updateQueryStringParameter(document.location.href, "wcmmode", "disabled");
document.location.href = url.replace(/cf#\//, "");
})();
@asabaylus
Copy link
Author

beware hash tags

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment