comparison mod_conversejs/mod_conversejs.lua @ 2921:3264058ae54f

mod_conversejs: Hack in support for changing the CSS if InVerse mode is enabled
author Kim Alvefur <zash@zash.se>
date Sat, 10 Mar 2018 00:49:06 +0100
parents 0ea93da47db9
children 8858cef9ed27
comparison
equal deleted inserted replaced
2920:4d03ac2737ab 2921:3264058ae54f
10 end); 10 end);
11 11
12 local template = [[ 12 local template = [[
13 <!DOCTYPE html> 13 <!DOCTYPE html>
14 <meta charset="utf-8"> 14 <meta charset="utf-8">
15 <link rel="stylesheet" type="text/css" media="screen" href="https://cdn.conversejs.org/css/converse.min.css"> 15 <link rel="stylesheet" type="text/css" media="screen" href="https://cdn.conversejs.org/css/%s.min.css">
16 <script src="https://cdn.conversejs.org/dist/converse.min.js"></script> 16 <script src="https://cdn.conversejs.org/dist/converse.min.js"></script>
17 <body><script>converse.initialize(%s);</script> 17 <body><script>converse.initialize(%s);</script>
18 ]] 18 ]]
19 19
20 local more_options = module:get_option("conversejs_options"); 20 local more_options = module:get_option("conversejs_options");
27 websocket_url = has_ws and module:http_url("websocket","xmpp-websocket"):gsub("^http", "ws") or nil; 27 websocket_url = has_ws and module:http_url("websocket","xmpp-websocket"):gsub("^http", "ws") or nil;
28 authentication = module:get_option_string("authentication") == "anonymous" and "anonymous" or "login"; 28 authentication = module:get_option_string("authentication") == "anonymous" and "anonymous" or "login";
29 jid = module.host; 29 jid = module.host;
30 }; 30 };
31 31
32 local view_mode_css = "converse";
32 if type(more_options) == "table" then 33 if type(more_options) == "table" then
33 for k,v in pairs(more_options) do 34 for k,v in pairs(more_options) do
34 converse_options[k] = v; 35 converse_options[k] = v;
35 end 36 end
37 if more_options.view_mode == "fullscreen" then
38 view_mode_css = "inverse";
39 end
36 end 40 end
37 41
38 event.response.headers.content_type = "text/html"; 42 event.response.headers.content_type = "text/html";
39 return template:format(json_encode(converse_options)); 43 return template:format(view_mode_css, json_encode(converse_options));
40 end; 44 end;
41 } 45 }
42 }); 46 });
43 47