Move functionality for setting the hub into NdnProtocolInfo.setHub.
Added button in Firefox for Android to set the hub.
diff --git a/ndnProtocol/content/ndnToolbar.js b/ndnProtocol/content/ndnToolbar.js
index 41aa8ab..cefa32e 100644
--- a/ndnProtocol/content/ndnToolbar.js
+++ b/ndnProtocol/content/ndnToolbar.js
@@ -23,22 +23,7 @@
false);
function ndnToolbarSetHub() {
- var host = prompt("Enter hub host:", NdnProtocolInfo.ndn.host);
- if (!host)
- return;
-
- host = host.trim();
- if (host == "")
- return;
- if (host == NdnProtocolInfo.ndn.host)
- // No change.
- return;
-
- var port = 9695;
- NdnProtocolInfo.ndn.createRoute(host, port);
- document.getElementById("ndnHubLabel").setAttribute("value", "Hub: trying " + host + ":" + port);
-
- if (window._content.document.location.protocol == "ndn:")
- // Reload with the new hub.
- window._content.document.location = window._content.document.location.href;
+ var message = NdnProtocolInfo.setHub(window);
+ if (message != null)
+ document.getElementById("ndnHubLabel").setAttribute("value", message);
}