Created
July 28, 2011 16:11
-
-
Save dennishall/1111837 to your computer and use it in GitHub Desktop.
Toggle the current page between author and publish mode (if the page is powered by adobe day cq)
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
javascript:(function(){var a=location,b=/wcmmode=disabled[&]?/,c=a.search,d=c.replace(b,""),e="wcmmode=disabled",f=a.href.replace("/cf#","").replace("?","?"+e);a.href=b.test(a.href)?location.protocol+"//"+location.host+"/cf#"+location.pathname+(d.length?"?"+d:d)+location.hash:b.test(f)?f:f+"?"+e})() |
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
(function(){ | |
var l = location, | |
re = /wcmmode=disabled[&]?/, | |
qs = l.search, | |
_qs = qs.replace(re, ''), | |
nowcm = 'wcmmode=disabled', | |
href = l.href.replace('/cf#', '').replace('?', '?' + nowcm); | |
// | |
l.href = re.test(l.href) | |
? location.protocol + '//' + location.host + '/cf#' + location.pathname + (_qs.length ? '?' + _qs : _qs) + location.hash | |
: (re.test(href) ? href : href+'?'+nowcm); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment