9101* Remove the opacity value from the color string9102*9103* @param {string} color - the color to remove the opacity from.9104* @returns {string} - the original color string with the opacity value removed.9105**/9106function t_store_removeRgbOpacity(color) {9107if (!color || !color.length) {9108return null;9109}91109111var result = color.split(',');9112
if (result[3]) { result[3] = '1)'; } return result.join();}/** * Parsing the URL and extracting the query parameters * * @returns {object} JSON **/function t_store_snippet_getJsonFromUrl() { var url = window.location.search; var query = url.substring(1); var result = {}; query.split('&').forEach(function (part) { var item = part.split('='); try { result[item[0]] = decodeURIComponent(item[1]); /* TODO: item[1].replace(/%(?![0-9][0-9a-fA-F]+)/g, '%25') */ } catch (error) { console.error(error); result[item[0]] = item[1]; } }); return result;}/** * Clean the price value * * @param {number|string} priceToClean * @returns {number} clean price **/function t_store__cleanPrice(priceToClean) { var price = priceToClean; if (price) { price = price.toString(); price = price.replace(',', '.').replace(/[^0-9.]/g, ''); price = parseFloat(price).toFixed(2); if (isNaN(price)) price = 0; price = parseFloat(price); price = price * 1; if (price < 0) price = 0; } else { price = 0; } return price;}/** * Remove the element from the DOM * * @param {HTMLElement} el - The element to remove **/function t_store__removeElement(el) { if (el && el.parentNode) { el.parentNode.removeChild(el); }}/** * Fade in an element * * @param {HTMLElement} el - the element to fade * @param {number} [duration] - the duration of the animation in milliseconds, default is 200ms * @returns {boolean|*} false **/function t_store__fadeIn(el, animationDuration) { if ( (getComputedStyle(el).opacity === '1' || getComputedStyle(el).opacity === '') && getComputedStyle(el).display !== 'none' ) return false; var opacity = 0; var duration = animationDuration; if (!duration) { duration = 200; } duration = parseInt(duration); var speed = duration > 0 ? duration / 10 : 40; el.style.opacity = opacity; el.style.display = 'block'; var timer = setInterval(function () {