Skip to content
Snippets Groups Projects
Commit c5b57857 authored by Jonas Leder's avatar Jonas Leder
Browse files

switched from JS to typescript and added devSetup script

parent 190480a9
No related branches found
No related tags found
No related merge requests found
......@@ -14,8 +14,8 @@ if (strpos($_SERVER['HTTP_HOST'], '.onion') !== false) {
<meta charset="UTF-8">
<title>404 - Page not found</title>
<link href="/css/error.css" rel="stylesheet">
<script src="/js/jquery-2.1.3.min.js"></script>
<script src="/js/typed.js"></script>
<script src="/error/jquery-2.1.3.js"></script>
<script src="/error/typed.js"></script>
</head>
<body>
<!-- Matomo Image Tracker-->
......@@ -59,6 +59,6 @@ if (strpos($_SERVER['HTTP_HOST'], '.onion') !== false) {
];
</script>
<script src="/js/error.js"></script>
<script src="/error/error.js"></script>
</body>
</html>
\ No newline at end of file
File moved
This diff is collapsed.
File moved
......@@ -17,8 +17,8 @@ function getError500()
<meta charset="UTF-8">
<title>500 - Internal Server error</title>
<link href="/css/error.css" rel="stylesheet">
<script src="/js/jquery-2.1.3.min.js"></script>
<script src="/js/typed.js"></script>
<script src="/error/jquery-2.1.3.js"></script>
<script src="/error/typed.js"></script>
</head>
<body>
<!-- Matomo Image Tracker-->
......@@ -62,7 +62,7 @@ function getError500()
];
</script>
<script src="/js/error.js"></script>
<script src="/error/error.js"></script>
</body>
</html>
EOF;
......
function acceptCookie(){
"use strict";
function acceptCookie() {
document.cookie = "cookieMessageHide=1";
checkHide();
}
function getCookie(name){
function getCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(";");
for (var i=0; i < ca.length; i++) {
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while(c.charAt(0) === " ") c = c.substr(1, c.length);
if(c.indexOf(nameEQ) === 0) return c.substr(nameEQ.length, c.length)
while (c.charAt(0) === " ")
c = c.substr(1, c.length);
if (c.indexOf(nameEQ) === 0)
return c.substr(nameEQ.length, c.length);
}
return null
return null;
}
function checkHide(){
if (getCookie("cookieMessageHide") === "1"){
document.getElementsByClassName("cookieinfo")[0].style.display = "none";
} else {
document.getElementsByClassName("cookieinfo")[0].style.display = "block";
function checkHide() {
var cookieInfo = document.getElementsByClassName("cookieinfo")[0];
if (getCookie("cookieMessageHide") === "1") {
cookieInfo.style.display = "none";
}
}
\ No newline at end of file
else {
cookieInfo.style.display = "block";
}
}
let z = document.getElementsByTagName("*");
for (let i = 0; i < z.length; i++) {
let element = z[i];
let externalFileURL = element.getAttribute("includeHTML");
if (externalFileURL) {
let xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
"use strict";
var z = document.getElementsByTagName("*");
var _loop_1 = function (i) {
var element = z[i];
var externalFileURL = element.getAttribute("includeHTML");
if (externalFileURL != "") {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function () {
if (this.readyState == 4) {
if (this.status == 200) { element.innerHTML = this.responseText; }
if (this.status == 404) { element.innerHTML = "Page not found."; }
if (this.status == 200) {
element.innerHTML = this.responseText;
}
if (this.status == 404) {
element.innerHTML = "Page not found.";
}
element.removeAttribute("includeHTML");
}
}
};
xhr.open("GET", externalFileURL, true);
xhr.send();
}
};
for (var i = 0; i < z.length; i++) {
_loop_1(i);
}
This diff is collapsed.
......@@ -26,7 +26,7 @@ getHeader("NTP Status", "status");
<script type="text/javascript">
if (!NP) var NP= {};
</script>
<script src="js/includeHTML.js"></script>
<script src="../ts/includeHTML.js"></script>
<script type="text/javascript" src="https://jonasled.pages.gitlab.jonasled.de/pool.ntp.org-graph/jquery.js"></script>
<script type="text/javascript" src="https://jonasled.pages.gitlab.jonasled.de/pool.ntp.org-graph/d3.js"></script>
<script type="text/javascript" src="https://jonasled.pages.gitlab.jonasled.de/pool.ntp.org-graph/graphs.js"></script>
......
function acceptCookie(){
document.cookie = "cookieMessageHide=1";
checkHide();
}
function getCookie(name){
var nameEQ = name + "=";
var ca = document.cookie.split(";");
for (var i=0; i < ca.length; i++) {
var c = ca[i];
while(c.charAt(0) === " ") c = c.substr(1, c.length);
if(c.indexOf(nameEQ) === 0) return c.substr(nameEQ.length, c.length)
}
return null
}
function checkHide(){
if (getCookie("cookieMessageHide") === "1"){
document.getElementsByClassName("cookieinfo")[0].style.display = "none";
} else {
document.getElementsByClassName("cookieinfo")[0].style.display = "block";
}
}
\ No newline at end of file
let z = document.getElementsByTagName("*");
for (let i = 0; i < z.length; i++) {
let element = z[i];
let externalFileURL = element.getAttribute("includeHTML");
if (externalFileURL) {
let xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (this.readyState == 4) {
if (this.status == 200) { element.innerHTML = this.responseText; }
if (this.status == 404) { element.innerHTML = "Page not found."; }
element.removeAttribute("includeHTML");
}
}
xhr.open("GET", externalFileURL, true);
xhr.send();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment