script to js file

This commit is contained in:
Martijn Scheepers
2017-11-16 16:07:40 +01:00
parent 8dd7dbd045
commit 5b5e334f05
3 changed files with 50 additions and 61 deletions

49
js/h1502.js Normal file
View File

@@ -0,0 +1,49 @@
// Script to open and close sidebar
function w3_open() {
document.getElementById("mySidebar").style.display = "block";
document.getElementById("myOverlay").style.display = "block";
}
function w3_close() {
document.getElementById("mySidebar").style.display = "none";
document.getElementById("myOverlay").style.display = "none";
}
//acsreader accordion menu
function acsreaderAccFunc() {
var x = document.getElementById("acsreaderAcc");
if (x.className.indexOf("w3-show") == -1) {
x.className += " w3-show";
x.previousElementSibling.className += " w3-dark-grey";
} else {
x.className = x.className.replace(" w3-show", "");
x.previousElementSibling.className =
x.previousElementSibling.className.replace(" w3-dark-grey", "");
}
}
//admin accordion menu
function adminAccFunc() {
var x = document.getElementById("adminAcc");
if (x.className.indexOf("w3-show") == -1) {
x.className += " w3-show";
x.previousElementSibling.className += " w3-dark-grey";
} else {
x.className = x.className.replace(" w3-show", "");
x.previousElementSibling.className =
x.previousElementSibling.className.replace(" w3-dark-grey", "");
}
}
$( document ).ready(function() {
if(typeof(EventSource) !== "undefined") {
var systemdate = new EventSource("helperpage/systemdate.php");
systemdate.onmessage = function(event) {
$("#systemdate").text("Datetime: " + event.data);
};
var systemload = new EventSource("helperpage/systemload.php");
systemload.onmessage = function(event) {
$("#systemload").text("Systemload: " + event.data);
};
} else {
$("#systemdate").text("browser not supported.");
}
});

View File

@@ -7,66 +7,5 @@
<p class="w3-right" id="systemload">system load</p> <p class="w3-right" id="systemload">system load</p>
</div> </div>
<script>
// Script to open and close sidebar
function w3_open() {
document.getElementById("mySidebar").style.display = "block";
document.getElementById("myOverlay").style.display = "block";
}
function w3_close() {
document.getElementById("mySidebar").style.display = "none";
document.getElementById("myOverlay").style.display = "none";
}
function acsreaderAccFunc() {
var x = document.getElementById("acsreaderAcc");
if (x.className.indexOf("w3-show") == -1) {
x.className += " w3-show";
x.previousElementSibling.className += " w3-dark-grey";
} else {
x.className = x.className.replace(" w3-show", "");
x.previousElementSibling.className =
x.previousElementSibling.className.replace(" w3-dark-grey", "");
}
}
function adminAccFunc() {
var x = document.getElementById("adminAcc");
if (x.className.indexOf("w3-show") == -1) {
x.className += " w3-show";
x.previousElementSibling.className += " w3-dark-grey";
} else {
x.className = x.className.replace(" w3-show", "");
x.previousElementSibling.className =
x.previousElementSibling.className.replace(" w3-dark-grey", "");
}
}
// Modal Image Gallery
function onClick(element) {
document.getElementById("img01").src = element.src;
document.getElementById("modal01").style.display = "block";
var captionText = document.getElementById("caption");
captionText.innerHTML = element.alt;
}
$( document ).ready(function() {
if(typeof(EventSource) !== "undefined") {
var systemdate = new EventSource("helperpage/systemdate.php");
systemdate.onmessage = function(event) {
$("#systemdate").text("Datetime: " + event.data);
};
var systemload = new EventSource("helperpage/systemload.php");
systemload.onmessage = function(event) {
$("#systemload").text("Systemload: " + event.data);
};
} else {
$("#systemdate").text("browser not supported.");
}
});
</script>
</body> </body>
</html> </html>

View File

@@ -13,5 +13,6 @@ body {font-size:16px;}
.w3-half img:hover{opacity:1} .w3-half img:hover{opacity:1}
</style> </style>
<script src="js/jquery-3.2.1.min.js"></script> <script src="js/jquery-3.2.1.min.js"></script>
<script src="js/h1502.js"></script>
<body> <body>