Created
February 6, 2015 13:52
-
-
Save joemaffia/a7a0095cf2380c48d3b0 to your computer and use it in GitHub Desktop.
Bookmarklet to switch between Touch & Classic edit mode in AEM
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 TOUCH = '/editor.html'; | |
var CLASSIC = '/cf'; | |
var createURL = function(path, qs, hash) { | |
var url = path; | |
if(qs.length != 0 && !(qs.length == 1 && qs[0] == '')) { | |
url += '?' + qs.join('&'); | |
} | |
url += hash; | |
return url; | |
}; | |
var hash = ''; | |
var parameters = []; | |
if (window.location.search.substring(1) != '') { | |
parameters = window.location.search.substring(1).split('&'); | |
} | |
var path = ''; | |
if (window.location.pathname.indexOf(TOUCH) != -1) { | |
path = window.location.pathname.replace(TOUCH,CLASSIC+'#'); | |
if(window.location.search.substring(1) != '') { | |
parameters = window.location.search.substring(1).split('&'); | |
} | |
hash = window.location.hash; | |
} | |
if (window.location.pathname.indexOf(CLASSIC) != -1) { | |
path = TOUCH + window.frames[1].location.pathname; | |
if(window.frames[1].location.search.substring(1) != '') { | |
parameters = window.frames[1].location.search.substring(1).split('&'); | |
} | |
hash = window.frames[1].location.hash; | |
} | |
var url = createURL(path, parameters, hash); | |
window.location = url; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment