Last active
January 26, 2022 17:03
-
-
Save crccheck/758791 to your computer and use it in GitHub Desktop.
Bookmarklet to swap from the live site to my local dev site
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.href.split('/');a[0]='http:';a[2]=location.port?'www.texastribune.org':'localhost:8000';window.open(a.join('/'))})(); |
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.href.split('/');a[0]='http:';a[2]=location.port?'www.texastribune.org':'localhost:8000';location.replace(a.join('/'))})(); |
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
// UNMINIFIED | |
// assumes you're running your dev server on a non-80 port | |
// config the ternary to your own servers | |
(function(){ | |
var a = location.href.split('/'); | |
a[0] = 'http:'; | |
a[2] = location.port? 'www.texastribune.org' : 'localhost:8000'; | |
window.open(a.join('/')); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Super handy, thanks for this! I made a (naive) modification that works like a toggle: