Я создаю свой собственный сайт (https://khushit -shah.github.io / ) с помощью github.dev.
Теперь в верхней части каждого репозитория я хотел показать некоторый контент с репозиторием, который должен быть гибким и легко изменяемым. Итак, я создал файл в хранилище с именем "repodesc.html". который содержит HTML, чтобы мы показали! Затем, используя следующий код, я добавляю этот HTML-файл для каждого хранилища.
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("{{ repository.id }}").innerHTML = this.responseText;
}
};
xhttp.open("GET", "https://raw.githubusercontent.com/khushit-shah/{{ repository.name }}/master/repodesc.html", true);
xhttp.send();
Это добавляет HTML-код в https://raw.githubusercontent.com/khushit-shah/Cursor.js/master/repodesc.html на мой веб-сайт (верхняя часть Cursor.js). Но тег script в repodesc не выполняется.
Код в repodesc.html
<h1 cursor-animate cursor-loop-reverse> Cursor.js </h1>
<script>
console.log("Is it working?");
js = "https://raw.githubusercontent.com/khushit-shah/Cursor.js/master/cursor-v.2.0.2.js";
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
eval(this.responseText);
}
};
xhttp.open("GET", js, true);
xhttp.send();
</script>
Я даже попробовал repodesc.html
<h1 cursor-animate cursor-loop-reverse> Cursor.js </h1>
<script src="https://cdn.jsdelivr.net/gh/khushit-shah/Cursor.js@latest/cursor.v1.0.0.min.js" >
</script>
ожидаемый результат: должен быть выполнен Cursor.js, а тег h1 должен быть анимирован с эффектом написания шрифтов!
фактический результат: скрипт в repodesc.html не выполняется!