Last active
May 21, 2016 20:29
-
-
Save svendahlstrand/6dfbeb583863d3f898fc to your computer and use it in GitHub Desktop.
En "bookmarklet" för att hoppa mellan nya och klassiska redigeringsläget i SiteVision 4.
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 iFrameInOldEdit = document.getElementsByName("SiteVisionEditor"); | |
var newEditModeMatch = window.location.href.match(/\/(edit|template)\/([a-z0-9\.]+)$/i); | |
var oldEditModeMatch = iFrameInOldEdit[0] && iFrameInOldEdit[0].contentWindow.location.href.match(/[^\/]\/([a-z0-9\.]+)\.html/i); | |
if (newEditModeMatch) { | |
window.location.href = '/editor?objectId=' + newEditModeMatch[2]; | |
} else if (oldEditModeMatch) { | |
window.location.href = '/edit/' + iFrameInOldEdit[0].contentWindow.sv.PageContext.pageId; | |
} else { | |
alert('Du verkar inte vara i nya eller klassiska redigeringsläget i SiteVision.'); | |
} | |
}()); |
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()%7B(function()%20%7Bvar%20iFrameInOldEdit%20%3D%20document.getElementsByName(%22SiteVisionEditor%22)%3Bvar%20newEditModeMatch%20%3D%20window.location.href.match(%2F%5C%2F(edit%7Ctemplate)%5C%2F(%5Ba-z0-9%5C.%5D%2B)%24%2Fi)%3Bvar%20oldEditModeMatch%20%3D%20iFrameInOldEdit%5B0%5D%20%26%26%20iFrameInOldEdit%5B0%5D.contentWindow.location.href.match(%2F%5B%5E%5C%2F%5D%5C%2F(%5Ba-z0-9%5C.%5D%2B)%5C.html%2Fi)%3Bif%20(newEditModeMatch)%20%7Bwindow.location.href%20%3D%20'%2Feditor%3FobjectId%3D'%20%2B%20newEditModeMatch%5B2%5D%3B%7D%20else%20if%20(oldEditModeMatch)%20%7Bwindow.location.href%20%3D%20'%2Fedit%2F'%20%2B%20iFrameInOldEdit%5B0%5D.contentWindow.sv.PageContext.pageId%3B%7D%20else%20%7Balert('Du%20verkar%20inte%20vara%20i%20nya%20eller%20klassiska%20redigeringsl%C3%A4get%20i%20SiteVision.')%3B%7D%7D())%7D)() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hur du installerar i din webbläsare
Nu är det fritt fram att hoppa mellan nya och gamla läget i SiteVision 4.