1/* 2author: @jiangwen5945 & EvanNotFound 3*/ 4export const config = { 5 usrTypeSpeed: theme.home_banner.subtitle.typing_speed, 6 usrBackSpeed: theme.home_banner.subtitle.backing_speed, 7 usrBackDelay: theme.home_banner.subtitle.backing_delay, 8 usrStartDelay: theme.home_banner.subtitle.starting_delay, 9 usrLoop: theme.home_banner.subtitle.loop, 10 usrSmartBackspace: theme.home_banner.subtitle.smart_backspace, 11 usrHitokotoAPI: theme.home_banner.subtitle.hitokoto.api, 12}; 13 14export default function initTyped(id) { 15 const { 16 usrTypeSpeed, 17 usrBackSpeed, 18 usrBackDelay, 19 usrStartDelay, 20 usrLoop, 21 usrSmartBackspace, 22 usrHitokotoAPI, 23 } = config; 24 25 function typing(dataList) { 26 const st = new Typed("#" + id, { 27 strings: [dataList], 28 typeSpeed: usrTypeSpeed || 100, 29 smartBackspace: usrSmartBackspace || false, 30 backSpeed: usrBackSpeed || 80, 31 backDelay: usrBackDelay || 1500, 32 loop: usrLoop || false, 33 startDelay: usrStartDelay || 500, 34 }); 35 } 36 37 if (theme.home_banner.subtitle.hitokoto.enable) { 38 fetch(usrHitokotoAPI) 39 .then((response) => response.json()) 40 .then((data) => { 41 typing(data.hitokoto); 42 }) 43 .catch(console.error); 44 } else { 45 const sentenceList = [...theme.home_banner.subtitle.text]; 46 if (document.getElementById(id)) { 47 const st = new Typed("#" + id, { 48 strings: sentenceList, 49 typeSpeed: usrTypeSpeed || 100, 50 smartBackspace: usrSmartBackspace || false, 51 backSpeed: usrBackSpeed || 80, 52 backDelay: usrBackDelay || 1500, 53 loop: usrLoop || false, 54 startDelay: usrStartDelay || 500, 55 }); 56 } 57 } 58}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.