-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
28 lines (25 loc) · 1.05 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//resets the user at the index page
function reloadPage(){
window.location = "index.php";
}
//loads the about page
function loadAbout(){
window.location = "about.php";
}
//takes care of animations for different browser variations
function animation(animationType, directory){
directory.style.webkitAnimation = animationType;
directory.style.MozAnimation = animationType;
directory.style.msAnimation = animationType;
directory.style.OAnimation = animationType;
directory.style.animation = animationType;
}
//sets autofocus on certain URL's
function focusDependingOnPath(){
//fetches the opened fileName from the opened path (the last part of the URL).
var fileNameIndex = location.pathname.lastIndexOf('/')+1; //fetch position of the last "/" (+1), which is the start position of the fileName
var fileName = location.pathname.substring(fileNameIndex); //creates a new string with only the fileName
if(fileName == "index.php" || fileName == "about.php" || fileName == ""){
document.getElementById("keyword").focus(); //set autofocus for searchbar
}
}