Lemmata.

In this example below you will see how to do a Lemmata. with some HTML / CSS and Javascript

Wikiviewer for FreeCodeCamp. #FCC Made with HTML, CSS, JS, AJAX, MediaQuery, Jquery.

Thumbnail
This awesome code was written by 0xFFD700, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright 0xFFD700 ©

Technologies

  • HTML
  • CSS
  • JavaScript
<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  <title>Lemmata.</title>
  <script src="js/typed.custom.js" type="text/javascript"></script>

  
  <link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css'>
<link rel='stylesheet prefetch' href='css/rfhjs.css'>

      <link rel="stylesheet" href="css/style.css">

  
</head>

<body>

  <!-- Metadaten-->
<meta name="description" content="Lemmata.">
<meta name="author" content="Jenny Hofbauer">

<!-- text/terminal-container-->
<div class="container-fluid">
  <div class="row">
    <div class="col-md-1"></div>
    <div class="col-md-9">
      <span style="color: #009900;">jenny@0xFFD700:~$ </span><span class='element0'></span><br>

      <span class="password install">[sudo] password for jenny: </span><span class='element1'></span>

      <p class="inst0 install"><br>Read package lists ... Done</p>

      <p class="inst1 install"><br>Dependency tree is established. <br> Status information is read .... Done </p>

      <p class="inst2 install"><br>The following packages were installed automatically and are no longer required: <br> extlinux gksu libgksu2-0 linux-image-extra-4.4.0-31-generic <br> linux-image-extra-4.4.0-36-generic
        <br> Use »sudo apt autoremove« to remove it.</p>

      <p class="inst3 install"><br>The following NEW packages are installed: <br> Lemmata <br> 0 updated, 1 newly installed, 0 to remove and 136 not updated. <br> 22.2 kB of archives to be downloaded. <br> After this operation 87.0 kB Disk space in addition.</p>

      <p class="inst4 install"><br>Get: 1 http://de.archive.ubuntu.com/ubuntu xenial / universe amd64 Lemmata amd64 10-17.1 [22.2 kB] <br> There were 22.2 kB fetched in 0 s (326 kB / s) <br>Previously unselected package Lemmata is chosen. (Read database ... 256725 files and directories
        are currently installed.)</p>

      <p class="inst5 install"><br>Get: 1 http://de.archive.ubuntu.com/ubuntu Xenial / Universe amd64 pacman amd64 10-17.1 [22.2 kB] <br> There were 22.2 kB fetched in 0 s (326 kB / s) <br> Holds not known package Lemmata is selected. <br>(Reading database ... 256725 files and
        directories are currently installed.) <br>Preparing to unpack ... / Lemmata_10-17.1_amd64.deb ... <br> Unpacking Lemmata (10-17.1) ...</p>

      <p class="inst6 install"><br>Triggers for man-db (2.7.5-1) are being processed <br> Triggers for gnome-menus (3.13.3-6ubuntu3.1) are being processed <br>Trigger for desktop-file-utils ( 0.22-1ubuntu5) are processed ... <br> Triggering for mime-support (3.59ubuntu1) are
        being processed <br> Lemmata (10-17.1) is set up ...<br></p>


      <span class="whoami nodisplay">jenny@0xFFD700:~$ </span><span class='element2'></span><br><br>

      <pre class="logo lemmata">      
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
              |L|e|m|m|a|t|a|
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
 </pre><br>


      <form onsubmit="return false"><span class='element3'></span><input type="text" name="name" id="name-input"></form>

      <span class="intro-text lemmata"></span>

      <form onsubmit="return false"><span class='element4'></span>
        <input type="text" name="search" id="search-input"></form><br>


      <div id="results">
        <span class='result-text'><form onsubmit='return false'><span class='element5'></span><input type='text' name='error' id='error-input'></form>
        </span>
        <!--Api results-->
      </div>
    </div>
    <div class="col-md-2"></div>
  </div>
</div>
  <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js'></script>
<script src='js/rfhjs.js'></script>

  

    <script  src="js/index.js"></script>




</body>

</html>

/*Downloaded from https://www.codeseek.co/0xFFD700/lemmata-JRaNxQ */
body {
  background-color: #111111;
  color: white;
  font-size: 3.0em;
  font-family: Georgia, 'Times New Roman', serif;
}

@media all and (max-width: 1800px) {
  body {
    font-size: 2.5em;
  }
}
@media all and (max-width: 1200px) {
  body {
    font-size: 2.0em;
  }
}
@media all and (max-width: 1000px) {
  body {
    font-size: 1.5em;
  }
}
@media all and (max-width: 500px) {
  body {
    font-size: 1.0em;
  }
}
a {
  text-decoration: none;
  color: #009900;
}

a:hover,
a:focus {
  color: #009900;
}

.nodisplay {
  color: #009900;
  display: none;
}

.install,
.lemmata {
  color: white;
  display: none;
}

.logo {
  background-color: #111111;
  border: none;
}

.element3,
.element5,
.result-text {
  display: inline;
}

#name-input,
#search-input,
#error-input {
  background-color: #111111;
  border: none;
  color: white;
  display: none;
}

