# HG changeset patch # User Kim Alvefur # Date 1553020993 -3600 # Node ID f59334da6df96c430c3fbf11e289217729cd2447 # Parent 4e9d4b07e3e9976e9e176934c96db0531d6edf55 mod_conversejs: Show fallback text if converse.js fails to load (thanks MattJ) This can happen if javascript is enabled but 3rd party resources are blocked, or some other error happened. diff -r 4e9d4b07e3e9 -r f59334da6df9 mod_conversejs/mod_conversejs.lua --- a/mod_conversejs/mod_conversejs.lua Sun Mar 17 17:56:54 2019 +0100 +++ b/mod_conversejs/mod_conversejs.lua Tue Mar 19 19:43:13 2019 +0100 @@ -54,7 +54,16 @@ ]]):gsub("$([%w_]+)", { js_url = js_url, css_url = css_url }); -js_template = "converse.initialize(%s);"; +js_template = [[ +if(typeof converse == 'undefined') { + var div = document.createElement("div"); + var noscript = document.getElementsByTagName("noscript")[0]; + div.innerHTML = noscript.innerText; + document.body.appendChild(div); +} else { + converse.initialize(%s); +} +]]; local user_options = module:get_option("conversejs_options");