Advertisement
Guest User

Homestuck Pesterlog Simulator

a guest
Apr 7th, 2020
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         Homestuck Pesterlog Simulatior
  3. // @namespace    http://tampermonkey.net/
  4. // @version      0.1
  5. // @description  Simulates the scrolling pesterlog.
  6. // @author       Cal Kalum
  7. // @match        https://www.homestuck.com/story/*
  8. // @grant        none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12.     'use strict';
  13.     let pElements = document.getElementsByTagName('p');
  14.     console.log(pElements);
  15.     let spans = [];
  16.     for(let i = 0; i < pElements.length; i++){
  17.         let spancheck = pElements[i].children;
  18.         for(let j = 0; j < spancheck.length; j++){
  19.             console.log(spancheck[j]);
  20.             if(spancheck[j].tagName === "SPAN"){
  21.                 spans.push(spancheck[j]);
  22.                 spans[spans.length - 1].style.transition = "0.3s";
  23.                 spans[spans.length - 1].style.opacity = 0;
  24.             }
  25.         }
  26.     }
  27.     console.log(spans);
  28.     // Your code here...
  29.     let spanIndex = 0;
  30.     document.addEventListener("keydown", function (e) {
  31.         if(e.key ==='Enter'){
  32.             spans[spanIndex].style.opacity = 1;
  33.             spanIndex++;
  34.         }
  35.     });
  36. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement