PageSourceSearch

https://conecta.bio/v2/assets/vendor/ityped/index.js?v=1.0.9

js conecta.bio collected 2026-10-01 10:46:10 UTC 4,604 bytes, 131 lines download raw bytes

vendor: 4,604 bytes, lines 1-131
1/**
2    * @name ityped
3    * @description Dead simple Animated Typing with no dependencies
4    * @author Luis Vinícius
5    * @email [email protected]
6    */
7(function (global, factory) {
8	typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
9	typeof define === 'function' && define.amd ? define(['exports'], factory) :
10	(factory((global.ityped = {})));
11}(this, (function (exports) { 'use strict';
12
13/**
14 * @name setProps
15 * @description Set the ityped properties configuration
16 * @param {Object} config The configuration properties
17 * @return {Promise}
18 */
19var setProps = function setProps(_ref) {
20  var _ref$strings = _ref.strings,
21      strings = _ref$strings === undefined ? ['Put your strings here...', 'and Enjoy!'] : _ref$strings,
22      _ref$typeSpeed = _ref.typeSpeed,
23      typeSpeed = _ref$typeSpeed === undefined ? 100 : _ref$typeSpeed,
24      _ref$backSpeed = _ref.backSpeed,
25      backSpeed = _ref$backSpeed === undefined ? 50 : _ref$backSpeed,
26      _ref$backDelay = _ref.backDelay,
27      backDelay = _ref$backDelay === undefined ? 500 : _ref$backDelay,
28      _ref$startDelay = _ref.startDelay,
29      startDelay = _ref$startDelay === undefined ? 500 : _ref$startDelay,
30      _ref$cursorChar = _ref.cursorChar,
31      cursorChar = _ref$cursorChar === undefined ? '|' : _ref$cursorChar,
32      _ref$placeholder = _ref.placeholder,
33      placeholder = _ref$placeholder === undefined ? false : _ref$placeholder,
34      _ref$showCursor = _ref.showCursor,
35      showCursor = _ref$showCursor === undefined ? true : _ref$showCursor,
36      _ref$disableBackTypin = _ref.disableBackTyping,
37      disableBackTyping = _ref$disableBackTypin === undefined ? false : _ref$disableBackTypin,
38      _ref$onFinished = _ref.onFinished,
39      onFinished = _ref$onFinished === undefined ? function () {} : _ref$onFinished,
40      _ref$loop = _ref.loop,
41      loop = _ref$loop === undefined ? true : _ref$loop;
42  return {
43    strings: strings,
44    typeSpeed: typeSpeed,
45    backSpeed: backSpeed,
46    cursorChar: cursorChar,
47    backDelay: backDelay,
48    placeholder: placeholder,
49    startDelay: startDelay,
50    showCursor: showCursor,
51    loop: loop,
52    disableBackTyping: disableBackTyping,
53    onFinished: onFinished
54  };
55};
56
57var init = function init(element, properties) {
58  var i = 0,
59      l = void 0,
60      STRINGS_TO_ITERATE = void 0;
61
62  var typewrite = function typewrite(strings, props) {
63    if (i === l) if (props.loop) i = 0;
64    setTimeout(function () {
65      typeString(strings[i], props);
66    }, props.startDelay);
67  };
68
69  var typeString = function typeString(str, props) {
70    var index = 0,
71        strLen = str.length;
72    var intervalID = setInterval(function () {
73      props.placeholder ? element.placeholder += str[index] : element.textContent += str[index];
74      if (++index === strLen) return onStringTyped(intervalID, props);
75    }, props.typeSpeed);
76  };
77
78  var onStringTyped = function onStringTyped(id, props) {
79    clearInterval(id);
80    if (props.disableBackTyping && i === l - 1) {
81      return props.onFinished();
82    }
83    if (!props.loop && i === l - 1) {
84      return props.onFinished();
85    }
86    setTimeout(function () {
87      return eraseString(props);
88    }, props.backDelay);
89  };
90
91  var eraseString = function eraseString(props) {
92    var str = props.placeholder ? element.placeholder : element.textContent,
93        strLen = str.length;
94    var intervalID = setInterval(function () {
95      props.placeholder ? element.placeholder = element.placeholder.substr(0, --strLen) : element.textContent = str.substr(0, --strLen);
96      if (strLen === 0) return onStringErased(intervalID, props);
97    }, props.backSpeed);
98  };
99
100  var onStringErased = function onStringErased(id, props) {
101    clearInterval(id);
102    ++i;
103    typewrite(STRINGS_TO_ITERATE, props);
104  };
105
106  var setCursor = function setCursor(element, props) {
107    var cursorSpan = document.createElement('span');
108    cursorSpan.classList.add('ityped-cursor');
109    cursorSpan.textContent = '|';
110    cursorSpan.textContent = props.cursorChar;
111    element.insertAdjacentElement('afterend', cursorSpan);
112  };
113
114  var startTyping = function startTyping(prop) {
115    var props = setProps(prop || {});
116    var strings = props.strings;
117    STRINGS_TO_ITERATE = strings;
118    l = strings.length;
119    if (typeof element === "string") element = document.querySelector(element);
120    if (props.showCursor) setCursor(element, props);
121    typewrite(strings, props);
122  };
123
124  return startTyping(properties);
125};
126
127exports.init = init;
128
129Object.defineProperty(exports, '__esModule', { value: true });
130
131})));

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.