diff options
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/main.js | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/scripts/main.js b/scripts/main.js index 2cb124c..cc13762 100644 --- a/scripts/main.js +++ b/scripts/main.js @@ -17,8 +17,7 @@ } } - function load_clients() { - var url = "clients.json"; + function load_clients(url) { var request = new XMLHttpRequest(); request.open('GET', url); request.onreadystatechange = function () { @@ -49,7 +48,7 @@ } // TODO: proper error checking / display / Creation of invitations - if (jid.search("@") <= 0) return {jid:"", name: "Somebody"}; + if (jid.search("@") <= 0) return {jid:jid, jid_encoded:jid, name: jid}; var name = jid.split("@")[0]; name = name.charAt(0).toUpperCase() + name.slice(1); @@ -93,7 +92,19 @@ i18n.setLocale('en'); // functionality - load_clients(); + if (navigator.userAgent.indexOf("Android") >= 0) { + load_clients("clients_Android.json") + } + else if (navigator.userAgent.indexOf("Linux") >= 0) { + load_clients("clients_Linux.json") + } + else if (navigator.userAgent.indexOf("iPhone") >= 0) { + load_clients("clients_iOS.json") + } + else { + load_clients("clients_Linux.json") + } + window.addEventListener("hashchange", rehash, false); document.getElementById("url_in").addEventListener("focus", function(event) { event.target.select(); |
