![]() |
|
Snippets |
|
The following bookmarklet toggles between the dev and prod environments. It simply does that by adding or removing the '_dev' suffix before the first ".php" of the URL.
javascript:var parts=location.pathname.match(/(.*?)(_dev)?(\.php.*)/);location.pathname=parts[1]+(parts[2]?'':'_dev')+parts[3]
Comments on this snippet
Hey,
I think this is really cool idea! I edited the code, so it switches from "frontend_dev.php" to "index.php" and the other way round:
javascript:var parts=location.pathname.match(/(.?)(_dev)?(.php.)/);if(parts[2]){location.pathname=parts[1].replace(/frontend/g, 'index')+parts[3]}else{location.pathname=parts[1].replace('index', 'frontend')+(parts[2]?'':'_dev')+parts[3] }