From f73b7eb569dc6f40ecf8adccf4a42446baf1f97f Mon Sep 17 00:00:00 2001 From: Jonah BrĂ¼chert Date: Thu, 30 Aug 2018 18:17:06 +0200 Subject: Recommend different clients depending on the operating system --- clients.json | 5 ----- clients_android.json | 6 ++++++ clients_desktop.json | 5 +++++ clients_iphone.json | 3 +++ lang/en.json | 2 +- scripts/main.js | 17 ++++++++++++++--- 6 files changed, 29 insertions(+), 9 deletions(-) delete mode 100644 clients.json create mode 100644 clients_android.json create mode 100644 clients_desktop.json create mode 100644 clients_iphone.json diff --git a/clients.json b/clients.json deleted file mode 100644 index 8fbec2b..0000000 --- a/clients.json +++ /dev/null @@ -1,5 +0,0 @@ -[ - "yaxim - lightweight classic UI", - "Conversations - modern and featureful", - "Bruno - cute and cuddly (based on yaxim)" -] diff --git a/clients_android.json b/clients_android.json new file mode 100644 index 0000000..6ed6c7e --- /dev/null +++ b/clients_android.json @@ -0,0 +1,6 @@ +[ + "Conversations - modern and featureful", + "Xabber - focus on user experience and interoperability", + "yaxim - lightweight classic UI", + "Bruno - cute and cuddly (based on yaxim)" +] diff --git a/clients_desktop.json b/clients_desktop.json new file mode 100644 index 0000000..024ac44 --- /dev/null +++ b/clients_desktop.json @@ -0,0 +1,5 @@ +[ + "Dino - modern, clean and GNOME integrated", + "Kaidan - modern, convergent and cross-platform", + "Gajim - full-featured" +] diff --git a/clients_iphone.json b/clients_iphone.json new file mode 100644 index 0000000..63e5a29 --- /dev/null +++ b/clients_iphone.json @@ -0,0 +1,3 @@ +[ + "ChatSecure - Encrypted Messenger for iOS" +] diff --git a/lang/en.json b/lang/en.json index ac90f47..5a3c3de 100644 --- a/lang/en.json +++ b/lang/en.json @@ -12,7 +12,7 @@ "":"" }, "clients": "If this link does not work, you need to install and configure an XMPP client, and visit this page again afterwards.", - "recommend": "On Android we recommend one of:", + "recommend": "We recommend one of:", "checkfulllist": "Check the full list of XMPP clients for other platforms.", "xmppis": "XMPP is a provider independent form of instant messaging. You can pick from many different clients and have a free choice of server operators to participate.", "":"" 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(); -- cgit 1.4.1