daily pastebin goal
3%
SHARE
TWEET

Deep.js

a guest May 17th, 2018 114 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. window.addEventListener('load', main(), false);
  2.  
  3. function main() {
  4.     // Main
  5.     let date = new Date();
  6.     let dateString = date.toISOString;
  7.     let txtArray = ["> CALL TRANS OPT: RECEIVED. " + dateString + " REC:LOG>", "> WARNING: CARRIER ANOMALY.", "> TRACE PROGRAM: RUNNING.", "> WAKE UP...", "> THE MATRIX HAS YOU.", "> IT HAS BEEN WATCHING.", "> IT IS TIME FOR YOU TO KNOW THE TRUTH.", "> WILL YOU? (Y / N)"];
  8.     const _SPEED = 100;
  9.  
  10.     wait(5000);
  11.  
  12.     let ul = document.createElement("ul");
  13.     let listClass = document.createAttribute("class");
  14.     listClass.value = "dialog-pane";
  15.     ul.setAttributeNode(listClass);
  16.  
  17.     newChat(txtArray[0], _SPEED, ul);
  18.  
  19.  
  20.     // Chat
  21.     function newChat(string, speed, ulist) {
  22.         let li = document.createElement("li");
  23.         let label = document.createElement("label");
  24.         let prompt = document.createTextNode(">");
  25.         label.appendChild(prompt);
  26.  
  27.         let classAtt = document.createAttribute("class");
  28.         classAtt.value = "message";
  29.         label.setAttributeNode(classAtt);
  30.  
  31.         li.appendChild(label);
  32.  
  33.         ulist.appendChild(li);
  34.  
  35.         typeWriter(string, li, speed);
  36.     }
  37.  
  38.     // Typewrite
  39.     function typeWriter(str, list, spd) {
  40.         let i = 0;
  41.         if (i < str.length) {
  42.             list.innerHTML += str.charAt(i);
  43.             i++;
  44.             setTimeout(typeWriter, spd);
  45.         }
  46.     }
  47.     // Helper
  48.     function wait(ms) {
  49.         let d = new Date();
  50.         let d2 = null;
  51.         do {
  52.             d2 = new Date();
  53.         } while (d2 - d < ms);
  54.     }
  55. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top