Skip to content

Commit 17fda6b

Browse files
add chatbot
1 parent e882fc0 commit 17fda6b

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"baseUrl": "https://techradar.aoe.com",
44
"editUrl": "https://github.dev/AOEpeople/techradar/blob/main/radar/{release}/{id}.md",
55
"logoFile": "logo.svg",
6-
"jsFile": "",
6+
"jsFile": "js/init.js",
77
"toggles": {
88
"showChart": true,
99
"showTagFilter": true,

nginx/conf.d/default.conf

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ server {
1010
root /usr/share/nginx/html;
1111
index index.html index.htm;
1212

13-
add_header Content-Security-Policy "frame-ancestors 'self'; default-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' cookie-cdn.cookiepro.com; connect-src 'self' cookie-cdn.cookiepro.com privacyportal.cookiepro.com; img-src *";
13+
add_header Content-Security-Policy "frame-ancestors 'self'; default-src 'self' 'unsafe-inline'; img-src *";
1414
add_header Strict-Transport-Security "max-age=31536000";
1515
add_header Cache-Control "max-age=86400";
1616
add_header X-Content-Type-Options nosniff;
@@ -23,6 +23,5 @@ server {
2323
}
2424

2525
error_page 404 /404.html;
26-
2726
}
2827

public/js/init.js

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
(function () {
2+
const chatbotElement = document.createElement("div");
3+
chatbotElement.id = "chatbot";
4+
chatbotElement.style =
5+
"position: fixed; bottom: 0; right: 0; z-index: 9999; margin-right: 0; margin-bottom: 20px";
6+
document.body.append(chatbotElement);
7+
8+
// initially load chatbot script
9+
const chatbot = document.createElement("script");
10+
chatbot.src = "/chatbot/chatbot.umd.js";
11+
chatbot.type = "text/javascript";
12+
chatbot.onload = function() {
13+
Chatbot.init({height: 700, width: 400, botName: "TechScout"})
14+
Chatbot.show();
15+
}
16+
document.head.append(chatbot);
17+
18+
// load chatbot styles
19+
const chatbotStyles = document.createElement("link");
20+
chatbotStyles.rel = "stylesheet";
21+
chatbotStyles.href = "/chatbot/style.css";
22+
document.head.append(chatbotStyles);
23+
})();

0 commit comments

Comments
 (0)