let conv = [ { "when": "1 days ago", "who": "Dorian", "from": "United States", "what": "The Reiki Master Course", },{ "when": "2 days ago", "who": "Carla", "from": "United States", "what": "The Reiki Master Course", },{ "when": "3 days ago", "who": "Lucy", "from": "United States", "what": "The Reiki Master Course", },{ "when": "3 days ago", "who": "Someone", "from": "United States", "what": "The Reiki Master Course", },{ "when": "3 days ago", "who": "Someone", "from": "United States", "what": "The Reiki Master Course", },{ "when": "4 days ago", "who": "Henriette", "from": "United States", "what": "The Reiki Master Course", },{ "when": "4 days ago", "who": "Someone", "from": "Australia", "what": "The Reiki Master Course", },{ "when": "4 days ago", "who": "Someone", "from": "United States", "what": "The Reiki Master Course", },{ "when": "5 days ago", "who": "Alison", "from": "United States", "what": "The Reiki Master Course", },{ "when": "5 days ago", "who": "Someone", "from": "Australia", "what": "The Reiki Master Course", },{ "when": "5 days ago", "who": "Someone", "from": "United States", "what": "The Reiki Master Course", },{ "when": "6 days ago", "who": "Lara", "from": "United States", "what": "The Reiki Master Course", },{ "when": "6 days ago", "who": "Someone", "from": "United Kingdom", "what": "The Reiki Master Course", },{ "when": "6 days ago", "who": "Someone", "from": "United States", "what": "The Reiki Master Course", },{ "when": "6 days ago", "who": "Someone", "from": "United States", "what": "The Reiki Master Course", },{ "when": "6 days ago", "who": "Someone", "from": "United States", "what": "The Reiki Master Course", },{ "when": "6 days ago", "who": "Someone", "from": "United States", "what": "The Reiki Master Course", },{ "when": "7 days ago", "who": "Mary", "from": "United States", "what": "The Reiki Master Course", },{ "when": "7 days ago", "who": "Someone", "from": "United Kingdom", "what": "The Reiki Master Course", },{ "when": "7 days ago", "who": "Someone", "from": "United States", "what": "The Reiki Master Course", },{ "when": "9 days ago", "who": "Someone", "from": "United States", "what": "The Reiki Master Course", },{ "when": "9 days ago", "who": "Someone", "from": "United States", "what": "The Reiki Master Course", },{ "when": "9 days ago", "who": "Someone", "from": "United States", "what": "The Reiki Master Course", },{ "when": "9 days ago", "who": "Lisa", "from": "United States", "what": "The Reiki Master Course", },{ "when": "9 days ago", "who": "Someone", "from": "United States", "what": "The Reiki Master Course", },{ "when": "9 days ago", "who": "Someone", "from": "United States", "what": "The Reiki Master Course", },{ "when": "9 days ago", "who": "Someone", "from": "United States", "what": "The Reiki Master Course", },{ "when": "9 days ago", "who": "Someone", "from": "United States", "what": "The Reiki Master Course", },{ "when": "9 days ago", "who": "Someone", "from": "United States", "what": "The Reiki Master Course", },{ "when": "10 days ago", "who": "Someone", "from": "United States", "what": "The Reiki Master Course", },{ "when": "10 days ago", "who": "Someone", "from": "United States", "what": "The Reiki Master Course", },{ "when": "12 days ago", "who": "Alina", "from": "United Kingdom", "what": "The Reiki Master Course", },{ "when": "12 days ago", "who": "Someone", "from": "United States", "what": "The Reiki Master Course", },{ "when": "12 days ago", "who": "Someone", "from": "United States", "what": "The Reiki Master Course", },{ "when": "13 days ago", "who": "Someone", "from": "United States", "what": "The Reiki Master Course", },{ "when": "13 days ago", "who": "Someone", "from": "United States", "what": "The Reiki Master Course", },{ "when": "14 days ago", "who": "Sandy", "from": "United States", "what": "The Reiki Master Course", },{ "when": "14 days ago", "who": "Someone", "from": "United Kingdom", "what": "The Reiki Master Course", },{ "when": "14 days ago", "who": "Someone", "from": "United States", "what": "The Reiki Master Course", },{ "when": "15 days ago", "who": "Someone", "from": "United States", "what": "The Reiki Master Course", },{ "when": "15 days ago", "who": "Someone", "from": "United States", "what": "The Reiki Master Course", },{ "when": "15 days ago", "who": "Someone", "from": "United States", "what": "The Reiki Master Course", },{ "when": "16 days ago", "who": "Someone", "from": "United States", "what": "The Reiki Master Course", },{ "when": "16 days ago", "who": "Someone", "from": "United States", "what": "The Reiki Master Course", },{ "when": "16 days ago", "who": "Someone", "from": "United States", "what": "The Reiki Master Course", }, ] let convIndex = 0 let widget = `

${conv[0].who} from ${conv[0].from}

bought ${conv[0].what} recently

${conv[0].when}

` let css = ` .conversion-widget { font-family: Helvetica, sans-serif; font-size: 14px; display: flex; background-color: white; border: 1px solid #eee; border-radius: 12px; box-shadow: 0 4px 12px rgba(120, 120, 120, 0.3); color: #4a4a4a; padding: 10px; z-index: 99; flex-direction: row; } .conversion-widget img { display: flex; height: 70px; width: 70px; } #conversion-widget-right { width: 100%; } .conversion-widget .conversion-brand a { display: flex; color: #51c2d5; text-decoration: none; } .conversion-widget .conversion-brand { display: flex; justify-content: flex-end; align-items: center; font-size: 12px; margin: 0 18px; } .conversion-widget .conversion-brand svg{ display: flex; height: 25px; width: 25px; } .conversion-widget.conversion-widget-bottom-right { position: fixed; bottom: 10px; right: 10px; } .conversion-widget.conversion-widget-bottom-left { position: fixed; top: 0px; left: 0px; width: 100%; } .conversion-widget #conversion-head span { font-size: 15px; font-weight: bold; color: #222222; text-align: left; padding: 0; } .conversion-widget p { margin: 2px 8px !important; } #conversion-when { color: rgb(187, 187, 187); } @media only screen and (min-width: 700px) { .conversion-widget.conversion-widget-bottom-left { position: fixed; top: auto; bottom: 10px; left: 10px; width: auto; } } .conversion-fade-in { animation: conversion-fadeIn ease 2s forwards; -webkit-animation: conversion-fadeIn ease 2s forwards; -moz-animation: conversion-fadeIn ease 2s forwards; -o-animation: conversion-fadeIn ease 2s forwards; -ms-animation: conversion-fadeIn ease 2s forwards; } @keyframes conversion-fadeIn { 0% {opacity:0;} 100% {opacity:1;} } @-moz-keyframes conversion-fadeIn { 0% {opacity:0;} 100% {opacity:1;} } @-webkit-keyframes conversion-fadeIn { 0% {opacity:0;} 100% {opacity:1;} } @-o-keyframes conversion-fadeIn { 0% {opacity:0;} 100% {opacity:1;} } @-ms-keyframes conversion-fadeIn { 0% {opacity:0;} 100% {opacity:1;} } .conversion-fade-out { animation: conversion-fadeOut ease 2s forwards; -webkit-animation: conversion-fadeOut ease 2s forwards; -moz-animation: conversion-fadeOut ease 2s forwards; -o-animation: conversion-fadeOut ease 2s forwards; -ms-animation: conversion-fadeOut ease 2s forwards; } @keyframes conversion-fadeOut { 0% {opacity:1;} 100% {opacity:0;} } @-moz-keyframes conversion-fadeOut { 0% {opacity:1;} 100% {opacity:0;} } @-webkit-keyframes conversion-fadeOut { 0% {opacity:1;} 100% {opacity:0;} } @-o-keyframes conversion-fadeOut { 0% {opacity:1;} 100% {opacity:0;} } @-ms-keyframes conversion-fadeOut { 0% {opacity:1;} 100% {opacity:0;} } ` function triggerHide() { setTimeout(function(){ document.getElementById("conversion-widget").classList.add("conversion-fade-out") document.getElementById("conversion-widget").classList.remove("conversion-fade-in") triggerNext() }, 6000); } function triggerNext() { setTimeout(function(){ convIndex++ if (convIndex >= conv.length) { convIndex =0 } document.getElementById("conversion-who").innerHTML = `${conv[convIndex].who}` document.getElementById("conversion-from").innerHTML = `${conv[convIndex].from}` document.getElementById("conversion-when").innerHTML = conv[convIndex].when document.getElementById("conversion-what").innerHTML = conv[convIndex].what document.getElementById("conversion-widget").classList.add("conversion-fade-in") document.getElementById("conversion-widget").classList.remove("conversion-fade-out") triggerHide() }, 6000); } setTimeout(function(){ let style = document.createElement('style'); style.innerHTML = css var head = document.getElementsByTagName("head")[0] head.append(style) let body = document.getElementsByTagName("body")[0] body.insertAdjacentHTML('beforeend', widget); document.getElementById("conversion-widget").classList.add("conversion-fade-in") triggerHide() }, 5000);