Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Allow update of weinreId without page refresh (attach to onhashchange).
  • Loading branch information
shteou committed Aug 13, 2014
1 parent f8bcc48 commit ad3c24fe15d119b6e0a712c061e9269418382692
Showing 1 changed file with 22 additions and 16 deletions.
@@ -23,26 +23,32 @@ var weinre_port = location.port
var weinre_pathname = location.pathname
var weinre_id = "anonymous"

var hash = location.href.split("#")[1]
if (hash) {
weinre_id = hash
}
function doReplacements() {
var hash = location.href.split("#")[1]
if (hash) {
weinre_id = hash
}

replaceURL("url-client-ui", buildHttpURL("client/#" + weinre_id))
replaceURL("url-interfaces", buildHttpURL("interfaces/interfaces.html"))
replaceURL("url-target-demo", buildHttpURL("demo/weinre-demo.html#" + weinre_id))
replaceURL("url-target-demo-min", buildHttpURL("demo/weinre-demo-min.html#" + weinre_id))
replaceURL("url-target-script", buildHttpURL("target/target-script-min.js#" + weinre_id))
replaceURL("url-target-bookmarklet", getTargetBookmarklet(), "weinre target debug")
replaceURL("url-target-documentation", buildHttpURL("doc/"))

replaceURL("url-client-ui", buildHttpURL("client/#" + weinre_id))
replaceURL("url-interfaces", buildHttpURL("interfaces/interfaces.html"))
replaceURL("url-target-demo", buildHttpURL("demo/weinre-demo.html#" + weinre_id))
replaceURL("url-target-demo-min", buildHttpURL("demo/weinre-demo-min.html#" + weinre_id))
replaceURL("url-target-script", buildHttpURL("target/target-script-min.js#" + weinre_id))
replaceURL("url-target-bookmarklet", getTargetBookmarklet(), "weinre target debug")
replaceURL("url-target-documentation", buildHttpURL("doc/"))
replaceText("version-weinre", Weinre.Versions.weinre)
replaceText("version-build", Weinre.Versions.build)

replaceText("version-weinre", Weinre.Versions.weinre)
replaceText("version-build", Weinre.Versions.build)
replaceText("target-bookmarklet-src-pre", getTargetBookmarklet())
replaceText("target-bookmarklet-src-text-area", getTargetBookmarklet())

replaceText("url-target-script-raw", buildHttpURL("target/target-script-min.js#" + weinre_id))
}

replaceText("target-bookmarklet-src-pre", getTargetBookmarklet())
replaceText("target-bookmarklet-src-text-area", getTargetBookmarklet())
doReplacements();

replaceText("url-target-script-raw", buildHttpURL("target/target-script-min.js#" + weinre_id))
window.onhashchange = doReplacements;

//---------------------------------------------------------------------
function buildHttpURL(uri) {

0 comments on commit ad3c24f

Please sign in to comment.