-
-
Save rcherny/5454c304c22a301f5629fef1078a472c to your computer and use it in GitHub Desktop.
AEM bookmark for quick edit/preview switch
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
// Drops you in preview mode | |
javascript:(function() { | |
var d = document, l = d.location, s = l.search; | |
d.cookie = 'wcmmode=preview; path=/'; | |
if (l.href.includes('editor.html') || !l.href.includes('wcmmode=disabled')) { | |
s = s.replace(/[\?&]?wcmmode=\w*/g, ''); | |
l.href = l.origin + l.pathname.replace(/\/editor\.html/g, '') + s + (s ? '&' : '?') + 'wcmmode=disabled'; | |
} else { | |
d.location.reload(); | |
} | |
})(); | |
// Drops you in edit mode | |
javascript:(function() { | |
var d = document, l = d.location, href = l.href; | |
d.cookie = 'wcmmode=edit; path=/'; | |
d.cookie = 'cq-editor-layer.page=edit; path=/'; | |
d.cookie = 'cq-editor-sidepanel=open; path=/'; | |
if (!href.includes('editor.html') || href.includes('wcmmode=disabled')) { | |
href = href.replace(l.origin, l.origin + '/editor.html'); | |
href = href.replace(/[\?&]?wcmmode=\w*/g, ''); | |
l.href = href; | |
} else { | |
l.reload(); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment