var stripePublishableKey = ""; var buyNowPostLogin = ""; var showingMoreDomainOptions = false; var myGetBitcoinReceiverInterval = null; var emailSetup = false; var websiteSetup = false; var elements = null; var cardNumberElement = null; var cardExpiryElement = null; var cardCvcElement = null; var postalCodeElement = null; var csrfTokenName = ''; var csrfTokenHash = ''; var usc = false; var auctionTimer = null; var auctionEnd = 0; function showRemaining() { var _second = 1000; var _minute = _second * 60; var _hour = _minute * 60; var _day = _hour *24 var now = new Date(); var distance = auctionEnd - now; if (distance < 0 ) { clearInterval( timer ); document.getElementById('auctionCountdown').innerHTML = 'EXPIRED!'; return; } var days = Math.floor(distance / _day); var hours = Math.floor( (distance % _day ) / _hour ); var minutes = Math.floor( (distance % _hour) / _minute ); var seconds = Math.floor( (distance % _minute) / _second ); var countdown = document.getElementById('auctionCountdown'); countdown.innerHTML = ''; if (days) { countdown.innerHTML += days + 'd '; } countdown.innerHTML += hours+ 'h '; countdown.innerHTML += minutes+ 'm '; countdown.innerHTML += seconds+ 's'; } function hostingAutoRenewSetting(domain, value, e) { $.post("/api/domains/hostingAutoRenewSetting", {domain:domain, value:value}, function(data) { if(data['error'] == '1') { $(e).prop( "checked", !$(e).prop( "checked")); alert(data['message']); return; } else { if(value == 'on') $('#hostingAutoRenewDescription').html("We will attempt to auto renew a couple days before expiration."); else $('#hostingAutoRenewDescription').html("Auto renew is disabled for this hosting product."); } }, "json"); } // data-extension="'.$displayTld.'" data-price-registration="'.$registrationPrice.'" data-price-renewal="'.$renewalPrice.'" data-price-transfer="'.$transferPrice.'" function handleDomainsPricingLabelClick(e) { var sortColumn = $(e).html(); var order = $(this).attr("data-order"); if(!order) order = 'asc'; $(this).attr("data-order", order == "asc" ? "desc" : "asc"); $('.sortIcon').html(""); if(sortColumn == 'extension') { var sorted = getSorted(".domainsPricingAllExtensionsItem", "data-extension", order, "alpha"); $("#sortIcon_extension").html(''); } else if(sortColumn == 'registration') { var sorted = getSorted(".domainsPricingAllExtensionsItem", "data-price-registration", order, "numeric"); $("#sortIcon_registration").html(''); } else if(sortColumn == 'renewal') { var sorted = getSorted(".domainsPricingAllExtensionsItem", "data-price-renewal", order, "numeric"); $("#sortIcon_renewal").html(''); } else if(sortColumn == 'transfer') { var sorted = getSorted(".domainsPricingAllExtensionsItem", "data-price-transfer", order, "numeric"); $("#sortIcon_transfer").html(''); } $("#domainsPricingAllExtensionsPriceRowsContainer").html(""); $(".tldLetterAlphabet").hide(); for(var i = 0; i < sorted.length; i++) { $("#domainsPricingAllExtensionsPriceRowsContainer").append(sorted[i]); } } function getSorted(selector, attrName, order, type) { return $($(selector).toArray().sort(function(a, b){ if(type == "alpha") { var aVal = (a.getAttribute(attrName)), bVal = (b.getAttribute(attrName)); if(order == 'asc') return(aVal.localeCompare(bVal)); else return(bVal.localeCompare(aVal)); } else if(type == "numeric") { var aVal = parseInt(a.getAttribute(attrName)), bVal = parseInt(b.getAttribute(attrName)); if(order == 'asc') return(aVal - bVal); else return(bVal - aVal); } })); } function sortByPrice() { var elements = {}; $('.tldLetterAlphabet').hide(); $('.searchResultsTldLetterBox').hide(); $('.sortByPriceButton').hide(); $('.searchResultRow').each(function() { var price = parseInt(parseFloat($(this).parent().attr('data-price')) * 100); if(!(price in elements)) elements[price] = []; elements[price].push($(this).parent()); }); $('#searchResultsDomainContainer').html(''); var keys = Object.keys(elements).sort(function(a, b) { if(a.position > b.position) return -1; else return 1; }); for(let i = 0; i < keys.length; i++) { for(let j = 0; j < elements[keys[i]].length; j++) { $('#searchResultsDomainContainer').append(elements[keys[i]][j]); } } $('html,body').scrollTop(0); } function showTwoFactorKeyViewOnly() { $('#twoFactorModal_info').hide(); $('#twoFactorModal_form').hide(); $('#twoFactorModalView_button').show(); $('#twoFactorModal_loading').hide(); $('#twoFactorModal_button').hide(); $('#twoFactorModalAlert').html(''); $('#twoFactorModalAlert').hide(''); $("#twoFactorModalCloseButton").prop("onclick", null).off("click"); $('#twoFactorVerificationCode').val(''); $('#twoFactorModal').modal('show'); } function showTwoFactorKeyInitialize() { if(!confirm("Before continuing please make sure that your phone number, email address, and mailing/physical address under \"Account Details\" are true and correct. Valid information is required for account recovery should you become locked out.")) { $('#twoFactorSwitch').prop('checked', false); return; } $('#twoFactorModal_info').show(); $('#twoFactorModal_form').show(); $('#twoFactorModalView_button').hide(); $('#twoFactorModal_loading').hide(); $('#twoFactorModal_button').show(); $('#twoFactorModalAlert').html(''); $('#twoFactorModalAlert').hide(''); $("#twoFactorModalCloseButton").click(function () { $('#twoFactorSwitch').prop('checked', false); }); $('#twoFactorVerificationCode').val(''); $('#twoFactorModal').modal('show'); } function clearSavedCoupons() { $.post("/api/user/clearSavedCoupons", {none:true}, function(data) { if(data['error'] == "1") { } else { window.location.reload(); } }, "json"); } function toggleCloudflare(e, domain) { if(!confirm("Are you sure you want to toggle DNS? This will enable or disable DNS with our backend provider, Cloudflare.")) { $(e).prop('checked', !$(e).prop('checked')); return; } if(!domain) { domain = jQuery.trim($(e).attr('data-domain')); } var idDomain = domain.replace(/\./g, '_'); $('#domainManagementDetailsContent_loudflare_loading_'+idDomain).show(); $('#domainManagementDetailsContent_edit_cloudflare_'+idDomain).hide(); $.post("/api/domains/toggleCloudflare", {domain: domain}, function(data) { $('#domainManagementDetailsContent_loudflare_loading_'+idDomain).hide(); $('#domainManagementDetailsContent_edit_cloudflare_'+idDomain).show(); if(data['error'] == "1") { alert(data['message']); return; } if(data['toggle'] == 'on') { $(e).html("Disable"); } else if(data['toggle'] == 'off') { $(e).html("Enable"); } }, "json"); } function closeMessageModalOpenDns(domain) { $('#messageModal').on('hidden.bs.modal', function () { viewDomainDNS(domain); $('#messageModal').unbind('hidden.bs.modal'); }); $('#messageModal').modal('hide'); } function configureHostingDNS(e, service, subService, additionalDns) { var domain = jQuery.trim($(e).attr('data-domain')); var domainTemplate = jQuery.trim($('#editDNSModal_templateDomain').val()); var prompt = null; var additionalDnsData = {}; if(additionalDns) { $(".configDnsPromptInput").each(function(index, element) { if(!additionalDnsData['index_'+$(element).attr('data-group-index')]) additionalDnsData['index_'+$(element).attr('data-group-index')] = {}; additionalDnsData['index_'+$(element).attr('data-group-index')][$(element).attr('data-name')] = jQuery.trim($(element).val()); }); } else { if(subService) prompt = "Are you sure you want to reconfigure this domain's DNS records? Any conflicting records will be deleted."; else prompt = "Are you sure you want to configure this domain with our hosting DNS records?"; } if(!prompt || (prompt && confirm(prompt))) { $("#configureHostingDNSLoading").show(); $("#configureHostingDNSButton").hide(); $("#editDNSModal_templateContainer").hide(); $("#editDNSModal_templateLoading").show(); $.post("/api/domains/configureServiceDNS", {domain:domain, service:service, subService:subService, additionalDnsData:additionalDnsData, domainTemplate:domainTemplate}, function(data) { $("#editDNSModal_templateContainer").show(); $("#editDNSModal_templateLoading").hide(); if(data['prompts']) { var messageModalBody = ""; for(var i = 0; i < data['prompts']['records'].length; i++) { var promptRecord = data['prompts']['records'][i]; messageModalBody += "

