for (var i = 0; i < arrClassNames.length; i++) {
1614 var className = arrClassNames[i]; 1616 // HTML 5 compliant browsers 1617 if (document.body.classList) { 1618 element.classList.add(className); 1620 // legacy browsers (IE<10) support 1621 element.className += (element.className ? ' ' : '') + className; 1627 * Method classList.remove for IE8+ 1629 * @param {Node} element - element remove class 1630 * @param {string} className - class name 1633 function t_removeClass(element, className) { 1634 // HTML 5 compliant browsers 1635 if (document.body.classList) { 1636 element.classList.remove(className); 1639 // legacy browsers (IE<10) support 1640 element.className = element.className 1641 .replace(new RegExp('(^|\\s+)' + className + '(\\s+|$)'), ' ') 1642 .replace(/^\s+/, '') 1643 .replace(/\s+$/, ''); 1647 * Method remove() for IE8+ 1649 * @param {Node} element - remove element 1651 function t_removeEl(element) { 1652 if (element && element.parentNode) { 1653 element.parentNode.removeChild(element); 1657 function t_initScaleFactorFlag() { 1658 if (typeof window.shouldUseScaleFactor !== 'undefined') return; 1659 var firefoxMatch = window.navigator.userAgent.match(/Firefox\/([0-9]+)\./); 1660 var firefoxVersion = firefoxMatch ? parseInt(firefoxMatch[1], 10) : 126; 1661 var isChrome = window.navigator.userAgent.match(/Chrome\/([0-9]+)\./); 1662 var chromeVersion = (isChrome && parseInt(isChrome[1], 10)) || 0; 1663 window.isOnlyScalable = firefoxVersion < 126; 1664 window.shouldUseScaleFactor = !window.isOnlyScalable && !firefoxMatch && chromeVersion <= 127; 1668 * Method fade in for IE8+ 1670 * @param {Node} element - element animation 1671 * @param {number} duration - speed animation 1672 * @param {Function} complete - call function after end animation 1675 function t_fadeIn(element, duration, complete) { 1676 var elementStyle = getComputedStyle(element, null); 1678 if (elementStyle.display !== 'block' || elementStyle.opacity === '1' || elementStyle.opacity === '') return; 1680 duration = parseInt(duration); 1683 var speed = duration > 0 ? duration / 10 : 40; 1685 element.style.opacity = opacity; 1686 element.style.display = 'block'; 1688 var timer = setInterval(function () { 1689 element.style.opacity = opacity; 1691 if (opacity >= 1.0) { 1692 clearInterval(timer); 1693 if (typeof complete === 'function') {