Download pool/shard001/JavaScript/0006081_ui.js from Variable-role/sajaniemi_variable_dataset_large: direct link, hf CLI and curl.
- Browser
- Download file 1.17 kB
-
https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard001/JavaScript/0006081_ui.js
- Command line
-
hf download hf://datasets/Variable-role/sajaniemi_variable_dataset_large/pool/shard001/JavaScript/0006081_ui.js
-
curl -L -o 0006081_ui.js https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard001/JavaScript/0006081_ui.js
1.17 kB
| var flight = require('flightjs'); | |
| var template = require('./templates/title.hogan'); | |
| const TYPING_DELAY = 42; | |
| const BASE_TYPING_DELAY = 50; | |
| function helloWorldUI() { | |
| this.attributes({ | |
| }); | |
| this.typewriter = function(str) { | |
| var instance = this; | |
| var textEl = document.querySelector('[data-text]'); | |
| var arr = str.split(''); | |
| var i = 0; | |
| textEl.innerHTML = ''; | |
| setTimeout(function() { | |
| instance.setText(textEl, arr, 0); | |
| }, BASE_TYPING_DELAY); | |
| }; | |
| this.setText = function(el, arr, i) { | |
| var instance = this; | |
| var delay = (TYPING_DELAY * Math.random()) + BASE_TYPING_DELAY; | |
| if (arr[i]) { | |
| el.innerHTML += arr[i]; | |
| i++; | |
| setTimeout(function() { | |
| instance.setText(el, arr, i); | |
| }, delay); | |
| } | |
| }; | |
| this.render = function(name) { | |
| var titleEl = document.querySelector('[data-title]'); | |
| titleEl.innerHTML = template.render({ | |
| name: name | |
| }); | |
| } | |
| this.after('initialize', function() { | |
| this.render('Hanna'); | |
| this.typewriter.call(this, 'Welcome to the Epsilon Eridani system. What would you like to do next?'); | |
| }); | |
| } | |
| module.exports = flight.component(helloWorldUI); | |