"+promptRecord['type']+"

"; if(promptRecord['description']) { messageModalBody += "

"+promptRecord['description']+"

"; } if(promptRecord['subdomain'] != '@') messageModalBody += '

.'+domain+'


'; else messageModalBody += '

'+domain+'

'; if(promptRecord['contenthidden']) messageModalBody += '
'; else messageModalBody += '

'; } $('#editDNSModal').on('hidden.bs.modal', function () { $('#messageModal_button').attr('data-domain', domain); showMessageModal("Additional DNS Requirements", messageModalBody, null, "Submit", "configureHostingDNS(this, 'quickDns', '"+subService+"', true);", "Close", "closeMessageModalOpenDns('"+domain+"');"); $('#editDNSModal').unbind('hidden.bs.modal'); }); $('#editDNSModal').modal('hide'); } else if(data['error'] == '1') { $("#configureHostingDNSLoading").hide(); $("#configureHostingDNSButton").show(); alert(data['message']); } else { if(subService) { if(data['quickDnsAlert']) { $('#editDNSModal').on('shown.bs.modal', function (e) { $("#quickDnsAlertContent").html(data['quickDnsAlert']); $("#quickDnsAlert").show(); $('#editDNSModal').unbind('shown.bs.modal'); }); } if($('#messageModal').is(':visible')) { $('#messageModal').on('hidden.bs.modal', function () { viewDomainDNS(domain); $('#messageModal').unbind('hidden.bs.modal'); }); $('#messageModal').modal('hide'); } else { viewDomainDNS(domain); } alert("We were able to successfully update your DNS records."); } else { alert("Everything should be back to normal. If not, please contact our support department."); window.location.reload(); } } }, "json"); } } function trapFocus(e) { var focusableEls = $(e).find(':focusable'); var firstFocusableEl = $(focusableEls).first(); var lastFocusableEl = $(focusableEls).last(); $(firstFocusableEl).focus(); $(e).keydown(function(e) { if (e.key === 'Tab' || (typeof KEYCODE_TAB !== 'undefined' && e.keyCode === KEYCODE_TAB)) { if ( e.shiftKey ) /* shift + tab */ { if ($(':focus').is(firstFocusableEl)) { lastFocusableEl.focus(); e.preventDefault(); } } else /* tab */ { if ($(':focus').is(lastFocusableEl)) { firstFocusableEl.focus(); e.preventDefault(); } } } }); } function changeIPSTag(e) { var domain = jQuery.trim($('#modal_changeIPSTag').attr('data-domain')); var tag = jQuery.trim($('#modal_changeIPSTag_tag').val()); $("#modal_changeIPSTag_loading").show(); $("#modal_changeIPSTag_buttons").hide(); $.post("/api/domains/changeIPSTag", {domain:domain, tag:tag}, function(data) { if(data['error'] == '1') { alert(data['message']); } else { alert(data['message']); if(data['redir']) window.location = 'https://'+window.location.hostname+data['redir']; else $('#modal_changeIPSTag').modal('hide'); } $("#modal_changeIPSTag_loading").hide(); $("#modal_changeIPSTag_buttons").show(); }, "json"); } function showChangeIPSTag(e) { var domain = jQuery.trim($(e).attr('data-domain')); $('#modal_changeIPSTag').attr('data-domain', domain); $('#modal_changeIPSTag').modal('show'); } function processBuyAccountCreditAch() { var amount = jQuery.trim($('#modal_buyAccountCreditAch_amount').val()); $("#modal_buyAccountCreditAch_loading").show(); $("#modal_buyAccountCreditAch_buttons").hide(); $.post("/api/user/buyAccountCreditAch", {amount:amount}, function(data) { if(data['error'] == '1') { alert(data['message']); $("#modal_buyAccountCreditAch_loading").hide(); $("#modal_buyAccountCreditAch_buttons").show(); } else { window.location.reload(); } }, "json"); } function showBuyAccountCreditAchModal(e) { $('#modal_buyAccountCreditAch').modal('show'); } function deleteBillingBank() { if(confirm("Are you sure you want to delete this bank account?")) { $.post("/api/user/deleteAch", {post:1}, function(data) { if(data['error'] == '1') { alert(data['message']); } else { window.location.reload(); } }, "json"); } } function verifyAch() { var depositOne = jQuery.trim($("#modal_verifyAch_depositOne").val()); var depositTwo = jQuery.trim($("#modal_verifyAch_depositTwo").val()); $("#modal_verifyAch_loading").show(); $("#modal_verifyAch_buttons").hide(); $.post("/api/user/verifyAch", {depositOne:depositOne, depositTwo:depositTwo}, function(data) { if(data['error'] == '1') { alert(data['message']); $("#modal_verifyAch_loading").hide(); $("#modal_verifyAch_buttons").show(); } else { window.location.reload(); } }, "json"); } function showVerifyBillingBank(e) { $('#modal_verifyAch').modal('show'); } function setupAchConfiguration() { var accountHolderName = jQuery.trim($("#modal_updateAch_accountHolderName").val()); var accountHolderType = jQuery.trim($("#modal_updateAch_accountHolderType").val()); var routingNumber = jQuery.trim($("#modal_updateAch_routingNumber").val()); var accountNumber = jQuery.trim($("#modal_updateAch_accountNumber").val()); $("#modal_updateAch_loading").show(); $("#modal_updateAch_buttons").hide(); stripe.createToken('bank_account', { country: 'US', currency: 'usd', routing_number: routingNumber, account_number: accountNumber, account_holder_name: accountHolderName, account_holder_type: accountHolderType, }) .then(function(result) { if(result['error']) { var message = result['error']['message']; alert(message); $("#modal_updateAch_loading").hide(); $("#modal_updateAch_buttons").show(); } else if(result['token']) { $.post("/api/user/setupAchConfiguration", {stripeResult:result}, function(data) { if(data['error'] == '1') { alert(data['message']); $("#modal_updateAch_loading").hide(); $("#modal_updateAch_buttons").show(); } else { window.location.reload(); } }, "json"); } else { alert("We were unable to submit your bank information."); $("#modal_updateAch_loading").hide(); $("#modal_updateAch_buttons").show(); } }); } function showConfigureAchModal(e) { $.post("/api/user/showConfigureAchModal", {post:1}, function(data) { if(data['error'] == '1') { alert(data['message']); } else { $('#modal_updateAch').modal('show'); } }, "json"); } function showUpdateBillingModal(e) { elements = stripe.elements(); cardNumberElement = elements.create('cardNumber', { style: { base: { color:'#555', fontSize:'21px', '::placeholder':{color:'#b6b6b6'} } }, classes: { focus:'StripeElementFocus' } }); cardNumberElement.mount('#updateBillingModal_cardNumber'); cardExpiryElement = elements.create('cardExpiry', { style: { base: { color:'#555', fontSize:'21px', '::placeholder':{color:'#b6b6b6'} } }, classes: { focus:'StripeElementFocus' } }); cardExpiryElement.mount('#updateBillingModal_expires'); cardCvcElement = elements.create('cardCvc', { style: { base: { color:'#555', fontSize:'21px', '::placeholder':{color:'#b6b6b6'} } }, classes: { focus:'StripeElementFocus' } }); cardCvcElement.mount('#updateBillingModal_cardCode'); postalCodeElement = elements.create('postalCode', { style: { base: { color:'#555', fontSize:'21px', '::placeholder':{color:'#b6b6b6'} } }, classes: { focus:'StripeElementFocus' } }); postalCodeElement.mount('#updateBillingModal_zip'); $("#updateBillingModalTagline").html(''); $("#updateBillingModalTagline").hide(); $("#updateBillingModalForm").show(); $('#updateBillingModalAlert').hide(); $('#updateBillingModal_loading').hide(); $('#updateBillingModal_button').show(); if(e) $('#updateBillingModalHeader').html($(e).attr('data-name')); $('#updateBillingModal').modal('show'); } function toggleCloudflareDomainDNS(e) { var proxied = jQuery.trim($(e).attr("data-cloudplare-proxied")); if(confirm("Are you sure you want to toggle Cloudflare proxy "+(proxied == "on" ? "off" : "on")+"?")) { var dnsIndex = jQuery.trim($(e).attr("data-index")); var domain = jQuery.trim($(e).attr('data-dns-domain')).toLowerCase(); var id = jQuery.trim($(e).attr('data-id')).toLowerCase(); var idDomain = domain.replace(/\./g, '_'); $.post("/api/domains/toggleCloudflareDomainDNS", {id, domain}, function(data) { if(data['error'] == '1') { $('#editDNSModalAlert').html('ERROR: '+data['message']); $('#editDNSModal').scrollTop(0); $('#editDNSModalAlert').show(); } else { if($(e).find(".text-cloudflare-on")[0]) $(e).find(".cloudflareProxiedIcon").removeClass("text-cloudflare-on"); else $(e).find(".cloudflareProxiedIcon").addClass("text-cloudflare-on"); } $(e).removeClass('icon-white'); }, "json"); } } function deleteDomainDNS(e) { if(confirm("Are you sure you want to delete this DNS record?")) { $(e).addClass('icon-white'); $('#editDNSModalAlert').hide(); $('#editDNSModalAlert').html(''); var dnsIndex = $(e).attr("data-index"); var dnsRecord = {}; dnsRecord['id'] = jQuery.trim($(e).attr('data-id')).toLowerCase(); dnsRecord['domain'] = jQuery.trim($(e).attr('data-dns-domain')).toLowerCase(); dnsRecord['type'] = jQuery.trim($(e).attr('data-dns-type')).toUpperCase(); dnsRecord['host'] = jQuery.trim($("#dnsRecordName"+dnsIndex).html()).toLowerCase(); dnsRecord['answer'] = jQuery.trim($("#dnsRecordContent"+dnsIndex).html()).toLowerCase(); var idDomain = dnsRecord['domain'].replace(/\./g, '_'); $.post("/api/domains/deleteDomainDNS", {dnsRecord: dnsRecord}, function(data) { if(data['error'] == '1') { $('#editDNSModalAlert').html('ERROR: '+data['message']); $('#editDNSModal').scrollTop(0); $('#editDNSModalAlert').show(); } else { $('.quickConnectManagementIcon[data-domain="'+dnsRecord['domain']+'"]').removeClass('glyphproOn'); $(e).parent().parent().parent().remove(); $('.editDNSSortItem[data-dns-index='+dnsIndex+']').remove(); $("#domainManagementDetailsContent_dnsRecords_"+idDomain).find('.domainManagementDetailsContent_dnsRecords_content').html(($('#editDNSModalTable >tbody >tr').length / 2)+" records set"); } $(e).removeClass('icon-white'); }, "json"); } else { return; } } function saveToWishList(e) { var itemId = $(e).attr("data-item-id"); $.post("/api/user/saveToWishList", {itemId:itemId}, function(data) { if(data['error'] == '1') { alert(data['message']); } else { location.reload(); } }, "json"); } function pbSimpleHumanCheckerClick_20230305(e) { var pbSimpleHumanCheckerId = $(e).attr("data-id"); var checked = $(e).prop('checked') if(!checked) { $("#"+pbSimpleHumanCheckerId+" .pbSimpleHumanInput").val(''); return; } $.get("/api/user/pbSimpleHumanCheckerClick_20230305", {}, function(data) { if(data['code']) { $("#"+pbSimpleHumanCheckerId+" .pbSimpleHumanInput").val(data['code']); } }, "json"); } function submitNewsletterSubscribe() { var emailAddress = jQuery.trim($('#newsletterEmailAddress').val()); $('#newsletterSubscribeButton').hide(); $('#newsletterSubscribeLoading').show(); $.post("/api/user/newsletterSubscribe", {emailAddress:emailAddress}, function(data) { if(data['error']) { $('#newsletterSubscribeLoading').hide(); $('#newsletterSubscribeButton').show(); alert(data['message']); } else { $("#newsletterSubscribeForm").html("Thanks for subscribing!"); } }, "json"); } function showAddOnSubSelector(e) { var domain = jQuery.trim($(e).attr('data-domain')); var type = jQuery.trim($(e).attr('data-type')); $('.attrDynamic').attr('data-domain', domain); $('#addOnHosting').modal('hide'); if(type == 'managedWordPress') { $('#addOnHosting_managedWordPress').modal('show'); } else if(type == 'staticHosting') { $('#addOnHosting_staticHosting').modal('show'); } else if(type == 'easyBuilder') { $('#addOnHosting_easyBuilder').modal('show'); } else if(type == 'cPanelHosting') { $('#addOnHosting_cPanelHosting').modal('show'); } else if(type == 'managedPHP') { $('#addOnHosting_managedPHP').modal('show'); } else if(type == 'managedLinks') { $('#addOnHosting_managedLinks').modal('show'); } } function showAddOnSelector(e) { var domain = jQuery.trim($(e).attr('data-domain')); var type = jQuery.trim($(e).attr('data-type')); $('.attrDynamic').attr('data-domain', domain); if(type == 'hosting') { $('#addOnHosting').modal('show'); } } function toggleBlurOverlay(e) { if($(e).hasClass('blurOverlay2')) $(e).removeClass('blurOverlay2'); else $(e).addClass('blurOverlay2'); } function resendAccountPhoneVerification() { $.post("/api/user/sendPhoneCode", {markUsedUponSuccess: 1}, function(data) { if(data['error'] == 1) { alert(data['message']); } else { if(data['hasCurrentVerification'] == 1) $('#modal_phoneVerify_notice').html("It looks like we recently sent you a verification code. That verification code is good for 30 minutes from the time it was sent. If you need to generate a new verification code, please wait a few minutes before trying again."); else $('#modal_phoneVerify_notice').html("Verification codes are good for 30 minutes from the time they are sent."); $('#modal_phoneVerify').modal('show'); } }, "json"); } function resendAccountEmailVerification() { $.post("/api/user/sendAccountEmailVerification", {empty:true}, function(data) { if(data['error'] == '1') { alert(data['message']); } else { alert(data['message']); } }, "json"); } function resendAccountEmailBackupVerification() { $.post("/api/user/sendAccountEmailBackupVerification", {empty:true}, function(data) { if(data['error'] == '1') { alert(data['message']); } else { alert(data['message']); } }, "json"); } function processCountry(e, stateId, phoneCodeId) { var country = jQuery.trim($(e).val()); $('#specialCountryMessage').hide(); $('#'+stateId).hide(); $('#'+stateId+'_loading').show(); if(phoneCodeId) $("#"+phoneCodeId+">option[data-countryCode='"+country+"']").prop('selected', true); else $("#newAccountPhoneCode>option[data-countryCode='"+country+"']").prop('selected', true); $.post("/api/user/getStatesByCountry", {country:country}, function(data) { $('#'+stateId).html('