# HG changeset patch # User Kim Alvefur # Date 1536584643 -7200 # Node ID e714be00aaad896e5f5928a617cc41b131dd3f4a # Parent 5b3347056f07551d3aaede6be2f5aa9bac8d9600 mod_conversejs: Factor JavaScript part out of HTML This will allow serving only the JS snippet in the future. diff -r 5b3347056f07 -r e714be00aaad mod_conversejs/mod_conversejs.lua --- a/mod_conversejs/mod_conversejs.lua Mon Sep 10 14:49:49 2018 +0200 +++ b/mod_conversejs/mod_conversejs.lua Mon Sep 10 15:04:03 2018 +0200 @@ -9,7 +9,7 @@ module:depends("websocket"); end); -local template = [[ +local html_template = [[ @@ -37,11 +37,13 @@

More clients...

- + ]] +js_template = "converse.initialize(%s);"; + local more_options = module:get_option("conversejs_options"); module:provides("http", { @@ -66,7 +68,7 @@ end event.response.headers.content_type = "text/html"; - return template:format(json_encode(converse_options)); + return html_template:format(js_template:format(json_encode(converse_options))); end; } });