Webbserverprogrammering 1

Show sourcecode

The following files exists in this folder. Click to view.

webbsrvprg/

bilder/
comments.php
exercises/
exercises.php
gya/
img/
incl/
index-no-include.php
index.css
index.js
index.php
indexOld.php
ovningar/
source.php
style/
viewsource.php

index.js

46 lines ASCII Windows (CRLF)
document.addEventListener("keydown", switchMouse);

function switchMouse(key) {
  if (key.keyCode == 70) {
    if(document.getElementById("cursorBlade")) {
      document.getElementById("cursorBlade").id = "cursorKrokodil";
    } else if (document.getElementById("cursorKrokodil")) {
      document.getElementById("cursorKrokodil").id = "cursorHeterochromia";
    } else {
      document.getElementById("cursorHeterochromia").id = "cursorBlade";
    }
  }
}

function changeSlide(btnIndex) {
const slides = document.getElementById("slides");

  slideIndex = btnIndex - 1;

  for (let i = 0; i < slides.children.length; i++) {
    const img = slides.children[i];

    if (i == slideIndex) {
      img.style.display = "inline";

      if (img.width > img.height) {
        img.style.width = "100%";
        if (img.height > slides.clientHeight) {
          img.style.width = "auto";
        }
      } else {
        img.style.height = "100%";
      }
    } else {
      img.style.display = "none";
    }
  }
}

const links = document.getElementsByClassName("flexLink");

for (let i = 0; i < links.length; i++) {
  setTimeout(function () {
    links[i].style.display = "block";
  }, (i + 3) * 100);
}