Skip to main content

One barrier I and many others find in efficiency while working on the computer is the time it takes between switching between keyboard and mouse. I find it much easier to keep my hands on my keyboard and use more shortcuts, so I wrote a simple intranet page that keep that in motion up to reaching outside websites. Below is a brief video, as well as the code shown below.

Please let me know what you think of this, how you may do it differently or what you would add- thank you for reading!

<!DOCTYPE html><html lang="en" dir="ltr">  <head>
      <title>Intranet | Welcome</title>      <base href="/" />
      <meta charset="UTF-8" />
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
      <style media="screen">
      body {
        background-color: #313131;
        color: #fff;
        margin: 0;
        padding: 0;
        font-family: sans-serif;
      }
      div#help {
        border-bottom: 3px solid #1ab1ed;
      }
      div#help ul {
        list-style: none;
        padding: 0;
        margin: 0;
        width: 100%;
      }
      div#help ul li {
        display: inline-block;
        min-width: 5%;
        padding: 1em;
        text-align: center;
      }
      div#help ul li:hover {
        background-color: #1ab1ed;
      }
      div#input {
        width: 100%;
        padding: 2em 0 2em 0;
      }
      div#links {
        background-color: #ABABAB;
        width: 46%;
        margin: 0 auto 0 auto;
        border-radius: .125em;
      }
      div#links ul {
        list-style: none;
        padding: 1%;
        margin: 1em;
      }
      input {
        background-color: #ABABAB;
        padding: 1em;
        border: 0;
        display: block;
        margin: 0 auto 0 auto;
        font-size: 2em;
        border-radius: .125em;
        width: 25%;
      }
    </style>
    <script type="text/javascript">
      function sleep(ms) {
        return new Promise(
        resolve => setTimeout(resolve, ms)
        );
      };
      async function uniKeyCode(event) {
        var key = event.which;
        await sleep(100);
        if (document.getElementById("input").innerHTML == "") {
          if (key == 76) {
            document.getElementById("links").innerHTML = "<ul><li>(y) Youtube Subscriptions</li><li>(d) DeviantArt</li><li>(t) Twitter</li></ul>";
          } else if (key == 72) {
            document.getElementById("help").innerHTML = "
            <ul>
              <li>() search</li><li>(l) links</li><li>(h) help</li><li>(esc) close</li>
            </ul>";
          } else if (key == 220) {
            document.getElementById("input").innerHTML = "<form class="" action="http://duckduckgo.com/" target="_BLANK" id="search"><input type="text" name="q" placeholder="Search DuckDuckGo" id="q"></form>";
            var input = document.getElementById(\'q\');
            input.focus();
            input.select();
          };
        }
        if (! document.getElementById("links").innerHTML == "") {
          if (key == 68) {
            window.open("https://deviantart.com")
          }
          if (key == 84) {
            window.open("https://twitter.com")
          }
          if (key == 89) {
            window.open("https://www.youtube.com/feed/subscriptions")
          }
        }
        if (key == 27) {          document.getElementById("links").innerHTML = "";          document.getElementById("input").innerHTML = "";
          document.getElementById("help").innerHTML = "";
        };
      };
    </script>
  </head>
  <body onkeydown="uniKeyCode(event);">
    <div id="help"></div>
    <div id="input"></div>
    <div id="links"></div>
  </body></html>
graphic that says Adam and shows an exclamation point

Adam Anderson

Systems Administrator by day; ronin illustrator by night. I promote learning the tools in your computer system to complete your work in a more effective way, meanwhile agonizing for hours over an A3 sheet of bristol paper with a 0.03mm pen.