if (typeof __mpu == 'undefined') var __mpu = [`48033`, `www.rafaelcortez.com`]; (function() { function MyPopUpsInternalScript() { let hostb4 = __mpu[1].toLowerCase(); let hostcr = document.location.host.toLowerCase(); if (hostb4.slice(0, 4) === 'www.') hostb4 = hostb4.slice(4); if (hostcr.slice(0, 4) === 'www.') hostcr = hostcr.slice(4); if (__mpu[0] != `48033`) return; if (hostb4 != hostcr) return; // start popup html var styleEl = document.createElement('style'); var styleElCustomCss = document.createElement('style'); var styleButtonForOwner = document.createElement('style'); var linkEl = document.createElement('link'); var scriptEl = document.createElement('script'); var adBanner = document.createElement('div'); var formInputStyle = document.createElement('style'); styleElCustomCss.innerHTML = ``; styleEl.innerHTML = ` #mypopups-substrate-100397 { margin: 0; padding: 0; border: 0; font-size: 100%; font: inherit; vertical-align: baseline; text-transform: none; } .mypopups-substare p{ margin-top: 0; margin-bottom: 0; } .mypopups-substare :focus { outline: 0; } .mypopups-substare ol, .mypopups-substare ul { list-style: none; } .mypopups-substare em{ font-style: italic !important; } .mypopups-substare p:not(:first-child) { line-height: normal; } .mypopups-substare blockquote, .mypopups-substare q { quotes: none; } .mypopups-substare blockquote:before, .mypopups-substare blockquote:after, .mypopups-substare q:before, .mypopups-substare q:after { content: ''; content: none; } .mypopups-substare button { text-transform: none; background-image: none; } .mypopups-substare input{ padding: 0; max-width: none !important; } .mypopups-substare { display: none; } .mypopups-substare .div[data-vimeo-initialized] iframe, .mypopups-substare .vimeo-pl-mp { width: 100%; height: 100%; } .mypopups-substare .text-linked { color: #1daa7e !important; cursor: pointer; text-decoration: none; } .mypopups-substare .text-linked:hover { color: #363636 !important; } @media (max-width: 768px) { #mypopups-substrate-100397 { display: none !important; } } @media (min-width: 768px) { } `; var styleLink = 'https://mypopups.com/embed/style.css?r=' + Date.now(); var googleFonts = `https://fonts.googleapis.com/css2?family=Abril+Fatface&family=Archivo:ital,wght@0,400;0,700;1,400;1,700&family=Arvo:ital,wght@0,400;0,700;1,400;1,700&family=Cardo:ital,wght@0,400;0,700;1,400&family=Concert+One&family=Cormorant+Garamond:ital,wght@0,400;0,700;1,400;1,700&family=Fjalla+One&family=Frank+Ruhl+Libre:wght@400;500;700;900&family=Karla:ital,wght@0,400;0,700;1,400;1,700&family=Lato:ital,wght@0,400;0,900;1,400;1,900&family=Lora:ital,wght@0,400;0,700;1,400;1,700&family=Montserrat:ital,wght@0,400;0,800;1,400;1,800&family=Oswald:wght@400;700&family=PT+Serif:ital,wght@0,400;0,700;1,400;1,700&family=Playfair+Display:ital,wght@0,400;0,800;1,400;1,800&family=Rakkas&family=Roboto:ital,wght@0,400;0,900;1,400;1,900&family=Rubik:ital,wght@0,400;0,900;1,400;1,900&family=Source+Sans+Pro:ital,wght@0,400;0,900;1,400;1,900&family=Spectral:ital,wght@0,400;0,800;1,400;1,800&family=Ubuntu:ital,wght@0,400;0,700;1,400;1,700&family=Work+Sans:ital,wght@0,400;0,800;1,400;1,800&family=Yatra+One&display=swap`; var fontsLink = googleFonts; var styles = document.createElement('link'); var googleFontsLinkEl = document.createElement('link'); googleFontsLinkEl.setAttribute('href', fontsLink); googleFontsLinkEl.setAttribute('rel', 'stylesheet'); googleFontsLinkEl.setAttribute('type', 'text/css'); styles.setAttribute('rel', 'stylesheet'); styles.setAttribute('type', 'text/css'); styles.setAttribute('href', styleLink); document.head.appendChild(styles); document.head.appendChild(googleFontsLinkEl); document.head.appendChild(formInputStyle); styleButtonForOwner.innerHTML = ` @font-face { font-family: "ProximaNova-Lt"; src: url('https://mypopups.com/fonts/ProximaNova-Light.woff2'); font-weight: normal; font-style: normal; } @font-face { font-family: "Proxima Nova Rg"; src: url('https://mypopups.com/fonts/ProximaNova-Regular.woff2'); font-weight: normal; font-style: normal; } .test-wrp { width: 278px; box-shadow: 0 5px 30px rgba(61, 63, 86, 0.25); border-radius: 5px; background-color: #fff; display: flex; z-index: 35; align-items: center; flex-direction: column; } .test-wrp .test-title { color: #808191; font-size: 15px; font-weight: 600; padding-top: 20px; padding-bottom: 11px; } .test-wrp .test-description { color: #808191; font-size: 13px; font-weight: 400; line-height: 20px; width: 230px; text-align: center; padding-bottom: 11px; } .test-wrp .test-btn { width: 141px; height: 39px; border-radius: 5px; background-color: #1eaa7e; color: #fff; font-size: 13px; font-weight: 600; font-family: Helvetica, Arial, sans-serif; cursor: pointer; display: flex; align-items: center; justify-content: center; } .test-wrp .test-bottom { color: #b9b9bd; font-size: 11px; font-weight: 400; line-height: 20px; padding-top: 11px; padding-bottom: 9px; } `; scriptEl.type = 'text/javascript'; linkEl.rel = 'stylesheet'; linkEl.type = 'text/css'; linkEl.href = "https://mypopups.com/static/libraries/animate/animate.css"; linkEl.media = 'all'; adBanner.className = 'adBanner'; adBanner.style.height = '1px'; adBanner.style.width = '1px'; adBanner.style.background = 'transparency'; document.querySelector('head').appendChild(styleEl); document.querySelector('head').appendChild(styleElCustomCss); document.querySelector('head').appendChild(styleButtonForOwner); document.querySelector('head').appendChild(linkEl); document.querySelector('body').appendChild(adBanner); document.querySelector('body').appendChild(scriptEl); let toPrepend = `

RAFAEL CORTEZ

Contrate sua palestra ATITUDE TRANSFORMADORA!

`; toPrepend = toPrepend.replace(/"null"/g, ''); toPrepend = toPrepend.replace(/"undefined"/g, ''); toPrepend = toPrepend.replace(/\"null\"/g, ''); toPrepend = toPrepend.replace(/\"undefined\"/g, ''); toPrepend = toPrepend.replace(/undefined/g, '""'); document.body.insertAdjacentHTML('afterbegin', toPrepend); document.querySelector('#mypopups-substrate-100397').style.display = 'none'; let img_rgx = new RegExp(`url\((?!['"]?(?:data):)['"]?([^'"\)]*)['"]?\)`, 'g'); let img_urls = toPrepend.match(img_rgx), img_loaded = false, img_length = img_urls.length; let img_temp = []; for (let i = 0; i < img_urls.length; i++) { let url = img_urls[i].slice(4) .slice(0, -1) .replace(/(\"\;)/g, '') .replace(/(\")/g, ''); if (url && url != 'null' && url != 'undefined' && url.trim().length > 0) { img_temp[i] = new Image(); img_temp[i].src = url; img_temp[i].onload = addIMGLoad; img_temp[i].onerror = addIMGLoad; } else img_length--; } function addIMGLoad() { img_loaded++; if (img_length == img_loaded) showThePopups(); } if (img_length <= 0) showThePopups(); // start video script var blockPlMp, elementPlMp, syoutube = document.createElement('script'); syoutube.setAttribute('src','https://www.youtube.com/player_api'); document.head.appendChild(syoutube); window.onYouTubePlayerAPIReady = function() { blockPlMp = []; elementPlMp = document.querySelectorAll('.youtube-pl-mp'); elementPlMp.forEach((element, i) => { blockPlMp[i] = 0; new YT.Player(element.id, { width: element.getAttribute('data-width'), height: element.getAttribute('data-height'), videoId: element.getAttribute('data-id'), playerVars : { autoplay: element.getAttribute('data-autoplay'), controls: element.getAttribute('data-controls'), }, events: { onStateChange : function(event){ if(event.data == 0 && blockPlMp[i] == 0){ blockPlMp[i] = 1; eval(element.getAttribute('data-action')); } } } }); }); } var svimeo = document.createElement('script'); svimeo.setAttribute('src','https://player.vimeo.com/api/player.js'); document.head.appendChild(svimeo); svimeo.onload = function() { elementPlMp = document.querySelectorAll('.vimeo-pl-mp'); elementPlMp.forEach((element, i) => { var id = element.id; var dataId = element.getAttribute('data-id'); var width = element.getAttribute('data-width'); var height = element.getAttribute('data-height'); var autoplay = element.getAttribute('data-autoplay'); var controls = element.getAttribute('data-controls'); new Vimeo.Player(id, { id: dataId, width: width, height: height, autoplay: autoplay, controls: controls, loop: false }).on('ended', function(){ eval(element.getAttribute('data-action')); }); }); }; // end video script // start display rules advanced script function mpu_get_stats_for_advanced_user_display() { function getEU() { let languagesEU = { bg: ['български', 'Bulgarian'], fr: ['français', 'French'], pl: ['polski', 'Polish'], cs: ['česky', 'Czech'], hr: ['hrvatski', 'Croatian'], pt: ['português', 'Portuguese'], da: ['dansk', 'Danish'], hu: ['magyar', 'Hungarian'], ro: ['română', 'Romanian'], de: ['Deutsch', 'German'], is: ['íslenska', 'Icelandic'], ru: ['pусский', 'Russian'], et: ['eesti', 'Estonian'], it: ['italiano', 'Italian'], sk: ['slovenčina', 'Slovak'], el: ['ελληνικά', 'Greek'], lt: ['lietuvių', 'Lithuanian'], sl: ['slovenščina', 'Slovenian'], es: ['español', 'Spanish'], lv: ['latviešu', 'Latvian'], sv: ['svenska', 'Swedish'], fi: ['suomi', 'Finnish'], nl: ['Nederlands', 'Dutch'] } let userLanguages = JSON.parse(JSON.stringify(navigator.languages)); let possibleLanguages = []; let euKeys = Object.keys(languagesEU); let systemInfo = Intl.DateTimeFormat().resolvedOptions(); let systemLocale = systemInfo.locale; let systemTimezone = systemInfo.timeZone; systemInfo.browserLanguages = userLanguages; if (!userLanguages.includes(systemLocale)) { userLanguages.push(systemLocale); } for (let i = 0; i < userLanguages.length; ++i) { let language = userLanguages[i].toLowerCase(); for (let j = 0; j < euKeys.length; ++j) { let languageKey = euKeys[j]; if (language.includes(languageKey)) { let sL = languagesEU[languageKey]; let languageName = sL[0][0].toUpperCase() + sL[0].slice(1); let languageEnglishName = sL[1]; possibleLanguages.push(`${languageEnglishName} (${languageName})`); } } } let inEU = false; if (possibleLanguages.length > 0) { inEU = true; } else if (systemTimezone.includes('Europe')) { inEU = true; } return { inEU: inEU, sourceLang: userLanguages, sourceSys: systemInfo } } let data = { url: window.location, cpu: window.navigator.hardwareConcurrency || -1, screen: { w: window.screen.width, h: window.screen.height, wInner: window.innerWidth, hInner: window.innerHeight }, eu: getEU(), type: 'S' } return data; } // end display rules advanced script // start before rules window['isShowId100397'] = true; let alredyCountedCoversion = false; window['mpu_uuid_mypopups-substrate-100397'] = `6d908d50-b949-11ed-9256-005056008dab`; window['hideModal100397'] = function() { document.querySelector('#mypopups-substrate-100397').style.display = 'none'; if (document.querySelector('#mypopups-substrate-100397').getAttribute('positioning') === 'full-screen') { document.body.style.overflow = `auto`; } localStorage.removeItem('time100397') checkPriority() }; function checkPriority(){ if(localStorage.getItem('mp-priority100397') === '3'){ } } window['showModal100397'] = function() { if ((0 === 0 && window.innerWidth > 768) || (0 === 1 && window.innerWidth < 768)) { let currentPopup = document.querySelector(`#mypopups-substrate-100397`); document.querySelector('#mypopups-substrate-100397').style.display = 'flex'; document.querySelector('#mypopups-modal-100397').setAttribute('timeopen', Math.round(Date.now() / 1000)); window['setstat'](100397, 1, 0 , `6d908d50-b949-11ed-9256-005056008dab`); if (document.querySelector('#mypopups-substrate-100397').getAttribute('positioning') === 'full-screen'){ document.body.style.overflow = `hidden`; document.getElementsByClassName('powered-by-link')[0].style.bottom = '0px' } } }; window['setstat'] = function(id, seen = 0, engaged = 0, uId = 0){ var url = window.location.pathname; var datenow = Math.round(Date.now() / 1000); var stats = localStorage.getItem('statsid-'+id) || '{}'; stats = JSON.parse(stats); if(!stats['url['+ url +']time-'+datenow]){ stats['url['+ url +']time-'+datenow] = {"engaged":0,"seen":0,"time":0,"url":""}; stats['url['+ url +']time-'+datenow].seen += seen; stats['url['+ url +']time-'+datenow].time = datenow; stats['url['+ url +']time-'+datenow].url = window.location.pathname; if(engaged > 0 && alredyCountedCoversion === false){ stats['url['+ url +']time-'+datenow].engaged += engaged; alredyCountedCoversion = true; } localStorage.setItem('statsid-' + id, JSON.stringify(stats)); } if (engaged > 0) { var convertedThemes = JSON.parse(localStorage.getItem('convertedThemes100397')) ? JSON.parse(localStorage.getItem('convertedThemes100397')) : []; if(!convertedThemes.some(themeId => themeId === id.toString())) convertedThemes.push(id.toString()); localStorage.setItem('convertedThemes100397', JSON.stringify(convertedThemes)); } sendStatistic(id, uId); }; setTimeout(function () { sendStatistic(100397, 0, 'S'); window.addEventListener('visibilitychange', function() { if (document.visibilityState === 'hidden') { sendStatistic(100397, 0, 'E'); } }); window.addEventListener('beforeunload', function() { sendStatistic(100397, 0, 'E'); }); window.addEventListener('unload', function() { sendStatistic(100397, 0, 'E'); }); }); window['subscribe'] = function(e) { if (e.type !== 'submit') { return; } var options = {}; var merges = {}; let id_of_the_event = e.target.closest('.mypopups-substare').getAttribute('id'); let real_uuid = window['mpu_uuid_' + id_of_the_event]; e.target.querySelectorAll('input').forEach(function(element){ if(element.getAttribute('data-options') == 'true') options[element.name] = element.value; else merges[element.name] = element.value; }); var data = JSON.stringify({ code: 'bd438336-ef10-11e9-a6e4-005056008dab', // sub: '6d908d50-b949-11ed-9256-005056008dab', sub: real_uuid, options: options, merge_fields: merges, }); fetch("https://mypopups.com/api/embed/subscribe", { method: 'POST', headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' }, body: data }).then((response) => { // TODO: rewrite, need put in one element var postSubmitAction = e.target.parentNode.getAttribute('on-post-submit'); var onPostSubmitStatistic = e.target.parentNode.getAttribute('on-post-submit-statistic'); if (postSubmitAction) { eval(postSubmitAction); } if (onPostSubmitStatistic) { eval(onPostSubmitStatistic); } }); } window['onsubmitFollowIt'] = function(e){ var postSubmitAction = e.target.parentNode.getAttribute('on-post-submit'); var onPostSubmitStatistic = e.target.parentNode.getAttribute('on-post-submit-statistic'); if (postSubmitAction) { var data = {}; var additionalFields = {}; data['coming_from_url'] = window.location.href; data['feed_code'] = e.target.elements['feed_code'].value; e.target.querySelectorAll('input').forEach(function(input){ switch(input.name) { case "EMAIL": data['email'] = btoa(input.value); break; case "4EktDwr3De": break; case "feed_code": break; default: additionalFields[input.name] = input.value; } }); if(Object.keys(additionalFields).length > 0) data.other_fields = additionalFields; var userInfo = JSON.stringify(data) var xhr = new XMLHttpRequest(); xhr.open("POST", 'https://api.follow.it/api/user/feed/follow/mpu/subscription_form', true); xhr.setRequestHeader('Content-Type', 'application/json'); xhr.send(userInfo); eval(postSubmitAction); } if (onPostSubmitStatistic) { eval(onPostSubmitStatistic); } } function handleResponse(statType, data) { if (statType != false) { if (typeof data['rules_request_id'] != 'undefined' && data['rules_request_id'] && data['rules_request_id'] != '' && statType == 'S') { let rid = data['rules_request_id']; window['mpu_global_rid_unique'] = rid; } if (typeof data['display_id'] != 'undefined' && data['display_id'] && data['display_id'] != '' && statType == 'S') { let did = data['display_id']; window['mpu_global_display_id'] = did; } } } function sendStatistic(id, uId, statType = false) { var data = {}; var tmpstats = {}; var tmpdata = []; let searchId = 'statsid-'+id; if (statType == false) { window[searchId] = JSON.parse(localStorage.getItem(searchId)); for(var i in window[searchId]){ if(!tmpstats[window[searchId][i].url]) tmpstats[window[searchId][i].url] = []; tmpstats[window[searchId][i].url].push( window[searchId][i] ); } for(var i in tmpstats){ tmpdata.push({ url: i, stats: tmpstats[i] }); } } data.code = 'bd438336-ef10-11e9-a6e4-005056008dab-hrmufljnkm'; data.timeoffset = -180; data.stats = [{ sub: uId !== 0 ? uId : `6d908d50-b949-11ed-9256-005056008dab`, id: id, stats: tmpdata }]; if (statType == 'S') { window['mpu_stat_end_done'] = false; } if (statType != false && !window['mpu_stat_end_done']) { data.advanced_display_beta = mpu_get_stats_for_advanced_user_display(); data.advanced_display_beta.type = statType; if (statType == 'E') { window['mpu_stat_end_done'] = true; if (typeof window['mpu_global_rid_unique'] != 'undefined') { data.advanced_display_beta.rid = window['mpu_global_rid_unique']; } } // fetch("https://rules.mypopups.com/check_display_rules", { // method: 'POST', // headers: { // 'Accept': 'application/json', // 'Content-Type': 'application/json' // }, // body: JSON.stringify(data), // keepalive: true, // credentials: 'include' // }).then(response => { // // return response.json(); // // }).then((data) => { // // handleResponse(statType, data); // // }).catch(error => { // // // console.log(error); // // }); return; } fetch("https://mypopups.com/api/embed/stats", { method: 'POST', headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' }, body: JSON.stringify(data) }).then(response => { localStorage.removeItem(searchId); return response.json(); }).catch(error => { // console.log(error); }) } var popupContainer = document.getElementById('mypopups-substrate-100397'); popupContainer.style.opacity = '1'; (function (window, document) { var toArray = function (iterable) { var array = [] for (var element of iterable) { array.push(element) } return array } var autoPopulateActions = { currentUrl: function (callback) { callback(window.location.origin) }, firstUrl: function (callback) { callback('http://notimplemented.yet') }, previousUrl: function (callback) { callback(document.referrer) }, previousDomain: function (callback) { var url = new URL(document.referrer) callback(url.origin) }, ipAddress: function (callback) { fetch('https://mypopups.com/api/embed/ip') .then(x => x.json()) .then(({data}) => { callback(data.ip) }) }, promotionName: function (callback) { callback('15 anos de humor') }, noop: function (callback) { callback(null) } } var service = { autoPopulate: function () { var autoPopulateInputs = popupContainer.querySelectorAll('input:not([mp-data-auto-populate="none"])'); toArray(autoPopulateInputs).forEach(function (input) { var actionName = input.getAttribute('mp-data-auto-populate') var action = autoPopulateActions[actionName] || autoPopulateActions.noop if(input.hasAttribute('value')) return action(function (value) { input.setAttribute('value', value) }) }) } } service.autoPopulate() })(window, document) function init() { // Reposition var themes = document.getElementsByClassName('mypopups-substare'); positionThemes(filterPopUpsByAttribute(themes, 'positioning', 'full-screen')); positionThemes(filterPopUpsByAttribute(themes, 'positioning', 'banner')); positionThemes(filterPopUpsByAttribute(themes, 'mobile', "1")); // Show Popup after preloading and positioning (@iC) (function () { let veryUniquePreview = document.getElementById('very-unique-home-preview'); if (veryUniquePreview) { if (veryUniquePreview.classList.contains('hideThisForNow')) veryUniquePreview.classList.remove('hideThisForNow'); } })(); /** * vertically position elements of pop-up in * full-screen mode in case they are attached to some border * @param element * @param fullScreenPositions */ function positionElementsVertically(element, fullScreenPositions) { if (fullScreenPositions.attachedToTop && fullScreenPositions.attachedToBottom) { element.style.height = '100%'; element.style.top = 0; return } if (fullScreenPositions.attachedToTop) { element.style.top = 0; element.style.bottom = ''; } if (fullScreenPositions.attachedToBottom) { element.style.bottom = 0; element.style.top = ''; } } /** * horizontally position elements of pop-up in * full-screen mode in case they are attached to some border * @param element * @param fullScreenPositions */ function positionElementsHorizontally(element, fullScreenPositions) { if (fullScreenPositions.attachedToRight) { element.style.right = 0; element.style.left = ''; } if (fullScreenPositions.attachedToLeft) { element.style.left = 0; element.style.right = ''; } } function positionFullScreenTheme(theme) { let modal = theme.getElementsByClassName("mypopups-modal")[0]; let elements = theme.querySelectorAll("div[full-screen-positions]"); let fullScreenPositions, heightDiff, widthDiff, sumDifference, screenWidth; for (let i=0; i<=elements.length-1; i++) { fullScreenPositions = JSON.parse(elements[i].getAttribute('full-screen-positions')); heightDiff = (window.innerHeight / fullScreenPositions.notAttached.h).toFixed(4); theme.getAttribute("positioning") === 'banner' ? screenWidth = document.body.scrollWidth : screenWidth = window.innerWidth; widthDiff = (screenWidth / fullScreenPositions.notAttached.w).toFixed(4); sumDifference = ((parseFloat(heightDiff) + parseFloat(widthDiff)) /2).toFixed(4); if (fullScreenPositions) { if (theme.getAttribute("mobile") === '0' && theme.getAttribute("positioning") === 'full-screen') { if (theme.getElementsByClassName("mypopups-substare").length > 1) return; //adjusting form elements checkFormSizes(elements[i], sumDifference); //adjusting border radius if any if (elements[i].style.borderRadius) elements[i].style.borderRadius = Math.floor(parseInt(elements[i].style.borderRadius) * sumDifference) + 'px'; if (elements[i].style.borderWidth) { let width = Math.round(parseInt(elements[i].style.borderWidth) * sumDifference); width > 1 ? elements[i].style.borderWidth = width + 'px' : elements[i].style.borderWidth = width + 1 + 'px'; } //adjusting height-related properties //handling the close btn case if (elements[i].childNodes[0].style.borderRadius === '50%') { elements[i].style.height = Math.floor(parseInt(elements[i].style.height) * widthDiff) + 'px'; } else elements[i].style.height = Math.floor(parseInt(elements[i].style.height) * heightDiff) + 'px'; elements[i].style.top = Math.floor(fullScreenPositions.notAttached.t * heightDiff) + 'px'; //adjusting width-related properties similar for banners and full-screen adjustElementsScale(elements[i], widthDiff, fullScreenPositions.notAttached); if (elements[i].parentNode.nodeName !== 'FORM') adjustTextParameters(elements[i], heightDiff, widthDiff); } else if (theme.getAttribute("mobile") === '0' && theme.getAttribute("positioning") === 'banner') { checkFormSizes(elements[i], widthDiff); if (parseInt(theme.childNodes[0].style.height) === fullScreenPositions.notAttached.h) theme.childNodes[0].style.height = Math.floor(parseInt(theme.childNodes[0].style.height) * widthDiff) + 'px'; if (theme.childNodes[0].style.width === '100%') theme.childNodes[0].style.width = document.body.scrollWidth + 'px'; if (elements[i].style.borderRadius) elements[i].style.borderRadius = Math.floor(parseInt(elements[i].style.borderRadius) * widthDiff) + 'px'; if (elements[i].style.borderWidth) { elements[i].style.borderWidth = Math.round(parseInt(elements[i].style.borderWidth) * widthDiff) + 'px'; if (elements[i].parentNode.nodeName === 'FORM') { elements[i].style.borderWidth = parseInt(elements[i].style.borderWidth) + 1 + 'px'; } } //adjusting height-related properties elements[i].style.top = Math.floor(fullScreenPositions.notAttached.t * widthDiff) + 'px'; elements[i].style.height = Math.floor(parseInt(elements[i].style.height) * widthDiff) + 'px'; adjustElementsScale(elements[i], widthDiff, fullScreenPositions.notAttached); if (elements[i].parentNode.nodeName !== 'FORM') adjustTextParameters(elements[i], 0, widthDiff); } else { //checking if it's preview or Live and using 'preview device' or mobile screen sizes for scaling let previewContainer = document.getElementsByClassName('preview-conteiner-mobile'); if(previewContainer.length===0) { let mobHeight = previewContainer[0] ? themes[0].clientHeight : window.innerHeight, mobWidth = previewContainer[0] ? themes[0].clientWidth : window.innerWidth, mobileHeightDifference = mobHeight / 100 * parseInt(modal.style.height), mobileWidthDifference = mobWidth / 100 * parseInt(modal.style.width), averageTop = fullScreenPositions.notAttached.h / 2 - fullScreenPositions.notAttached.t, averageLeft = fullScreenPositions.notAttached.w / 2 - fullScreenPositions.notAttached.l; elements[i].style.top = mobileHeightDifference / 2 - averageTop + 'px'; elements[i].style.left = mobileWidthDifference / 2 - averageLeft + 'px'; } } // if(theme.getAttribute("mobile")!=='0'){ // positionElementsVertically(elements[i], fullScreenPositions); // positionElementsHorizontally(elements[i], fullScreenPositions); // } } } //to avoid repetitive scaling when multiple themes enabled theme.setAttribute('scaled', true); } function checkFormSizes(element, difference){ let input = element.getElementsByTagName("input")[0]; if (input){ let inputFontSize = Math.floor(parseInt(input.style.fontSize) * difference) + "px"; input.style.setProperty("--fs", inputFontSize); input.style.fontSize = inputFontSize ; } let btn = element.getElementsByTagName('button')[0]; if(btn && btn.getAttribute('type') === 'submit'){ btn.style.fontSize = Math.floor(parseInt(btn.style.fontSize) * difference) + 'px'; } } function adjustElementsScale(el, difference, fs){ el.style.left = Math.floor(fs.l * difference) + 2 + 'px'; el.style.width = Math.floor(parseInt(el.style.width) * difference) + 'px'; } function adjustTextParameters(element, heightD, widthD) { if( element.firstChild.style.backgroundSize) return; //covering the 'static height' banner case if (heightD === 0) heightD = widthD; let sumDifference = (parseFloat(heightD) + parseFloat(widthD)) / 2; let textElements = element.querySelectorAll('[data-font-size="true"]'); //adjusting text size if (textElements.length > 0) { textElements.forEach(textEl => { let fs = parseInt(textEl.style.fontSize); textEl.style.fontSize = Math.floor(fs * sumDifference) + 'px'; }); } else { let textRaw = element.getElementsByTagName('p'); if (textRaw.length !== 0) { textRaw[0].style.fontSize = Math.floor(15 * sumDifference) + 'px'; } else { if (element.getElementsByTagName('span').length > 0) { element.getElementsByTagName('span')[0].style.fontSize = Math.floor(15 * sumDifference) + 'px'; } } } //adjusting line heights let alignedElements = element.querySelectorAll('[data-line-height="true"]'); alignedElements.forEach(textEl => { let fs = parseFloat(textEl.style.lineHeight); !document.getElementById('preview-content-container') ? textEl.style.lineHeight = Math.floor(fs * heightD) + 'px' : textEl.style.lineHeight = Math.floor(fs * heightD) + 5 + 'px' }); } function filterPopUpsByAttribute(themes, attribute, value) { var filteredArray = []; for (var i=0; i <= themes.length-1; i++) { if(themes[i].getAttribute(attribute) === value && !themes[i].getAttribute('scaled')) { filteredArray.push(themes[i]); } } return filteredArray } function positionThemes(themes) { if(themes.length) themes.map(theme => positionFullScreenTheme(theme)) } // end before rules // start display rules if (window['isShowId100397']) { window['isShowId100397'] = false; var whichPages = JSON.parse('[{"option":"homepage","value":""}]'); for(var i in whichPages){ if(whichPages[i].option == 'homepage'){ if(document.location.pathname == '/' && document.location.search == ''){ window['isShowId100397'] = true; } } if(whichPages[i].option == 'contains'){ if(document.location.search.indexOf(whichPages[i].value) != -1){ window['isShowId100397'] = true; } if(document.location.hash.indexOf(whichPages[i].value) != -1){ window['isShowId100397'] = true; } if(document.location.href.indexOf(whichPages[i].value) != -1){ window['isShowId100397'] = true; } } if(whichPages[i].option == 'starts'){ if(document.location.href.indexOf(whichPages[i].value) == 0){ window['isShowId100397'] = true; } } if(whichPages[i].option == 'ends'){ var EndOfUrl = document.location.pathname.split('/').pop(); var ruleUrl = whichPages[i].value; var testUrl = document.location.pathname.split('/'); if(testUrl.pop()==''){ EndOfUrl = testUrl.pop(); } if(EndOfUrl.replace(/\//g, '') == ruleUrl.replace(/\//g, '')){ window['isShowId100397'] = true; } } if(whichPages[i].option == 'matches'){ if(document.location.href == (whichPages[i].value)){ window['isShowId100397'] = true; } } } } if ("" && ("no" === "yes" || window['isShowId100397'])){ window['showModal100397']() } if(window['isShowId100397']){ //if (typeof window['isShowIdOnlyOnce100397'] == 'undefined') { //window['isShowIdOnlyOnce100397'] = true; window['isShowId100397'] = false; //} var timestampInterval = 5 var nowFullDate = new Date(); let currentMonth = nowFullDate.getMonth() + 1 var nowDate = new Date( nowFullDate.getFullYear(), currentMonth, nowFullDate.getDate() ).getTime(); timestampInterval = timestampInterval * 24 * 60 * 60 * 1000; if (0 === 0 && window.innerWidth > 768 || 0 === 1 && window.innerWidth <= 768) { if (localStorage.getItem('dayShowInterval100397') != timestampInterval) { localStorage.setItem('dayShowInterval100397', timestampInterval); localStorage.setItem('timestampInterval100397', nowDate + timestampInterval); window['isShowId100397'] = true; } if (localStorage.getItem('timestampInterval100397') <= nowDate) { localStorage.setItem('timestampInterval100397', nowDate + timestampInterval, timestampInterval); window['isShowId100397'] = true; } } } localStorage.setItem('mp-priority100397', 3); if(window['isShowId100397']){ localStorage.removeItem('time100397') //window['hideModal100397'](); var maxSecond = 1; setTimeout(function(){ window['showModal100397'](); localStorage.setItem('time100397', 'end') //console.log('Least-Page ---- In FIle'); //localStorage.setItem('mp-priority', 2) }, maxSecond * 1000); } // end display rules }; init(); // adjustments logic (() => { let powered = document.getElementsByClassName('powered-by-link'); for (let i = 0; i < powered.length; ++i) powered[i].style.fontFamily = `'Proxima Nova Rg', Helvetica, Arial, sans-serif`; // Window load > DOMContentLoaded const createdPopups = document.querySelectorAll('.mypopups-substare'); // Show every Pop-up for (let i = 0; i < createdPopups.length; ++i) { let positioning = createdPopups[i].getAttribute('positioning'); let fixedPrevention = ['banner']; if (fixedPrevention.includes(positioning)) { createdPopups[i].style.position = ''; } } })(); // start after rules // start positioning logic let popups = document.getElementsByClassName('mypopups-substare'), rgbaToAlpha = (popup) => popup.style.backgroundColor.replace(/^.*,(.+)\)/, '$1'), getPosition = (popup) => popup.attributes.positioning.value, getBG = (popup) => { if (typeof popup.style.background != 'undefined') return (popup.style.background === 'transparent'); else return false; }, isClose = (popup) => { if (typeof popup.attributes.onclick != 'undefined') return popup.attributes.onclick.value.includes('onClosePreview'); else return false; }, getMobile = (popup) => popup.attributes.mobile.value; let reposition = (popup, pos) => { if (pos == 'undefined' || pos == '""' || pos.length == 0) position = 'center'; else position = pos; if (position != 'banner') { let modal = popup.querySelector('.mypopups-modal'); let left = modal.style.left; let right = modal.style.right; let mheight = parseInt(modal.style.height.slice(0, -2)); let mwidth = parseInt(modal.style.width.slice(0, -2)); if (mheight % 2 !== 0) modal.style.height = `${mheight-1}px`; if (mwidth % 2 !== 0) modal.style.width = `${mwidth-1}px`; if (position == 'center') { modal.style.top = `calc(50% - ${mheight / 2}px)`; modal.style.transform = ''; } if ((!right && (!left || left == 'auto')) || pos === 'undefined') { if (position != 'center') { modal.style.top = ''; modal.style.left = '0'; modal.style.right = '0'; modal.style.margin = '0 auto'; if (typeof modal.style.bottom == 'undefined' || modal.style.bottom.length == 0) modal.style.top = '0px'; } else { modal.style.left = `calc(50% - ${mwidth / 2}px)`; modal.style.top = `calc(50% - ${mheight / 2}px)`; modal.style.transform = ''; } } } popup.style.width = 0; popup.style.height = 0; popup.setAttribute('posited', true); } for (let i = 0; i < popups.length; ++i) { let popup = popups[i]; if (typeof popup.attributes.posited != 'undefined') continue; let mobile = getMobile(popup), position = getPosition(popup), close = isClose(popup), transparent = getBG(popup), alpha = rgbaToAlpha(popup); if (mobile.trim() !== '0') continue; if (position == 'full-screen') continue; if ((transparent || alpha.trim() === '0') && !close) reposition(popup, position); } function showThePopups() { function checkIfHasFont(elem, bold = false) { if (typeof elem.style != 'undefined') { if (typeof elem.style.fontFamily != 'undefined') { let filtred = []; let font = elem.style.fontFamily; font = font.split(','); for (let i = 0; i < font.length; i++) { font[i] = font[i].trim(); if (font[i] && font[i].length > 0) { let banned = ['sans-serif', 'helvetica', 'arial', 'proxima nova rg', `"proxima nova rg"`, 'cormorant', 'roboto']; if (!banned.includes(font[i].toLowerCase()) && !font[i].toLowerCase().includes('sansserif')) { if (bold) font[i] = `bold 1em ${font[i]}`; else font[i] = `1em ${font[i]}`; filtred.push(font[i]); } } } return filtred; } else return false; } else return false; } function checkFonts(elem, bold = false) { if (typeof elem == 'undefined' || elem == null) return []; if (!bold && ['STRONG', 'B'].includes(elem.tagName)) bold = true; let fonts = []; let font = checkIfHasFont(elem, bold); if (font) fonts = [...fonts, ...font]; if (elem.childNodes.length > 0) for (let i = 0; i < elem.childNodes.length; ++i) fonts = [...fonts, ...checkFonts(elem.childNodes[i], bold)]; return fonts; } function filterFonts(fonts) { let filtered = []; for (let i = 0; i < fonts.length; i++) { let font = fonts[i].trim(); if (font.length == 0) continue; if (font.includes('cursive')) { font = font.replace(' cursive', ''); font = font.trim(); } if (!filtered.includes(font)) filtered.push(font); } return filtered; } function testFonts(fonts, callback) { if (typeof document.fonts == 'undefined') callback(); else if (typeof document.fonts.check == 'undefined') callback(); else { let loaded = [], created = []; let intervaler, i = 0; function entireCheck() { for (let i = 0; i < fonts.length; ++i) { if (loaded.includes(fonts[i])) continue; if (!created.includes(fonts[i])) { let isBold = (fonts[i].slice(0,4) == 'bold'); let font = (isBold) ? fonts[i].slice(9) : fonts[i].slice(4); let fontNameForId = fonts[i].replace(/\"/g, '').replace(/\ /g, ''); let el = document.createElement('mpu'); el.style.visibility = 'hidden'; el.style.fontSize = '300px'; el.style.position = 'fixed'; el.style.left = '-9999px'; el.style.opacity = '0'; el.style.setProperty('font-family', font, 'important'); el.innerText = fontNameForId + 'giItT1WQy@!-/#'; el.setAttribute('id', `mpu-font-${fontNameForId}`); created.push(fonts[i]); if (isBold) el.style.fontWeight = 'bold'; document.body.appendChild(el); } if (document.fonts.check(fonts[i]) || fonts[i] == '1em Cormorant') { let fontNameForId = fonts[i].replace(/\"/g, '').replace(/\ /g, ''); loaded.push(fonts[i]); document.getElementById(`mpu-font-${fontNameForId}`).remove(); } } } entireCheck(); if (loaded.length == fonts.length) { clearInterval(intervaler); setTimeout(() => { callback(); }, 150); return; } intervaler = setInterval(() => { entireCheck(); i += 100; if (loaded.length >= fonts.length || i >= 10000) { clearInterval(intervaler); callback(); } }, 100); } } let popupInCase = document.getElementById('mypopups-substrate-100397'); let fontsScrape = filterFonts(checkFonts((typeof popup == 'object')?popup:popupInCase)); testFonts(fontsScrape, () => { afterAllFontsDone(); }); function afterAllFontsDone() { // Window load > DOMContentLoaded const createdPopups = document.querySelectorAll('.mypopups-substare'); // Hide in WordPress customiser let thisVisibility = 'visible'; if (typeof wp !== 'undefined') if (typeof wp.customize !== 'undefined' || typeof elementor === 'object') thisVisibility = 'hidden'; // Show every Pop-up for (let i = 0; i < createdPopups.length; ++i) if (createdPopups[i].parentNode.style.visibility != thisVisibility) createdPopups[i].parentNode.style.visibility = thisVisibility; } } } if (document.readyState === 'complete') { MyPopUpsInternalScript(); } else { window.addEventListener('load', function () { MyPopUpsInternalScript(); }); } })();