Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>Fast Text Reader</title>
- <style>
- #text_input {
- border: 1px solid #CCCCCC;
- outline: none;
- width: 500px;
- height: 300px;
- padding: 5px;
- margin: 0px;
- overflow-y: scroll;
- color: #000000;
- background-color: #FFFFFF;
- font-family: Arial;
- font-size: 14px;
- resize: none;
- }
- #text_reader {
- border: 1px solid #CCCCCC;
- outline: none;
- width: 510px;
- height: 60px;
- padding: 0px;
- margin: 0px;
- overflow: none;
- color: #000000;
- background-color: #FFFFFF;
- font-family: Arial;
- font-size: 40px;
- text-align: center;
- line-height: 60px;
- resize: none;
- cursor: default;
- }
- #text_speed_show {
- font-family: Arial;
- font-size: 14px;
- }
- </style>
- <script>
- var data, it, interval, speed, cronometru;
- document.addEventListener("readystatechange", function(e) {
- if (document.readyState == "complete") {
- data = new Array();
- document.querySelector("#text_start").addEventListener("click", function(e) {
- it = 0;
- speed = document.querySelector("#text_speed").value;
- if (interval == null) {
- document.querySelector("#text_start").disabled = true;
- document.querySelector("#text_speed").disabled = true;
- document.querySelector("#text_input").disabled = true;
- interval = setInterval(function() {
- if (it < data.length)
- document.querySelector("#text_reader").value = data[it++];
- else {
- clearInterval(interval);
- interval = null;
- document.querySelector("#text_start").disabled = false;
- document.querySelector("#text_speed").disabled = false;
- document.querySelector("#text_input").disabled = false;
- }
- }, speed);
- }
- });
- document.querySelector("#text_input").addEventListener("input", function(e) {
- data = document.querySelector("#text_input").value.replace(/\s+/g, " ").split(" ");
- var info = document.querySelector("#text_speed");
- var time = new Date(data.length * info.value);
- document.querySelector("#text_speed_show").innerHTML = info.value + "ms delay, " + data.length + " tokens, time to read: " + time.getUTCHours() + "h " + time.getUTCMinutes() + "m " + time.getUTCSeconds() + "s";
- });
- document.querySelector("#text_speed").addEventListener("change", function(e) {
- var info = this;
- var time = new Date(data.length * info.value);
- document.querySelector("#text_speed_show").innerHTML = info.value + "ms delay, " + data.length + " tokens, time to read: " + time.getUTCHours() + "h " + time.getUTCMinutes() + "m " + time.getUTCSeconds() + "s";
- });
- document.querySelector("#crono").addEventListener("click", function(e) {
- if (cronometru) {
- var time = new Date(new Date() - cronometru);
- alert(time.getUTCHours() + "h " + time.getUTCMinutes() + "m " + time.getUTCSeconds() + "s");
- cronometru = null;
- }
- else
- cronometru = new Date();
- });
- }
- });
- </script>
- </head>
- <body>
- <textarea id="text_input" value="" spellcheck="false"></textarea>
- <br>
- <textarea id="text_reader" disabled="true" spellcheck="false"></textarea>
- <br>
- <input id="text_speed" type="range" min="100" max="1000" value="500"></input>
- <div id="text_speed_show">Set text speed</div>
- <br>
- <button id="text_start">Start reading</button>
- <button id="crono">Start/Stop stopwatch</button>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment