about summary refs log tree commit diff
path: root/scripts/main.js
diff options
context:
space:
mode:
authorJonah BrĂ¼chert <jbb.prv@gmx.de>2018-08-30 18:17:06 +0200
committerJonah BrĂ¼chert <jbb.prv@gmx.de>2019-03-12 17:07:28 +0100
commitf73b7eb569dc6f40ecf8adccf4a42446baf1f97f (patch)
tree65ec4be7ebb3dc257a01040cc75e799dc453dd02 /scripts/main.js
parentadb12a1b801e864847067758d625d24047cb363c (diff)
downloadphp-xmpp-invitation-f73b7eb569dc6f40ecf8adccf4a42446baf1f97f.tar.gz
Recommend different clients depending on the operating system
Diffstat (limited to 'scripts/main.js')
-rw-r--r--scripts/main.js17
1 files changed, 14 insertions, 3 deletions
diff --git a/scripts/main.js b/scripts/main.js
index 7f9bc8d..4f2f207 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 () {
@@ -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_desktop.json")
+		}
+                else if (navigator.userAgent.indexOf("iPhone") >= 0)  {
+                        load_clients("clients_iphone.json")
+                }
+		else {
+			load_clients("clients_desktop.json")
+		}
+
 		window.addEventListener("hashchange", rehash, false);
 		document.getElementById("url_in").addEventListener("focus", function(event) {
 			event.target.select();