Adjust style.css path.

Adjusted the path to style.css to be dynamically set using 'data-static-path' attribute. This change allows stylesheets to be fetched from the correct path based on the consumed API.
This commit is contained in:
Leonid Nikitin 2023-12-02 01:44:21 +06:00
parent 04eacf66cd
commit 4bac5c10a0
Signed by: kor-elf
GPG Key ID: 604A019EB118CAC4
2 changed files with 64 additions and 63 deletions

View File

@ -6,7 +6,7 @@
<title>Title</title> <title>Title</title>
</head> </head>
<body> <body>
<div class="captcha-service-kor-elf" data-domain="http://captcha.localhost:9008" data-token=""></div> <div class="captcha-service-kor-elf" data-domain="" data-static-path="./" data-token=""></div>
<script src="script.js" async></script> <script src="script.js" async></script>
</body> </body>
</html> </html>

View File

@ -6,12 +6,13 @@
const style = document.createElement('link'); const style = document.createElement('link');
const domain = element.getAttribute('data-domain'); const domain = element.getAttribute('data-domain');
const token = element.getAttribute('data-token'); const token = element.getAttribute('data-token');
const staticPath = element.getAttribute('data-static-path');
let windowCaptcha = null; let windowCaptcha = null;
style.rel = 'stylesheet'; style.rel = 'stylesheet';
style.type = 'text/css'; style.type = 'text/css';
style.href = 'style.css'; style.href = staticPath + '/style.css';
shadow.appendChild(style); shadow.appendChild(style);
button.textContent = 'Я не робот!'; button.textContent = 'Я не робот!';