Skip to content

Commit 6aad055

Browse files
authored
Merge pull request 0xPolygon#2656 from 0xPolygon/hosted/kapaaitest
feat: added kapa ai, missing polygon logo
2 parents a351bbc + 293b68d commit 6aad055

File tree

2 files changed

+76
-0
lines changed

2 files changed

+76
-0
lines changed
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/** @format */
2+
3+
(function () {
4+
let k = window.Kapa;
5+
if (!k) {
6+
let i = function () {
7+
i.c(arguments);
8+
};
9+
i.q = [];
10+
i.c = function (args) {
11+
i.q.push(args);
12+
};
13+
window.Kapa = i;
14+
}
15+
})();
16+
17+
// keeps MkDocs from seeing the keydown
18+
function stopMkdocsShortcuts(e) {
19+
if (e.ctrlKey || e.metaKey || e.altKey) return;
20+
const blocked = new Set(['/', 's', 'f', 'n', 'p', '.']);
21+
if (blocked.has(e.key.toLowerCase())) {
22+
e.stopImmediatePropagation();
23+
}
24+
}
25+
26+
Kapa('onModalOpen', () => {
27+
window.addEventListener('keydown', stopMkdocsShortcuts, true);
28+
});
29+
30+
Kapa('onModalClose', () => {
31+
window.removeEventListener('keydown', stopMkdocsShortcuts, true);
32+
});
33+
34+
document.addEventListener('DOMContentLoaded', function () {
35+
var script = document.createElement('script');
36+
script.src = 'https://widget.kapa.ai/kapa-widget.bundle.js';
37+
script.setAttribute(
38+
'data-website-id',
39+
'd4477ef9-8d35-448e-b5ea-3b8f13d1cf1e'
40+
);
41+
script.setAttribute('data-project-name', 'Polygon');
42+
script.setAttribute('data-project-color', '#6306B6');
43+
script.setAttribute(
44+
'data-project-logo',
45+
'https://polygontechnology.notion.site/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2F51562dc1-1dc5-4484-bf96-2aeac848ae2f%2F2c578a74-e8a1-4b2d-aafa-3126339715ae%2FPolygon_Icon_White_Purple_Rn.png?id=f3d302a7-607b-4f4d-8490-240c7eafe3c7&table=block&spaceId=51562dc1-1dc5-4484-bf96-2aeac848ae2f&width=2000&userId=&cache=v2'
46+
);
47+
script.setAttribute('data-button-image-height', '2rem');
48+
script.setAttribute('data-button-image-width', '2.5rem');
49+
script.setAttribute('data-modal-open-by-default', 'false');
50+
script.setAttribute('data-modal-title', 'Polygon Docs Chat Bot');
51+
script.setAttribute('data-modal-example-questions-title', 'Try asking me...');
52+
script.setAttribute('data-font-size-sm', '.7rem');
53+
script.setAttribute('data-query-input-font-size', '0.80rem');
54+
script.setAttribute('data-modal-disclaimer-font-size', '0.6rem');
55+
script.setAttribute('data-modal-title-font-size', '1.1rem');
56+
script.setAttribute("data-example-question-button-font-size","0.6rem");
57+
script.setAttribute(
58+
'data-modal-disclaimer',
59+
'This AI chatbot is powered by kapa.ai. Responses are generated automatically and may be inaccurate or incomplete. Do not rely on this information as legal, financial or other professional advice. By using this assistant, you agree that your input may be processed in accordance with the kapa.ai privacy policy: https://www.kapa.ai/content/privacy-policy'
60+
);
61+
script.setAttribute(
62+
'data-modal-example-questions',
63+
'What is the finality time on Polygon?, How do I connect my wallet to Polygon?'
64+
);
65+
script.setAttribute('data-button-text-color', '#ffffff');
66+
script.setAttribute('data-modal-title-color', '#ffffff');
67+
script.setAttribute('data-modal-header-bg-color', '#6306B6');
68+
script.setAttribute('data-button-position-top', '10px');
69+
script.setAttribute('data-button-position-right', '20px');
70+
script.setAttribute('data-button-text-font-size', '0.8rem');
71+
script.setAttribute('data-button-height', '3.8rem');
72+
script.setAttribute('data-button-width', '3.6rem');
73+
script.async = true;
74+
document.head.appendChild(script);
75+
});

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,7 @@ validation:
613613
anchors: warn
614614

615615
extra_javascript:
616+
- _site_essentials/js/init_kapa_widget.js
616617
- _site_essentials/js/mathjax.js
617618
- https://cdnjs.cloudflare.com/polyfill/v3/polyfill.min.js?version=4.8.0
618619
- https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js

0 commit comments

Comments
 (0)