×

Electrical Contracting

Network Cabling Blog Form


Make sure you are not offline.’, password: ‘Incorrect name/password combination’, tryAgain: ‘Try again’ }, NavigationAreaParams: { ShowBackToHomeOnInnerPages: true, NavbarSize: 4, NavbarLiveHomePage: ‘https://www.osterwisch.com/’, BlockContainerSelector: ‘.dmBody’, NavbarSelector: ‘#dmNav:has(a)’, SubNavbarSelector: ‘#subnav_main’ }, hasCustomCode: true, planID: ‘753’, customTemplateId: ‘null’, siteTemplateId: ‘null’, productId: ‘DM_DIRECT’, disableTracking: false, pageType: ‘FROM_SCRATCH’, isRuntimeServer: true, siteCacheKey: ‘1649775408813_610c505f1cd84102a0cd22c2badecfbe’, siteInfo: null, }; window.Parameters.LayoutID = {}; window.Parameters.LayoutID[window._currentDevice] = 6; window.Parameters.LayoutVariationID = {}; window.Parameters.LayoutVariationID[window._currentDevice] = 5; ]]]]]]>]]]]>]]> > 0 } ]]]]]]>]]]]>]]> ]]> ]]> ]]> Electrical Contracting | Electric Improvement Cincinnati OH ]]> ]]> 1){ $(element).find(‘.multipleYextError’).addClass(‘hasError’); return; }else if(data.config.type === ‘none’){ $(element).find(‘.editorOnlyInfo’).addClass(‘inEditor’); } } } /* refresh yext script */ window.refreshYext = function(){ loadYext(true); } //function for Omniture tracking window._trackConvWidgetClickEvent = function(eventName) { if(typeof(HAF)===”object”){ HAF.OmTracking.onCMClick(eventName) } return; } /* draw yext map */ var drawMap = function(yextData){ var zoom = data.config.mapZoom; var yData = yextData.entities[0].attributes; var addressQuery = yData[‘address1’] + ” ” + yData[‘address2’] + ” ” + yData[‘city’] + ” ” + yData[‘state’] + ” ” + yData[‘zip’]; dmAPI.drawMap({addressQuery: addressQuery, zoom: zoom, container: $(element).find(‘.yextMap’)}); } var formatPhoneBeforeRender = function(num,cb) { if (!cb) cb = function(){return} if(data.config.formatPhone){ var s2 = (“”+num).replace(/D/g, ”); var m = s2.match(/^(d{3})(d{3})(d{4})$/); var formatted = (!m) ? null : “(” + m[1] + “) ” + m[2] + “-” + m[3]; cb(formatted); return formatted; } else { cb(num); return num; } } var displayTextdList = function(type,yextData,firstOnly) { var list = “”; if(yextData.entities[0].attributes[type]) { var yextAtt = yextData.entities[0].attributes[type] } else { var yextAtt = false } if(yextAtt && Array.isArray(yextAtt)) { for (var i=0; i< yextAtt.length; i++) { if (yextAtt[i] === 'Android Pay') { list += '

  • Google Pay’; } else { list += ‘
  • ‘ + yextAtt[i] + ”; } } $(element).find(‘#’ + type + ‘List’).html(list); } else if (yextAtt) { var yextAtt = yextAtt.split(“, “); for (var i=0; i< yextAtt.length; i++) { list += '
  • ‘ + yextAtt[i] + ”; } $(element).find(‘#’ + type + ‘List’).html(list); } else if (data.inEditor) { $(element).html(emptyListPlaceHolder); } else { $(element).css(‘display’,’none’); } } var displaySpecialties = function(yextData){ var list = “”; if(yextData.entities[0].attributes[“specialties”]) { var yextAtt = yextData.entities[0].attributes[“specialties”] } else if (yextData.entities[0].attributes[“specialities”]) { var yextAtt = yextData.entities[0].attributes[“specialities”] } else { var yextAtt = false } if(yextAtt && Array.isArray(yextAtt)) { for (var i=0; i< yextAtt.length; i++) { list += '
  • ‘ + yextAtt[i] + ”; } $(element).find(‘#specialtiesList’).html(list); } else if (yextAtt) { var yextAtt = yextAtt.split(“, “); for (var i=0; i< yextAtt.length; i++) { list += '
  • ‘ + yextAtt[i] + ”; } $(element).find(‘#specialtiesList’).html(list); } else if (data.inEditor) { $(element).html(emptyListPlaceHolder); } else { $(element).css(‘display’,’none’); } } var displayHours = function(type,yextData) { var list = “”; if(yextData.entities[0].attributes[type]) { var yextAtt = yextData.entities[0].attributes[type] } else { var yextAtt = false } if(yextAtt && Array.isArray(yextAtt)) { for(var i=0;i < yextAtt.length;i++) { var indexEndDay = yextAtt[i].lastIndexOf('day ') + 3; var leftSide = yextAtt[i].substr(0,indexEndDay).replace("Monday","Mon").replace("Tuesday","Tue").replace("Wednesday","Wed").replace("Thursday","Thu").replace("Friday","Fri").replace("Saturday","Sat").replace("Sunday","Sun"); var rightSide = yextAtt[i].substr(indexEndDay + 1) list += '' + leftSide + '' + rightSide + ''; } $(element).find('#hoursSmall').html(list); } else if(yextAtt) { var yextAtt = yextAtt.split(", "); for(var i=0;i < yextAtt.length;i++) { if((/s/.test(yextAtt[i])) === false){ yextAtt[i] = yextAtt[i] + ' - ' + yextAtt[i+1] yextAtt.splice(i+1, 1) } if (yextAtt[i].includes('day') === false ){ var leftSide = ' '; var rightSide = yextAtt[i] }else { var indexEndDay = yextAtt[i].lastIndexOf('day ') + 3; var leftSide = yextAtt[i].substr(0,indexEndDay).replace("Monday","Mon").replace("Tuesday","Tue").replace("Wednesday","Wed").replace("Thursday","Thu").replace("Friday","Fri").replace("Saturday","Sat").replace("Sunday","Sun"); var rightSide = yextAtt[i].substr(indexEndDay + 1) } list += '' + leftSide + '' + rightSide + ''; } $(element).find('#hoursSmall').html(list); } else if (data.inEditor) { $(element).html(emptyListPlaceHolder); } else { $(element).css('display','none'); } } var displayOpenHours = function(type, yextData){ if(yextData.entities[0].attributes['timezone']){ var zone = yextData.entities[0].attributes['timezone'] } else { var zone = false } if(zone){ var time = new Date().toLocaleString("en-US", {timeZone: zone}); var today = new Date(time ); var thirtyMins = 30 * 60 * 1000 var days = ['sunday','monday','tuesday','wednesday','thursday','friday','saturday']; var daysShort = ['Sun','Mon','Tues','Wed','Thurs','Fri','Sat']; var day = days[today.getDay()]; var hour = today.getHours(); var min = today.getMinutes(); var dd = ("0" + today.getDate()).slice(-2); var mm = ("0" + (today.getMonth() + 1)).slice(-2) var yyyy = today.getFullYear(); var todayDate = yyyy + '-' + mm + '-' + dd var mm = mm - 1 const tomorrow = new Date(today) tomorrow.setDate(tomorrow.getDate() + 1) var mmTmw = ("0" + (tomorrow.getMonth() + 1)).slice(-2) var ddTmw = ("0" + tomorrow.getDate()).slice(-2) var yyyyTmw = tomorrow.getFullYear(); var nextDay = days[tomorrow.getDay()] var tommorrow = yyyyTmw + '-' + mmTmw + '-' + ddTmw var mmTmw = mmTmw - 1 } if(yextData.entities[0].attributes[type + '-' + day]) { var yextAtt = yextData.entities[0].attributes[type + '-' + day] if (yextAtt === "Closed"){ yextAtt = false } } else { var yextAtt = false } //check if day is closed if(yextData.entities[0].attributes[type + '.' + day + '.isClosed'] === true) { var closed = true } //collects business holiday hours if(yextData.entities[0].attributes[type + '.holidayHours']){ var holidayHours = yextData.entities[0].attributes[type + '.holidayHours'] } else{ var holidayHours = false } //gets next days start time if(yextData.entities[0].attributes[type + '.' + nextDay + '.isClosed'] === true){ var tomorrowOpen = false } else { var tomorrowOpen = true var tmrwStart = yextData.entities[0].attributes[type + '-' + nextDay].split(" - ")[0] } //checks if holiday hours change if(holidayHours) { for(var i=0;i < holidayHours.length;i++){ if(holidayHours[i].date === todayDate && holidayHours[i].openIntervals){ yextAtt = holidayHours[i].hoursFormatted } } } //split hours if(yextAtt && yextAtt.includes(",")){ yextAtt = yextAtt.split(", ") for(var i=0;i < yextAtt.length;i++){ var end = yextAtt[i].split(' - ')[1] var start = yextAtt[i].split(' - ')[0] if (i+1 != yextAtt.length){ var nextStart = yextAtt[i + 1].split(' - ')[0] } if(start.includes("pm") && start.split(/s+|:/)[0] != "12"){ var startDate = new Date(yyyy, mm, dd, parseInt(start.split(/s+|:/)[0]) + 12, parseInt(start.split(/s+|:/)[1])) } else { var startDate = new Date(yyyy, mm, dd, parseInt(start.split(/s+|:/)[0]), parseInt(start.split(/s+|:/)[1])) } if(nextStart.includes("pm") && nextStart.split(/s+|:/)[0] != "12"){ var nextStartDate = new Date(yyyy, mm, dd, parseInt(nextStart.split(/s+|:/)[0]) + 12, parseInt(nextStart.split(/s+|:/)[1])) } else { var nextStartDate = new Date(yyyy, mm, dd, parseInt(nextStart), parseInt(nextStart.split(/s+|:/)[1])) } if(end.includes("pm") && end.split(/s+|:/)[0] != "12"){ var endDate = new Date(yyyy, mm, dd, parseInt(end.split(/s+|:/)[0]) + 12, parseInt(end.split(/s+|:/)[1])) } else { var endDate = new Date(yyyy, mm, dd, parseInt(end.split(/s+|:/)[0]), parseInt(end.split(/s+|:/)[1])) } if (end.includes("am") && (endDate startDate && today endDate && (i+1 != yextAtt.length) && today endDate && i+1 === yextAtt.length){ var closed = true } } } if(yextAtt || closed) { if(typeof yextAtt === "string"){ var start = yextAtt.split(" - ")[0] var end = yextAtt.split(" - ")[1] if(start.includes("pm") && start.split(/s+|:/)[0] != "12"){ var startDate = new Date(yyyy, mm, dd, parseInt(start.split(/s+|:/)[0]) + 12, parseInt(start.split(/s+|:/)[1])) } else { var startDate = new Date(yyyy, mm, dd, parseInt(start.split(/s+|:/)[0]), parseInt(start.split(/s+|:/)[1])) } if(end.includes("pm") && end.split(/s+|:/)[0] != "12"){ var endDate = new Date(yyyy, mm, dd, parseInt(end.split(/s+|:/)[0]) + 12, parseInt(end.split(/s+|:/)[1])) } else if (end.includes("am") && end.split(/s+|:/)[0] === "12") { var endDate = new Date(yyyy, mm, dd, parseInt(end.split(/s+|:/)[0]) - 12, parseInt(end.split(/s+|:/)[1])) } else { var endDate = new Date(yyyy, mm, dd, parseInt(end.split(/s+|:/)[0]), parseInt(end.split(/s+|:/)[1])) } if (end.includes("am") && (endDate endDate){ var closed = true } else if(today < startDate){ var closed = true //check if closing soon } else if (endDate - today < thirtyMins && endDate - today < 0 === false ){ var status = "Closing Soon " var cssClass = "soonStatus" var busHours = ' • ' + end //opened 24 hours } else if(start === '12:00 am' && end === '11:59 pm'){ var status = "Open " var cssClass = "allDayStatus" var busHours = ' 24 hours ' //opened } else { var status = "Open " var cssClass = "openedStatus" var busHours = '• Closes ' + end } } if(closed){ // closed & opening today if((today < startDate)){ var status = "Closed " var cssClass = "closedStatus" var busHours = ' Opens ' + start //closed & open tomorrow } else if(closed && tomorrowOpen === true){ var status = "Closed " var cssClass = "closedStatus" var busHours = ' • Opens ' + tmrwStart //closed and not open tomorrow } else if(closed && tomorrowOpen != true){ var offset = days.indexOf(day) + 1 for( var i=0; i < days.length; i++) { var dayIndex = (i + offset) % days.length; if(yextData.entities[0].attributes[type + '.' + days[dayIndex] + '.openIntervals']){ tmrwStart = daysShort[dayIndex] + " " + yextData.entities[0].attributes[type + '-' + days[dayIndex]].split(" - ")[0] break } } var status = "Closed " var cssClass = "closedStatus" var busHours = ' • Opens ' + tmrwStart } } } // checks if holiday if(holidayHours) { for(var i=0;i < holidayHours.length;i++){ if(holidayHours[i].date === todayDate && holidayHours[i].isClosed === true && tomorrowOpen === false){ var offset = days.indexOf(day) + 1 for( var i=0; i < days.length; i++) { var dayIndex = (i + offset) % days.length; if(yextData.entities[0].attributes[type + '.' + days[dayIndex] + '.openIntervals']){ tmrwStart = daysShort[dayIndex] + " " + yextData.entities[0].attributes[type + '-' + days[dayIndex]].split(" - ")[0] break } } var status = "Closed " var cssClass = "closedStatus" var busHours = ' • Opens ' + tmrwStart } else if(holidayHours[i].date === todayDate && holidayHours[i].isClosed === true && tomorrowOpen === true){ var status = "Closed " var cssClass = "closedStatus" var busHours = ' • Opens ' + tmrwStart } } } if(cssClass){ var hoursWidgets = document.getElementsByClassName('status') for( var i=0; i < hoursWidgets.length; i++) { hoursWidgets[i].classList.add(cssClass); } } if(status){ var hoursWidgets = document.getElementsByClassName('status') for( var i=0; i < hoursWidgets.length; i++) { hoursWidgets[i].innerText = status; } } if(cssClass === 'allDayStatus'){ var hoursWidgets = $(element).find('.openHours') for( var i=0; i 1){ var hoursWidgets = document.getElementsByClassName('openHours') for( var i=0; i < hoursWidgets.length; i++) { var openHoursLength = hoursWidgets[i].childNodes.length var oldHours = hoursWidgets[i] oldHours.removeChild(oldHours.childNodes[openHoursLength - 1]) } } var hoursWidgets = document.getElementsByClassName('openHours') for( var i=0; i < hoursWidgets.length; i++) { hoursWidgets[i].append(busHours) } } var displayHolidayHoursList = function(type,yextData) { var list = ""; if(yextData.entities[0].attributes["hours.holidayHours"]) { var yextAtt = yextData.entities[0].attributes["hours.holidayHours"] } else if(yextData.entities[0].attributes["holidayHours"]) { var yextAtt = yextData.entities[0].attributes["holidayHours"] } else { var yextAtt = false } if(yextAtt) { for (var i=0; i -1) { // write to dom list += '
  • ‘ + yextAtt[i].dateFormatted + ‘ – ‘ + yextAtt[i].hoursFormatted + ”; } } $(element).find(‘#’ + type + ‘List’).html(list); } else if (data.inEditor) { // if in editor display place holder $(element).html(emptyListPlaceHolder); } else { // if empty, hide element on runtime $(element).css(‘display’,’none’); } } var displayServiceArea = function(type,yextData,firstOnly) { var list = “”; if(yextData.entities[0].attributes[type]) { var yextAtt = yextData.entities[0].attributes[type] } else { var yextAtt = false } if (firstOnly) { list = ‘
  • ‘ + yextAtt[0] + ”; $(element).find(‘#’ + type + ‘List’).html(list); } else if (yextAtt && Array.isArray(yextAtt)) { for (var i=0; i< yextAtt.length; i++) { list += '
  • ‘ + yextAtt[i] + ”; } $(element).find(‘#’ + type + ‘List’).html(list); } else if (yextAtt) { var yextAtt = yextData.entities[0].attributes[type + “.places”] for (var i=0; i< yextAtt.length; i++) { list += '
  • ‘ + yextAtt[i] + ”; } $(element).find(‘#’ + type + ‘List’).html(list); } else if (data.inEditor) { $(element).html(emptyListPlaceHolder); } else { $(element).css(‘display’,’none’); } } var displayPhoneList = function(type,yextData) { var list = “”; var locData = yextData.entities[0].attributes; if(locData.phone) { list += ‘
  • Main: ‘ + formatPhoneBeforeRender(locData.phone) + ”; } if(locData.localPhone) { list += ‘
  • Local: ‘ + formatPhoneBeforeRender(locData.localPhone) + ”; } if(locData.alternatePhone) { list += ‘
  • Alternate: ‘ + formatPhoneBeforeRender(locData.alternatePhone) + ”; } if(locData.tollFreePhone) { list += ‘
  • Toll Free: ‘ + formatPhoneBeforeRender(locData.tollFreePhone) + ”; } if(locData.mobilePhone) { list += ‘
  • Mobile: ‘ + formatPhoneBeforeRender(locData.mobilePhone) + ”; } if(locData.faxPhone) { list += ‘
  • Fax: ‘ + formatPhoneBeforeRender(locData.faxPhone) + ”; } if(locData.ttyPhone) { list += ‘
  • TTY: ‘ + formatPhoneBeforeRender(locData.ttyPhone) + ”; } if(list.length > 0) { $(element).find(‘#’ + type + ‘List’).html(list); } else if (data.inEditor) { $(element).html(emptyListPlaceHolder); } else { $(element).css(‘display’,’none’); } emitYextPhoneRenderEvent(formatPhoneBeforeRender(locData.phone)); } var getNumDaysBetween = function(d1, d2) { var diff = d1.getTime() – d2.getTime(); return diff / (1000 * 60 * 60 * 24); }; var orderPaymentsList = function(listData) { if(listData.indexOf(‘Discover’) >= 0) { listData.splice(listData.indexOf(“Discover”), 1); listData.unshift(‘Discover’); } if(listData.indexOf(‘American Express’) >= 0) { listData.splice(listData.indexOf(“American Express”), 1); listData.unshift(‘American Express’); } if(listData.indexOf(‘MasterCard’) >= 0) { listData.splice(listData.indexOf(“MasterCard”), 1); listData.unshift(‘MasterCard’); } if(listData.indexOf(‘Visa’) >= 0) { listData.splice(listData.indexOf(“Visa”), 1); listData.unshift(‘Visa’); } return listData } var displayImageList = function(type,yextData) { var list = “”; var listData = orderPaymentsList(_yextData.entities[0].attributes[type]); for (var i=0; i< listData.length; i++) { list += '' + listData[i] + '‘ } if(list.length > 0) { $(element).find(‘#paymentOptionsImages’).html(list) } else if (data.inEditor) { $(element).html(emptyListPlaceHolder); } else { $(element).css(‘display’,’none’); } } var displaySocialIcons = function(type,yextData) { var list = “”; if(yextData.entities[0].attributes.facebookPageUrl) { list += ‘ ‘ } if(yextData.entities[0].attributes.twitterHandle) { list += ‘ ‘ } if(yextData.entities[0].attributes.instagramHandle) { list += ‘ ‘ } if(list.length > 0) { $(element).find(‘#socialIcons’).html(list); } else if (data.inEditor) { $(element).html(emptyListPlaceHolder); } else { $(element).css(‘display’,’none’); } } var getImageUrl = function(name,style) { var cdnPath = ‘https://cdn.websites.hibu.com/-resellers-preview/_cc_icons/’; if(!style) { style = ‘_d.svg’ } if (name === “ZELLE”){ name = “Zelle” } var imageUrl=”; switch (name) { case ‘Visa’: imageUrl = cdnPath + name.replace(/[W_]+/g,”).toLowerCase() + style; break; case ‘MasterCard’: imageUrl = cdnPath + name.replace(/[W_]+/g,”).toLowerCase() + style; break; case ‘Discover’: imageUrl = cdnPath + name.replace(/[W_]+/g,”).toLowerCase() + style; break; case ‘American Express’: imageUrl = cdnPath + name.replace(/[W_]+/g,”).toLowerCase() + style; break; case ‘Android Pay’: imageUrl = cdnPath + name.replace(/[W_]+/g,”).toLowerCase() + style; break; case ‘Apple Pay’: imageUrl = cdnPath + name.replace(/[W_]+/g,”).toLowerCase() + style; break; case ‘Bitcoin’: imageUrl = cdnPath + name.replace(/[W_]+/g,”).toLowerCase() + style; break; case ‘Cash’: imageUrl = cdnPath + name.replace(/[W_]+/g,”).toLowerCase() + style; break; case ‘Check’: imageUrl = cdnPath + name.replace(/[W_]+/g,”).toLowerCase() + style; break; case ‘Diners Club’: imageUrl = cdnPath + name.replace(/[W_]+/g,”).toLowerCase() + style; break; case ‘Discover’: imageUrl = cdnPath + name.replace(/[W_]+/g,”).toLowerCase() + style; break; case ‘Financing’: imageUrl = cdnPath + name.replace(/[W_]+/g,”).toLowerCase() + style; break; case ‘Invoice’: imageUrl = cdnPath + name.replace(/[W_]+/g,”).toLowerCase() + style; break; case ‘PayPal’: imageUrl = cdnPath + name.replace(/[W_]+/g,”).toLowerCase() + style; break; case ‘Samsung Pay’: imageUrl = cdnPath + name.replace(/[W_]+/g,”).toLowerCase() + style; break; case “Traveler’s Check”: imageUrl = cdnPath + name.replace(/[W_]+/g,”).toLowerCase() + style; break; case “Zelle”: imageUrl = cdnPath + name.replace(/[W_]+/g,”).toLowerCase() + style; break } return imageUrl } function emitYextPhoneRenderEvent(phone) { var yextPhoneRenderEvent = new CustomEvent(‘YextPhoneChangeEvent’, { detail: phone, bubbles: true, cancelable: true }); document.dispatchEvent(yextPhoneRenderEvent); } var initYextElements = function(yextData,widgetType){ if (widgetType === ‘address’ && data.config.drawMap) { drawMap(yextData); } else if (widgetType === ‘paymentOptions’ && data.config.showPaymentsAs === ‘paymentIcons’) { displayImageList(widgetType,yextData); } else if (widgetType === ‘phone’ && data.config.phoneShowAs === ‘list’) { displayPhoneList(widgetType,yextData); // check for any list type } else if(widgetType === ‘phone’ && data.config.phoneShowAs === ‘button’) { var phFormatted = formatPhoneBeforeRender(yextData.entities[0].attributes[data.config.phoneType],function(phone) { $(element).find(“.dmButtonLink”).html(” + phone + ”); emitYextPhoneRenderEvent(phone); }); } else if(widgetType === ‘phone’ && data.config.phoneShowAs === ‘text’) { var phFormatted = formatPhoneBeforeRender(yextData.entities[0].attributes[data.config.phoneType],function(phone) { $(element).find(‘.yextPhoneText’).html(” + phone + ”); emitYextPhoneRenderEvent(phone); }); } else if (widgetType === ‘services’ || widgetType === ‘googleAttributesFormatted’ || widgetType === ‘languages’ || widgetType === ‘paymentOptions’ || widgetType === ‘keywords’ || widgetType === ‘products’ || widgetType === ‘associations’ || widgetType === ‘brands’) { setTimeout(function() { displayTextdList(widgetType,yextData) },1); } else if(widgetType === ‘specialties’) { setTimeout(function() { displaySpecialties(yextData) },1) }else if (widgetType ===’serviceArea’) { setTimeout(function() { displayServiceArea(widgetType,yextData,data.config.showServiceAreaFirst) },1) } else if (widgetType ===’hours’ && data.config.hoursShowAs === ‘list’ && data.config.isList == false) { setTimeout(function() { displayHours(widgetType,yextData) },1) } else if (widgetType ===’hours’ && data.config.hoursShowAs === ‘openHours’) { setTimeout(function() { displayOpenHours(widgetType,yextData) },1) } else if (widgetType === ‘social’) { displaySocialIcons(widgetType,yextData); } else if (widgetType === ‘holidayHours’) { setTimeout(function() { displayHolidayHoursList(widgetType,yextData) },1); } else if (widgetType === ‘hours’) { //hide hours list if toggle enabled if(data.config.hideHoursList === true) { $(element).find(‘.yextHours’).css(‘display’,’none’); } } else if (widgetType === ‘description’ || widgetType === ‘yearEstablished’ || widgetType === ’email’ || widgetType === ‘name’) { // check hideIfEmpty(widgetType,yextData) } //remove error if script not entered correctly. $(element).find(‘.wrongScriptError’).removeClass(‘hasError’); } function hideIfEmpty(type,yextData) { if(!yextData.entities[0].attributes[type]) { if(data.inEditor) { $(element).html(emptyListPlaceHolder); } else { $(element).css(‘display’,’none’); } } } // TODO CHANGE TO EVENT CALL BACK var startIntervalToWaitAndLoadWidgets = function(widgetType) { //start interval for this specific widget var intervalCheckYextLoaded = setInterval(function(){ if (window._yextData) { clearInterval(intervalCheckYextLoaded); initYextElements(window._yextData,widgetType); } },50) } /* initialization */ if(data.inEditor){ window.refreshYext && window.refreshYext(); $(document).ready(function(){ if(!window.yextInitialized){ $(element).find(‘.missingYextWidget’).addClass(‘show’); } else { $(element).find(‘.missingYextWidget’).removeClass(‘show’); } }); } else { dmAPI.runOnReady(‘yext’ , function(){ loadYext(); }); // Before navigating with Ajax, we set the yext initialized to be false so it will be initialized again after the ajax navigation dmAPI.runBeforeAjaxNavigation(‘yext’, function(){ window.yextInitialized = false; }); } }; ]]]]]]>]]]]>]]>
  • ]]> 1){ $(element).find(‘.multipleYextError’).addClass(‘hasError’); return; }else if(data.config.type === ‘none’){ $(element).find(‘.editorOnlyInfo’).addClass(‘inEditor’); } } } /* refresh yext script */ window.refreshYext = function(){ loadYext(true); } //function for Omniture tracking window._trackConvWidgetClickEvent = function(eventName) { if(typeof(HAF)===”object”){ HAF.OmTracking.onCMClick(eventName) } return; } /* draw yext map */ var drawMap = function(yextData){ var zoom = data.config.mapZoom; var yData = yextData.entities[0].attributes; var addressQuery = yData[‘address1’] + ” ” + yData[‘address2’] + ” ” + yData[‘city’] + ” ” + yData[‘state’] + ” ” + yData[‘zip’]; dmAPI.drawMap({addressQuery: addressQuery, zoom: zoom, container: $(element).find(‘.yextMap’)}); } var formatPhoneBeforeRender = function(num,cb) { if (!cb) cb = function(){return} if(data.config.formatPhone){ var s2 = (“”+num).replace(/D/g, ”); var m = s2.match(/^(d{3})(d{3})(d{4})$/); var formatted = (!m) ? null : “(” + m[1] + “) ” + m[2] + “-” + m[3]; cb(formatted); return formatted; } else { cb(num); return num; } } var displayTextdList = function(type,yextData,firstOnly) { var list = “”; if(yextData.entities[0].attributes[type]) { var yextAtt = yextData.entities[0].attributes[type] } else { var yextAtt = false } if(yextAtt && Array.isArray(yextAtt)) { for (var i=0; i< yextAtt.length; i++) { if (yextAtt[i] === 'Android Pay') { list += '

  • Google Pay’; } else { list += ‘
  • ‘ + yextAtt[i] + ”; } } $(element).find(‘#’ + type + ‘List’).html(list); } else if (yextAtt) { var yextAtt = yextAtt.split(“, “); for (var i=0; i< yextAtt.length; i++) { list += '
  • ‘ + yextAtt[i] + ”; } $(element).find(‘#’ + type + ‘List’).html(list); } else if (data.inEditor) { $(element).html(emptyListPlaceHolder); } else { $(element).css(‘display’,’none’); } } var displaySpecialties = function(yextData){ var list = “”; if(yextData.entities[0].attributes[“specialties”]) { var yextAtt = yextData.entities[0].attributes[“specialties”] } else if (yextData.entities[0].attributes[“specialities”]) { var yextAtt = yextData.entities[0].attributes[“specialities”] } else { var yextAtt = false } if(yextAtt && Array.isArray(yextAtt)) { for (var i=0; i< yextAtt.length; i++) { list += '
  • ‘ + yextAtt[i] + ”; } $(element).find(‘#specialtiesList’).html(list); } else if (yextAtt) { var yextAtt = yextAtt.split(“, “); for (var i=0; i< yextAtt.length; i++) { list += '
  • ‘ + yextAtt[i] + ”; } $(element).find(‘#specialtiesList’).html(list); } else if (data.inEditor) { $(element).html(emptyListPlaceHolder); } else { $(element).css(‘display’,’none’); } } var displayHours = function(type,yextData) { var list = “”; if(yextData.entities[0].attributes[type]) { var yextAtt = yextData.entities[0].attributes[type] } else { var yextAtt = false } if(yextAtt && Array.isArray(yextAtt)) { for(var i=0;i < yextAtt.length;i++) { var indexEndDay = yextAtt[i].lastIndexOf('day ') + 3; var leftSide = yextAtt[i].substr(0,indexEndDay).replace("Monday","Mon").replace("Tuesday","Tue").replace("Wednesday","Wed").replace("Thursday","Thu").replace("Friday","Fri").replace("Saturday","Sat").replace("Sunday","Sun"); var rightSide = yextAtt[i].substr(indexEndDay + 1) list += '' + leftSide + '' + rightSide + ''; } $(element).find('#hoursSmall').html(list); } else if(yextAtt) { var yextAtt = yextAtt.split(", "); for(var i=0;i < yextAtt.length;i++) { if((/s/.test(yextAtt[i])) === false){ yextAtt[i] = yextAtt[i] + ' - ' + yextAtt[i+1] yextAtt.splice(i+1, 1) } if (yextAtt[i].includes('day') === false ){ var leftSide = ' '; var rightSide = yextAtt[i] }else { var indexEndDay = yextAtt[i].lastIndexOf('day ') + 3; var leftSide = yextAtt[i].substr(0,indexEndDay).replace("Monday","Mon").replace("Tuesday","Tue").replace("Wednesday","Wed").replace("Thursday","Thu").replace("Friday","Fri").replace("Saturday","Sat").replace("Sunday","Sun"); var rightSide = yextAtt[i].substr(indexEndDay + 1) } list += '' + leftSide + '' + rightSide + ''; } $(element).find('#hoursSmall').html(list); } else if (data.inEditor) { $(element).html(emptyListPlaceHolder); } else { $(element).css('display','none'); } } var displayOpenHours = function(type, yextData){ if(yextData.entities[0].attributes['timezone']){ var zone = yextData.entities[0].attributes['timezone'] } else { var zone = false } if(zone){ var time = new Date().toLocaleString("en-US", {timeZone: zone}); var today = new Date(time); var days = ['sunday','monday','tuesday','wednesday','thursday','friday','saturday']; var daysShort = ['Sun','Mon','Tues','Wed','Thurs','Fri','Sat']; var day = days[today.getDay()]; var hour = today.getHours(); var min = today.getMinutes(); var dd = ("0" + today.getDate()).slice(-2); var mm = ("0" + (today.getMonth() + 1)).slice(-2) var yyyy = today.getFullYear(); var todayDate = yyyy + '-' + mm + '-' + dd const tomorrow = new Date(today) tomorrow.setDate(tomorrow.getDate() + 1) var mmTmw = ("0" + (tomorrow.getMonth() + 1)).slice(-2) var ddTmw = ("0" + tomorrow.getDate()).slice(-2) var yyyyTmw = tomorrow.getFullYear(); var nextDay = days[tomorrow.getDay()] var tommorrow = yyyyTmw + '-' + mmTmw + '-' + ddTmw } if(yextData.entities[0].attributes[type + '.' + day + '.openIntervals']) { var yextAtt = yextData.entities[0].attributes[type + '.' + day + '.openIntervals'] } else { var yextAtt = false } //check if day is closed if(yextData.entities[0].attributes[type + '.' + day + '.isClosed'] === true) { var closed = true } //collects business holiday hours if(yextData.entities[0].attributes[type + '.holidayHours']){ var holidayHours = yextData.entities[0].attributes[type + '.holidayHours'] } else{ var holidayHours = false } //gets next days start time if(yextData.entities[0].attributes[type + '.' + nextDay + '.isClosed'] === true){ var tomorrowOpen = false } else { var tomorrowOpen = true var tmrwStart = yextData.entities[0].attributes[type + '.' + nextDay + '.openIntervals[0].start'].split(":") if (parseInt(tmrwStart[0]) > 12){ tmrwStart[0] = String(parseInt(tmrwStart[0]) – 12) tmrwStart = tmrwStart[0] + “:” + tmrwStart[1] + ” pm” } else if (parseInt(tmrwStart[0]) === 12) { tmrwStart = yextData.entities[0].attributes[type + ‘.’ + nextDay + ‘.openIntervals[0].start’] + ” pm” } else if (parseInt(tmrwStart[0]) === 00){ tmrwStart = “12:” + tmrwStart[1] + ” am” } else{ tmrwStart = yextData.entities[0].attributes[type + ‘.’ + nextDay + ‘.openIntervals[0].start’].substring(1) + ” am” } } //checks if holiday hours change if(holidayHours) { for(var i=0;i 1){ for(var i=0;i = parseInt(start[0]) && min >= parseInt(start[1])) && ((hour < parseInt(end[0]) || (hour === parseInt(end[0]) && min = parseInt(end[0]) && min > parseInt(end[1])) && ( i+1 != yextAtt.length) && ((hour < parseInt(nextStart[0]) || (hour === parseInt(nextStart[0]) && min 12){ tmrwStart[0] = String(parseInt(tmrwStart[0]) - 12) tmrwStart = tmrwStart[0] + ":" + tmrwStart[1] + " pm" } else if (parseInt(tmrwStart[0]) === 12) { tmrwStart = tmrwStart[0] + ":" + tmrwStart[1] + " pm" } else if (parseInt(tmrwStart[0]) === 00){ tmrwStart = "12:" + tmrwStart[1] + " am" } else{ tmrwStart = tmrwStart[0].substring(1) + ":" + tmrwStart[1] + " am" } } else if ((hour >= parseInt(end[0]) && min > parseInt(end[1])) && ( i+1 === yextAtt.length)) { var closed = true } } } if(yextAtt || closed) { if(yextAtt){ // console.log(yextAtt) var end = yextAtt[0][“end”].split(“:”) var start = yextAtt[0][“start”].split(“:”) // } //closing soon logic add to conditional below if(hour === parseInt(end[0])){ if(min >= parseInt(end[1])){ var closed = true } } } //closed & open tomorrow if(closed && tomorrowOpen === true){ var status = “Closed ” var cssClass = “closedStatus” var busHours = ‘ • Opens ‘ + tmrwStart } //close and not open tomorrow else if((closed && tomorrowOpen != true) || (hour > parseInt(end[0]) && tomorrowOpen != true)){ var offset = days.indexOf(day) + 1 for( var i=0; i 12){ tmrwStart[0] = String(parseInt(tmrwStart[0]) – 12) tmrwStart = tmrwStart[0] + “:” + tmrwStart[1] + ” pm ” + daysShort[dayIndex] break } else if (parseInt(tmrwStart[0]) === 12){ tmrwStart = tmrwStart.join(“:”) + ” pm ” + daysShort[dayIndex] break } else if (parseInt(tmrwStart[0]) === 00){ tmrwStart = “12:” + tmrwStart[1] + ” am ” + daysShort[dayIndex] break } else{ tmrwStart = tmrwStart.join(“:”) tmrwStart = tmrwStart.substring(1) + ” am ” + daysShort[dayIndex] break } } } var status = “Closed ” var cssClass = “closedStatus” var busHours = ‘ • Opens ‘ + tmrwStart // closed & opening today } else if(hour > parseInt(end[0]) && tomorrowOpen === true){ var status = “Closed ” var cssClass = “closedStatus” var busHours = ‘ • Opens ‘ + tmrwStart }else if(hour < parseInt(start[0]) || (hour === parseInt(start[0]) && min 12){ start[0] = String(parseInt(start[0]) - 12) start = start[0] + ":" + start[1] + " pm" } else if (parseInt(start[0]) === 12) { start = yextData.entities[0].attributes[type + '.' + day + '.openIntervals[0].start'] + " pm" } else if (parseInt(start[0]) === 00){ start = "12:" + start[1] + " am" } else{ start = yextData.entities[0].attributes[type + '.' + day + '.openIntervals[0].start'].substring(1) + " am" } var status = "Closed " var cssClass = "closedStatus" var busHours = ' Opens ' + start } else if(yextAtt[0]["start"] == '00:00' && yextAtt[0]["end"] === '23:59'){ var status = "Open " var cssClass = "allDayStatus" var busHours = ' 24 hours ' // opened } else { if (parseInt(end[0]) > 12){ end[0] = String(parseInt(end[0]) – 12) end = end[0] + “:” + end[1] + ” pm” } else if (parseInt(end[0]) === 12) { end = yextData.entities[0].attributes[type + ‘.’ + day + ‘.openIntervals[0].end’] + ” pm” } else if (parseInt(end[0]) === 00){ end = “12:” + end[1] + ” am” } else{ end = yextData.entities[0].attributes[type + ‘.’ + day + ‘.openIntervals[0].end’].substring(1) + ” am” } var status = “Open ” var cssClass = “openedStatus” var busHours = ‘• Closes ‘ + end } if(yextAtt){ // console.log(yextAtt) var end = yextAtt[0][“end”].split(“:”) var start = yextAtt[0][“start”].split(“:”) } //closing soon logic add to conditional below if(yextAtt){ if(hour === parseInt(end[0])){ if(min parseInt(end[1])){ if (parseInt(end[0]) > 12){ end[0] = String(parseInt(end[0]) – 12) end = end[0] + “:” + end[1] + ” pm” } else if (parseInt(end[0]) === 12) { end = yextAtt[0][“end”] + ” pm” } else if (parseInt(start[0]) === 00){ end = “12:” + start[1] + ” am” } else{ end = yextAtt[0][“end”].substring(1) + ” am” } var status = “Closing Soon ” var cssClass = “soonStatus” var busHours = ‘ • ‘ + end } } else if ((parseInt(end[0]) – hour === 1) || (parseInt(end[0]) === 00 && hour === 11)){ var checkMin = min + 30 if(checkMin >= 60){ checkMin = checkMin – 60 if(checkMin >= parseInt(end[1])){ if (parseInt(end[0]) > 12){ end[0] = String(parseInt(end[0]) – 12) end = end[0] + “:” + end[1] + ” pm” } else if (parseInt(end[0]) === 12) { end = yextAtt[0][“end”] + ” pm” } else if (parseInt(start[0]) === 00){ end = “12:” + start[1] + ” am” } else{ end = yextAtt[0][“end”].substring(1) + ” am” } var status = “Closing Soon ” var cssClass = “soonStatus” var busHours = ‘ • ‘ + end } } } } } //checks if holiday if(holidayHours) { for(var i=0;i < holidayHours.length;i++){ if(holidayHours[i].date === todayDate && holidayHours[i].isClosed === true && tomorrowOpen === false){ var offset = days.indexOf(day) + 1 for( var i=0; i 12){ tmrwStart[0] = String(parseInt(tmrwStart[0]) - 12) tmrwStart = tmrwStart[0] + ":" + tmrwStart[1] + " pm " + daysShort[dayIndex] break } else if (parseInt(tmrwStart[0]) === 12){ tmrwStart = tmrwStart.join(":") + " pm " + daysShort[dayIndex] break } else if (parseInt(tmrwStart[0]) === 00){ tmrwStart = "12:" + tmrwStart[1] + " am " + daysShort[dayIndex] break } else{ tmrwStart = tmrwStart.join(":") tmrwStart = tmrwStart.substring(1) + " am " + daysShort[dayIndex] break } } } var status = "Closed " var cssClass = "closedStatus" var busHours = ' • Opens ' + tmrwStart } else if(holidayHours[i].date === todayDate && holidayHours[i].isClosed === true && tomorrowOpen === true){ var status = "Closed " var cssClass = "closedStatus" var busHours = ' • Opens ' + tmrwStart } } } if(cssClass){ var hoursWidgets = document.getElementsByClassName('status') for( var i=0; i < hoursWidgets.length; i++) { hoursWidgets[i].classList.add(cssClass); } } if(status){ var hoursWidgets = document.getElementsByClassName('status') for( var i=0; i < hoursWidgets.length; i++) { hoursWidgets[i].innerText = status; } } if(cssClass === 'allDayStatus'){ var hoursWidgets = $(element).find('.openHours') for( var i=0; i 1){ var hoursWidgets = document.getElementsByClassName('openHours') for( var i=0; i < hoursWidgets.length; i++) { var openHoursLength = hoursWidgets[i].childNodes.length var oldHours = hoursWidgets[i] oldHours.removeChild(oldHours.childNodes[openHoursLength - 1]) } } var hoursWidgets = document.getElementsByClassName('openHours') for( var i=0; i < hoursWidgets.length; i++) { hoursWidgets[i].append(busHours) } } var displayHolidayHoursList = function(type,yextData) { var list = ""; if(yextData.entities[0].attributes["hours.holidayHours"]) { var yextAtt = yextData.entities[0].attributes["hours.holidayHours"] } else if(yextData.entities[0].attributes["holidayHours"]) { var yextAtt = yextData.entities[0].attributes["holidayHours"] } else { var yextAtt = false } if(yextAtt) { for (var i=0; i -1) { // write to dom list += '
  • ‘ + yextAtt[i].dateFormatted + ‘ – ‘ + yextAtt[i].hoursFormatted + ”; } } $(element).find(‘#’ + type + ‘List’).html(list); } else if (data.inEditor) { // if in editor display place holder $(element).html(emptyListPlaceHolder); } else { // if empty, hide element on runtime $(element).css(‘display’,’none’); } } var displayServiceArea = function(type,yextData,firstOnly) { var list = “”; if(yextData.entities[0].attributes[type]) { var yextAtt = yextData.entities[0].attributes[type] } else { var yextAtt = false } if (firstOnly) { list = ‘
  • ‘ + yextAtt[0] + ”; $(element).find(‘#’ + type + ‘List’).html(list); } else if (yextAtt && Array.isArray(yextAtt)) { for (var i=0; i< yextAtt.length; i++) { list += '
  • ‘ + yextAtt[i] + ”; } $(element).find(‘#’ + type + ‘List’).html(list); } else if (yextAtt) { var yextAtt = yextData.entities[0].attributes[type + “.places”] for (var i=0; i< yextAtt.length; i++) { list += '
  • ‘ + yextAtt[i] + ”; } $(element).find(‘#’ + type + ‘List’).html(list); } else if (data.inEditor) { $(element).html(emptyListPlaceHolder); } else { $(element).css(‘display’,’none’); } } var displayPhoneList = function(type,yextData) { var list = “”; var locData = yextData.entities[0].attributes; if(locData.phone) { list += ‘
  • Main: ‘ + formatPhoneBeforeRender(locData.phone) + ”; } if(locData.localPhone) { list += ‘
  • Local: ‘ + formatPhoneBeforeRender(locData.localPhone) + ”; } if(locData.alternatePhone) { list += ‘
  • Alternate: ‘ + formatPhoneBeforeRender(locData.alternatePhone) + ”; } if(locData.tollFreePhone) { list += ‘
  • Toll Free: ‘ + formatPhoneBeforeRender(locData.tollFreePhone) + ”; } if(locData.mobilePhone) { list += ‘
  • Mobile: ‘ + formatPhoneBeforeRender(locData.mobilePhone) + ”; } if(locData.faxPhone) { list += ‘
  • Fax: ‘ + formatPhoneBeforeRender(locData.faxPhone) + ”; } if(locData.ttyPhone) { list += ‘
  • TTY: ‘ + formatPhoneBeforeRender(locData.ttyPhone) + ”; } if(list.length > 0) { $(element).find(‘#’ + type + ‘List’).html(list); } else if (data.inEditor) { $(element).html(emptyListPlaceHolder); } else { $(element).css(‘display’,’none’); } emitYextPhoneRenderEvent(formatPhoneBeforeRender(locData.phone)); } var getNumDaysBetween = function(d1, d2) { var diff = d1.getTime() – d2.getTime(); return diff / (1000 * 60 * 60 * 24); }; var orderPaymentsList = function(listData) { if(listData.indexOf(‘Discover’) >= 0) { listData.splice(listData.indexOf(“Discover”), 1); listData.unshift(‘Discover’); } if(listData.indexOf(‘American Express’) >= 0) { listData.splice(listData.indexOf(“American Express”), 1); listData.unshift(‘American Express’); } if(listData.indexOf(‘MasterCard’) >= 0) { listData.splice(listData.indexOf(“MasterCard”), 1); listData.unshift(‘MasterCard’); } if(listData.indexOf(‘Visa’) >= 0) { listData.splice(listData.indexOf(“Visa”), 1); listData.unshift(‘Visa’); } return listData } var displayImageList = function(type,yextData) { var list = “”; var listData = orderPaymentsList(_yextData.entities[0].attributes[type]); for (var i=0; i< listData.length; i++) { list += '' + listData[i] + '‘ } if(list.length > 0) { $(element).find(‘#paymentOptionsImages’).html(list) } else if (data.inEditor) { $(element).html(emptyListPlaceHolder); } else { $(element).css(‘display’,’none’); } } var displaySocialIcons = function(type,yextData) { var list = “”; if(yextData.entities[0].attributes.facebookPageUrl) { list += ‘ ‘ } if(yextData.entities[0].attributes.twitterHandle) { list += ‘ ‘ } if(yextData.entities[0].attributes.instagramHandle) { list += ‘ ‘ } if(list.length > 0) { $(element).find(‘#socialIcons’).html(list); } else if (data.inEditor) { $(element).html(emptyListPlaceHolder); } else { $(element).css(‘display’,’none’); } } var getImageUrl = function(name,style) { var cdnPath = ‘https://cdn.websites.hibu.com/-resellers-preview/_cc_icons/’; if(!style) { style = ‘_d.svg’ } var imageUrl=”; switch (name) { case ‘Visa’: imageUrl = cdnPath + name.replace(/[W_]+/g,”).toLowerCase() + style; break; case ‘MasterCard’: imageUrl = cdnPath + name.replace(/[W_]+/g,”).toLowerCase() + style; break; case ‘Discover’: imageUrl = cdnPath + name.replace(/[W_]+/g,”).toLowerCase() + style; break; case ‘American Express’: imageUrl = cdnPath + name.replace(/[W_]+/g,”).toLowerCase() + style; break; case ‘Android Pay’: imageUrl = cdnPath + name.replace(/[W_]+/g,”).toLowerCase() + style; break; case ‘Apple Pay’: imageUrl = cdnPath + name.replace(/[W_]+/g,”).toLowerCase() + style; break; case ‘Bitcoin’: imageUrl = cdnPath + name.replace(/[W_]+/g,”).toLowerCase() + style; break; case ‘Cash’: imageUrl = cdnPath + name.replace(/[W_]+/g,”).toLowerCase() + style; break; case ‘Check’: imageUrl = cdnPath + name.replace(/[W_]+/g,”).toLowerCase() + style; break; case ‘Diners Club’: imageUrl = cdnPath + name.replace(/[W_]+/g,”).toLowerCase() + style; break; case ‘Discover’: imageUrl = cdnPath + name.replace(/[W_]+/g,”).toLowerCase() + style; break; case ‘Financing’: imageUrl = cdnPath + name.replace(/[W_]+/g,”).toLowerCase() + style; break; case ‘Invoice’: imageUrl = cdnPath + name.replace(/[W_]+/g,”).toLowerCase() + style; break; case ‘PayPal’: imageUrl = cdnPath + name.replace(/[W_]+/g,”).toLowerCase() + style; break; case ‘Samsung Pay’: imageUrl = cdnPath + name.replace(/[W_]+/g,”).toLowerCase() + style; break; case “Traveler’s Check”: imageUrl = cdnPath + name.replace(/[W_]+/g,”).toLowerCase() + style; break; } return imageUrl } function emitYextPhoneRenderEvent(phone) { var yextPhoneRenderEvent = new CustomEvent(‘YextPhoneChangeEvent’, { detail: phone, bubbles: true, cancelable: true }); document.dispatchEvent(yextPhoneRenderEvent); } var initYextElements = function(yextData,widgetType){ if (widgetType === ‘address’ && data.config.drawMap) { drawMap(yextData); } else if (widgetType === ‘paymentOptions’ && data.config.showPaymentsAs === ‘paymentIcons’) { displayImageList(widgetType,yextData); } else if (widgetType === ‘phone’ && data.config.phoneShowAs === ‘list’) { displayPhoneList(widgetType,yextData); // check for any list type } else if(widgetType === ‘phone’ && data.config.phoneShowAs === ‘button’) { var phFormatted = formatPhoneBeforeRender(yextData.entities[0].attributes[data.config.phoneType],function(phone) { $(element).find(“.dmButtonLink”).html(” + phone + ”); emitYextPhoneRenderEvent(phone); }); } else if(widgetType === ‘phone’ && data.config.phoneShowAs === ‘text’) { var phFormatted = formatPhoneBeforeRender(yextData.entities[0].attributes[data.config.phoneType],function(phone) { $(element).find(‘.yextPhoneText’).html(” + phone + ”); emitYextPhoneRenderEvent(phone); }); } else if (widgetType === ‘services’ || widgetType === ‘googleAttributesFormatted’ || widgetType === ‘languages’ || widgetType === ‘paymentOptions’ || widgetType === ‘keywords’ || widgetType === ‘products’ || widgetType === ‘associations’ || widgetType === ‘brands’) { setTimeout(function() { displayTextdList(widgetType,yextData) },1); } else if(widgetType === ‘specialties’) { setTimeout(function() { displaySpecialties(yextData) },1) }else if (widgetType ===’serviceArea’) { setTimeout(function() { displayServiceArea(widgetType,yextData,data.config.showServiceAreaFirst) },1) } else if (widgetType ===’hours’ && data.config.hoursShowAs === ‘list’ && data.config.isList == false) { setTimeout(function() { displayHours(widgetType,yextData) },1) } else if (widgetType ===’hours’ && data.config.hoursShowAs === ‘openHours’) { setTimeout(function() { displayOpenHours(widgetType,yextData) },1) } else if (widgetType === ‘social’) { displaySocialIcons(widgetType,yextData); } else if (widgetType === ‘holidayHours’) { setTimeout(function() { displayHolidayHoursList(widgetType,yextData) },1); } else if (widgetType === ‘hours’) { //hide hours list if toggle enabled if(data.config.hideHoursList === true) { $(element).find(‘.yextHours’).css(‘display’,’none’); } } else if (widgetType === ‘description’ || widgetType === ‘yearEstablished’ || widgetType === ’email’ || widgetType === ‘name’) { // check hideIfEmpty(widgetType,yextData) } //remove error if script not entered correctly. $(element).find(‘.wrongScriptError’).removeClass(‘hasError’); } function hideIfEmpty(type,yextData) { if(!yextData.entities[0].attributes[type]) { if(data.inEditor) { $(element).html(emptyListPlaceHolder); } else { $(element).css(‘display’,’none’); } } } // TODO CHANGE TO EVENT CALL BACK var startIntervalToWaitAndLoadWidgets = function(widgetType) { //start interval for this specific widget var intervalCheckYextLoaded = setInterval(function(){ if (window._yextData) { clearInterval(intervalCheckYextLoaded); initYextElements(window._yextData,widgetType); } },50) } /* initialization */ if(data.inEditor){ window.refreshYext && window.refreshYext(); $(document).ready(function(){ if(!window.yextInitialized){ $(element).find(‘.missingYextWidget’).addClass(‘show’); } else { $(element).find(‘.missingYextWidget’).removeClass(‘show’); } }); } else { dmAPI.runOnReady(‘yext’ , function(){ loadYext(); }); // Before navigating with Ajax, we set the yext initialized to be false so it will be initialized again after the ajax navigation dmAPI.runBeforeAjaxNavigation(‘yext’, function(){ window.yextInitialized = false; }); } }; ]]]]]]>]]]]>]]>
  • ‘+getSvg(‘facebook’)+’ ‘); case ‘Tumblr’: href = ‘http://tumblr.com/share/link?url=’+link+’&name=’+encodedTitle; return ( ‘ ‘+getSvg(‘tumblr’)+’ ‘); case ‘LinkedIn’: href = ‘http://www.linkedin.com/shareArticle?mini=true&url=’+link+’&title=’+encodedTitle; statsEventName = ‘CM_SHARE_LINKEDIN’; return ( ‘ ‘+getSvg(‘linkedIn’)+’ ‘); case ‘Twitter’: href = ‘https://twitter.com/intent/tweet?text=’+link; statsEventName = ‘CM_SHARE_TWITTER’; return ( ‘ ‘+getSvg(‘twitter’)+’ ‘); case ‘Reddit’: href = ‘http://www.reddit.com/submit?url=’+link+’&title=’+encodedTitle+’&text=’+encodedTitle; return ( ‘ ‘+getSvg(‘reddit’)+’ ‘); /* case ‘GooglePlus’: href = ‘https://plus.google.com/share?url=’+link; statsEventName = ‘CM_SHARE_GOOGLE_PLUS’; return ( ‘ ‘+getSvg(‘gPlus’)+’ ‘); */ case ‘Pinterest’: href = ‘http://pinterest.com/pin/create/button/?url=’+link+’&description=’+encodedTitle; return ( ‘ ‘+getSvg(‘pinterest’)+’ ‘); default: return ”; } } // // Helpers // // check display type function isMobile() { return data.device === ‘mobile’; } function getItemAction(item, elem) { var statsEventName=”; switch(item.Action) { case ‘Link’: if(!item.Link) item.Link = { target: ‘target=”_blank’, href: ‘http://www.google.com’ } // default link var target = item.Link.target? item.Link.target : ”; var statsEventName = ‘CM_LINK_CLICK’; return ”+elem+”; case ‘Call’: statsEventName = ‘CM_CLICK_TO_CALL’; return ”+elem+”; case ‘Sms’: statsEventName = ‘CM_CLICK_TO_SMS’; return ”+elem+”; case ‘Email’: statsEventName = ‘CM_CLICK_TO_EMAIL’; return ”+elem+”; case ‘Map’: statsEventName = ‘CM_DIRECTION’; return ”+elem+”; case ‘Mess’: statsEventName = ‘CM_FB_MESSAGE’; return ”+elem+”; case ‘Share’: return ”+elem+”; default: return ”; } } // returns new default icon only if icon is default (identified by path data in default svg MUST CHANGE FOR DIFFERENT DEFAUTL) function getItemIcon(item) { // icon is default if(item.CustomIcon) { return ”+item.Icon+”; } else { switch(item.Action) { case ‘Link’: return getSvg(‘link’); case ‘Call’: return getSvg(‘phone’); case ‘Sms’: return getSvg(‘sms’); case ‘Email’: return getSvg(‘envelope’); case ‘Mess’: return getSvg(‘messenger’); case ‘Map’: return getSvg(‘map’); case ‘Share’: return getSvg(‘share’); } } } window._trackConvWidgetClickEvent = function(eventName) { if(typeof(HAF)===”object”){ HAF.OmTracking.onCMClick(eventName) } return; } function dudaicon(icon){ return ”+icon+” } function getSvg(name) { const type = name? name : data.config.DeskMain; switch(type) { case ‘vEllipsis’: return ‘More’; case ‘map’: return ” case ‘hEllipsis’: return ‘More’; case ‘plus’: return ‘More’; case ‘bars’: return ‘More’; case ‘envelope’: return ‘Email’; case ‘shareenvelope’: return ‘Email’; case ‘phone’: return ‘Phone’; case ‘close’: return ‘Close’; case ‘facebook’: return ‘Facebook’; case ‘messenger’: return ‘Facebook Messenger’ case ‘tumblr’: return ‘Tumblr’; case ‘linkedIn’: return ‘LinkedIn’; case ‘twitter’: return ‘Twitter’; case ‘reddit’: return ‘Reddit’; case ‘pinterest’: return ‘Pinterest’; case ‘share’: return ‘Share’; case ‘sms’: return ‘SMS Text’; case ‘link’: return ”; default: return ”; } } }; ]]]]]]>]]]]>]]> ]]> ]]> ]]> ]]> ]]]]>]]> ]]> ]]> ]]]]>]]> ]]> ]]> ]]> ]]> ]]> ]]> ]]>

    {{placeholder_retargeting_pixel}}

    ]]> ]]]]>]]>

    ]]]]>]]> ]]]]>]]> ]]]]>]]> ]]]]>]]>

    ]]> ]]>

    ]]> ]]>

    Source

    For reliable and quality Managed IT ServicesIT Support and VoIP, Contact Precise Business Solutions 

    Network Cabling Blog Form