Last active
September 29, 2015 07:38
-
-
Save greystate/1567959 to your computer and use it in GitHub Desktop.
XMLDump toggle Bookmarklet
This file contains hidden or 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
// What it does: | |
(function() { | |
var loc = document.location; | |
var hasXMLDump = /xmldump(\.aspx)?(\/?\?([^=&?]+=[^=&?]+&?)*)?$/i; | |
var hasntXMLDump = /(\/|(\.aspx))?$/i; | |
if (hasXMLDump.test(loc.pathname)) { | |
document.location = loc.pathname.replace(hasXMLDump, '$1'); | |
} else { | |
document.location = loc.pathname.replace(hasntXMLDump, '/xmldump$2'); | |
} | |
})() | |
// Minified for Copying to Bookmark URL: | |
javascript:(function()%20{var%20loc%20=%20document.location;var%20hasXMLDump%20=%20/xmldump(\.aspx)?(\/?\?([^=&?]+=[^=&?]+&?)*)?$/i;var%20hasntXMLDump%20=%20/(\/|(\.aspx))?$/i;if%20(hasXMLDump.test(loc.pathname))%20{document.location%20=%20loc.pathname.replace(hasXMLDump,%20%27$1%27);}%20else%20{document.location%20=%20loc.pathname.replace(hasntXMLDump,%20%27/xmldump$2%27);}})() |
Updated hasXMLDump regex to account for QueryString params - now you can toggle XMLDump on, add a few options (xpath, media, id etc.) and then just toggle off again.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've used an uglier version of this until now, but Ole Andreas triggered my "create a nice version of this that works with or without the .aspx" reflex, when he posted a thread on our.umbraco.org: http://our.umbraco.org/projects/developer-tools/xml-dump/xmldump-feedback/27309-XMLDump-bookmarklet