input,
input:focus {
  outline: none;
  border: none !important;
  border-color: #111111 !important;
  animation: blink-empty 1s infinite;
  border-left: transparent solid 1px;
  margin: 5px;
}

@keyframes blink-empty {
  50% {
    border-left: 1px solid white;
  }
}


/*Downloaded from https://www.codeseek.co/0xFFD700/lemmata-JRaNxQ */
//typanimation with type.js
setTimeout(function() {
  $(".element0").typed({
    strings: ["sudo apt-get install Lemmata"],
    typeSpeed: 30, // speed 0 fastest
    backDelay: 750, // backspacing
    loop: false, // loop
    loopCount: false, // number of loops, false = infinite
    callback: function() {}
  });
}, 0);

setTimeout(function() {
  $(".password").css("display", "inline");
  down();
  $(".element1").typed({
    strings: ["**********"],
    typeSpeed: 100,
    backDelay: 750,
    loop: false,
    loopCount: false,
    callback: function() {}
  });
}, 3000);

//timeout for install
setTimeout(
  function() {
    $(".inst0").css("display", "inline");
    down();
  }, 6000);
setTimeout(
  function() {
    $(".inst1").css("display", "inline");
    down();
  }, 7000);
setTimeout(
  function() {
    $(".inst2").css("display", "inline");
    down();
  }, 8500);
setTimeout(
  function() {
    $(".inst3").css("display", "inline");
    down();
  }, 10000);
setTimeout(
  function() {
    $(".ins4").css("display", "inline");
    down();
  }, 1200);
setTimeout(
  function() {
    $(".inst5").css("display", "inline");
    down();
  }, 13500);
setTimeout(
  function() {
    $(".inst6").css("display", "inline");
    down();
  }, 15000);

setTimeout(function() {
  $(".whoami").css("display", "inline");
  down();
  $(".element2").typed({
    strings: ["Lemmata"],
    typeSpeed: 100,
    backDelay: 750,
    loop: false,
    loopCount: false,
    callback: function() {}
  });
}, 17000);

setTimeout(function() {
  $(".logo").css("display", "inline");
  $("#name-input").css("display", "inline").focus();
  down();
  $(".element3").typed({
    strings: ["> Who are you? "],
    typeSpeed: 20,
    backDelay: 750,
    loop: false,
    loopCount: false,
    callback: function() {}
  });
}, 20000);

//input name event
function userIn(inputName) {
  var intro = "> Hello " + inputName + ", nice meeting you. My name is Lemmata, I´m your personal Wikipedia Assistant. It´s simple just enter the search term regarding your desired researchefield or RANDOM to get a random wikipage, I´ll do the rest.";
  $(".intro-text").html(intro).css("display", "inline");
  down();
  $("#search-input").val('').css("display", "inline").focus();
  $(".element4").typed({
    strings: ["> What can I do for you today?"],
    typeSpeed: 20,
    backDelay: 750,
    loop: false,
    loopCount: false,
    callback: function() {}
  });
}

//random wikipage
function randomIn() {
  $("input").attr('disabled', 'disabled');
  $("#results").prepend("<a href='https://en.wikipedia.org/wiki/Special:Random'>Random Wikipage</a>");
  down();
}

//input searchTerm error event
function errorIn() {
  var output = ">'" + searchTerm + "': command not found<br>Enter valid searchterm: ";
  $(".element5").html(output).css("display", "inline");
  $("#error-input").val('').css("display", "inline").focus();
  down();
}

//input searchTerm event
function searchIn(searchTerm) {
  if (searchTerm == "RANDOM") {
    randomIn();
  } else {
    var url = "https://en.wikipedia.org/w/api.php?action=opensearch&search=" + searchTerm + "&format=json&callback=?";

    $.ajax({
      url: url,
      type: 'GET',
      contentType: "application/json; charset=utf-8",
      async: false,
      dataType: "json",
      success: function(data, status, jqXHR) {
        if (data[1].length == 0) {
          errorIn();
        } else {
          $('#error-input').css("animation", "none");
          $("input").attr('disabled', 'disabled');
          var output = "> That´s everything I found regarding the search term: '" + searchTerm + "'<br>";
          $(".result-text").append(output).css("display", "inline");
          for (var j = 0; j < data[1].length; j++) {
            var wikiLink = "<a href='" + data[3][j] + "'>";
            $("#results").append(wikiLink + "> " + data[1][j] + "<br><small>" + data[2][j] + "...</small></a><br><br>");
          }
        }
        down();
      }
    })
  }
}

//input triggers (enterkey 13)
$(function() {
  $("#name-input").keyup(function(event) {
    if (event.which == 13) {
      inputName = document.getElementById('name-input').value;
      userIn(inputName);
      $('#name-input').css("animation", "none");
      down();
    }
  });
});

$(function() {
  $("#search-input").keyup(function(event) {
    if (event.which == 13) {
      searchTerm = document.getElementById('search-input').value;
      $('#search-input').css("animation", "none");
      searchIn(searchTerm);
    }
  });
});

$(function() {
  $("#error-input").keyup(function(event) {
    if (event.which == 13) {
      searchTerm = document.getElementById('error-input').value;
      searchIn(searchTerm);
    }
  });
});

//autoscroll
function down() {
  document.getElementById('results').scrollIntoView();
};

Comments