about summary refs log tree commit diff
path: root/scripts/main.js
diff options
context:
space:
mode:
authorFelix <felix@felix-zauberer.de>2021-07-30 12:50:13 +0200
committerFelix <felix@felix-zauberer.de>2021-07-30 23:04:54 +0200
commitd8b16f35232b1b881b98685d41e6cdc47323e596 (patch)
tree69a7af20f32517c8cc73db8378770f8d18c48972 /scripts/main.js
parent1fa012fdcc2aa6be2659d6c3e3149f8bc220abd9 (diff)
downloadphp-xmpp-invitation-d8b16f35232b1b881b98685d41e6cdc47323e596.tar.gz
Use a better variable name
Diffstat (limited to 'scripts/main.js')
-rw-r--r--scripts/main.js28
1 files changed, 14 insertions, 14 deletions
diff --git a/scripts/main.js b/scripts/main.js
index 52b929a..92b0207 100644
--- a/scripts/main.js
+++ b/scripts/main.js
@@ -33,31 +33,31 @@
 	function load_hash() {
 		var muc = false;
 		key_prefix = "chat.";
-		var jid = window.location.search || window.location.hash;
-		jid = decodeURIComponent(jid.substring(jid.indexOf('#') + 1, jid.length));
+		var xmpp_uri = window.location.search || window.location.hash;
+		xmpp_uri = decodeURIComponent(xmpp_uri.substring(xmpp_uri.indexOf('#') + 1, xmpp_uri.length));
 		try {
-			base_decoded = window.atob(jid);
+			base_decoded = window.atob(xmpp_uri);
 			if (base_decoded.search('@') >= 0)
-				jid = base_decoded;
+				xmpp_uri = base_decoded;
 		} catch (err) {
 			// ignore error, JID wasn't base64 encoded
 		}
-		if (jid.search("\\?join") >= 0) {
+		if (xmpp_uri.search("\\?join") >= 0) {
 			muc = true;
 			key_prefix = "muc.";
 		}
 
 		// TODO: proper error checking / display / Creation of invitations
-		if (jid.search("@") <= 0) return {jid:jid, jid_encoded:jid, name: jid};
+		if (xmpp_uri.search("@") <= 0) return {xmpp_uri:xmpp_uri, xmpp_uri_encoded:xmpp_uri, name: xmpp_uri};
 
-		var name = jid.split("@")[0];
+		var name = xmpp_uri.split("@")[0];
 		name = name.charAt(0).toUpperCase() + name.slice(1);
 
-		var jid_parts = jid.split("?");
-		jid_parts[0] = encodeURIComponent(jid_parts[0]) // URL-encode the JID only
-		var jid_encoded = jid_parts.join("?");
+		var xmpp_uri_parts = xmpp_uri.split("?");
+		xmpp_uri_parts[0] = encodeURIComponent(xmpp_uri_parts[0]) // URL-encode the JID only
+		var xmpp_uri_encoded = xmpp_uri_parts.join("?");
 
-		return {jid: jid, jid_encoded: jid_encoded, name: name};
+		return {xmpp_uri: xmpp_uri, xmpp_uri_encoded: xmpp_uri_encoded, name: name};
 	}
 
 	function translate_ui() {
@@ -75,14 +75,14 @@
 
 	function rehash() {
 		display_data = load_hash();
-		document.getElementById('button').href = "xmpp:" + display_data.jid_encoded;
-		document.getElementById('url_in').value = "xmpp:" + display_data.jid;
+		document.getElementById('button').href = "xmpp:" + display_data.xmpp_uri_encoded;
+		document.getElementById('url_in').value = "xmpp:" + display_data.xmpp_uri;
 		translate_ui();
 	}
 
 	function createQR() {
 		display_data = load_hash();
-		new QRCode(document.getElementById("qrcode"), "xmpp:" + display_data.jid);
+		new QRCode(document.getElementById("qrcode"), "xmpp:" + display_data.xmpp_uri);
 	}
 
 	function load_done() {