Created
September 7, 2012 21:32
-
-
Save nrn/3669857 to your computer and use it in GitHub Desktop.
Smallest Federated Wiki bookmarklet
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 (main) { | |
var host = document.location.host | |
, home = window.prompt('Open these pages from what origin server:', main) | |
; | |
if (!home) return; | |
document.location = 'http://' + home + document.location.pathname.split('/').map( | |
function (i) { | |
if (i === 'view') return host; | |
if (i === home) return 'view'; | |
return i; | |
} | |
).join('/'); | |
})('fed.wiki.org'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To use this just set the target of a bookmark to the script. If you want a different default server, replace 'fed.wiki.org' at the end with the server you most often rebase to.