1var CLOUD_JS_FILE_LOADED = 1; 2var AJAXPAGES_URL = '/ajaxPages.php'; 3var AJAXACTIONS_URL = '/ajaxActions.php'; 4var ZONE_UPDATE_STATUS_AUTO_REFRESH = false; 5 6/* ********************* */ 7/* Core functions */ 8/* ********************* */ 9 10 11function number_format(number, decimals, dec_point, thousands_sep) { 12 // Formats a number with grouped thousands 13 // version: 906.1806 14 var n = number, prec = decimals; 15 16 var toFixedFix = function (n,prec) { 17 var k = Math.pow(10,prec); 18 return (Math.round(n*k)/k).toString(); 19 }; 20 21 n = !isFinite(+n) ? 0 : +n; 22 prec = !isFinite(+prec) ? 0 : Math.abs(prec); 23 var sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep; 24 var dec = (typeof dec_point === 'undefined') ? '.' : dec_point; 25 26 var s = (prec > 0) ? toFixedFix(n, prec) : toFixedFix(Math.round(n), prec); //fix for IE parseFloat(0.55).toFixed(0) = 0; 27 28 var abs = toFixedFix(Math.abs(n), prec); 29 var _, i; 30 31 if (abs >= 1000) { 32 _ = abs.split(/\D/); 33 i = _[0].length % 3 || 3; 34 35 _[0] = s.slice(0,i + (n < 0)) + 36 _[0].slice(i).replace(/(\d{3})/g, sep+'$1'); 37 s = _.join(dec); 38 } else { 39 s = s.replace('.', dec); 40 } 41 42 var decPos = s.indexOf(dec); 43 if (prec >= 1 && decPos !== -1 && (s.length-decPos-1) < prec) { 44 s += new Array(prec-(s.length-decPos-1)).join(0)+'0'; 45 } 46 else if (prec >= 1 && decPos === -1) { 47 s += dec+new Array(prec).join(0)+'0'; 48 } 49 return s; 50} 51function htmlspecialchars(str) { 52 if (typeof(str) == "string") { 53 str = str.replace(/&/g, "&"); /* must do & first */ 54 str = str.replace(/"/g, """); 55 str = str.replace(/'/g, "'"); 56 str = str.replace(/</g, "<"); 57 str = str.replace(/>/g, ">"); 58 } 59 return str; 60} 61 62function addslashes(str) { 63 64 if (typeof(str) == "string") { 65 str = str.replace(/\\/g, '\\\\'); 66 str = str.replace(/\t/g, '\\t'); 67 str = str.replace(/\n/g, '\\n'); 68 str = str.replace(/\f/g, '\\f'); 69 str = str.replace(/\r/g, '\\r'); 70 str = str.replace(/"/g, '\\"'); 71 str = str.replace(/'/g, "\\'"); 72 } 73 74 return str; 75} 76 77function showOverlay() { 78 $('#cloudOverlay').show(); 79 $('#cloudOverlay').click(function() { 80 hideCloudPage(0); 81 }); 82} 83function hideOverlay() { 84 $('#cloudOverlay').hide(); 85} 86 87var cloudPageCallback = undefined; 88var cloudPageCallbackPageOpen = undefined; 89 90function hideCloudPage(status) { 91 $('#cloudPage').hide(); 92 hideOverlay(); 93 94 if (typeof(cloudPageCallback) != 'undefined') { 95 if (typeof cloudPageCallback == 'object') { 96 var i; 97 for (i in cloudPageCallback) { 98 cloudPageCallback[i](status); 99 } 100 } else { 101 cloudPageCallback(status); 102 } 103 } 104 cloudPageCallback = undefined; 105} 106 107function showPopup(action, ajaxData, callback, callbackPageOpen) { 108 109 hideCloudPage(); 110 cloudPageCallback = callback; 111 cloudPageCallbackPageOpen = callbackPageOpen; 112 $('#cloudnspop .popup-content').html(''); 113 114 $('#popupOverlay').show(); 115 116 $('#cloudnspop .popup-content').css('min-height', '200px'); 117 $('#cloudnspop .popup-content').html('<div class="a-c lds-roller-centered" style="min-height: inherit;"><div class="lds-roller"><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div></div></div>'); 118 $('#cloudnspop').addClass('show'); 119 120 fixPopupPosition('#cloudnspop'); 121 $(window).resize(function() { 122 fixPopupPosition('#cloudnspop'); 123 }); 124 125 if (typeof ajaxData != 'undefined') { 126 action = action + ajaxData; 127 } 128 129 $.get(AJAXPAGES_URL + '?action=' + action + '&nocache='+ (new Date).getTime(), function(data) { 130 $('#cloudnspop .popup-content').css('min-height', '0'); 131 $('#cloudnspop .popup-content').html(data); 132 fixPopupPosition('#cloudnspop'); 133 134 if (typeof cloudPageCallbackPageOpen !== 'undefined') { 135 cloudPageCallbackPageOpen(); 136 } 137 }); 138} 139 140 141function hidePopup(status) { 142 $('#cloudnspop').removeClass('show'); 143 $('#popupOverlay').hide(); 144 145 if (typeof(cloudPageCallback) != 'undefined') { 146 if (typeof cloudPageCallback == 'object') { 147 var i; 148 for (i in cloudPageCallback) { 149 cloudPageCallback[i](status); 150 } 151 } else { 152 cloudPageCallback(status); 153 } 154 } 155 cloudPageCallback = undefined; 156} 157 158function addCloudPageCallBack (callback) { 159 if (typeof cloudPageCallback == 'undefined') { 160 cloudPageCallback = callback; 161 } else if (typeof cloudPageCallback == 'object') { 162 cloudPageCallback.push(callback); 163 } else { 164 var newCallback = [cloudPageCallback, callback]; 165 cloudPageCallback = newCallback; 166 } 167} 168
169var insideCloudPageSharedZonesRequest = 0; 170var insideCloudPageSharedSslsRequest = 0; 171function insideCloudPage(insideElement, action, ajaxData, callback) { 172 var sharedZonesRequest = 0; 173 if (insideElement == 'shared-zones-table-body') { 174 sharedZonesRequest = ++insideCloudPageSharedZonesRequest; 175 } 176 177 var sharedSslsRequest = 0; 178 if (insideElement == 'shared-ssls-table-body') { 179 sharedSslsRequest = ++insideCloudPageSharedSslsRequest; 180 } 181 182 if ($('#' + insideElement).css('display') == 'none') { 183 $('#' + insideElement).css('display', 'block'); 184 } 185 186 if (insideElement == 'subUsersTableBody' || insideElement == 'zoneStatus' || insideElement == 'zones-table-body' || insideElement == 'shared-zones-table-body' || insideElement == 'domains-table-body' || insideElement == 'monitoring-table-body' || insideElement == 'shared-monitoring-records-table-body' || insideElement == 'failover-table-body' || insideElement == 'shared-ssls-table-body') { 187 $('#' + insideElement).html('<tr><td colspan="8"><div class="a-c lds-roller-centered"><div class="lds-roller"><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div></div></div></td></tr>'); 188 } else { 189 $('#' + insideElement).html('<div class="a-c lds-roller-centered"><div class="lds-roller"><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div></div></div>'); 190 } 191 192 if ($('#' + insideElement).css('height') == '0px') { 193 $('#' + insideElement).css('min-height', '200px'); 194 } else { 195 $('#' + insideElement).css('min-height', $('#' + insideElement).css('height')); 196 } 197 198 $.post(AJAXPAGES_URL + '?action=' + action + '&nocache='+ (new Date).getTime(), ajaxData, function(data) { 199 if (data == 'error') { 200 window.location = '/'; 201 return true; 202 } 203 if (insideElement == 'shared-zones-table-body' && sharedZonesRequest != insideCloudPageSharedZonesRequest) { 204 return true; 205 } 206 if (insideElement == 'shared-ssls-table-body' && sharedSslsRequest != insideCloudPageSharedSslsRequest) { 207 return true; 208 } 209 210 $('#' + insideElement).html(data); 211 $('#' + insideElement).css('min-height', '0px'); 212 213 if (insideElement == 'domains-table-body') { 214 initDomainsTableBody(); 215 } 216 217 if (insideElement == 'monitoring-table-body') { 218 initMonitoringTableBody(); 219 } 220 221 if (insideElement == 'zones-table-body') { 222 initZoneTableBody(); 223 } 224 225 if (insideElement == 'shared-zones-table-body') { 226 initSharedZonesTableBody(); 227 } 228 229 if (insideElement == 'failover-table-body') { 230 initFailoverTableBody(); 231 } 232 233 if (typeof(callback) != 'undefined') { 234 callback(); 235 } 236 }); 237} 238 239function initDomainsTableBody() { 240 $(".showNoteTitle, .showDomainsTitle").tooltip({ 241 track: true, 242 delay: 0, 243 showURL: false, 244 showBody: "<body>", 245 fade: 250 246 }); 247 updateDomainsTableColSpan(); 248} 249 250function updateDomainsTableColSpan() { 251 fixTableColSpan($('.domains-group-column').length ? 1 : 0, '.colspan-1020'); 252} 253 254function insideCloudPageAdd(insideElement, action, ajaxData) { 255 $.post(AJAXPAGES_URL + '?action=' + action + '&nocache='+ (new Date).getTime(), ajaxData, function(data) { 256 if (data == 'error') { 257 window.location = '/'; 258 return true; 259 } 260 261 $('#' + insideElement).html($('#' + insideElement).html() + data); 262 fixPopupPosition('#cloudnspop'); 263 }); 264} 265 266var CLOUD_MESSAGE_CALLBACK = undefined; 267function hideCloudMessage(status) { 268 $('#cloudMessageContent').html(''); 269 $('#cloudMessage').hide(); 270 $('#cloudSecondOverlay').hide(); 271 272 if (typeof CLOUD_MESSAGE_CALLBACK !== 'undefined') { 273 CLOUD_MESSAGE_CALLBACK(status); 274 } 275} 276 277var popupMessageCallbackOpen = undefined; 278function showPopupMessage(message, callback, callbackOpen) { 279 CLOUD_MESSAGE_CALLBACK = callback; 280 popupMessageCallbackOpen = callbackOpen; 281 282 $('#popupSecondOverlay').show(); 283 284 $('#popup-message').addClass('show'); 285 286 $('#popup-message .popup-content').html(message); 287 fixPopupPosition('#popup-message'); 288 289 $(window).resize(function() { 290 fixPopupPosition('#popup-message'); 291 }); 292 293 if (typeof popupMessageCallbackOpen !== 'undefined') { 294 popupMessageCallbackOpen(); 295 } 296} 297function hidePopupMessage(status) { 298 $('#popup-message .popup-content').html(''); 299 $('#popup-message').removeClass('show'); 300 $('#popupSecondOverlay').hide(); 301 302 if (typeof CLOUD_MESSAGE_CALLBACK !== 'undefined') { 303 CLOUD_MESSAGE_CALLBACK(status); 304 } 305} 306 307var POPUP_CONFIRMATION_CALLBACK_OK = undefined; 308var POPUP_CONFIRMATION_CALLBACK_CANCEL = undefined; 309function showConfirmation (message, callback_ok, callback_cancel) { 310 POPUP_CONFIRMATION_CALLBACK_OK = callback_ok; 311 POPUP_CONFIRMATION_CALLBACK_CANCEL = callback_cancel; 312 $('#popupConfirmationOverlay').show(); 313 $('#popup-confirmation').addClass('show'); 314 $('#popup-confirmation .popup-content').addClass('ww-bw'); 315 316 var escapedMessage = $('<div>').text(message).html(); 317 escapedMessage = escapedMessage.replace(/<br>/g, '<br/>').replace(/<strong>/g, '<strong>').replace(/<\/strong>/g, '</strong>'); 318 $('#popup-confirmation .popup-content').html(escapedMessage); 319 320 fixPopupPosition('#popup-confirmation'); 321 $(window).resize(function() { 322 fixPopupPosition('#popup-confirmation'); 323 }); 324} 325 326function hideConfirmation (status) { 327 if (typeof status !== 'undefined' && status && typeof POPUP_CONFIRMATION_CALLBACK_OK !== 'undefined') { 328 POPUP_CONFIRMATION_CALLBACK_OK(status); 329 } 330 if (typeof status !== 'undefined' && !status && typeof POPUP_CONFIRMATION_CALLBACK_CANCEL !== 'undefined') { 331 POPUP_CONFIRMATION_CALLBACK_CANCEL(status); 332 } 333 $('#popup-confirmation .popup-content').html(''); 334 $('#popup-confirmation').removeClass('show'); 335 $('#popupConfirmationOverlay').hide(); 336} 337 338function fixPopupPosition(element, scroll, forceAbsolute, forceScroll = false) {
339 var overlay = '#popupOverlay'; 340 if (element == '#popup-confirmation') { 341 overlay = '#popupConfirmationOverlay'; 342 } 343 344 if (element == '#popup-message') { 345 overlay = '#popupSecondOverlay'; 346 } 347 348 if (forceAbsolute == true) { 349 positionAbsolute(element, scroll, forceScroll); 350 } else { 351 if (($(element + ' ' + overlay).height() > ($(element + ' .popup-wraper').height() + parseInt($(element + ' .popup-wraper').css('top')) + parseInt($(element + ' .popup-wraper').css('margin-bottom'))))) { 352 $(element).css('position', 'fixed'); 353 $(element + ' .popup-wraper').css('position', 'relative'); 354 } else { 355 positionAbsolute(element, scroll, forceScroll); 356 } 357 } 358} 359 360function positionAbsolute (element, scroll, forceScroll = false) { 361 if (!forceScroll && $(element).css('position') === 'absolute') { 362 return; 363 } 364 365 $(element).css('position', 'absolute'); 366 $(element + ' .popup-wraper').css('position', 'relative'); 367 if (typeof(scroll) == 'undefined' || scroll == true) { 368 window.scrollTo(0, 0); 369 } 370} 371 372function positionRelative (element, scroll) { 373 $(element).css('position', 'absolute'); 374 $(element + ' .popup-wraper').css('position', 'absolute'); 375 if (typeof(scroll) == 'undefined' || scroll == true) { 376 window.scrollTo(0, 0); 377 } 378} 379 380function userData() { 381 $.post(AJAXACTIONS_URL + '?action=userData', { 382 'type': 'userData' 383 }, function(response) { 384 385 if (typeof(response) == 'undefined') { 386 return false; 387 } 388 389 $('#userDataZones').html(response.zones_used); 390 $('#userDataZonesAvailable').html(response.zones_available); 391 $('#userDataMailForwards').html(response.mail_forwards_used); 392 $('#userDataMailForwardsAvailable').html(response.mail_forwards_available); 393 $('#userDataRecords').html(response.records_used); 394 $('#userDataRecordsAvailable').html(response.records_available); 395 $('#userDataDynHostsAvailable').html(response.dyndns_hosts_available); 396 $('#userDataDynHostsUsed').html(response.dyndns_hosts_used); 397 $('.userDataPlan').html(''); 398 $('.userDataPlan').prop('title', response.user_plan + '<br>' + response.user_premium_time); 399 400 $(".user-data-tooltip").tooltip({ 401 track: true, 402 delay: 0, 403 showURL: false, 404 showBody: "<body>", 405 fade: 250 406 }); 407 408 if (typeof response.failover_available !== 'undefined') { 409 $('#userDataFailover').html(response.failover_used); 410 $('#userDataFailoverAvailable').html(response.failover_available); 411 } 412 }, 'json'); 413} 414 415function removeFieldChars (element, chars) { 416 $.each(chars, function (index, char) { 417 if ($('#' + element).length) { 418 $('#' + element).val($('#' + element).val().replace(char, '')); 419 } 420 }); 421} 422 423function countDown (element, time, callback) { 424 // new timer 425 if (typeof time !== 'undefined') { 426 $(element).data('time', time); 427 $(element).data('callback', callback); 428 } 429 430 var timeLeft = parseInt($(element).data('time')) - 1; 431 if (timeLeft <= 0) { 432 var elementCallback = $(element).data('callback'); 433 if (typeof elementCallback !== 'undefined') { 434 elementCallback(); 435 } 436 return false; 437 } 438 439 $(element).html(timeToString(timeLeft)); 440 $(element).data('time', timeLeft); 441 442 setTimeout(function () { 443 countDown(element); 444 }, 1000); 445} 446function timeToString (time) { 447 var days = 0; 448 var hours = 0; 449 var minutes = 0; 450 var seconds = 0; 451 if (time > 24*60*60) { 452 days = Math.floor(time / (24*60*60)); 453 } 454 if (time > 60*60) { 455 hours = Math.floor((time - days * 24*60*60) / (60*60)); 456 } 457 if (time > 60) { 458 minutes = Math.floor((time - days * 24*60*60 - hours * 60*60) / 60); 459 } 460 seconds = Math.floor(time - days * 24*60*60 - hours * 60*60 - minutes * 60); 461 462 if (days > 1) { 463 return days +" "+ translate('days') +" "+ formatTimeNumber(hours) +":"+ formatTimeNumber(minutes) +":"+ formatTimeNumber(seconds); 464 } 465 if (days === 1) { 466 return days +" "+ translate('day') +" "+ formatTimeNumber(hours) +":"+ formatTimeNumber(minutes) +":"+ formatTimeNumber(seconds); 467 } 468 return formatTimeNumber(hours) +":"+ formatTimeNumber(minutes) +":"+ formatTimeNumber(seconds); 469} 470function formatTimeNumber (number) { 471 if (number < 10) { 472 return "0"+ number; 473 } 474 return number; 475} 476 477var TRANSLATIONS_MAP = []; 478function translate (tag) { 479 if (typeof TRANSLATIONS_MAP[tag] !== 'undefined') { 480 return TRANSLATIONS_MAP[tag]; 481 } 482 return tag; 483} 484function __ (tag) { 485 return translate(tag); 486} 487 488function __js(translation) { 489 return addslashes(translation); 490} 491 492function addTranslation (tag, translation) { 493 TRANSLATIONS_MAP[tag] = translation; 494 return true; 495} 496 497function openLink (element) { 498 if ($(element).length) { 499 var target = $(element).data('target'); 500 var href = $(element).data('href'); 501
502 if (target == '_blank') { 503 window.open(href); 504 } else { 505 window.location.href = href; 506 } 507 508 if (href.includes('data-centers')) { 509 toggleDataCenterBox(); 510 } 511 } 512} 513 514function toggleDataCenterBox () { 515 var path = window.location.href; 516 var element = path.split('/data-centers/')[1]; 517 518 if (element && element.includes("/") === false && !$(element).children(".news").hasClass("news-focus")) { 519 $(element).children(".news").toggleClass("news" + "-focus"); 520 } 521} 522 523function showDataCenterPopup (datacenter) { 524 showPopup('data-centers', '&show=dataCenter&datacenter=' + datacenter, null, function(){ 525 setTimeout(function () { 526 fixPopupPosition('#cloudnspop'); 527 }, 100); 528 }); 529} 530 531function logWebsiteLatency () { 532 $.post(AJAXACTIONS_URL + '?action=latency', { 533 'type': 'log', 534 'uri': window.location.pathname, 535 'ttfb': WL_TTFB, 536 'fcp': WL_FCP, 537 'rt': WL_RT, 538 'static': STATIC_URL, 539 'version': STATIC_VERSION 540 }); 541} 542 543/* ********************* */ 544/* INDEX */ 545/* ********************* */ 546function saveCookiesConsent (analytics, advertisement) { 547 var analyticsGranted = analytics ? 'granted':'denied'; 548 var advertisementGranted = advertisement ? 'granted':'denied'; 549 550 $.post(AJAXACTIONS_URL + '?action=index', { 551 'type': 'consent', 552 'analytics': analytics, 553 'advertisement': advertisement 554 }, function(response) { 555 if (response.enable_tracking === true) { 556 activateConsent(advertisementGranted, analyticsGranted); 557 } 558 $('#cookiesAlert').hide(); 559 hidePopup(); 560 }, 'json'); 561 return false; 562} 563 564function activateConsent (advertisementGranted, analyticsGranted) { 565 if (!ENABLE_TRACKING) { 566 return true; 567 } 568 569 gtag('consent', 'update', { 570 'ad_storage': advertisementGranted, 571 'ad_user_data': advertisementGranted, 572 'ad_personalization': advertisementGranted, 573 'analytics_storage': analyticsGranted 574 }); 575 576 if (typeof window.pushMicrosoftConsent === 'function') { 577 window.pushMicrosoftConsent('update', advertisementGranted); 578 } 579 580 return true; 581} 582 583var REGISTRATION_ACTION; 584var REGISTRATION_TYPE; 585function showRegisterForm(type, action) { 586 var register = ''; 587 if (typeof(type) !== 'undefined') { 588 register = '®ister='+type; 589 } 590 REGISTRATION_TYPE = type; 591 592 // registration action 593 if (typeof(action) === 'undefined') { 594 action = 'undefined'; 595 } 596 REGISTRATION_ACTION = action; 597 598 showPopup('index', '&show=registerForm®istrationAction='+ REGISTRATION_ACTION + register, function() { 599 $('.tipsy').remove(); 600 $('#cloudnspop').removeClass('popup-login'); 601 }, function() { 602 $('#cloudnspop').addClass('popup-login'); 603 }); 604} 605var blockSignUp = false; 606function register() { 607 608 if (blockSignUp == true) { 609 return false; 610 } 611 blockSignUp = true; 612 blockButton('signupButton', 'signup_loading', 'block'); 613 614 var hcaptchaResponse = ''; 615 if ($('.register-form .h-captcha').length && typeof hcaptcha_id !== 'undefined') { 616 loadJs(function () { 617 hcaptchaResponse = hcaptcha.getResponse(hcaptcha_id); 618 registerPost('register', hcaptchaResponse, function(){unBlockButton('signupButton', 'signup_loading', 'block');}); 619 }, 'hcaptcha'); 620 } else { 621 registerPost('register', '', function(){unBlockButton('signupButton', 'signup_loading', 'block');}); 622 } 623} 624 625function registerPost (type, hcaptchaResponse, callback) { 626 var mobile = false; 627 if ($('.popup').width() < 800) { 628 mobile = true; 629 } 630 $.post(AJAXACTIONS_URL + '?action=index', { 631 'type': type, 632 'name': $('#registerName').val(), 633 'mail': $('#registerMail').val(), 634 'password': $('#registerPassword').val(), 635 'tos': $('#registerTos').is(':checked') ? 1 : 0, 636 'registrationDomain': window.location.host, 637 'registrationPage': window.location.pathname, 638 'registrationAction': REGISTRATION_ACTION, 639 'mobile': mobile, 640 'captcha': hcaptchaResponse 641 }, function(response) { 642 blockSignUp = false; 643 blockDirectSignUp = false; 644 $('#registerName').tipsy('hide'); 645 $('#registerMail').tipsy('hide'); 646 $('#registerPassword').tipsy('hide'); 647 $('#registerTos').parent().tipsy('hide'); 648 $('#registerName').removeClass('error'); 649 $('#registerMail').removeClass('error'); 650 $('#registerPassword').removeClass('error'); 651 if (response.showcaptcha) { 652 showPopupMessage(response.message, function () { 653 showRegisterForm(REGISTRATION_TYPE, REGISTRATION_ACTION); 654 }); 655 } 656 if (typeof(response.message) !== 'undefined') { 657 showPopupMessage(response.message); 658 if (!response.status) { 659 hidePopup(); 660 showRegisterForm(REGISTRATION_TYPE, REGISTRATION_ACTION); 661 } 662 } 663 if (typeof(response.errors) !== 'undefined') { 664 var popupMessage = ''; 665 if (mobile === true) { 666 popupMessage += response.errors.title + '<br>'; 667 } 668 669 $.each(response.errors, function(type, message) { 670 var html_enable = false;
671 switch (type) { 672 case 'name': 673 var element = $('#registerName'); 674 element.addClass('error'); 675 popupMessage += '- ' + message + '<br>'; 676 break; 677 case 'activation': 678 var element = $('#registerMail'); 679 element.addClass('error'); 680 html_enable = true; 681 popupMessage += '- ' + message + '<br>'; 682 break; 683 case 'mail': 684 var element = $('#registerMail'); 685 element.addClass('error'); 686 popupMessage += '- ' + message + '<br>'; 687 break; 688 case 'password': 689 var element = $('#registerPassword'); 690 element.addClass('error'); 691 popupMessage += '- ' + message + '<br>'; 692 break; 693 case 'tos': 694 var element = $('#registerTos').parent(); 695 popupMessage += '- ' + message + '<br>'; 696 break; 697 case 'title': 698 var element = true; 699 break; 700 default: 701 var element = false; 702 break; 703 } 704 705 if (mobile === true) { 706 showPopupMessage(popupMessage); 707 } else if (element === false) { 708 showPopupMessage(message); 709 } else { 710 if (element === true) { 711 return true; 712 } 713 element.attr('title', message); 714 element.tipsy({ 715 gravity: 'w', 716 trigger: 'manual', 717 html: html_enable 718 }); 719 element.tipsy('show'); 720 $(window).resize(function(){ 721 element.tipsy('show'); 722 }); 723 } 724 }); 725 } 726 callback(response.status); 727 }, 'json'); 728} 729 730var DIRECT_REGISTER_CALLBACK = false; 731var blockDirectSignUp = false; 732function directRegister(callback, enableLogin) { 733 DIRECT_REGISTER_CALLBACK = callback; 734 735 if (blockDirectSignUp == true) { 736 return false; 737 } 738 blockDirectSignUp = true; 739 blockButton('signupButton', 'signup_loading', 'block'); 740 741 var newcallback = function(status) { 742 unBlockButton('signupButton', 'signup_loading', 'block'); 743 if (status) { 744 if (typeof (DIRECT_REGISTER_CALLBACK) === 'undefined' || !DIRECT_REGISTER_CALLBACK) { 745 window.location.href = '/main/?directRegister=1'; 746 } else { 747 DIRECT_REGISTER_CALLBACK(1); 748 } 749 } 750 }; 751 var hcaptchaResponse = ''; 752 if ($('.register-form .h-captcha').length && typeof hcaptcha_id !== 'undefined') { 753 loadJs(function () { 754 hcaptchaResponse = hcaptcha.getResponse(hcaptcha_id); 755 registerPost('directRegister', hcaptchaResponse, newcallback); 756 757 }, 'hcaptcha'); 758 } else { 759 registerPost('directRegister', hcaptchaResponse, newcallback); 760 } 761 762 return false; 763} 764 765var blockLogin = false; 766var TWOFA_USER_MAIL = TWOFA_USER_PASSWORD = TWOFA_ENTER_TOKEN = ''; 767function login() { 768 if (blockLogin == true) { 769 return false; 770 } 771 blockLogin = true; 772 blockButton('loginButton', 'login_loading'); 773 $.post(AJAXACTIONS_URL + '?action=index', { 774 'type': 'login', 775 'mail': $('#loginMail').val(), 776 'password': $('#loginPassword').val() 777 }, function(response) { 778 unBlockButton('loginButton', 'login_loading'); 779 blockLogin = false; 780 if (response.status == 0) { 781 if (response.twofa) { 782 TWOFA_USER_MAIL = $('#loginMail').val(); 783 TWOFA_USER_PASSWORD = $('#loginPassword').val(); 784 TWOFA_ENTER_TOKEN = response.message; 785 show2FALoginForm(); 786 } else { 787 showPopupMessage(response.message); 788 } 789 } else { 790 if (REGISTRATION_TYPE === 'cart' && REGISTRATION_ACTION === 'cart-continue') { 791 window.location = '/order/step/1/'; 792 return; 793 } 794 795 window.location = '/main/'; 796 } 797 }, 'json'); 798 return false; 799} 800function show2FALoginForm (direct) { 801 var register = ''; 802 if (typeof(direct) !== 'undefined') { 803 register = '®ister=direct'; 804 } 805 showPopup('index', '&show=2FALoginForm' + register, 806 function() { 807 TWOFA_USER_MAIL = TWOFA_USER_PASSWORD = TWOFA_ENTER_TOKEN = ''; 808 $('.tipsy').remove(); 809 $('#cloudnspop').removeClass('popup-login'); 810 }, 811 function () { 812 $('#login2FAMail').val(TWOFA_USER_MAIL); 813 $('#login2FAPassword').val(TWOFA_USER_PASSWORD); 814 $('#login2FAToken').attr('title', TWOFA_ENTER_TOKEN); 815 $('#cloudnspop').addClass('popup-login'); 816 } 817 ); 818} 819 820var LOGIN_2FA_CALLBACK = false; 821var blockLogin2FA = false; 822function login2FA (callback) { 823 if (blockLogin2FA == true) { 824 return false;
825 } 826 blockLogin2FA = true; 827 blockButton('login2faButton', 'login2fa_loading', 'block'); 828 829 LOGIN_2FA_CALLBACK = callback; 830 var newcallback = function() { 831 unBlockButton('login2faButton', 'login2fa_loading', 'block'); 832 } 833 834 var hcaptchaResponse = ''; 835 if ($('.register-form .h-captcha').length && typeof hcaptcha_id !== 'undefined') { 836 loadJs(function() { 837 hcaptchaResponse = hcaptcha.getResponse(hcaptcha_id); 838 loginPost(hcaptchaResponse, newcallback); 839 }, 'hcaptcha'); 840 } else { 841 loginPost('', newcallback); 842 } 843 844 return false; 845} 846 847function loginPost (hcaptchaResponse, callback) { 848 $.post(AJAXACTIONS_URL + '?action=index', { 849 type: 'login2FA', 850 mail: $('#login2FAMail').val(), 851 password: $('#login2FAPassword').val(), 852 token: $('#login2FAToken').val(), 853 captcha: hcaptchaResponse 854 }, function(response) { 855 callback(); 856 blockLogin2FA = false; 857 if (!response.status) { 858 if (typeof(LOGIN_2FA_CALLBACK) === 'undefined' || !LOGIN_2FA_CALLBACK) { 859 if (response.showcaptcha) { 860 showPopupMessage(response.message, function () { 861 show2FALoginForm(); 862 }); 863 } else { 864 showPopupMessage(response.message); 865 } 866 } else { 867 LOGIN_2FA_CALLBACK(0, response.message); 868 } 869 } else { 870 if (REGISTRATION_TYPE === 'cart' && REGISTRATION_ACTION === 'cart-continue') { 871 window.location.href = '/order/step/1/'; 872 return; 873 } 874 875 if (typeof(LOGIN_2FA_CALLBACK) === 'undefined' || !LOGIN_2FA_CALLBACK) { 876 if (response.dashboard) { 877 window.location.href = '/main/dashboard/' + response.dashboard + '/'; 878 } else { 879 window.location.href = '/main/'; 880 } 881 } else { 882 LOGIN_2FA_CALLBACK(1); 883 } 884 } 885 }, 'json'); 886} 887 888function loginPromo2FA () { 889 var token = $('#login2FAToken').val(); 890 if (token === '') { 891 token = 0; 892 } 893 window.location = '/promo/code/' + $('#login2FAPromoCode').val() + '/twofa/' + token + '/'; 894} 895 896function requestActivation(mail) { 897 $.post(AJAXACTIONS_URL + '?action=index', { 898 'type': 'requestActivationMail', 899 'mail': mail 900 }, function(response) { 901 $('#registerMail').tipsy('hide'); 902 $('#registerPassword').tipsy('hide'); 903 $('#registerTos').parent().tipsy('hide'); 904 if (typeof(response.message) != 'undefined') { 905 showPopupMessage(response.message); 906 } 907 }, 'json'); 908} 909var blockConfirmReg = false; 910function confirmRegistration (key) { 911 if (blockConfirmReg == true) { 912 return false; 913 } 914 blockConfirmReg = true; 915 blockButton('confirmRegButton', 'confirmReg_loading', 'block'); 916 $.post(AJAXACTIONS_URL + '?action=index', { 917 'type': 'confirmRegistration', 918 'token': key 919 }, function(response) { 920 unBlockButton('confirmRegButton', 'confirmReg_loading', 'block'); 921 blockConfirmReg = false; 922 if (response.status == 0) { 923 showPopupMessage(response.message); 924 } else { 925 if (response.page == 'monitoring') { 926 window.location = '/main/dashboard/monitoring/?firstLogin=1'; 927 } else if (response.page == 'cart') { 928 window.location = '/order/step/1/'; 929 } else { 930 window.location = '/main/?firstLogin=1'; 931 } 932 } 933 }, 'json'); 934} 935 936function forgottenPassword () { 937 if (typeof hcaptcha_id !== 'undefined') { 938 loadJs(function() { 939 var hcaptchaResponse = ''; 940 if ($('.forgotten-password-form .h-captcha').length) { 941 hcaptchaResponse = hcaptcha.getResponse(hcaptcha_id); 942 } 943 $.post(AJAXACTIONS_URL + '?action=index', { 944 'type': 'forgottenPassword', 945 'mail': $('#mail').val(), 946 'captcha': hcaptchaResponse 947 }, function (response) { 948 if (response) { 949 if (response.status == 0) { 950 showPopupMessage(response.message, function() { 951 location.reload(); 952 }); 953 } else { 954 showPopupMessage('<p class="a-c">' + response.message + '</p>' + '<button onclick="hidePopupMessage();" class="h-c round-btn m-btn color-btn mt-20">' + __('okay') + '</button>', function () { 955 location.reload(); 956 }); 957 } 958 } 959 }, 'json'); 960 return false; 961 }, 'hcaptcha'); 962 } 963} 964blockChangePassword = false; 965function changePassword () { 966 if (blockChangePassword == true) { 967 return false; 968 } 969 970 blockChangePassword = true; 971 blockButton('changePasswordButton', 'changePasswordButton_loading', 'block'); 972 973 $.post(AJAXACTIONS_URL + '?action=index', { 974 'type': 'changePassword', 975 'password': $('#new_password').val(), 976 'verify_password': $('#verify_password').val(), 977 'request': $('#request').val() 978 }, function (response) { 979 unBlockButton('changePasswordButton', 'changePasswordButton_loading', 'block'); 980 blockChangePassword = false;
981 if (response.status == 1) { 982 showPopupMessage('<p class="a-c">' + response.message + '</p>' + '<button onclick="hidePopupMessage();" class="h-c round-btn m-btn color-btn mt-20">' + __('okay') + '</button>', function () { 983 window.location.href = '/index/show/login/'; 984 }); 985 } else { 986 showPopupMessage(response.message); 987 } 988 }, 'json'); 989 return false; 990} 991 992function show2faDeactivationForm () { 993 showPopup('index', '&show=deactivate2faForm', function() { 994 $('.tipsy').remove(); 995 $('#cloudnspop').addClass('popup-login'); 996 }, function() { 997 $('#cloudnspop').addClass('popup-login'); 998 }); 999} 1000 1001blockDeactivate2FA = false; 1002function index_deactivate2FA () { 1003 if (blockDeactivate2FA == true) { 1004 return false; 1005 } 1006 blockDeactivate2FA = true; 1007 blockButton('deactivate2faButton', 'deactivate2fa_loading', 'block'); 1008 loadJs(function() { 1009 var hcaptchaResponse = ''; 1010 if ($('.register-form .h-captcha').length && typeof hcaptcha_id !== 'undefined') { 1011 hcaptchaResponse = hcaptcha.getResponse(hcaptcha_id); 1012 } 1013 1014 $.post(AJAXACTIONS_URL + '?action=index', { 1015 'type': 'deactivate2FA', 1016 'password': $('#deactivate2FAPassword').val(), 1017 'token': $('#deactivate2FAToken').val(), 1018 'mail': $('#deactivate2FAMail').val(), 1019 'captcha': hcaptchaResponse 1020 }, function (response) { 1021 unBlockButton('deactivate2faButton', 'deactivate2fa_loading', 'block'); 1022 blockDeactivate2FA = false; 1023 if (response) { 1024 if (response.status == 1) { 1025 showPopupMessage(response.message); 1026 hideCloudPage(); 1027 show2FALoginForm() 1028 } else { 1029 showPopupMessage(response.message, function() { 1030 show2faDeactivationForm() 1031 }); 1032 } 1033 } 1034 }, 'json'); 1035 return false; 1036 }, 'hcaptcha'); 1037} 1038 1039var FEATURES_PAGE = 1; 1040var FEATURES_PAGES = 10; 1041function featuresChange(page) { 1042 if (page > FEATURES_PAGES) { 1043 page = 1; 1044 } 1045 if (FEATURES_PAGE == page) { 1046 return false; 1047 } 1048 $('.features .pages. .page' + FEATURES_PAGE).fadeOut(1000); 1049 $('.features .paging .page' + FEATURES_PAGE).delay(1000).removeClass('active'); 1050 $('.features .pages. .page' + page).fadeIn(1000); 1051 $('.features .paging .page' + page).delay(1000).addClass('active'); 1052 1053 FEATURES_PAGE = page; 1054 return true; 1055} 1056function featuresChangeAuto() { 1057 setTimeout(function() { 1058 featuresChange(FEATURES_PAGE+1); 1059 featuresChangeAuto(); 1060 }, 5000); 1061} 1062/* ********************* */ 1063/* SIGNUP REQUIREMENT */ 1064/* ********************* */ 1065 1066var blockLoginReq = false; 1067function loginReq() { 1068 if (blockLoginReq == true) { 1069 return false; 1070 } 1071 blockLoginReq = true; 1072 blockButton('signupRecuiredLoginButton', 'signup_required_loading'); 1073 $.post(AJAXACTIONS_URL + '?action=index', { 1074 'type': 'login', 1075 'mail': $('#loginMailReq').val(), 1076 'password': $('#loginPasswordReq').val() 1077 }, function(response) { 1078 unBlockButton('signupRecuiredLoginButton', 'signup_required_loading'); 1079 blockLoginReq = false; 1080 if (response.status == 0) { 1081 showPopupMessage(response.message); 1082 } else { 1083 if (REGISTRATION_TYPE === 'cart' && REGISTRATION_ACTION === 'cart-continue') { 1084 window.location = '/order/step/1/'; 1085 return; 1086 } 1087 1088 window.location = '/main/'; 1089 } 1090 }, 'json'); 1091 return false; 1092} 1093 1094/* ********************* */ 1095/* DASHBOARD */ 1096/* ********************* */ 1097var NEW_ZONE_POPUP_TUTORIAL = false; 1098function dashboard_newZonePopup(domain) { 1099 var prepend = ''; 1100 if (typeof(domain) != 'undefined') { 1101 prepend = '&domain=' + domain; 1102 } 1103 $('.tipsy').remove(); 1104 var mobile = isMobile(1035); 1105 showPopup('newzone', '&show=chooseZoneType' + prepend, function () { 1106 if (NEW_ZONE_POPUP_TUTORIAL) { 1107 $('.newZoneButtonsContainer .newZoneBox.masterZone').tipsy('hide'); 1108 $('.newZoneButtonsContainer .newZoneBox.freeZone').tipsy('hide'); 1109 } 1110 }, function () { 1111 if (NEW_ZONE_POPUP_TUTORIAL) { 1112 var mGravity = 'e'; 1113 var fGravity = 'w'; 1114 if (mobile) { 1115 mGravity = 's'; 1116 fGravity = 'n'; 1117 } 1118 $('.newZoneButtonsContainer .newZoneBox.masterZone').attr('title', __('tutorial_master_zone_info')); 1119 $('.newZoneButtonsContainer .newZoneBox.masterZone').tipsy({'gravity':mGravity, 'trigger':'manual'}); 1120 $('.newZoneButtonsContainer .newZoneBox.masterZone').tipsy('show'); 1121 $(window).resize(function(){ 1122 $('.newZoneButtonsContainer .newZoneBox.masterZone').tipsy('show'); 1123 }); 1124 $(window).scroll(function(){ 1125 $('.newZoneButtonsContainer .newZoneBox.masterZone').tipsy('show'); 1126 }); 1127 addCloudPageCallBack(function () { 1128 $(window).scroll(function(){ 1129 $('.newZoneButtonsContainer .newZoneBox.masterZone').tipsy('hide'); 1130 }); 1131 }); 1132 1133 $('.newZoneButtonsContainer .newZoneBox.freeZone').attr('title', __('tutorial_free_zone_info')); 1134 $('.newZoneButtonsContainer .newZoneBox.freeZone').tipsy({'gravity':fGravity, 'trigger':'manual'}); 1135 $('.newZoneButtonsContainer .newZoneBox.freeZone').tipsy('show'); 1136 $(window).resize(function(){ 1137 $('.newZoneButtonsContainer .newZoneBox.freeZone').tipsy('show'); 1138 }); 1139 $(window).scroll(function(){ 1140 $('.newZoneButtonsContainer .newZoneBox.freeZone').tipsy('show'); 1141 }); 1142 addCloudPageCallBack(function () { 1143 $(window).scroll(function(){ 1144 $('.newZoneButtonsContainer .newZoneBox.freeZone').tipsy('hide'); 1145 }); 1146 }); 1147 } 1148 }); 1149} 1150 1151var BLOCK_MANAGED_DNS_BUTTON = false;
1152function domains_openManagedDns(domain) { 1153 if (BLOCK_MANAGED_DNS_BUTTON == true) { 1154 return false; 1155 } 1156 1157 BLOCK_MANAGED_DNS_BUTTON = true; 1158 $.post(AJAXACTIONS_URL + '?action=domainManage', { 1159 'action': 'getManagedDnsTarget', 1160 'domain': domain 1161 }, function(response) { 1162 BLOCK_MANAGED_DNS_BUTTON = false; 1163 1164 if (response.status != 1) { 1165 showPopupMessage(response.message ? response.message : __('cant_execute_action')); 1166 return false; 1167 } 1168 1169 if (response.mode == 'popup') { 1170 dashboard_newZonePopup(domain); 1171 return false; 1172 } 1173 1174 if (response.mode == 'redirect' && response.url) { 1175 window.location.href = response.url; 1176 return false; 1177 } 1178 1179 }, 'json').fail(function() { 1180 BLOCK_MANAGED_DNS_BUTTON = false; 1181 showPopupMessage(__('cant_execute_action')); 1182 }); 1183} 1184 1185 1186function isMobile (width) { 1187 if ($('body').width() < width) { 1188 return true; 1189 } 1190 1191 return false; 1192} 1193 1194var BLOCK_NEW_MASTER_ZONE_BUTTON = false; 1195function dashboard_addMasterZone() { 1196 if (BLOCK_NEW_MASTER_ZONE_BUTTON === true) { 1197 return false; 1198 } 1199 BLOCK_NEW_MASTER_ZONE_BUTTON = true; 1200 blockButton('masterDomain_button', 'masterDomain_loading', 'block'); 1201 var domain = $('#masterDomain').val(); 1202 if (typeof(domain) == 'undefined') { 1203 showPopupMessage('Invalid zone type'); 1204 return false; 1205 } 1206 var data = { 1207 'type': 'addMaster', 1208 'domain': domain 1209 }; 1210 if ($('input[name*="newZoneOptions"]:checked').val() == 1) { 1211 var servers = new Array(); 1212 1213 $.each($('#masterDNSServers').children(), function() { 1214 if ($(this).children().prop('checked')) { 1215 servers.splice(servers.length, 0, $(this).children().val()); 1216 } 1217 }); 1218 data['option'] = 'servers'; 1219 data['servers'] = servers; 1220 } else if ($('input[name*="newZoneOptions"]:checked').val() == 2) { 1221 data['option'] = 'copyFrom'; 1222 data['copyFromDomain'] = $('#from_domain').val(); 1223 data['followDomain'] = $('#followDomain').is(':checked') ? 1 : 0; 1224 } else { 1225 data['option'] = 'empty'; 1226 } 1227 1228 data['note'] = $('#noteZone').val(); 1229 1230 $.post(AJAXACTIONS_URL + '?action=newzone', data, function(response) { 1231 unBlockButton('masterDomain_button', 'masterDomain_loading', 'block'); 1232 BLOCK_NEW_MASTER_ZONE_BUTTON = false; 1233 if (response.status == 1) { 1234 window.location.href = '/records/domain/' + response.domain + '/'; 1235 } else { 1236 // only if status == 0, because we don't want to show 1237 // the button for a second before redirecting to the zone 1238 $('#masterDomain').css('border-color', 'red'); 1239 showPopupMessage(response.msg); 1240 } 1241 }, 'json'); 1242} 1243 1244function dashboard_checkIfFiOrDeZone(alertText, zone) { 1245 if (zone == 'master') { 1246 var zoneName = $('#masterDomain').val(); 1247 } else if (zone == 'parked') { 1248 var zoneName = $('#parkedDomain').val(); 1249 } else if (zone == 'geodns') { 1250 var zoneName = $('#geodnsDomain').val(); 1251 } 1252 if (typeof(zoneName) == 'undefined') { 1253 return false; 1254 } 1255 var split = zoneName.split("."); 1256 var tld = (split[split.length-1]).trim(); 1257 if (tld == 'de' || tld == 'fi') { 1258 alert(alertText); 1259 } 1260 return false; 1261} 1262 1263function dashboard_checkNewZoneName(selector, message) { 1264 var element = $('#' + selector); 1265 var val = element.val(); 1266 if (typeof(val) != 'undefined') { 1267 element.tipsy('hide'); 1268 if (val.indexOf('www.') == 0) { 1269 element.attr('title', message); 1270 element.tipsy({ 1271 gravity: 'n', 1272 trigger: 'manual', 1273 html: false 1274 }); 1275 element.tipsy('show'); 1276 $(window).resize(function(){ 1277 element.tipsy('show'); 1278 }); 1279 $(window).scroll(function(){ 1280 element.tipsy('show'); 1281 }); 1282 addCloudPageCallBack(function () { 1283 $(window).scroll(function(){ 1284 element.tipsy('hide'); 1285 }); 1286 }); 1287 } 1288 } 1289} 1290 1291function showNewZoneOptions(options) { 1292 $('.zoneOptions').css('display', 'none'); 1293 $('#zoneOptions' + options).css('display', 'block') 1294} 1295 1296function showDynamicDnsIP () { 1297 if ($('#activateDynamicDNS').is(":checked")) { 1298 $(".dynamicIP").show(); 1299 } else { 1300 $(".dynamicIP").hide(); 1301 } 1302} 1303 1304var blockNewSlaveZone = false; 1305function dashboard_addSlaveZone() { 1306 if (blockNewSlaveZone == true) { 1307 return false; 1308 } 1309 blockNewSlaveZone = true; 1310 blockButton('newSlaveZoneButton', 'newSlaveZone_loading', 'block'); 1311 1312 var domain = $('#slaveDomain').val(); 1313 var master_ip = $('#slaveMasterIp').val(); 1314 var note = $('#noteZone').val(); 1315 1316 $.post(AJAXACTIONS_URL + '?action=newzone', { 1317 'type': 'addSlave', 1318 'domain': domain, 1319 'master_ip': master_ip, 1320 'note': note 1321 }, function(data) { 1322 unBlockButton('newSlaveZoneButton', 'newSlaveZone_loading', 'block'); 1323 blockNewSlaveZone = false;
1324 response = JSON.parse(data); 1325 if (response.status == 1) { 1326 window.location.href = '/slave/domain/' + response.domain + '/?open=primary-settings'; 1327 } else { 1328 showPopupMessage(response.msg); 1329 } 1330 }); 1331} 1332 1333var blockNewFreeZone = false; 1334function dashboard_addFreeZone() { 1335 if (blockNewFreeZone == true) { 1336 return false; 1337 } 1338 blockNewFreeZone = true; 1339 blockButton('newFreeZoneButton', 'newFreeZone_loading', 'block'); 1340 1341 var prefix = $('#freePrefix').val(); 1342 var domain = $('#freeDomain').val(); 1343 var note = $('#noteZone').val(); 1344 var ip = ''; 1345 var dynamicDNS = 0; 1346 1347 if ($('#activateDynamicDNS').is(":checked")) { 1348 ip = $('#ip').val(); 1349 dynamicDNS = 1; 1350 } 1351 1352 $.post(AJAXACTIONS_URL + '?action=newzone', { 1353 'type': 'freeDomain', 1354 'domain': domain, 1355 'prefix': prefix, 1356 'dynamicDNS': dynamicDNS, 1357 'ip': ip, 1358 'note': note 1359 }, function(response) { 1360 unBlockButton('newFreeZoneButton', 'newFreeZone_loading', 'block'); 1361 blockNewFreeZone = false; 1362 if (response.status == 1) { 1363 if (dynamicDNS == 1) { 1364 if (response.message) { 1365 showPopupMessage(response.message, function(){ 1366 window.location.href = '/records/domain/' + response.domain + '/'; 1367 }); 1368 } else { 1369 window.location.href = '/records/domain/' + response.domain + '/dynamic/' + response.dynamic_id + '/'; 1370 } 1371 } else { 1372 window.location.href = '/records/domain/' + response.domain + '/'; 1373 } 1374 } else { 1375 showPopupMessage(response.msg); 1376 } 1377 }, 'json'); 1378} 1379 1380blockNewGeodnsZone = false; 1381function dashboard_addGeodnsZone() { 1382 if (blockNewGeodnsZone == true) { 1383 return false; 1384 } 1385 blockNewGeodnsZone = true; 1386 blockButton('newGeoDNSZoneButton', 'newGeoDNSZone_loading', 'block'); 1387 1388 var domain = $('#geodnsDomain').val(); 1389 var data = { 1390 'type': 'addGeodns', 1391 'domain': domain, 1392 'servers': [] 1393 }; 1394 1395 $.each($('#masterDNSServers').children(), function() { 1396 if ($(this).children().prop('checked')) { 1397 data.servers.splice(data.servers.length, 0, $(this).children().val()); 1398 } 1399 }); 1400 1401 data['note'] = $('#noteZone').val(); 1402 1403 $.post(AJAXACTIONS_URL + '?action=newzone', data, function(response) { 1404 unBlockButton('newGeoDNSZoneButton', 'newGeoDNSZone_loading', 'block'); 1405 blockNewGeodnsZone = false; 1406 if (response.status) { 1407 window.location.href = '/records-geodns/domain/' + response.domain + '/'; 1408 } else { 1409 $('#geodnsDomain').css('border-color', 'red'); 1410 showPopupMessage(response.message); 1411 } 1412 }, 'json'); 1413 return false; 1414} 1415 1416var FROM_MONITORING = false; 1417var FIRST_ITERATION = true; 1418function startTutorial (fromMonitoring) { 1419 if (__('tutorial_start_title') == 'tutorial_start_title') { 1420 if (FIRST_ITERATION === true) { 1421 $.post('/ajaxActions.php?action=errorlog', { 1422 'action': 'log', 1423 'error': 'Tutorial started without translation', 1424 'url': '/', 1425 'line': 1, 1426 'extra': '', 1427 'lastClicked': 'New registration', 1428 'lastClickedTimestamp': 0, 1429 'timestampErrorSent': Math.floor(Date.now() / 1000), 1430 'errorStack': __('tutorial_start_title') + ' shown without a translation', 1431 }); 1432 } 1433 setTimeout(function() { 1434 FIRST_ITERATION = false; 1435 return startTutorial(fromMonitoring); 1436 }, 100); 1437 } 1438 if (typeof fromMonitoring != 'undefined') { 1439 FROM_MONITORING = fromMonitoring; 1440 } 1441 $('#popup-message').addClass('a-c'); 1442 1443 showPopupMessage('<h2>'+ __('tutorial_start_title') +'</h2><p>'+ __('tutorial_start_message') +'</p><div><a href="#" onclick="hidePopupMessage(0);" class="round-btn s-btn bright-btn">'+ __('no') +'</a> <a href="#" onclick="hidePopupMessage(1)" class="round-btn s-btn color-btn">'+ __('yes') +'</a></div>', function (status) { 1444 $('#popup-message').removeClass('a-c'); 1445 $('#popupSecondOverlay').css('display', 'block'); 1446 $('#cloudOverlay').css('display', 'none'); 1447 if (status) { 1448 tutorialStep1(); 1449 } 1450 }); 1451 $('#popupSecondOverlay').css('display', 'none'); 1452 $('#cloudOverlay').css('display', 'block'); 1453} 1454function tutorialStep1 () { 1455 $('header.dashboard').addClass('tutorial'); 1456 $('#popup-message').addClass('a-c'); 1457 1458 showPopupMessage('<p>' + __('tutorial_step_1')+'</p><div><a href="#" onclick="hidePopupMessage(1)" class="round-btn s-btn color-btn">'+ __('okay')+'</a></div>', function (status) { 1459 $('header.dashboard').removeClass('tutorial'); 1460 $('#popup-message').removeClass('a-c'); 1461 $('#popupSecondOverlay').css('display', 'block'); 1462 $('#cloudOverlay').css('display', 'none'); 1463 1464 if (status) {
1465 tutorialStep2(); 1466 } else { 1467 abortTutorial('tutorialStep1()'); 1468 } 1469 }); 1470 1471 var margin_top = '40'; 1472 1473 var mobile = isMobile(870); 1474 if (mobile) { 1475 var element_height = $('header.dashboard').height(); 1476 var element_offset = $('header.dashboard').offset().top + element_height; 1477 margin_top = element_offset + 15; 1478 } 1479 1480 $('#popupSecondOverlay').css('display', 'none'); 1481 $('#cloudOverlay').css('display', 'block'); 1482 $('.popup-wraper').css('marginTop', margin_top + 'px'); 1483} 1484function tutorialStep2 () { 1485 $('.sub-header').addClass('tutorial'); 1486 $('#popup-message').addClass('a-c'); 1487 1488 showPopupMessage('<p>' + __('tutorial_step_2')+'</p><div><a href="#dashboard-zones" onclick="hidePopupMessage(1)" class="round-btn s-btn color-btn">'+ __('okay')+'</a></div>', function (status) { 1489 $('.sub-header').removeClass('tutorial'); 1490 $('#popup-message').removeClass('a-c'); 1491 $('#popupSecondOverlay').css('display', 'block'); 1492 $('#cloudOverlay').css('display', 'none'); 1493 1494 if (status) { 1495 tutorialStep3(); 1496 } else { 1497 abortTutorial('tutorialStep2()'); 1498 } 1499 }); 1500 1501 var margin_top = '100'; 1502 var mobile = isMobile(870); 1503 1504 if (mobile) { 1505 margin_top = $('.sub-header').outerHeight(true) + $('.sub-header').offset().top + 15; 1506 } 1507 1508 $('#popupSecondOverlay').css('display', 'none'); 1509 $('#cloudOverlay').css('display', 'block'); 1510 $('.popup-wraper').css('marginTop', margin_top + 'px'); 1511} 1512function tutorialStep3() { 1513 $('#dashboard-zones').addClass('tutorial'); 1514 $('#popup-message').addClass('a-c'); 1515 var mobile = isMobile(870); 1516 var popup_href = '#dashboard-domains'; 1517 1518 if (mobile) { 1519 popup_href = '#dashboard-zones'; 1520 } 1521 1522 showPopupMessage('<p>' + __('tutorial_step_3')+'</p><div><a href="' + popup_href + '" onclick="hidePopupMessage(1)" class="round-btn s-btn color-btn">'+ __('okay') +'</a></div>', function (status) { 1523 $('#dashboard-zones').removeClass('tutorial'); 1524 $('#popup-message').removeClass('a-c'); 1525 $('#popupSecondOverlay').css('display', 'block'); 1526 $('#cloudOverlay').css('display', 'none'); 1527 1528 if (status) { 1529 if (mobile) { 1530 tutorialStep9(); 1531 } else { 1532 tutorialStep4(); 1533 } 1534 } else { 1535 abortTutorial('tutorialStep3()'); 1536 } 1537 }); 1538 1539 $('#popupSecondOverlay').css('display', 'none'); 1540 $('#cloudOverlay').css('display', 'block'); 1541 1542 if (mobile) { 1543 var margin_top = $('#dashboard-zones').height() + 15; 1544 1545 $('.popup-wraper').css('marginTop', margin_top + 'px'); 1546 } 1547} 1548function tutorialStep4() { 1549 $('#dashboard-domains').addClass('tutorial'); 1550 $('#popup-message').addClass('a-c'); 1551 1552 showPopupMessage('<p>' + __('tutorial_step_4')+'</p><div><a href="#dashboard-monitoring-records" onclick="hidePopupMessage(1)" class="round-btn s-btn color-btn">'+ __('okay')+'</a></div>', function (status) { 1553 $('#dashboard-domains').removeClass('tutorial'); 1554 $('#popup-message').removeClass('a-c'); 1555 $('#popupSecondOverlay').css('display', 'block'); 1556 $('#cloudOverlay').css('display', 'none'); 1557 1558 if (status) { 1559 tutorialStep5(); 1560 } else { 1561 abortTutorial('tutorialStep4()'); 1562 } 1563 }); 1564 1565 $('#popupSecondOverlay').css('display', 'none'); 1566 $('#cloudOverlay').css('display', 'block'); 1567 1568 var mobile = isMobile(870); 1569 if (mobile) { 1570 var margin_top = $('#dashboard-domains').height() + $('#dashboard-domains').offset().top + 15; 1571 1572 $('.popup-wraper').css('marginTop', margin_top + 'px'); 1573 } 1574} 1575function tutorialStep5() { 1576 $('#dashboard-monitoring-records').addClass('tutorial'); 1577 $('#popup-message').addClass('a-c'); 1578 1579 showPopupMessage('<p>' + __('tutorial_step_5')+'</p><div><a href="#dashboard-ssl-certificates" onclick="hidePopupMessage(1)" class="round-btn s-btn color-btn">'+ __('okay')+'</a></div>', function (status) { 1580 $('#dashboard-monitoring-records').removeClass('tutorial'); 1581 $('#popup-message').removeClass('a-c'); 1582 $('#popupSecondOverlay').css('display', 'block'); 1583 $('#cloudOverlay').css('display', 'none'); 1584 1585 if (status) { 1586 tutorialStep6(); 1587 } else { 1588 abortTutorial('tutorialStep5()'); 1589 } 1590 }); 1591 1592 $('#popupSecondOverlay').css('display', 'none'); 1593 $('#cloudOverlay').css('display', 'block'); 1594 1595 var mobile = isMobile(870); 1596 if (mobile) { 1597 var margin_top = $('#dashboard-monitoring-records').height() + 15; 1598 1599 $('.popup-wraper').css('marginTop', margin_top + 'px'); 1600 } 1601} 1602 1603function tutorialStep6() { 1604 $('#dashboard-ssl-certificates').addClass('tutorial'); 1605 $('#popup-message').addClass('a-c'); 1606 1607 showPopupMessage('<p>' + __('tutorial_step_6')+'</p><div><a href="#dashboard-google-workspace" onclick="hidePopupMessage(1)" class="round-btn s-btn color-btn">'+ __('okay')+'</a></div>', function (status) { 1608 $('#dashboard-ssl-certificates').removeClass('tutorial'); 1609 $('#popup-message').removeClass('a-c'); 1610 $('#popupSecondOverlay').css('display', 'block'); 1611 $('#cloudOverlay').css('display', 'none'); 1612 1613 if (status) { 1614 tutorialStep7(); 1615 } else { 1616 abortTutorial('tutorialStep6()'); 1617 } 1618 }); 1619 1620 $('#popupSecondOverlay').css('display', 'none'); 1621 $('#cloudOverlay').css('display', 'block'); 1622} 1623 1624function tutorialStep7() { 1625 $('#dashboard-google-workspace').addClass('tutorial'); 1626 $('#popup-message').addClass('a-c'); 1627 1628 if (FROM_MONITORING === '1') { 1629 var nextStep = function(){tutorialStep8()}; 1630 var hilghlightTable = "dashboard-monitoring-records"; 1631 } else { 1632 var nextStep = function(){tutorialStep9()}; 1633 var hilghlightTable = "dashboard-zones"; 1634 } 1635 showPopupMessage('<p>' + __('tutorial_step_7')+'</p><div>
1635<a href="#' + hilghlightTable + '" onclick="hidePopupMessage(1)" class="round-btn s-btn color-btn">'+ __('okay')+'</a></div>', function (status) { 1636 $('#dashboard-google-workspace').removeClass('tutorial'); 1637 $('#popup-message').removeClass('a-c'); 1638 $('#popupSecondOverlay').css('display', 'block'); 1639 $('#cloudOverlay').css('display', 'none'); 1640 1641 if (status) { 1642 nextStep(); 1643 } else { 1644 abortTutorial('tutorialStep7()'); 1645 } 1646 }); 1647 1648 $('#popupSecondOverlay').css('display', 'none'); 1649 $('#cloudOverlay').css('display', 'block'); 1650 1651 var mobile = isMobile(870); 1652 if (mobile) { 1653 var margin_top = $('#dashboard-google-workspace').height() + 15; 1654 1655 $('.popup-wraper').css('marginTop', margin_top + 'px'); 1656 } 1657} 1658function tutorialStep8() { 1659 1660 $('#dashboard-monitoring-records').addClass('tutorial'); 1661 $('#popup-message').addClass('a-c'); 1662 1663 showPopupMessage('<p>' + __('tutorial_step_8')+'</p><div><a href="#dashboard-zones" onclick="hidePopupMessage(1)" class="round-btn s-btn bright-btn">'+ __('no') +'</a> <a href="#dashboard-monitoring-records" onclick="hidePopupMessage(2)" class="round-btn s-btn color-btn">'+ __('yes') +'</a></div>', function (status) { 1664 $('#dashboard-monitoring-records').removeClass('tutorial'); 1665 $('#popup-message').removeClass('a-c'); 1666 $('#popupSecondOverlay').css('display', 'block'); 1667 $('#cloudOverlay').css('display', 'none'); 1668 1669 if (status) { 1670 if (status == 2) { 1671 showPopup('monitoring-records', '&show=add-new&page=1'); 1672 } else if (status == 1) { 1673 tutorialStep9(); 1674 } 1675 } else { 1676 abortTutorial('tutorialStep8()'); 1677 } 1678 }); 1679 1680 $('#popupSecondOverlay').css('display', 'none'); 1681 $('#cloudOverlay').css('display', 'block'); 1682 1683} 1684function tutorialStep9() { 1685 $('#dashboard-zones').addClass('tutorial'); 1686 $('#popup-message').addClass('a-c'); 1687 1688 showPopupMessage('<p>' + __('tutorial_step_9')+'</p><div><a href="#" onclick="hidePopupMessage(1)" class="round-btn s-btn bright-btn">'+ __('no') +'</a> <a href="#" onclick="hidePopupMessage(2)" class="round-btn s-btn color-btn">'+ __('yes') +'</a></div>', function (status) { 1689 $('#dashboard-zones').removeClass('tutorial'); 1690 $('#popup-message').removeClass('a-c'); 1691 $('#popupSecondOverlay').css('display', 'block'); 1692 $('#cloudOverlay').css('display', 'none'); 1693 1694 if (status) { 1695 if (status == 2) { 1696 tutorialStep10(); 1697 } else if (status == 1) { 1698 tutorialStepEnd() 1699 } 1700 } else { 1701 abortTutorial('tutorialStep9()'); 1702 } 1703 }); 1704 1705 $('#popupSecondOverlay').css('display', 'none'); 1706 $('#cloudOverlay').css('display', 'block'); 1707 1708 var mobile = isMobile(870); 1709 if (mobile) { 1710 var margin_top = $('#dashboard-zones').height() + 15; 1711 1712 $('.popup-wraper').css('marginTop', margin_top + 'px'); 1713 } 1714} 1715 1716function tutorialStep10() { 1717 NEW_ZONE_POPUP_TUTORIAL = true; 1718 var mobile = isMobile(870); 1719 1720 if (mobile) { 1721 $('.popup-wraper').css('marginTop', '80px'); 1722 } 1723 1724 dashboard_newZonePopup(); 1725} 1726 1727function tutorialStepEnd () { 1728 $('#popup-message').addClass('a-c'); 1729 showPopupMessage('<h2>'+ __('tutorial_end_title') +'</h2>'+'<p>' + __('tutorial_end_message')+'</p><div><a href="#" onclick="hidePopupMessage(1)" class="round-btn s-btn color-btn">'+__('okay')+'</a></div>', function () { 1730 $('#popup-message').removeClass('a-c'); 1731 }); 1732} 1733 1734function abortTutorial (step) { 1735 showConfirmation(__('tutorial_abort_message'), function () { 1736 hidePopupMessage(0); 1737 }, function () { 1738 eval(step); 1739 }); 1740} 1741 1742function search (search, element, event) { 1743 var category = $(element).closest('.qsw').find('.heading').attr('id'); 1744 var eventType = (typeof event !== 'undefined') ? event.type : ''; 1745 1746 1747 if (typeof category == 'undefined') { 1748 var category = $(element).closest('.qswWraper').attr('id'); 1749 } 1750 1751 if (productTableSearch(search, category, eventType, element)) { 1752 return; 1753 } 1754 1755 $(element).closest('.qswWraper').find('.domainSearchBox div').html(''); 1756 1757 search = search.trim(); 1758 if (search.length == 0) { 1759 $('.zone-manage-search div#domainSearchBox').css('border', 'none'); 1760 $(element).closest('.table-h-scroll').css('padding-bottom', '0'); 1761 return false; 1762 } 1763 1764 $(element).closest('.qswWraper').find('.domainSearchBox div').html('<span class="progress ml-10" style="margin-bottom: 0px;"></span> Loading'); 1765 1766 search = search.replace('\.', '.'); 1767 search = search.replace('_', '\\_'); 1768 1769 var rand = Math.floor((Math.random() * 100) + 1) + '' + Math.round((new Date()).getTime() / 1000); 1770 $(element).closest('.qswWraper').find('.domainSearchBox div').removeClass(); 1771 $(element).closest('.qswWraper').find('.domainSearchBox div').addClass('' + rand + '');
1772 $('#quickSearchWraper .zone-manage-search div#domainSearchBox').css('border', '5px solid #ededed'); 1773 1774 $.post(AJAXACTIONS_URL + '?action=main', { 1775 'type': 'quickSearch', 1776 'name': search, 1777 'class': rand, 1778 'category': category, 1779 'date': $('#date').val(), 1780 }, function(data) { 1781 try { 1782 response = JSON.parse(data); 1783 } catch (e) { 1784 return false; 1785 } 1786 1787 if (typeof(response.action) != 'undefined') { 1788 eval(response.action); 1789 return false; 1790 } 1791 1792 var results = response.domainsList; 1793 1794 $('.' + response.randid).html(''); 1795 $.each(results, function (index, value) { 1796 if (value['type'] == 1) { 1797 if (value['registered'] == 0) { 1798 if (value['bulk'] == 0) { 1799 if (value['zone'] == 1) { 1800 $('.' + response.randid).html($('.' + response.randid).html() + '<div onclick="window.location = \'/records/domain/' + value['url'] + '/\';" title="' + translation_primary_zone + ' - '+ value['title'] +'" style="overflow: hidden;" class="searchTitle">' + '<span class="icon icon-darker icon-master-dns-zone f-l"></span><div class="f-l quickSearchOverflow"> ' + value['name'] + '</div></div>'); 1801 } else if (value['zone'] == 4) { 1802 $('.' + response.randid).html($('.' + response.randid).html() + '<div onclick="window.location = \'/parked/domain/' + value['url'] + '/\';" title="' + translation_parked_zone + ' - '+ value['title'] +'" style="overflow: hidden;" class="searchTitle">' + '<span class="icon icon-darker icon-parked-dns-zone f-l"></span><div class="f-l quickSearchOverflow"> ' + value['name'] + '</div></div>'); 1803 } else if (value['zone'] == 5) { 1804 $('.' + response.randid).html($('.' + response.randid).html() + '<div onclick="window.location = \'/records-geodns/domain/' + value['url'] + '/\';" title="' + translation_dns_zone + ' - '+ value['title'] +'" style="overflow: hidden;" class="searchTitle">' + '<span class="icon icon-darker icon-geodns-zone f-l"></span><div class="f-l quickSearchOverflow"> ' + value['name'] + '</div></div>'); 1805 } else if (value['zone'] == 6) { 1806 $('.' + response.randid).html($('.' + response.randid).html() + '<div onclick="window.location = \'/enum/domain/' + value['url'] + '/\';" title="' + translation_primary_zone + ' - '+ value['title'] +'" style="overflow: hidden;" class="searchTitle">' + '<span class="icon icon-darker icon-master-dns-zone f-l"></span><div class="f-l quickSearchOverflow"> ' + value['name'] + '</div></div>'); 1807 } else { 1808 $('.' + response.randid).html($('.' + response.randid).html() + '<div onclick="window.location = \'/reverse/domain/' + value['url'] + '/\';" title="' + translation_primary_zone + ' - '+ value['title'] +'" style="overflow: hidden;" class="searchTitle">' + '<span class="icon icon-darker icon-master-dns-zone f-l"></span><div class="f-l quickSearchOverflow"> ' + value['name'] + '</div></div>'); 1809 } 1810 } else { 1811 $('.' + response.randid).html($('.' + response.randid).html() + '<div onclick="window.location = \'/records'+(value['zone'] == 5 ? '-geodns' : '')+'/domain/' + value['bulk'] + '/show/cloud/\';" title="' + translation_cloud_domain + ' - '+ value['title'] +'" style="overflow: hidden;" class="searchTitle">' + '<span class="icon icon-darker icon-master-dns-zone f-l"></span><div class="f-l quickSearchOverflow"> ' + value['name'] + '</div></div>'); 1812 } 1813 } else { 1814 $('.' + response.randid).html($('.' + response.randid).html() + '<div onclick="window.location = \'/domainManage/domain/' + value['url'] + '/\';" title="' + translation_domain_name + ' - '+ value['title'] +'" style="overflow: hidden;" class="searchTitle">' + '<span class="icon icon-darker icon-domains f-l"></span><div class="f-l quickSearchOverflow"> ' + value['name'] + '</div></div>'); 1815 } 1816 } else if (value['type'] == 'monitoring') { 1817 $('.' + response.randid).html($('.' + response.randid).html() + '<div onclick="window.location = \'/monitoring-records/record/' + value['url'] + '/\';" title="' + translation_monitoring_check + ' - '+ value['title'] +'" style="overflow: hidden;" class="searchTitle">' + '<span class="icon icon-darker icon-failover f-l"></span><div class="f-l quickSearchOverflow"> ' + value['name'] + '</div></div>'); 1818 } else if (value['type'] == 'failover') { 1819 $('.' + response.randid).html($('.' + response.randid).html() + '<div onclick="window.location = \'/failover-manage/domain/' + value['zone_id'] + '/record/' + value['url'] + '/\';" title="' + translation_failover_record + ' - '+ value['title'] +'" style="overflow: hidden;" class="searchTitle">' + '<span class="icon icon-darker icon-failover f-l"></span><div class="f-l quickSearchOverflow"> ' + value['name'] + '</div></div>'); 1820 } else if (value['type'] == 'ssl') { 1821 $('.' + response.randid).html($('.' + response.randid).html() + '<div onclick="window.location = \'/failover-manage/domain/' + value['zone_id'] + '/record/' + value['url'] + '/\';" title="' + translation_failover_record + ' - '+ value['title'] +'" style="overflow: hidden;" class="searchTitle">' + '<span class="icon icon-darker icon-failover f-l"></span><div class="f-l quickSearchOverflow"> ' + value['name'] + '</div></div>'); 1822 } else { 1823 $('.' + response.randid).html($('.' + response.randid).html() + '<div onclick="window.location = \'/slave/domain/' + value['url'] + '/\';" title="' + translation_secondary_zone + ' - '+ value['title'] +'" style="overflow: hidden;" class="searchTitle">' + '<span class="icon icon-darker icon-slave-dns-zone f-l"></span><div class="f-l quickSearchOverflow"> ' + value['name'] + '</div></div>'); 1824 } 1825 }); 1826 1827 $(element).closest('.qswWraper').find('.domainSearchBox div').css('width', $('#quickSearchWra
1827per').width()); 1828 1829 if (results.length <= 0) { 1830 $(element).closest('.qswWraper').find('.domainSearchBox div').html('<div class="no-results">' + translation_no_results_found + '</div>'); 1831 } 1832 1833 $(".searchTitle").tooltip({ 1834 track: true, 1835 delay: 0, 1836 showURL: false, 1837 showBody: "<body>", 1838 fade: 250 1839 }); 1840 1841 var tableType = $(element).closest('.table-h-scroll').attr('class'); 1842 1843 if (results.length <= 0 || search.length <= 0) { 1844 $(element).closest('.table-h-scroll').css('padding-bottom', '0'); 1845 } else { 1846 if (typeof(tableType) !== 'undefined') { 1847 if (tableType.indexOf("overx") >= 0) { 1848 if ($(element).closest('.quickSearchWraper').height() > $(element).closest('.table-h-scroll').height()) { 1849 $(element).closest('.table-h-scroll').css('padding-bottom', $(element).closest('.quickSearchWraper').height()); 1850 } 1851 } 1852 } 1853 } 1854 1855 $(document).click(function () { 1856 if (this != $(".domainSearchBox div")[0]) { 1857 $(element).closest('.qswWraper').find('.domainSearchBox div').html(''); 1858 } 1859 $('.zone-manage-search div#domainSearchBox').css('border', 'none'); 1860 $(document).off('click'); 1861 }); 1862 $("#searchButton").click(function() { 1863 $('#quickSearchWraper .zone-manage-search div#domainSearchBox').css('border', '5px solid #ededed'); 1864 $(document).off('click'); 1865 }); 1866 1867 scrollList('.domainSearchBox div.searchTitle'); 1868 }); 1869} 1870 1871function productTableSearch (search, category, eventType, element) { 1872 if (!$(element).closest('.qswWraper').hasClass('dashboard-search')) { 1873 return false; 1874 } 1875 1876 if (category == 'zones-heading' || category == 'zones-heading-mob') { 1877 if (eventType == 'click') { 1878 return true; 1879 } 1880 insideCloudPage('zones-table-body', 'main', '&show=zones-body&page=1&name=' + encodeURIComponent(search)); 1881 return true; 1882 } else if (category == 'monitoring-heading' || category == 'monitoring-heading-mob') { 1883 if (eventType == 'click') { 1884 return true; 1885 } 1886 insideCloudPage('monitoring-table-body', 'main', '&show=monitoring-body&page=1&name=' + encodeURIComponent(search)); 1887 return true; 1888 } else if (category == 'shared-monitoring-heading' || category == 'shared-monitoring-heading-mob') { 1889 if (eventType == 'click') { 1890 return true; 1891 } 1892 insideCloudPage('shared-monitoring-records-table-body', 'main', '&show=shared-monitoring-records-body&page=1&name=' + encodeURIComponent(search), function() { 1893 initSharedMonitoringTableBody(); 1894 }); 1895 return true; 1896 } else if (category == 'shared-heading' || category == 'shared-heading-mob') { 1897 if (eventType == 'click') { 1898 return true; 1899 } 1900 insideCloudPage('shared-zones-table-body', 'main', '&show=shared-zones-body&page=1&name=' + encodeURIComponent(search)); 1901 return true; 1902 } else if (category == 'domains-heading' || category == 'domains-heading-mob') { 1903 if (eventType == 'click') { 1904 return true; 1905 } 1906 insideCloudPage('domains-table-body', 'main', '&show=domains-body&page=1&name=' + encodeURIComponent(search)); 1907 return true; 1908 } else if (category == 'failover-heading' || category == 'failover-heading-mob') { 1909 if (eventType == 'click') { 1910 return true; 1911 } 1912 insideCloudPage('failover-table-body', 'failover-records', '&show=failover-body&page=1&name=' + encodeURIComponent(search)); 1913 return true; 1914 } else if (category == 'ssl-heading' || category == 'ssl-heading-mob') { 1915 if (eventType == 'click') { 1916 return true; 1917 } 1918 insideCloudPage('ssl-table-body', 'main', '&show=ssl-certificates-body&page=1&name=' + encodeURIComponent(search), function() { 1919 $(".showSSLTitleBody").tooltip({ 1920 track: true, 1921 delay: 0, 1922 showURL: false, 1923 showBody: "<body>", 1924 fade: 250 1925 }); 1926 }); 1927 return true; 1928 } else if (category == 'gw-heading' || category == 'gw-heading-mob') { 1929 if (eventType == 'click') { 1930 return true; 1931 } 1932 insideCloudPage('gw-table-body', 'main', '&show=google-workspace-body&page=1&name=' + encodeURIComponent(search), function() { 1933 $(".showGWTitle").tooltip({ 1934 track: true, 1935 delay: 0, 1936 showURL: false, 1937 showBody: "<body>", 1938 fade: 250 1939 }); 1940 }); 1941 return true; 1942 } else if (category == 'shared-ssl-heading' || category == 'shared-ssl-heading-mob') { 1943 if (eventType == 'click') { 1944 return true; 1945 } 1946 insideCloudPage('shared-ssls-table-body', 'main', '&show=shared-ssl-certificates-body&page=1&name=' + encodeURIComponent(search), function() { 1947 $(".showTitleSharedSSLs").tooltip({ 1948 track: true, 1949 delay: 0, 1950 showURL: false, 1951 showBody: "<body>", 1952 fade: 250 1953 }); 1954 } 1955 ); 1956 return true; 1957 } else if (category == 'billing-ssl-heading' || category == 'billing-ssl-heading-mob') { 1958 if (eventType == 'click') { 1959 return true; 1960 } 1961 insideCloudPage("billing-ssl-table-body", "billing", "&show=billing-ssl-table-body&name=" + search); 1962 return true; 1963 } else if (category == 'billing-domains-heading' || category == 'billing-domains-heading-mob') { 1964 if (eventType == 'click') { 1965 return true; 1966 } 1967 insideCloudPage("billing-domains-table-body", "billing", "&show=billing-domains-table-body&name=" + search); 1968 return true; 1969 } else if (category == 'billing-gw-heading' || category == 'billing-gw-heading-mob') { 1970 if (eventType == 'click') { 1971 return true; 1972 } 1973 insideCloudPage("billing-gw-table-body", "billing", "&show=billing-gw-table-body&name=" + search); 1974 return true; 1975 } else if (category == 'backups-heading' || category == 'backups-heading-mob') { 1976 if (eventType == 'click') { 1977 return true; 1978 } 1979 1980 insideCloudPage('backups-table', 'view-dns-backup', '&show=view-backups-table&backup=' + $('#backup').val() + '&page=1&name=' + encodeURIComponent(search)); 1981 1982 return true; 1983 } 1984 1985 return false;
1986} 1987 1988function showQuickSearch(element, tableType) { 1989 $.post(AJAXACTIONS_URL + '?action=main', { 1990 'type': 'showQuickSearch' 1991 }, function(data) { 1992 1993 try { 1994 var response = JSON.parse(data); 1995 if (typeof(response.action) != 'undefined') { 1996 eval(response.action); 1997 return false; 1998 } 1999 } catch (e) { 2000 2001 } 2002 2003 $('#zone-name-wraper').addClass('zone-name-wraper-search'); 2004 $(element).closest('.qsw').find('.qswWraper').removeClass('hidden'); 2005 2006 $(element).closest('.qsw').find('.quickSearchWraper').html(data); 2007 2008 $('.' + tableType).closest('.qsw').find('.qswWraper').removeClass('hidden'); 2009 $('.' + tableType).closest('.qsw').find('.quickSearchWraper').html(data); 2010 2011 $(element).closest('.qsw').find('.heading').addClass('hidden'); 2012 $(element).closest('.qsw').css('height', '35px'); 2013 2014 $(element).addClass('hidden'); 2015 $('.' + tableType).addClass('hidden'); 2016 2017 $('.' + tableType).closest('.qsw').css('height', '35px'); 2018 $('.' + tableType).closest('.qsw').css('margin-left', '-30px'); 2019 $('.zones-actions-line').css('padding-left', '310px'); 2020 $('.searchField').focus(); 2021 }); 2022} 2023 2024function hideQuickSearch(element) { 2025 $('#zone-name-wraper').removeClass('zone-name-wraper-search'); 2026 2027 $(element).closest('tr').find('th .icon-search').removeClass('hidden'); 2028 2029 $(element).closest('th').find('.qsw').css('margin-left', '0px'); 2030 $(element).closest('.qsw').find('.heading .icon-search').removeClass('hidden'); 2031 2032 $(element).closest('.qsw').find('.heading').removeClass('hidden'); 2033 $(element).closest('.qsw').find('.qswWraper').addClass('hidden'); 2034 $(element).closest('.qsw').css('height', 'auto'); 2035 $(element).closest('.qsw').find('.quickSearchWraper').html(''); 2036 $('.zones-actions-line').css('padding-left', '0'); 2037} 2038 2039function scrollList(list) { 2040 var element = $(list); 2041 var elementSelected; 2042 2043 $(window).keydown(function (e) { 2044 if (e.which === 40) { 2045 e.preventDefault(); 2046 if (elementSelected) { 2047 elementSelected.removeClass('selected'); 2048 next = elementSelected.next(); 2049 if (next.length > 0) { 2050 elementSelected = next.addClass('selected'); 2051 } else { 2052 elementSelected = element.eq(0).addClass('selected'); 2053 } 2054 } else { 2055 elementSelected = element.eq(0).addClass('selected'); 2056 } 2057 } else if (e.which === 38) { 2058 e.preventDefault(); 2059 if (elementSelected) { 2060 elementSelected.removeClass('selected'); 2061 next = elementSelected.prev(); 2062 if (next.length > 0) { 2063 elementSelected = next.addClass('selected'); 2064 } else { 2065 elementSelected = element.last().addClass('selected'); 2066 } 2067 } else { 2068 elementSelected = element.last().addClass('selected'); 2069 } 2070 } else if (e.which === 13) { 2071 $(".selected").click(); 2072 } 2073 }); 2074 2075 $('.searchTitle').hover(function() { 2076 $(".selected").removeClass('selected'); 2077 elementSelected = false; 2078 }); 2079} 2080 2081function dashboard_deleteZone(warning, zone, page, group_id) { 2082 var scroll = $(window).scrollTop(); 2083 showConfirmation(warning, function () { 2084 showSplashScreen(); 2085 $.post(AJAXACTIONS_URL + '?action=main', { 2086 'type': 'deleteZone', 2087 'zone': zone 2088 }, function(data) { 2089 response = JSON.parse(data); 2090 hideSplashScreen(); 2091 if (!response.status) { 2092 showPopupMessage(response.message); 2093 } else { 2094 userData(); 2095 insideCloudPage('dashboard-zones', 'main', '&show=zones&page=' + page + '&group_id=' + group_id, function() { 2096 $('html').scrollTop(scroll); 2097 }); 2098 insideCloudPage('dashboard-failover-records', 'failover-records', '&show=showRecords'); 2099 } 2100 }); 2101 }); 2102} 2103 2104function dashboard_updateZone(warning, zone, page, group_id, page_location) { 2105 showConfirmation(warning, function () { 2106 $.post(AJAXACTIONS_URL + '?action=main', { 2107 'type': 'updateZone', 2108 'zone': zone 2109 }, function(data) { 2110 response = JSON.parse(data); 2111 2112 if (response.status == 0) { 2113 showPopupMessage(response.msg); 2114 } else { 2115 insideCloudPage("zoneStatus", "records", "&show=zoneUpdateInfoRow&zone=" + zone); 2116 zone_checkIfUpdated(zone); 2117 } 2118 }); 2119 }); 2120} 2121 2122var blockNewReverseZone = false; 2123function dashboard_addMasterReverseZone() { 2124 if (blockNewReverseZone == true) { 2125 return false; 2126 } 2127 blockNewReverseZone = true; 2128 blockButton('newReverseZoneButton', 'newReverseZone_loading', 'block'); 2129 2130 var data = { 2131 'type': 'addMasterReverse', 2132 'zoneName': $('#reverseZone').val(), 2133 'zoneNameSub': $('#reverseZoneSub').val(), 2134 'newZoneOption': $("input[name=newZoneOptions]:checked").val(), 2135 'zoneType': $('#zoneType').val(), 2136 'note': $('#noteZone').val() 2137 }; 2138 2139 var servers = new Array(); 2140 $.each($('#masterDNSServers').children(), function() { 2141 if ($(this).children().prop('checked')) { 2142 servers.splice(servers.length, 0, $(this).children().val()); 2143 } 2144 }); 2145 data['servers'] = servers; 2146 $.post(AJAXACTIONS_URL + '?action=newzone', data, function(response) { 2147 unBlockButton('newReverseZoneButton', 'newReverseZone_loading', 'block'); 2148 blockNewReverseZone = false;
2149 2150 if (response.status === 0) { 2151 showPopupMessage(response.message); 2152 } else { 2153 window.location.href = '/reverse/domain/' + response.zone + '/'; 2154 } 2155 }, 'json'); 2156} 2157 2158var blockNewSlaveReverseZone = false; 2159function dashboard_addSlaveReverseZone() { 2160 if (blockNewSlaveReverseZone == true) { 2161 return false; 2162 } 2163 blockNewSlaveReverseZone = true; 2164 blockButton('newSlaveReverseZoneButton', 'newSlaveReverseZone_loading', 'block'); 2165 2166 var data = { 2167 'type': 'addSlaveReverse', 2168 'zoneName': $('#reverseZone').val(), 2169 'zoneType': $('#zoneType').val(), 2170 'masterIP': $('#slaveMasterIp').val(), 2171 'zoneNameSub': $('#reverseZoneSub').val(), 2172 'newZoneOption': $("input[name=newZoneOptions]:checked").val(), 2173 'note': $('#noteZone').val() 2174 }; 2175 2176 $.post(AJAXACTIONS_URL + '?action=newzone', data, function(response) { 2177 unBlockButton('newSlaveReverseZoneButton', 'newSlaveReverseZone_loading', 'block'); 2178 blockNewSlaveReverseZone = false; 2179 if (response.status === 0) { 2180 showPopupMessage(response.message); 2181 } else { 2182 window.location.href = '/slave/domain/' + response.zone + '/?open=primary-settings'; 2183 } 2184 }, 'json'); 2185} 2186 2187var blockNewEnumZone = false; 2188function dashboard_addMasterEnumZone() { 2189 if (blockNewEnumZone == true) { 2190 return false; 2191 } 2192 blockNewEnumZone = true; 2193 blockButton('newEnumZoneButton', 'newEnumZone_loading', 'block'); 2194 2195 var data = { 2196 'type': 'addMasterEnum', 2197 'zoneName': $('#enumZone').val(), 2198 'note': $('#noteZone').val() 2199 }; 2200 2201 var servers = new Array(); 2202 $.each($('#masterDNSServers').children(), function() { 2203 if ($(this).children().prop('checked')) { 2204 servers.splice(servers.length, 0, $(this).children().val()); 2205 } 2206 }); 2207 data['servers'] = servers; 2208 $.post(AJAXACTIONS_URL + '?action=newzone', data, function(response) { 2209 unBlockButton('newEnumZoneButton', 'newEnumZone_loading', 'block'); 2210 blockNewEnumZone = false; 2211 if (response.status === 0) { 2212 showPopupMessage(response.message); 2213 } else { 2214 window.location.href = '/enum/domain/' + response.zone + '/'; 2215 } 2216 }, 'json'); 2217} 2218 2219var blockNewSlaveEnumZone = false; 2220function dashboard_addSlaveEnumZone() { 2221 if (blockNewSlaveEnumZone == true) { 2222 return false; 2223 } 2224 blockNewSlaveEnumZone = true; 2225 blockButton('newSlaveEnumZoneButton', 'newSlaveEnumZone_loading', 'block'); 2226 2227 var data = { 2228 'type': 'addSlaveEnum', 2229 'zoneName': $('#enumZone').val(), 2230 'masterIP': $('#slaveMasterIp').val(), 2231 'note': $('#noteZone').val() 2232 2233 }; 2234 2235 $.post(AJAXACTIONS_URL + '?action=newzone', data, function(response) { 2236 unBlockButton('newSlaveEnumZoneButton', 'newSlaveEnumZone_loading', 'block'); 2237 blockNewSlaveEnumZone = false; 2238 if (response.status === 0) { 2239 showPopupMessage(response.message); 2240 } else { 2241 window.location.href = '/slave/domain/' + response.zone + '/?open=primary-settings'; 2242 } 2243 }, 'json'); 2244} 2245 2246function dashboard_soaEdit(zone) { 2247 var data = { 2248 'show': 'editSOA', 2249 'domain': zone, 2250 'primary_ns': $('#primary_ns').val(), 2251 'mail': $('#mail').val(), 2252 'refresh': $('#refresh').val(), 2253 'retry': $('#retry').val(), 2254 'expire': $('#expire').val(), 2255 'minimum': $('#minimum').val() 2256 2257 }; 2258 2259 $.post(AJAXACTIONS_URL + '?action=soa-settings', data, function(response) { 2260 2261 if (typeof(response.action) != 'undefined') { 2262 eval(response.action); 2263 } else if (response.status == 0) { 2264 showPopupMessage(response.message); 2265 } else { 2266 hidePopup(); 2267 showPopup('soa-settings', '&show=get&domain=' + zone); 2268 showPopupMessage(response.message); 2269 zone_checkIfUpdated(zone); 2270 } 2271 }, 'json'); 2272} 2273 2274function dashboard_soaReset(zone, warning) { 2275 showConfirmation(warning, function () { 2276 var data = { 2277 'show': 'resetSOA', 2278 'domain': zone 2279 2280 }; 2281 $.post(AJAXACTIONS_URL + '?action=soa-settings', data, function(response) { 2282 if (typeof(response.action) != 'undefined') { 2283 eval(response.action); 2284 } else if (response.status == 0) { 2285 showPopupMessage(response.message); 2286 } else { 2287 hidePopup(); 2288 showPopup('soa-settings', '&show=get&domain=' + zone); 2289 showPopupMessage(response.message); 2290 zone_checkIfUpdated(zone); 2291 } 2292 2293 }, 'json'); 2294 }); 2295} 2296 2297var blockNewParkedZone = false;
2298function dashboard_addParkedDomain() { 2299 if (blockNewParkedZone == true) { 2300 return false; 2301 } 2302 blockNewParkedZone = true; 2303 blockButton('newParkedZoneButton', 'newParkedZone_loading', 'block'); 2304 2305 var domain = $('#parkedDomain').val(); 2306 var data = { 2307 'type': 'addParked', 2308 'domain': domain 2309 }; 2310 2311 var servers = new Array(); 2312 2313 $.each($('#masterDNSServers').children(), function() { 2314 if ($(this).children().prop('checked')) { 2315 servers.splice(servers.length, 0, $(this).children().val()); 2316 } 2317 }); 2318 data['option'] = 'servers'; 2319 data['servers'] = servers; 2320 data['note'] = $('#noteZone').val(); 2321 2322 2323 $.post(AJAXACTIONS_URL + '?action=newzone', data, function(response) { 2324 unBlockButton('newParkedZoneButton', 'newParkedZone_loading', 'block'); 2325 blockNewParkedZone = false; 2326 if (response.status == 1) { 2327 window.location.href = '/parked/domain/' + response.domain + '/'; 2328 } else { 2329 $('#parkedDomain').css('border-color', 'red'); 2330 showPopupMessage(response.message); 2331 } 2332 }, 'json'); 2333} 2334 2335var dashboardAutoreloadZones = false; 2336var dashboardAutoreloadZonesPage = 1; 2337var dashboardAutoreloadZonesGroup = 'all'; 2338var dashboardAutoreloadZonesOrderBy = ''; 2339function dashboard_autoReloadZones (page, group_id, order) { 2340 dashboardAutoreloadZones = true; 2341 dashboardAutoreloadZonesPage = page; 2342 dashboardAutoreloadZonesGroup = group_id; 2343 dashboardAutoreloadZonesOrderBy = '&orderBy=' + order; 2344} 2345function dashboard_stopAutoReloadZones () { 2346 dashboardAutoreloadZones = false; 2347} 2348function dashboard_autoReloadZonesRefresh () { 2349 if (dashboardAutoreloadZones) { 2350 insideCloudPage("dashboard-zones", "main", "&show=zones&page="+ dashboardAutoreloadZonesPage + "&group_id=" + dashboardAutoreloadZonesGroup + dashboardAutoreloadZonesOrderBy); 2351 } 2352 if (dashboardAutoreloadSharedZones) { 2353 insideCloudPage("dashboard-shared-zones", "main", "&show=sharedZones&page="+ dashboardAutoreloadSharedZonesPage); 2354 } 2355 setTimeout(function () { 2356 dashboard_autoReloadZonesRefresh(); 2357 }, 30000); 2358} 2359 2360var productsTableReload = false; 2361var productsTableReloadOrderID = 0; 2362function productsTableReloadStart (order) { 2363 productsTableReload = true; 2364 productsTableReloadOrderID = order; 2365} 2366function productsTableReloadStop () { 2367 productsTableReload = false; 2368} 2369function productsTableReloadRefresh () { 2370 if (productsTableReload) { 2371 insideCloudPage("productsTable", "orders", "&type=showProducts&order_id=" + productsTableReloadOrderID); 2372 } 2373 setTimeout(function () { 2374 productsTableReloadRefresh(); 2375 }, 60000); 2376} 2377 2378function orderPaidStatusCheck(order, status) { 2379 $.post(AJAXACTIONS_URL + '?action=orders', { 2380 'type': 'getOrderStatus', 2381 'order_id': order 2382 }, function(newStatus) { 2383 if (newStatus != status) { 2384 location.reload(); 2385 } else { 2386 setTimeout(function () { 2387 orderPaidStatusCheck(order, status); 2388 }, 30000); 2389 } 2390 }, 'json'); 2391} 2392 2393 2394var dashboardAutoreloadSharedZones = false; 2395var dashboardAutoreloadSharedZonesPage = 1; 2396function dashboard_autoReloadSharedZones (page) { 2397 dashboardAutoreloadSharedZones = true; 2398 dashboardAutoreloadSharedZonesPage = page; 2399} 2400function dashboard_stopAutoReloadSharedZones () { 2401 dashboardAutoreloadSharedZones = false; 2402} 2403 2404function dashboard_changeZoneStatus(zone, page, group_id, warning) { 2405 if (typeof(warning) == 'undefined') { 2406 executeZoneStatusChange(zone, page, group_id); 2407 } else { 2408 showConfirmation(warning, function () { 2409 executeZoneStatusChange(zone, page, group_id); 2410 }) 2411 } 2412} 2413 2414function dashboard_monitoring_deactivate(record_id, warning, page) { 2415 showConfirmation(warning, function () { 2416 showSplashScreen(); 2417 $.post(AJAXACTIONS_URL + '?action=monitoring-records', { 2418 'type': 'deactivate', 2419 'record_id': record_id, 2420 }, function (data) { 2421 response = JSON.parse(data); 2422 hideSplashScreen(); 2423 2424 if (!response.status) { 2425 showPopupMessage(response.message); 2426 } else { 2427 userData(); 2428 } 2429 2430 insideCloudPage('dashboard-monitoring-records', 'main', '&show=monitoring-records&page=' + page); 2431 }); 2432 }); 2433} 2434 2435function dashboard_monitoringSettings(record_id, page) { 2436 var scroll = $(window).scrollTop(); 2437 2438 showPopup('monitoring-records', '&show=settings&record=' + record_id + '&page=' + page + '&from_page=dashboard', function () { 2439 $(window).scrollTop(scroll); 2440 }); 2441} 2442 2443function dashboard_failoverSettings(record_id, domain_id, page) { 2444 var scroll = $(window).scrollTop(); 2445 2446 showPopup('records', '&show=failover-settings&record=' + record_id + '&zone=' + domain_id + '&page=' + page + '&from_page=dashboard', function () { 2447 $(window).scrollTop(scroll); 2448 }); 2449} 2450 2451function executeZoneStatusChange (zone, page, group_id) { 2452 $.post(AJAXACTIONS_URL + '?action=main', { 2453 'show': 'changeZoneStatus', 2454 'zone': zone 2455 }, function(response) { 2456 if (response.status == 0) { 2457 if (typeof(response.message) != 'undefined') { 2458 showPopupMessage(response.message); 2459 } else { 2460 var show = ''; 2461 2462 $.each(response.errors, function(key, error) { 2463 $.each(error, function(type, message) { 2464 show += message + '<br />'; 2465 }); 2466 }); 2467 showPopupMessage(show); 2468 } 2469 } else { 2470 if (typeof(page) != 'undefined') { 2471 insideCloudPage('dashboard-zones', 'main', '&show=zones&page=' + page + '&group_id=' + group_id); 2472 } else { 2473 location.reload(); 2474 } 2475 } 2476 }, 'json'); 2477 return false;
2478} 2479 2480 2481function dashboard_changeSharedZoneStatus(zone, page, warning) { 2482 if (typeof(warning) == 'undefined') { 2483 executeSharedZoneStatusChange(zone, page); 2484 } else { 2485 showConfirmation(warning, function () { 2486 executeSharedZoneStatusChange(zone, page); 2487 }) 2488 } 2489} 2490 2491function executeSharedZoneStatusChange (zone, page) { 2492 $.post(AJAXACTIONS_URL + '?action=main', { 2493 'show': 'changeZoneStatus', 2494 'zone': zone 2495 }, function(response) { 2496 if (response.status == 0) { 2497 if (typeof(response.message) != 'undefined') { 2498 showPopupMessage(response.message); 2499 } else { 2500 var show = ''; 2501 2502 $.each(response.errors, function(key, error) { 2503 $.each(error, function(type, message) { 2504 show += message + '<br />'; 2505 }); 2506 }); 2507 showPopupMessage(show); 2508 } 2509 } else { 2510 insideCloudPage('dashboard-shared-zones', 'main', '&show=sharedZones&page=' + page); 2511 } 2512 }, 'json'); 2513 return false; 2514} 2515 2516function groupChangeShow (products, product_id, group_id, page, forPage, name) { 2517 $('html body .popup-wraper').addClass('noMinHeight'); 2518 showPopup('main', '&show=groupChange&products=' + products + '&domain=' + product_id + '&group_id=' + group_id + '&page=' + page + '&forPage=' + forPage + '&productName=' + name, function() { 2519 $('html body .popup-wraper').removeClass('noMinHeight'); 2520 }); 2521} 2522 2523function groupChange (productType) { 2524 var scroll = $(window).scrollTop(); 2525 var goto = '&sortBy=' + $('#sortBy').val() + '&group_id=' + $('#' + productType + '-group').val(); 2526 var page = '&page=' + $('#page').val(); 2527 var new_group_id = $('#group').val(); 2528 var forPage = $('#forPage').val(); 2529 var product_id = $('#domain').val(); 2530 var responsive = $('#responsive').val(); 2531 var domain_name = $('#domain_name').val(); 2532 $.post(AJAXACTIONS_URL + '?action=main', { 2533 'type': 'groupChange', 2534 'productType': productType, 2535 'product': product_id, 2536 'group': new_group_id, 2537 'current_group': $('#current_group').val(), 2538 'new_group_name': $('#new_group_name').val() 2539 }, function(response) { 2540 showPopupMessage(response.message); 2541 if (response.status == 1) { 2542 if (forPage == 'records') { 2543 insideCloudPage('showGroup', 'main', '&show=groupName&zone_id=' + product_id); 2544 insideCloudPage('showGroupResponsive', 'main', '&show=groupName&zone_id=' + product_id + '&responsive=1'); 2545 } else if (forPage == 'domain-manage') { 2546 insideCloudPage('showGroup', 'domainManage', '&show=groupName&domain=' + product_id); 2547 insideCloudPage('showGroupResponsive', 'domainManage', '&show=groupName&domain=' + product_id + '&responsive=1'); 2548 } else if (forPage == 'monitoring-records') { 2549 insideCloudPage('showGroup', 'monitoring-records', '&show=groupName&record=' + product_id); 2550 insideCloudPage('showGroupResponsive', 'monitoring-records', '&show=groupName&record=' + product_id + '&responsive=1'); 2551 } else if (forPage == 'domain-manage-ssl') { 2552 insideCloudPage('ssl-certificates', 'domainManage', '&show=ssl-certificates&domain=' + domain_name + page, function() { 2553 $(".showSSLTitle, .showSSLTitleBody, .help").tooltip({ 2554 track: true, 2555 delay: 0, 2556 showURL: false, 2557 showBody: "<body>", 2558 fade: 250 2559 }); 2560 }); 2561 } else { 2562 insideCloudPage("dashboard-" + productType, "main", "&show=" + productType + "&page=" + page); 2563 } 2564 hidePopup(); 2565 } 2566 }, 'json'); 2567} 2568 2569function showNewGroupInput () { 2570 var val = $('#group').val(); 2571 $('#new_group_name').css('display', 'none'); 2572 $('#new_group_name_p').css('display', 'none'); 2573 if (val == 'new') { 2574 $('#new_group_name').css('display', 'inline'); 2575 $('#new_group_name_p').css('display', 'block'); 2576 } 2577} 2578 2579function groupAdd (productType) { 2580 var page = $('#page').val(); 2581 2582 $.post(AJAXACTIONS_URL + '?action=main', { 2583 'type': 'groupAdd', 2584 'productType': productType, 2585 'group_name': $('#group_name').val() 2586 }, function(response) { 2587 showPopupMessage(response.message); 2588 if (response.status == 1) { 2589 hidePopup(); 2590 showPopup("main", "&show=groupManage&products=" + productType + "&page=" + page); 2591 insideCloudPage("dashboard-" + productType, "main", "&show=" + productType + "&page=" + page); 2592 } 2593 }, 'json'); 2594} 2595 2596function groupDelete (confirmText, productType, group_id, innerpage, page) { 2597 showConfirmation(confirmText, function () { 2598 $.post(AJAXACTIONS_URL + '?action=main', { 2599 'type': 'groupDelete', 2600 'productType': productType, 2601 'group_id': group_id 2602 }, function(response) { 2603 showPopupMessage(response.message); 2604 if (response.status == 1) { 2605 hidePopup(); 2606 showPopup('main', '&show=groupManage&products=' + productType + '&page=' + page + '&innerpage=' + innerpage); 2607 insideCloudPage("dashboard-" + productType, "main", "&show=" + productType + "&page=" + page); 2608 } 2609 }, 'json'); 2610 }); 2611} 2612 2613function groupShowRename (group_id, productType, group_name, innerpage, page) { 2614 showPopup('main', '&show=groupRename&products=' + productType + '&group_id=' + group_id + '&page=' + page + '&innerpage=' + innerpage); 2615} 2616 2617function groupRename (group_id, productType) { 2618 var name = $('#name-' + group_id).val(); 2619 2620 $.post(AJAXACTIONS_URL + '?action=main', { 2621 'type': 'groupRename', 2622 'productType': productType, 2623 'group_id': group_id, 2624 'name': name 2625 }, function(response) { 2626 showPopupMessage(response.message); 2627 if (response.status == 1) { 2628 showPopup('main', '&show=groupManage&products=' + productType + '&page=1'); 2629 } 2630 }, 'json'); 2631} 2632 2633function groupShowAddBulkProducts (group_id, productType, innerpage, page) { 2634 showPopup('main', '&show=groupAddBulkProducts&products=' + productType + '&group_id=' + group_id + '&page=' + page + '&innerpage=' + innerpage); 2635} 2636 2637var blockGroupAddBulkProducts = false;
2638function groupAddBulkProducts (group_id, productType) { 2639 if (blockGroupAddBulkProducts === true) { 2640 return false; 2641 } 2642 2643 blockGroupAddBulkProducts = true; 2644 blockButton('addGroupBulkButton', 'addGroupBulk_loading'); 2645 2646 var scroll = $(window).scrollTop(); 2647 var domains = $('#groups-domains').val().split('\n').map(line => line.trim()).filter(line => line !== ''); 2648 2649 $.post(AJAXACTIONS_URL + '?action=main', { 2650 'type': 'addBulkProducts', 2651 'group_id': group_id, 2652 'domains': domains, 2653 'productType': productType 2654 }, function(response) { 2655 unBlockButton('addGroupBulkButton', 'addGroupBulk_loading'); 2656 blockGroupAddBulkProducts = false; 2657 showPopupMessage(response.message); 2658 if (response.status == 1) { 2659 showPopup('main', '&show=groupManage&products=' + productType + '&page=1'); 2660 insideCloudPage("dashboard-" + productType, "main", "&show=" + productType, function () { 2661 $('html').scrollTop(scroll); 2662 }); 2663 } 2664 }, 'json'); 2665} 2666 2667function groupShowShare (group_id) { 2668 var html = '<h3>' + __('share_group_with') + ':</h3><form onsubmit="return false;" class="flat-input-style s-input-wraper a-c"><input type="text" name="shere" id="share" placeholder="[email protected]"> <button type="button" class="round-btn s-btn color-btn group-rename-button" onclick="groupShare(' + group_id + ')">' + __('share') + '</button></form>'; 2669 showPopupMessage(html); 2670} 2671 2672function groupShare (group_id) { 2673 $.post(AJAXACTIONS_URL + '?action=main', { 2674 'type': 'groupShare', 2675 'group_id': group_id, 2676 'mail': $('#share').val() 2677 }, function(response) { 2678 showPopupMessage(response.message); 2679 if (response.status == 1) { 2680 showPopup('main', '&show=groupManage&products=zones&page=1'); 2681 } 2682 }, 'json'); 2683} 2684 2685function deleteGroupShare (group_id, mail, warning) { 2686 showConfirmation(htmlspecialchars(warning), function () { 2687 $.post(AJAXACTIONS_URL + '?action=main', { 2688 'type': 'deleteGroupShare', 2689 'group_id': group_id, 2690 'mail': mail 2691 }, function(response) { 2692 if (response.status == 1) { 2693 showPopup('main', '&show=groupManage&products=zones&page=1'); 2694 } else { 2695 showPopupMessage(response.message); 2696 } 2697 }, 'json'); 2698 }); 2699} 2700 2701function filterByGroup (select, productType, domain) { 2702 var group = $(select).val(); 2703 if (productType == 'monitoring-records') { 2704 insideCloudPage('monitoring-table-body', 'main', '&show=monitoring-body&group_id=' + group + '&page=1'); 2705 return; 2706 } 2707 2708 if (productType == 'table-ssl') { 2709 insideCloudPage('ssl-certificates', 'domainManage', '&show=ssl-certificates&domain=' + encodeURIComponent(domain) + '&sortBy=group&group_id=' + encodeURIComponent(group) + '&page=1'); 2710 return; 2711 } 2712 2713 insideCloudPage('dashboard-' + productType, 'main', '&show=' + productType + '&sortBy=group&group_id=' + group + '&page=1'); 2714} 2715 2716function initZonesTypeDropdown() { 2717 $('#zones-type-btn').on('click', function(e) { 2718 $('#zones-type-list').toggle(); 2719 e.stopPropagation(); 2720 }); 2721 2722 $('#zones-type-list li').on('click', function() { 2723 var selectedType = $(this).data('value'); 2724 $('#zones-type-list').hide(); 2725 2726 $('#zones-type-selected').attr('class', $(this).find('span').attr('class')); 2727 2728 insideCloudPage('dashboard-zones', 'main', '&show=zones&zone_type=' + selectedType + '&page=1'); 2729 }); 2730 2731 $(document).on('click', function() { 2732 $('#zones-type-list').hide(); 2733 }); 2734} 2735 2736function failoverFilterBy (select, type, sortBy) { 2737 var value = $(select).val(); 2738 insideCloudPage('dashboard-failover-records', 'failover-records', '&show=showRecords' + sortBy + '&' + type + '=' + value + '&page=1'); 2739} 2740 2741function monitoringFilterBy (select, type, sortBy) { 2742 var value = $(select).val(); 2743 2744 insideCloudPage('dashboard-monitoring-records', 'main', '&show=monitoring-records' + sortBy + '&' + type + '=' + value + '&page=1'); 2745} 2746 2747function sharedMonitoringFilterBy (select, type) { 2748 var value = $(select).val(); 2749 insideCloudPage('shared-monitoring-records-table-body', 'main', '&show=shared-monitoring-records-body&' + type + '=' + value + '&page=1', function() { 2750 initSharedMonitoringTableBody(); 2751 }); 2752} 2753 2754function initSharedMonitoringTableBody () { 2755 $(".showMonitoringRecordsTitle").tooltip({ 2756 track: true, 2757 delay: 0, 2758 showURL: false, 2759 showBody: "<body>", 2760 fade: 250 2761 }); 2762} 2763 2764function dashboard_monitoringActivate (status, state, check_type, page, from, domain) { 2765 var sortBy = ''; 2766 if (status != '') { 2767 sortBy = '&status=' + status; 2768 } 2769 if (state != '') { 2770 sortBy = '&state=' + state; 2771 } 2772 if (check_type != '') { 2773 sortBy = '&check_type=' + check_type; 2774 } 2775 2776 $.post(AJAXACTIONS_URL + '?action=monitoring-records', { 2777 'action': 'activate', 2778 'check_type': $('#fo_check_type').val(), 2779 'monitoring_region': $('#fo_monitoring_region').val(), 2780 'check_period': $('#fo_check_period').val(), 2781 'ip': $('#fo_ip').val(), 2782 'name': $('#fo_name').val(), 2783 'http_host': $('#fo_http_host').val(), 2784 'http_port': $('#fo_http_port').val(), 2785 'http_path': $('#fo_http_path').val(), 2786 'http_content': $('#fo_http_content').val(), 2787 'http_status_code': $('#fo_http_status_code').val(), 2788 'http_match_type': $('input[name=match_type]:checked').val(), 2789 'http_protocol': $('input[name=web_protocol]:checked').val(), 2790 'http_custom_string': $('input[name=web_custom_string]:checked').val(), 2791 'port': $('#fo_port').val(), 2792 'dns_host': $('#fo_dns_host').val(), 2793 'dns_type': $('#fo_dns_type').val(), 2794 'dns_response': $('#fo_dns_response').val(), 2795 'ssl_host': $('#fo_ssl_host').val(), 2796 'ssl_port': $('#fo_ssl_port').val(), 2797 'ssl_timeout': $('#fo_ssl_timeout').val(), 2798 'ssl_cacert': $('#fo_ssl_cacert').val(),
2799 'self_cacert': $('#fo_self_cacert').is(':checked') ? 1 : 0, 2800 'http_timeout': $('#fo_http_timeout').val(), 2801 'open_port': $('#monitoring_port_open').is(':checked') ? 1 : 0, 2802 'state': $('#monitoring_state_active').is(':checked') ? 1 : 0, 2803 'status_change_checks': $('#fo_status_change_checks').val(), 2804 'header': $('#fo_header').is(':checked') ? 1 : 0, 2805 'header_name': $('#fo_header_name').val(), 2806 'header_value': $('#fo_header_value').val(), 2807 'latency_limit': $('#fo_latency_limit').val(), 2808 'notification_days': $('#fo_notification_days').val(), 2809 'ping_timeout': $('#fo_ping_timeout').val(), 2810 'http_request_type': $('#http_request_type').val(), 2811 'ip_type': $('input[name=ip_type]:checked').val(), 2812 'url': $('#fo_url').val(), 2813 'audio_threshold': $('#fo_audio_threshold').val(), 2814 'ping_threshold': $('#fo_ping_threshold').val(), 2815 'connection_security': $('#connection_security').val(), 2816 'connection_security_imap': $('#connection_security_imap').val(), 2817 'keyword': $('#keyword').val(), 2818 'domain': domain 2819 }, function(response) { 2820 if (!response.status) { 2821 var escapedMessage = $('<div>').text(response.message).html(); 2822 escapedMessage = escapedMessage.replace(/<a/, '<a').replace(/<\/a>/, '</a>').replace(/>/, '>'); 2823 2824 showPopupMessage(escapedMessage); 2825 } else { 2826 userData(); 2827 if (from == 'statuspages') { 2828 insideCloudPage('fo_monitoring_table', 'monitoring-status-pages', '&show=checks-table&domain=' + domain + '&page=1'); 2829 hidePopup(); 2830 } else { 2831 window.location.href = '/monitoring-records/record/' + response.id + '/'; 2832 } 2833 } 2834 }, 'json'); 2835 return false; 2836} 2837 2838function dashboard_monitoringChangeType () { 2839 var foType = parseInt($('#fo_check_type').val()); 2840 $('.monitoringType').css('display', 'none'); 2841 $('.monitoringType'+ foType).css('display', ''); 2842 $('.monitoringTypeNot').css('display', ''); 2843 $('.monitoringTypeNot'+ foType).css('display', 'none'); 2844 2845 fixPopupPosition('#cloudnspop'); 2846 2847 monitoringSmtpPort(); 2848} 2849 2850function dashboard_monitoringCustomHeaderFileds () { 2851 if ($('#fo_header').is(':checked')) { 2852 $('.fo-header-fields').css('display', ''); 2853 fixPopupPosition('#cloudnspop'); 2854 } else { 2855 $('.fo-header-fields').css('display', 'none'); 2856 } 2857} 2858 2859function dashboard_monitoringSslSelfSigned () { 2860 if ($('#fo_self_cacert').is(':checked')) { 2861 $('.fo-self-cacert').css('display', ''); 2862 fixPopupPosition('#cloudnspop'); 2863 } else { 2864 $('.fo-self-cacert').css('display', 'none'); 2865 } 2866} 2867 2868function monitoringRegionDisclamer () { 2869 $('#region_location_disclamer').css('display', 'none'); 2870 if ($.isNumeric($('#fo_monitoring_region').val())) {
2871 $('#region_location_disclamer').css('display', 'block'); 2872 } 2873} 2874 2875function monitoring_log (record_id, page, select, type, sortBy) { 2876 if (typeof page === 'undefined') { 2877 page = 1; 2878 } 2879 2880 if (typeof sortBy === 'undefined' || sortBy === null) { 2881 sortBy = ''; 2882 } 2883 2884 if (type === 'date') { 2885 2886 var fromDate = $('#fromDate').val(); 2887 var toDate = $('#toDate').val(); 2888 2889 var dateRegex = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/; 2890 2891 var invalid = false; 2892 2893 if (fromDate != '' && !dateRegex.test(fromDate)) { 2894 $('#fromDate').attr('title', 'Date must be in format YYYY-MM-DD'); 2895 $('#fromDate').tipsy({ 2896 gravity: 's', 2897 trigger: 'manual', 2898 html: false 2899 }).tipsy('show'); 2900 2901 $('#fromDate').one('change', function () { 2902 $(this).tipsy('hide'); 2903 }); 2904 2905 invalid = true; 2906 } 2907 2908 if (toDate != '' && !dateRegex.test(toDate)) { 2909 $('#toDate').attr('title', 'Date must be in format YYYY-MM-DD'); 2910 $('#toDate').tipsy({ 2911 gravity: 's', 2912 trigger: 'manual', 2913 html: false 2914 }).tipsy('show'); 2915 2916 $('#toDate').one('change', function () { 2917 $(this).tipsy('hide'); 2918 }); 2919 2920 invalid = true; 2921 } 2922 if (!invalid && validateDateRange(fromDate, toDate)) { 2923 invalid = true; 2924 } 2925 2926 if (invalid) { 2927 return false; 2928 } 2929 2930 2931 var hadFrom = /(?:^|&)fromDate=/.test(sortBy); 2932 var hadTo = /(?:^|&)toDate=/.test(sortBy); 2933 2934 sortBy = sortBy.replace(/&fromDate=[^&]*/g, ''); 2935 sortBy = sortBy.replace(/&toDate=[^&]*/g, ''); 2936 2937 if (fromDate === '' && toDate === '') { 2938 if (!hadFrom && !hadTo) { 2939 return; 2940 } 2941 } else { 2942 if (fromDate !== '') { 2943 sortBy += '&fromDate=' + encodeURIComponent(fromDate); 2944 } 2945 if (toDate !== '') { 2946 sortBy += '&toDate=' + encodeURIComponent(toDate); 2947 } 2948 } 2949 } else { 2950 if (select !== '') { 2951 var value = $(select).val(); 2952 sortBy = sortBy + '&' + type + '=' + value; 2953 } 2954 } 2955 2956 insideCloudPage('fo_monitoring_table', 'monitoring-records', '&show=monitoring-log&record_id=' + record_id + '&page=' + page + sortBy, function () { 2957 $('.tipsy').remove(); 2958 }); 2959 2960 return false; 2961} 2962 2963function monitoring_uptime_log (record_id, page) { 2964 if (typeof page === 'undefined') { 2965 page = 1; 2966 } 2967 insideCloudPage('monitoring_uptime_table', 'monitoring-records', '&show=monitoring-uptime-log&record_id='+ record_id +'&page='+page); 2968 return false; 2969} 2970 2971function monitoring_recordModify (record_id, from_page, dashboard_page) { 2972 $.post(AJAXACTIONS_URL + '?action=monitoring-records', { 2973 'type': 'modify', 2974 'record_id': record_id, 2975 'check_type': $('#fo_check_type').val(), 2976 'monitoring_region': $('#fo_monitoring_region').val(), 2977 'check_period': $('#fo_check_period').val(), 2978 'ip': $('#fo_ip').val(), 2979 'name': $('#fo_name').val(), 2980 'http_host': $('#fo_http_host').val(), 2981 'http_port': $('#fo_http_port').val(), 2982 'http_path': $('#fo_http_path').val(), 2983 'http_content': $('#fo_http_content').val(), 2984 'http_status_code': $('#fo_http_status_code').val(), 2985 'http_match_type': $('input[name=match_type]:checked').val(), 2986 'http_protocol': $('input[name=web_protocol]:checked').val(), 2987 'http_custom_string': $('input[name=web_custom_string]:checked').val(), 2988 'port': $('#fo_port').val(), 2989 'dns_host': $('#fo_dns_host').val(), 2990 'dns_type': $('#fo_dns_type').val(), 2991 'dns_response': $('#fo_dns_response').val(), 2992 'ssl_host': $('#fo_ssl_host').val(), 2993 'ssl_port': $('#fo_ssl_port').val(), 2994 'ssl_timeout': $('#fo_ssl_timeout').val(), 2995 'ssl_cacert': $('#fo_ssl_cacert').val(), 2996 'self_cacert': $('#fo_self_cacert').is(':checked') ? 1 : 0, 2997 'http_timeout': $('#fo_http_timeout').val(), 2998 'open_port': $('#monitoring_port_open').is(':checked') ? 1 : 0, 2999 'state': $('#monitoring_state_active').is(':checked') ? 1 : 0, 3000 'status_change_checks': $('#fo_status_change_checks').val(), 3001 'notification_subject': $('#fo_notification_subject').val(), 3002 'header': $('#fo_header').is(':checked') ? 1 : 0, 3003 'header_name': $('#fo_header_name').val(), 3004 'header_value': $('#fo_header_value').val(), 3005 'latency_limit': $('#fo_latency_limit').val(), 3006 'notification_days': $('#fo_notification_days').val(), 3007 'ping_timeout': $('#fo_ping_timeout').val(), 3008 'http_request_type': $('#http_request_type').val(), 3009 'ip_type': $('input[name=ip_type]:checked').val(), 3010 'url': $('#fo_url').val(), 3011 'audio_threshold': $('#fo_audio_threshold').val(), 3012 'ping_threshold': $('#fo_ping_threshold').val(), 3013 'connection_security': $('#connection_security').val(), 3014 'connection_security_imap': $('#connection_security_imap').val(), 3015 'keyword': $('#keyword').val(), 3016 }, function(response) { 3017 if (typeof(response.action) !== 'undefined') { 3018 eval(response.action); 3019 } else { 3020 showPopupMessage(htmlspecialchars(response.message), function() { 3021 if (response.status == 1) { 3022 if (from_page == 'dashboard') { 3023 insideCloudPage('dashboard-monitoring-records', 'main', '&show=monitoring-records&page=' + dashboard_page); 3024 } else { 3025 window.location.href = '/monitoring-records/record/' + record_id + '/'; 3026 } 3027 } 3028 }); 3029 } 3030 }, 'json'); 3031 return false;
3032} 3033 3034function monitoring_deactivate(record_id, warning) { 3035 showConfirmation(warning, function () { 3036 $.post(AJAXACTIONS_URL + '?action=monitoring-records', { 3037 'type': 'deactivate', 3038 'record_id': record_id 3039 }, function (response) { 3040 if (typeof (response.action) !== 'undefined') { 3041 eval(response.action); 3042 } else { 3043 if (!response.status) { 3044 showPopupMessage(response.message); 3045 } else { 3046 showPopupMessage(response.message, function () { 3047 window.location = '/main/#dashboard-monitoring-records'; 3048 }); 3049 } 3050 } 3051 }, 'json'); 3052 return false; 3053 }); 3054} 3055function monitoring_changeNotificationsOption(formId) { 3056 var type = $('#'+ formId +' select#type').val(); 3057 if (type == '1') { 3058 $('#'+ formId +' .emailInput').css('display', ''); 3059 $('#'+ formId +' .webhookInput').css('display', 'none'); 3060 $('#'+ formId +' .smsInput').css('display', 'none'); 3061 $('#'+ formId +' .telegramInput').css('display', 'none'); 3062 $('#'+ formId +' .discordInput').css('display', 'none'); 3063 } else if (type == 2 || type == 3) { 3064 $('#'+ formId +' .webhookInput').css('display', ''); 3065 $('#'+ formId +' .emailInput').css('display', 'none'); 3066 $('#'+ formId +' .smsInput').css('display', 'none'); 3067 $('#'+ formId +' .telegramInput').css('display', 'none'); 3068 $('#'+ formId +' .discordInput').css('display', 'none'); 3069 var placeholder = 'up'; 3070 if (type == 3) { 3071 placeholder = 'down'; 3072 } 3073 $('#'+ formId +' #url').attr('placeholder', 'http://example.com?content='+placeholder); 3074 } else if (type == 4) { 3075 $('#'+ formId +' .webhookInput').css('display', 'none'); 3076 $('#'+ formId +' .emailInput').css('display', 'none'); 3077 $('#'+ formId +' .smsInput').css('display', ''); 3078 $('#'+ formId +' .telegramInput').css('display', 'none'); 3079 $('#'+ formId +' .discordInput').css('display', 'none'); 3080 } else if (type == 5) { 3081 $('#'+ formId +' .webhookInput').css('display', 'none'); 3082 $('#'+ formId +' .emailInput').css('display', 'none'); 3083 $('#'+ formId +' .smsInput').css('display', 'none'); 3084 $('#'+ formId +' .discordInput').css('display', 'none'); 3085 $('#'+ formId +' .telegramInput').css('display', 'flex'); 3086 } else { 3087 $('#'+ formId +' .webhookInput').css('display', 'none'); 3088 $('#'+ formId +' .emailInput').css('display', 'none'); 3089 $('#'+ formId +' .smsInput').css('display', 'none'); 3090 $('#'+ formId +' .telegramInput').css('display', 'none'); 3091 $('#'+ formId +' .discordInput').css('display', 'flex'); 3092 } 3093} 3094 3095function monitoring_showNotifications (record_id, page) { 3096 if (typeof page === 'undefined') { 3097 page = 1; 3098 } 3099 3100 showPopup("monitoring-records", "&show=notifications&record=" + record_id + "&page=" + page); 3101 return false; 3102} 3103 3104function monitoring_showNotificationsTable (record_id, page) { 3105 if (typeof page === 'undefined') { 3106 page = 1; 3107 } 3108 insideCloudPage("notifications", "monitoring-records", "&show=notifications-table&record=" + record_id + "&page=" + page, function() { 3109 fixPopupPosition('#cloudnspop'); 3110 }); 3111 return false; 3112} 3113 3114function monitoring_createNotification (record_id) { 3115 var type = $('#type').val(); 3116 var code = ''; 3117 var value = ''; 3118 var id = ''; 3119 if (type == '1') { 3120 value = $('#email').val(); 3121 } else if (type == 2 || type == 3) { 3122 value = $('#url').val(); 3123 } else if (type == 4) { 3124 code = $('#telnocc').val(); 3125 value = $('#telno').val(); 3126 } else if (type == 5) { 3127 value = $('#message').val(); 3128 code = $('#botToken').val(); 3129 id = $('#chatID').val(); 3130 } else { 3131 value = $('#discordMessage').val(); 3132 code = $('#discordToken').val(); 3133 id = $('#discordChatID').val(); 3134 } 3135 3136 $.post(AJAXACTIONS_URL + '?action=monitoring-records', { 3137 'type': 'create-notification', 3138 'record_id': record_id, 3139 'nType': type, 3140 'code': code, 3141 'value': value, 3142 'id': id 3143 }, function(response) { 3144 if (!response.status) { 3145 showPopupMessage(response.message); 3146 } else { 3147 showPopupMessage(response.message); 3148 monitoring_showNotifications(record_id); 3149 } 3150 }, 'json'); 3151} 3152 3153function monitoring_deleteNotification (id, record_id, page, warning) { 3154 showConfirmation(warning, function () { 3155 $.post(AJAXACTIONS_URL + '?action=monitoring-records', { 3156 'type': 'delete-notification', 3157 'record_id': record_id, 3158 'id': id 3159 }, function(response) { 3160 if (!response.status) { 3161 showPopupMessage(response.message); 3162 } else { 3163 monitoring_showNotifications(record_id, page); 3164 } 3165 }, 'json'); 3166 }); 3167} 3168 3169function monitoring_calcSmsPrice () { 3170 $.post(AJAXACTIONS_URL + '?action=monitoring-records', { 3171 'type': 'calc-sms-price', 3172 'code': $('#telnocc').val(), 3173 'number': $('#telno').val() 3174 }, function(response) { 3175 if (response.status == 0) { 3176 showPopupMessage(response.message); 3177 } else { 3178 $('#calcPriceLink').css('display', 'none') 3179 $('#priceText').html(response.message); 3180 } 3181 }, 'json'); 3182} 3183 3184function monitoring_toggleSmsPrice () { 3185 $('#calcPriceLink').css('display', '') 3186 $('#priceText').html(''); 3187} 3188 3189function monitoring_checkIfValidHost () { 3190 var host = $('#fo_ip').val(); 3191 if (typeof host === 'undefined') { 3192 return false;
3193 } 3194 if (host.length < 3) { 3195 return false; 3196 } 3197 $.post(AJAXACTIONS_URL + '?action=monitoring-records', { 3198 'type': 'check-if-host', 3199 'host': host 3200 }, function(response) { 3201 if (response.status == 1) { 3202 $('.fo_host_ip_choice').css('display', 'flex'); 3203 } else { 3204 $('.fo_host_ip_choice').css('display', 'none'); 3205 } 3206 3207 fixPopupPosition('#cloudnspop'); 3208 }, 'json'); 3209} 3210 3211function monitoring_changeMaintenanceState () { 3212 if ($('#maintenance_enabled').is(':checked')) { 3213 $('.maintenance-date-fields').css('display', 'flex'); 3214 } else { 3215 $('.maintenance-date-fields').css('display', 'none'); 3216 } 3217 3218 fixPopupPosition('#cloudnspop'); 3219 return true; 3220} 3221 3222function monitoring_editMaintenance (record_id) { 3223 $.post(AJAXACTIONS_URL + '?action=monitoring-records', { 3224 'action': 'editMaintanance', 3225 'record': record_id, 3226 'maintenance': $('#maintenance_enabled').is(':checked') ? 1 : 0, 3227 'maintenance_from': $('#maintenance_from').val(), 3228 'maintenance_to': $('#maintenance_to').val() 3229 }, function(response) { 3230 if (response.status == 1) { 3231 insideCloudPage('showMaintenance', 'monitoring-records', '&show=maintenanceState&record=' + record_id); 3232 insideCloudPage('showMaintenanceResponsive', 'monitoring-records', '&show=maintenanceState&record=' + record_id + '&responsive=1'); 3233 } 3234 showPopupMessage(response.message); 3235 }, 'json'); 3236 3237 return false; 3238} 3239 3240function monitoringSmtpPort () { 3241 var foType = parseInt($('#fo_check_type').val()); 3242 var port = 25; 3243 var option = $('#connection_security').val(); 3244 3245 if (typeof foType == 'undefined' || foType == 15) { 3246 if (option == 2) { 3247 port = 587; 3248 } else if (option == 3) { 3249 port = 465; 3250 } else { 3251 port = 25; 3252 } 3253 } else if (foType == 19) { 3254 var port = 143; 3255 var option = $('#connection_security_imap').val(); 3256 if (option == 3) { 3257 port = 993; 3258 } else { 3259 port = 143; 3260 } 3261 } 3262 3263 $('#fo_port').attr('placeholder', port); 3264} 3265 3266function monitoringImapPort () { 3267 var port = 143; 3268 var option = $('#connection_security_imap').val(); 3269 if (option == 3) { 3270 port = 993; 3271 } else { 3272 port = 143; 3273 } 3274 3275 $('#fo_port').attr('placeholder', port); 3276} 3277 3278/* ********************* */ 3279/* DOMAINS */ 3280/* ********************* */ 3281function domains_toggie(header, show, domain) { 3282 3283 $('.managerBox').css('display', 'none'); 3284 3285 if ($('#' + show).css('display') == 'block') { 3286 $(header).css('color', '#000'); 3287 $('#' + show).hide(); 3288 return true; 3289 } else if ($('#' + show).html() == '') { 3290 insideCloudPage(show, 'domainManage', {'show': show, 'domain': domain}); 3291 } 3292 3293 $('#' + show).show(); 3294 3295} 3296 3297var blockDomainSaveContacts = false; 3298function domains_saveContacts(domain, type, fields) { 3299 if (blockDomainSaveContacts === true) { 3300 return false; 3301 } 3302 blockDomainSaveContacts = true; 3303 blockButton('button_contacts_' + type,'loading_contacts_' + type, 'inline-block'); 3304 fields = eval('{' + fields + '}'); 3305 3306 var contacts = ''; 3307 $.each(fields, function(index, value) { 3308 if (typeof($('#' + type + '_' + value).val()) == 'undefined') { 3309 field = ''; 3310 } else { 3311 field = $('#' + type + '_' + value).val(); 3312 } 3313 if (contacts != '') { 3314 contacts = contacts + ','; 3315 } 3316 contacts = contacts + "'" + addslashes(value) + "':" + '"' + addslashes(field) + '"'; 3317 }); 3318 contacts = eval('[{' + contacts + '}]'); 3319 $('#loading_records_'+type).css('display', 'inline'); 3320 var useForAll = $('#useForAllContactTypes').is(':checked') ? 1 : 0; 3321 $.post(AJAXACTIONS_URL + '?action=domainManage', { 3322 'action': 'setContacts', 3323 'domain': domain, 3324 'type': type, 3325 'contacts': contacts, 3326 'useForAllTypes': useForAll 3327 }, function(response) { 3328 blockDomainSaveContacts = false; 3329 unBlockButton('button_contacts_' + type,'loading_contacts_' + type); 3330 if (response.status == 0 && response.needApproval == 1) { 3331 showPopup('domainManage', '&show=contacts-confirmation&domain=' + domain + '&reqid=' + response.reqId); 3332 } else if (response.status == 0) { 3333 showPopupMessage(response.message); 3334 $('#loading_records_'+type).css('display', 'none'); 3335 } else { 3336 if (useForAll == 0) { 3337 insideCloudPage('modifyContact-' + type, 'domainManage', '&show=getContactDetails&domain=' + domain + '&type=' + type + '&contacts=' + contacts); 3338 } else { 3339 insideCloudPage('contactDetails', 'domainManage', '&show=contactDetails&domain=' + htmlspecialchars(domain)); 3340 } 3341 showPopupMessage(response.message); 3342 } 3343 }, 'json'); 3344} 3345 3346function domains_sendContactsApprovalType(domain, reqid) { 3347 $.post(AJAXACTIONS_URL + '?action=domainManage', { 3348 'action': 'setContactsApprovalType', 3349 'domain': domain, 3350 'approvalType': $("input[type='radio'][name='approvalType']:checked").val(), 3351 'reqid': reqid 3352 }, function(response) { 3353 showPopupMessage(response.message, function(){ 3354 hidePopup(); 3355 insideCloudPage('contactDetails', 'domainManage', '&show=contactDetails&domain=' + htmlspecialchars(domain)); 3356 }); 3357 }, 'json'); 3358} 3359 3360function domains_declineContactsChange (reqid, reqkey, domain) { 3361 $.post(AJAXACTIONS_URL + '?action=registrar', { 3362 'type': 'declineContactsChange', 3363 'reqid': reqid, 3364 'reqkey': reqkey, 3365 'domain': domain 3366 }, function(response) { 3367 if (response.status == 0) { 3368 showPopupMessage(response.message, function(){ 3369 window.location = '/registrar/contacts-change-approval/' + reqkey + '/id/' + reqid + '/'; 3370 }); 3371 } else { 3372 window.location = '/registrar/contacts-change-approval/' + reqkey + '/id/' + reqid + '/'; 3373 } 3374 }, 'json'); 3375} 3376 3377function domains_approveContactsChange (reqid, reqkey, domain) { 3378 $.post(AJAXACTIONS_URL + '?action=registrar', { 3379 'type': 'approveContactsChange', 3380 'reqid': reqid, 3381 'reqkey': reqkey, 3382 'domain': domain 3383 }, function(response) { 3384 if (response.status == 0) { 3385 showPopupMessage(response.message, function(){ 3386 window.location = '/registrar/contacts-change-approval/' + reqkey + '/id/' + reqid + '/'; 3387 }); 3388 } else { 3389 window.location = '/registrar/contacts-change-approval/' + reqkey + '/id/' + reqid + '/'; 3390 } 3391 }, 'json'); 3392} 3393 3394blockNameserversChange = false;
3395function domains_saveNameservers(domain, max_ns) { 3396 if (typeof(max_ns) == 'undefined') { 3397 max_ns = 4; 3398 } 3399 if (blockNameserversChange == true) { 3400 return false; 3401 } 3402 blockNameserversChange = true; 3403 blockButton('save_nameservers', 'save_nameservers_loading', 'block'); 3404 var servers = {}; 3405 for (i = 1; i <= max_ns; i++) { 3406 servers[i] = $('#ns_' + i).val(); 3407 if (typeof($('#ns_ip_' + i).val()) != 'undefined' && $('#ns_ip_' + i).val() != '' && $('#ns_' + i).val() != '') { 3408 servers[i] += ' ' + $('#ns_ip_' + i).val(); 3409 } 3410 } 3411 3412 $.post(AJAXACTIONS_URL + '?action=domainManage', { 3413 'action': 'setNameservers', 3414 'domain': domain, 3415 'servers': servers 3416 }, function(data) { 3417 unBlockButton('save_nameservers', 'save_nameservers_loading', 'block'); 3418 blockNameserversChange = false; 3419 if (data.status == 0) { 3420 showPopupMessage(data.message); 3421 } else { 3422 insideCloudPage('nameservers', 'domainManage', '&show=nameservers&domain=' + domain); 3423 showPopupMessage(data.message); 3424 } 3425 }, 'json'); 3426} 3427 3428blockCDNSmodify = {}; 3429function domains_modifyChildNameserverIP(domain, cns, old_ip, new_ip, i) { 3430 // setting the unique block of the form to be false if is not set 3431 if (typeof(blockCDNSmodify[i]) == 'undefined') { 3432 blockCDNSmodify[i] = false; 3433 } 3434 // checking if it's set to true, 3435 // which means the form is already submited and is waiting a response 3436 // so we block next submits 3437 if (blockCDNSmodify[i] == true) { 3438 return false; 3439 } 3440 3441 // if it's not already blocked we block it 3442 blockCDNSmodify[i] = true; 3443 blockButton('button_cns_'+i, 'loading_cns_'+i, 'inline-block'); 3444 3445 $.post(AJAXACTIONS_URL + '?action=domainManage', { 3446 'action': 'modifyChildNameserverIP', 3447 'domain': domain, 3448 'cns': cns, 3449 'old_ip': old_ip, 3450 'new_ip': new_ip 3451 }, function(data) { 3452 // a response is received and we unblock the form and the button 3453 unBlockButton('button_cns_'+i, 'loading_cns_'+i); 3454 blockCDNSmodify[i] = false; 3455 if (data.status == 0) { 3456 showPopupMessage(data.message); 3457 } else { 3458 $('#form_' + i).attr('onSubmit', 'return false;'); 3459 $('#ip_' + i).attr('value', ''+htmlspecialchars(new_ip)+''); 3460 $('#button_cns_' + i).attr('onclick', 'domains_modifyChildNameserverIP(\'' + domain + '\', \'' + cns + '\', \'' + new_ip + '\', $(\'#ip_' + i +'\').val(), \''+ i + '\');'); 3461 $('#button_deleting_cns_' + i).attr('onclick', 'domains_deleteChildNameserver(\'' + domain + '\', \'' + cns + '\', \'' + new_ip + '\', \'' + i + '\');'); 3462 showPopupMessage(data.message); 3463 } 3464 }, 'json'); 3465} 3466function domains_deleteChildNameserver(domain, cns, ip, i) { 3467 $('#deleting_cns_'+i).css('display', 'inline-block'); 3468 $('#button_deleting_cns_'+i).css('display', 'none'); 3469 var scroll = $(window).scrollTop(); 3470 $.post(AJAXACTIONS_URL + '?action=domainManage', { 3471 'action': 'deleteChildNameserver', 3472 'domain': domain, 3473 'cns': cns, 3474 'ip': ip, 3475 }, function(data) { 3476 insideCloudPage('childNameservers', 'domainManage', '&show=childNameservers&domain=' + domain, function() { 3477 $(window).scrollTop(scroll); 3478 }); 3479 showPopupMessage(data.message); 3480 }, 'json'); 3481} 3482 3483blockCDNSadd = false; 3484function domains_addChildNameserver(domain, host, ip) { 3485 if (blockCDNSadd == true) { 3486 return false; 3487 } 3488 3489 blockCDNSadd = true; 3490 blockButton('button_adding_cns', 'adding_cns', 'block'); 3491 $.post(AJAXACTIONS_URL + '?action=domainManage', { 3492 'action': 'addChildNameserver', 3493 'domain': domain, 3494 'host': host, 3495 'ip': ip, 3496 }, function(data) { 3497 unBlockButton('button_adding_cns', 'adding_cns', 'block'); 3498 blockCDNSadd = false; 3499 if (data.status == 0) { 3500 showPopupMessage(data.message); 3501 } else { 3502 insideCloudPage('childNameservers', 'domainManage', '&show=childNameservers&domain=' + domain); 3503 showPopupMessage(data.message); 3504 } 3505 }, 'json'); 3506} 3507 3508 3509function domains_enableTransferProtection (domain) { 3510 $('#changing').css('display', 'inline-block'); 3511 $('#button_transfer').css('display', 'none'); 3512 $.post(AJAXACTIONS_URL + '?action=domainManage', { 3513 'action': 'enableTransferProtection', 3514 'domain': domain 3515 }, function(response) { 3516 $('#changing').css('display', 'none'); 3517 $('#button_transfer').css('display', 'inline-block'); 3518 if (response.status == 0) { 3519 showPopupMessage(response.message); 3520 return false;
3521 } 3522 insideCloudPage('transferProtection', 'domainManage', '&show=transferProtection&domain=' + domain); 3523 }, 'json'); 3524} 3525function domains_disableTransferProtection (domain, warning) { 3526 showConfirmation(warning, function () { 3527 $('#changing').css('display', 'inline-block'); 3528 $('#button_transfer').css('display', 'none'); 3529 $.post(AJAXACTIONS_URL + '?action=domainManage', { 3530 'action': 'disableTransferProtection', 3531 'domain': domain 3532 }, function(response) { 3533 $('#changing').css('display', 'none'); 3534 $('#button_transfer').css('display', 'inline-block'); 3535 if (response.status == 0) { 3536 showPopupMessage(response.message); 3537 return false; 3538 } 3539 insideCloudPage('transferProtection', 'domainManage', '&show=transferProtection&domain=' + domain); 3540 } , 'json'); 3541 }); 3542} 3543 3544function domains_sendTransferCode (domain) { 3545 $('#code_sending').css('display', 'inline-block'); 3546 $('#button_code').css('display', 'none'); 3547 $.post(AJAXACTIONS_URL + '?action=domainManage', { 3548 'action': 'sendTransferCode', 3549 'domain': domain 3550 }, function(response) { 3551 $('#code_sending').css('display', 'none'); 3552 $('#button_code').css('display', 'inline'); 3553 showPopupMessage(response.message); 3554 }, 'json'); 3555} 3556 3557function domains_enablePrivacyProtection (domain) { 3558 $('#enable').css('display', 'inline'); 3559 $('#enable_button').css('display', 'none'); 3560 $.post(AJAXACTIONS_URL + '?action=domainManage', { 3561 'action': 'enablePrivacyProtection', 3562 'domain': domain 3563 }, function(response) { 3564 $('#enable').css('display', 'none'); 3565 $('#enable_button').css('display', 'inline'); 3566 if (response.status == 0) { 3567 showPopupMessage(response.message); 3568 return false; 3569 } 3570 insideCloudPage('privacyProtection', 'domainManage', '&show=privacyProtection&domain='+ domain); 3571 }, 'json'); 3572} 3573function domains_disablePrivacyProtection (domain) { 3574 $('#disable').css('display', 'inline-block'); 3575 $('#disable_button').css('display', 'none'); 3576 $.post(AJAXACTIONS_URL + '?action=domainManage', { 3577 'action': 'disablePrivacyProtection', 3578 'domain': domain 3579 }, function(response) { 3580 $('#disable').css('display', 'none'); 3581 $('#disable_button').css('display', 'inline'); 3582 insideCloudPage('privacyProtection', 'domainManage', '&show=privacyProtection&domain='+ domain); 3583 }, 'json'); 3584} 3585 3586function domains_deleteDNSZone (domain, zone_id) { 3587 $('#delete').css('display', 'inline'); 3588 $.post(AJAXACTIONS_URL + '?action=domainManage', { 3589 'action': 'dnsZoneDelete', 3590 'domain': domain, 3591 'zone_id': zone_id 3592 }, function(response) { 3593 insideCloudPage('dnsZone', 'domainManage', '&show=dnsZone&domain='+ domain); 3594 }, 'json'); 3595} 3596 3597var BLOCK_ADD_DNSSEC_BUTTON = false; 3598function domains_addDNSSECRecords (domain) { 3599 if (BLOCK_ADD_DNSSEC_BUTTON == true) { 3600 return false; 3601 } 3602 BLOCK_ADD_DNSSEC_BUTTON = true; 3603 blockButton('save_dnssec', 'loading_save_dnssec', 'block'); 3604 $.post(AJAXACTIONS_URL + '?action=domainManage', { 3605 'action': 'addDNSSECRecords', 3606 'domain': domain, 3607 'records': $('#dnssecRecords').val() 3608 }, function(response) { 3609 unBlockButton('save_dnssec', 'loading_save_dnssec', 'block'); 3610 BLOCK_ADD_DNSSEC_BUTTON = false; 3611 3612 showPopupMessage(response.message, function () { 3613 $('#popup-message .popup-content').removeClass('wb-ba') 3614 }); 3615 3616 if (response.status == 1) { 3617 insideCloudPage('dnssec', 'domainManage', '&show=dnssec&domain='+ domain); 3618 } 3619 }, 'json'); 3620} 3621 3622var BLOCK_DELETE_DNSSEC_BUTTON = false; 3623function domains_deleteDnssec (domain, record, i) { 3624 if (BLOCK_DELETE_DNSSEC_BUTTON == true) { 3625 return false; 3626 } 3627 BLOCK_DELETE_DNSSEC_BUTTON = true; 3628 blockButton('delete_dnssec_' + i, 'loading_delete_dnssec_' + i, 'inline'); 3629 var scroll = $(window).scrollTop(); 3630 $.post(AJAXACTIONS_URL + '?action=domainManage', { 3631 'action': 'deleteDNSSECRecord', 3632 'domain': domain, 3633 'record': record 3634 }, function(response) { 3635 unBlockButton('delete_dnssec_' + i, 'loading_delete_dnssec_' + i, 'inline'); 3636 BLOCK_DELETE_DNSSEC_BUTTON = false; 3637 showPopupMessage(response.message); 3638 if (response.status == 1) { 3639 insideCloudPage('dnssec', 'domainManage', '&show=dnssec&domain='+ domain, function () { 3640 $(window).scrollTop(scroll); 3641 }); 3642 } 3643 }, 'json'); 3644} 3645 3646function domains_restartTransfer(domain, max_ns, page, sortby) { 3647 $('.tipsy').remove(); 3648 var servers = {}; 3649 for (i = 1; i <= max_ns; i++) { 3650 servers[i] = $('#ns_' + i).val(); 3651 3652 } 3653 $.post(AJAXACTIONS_URL + '?action=domainManage', { 3654 'action': 'restartDomainTransfer', 3655 'domain': domain, 3656 'transferCode': $('#transferCode').val(), 3657 'form': $('#domainTransferAdditionalData').serialize(), 3658 'servers': servers, 3659 'submitForm': $('#submitForm').val(), 3660 'page': page, 3661 'sortby': sortby 3662 }, function(response) { 3663 showPopupMessage(response.message, function(){ 3664 $('.tipsy').remove(); 3665 }); 3666 if (response.status == 1) { 3667 insideCloudPage('dashboard-domains', 'main', '&show=domains' + sortby + '&page=' + page); 3668 } 3669 }, 'json'); 3670 return false;
3671} 3672 3673function domains_changeOwnership (domain, confirmText) { 3674 confirmText = confirmText.replace('*mail*', $('#transfer_to').val()); 3675 showConfirmation(confirmText, function () { 3676 var newOwner = encodeURIComponent($('#transfer_to').val()); 3677 var customerID = htmlspecialchars($('#customer_id').val()); 3678 3679 $.post(AJAXACTIONS_URL + '?action=domainManage', { 3680 'action': 'changeOwnership', 3681 'newOwner': newOwner, 3682 'domain': domain, 3683 'customerID' : customerID 3684 }, function(response) { 3685 if (response.status == 0) { 3686 if (typeof(response.message) != 'undefined') { 3687 showPopupMessage(response.message); 3688 } 3689 } else { 3690 window.location = '/main/domain-account-changed/' + domain + '/'; 3691 } 3692 }, 'json'); 3693 }); 3694} 3695 3696function domains_resendIrtpMails (domain, warning) { 3697 showConfirmation(warning, function () { 3698 $.post(AJAXACTIONS_URL + '?action=domainManage', { 3699 'action': 'resendIrtpMails', 3700 'domain': domain 3701 }, function(response) { 3702 showPopupMessage(response.message, function() { 3703 window.location = '/domainManage/domain/' + domain + '/page/contactDetails/'; 3704 }); 3705 }, 'json'); 3706 }); 3707} 3708 3709var blockRaaMail = false; 3710function domains_resendRaaMail (domain) { 3711 if (blockRaaMail == true) { 3712 return false; 3713 } 3714 blockRaaMail = true; 3715 blockButton('resend_raa_mail', 'resend_raa_mail_loading', 'inline-block'); 3716 $.post(AJAXACTIONS_URL + '?action=domainManage', { 3717 'action': 'resendRaaMail', 3718 'domain': domain 3719 }, function(response) { 3720 blockRaaMail = false; 3721 unBlockButton('resend_raa_mail', 'resend_raa_mail_loading', 'inline-block'); 3722 showPopupMessage(response.message); 3723 }, 'json'); 3724} 3725 3726function domains_enableGdpr (domain, warning) { 3727 showConfirmation(warning, function () { 3728 $.post(AJAXACTIONS_URL + '?action=domainManage', { 3729 'action': 'enableGdpr', 3730 'domain': domain 3731 }, function(response) { 3732 showPopupMessage(response.message); 3733 if (response.status == 1) { 3734 insideCloudPage('gdpr-toggle', 'domainManage', '&show=getGdprDetails&domain=' + domain); 3735 } 3736 }, 'json'); 3737 }); 3738} 3739 3740function domains_disableGdpr (domain, warning) { 3741 showConfirmation(warning, function () { 3742 $.post(AJAXACTIONS_URL + '?action=domainManage', { 3743 'action': 'disableGdpr', 3744 'domain': domain 3745 }, function(response) { 3746 showPopupMessage(response.message); 3747 if (response.status == 1) { 3748 insideCloudPage('gdpr-toggle', 'domainManage', '&show=getGdprDetails&domain=' + domain); 3749 } 3750 }, 'json'); 3751 }); 3752} 3753 3754/* ********************* */ 3755/* DOMAIN REGISTRATIONS */ 3756/* ********************* */ 3757function domain_showSingleRegistration () { 3758 $('.popup-content .overview').removeClass('bulk-domains'); 3759 if ($('#singleDomainRegistration').hasClass('active')) { 3760 return false; 3761 } 3762 3763 $('.single-domain-registration').addClass(" active"); 3764 $('.bulk-domain-registration').removeClass("active"); 3765 $('.bulk-domain-check').removeClass("focus"); 3766 $('.single-domain-check').addClass(" focus"); 3767 3768 fixPopupPosition('#cloudnspop'); 3769} 3770function domain_showBulkRegistration () { 3771 $('.popup-content .overview').addClass('bulk-domains'); 3772 3773 if ($('#bulkDomainRegistration').hasClass('active')) { 3774 return false; 3775 } 3776 3777 $('.bulk-domain-registration').addClass("active"); 3778 $('.single-domain-registration').removeClass("active"); 3779 $('.single-domain-check').removeClass("focus"); 3780 $('.bulk-domain-check').addClass("focus"); 3781 3782 if ($('#domainNames').val() == '') { 3783 $('#domainNames').val($('#singleDomainRegistrationName').val()); 3784 } 3785 3786 fixPopupPosition('#cloudnspop', true, true); 3787} 3788 3789function domain_singleCheck () { 3790 insideCloudPage('domainSingleRegistrationResult', 'domainRegister', {'show':'checkSingleDomain', 'name':$('#singleDomainRegistrationName').val(), 'tld':$('#singleDomainRegistrationTld').val()}); 3791 return false; 3792} 3793 3794function domain_singleCheckPromo () { 3795 insideCloudPage('domainSingleRegistrationResultPromo', 'domainRegister', {'show':'checkSingleDomainPromo', 'name':$('#singleDomainRegistrationName').val(), 'tld':$('#singleDomainRegistrationTld').val()}); 3796 return false; 3797} 3798 3799function domain_frRegistrantChange(formId) { 3800 var type = $('#'+ formId +' select.registrantType').val(); 3801 var country = $('#'+ formId +' select#country').val(); 3802 3803 $('#'+ formId +' .frFields').css('display', 'none'); 3804 $('#'+ formId +' .frFields.'+type).css('display', ''); 3805 3806 var vatRequired = $('#' + formId + ' span#vatRequired'); 3807 var sirenField = $('#' + formId +' .frFields.SIREN'); 3808 var vatField = $('#' + formId +' .frFields.VAT'); 3809 var dunsField = $('#' + formId +' .frFields.DUNS'); 3810 var dunsRequired = $('#' + formId + ' span#dunsRequired'); 3811 3812 const euCountries = ['BG', 'AT', 'BE', 'HR', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'MC', 'DE', 'HU', 'IE', 'IT', 'LV', 'LT', 'LU', 'MT', 'NL', 'PL', 'PT', 'RO', 'SK', '
3812SI', 'ES', 'SE', 'IM', 'GR']; 3813 3814 var vatRequired = $('#' + formId + ' span#vatRequired'); 3815 if (type == 'COMPANY') { 3816 sirenField.css('display', 'none'); 3817 vatField.css('display', 'none'); 3818 dunsField.css('display', 'none'); 3819 dunsRequired.css('display', 'none'); 3820 3821 if (country == 'FR') { 3822 sirenField.css('display', ''); 3823 vatField.css('display', ''); 3824 dunsField.css('display', ''); 3825 } else if (euCountries.includes(country)) { 3826 vatField.css('display', ''); 3827 dunsField.css('display', ''); 3828 } else { 3829 dunsField.css('display', ''); 3830 dunsRequired.css('display', ''); 3831 } 3832 } else { 3833 vatRequired.css('display', 'none'); 3834 dunsRequired.css('display', 'none'); 3835 } 3836} 3837 3838function domain_comauRegistrantChange(formId) { 3839 var type = $('#'+ formId +' select.registrantType').val(); 3840 $('#'+ formId +' .comauFields').css('display', 'none'); 3841 $('#'+ formId +' .comauFields.'+type).css('display', ''); 3842} 3843 3844function domain_auRegistrantChange(formId) { 3845 var type = $('#'+ formId +' select.registrantType').val(); 3846 $('#'+ formId +' .auFields.COMPANY').css('display', 'none'); 3847 3848 if (type == 'Company' || type == 'Sole Trader' || type == 'Trademark Owner' || type == 'Registered Business') { 3849 $('#'+ formId +' .auFields.COMPANY').css('display', ''); 3850 $('#registrantType').html(__('registrant_id_number')); 3851 } 3852} 3853 3854function domain_ruRegistrantChange(formId) { 3855 var type = $('#'+ formId +' select.registrantType').val(); 3856 $('#'+ formId +' .ruFields').css('display', 'none'); 3857 $('#'+ formId +' .ruFields.'+type).css('display', ''); 3858 if (type == 'ORG') { 3859 var country = $('#'+ formId +' select#country').val(); 3860 if (country == 'RU') { 3861 $('#'+ formId +' .ruFields.forRuCompany').css('display', ''); 3862 } 3863 } 3864} 3865 3866function domain_itRegistrantChange(formId) { 3867 var type = $('#'+ formId +' select.registrantType').val(); 3868 $('#'+ formId +' .itFields').css('display', 'none'); 3869 3870 if (type == 'ORG') { 3871 $('#'+ formId +' .itFields.COMPANY').css('display', ''); 3872 $('#registrantType').html(__('vat_number')); 3873 } else { 3874 $('#'+ formId +' .itFields.INDIVIDUAL').css('display', ''); 3875 $('#registrantType').html(__('personal_id_number')); 3876 } 3877} 3878 3879function domain_nycRegistrantChange(formId) { 3880 $('#'+ formId +' #city').prop('readonly', 'readonly'); 3881 $('#'+ formId +' #state').prop('readonly', 'readonly'); 3882} 3883 3884function domain_berlinRegistrantChange(formId) { 3885 $('#'+ formId +' #city').prop('readonly', 'readonly'); 3886} 3887 3888function domain_roRegistrantChange(formId) { 3889 $('#'+ formId +' .forRoCompany').css('display', 'none'); 3890 $('#'+ formId +' .forRo').css('display', 'none'); 3891 $('#'+ formId +' .roFields').css('display', 'none'); 3892 var country = $('#'+ formId +' select#country').val(); 3893 var type = $('#'+ formId +' select.registrantType').val(); 3894 if (country == 'RO') { 3895 $('#'+ formId +' .forRo').css('display', ''); 3896 if (type == 'c') { 3897 $('#'+ formId +' .forRoCompany').css('display', ''); 3898 } 3899 } 3900 if (type == 'c') { 3901 $('#'+ formId +' .roFields').css('display', ''); 3902 } 3903} 3904 3905function domain_cnRegistrantChange (formId) { 3906 $('#'+ formId +' .cnFields').css('display', ''); 3907} 3908 3909function domain_srlRegistrantChange (formId) { 3910 $('#'+ formId +' .srlFields').css('display', ''); 3911} 3912 3913function domain_plcukRegistrantChange(formId) { 3914 $('#' + formId + ' .plcukFields').css('display', ''); 3915} 3916 3917function domain_fiRegistrantChange(formId) { 3918 var type = $('#'+ formId +' select.registrantType').val(); 3919 var country = $('#'+ formId +' select#country').val(); 3920 function disableRegistrantTypeDatePicker() { 3921 var registrantTypeInput = document.getElementById('registrantTypeInput'); 3922 3923 if (registrantTypeInput) { 3924 registrantTypeInput.onclick = null; 3925 registrantTypeInput.onfocus = null; 3926 registrantTypeInput.removeAttribute('globalNumber'); 3927 3928 $(registrantTypeInput).removeClass('birthDatePicker');
3929 $(registrantTypeInput).parent().find('.JsDatePickBox').remove(); 3930 } 3931 } 3932 3933 if (type == 'ORG') { 3934 if (country == 'FI') { 3935 $('#registrantType').html(__('fi_company_number')); 3936 } else { 3937 $('#registrantType').html(__('company_registration_number')); 3938 } 3939 3940 $('#registrantTypeTooltip').css('display', 'none'); 3941 $('#registrantTypeInput').attr('placeholder', ''); 3942 disableRegistrantTypeDatePicker(); 3943 $('#'+ formId +' .fiFields').css('display', ''); 3944 } else { 3945 $('#'+ formId +' .fiFields').css('display', 'none'); 3946 if (country == 'FI') { 3947 $('#registrantTypeTooltip').css('display', 'none'); 3948 $('#registrantTypeInput').attr('placeholder', ''); 3949 $('#registrantType').html(__('hetu_number') + ':'); 3950 3951 disableRegistrantTypeDatePicker(); 3952 } else { 3953 $('#registrantType').html(__('birth_date') + ':'); 3954 $('#registrantTypeInput').attr('placeholder', 'YYYY-MM-DD'); 3955 $('#registrantTypeInput').addClass('birthDatePicker'); 3956 $('#registrantTypeTooltip').css('display', 'block'); 3957 3958 if (typeof window.initRegistrantTypeDatePicker == 'function') { 3959 window.initRegistrantTypeDatePicker(); 3960 } 3961 } 3962 } 3963} 3964 3965function domain_hkRegistrantChange(formId) { 3966 var type = $('#'+ formId +' select.registrantType').val(); 3967 $('#registrantType').html(__('personal_id_number') + ':'); 3968 $('#'+ formId +' .hkFields').css('display', 'none'); 3969 3970 if (type != 'IND' && type != '') { 3971 $('#'+ formId +' .hkFields').css('display', ''); 3972 $('#registrantType').html(__('company_registration_number')); 3973 } 3974} 3975 3976function domain_baRegistrantChange(formId) { 3977 $('#'+ formId +' input[name="contacts[company]"]').on('input', function() { 3978 if ($(this).val().trim() !== '') { 3979 $('#registrantType').html(__('company_registration_number') + ':'); 3980 } else { 3981 $('#registrantType').html(__('personal_id_number') + ':'); 3982 } 3983 }); 3984 3985 if ($('#'+ formId +' input[name="contacts[company]"]').val().trim() !== '') { 3986 $('#registrantType').html(__('company_registration_number') + ':'); 3987 } else { 3988 $('#registrantType').html(__('personal_id_number') + ':'); 3989 } 3990} 3991 3992function domain_kzRegistrantChange(formId) { 3993 $('#'+ formId +' input[name="contacts[company]"]').on('input', function() { 3994 if ($(this).val().trim() !== '') { 3995 $('#registrantType').html(__('company_registration_number') + ':'); 3996 } else { 3997 $('#registrantType').html(__('personal_id_number') + ':'); 3998 } 3999 }); 4000 4001 if ($('#'+ formId +' input[name="contacts[company]"]').val().trim() !== '') { 4002 $('#registrantType').html(__('company_registration_number') + ':'); 4003 } else { 4004 $('#registrantType').html(__('personal_id_number') + ':'); 4005 } 4006} 4007 4008function domain_cyRegistrantChange(formId) { 4009 var type = $('#'+ formId +' select.registrantType').val(); 4010 $('#registrantType').html(__('personal_id_number') + ':'); 4011 $('#'+ formId +' .hkFields').css('display', 'none'); 4012 4013 if (type === 'ORG') { 4014 $('#'+ formId +' .hkFields').css('display', ''); 4015 $('#'+ formId +' .indType').css('display', 'none'); 4016 $('#registrantType').html(__('company_registration_number')); 4017 } else { 4018 $('#'+ formId +' .indType').css('display', ''); 4019 } 4020} 4021 4022function domain_combrRegistrantChange(formId) { 4023 var type = $('#' + formId + ' select.registrantType').val(); 4024 $('#' + formId + ' .combrFields').css('display', 'none'); 4025 4026 if (type === 'org') { 4027 $('#' + formId + ' .combrFields').css('display', ''); 4028 } 4029} 4030 4031function domain_skRegistrantChange(formId) { 4032 var type = $('#' + formId + ' input[name="contacts[company]"]').val(); 4033 var label = $('label[for=""]'); 4034 4035 if (type.trim() !== '') { 4036 label.text(label.data('original-label') + ' *'); 4037 } else { 4038 label.text(label.data('original-label')); 4039 } 4040} 4041 4042function changeCodeType(formId) { 4043 var companyType = $('#' + formId + ' input[name="contacts[company]"]').val(); 4044 var companyLabel = $('label[for="company"]'); 4045 4046 var codeType = $('#' + formId + ' input[name="additional_data[code]"]').val(); 4047 var codeLabel = $('label[for=""]'); 4048 4049 if (companyType.trim() !== '' || codeType.trim() !== '') { 4050 companyLabel.text(companyLabel.data('original-label') + ' *'); 4051 codeLabel.text(codeLabel.data('original-label') + ' *'); 4052 } else { 4053 companyLabel.text(companyLabel.data('original-label')); 4054 codeLabel.text(codeLabel.data('original-label')); 4055 } 4056} 4057 4058function domain_nuRegistrantChange(formId) { 4059 var country = $('#'+ formId +' select#country').val(); 4060 var type = $('#'+ formId +' select.registrantType').val(); 4061 const euCountries = ['BG', 'AT', 'BE', 'HR', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'MC', 'DE', 'HU', 'IE', 'IT', 'LV', 'LT', 'LU', 'MT', 'NL', 'PL', 'PT', 'RO', 'SK', '
4061SI', 'ES', 'SE', 'IM', 'GR']; 4062 4063 if (type != 'IND') { 4064 $('#'+ formId +' .nuFields').css('display', ''); 4065 $('#registrantType').html(__('company_registration_number') + ':'); 4066 4067 if (euCountries.includes(country)) { 4068 $('#'+ formId +' .nuVatNumber').css('display', 'table-row'); 4069 } else { 4070 $('#'+ formId +' .nuVatNumber').css('display', 'none'); 4071 } 4072 } else { 4073 $('#'+ formId +' .nuVatNumber').css('display', 'none'); 4074 $('#'+ formId +' .nuFields').css('display', 'none'); 4075 $('#registrantType').html(__('personal_id_number') + ':'); 4076 } 4077} 4078 4079function domain_seRegistrantChange(formId) { 4080 var country = $('#'+ formId +' select#country').val(); 4081 const euCountries = ['BG', 'AT', 'BE', 'HR', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'MC', 'DE', 'HU', 'IE', 'IT', 'LV', 'LT', 'LU', 'MT', 'NL', 'PL', 'PT', 'RO', 'SK', 'SI', 'ES', 'SE', 'IM', 'GR']; 4082 var type = $('#'+ formId +' select.registrantType').val(); 4083 4084 if (type != 'IND') { 4085 $('#'+ formId +' .seFields').css('display', ''); 4086 $('#registrantType').html(__('company_registration_number') + ':'); 4087 4088 if (euCountries.includes(country)) { 4089 $('#'+ formId +' .seVatNumber').css('display', 'table-row'); 4090 } else { 4091 $('#'+ formId +' .seVatNumber').css('display', 'none'); 4092 } 4093 } else { 4094 $('#'+ formId +' .seVatNumber').css('display', 'none'); 4095 $('#'+ formId +' .seFields').css('display', 'none'); 4096 $('#registrantType').html(__('personal_id_number') + ':'); 4097 } 4098} 4099 4100function domain_hrRegistrantChange(formId) { 4101 var country = $('#'+ formId +' select#country').val(); 4102 $('#registrantType').html(__('vat_number') + ':'); 4103 $('#'+ formId +' .hr-eu-reg').css('display', 'table-row'); 4104 $('#'+ formId +' .hrFields').css('display', ''); 4105 4106 if (country == 'HR') { 4107 $('#registrantType').html(__('oib_number') + ':'); 4108 $('#'+ formId +' .hr-eu-reg').css('display', 'none'); 4109 $('#registrantTypeSelect').val(''); 4110 $('#'+ formId +' .hrFields').css('display', 'none'); 4111 } 4112} 4113 4114function domain_huRegistrantChange(formId) { 4115 var type = $('#'+ formId +' select.registrantType').val(); 4116 $('#'+ formId +' .huIdNumber').css('display', 'table-row'); 4117 $('#'+ formId +' .huVatNumber').css('display', 'none'); 4118 $('#'+ formId +' .huFields').css('display', 'none'); 4119 4120 if (type != 'IND' && type != '') { 4121 $('#'+ formId +' .huVatNumber').css('display', 'table-row'); 4122 $('#'+ formId +' .huIdNumber').css('display', 'none'); 4123 $('#'+ formId +' .huFields').css('display', ''); 4124 } 4125} 4126 4127function domain_mdRegistrantChange(formId) { 4128 var type = $('#'+ formId +' select.registrantType').val(); 4129 $('#'+ formId +' .mdIndividual').css('display', 'table-row'); 4130 $('#'+ formId +' .mdFields').css('display', 'none'); 4131 $('#'+ formId +' .LERM').css('display', 'none'); 4132 $('#'+ formId +' .LEREU').css('display', 'none'); 4133 var companyNumberLabel = $('#' + formId + ' .vatNumber .s-t'); 4134 if (type === 'IND') { 4135 $('#'+ formId +' .mdIndividual').css('display', 'table-row'); 4136 $('#'+ formId +' .mdFields').css('display', 'none'); 4137 $('#'+ formId +' .LERM').css('display', 'none'); 4138 $('#'+ formId +' .vatNumber').css('display', 'none'); 4139 $('#'+ formId +' .LEROC').css('display', 'none'); 4140 } else if (type === "LERM") { 4141 $('#'+ formId +' .mdIndividual').css('display', 'none'); 4142 $('#'+ formId +' .mdFields').css('display', ''); 4143 $('#'+ formId +' .LERM').css('display', ''); 4144 $('#'+ formId +' .vatNumber').css('display', 'none'); 4145 } else if (type === "LEREU") { 4146 $('#'+ formId +' .mdIndividual').css('display', 'none'); 4147 $('#'+ formId +' .mdFields').css('display', ''); 4148 $('#'+ formId +' .LERM').css('display', 'none'); 4149 $('#'+ formId +' .vatNumber').css('display', ''); 4150 companyNumberLabel.text('Vat Number:'); 4151 } else if (type === 'LEROC') { 4152 $('#'+ formId +' .mdIndividual').css('display', 'none'); 4153 $('#'+ formId +' .mdFields').css('display', ''); 4154 $('#'+ formId +' .LERM').css('display', 'none'); 4155 $('#'+ formId +' .vatNumber').css('display', ''); 4156 companyNumberLabel.text('Company Identification Number:'); 4157 } 4158} 4159 4160function domain_byRegistrantChange(formId) { 4161 var type = $('#'+ formId +' select.registrantType').val(); 4162 $('#'+ formId +' .byFields').css('display', 'none'); 4163 $('#'+ formId +' .byFields.'+type).css('display', ''); 4164 if (type == 'ORG') { 4165 var country = $('#'+ formId +' select#country').val(); 4166 if (country == 'BY') { 4167 $('#'+ formId +' .byFields.forByCompany').css('display', ''); 4168 } else { 4169 $('#'+ formId +' .byFields').css('display', 'none'); 4170 $('#'+ formId +' .byFields.'+type+'.COMPANY').css('display', ''); 4171 } 4172 } 4173} 4174function domain_trRegistrantChange(formId) { 4175 $('#'+ formId +' input[name="contacts[company]"]').on('input', function() { 4176 if ($(this).val().trim() !== '') { 4177 $('#registrantTypeId').html(__('company_registration_number')); 4178 } else { 4179 $('#registrantTypeId').html(__('registrant_id_number')); 4180 } 4181 }); 4182 4183 if ($('#'+ formId +' input[name="contacts[company]"]').val().trim() !== '') { 4184 $('#registrantTypeId').html(__('company_registration_number')); 4185 } else { 4186 $('#registrantTypeId').html(__('registrant_id_number')); 4187 } 4188} 4189 4190function domain_comtrRegistrantChange(formId) { 4191 var type = $('#'+ formId +' select.registrantType').val(); 4192 $('#'+ formId +' .trFields').css('display', 'none'); 4193 switch (type) { 4194 case '1': 4195 $('#registrantType').html(__('info_tr_tld_citizen')); 4196 $('#registrantTypeId').html(__('registrant_id_number')); 4197 $('#'+ formId +' .trFields.INDIVIDUAL').css('display', ''); 4198 break; 4199 case '2': 4200 $('#registrantType').html(__('info_tr_tld_company')); 4201 $('#registrantTypeId').html(__('company_registration_number')); 4202 $('#'+ formId +' .trFields.COMPANY').css('display', ''); 4203 break; 4204 case '3': 4205 $('#registrantType').html(__('info_tr_tld_trademark')); 4206 $('#'+ formId +' .trFields.TRADEMARK.TM').css('display', ''); 4207 break; 4208 case '4': 4209 $('#registrantType').html(__('info_tr_tld_foreign_company')); 4210 $('#registrantTypeId').html(__('company_registration_number')); 4211 $('#'+ formId +' .trFields.COMPANY').css('display', ''); 4212 $('#'+ formId +' .trFields.ORG').css('display', ''); 4213 break; 4214 default: 4215 } 4216} 4217 4218function domain_alRegistrantChange(formId) { 4219 var type = $('#'+ formId +' select.registrantType').val(); 4220 var type_id = $('#'+ formId +' select.registrantTypeId').val(); 4221 var country = $('#'+ formId +' select#country').val(); 4222 4223 $('#'+ formId +' .alFields').css('display', 'none'); 4224 4225 if (type == 'IND') { 4226 $('#'+ formId +' .alFields.idType').css('display', ''); 4227 if (type_id == 1) { 4228 $('#registrantTypeId').html(__('id_card_number') + ':'); 4229 } else { 4230 $('#registrantTypeId').html(__('passport_number') + ':'); 4231 } 4232 } else { 4233 $('#'+ formId +' .alFields.COMPANY').css('display', ''); 4234 if (country == 'AL') { 4235 $('#'+ formId +' .alFields.idType').css('display', ''); 4236 $('#'+ formId +' .alFields.VAT').css('display', ''); 4237 if (type_id == 1) { 4238 $('#registrantTypeId').html(__('id_card_number') + ':'); 4239 } else { 4240 $('#registrantTypeId').html(__('passport_number') + ':'); 4241 } 4242 } else { 4243 var euCountries = ['BG', 'AT', 'BE', 'HR', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'MC', 'DE', 'HU', 'IE', 'IT', 'LV', 'LT', 'LU', 'MT', 'NL', 'PL', 'PT', 'RO', 'SK', '
4243SI', 'ES', 'SE', 'IM', 'GR']; 4244 $('#'+ formId +' .alFields.companyRegNumber').css('display', ''); 4245 if (euCountries.includes(country)) { 4246 $('#'+ formId +' .alFields.VAT').css('display', ''); 4247 } else { 4248 $('#'+ formId +' .alFields.idType').css('display', ''); 4249 if (type_id == 1) { 4250 $('#registrantTypeId').html(__('id_card_number') + ':'); 4251 } else { 4252 $('#registrantTypeId').html(__('passport_number') + ':'); 4253 } 4254 } 4255 } 4256 } 4257} 4258 4259function domain_comalRegistrantChange(formId) { 4260 var type = $('#' + formId + ' select.registrantType').val(); 4261 var type_id = $('#' + formId + ' select.registrantTypeId').val(); 4262 4263 $('#' + formId + ' .alFields').css('display', 'none'); 4264 4265 $('#' + formId + ' .alFields.idType').css('display', ''); 4266 if (type_id == 1) { 4267 $('#registrantTypeId').html(__('id_card_number') + ':'); 4268 } else { 4269 $('#registrantTypeId').html(__('passport_number') + ':'); 4270 } 4271 4272 $('#' + formId + ' .alFields.COMPANY').css('display', ''); 4273 $('#' + formId + ' .alFields.VAT').css('display', ''); 4274} 4275 4276function domain_vnRegistrantChange(formId) { 4277 var type = $('#'+ formId +' select.registrantType').val(); 4278 4279 $('#'+ formId +' .vnFields').css('display', 'none'); 4280 4281 if (type == 'IND') { 4282 $('#'+ formId +' .vnFields.indType').css('display', ''); 4283 $('#registrantTypeId').html(__('id_card_number') + ':'); 4284 } else { 4285 $('#'+ formId +' .vnFields.COMPANY').css('display', ''); 4286 $('#registrantTypeId').html(__('company_registration_number') + ':'); 4287 } 4288} 4289 4290function domain_sgRegistrantChange(formId) { 4291 var type = $('#'+ formId +' select.registrantType').val(); 4292 $('#'+ formId +' .sgFields').css('display', 'none'); 4293 4294 if (type == 'IND') { 4295 $('#'+ formId +' .sgFields.INDIVIDUAL').css('display', ''); 4296 } else if (type == 'ORG') { 4297 $('#'+ formId +' .sgFields.COMPANY').css('display', ''); 4298 } else { 4299 $('#'+ formId +' .sgFields.COMPANY').css('display', ''); 4300 } 4301} 4302 4303function domain_rsRegistrantChange(formId) { 4304 var type = $('#'+ formId +' select.registrantType').val(); 4305 $('#'+ formId +' .rsFields').css('display', 'none'); 4306 4307 if (type == 'ORG') { 4308 $('#'+ formId +' .rsFields.COMPANY').css('display', ''); 4309 } 4310} 4311 4312function domain_mcRegistrantChange(formId) { 4313 var type = $('#'+ formId +' select.registrantType').val(); 4314 $('#'+ formId +' .mcFields').css('display', 'none'); 4315 4316 if (type == 'ORG') { 4317 $('#'+ formId +' .mcFields.COMPANY').css('display', ''); 4318 } else { 4319 $('#'+ formId +' .mcFields.INDIVIDUAL').css('display', ''); 4320 } 4321} 4322 4323function domain_bgRegistrantChange(formId) { 4324 $('#'+ formId +' .bgFields.COMPANY').css('display', ''); 4325} 4326 4327function domain_gwRegistrantChange(formId) { 4328 $('#'+ formId +' .gwFields.COMPANY').css('display', ''); 4329} 4330function domain_krRegistrantChange(formId) { 4331 var type = $('#'+ formId +' select.registrantType').val(); 4332 $('#'+ formId +' .krFields.COMPANY').css('display', 'none'); 4333 4334 if (type == 'ORG') { 4335 $('#'+ formId +' .krFields.COMPANY').css('display', ''); 4336 } 4337} 4338 4339function domain_swissRegistrantChange(formId) { 4340 $('#'+ formId +' .swissFields').css('display', ''); 4341} 4342 4343function domain_madridRegistrantChange(formId) { 4344 $('#'+ formId +' .madridFields').css('display', ''); 4345} 4346 4347function domain_eusRegistrantChange(formId) { 4348 $('#'+ formId +' .eusFields').css('display', ''); 4349} 4350 4351function domain_radioRegistrantChange(formId) { 4352 $('#'+ formId +' .radioFields').css('display', ''); 4353} 4354 4355function domain_gnRegistrantChange(formId) { 4356 $('#'+ formId +' .gnFields').css('display', ''); 4357} 4358 4359function domain_cozaRegistrantChange(formId) { 4360 $('#' + formId + ' .cozaFields').css('display', ''); 4361} 4362 4363function domain_djRegistrantChange(formId) { 4364 $('#'+ formId +' .djFields').css('display', ''); 4365} 4366 4367function domain_ltdukRegistrantChange(formId) { 4368 $('#'+ formId +' .ltdukFields').css('display', ''); 4369} 4370 4371function domain_dzRegistrantChange(formId) { 4372 $('#'+ formId +' .dzFields').css('display', ''); 4373} 4374 4375function domain_corsRegistrantChange(formId) { 4376 $('#'+ formId +' .corsFields').css('display', ''); 4377} 4378 4379function domain_comaRegistrantChange(formId) { 4380 var type = $('#' + formId + ' input[name="contacts[company]"]').val(); 4381 var label = $('label[for=""]'); 4382 4383 if (type.trim() !== '') { 4384 $('#'+ formId +' .comaFields').css('display', ''); 4385 } else { 4386 $('#' + formId + ' .comaFields').css('display', 'none'); 4387 } 4388} 4389 4390function domain_comMyRegistrantChange(formId) { 4391 $('#'+ formId +' .commyFields').css('display', ''); 4392} 4393 4394function domain_comTwRegistrantChange(formId) { 4395 $('#'+ formId +' .comtwFields').css('display', ''); 4396} 4397 4398function domain_coThRegistrantChange(formId) { 4399 $('#'+ formId +' .cothFields').css('display', ''); 4400} 4401 4402function domain_twRegistrantChange(formId) { 4403 var type = $('#'+ formId +' select.registrantType').val(); 4404 $('#registrantType').html(__('personal_id_number') + ':'); 4405 $('#'+ formId +' .twFields').css('display', 'none'); 4406 4407 if (type === 'IND') { 4408 $('#'+ formId +' .indType').css('display', ''); 4409 } else { 4410 $('#'+ formId +' .twFields').css('display', ''); 4411 $('#'+ formId +' .indType').css('display', 'none'); 4412 $('#registrantType').html(__('company_registration_number')); 4413 } 4414} 4415 4416function domain_axRegistrantChange(formId) { 4417 var type = $('#'+ formId +' select.registrantType').val(); 4418 4419 if (type === 'IND') { 4420 $('#'+ formId +' .indType').css('display', ''); 4421 $('#'+ formId +' .orgType').css('display', 'none'); 4422 $('#'+ formId +' .twFields').css('display', 'none'); 4423 } else { 4424 $('#'+ formId +' .twFields').css('display', ''); 4425 $('#'+ formId +' .indType').css('display', 'none'); 4426 $('#'+ formId +' .orgType').css('display', ''); 4427 } 4428} 4429
4430function domain_noRegistrantChange(formId) { 4431 var type = $('#'+ formId +' select.registrantType').val(); 4432 $('#'+ formId +' .noFields').css('display', 'none'); 4433 4434 if (type == 'IND') { 4435 $('#'+ formId +' .noFields.INDIVIDUAL').css('display', ''); 4436 } else if (type == 'ORG') { 4437 $('#'+ formId +' .noFields.COMPANY').css('display', ''); 4438 } else { 4439 $('#'+ formId +' .noFields.COMPANY').css('display', ''); 4440 } 4441} 4442 4443function domain_ieRegistrantChange(formId) { 4444 var type = $('#'+ formId +' select.registrantType').val(); 4445 var type_id = $('#'+ formId +' select.registrantTypeId').val(); 4446 4447 $('#'+ formId +' .ieFields').css('display', 'none'); 4448 4449 if (type == '2') { 4450 $('#'+ formId +' .orgType').css('display', 'none'); 4451 $('#'+ formId +' .COMPANY').css('display', 'none'); 4452 $('#'+ formId +' select.registrantTypeId').val(''); 4453 } else { 4454 $('#'+ formId +' .ieFields').css('display', ''); 4455 $('#'+ formId +' .orgType').css('display', ''); 4456 $('#'+ formId +' .COMPANY').css('display', ''); 4457 } 4458 4459 if (type_id === 'VAT') { 4460 $('#registrantType').html(__('vat_number')); 4461 } else { 4462 $('#registrantType').html(__('company_registration_number')); 4463 } 4464} 4465 4466function domain_dkRegistrantChange(formId) { 4467 var country = $('#'+ formId +' select#country').val(); 4468 var type = $('#' + formId + ' input[name="contacts[company]"]').val(); 4469 4470 const euCountries = ['BG', 'AT', 'BE', 'HR', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'MC', 'DE', 'HU', 'IE', 'IT', 'LV', 'LT', 'LU', 'MT', 'NL', 'PL', 'PT', 'RO', 'SK', 'SI', 'ES', '
4470SE', 'IM', 'GR']; 4471 4472 if(type.trim() === '') { 4473 $('#' + formId + ' .dkFields.VAT').css('display', 'none'); 4474 $('#' + formId + ' .dkFields.companyRegNumber').css('display', 'none'); 4475 }else{ 4476 if(euCountries.includes(country)) { 4477 $('#'+ formId +' .dkFields.VAT').css('display', ''); 4478 $('#'+ formId +' .dkFields.companyRegNumber').css('display', 'none'); 4479 }else{ 4480 $('#'+ formId +' .dkFields.companyRegNumber').css('display', ''); 4481 $('#'+ formId +' .dkFields.VAT').css('display', 'none'); 4482 } 4483 } 4484} 4485 4486function domain_lvRegistrantChange(formId) { 4487 var type = $('#' + formId + ' input[name="contacts[company]"]').val(); 4488 var country = $('#'+ formId +' select#country').val(); 4489 $('#'+ formId +' .lvFields').css('display', 'none'); 4490 4491 if (country == 'LV') { 4492 $('#'+ formId +' .lvFields').css('display', ''); 4493 if (type.trim() !== '') { 4494 $('#'+ formId +' .lvFields.COMPANY').css('display', ''); 4495 $('#registrantType').html(__('company_registration_number')); 4496 } else { 4497 $('#'+ formId +' .lvFields.COMPANY').css('display', 'none'); 4498 $('#registrantType').html(__('id_card_number')); 4499 } 4500 } 4501} 4502 4503var BLOCK_ADD_TO_CART = false; 4504function domain_addRegisrationToCart (name, tld, additionalParam, max_ns) { 4505 if (BLOCK_ADD_TO_CART == true) { 4506 return false; 4507 } 4508 blockButton('single_register_button', 'single_register_loading', 'inline-block'); 4509 BLOCK_ADD_TO_CART = true; 4510 $('.tipsy').remove(); 4511 var servers = {}; 4512 for (i = 1; i <= max_ns; i++) { 4513 servers[i] = $('#ns_' + i).val(); 4514 4515 } 4516 var path = ''; 4517 if (window.location.pathname == '/black-friday/') { 4518 path = window.location.pathname; 4519 } 4520 4521 $.post(AJAXACTIONS_URL + '?action=cart&nocache='+ (new Date).getTime(), { 4522 'type': 'addDomainRegistration', 4523 'name': name, 4524 'tld': tld, 4525 'period': $('#domainRegisterPeriod').val(), 4526 'form': $('#domainRegisterAdditionalData').serialize(), 4527 'jsCallback': 'domain_addRegisrationToCart', 4528 'servers': servers, 4529 'suggestion_name': DOMAIN_SUGGESTION_LAST_CLICK_NAME, 4530 'suggestion_tld': DOMAIN_SUGGESTION_LAST_CLICK_TLD, 4531 'path': path 4532 }, function (response) { 4533 unBlockButton('single_register_button', 'single_register_loading'); 4534 BLOCK_ADD_TO_CART = false; 4535 if (response.status) { 4536 $('#popup-message .popup-wraper').addClass('registrationAddedToCart'); 4537 4538 showPopupMessage(response.message, function () { 4539 $('#popup-message .popup-wraper').removeClass('registrationAddedToCart'); 4540 if (path == '/black-friday/') { 4541 hidePopup(); 4542 } 4543 }); 4544 $('#domainSingleRegistrationResult').css('display', 'none'); 4545 $('#singleDomainRegistrationName').val(''); 4546 updateCart(); 4547 } else { 4548 showPopupMessage(response.message, function () { 4549 $('.tipsy').remove(); 4550 }); 4551 fixPopupPosition('#popup-message', true, false, true); 4552 } 4553 }, 'json'); 4554 return false; 4555} 4556 4557function domain_addGoogleWorkspaceRegisrationToCart (name, tld, additionalParam, max_ns) { 4558 if (BLOCK_ADD_TO_CART == true) { 4559 return false; 4560 } 4561 blockButton('single_register_button', 'single_register_loading', 'inline-block'); 4562 BLOCK_ADD_TO_CART = true; 4563 $('.tipsy').remove(); 4564 var servers = {}; 4565 for (i = 1; i <= max_ns; i++) { 4566 servers[i] = $('#ns_' + i).val(); 4567 } 4568 $.post(AJAXACTIONS_URL + '?action=cart&nocache='+ (new Date).getTime(), { 4569 'type': 'addDomainRegistration', 4570 'name': name, 4571 'tld': tld, 4572 'period': $('#domainRegisterPeriod').val(), 4573 'form': $('#domainRegisterAdditionalData').serialize(), 4574 'jsCallback': 'domain_addGoogleWorkspaceRegisrationToCart', 4575 'servers': servers, 4576 'suggestion_name': DOMAIN_SUGGESTION_LAST_CLICK_NAME, 4577 'suggestion_tld': DOMAIN_SUGGESTION_LAST_CLICK_TLD 4578 }, function (response) { 4579 unBlockButton('single_register_button', 'single_register_loading'); 4580 BLOCK_ADD_TO_CART = false;
4581 if (response.status) { 4582 window.location.href = '/order/step/1/'; 4583 } else { 4584 showPopupMessage(response.message, function () { 4585 $('.tipsy').remove(); 4586 }); 4587 fixPopupPosition('#popup-message', true, false, true); 4588 } 4589 }, 'json'); 4590 return false; 4591} 4592 4593var BLOCK_ADD_BULK_TO_CART = false; 4594function domain_addBulkRegisrationToCart (name, tld, requestId, max_ns) { 4595 if (BLOCK_ADD_BULK_TO_CART == true) { 4596 return false; 4597 } 4598 blockButton('bulk_register_button' + requestId, 'bulk_register_loading' + requestId, 'inline-block'); 4599 BLOCK_ADD_BULK_TO_CART = true; 4600 $('.tipsy').remove(); 4601 var servers = {}; 4602 for (i = 1; i <= max_ns; i++) { 4603 servers[i] = $('#ns_' + i).val(); 4604 4605 } 4606 var period = $('#bulkDomainPeriod'+requestId).val(); 4607 $.post(AJAXACTIONS_URL + '?action=cart&nocache='+ (new Date).getTime(), { 4608 'type': 'addDomainRegistration', 4609 'name': name, 4610 'tld': tld, 4611 'period': period, 4612 'form': $('#domainRegisterAdditionalData').serialize(), 4613 'jsCallback': 'domain_addBulkRegisrationToCart', 4614 'jsAdditionalParam': requestId, 4615 'servers': servers, 4616 'suggestion_name': DOMAIN_SUGGESTION_LAST_CLICK_NAME, 4617 'suggestion_tld': DOMAIN_SUGGESTION_LAST_CLICK_TLD 4618 }, function (response) { 4619 unBlockButton('bulk_register_button' + requestId, 'bulk_register_loading' + requestId); 4620 BLOCK_ADD_BULK_TO_CART = false; 4621 showPopupMessage(response.message, function () { 4622 $('.tipsy').remove(); 4623 }); 4624 if (response.status) { 4625 $('#bulkDomainResult'+requestId+' td:nth-child(2)').html('<input type="button" onclick="window.location.href=\'/order/step/1/\';" class="button" value="'+response.continue_to_cart+' »" />'); 4626 setTimeout(function () { 4627 $('#bulk_register_button'+requestId).hide(); 4628 }, 1000); 4629 $('#bulkDomainPeriod'+requestId).hide(); 4630 $('#bulk_checkout_button'+requestId).css('display', 'inline'); 4631 } 4632 updateCart(); 4633 }, 'json'); 4634 return false; 4635} 4636var DOMAIN_BULK_CHECK_COUNT = 0; 4637var DOMAIN_BULK_CHECK_RESPONSE = 0; 4638var DOMAIN_BULK_CHECK_WAIT = 0; 4639function domain_bulkCheck() { 4640 $('#domainSearchResults ul').html(''); 4641 4642 var namesCheck = $('#domainNames').val().trim(); 4643 if (!namesCheck) { 4644 return showPopupMessage(__('bulk_domain_name_missing')); 4645 } 4646 var names = namesCheck.split("\n"); 4647 4648 $.each(names, function (index, name) { 4649 if (!name) { 4650 return; 4651 } 4652 $.each($('input[name=tld]'), function(index, element) { 4653 if ($(element).is(':checked') === true) { 4654 DOMAIN_BULK_CHECK_COUNT++; 4655 var tld = $(element).val(); 4656 $('#domainSearchResults').css('display', 'block'); 4657 $('#domainSearchResults ul').append('<li id="bulkDomainResult'+ DOMAIN_BULK_CHECK_COUNT +'"><span>'+ htmlspecialchars(name) +'.'+ tld +'</span><span><img src="/images/icons/status/updating.gif" /></span></li>'); 4658 fixPopupPosition('#cloudnspop', false); 4659 } 4660 }); 4661 }); 4662 4663 DOMAIN_BUCK_CHECK_WAIT = 0; 4664 $.each(names, function (index, name) { 4665 if (!name) { 4666 return; 4667 } 4668 $.each($('input[name=tld]'), function(index, element) { 4669 if ($(element).is(':checked') === true) { 4670 DOMAIN_BULK_CHECK_WAIT++; 4671 setTimeout(function() { 4672 DOMAIN_BULK_CHECK_RESPONSE++; 4673 var tld = $(element).val(); 4674 $.post(AJAXPAGES_URL +'?action=domainRegister&nocache='+ (new Date).getTime(), { 4675 'show': 'checkBulkDomain', 4676 'name': name, 4677 'tld': tld, 4678 'requestId': DOMAIN_BULK_CHECK_RESPONSE 4679 }, function (response) { 4680 $('#bulkDomainResult'+response.requestId).html(response.response); 4681 }, 'json'); 4682 }, DOMAIN_BULK_CHECK_WAIT*500); 4683 } 4684 }); 4685 }); 4686 4687} 4688 4689function domain_showRegister (name, tld) { 4690 $('#cloudnspop .popup-content').addClass('popup-content-tabs'); 4691 4692 var domainTld = ''; 4693 var domainName = ''; 4694 var path = ''; 4695 4696 if (typeof(name) != 'undefined') { 4697 domainName = '&name='+name; 4698 } 4699 if (typeof(tld) != 'undefined') { 4700 domainTld = '&tld='+tld; 4701 } 4702 if (window.location.pathname == '/black-friday/') { 4703 path = '&path='+window.location.pathname; 4704 } 4705 4706 showPopup('domainRegister', '&show=viewRegister' + domainTld + domainName + path, function() { 4707 $('#cloudnspop .popup-content').removeClass('popup-content-tabs'); 4708 }); 4709} 4710 4711function domain_showTransfer (name, tld, parent_id) { 4712 var domainTld = ''; 4713 var domainName = ''; 4714 var parent = ''; 4715 4716 if (typeof(name) != 'undefined') { 4717 domainName = '&domainName='+name; 4718 } 4719 if (typeof(tld) != 'undefined') { 4720 domainTld = '&tld='+tld; 4721 } 4722 if (typeof(parent_id) != 'undefined') { 4723 parent = '&parent_id=' + parent_id; 4724 } 4725 showPopup('domainTransfer', '&show=viewTransfer' + domainTld + domainName + parent); 4726} 4727function domain_showSuggestions (domain) { 4728 var menu = $('div.domainSuggestionsMenu'); 4729 if (menu.length === 0) { 4730 return false;
4731 } 4732 4733 $.post(AJAXPAGES_URL + '?action=domainRegister', { 4734 'show': 'getDomainSuggestions', 4735 'domain': domain, 4736 }, function (response) { 4737 menu.html(response); 4738 }); 4739 return false; 4740} 4741var DOMAIN_SUGGESTION_LAST_CLICK_NAME = ''; 4742var DOMAIN_SUGGESTION_LAST_CLICK_TLD = ''; 4743function domain_transferSuggestion (name, tld) { 4744 DOMAIN_SUGGESTION_LAST_CLICK_NAME = name; 4745 DOMAIN_SUGGESTION_LAST_CLICK_TLD = tld; 4746 domain_showTransfer(name, tld); 4747} 4748function domain_registerSuggestion (name, tld) { 4749 DOMAIN_SUGGESTION_LAST_CLICK_NAME = name; 4750 DOMAIN_SUGGESTION_LAST_CLICK_TLD = tld; 4751 domain_showRegister(name, tld); 4752} 4753 4754function domain_showPromoBundleRegister (name, tld) { 4755 $('#cloudnspop .popup-content').addClass('popup-content-tabs'); 4756 4757 var domainTld = ''; 4758 var domainName = ''; 4759 4760 if (typeof(name) != 'undefined') { 4761 domainName = '&name='+name; 4762 } 4763 if (typeof(tld) != 'undefined') { 4764 domainTld = '&tld='+tld; 4765 } 4766 showPopup('domainRegister', '&show=viewPromoBundleRegister' + domainTld + domainName, function() { 4767 $('#cloudnspop .popup-content').removeClass('popup-content-tabs'); 4768 }); 4769} 4770/* ********************* */ 4771/* DOMAIN TRANSFER */ 4772/* ********************* */ 4773function domainTransfer_updateInfo() { 4774 var tld = $('#domainTransferTld').select().val(); 4775 var tldEx = tld; 4776 if (tld) { 4777 var exploded = tld.split('.'); 4778 4779 if (exploded.length > 1) { 4780 tldEx = exploded[0] + '-' + exploded[1]; 4781 } 4782 } 4783 4784 $('.transferInfo').hide(); 4785 $('#transfer_code').hide(); 4786 $('#transfer_code_info').hide(); 4787 $('.transferInfo-' + tldEx).show(); 4788 4789 $.post(AJAXACTIONS_URL + '?action=domainTransfer', { 4790 'type': 'price', 4791 'tld': tld 4792 }, function(response) { 4793 $('#transfer-fee').html(response.transfer_fee); 4794 $('#renewal-price').html(response.renewal_price); 4795 $('#renewal-years').html(response.renewal_years); 4796 4797 if (tld == 'com.au' || tld == 'net.au' || tld == 'cx') { 4798 $('#dont-show').css('display', 'none'); 4799 } else { 4800 $('#dont-show').css('display', 'inline'); 4801 } 4802 }, 'json'); 4803 4804 4805} 4806 4807var blockTransferDomain = false; 4808function domainTransfer_addDomainTransfer(max_ns, parent_id) { 4809 if (blockTransferDomain == true) { 4810 return false; 4811 } 4812 4813 blockButton('domain_transfer_btn', 'domain_transfer_loading', 'block'); 4814 blockTransferDomain = true; 4815 4816 $('.tipsy').remove(); 4817 var servers = {}; 4818 for (i = 1; i <= max_ns; i++) { 4819 servers[i] = $('#ns_' + i).val(); 4820 4821 } 4822 $.post(AJAXACTIONS_URL + '?action=cart&nocache='+ (new Date).getTime(), { 4823 'type': 'addDomainTransfer', 4824 'name': $('#domainTransferName').val(), 4825 'tld': $('#domainTransferTld').select().val(), 4826 'transferCode': $('#domainTransferCode').val(), 4827 'form': $('#domainTransferAdditionalData').serialize(), 4828 'servers': servers, 4829 'suggestion_name': DOMAIN_SUGGESTION_LAST_CLICK_NAME, 4830 'suggestion_tld': DOMAIN_SUGGESTION_LAST_CLICK_TLD, 4831 'parent_id': parent_id 4832 }, function(response) { 4833 4834 unBlockButton('domain_transfer_btn', 'domain_transfer_loading', 'block'); 4835 blockTransferDomain = false; 4836 4837 if (!response.status) { 4838 showPopupMessage(response.message, function () { 4839 $('.tipsy').remove(); 4840 }); 4841 fixPopupPosition('#popup-message', true, false, true); 4842 } else { 4843 if (typeof parent_id !== 'undefined') { 4844 updateCart(); 4845 insideCloudPage('cart-products', 'cart', '&show=products-table'); 4846 insideCloudPage('cart-payment', 'cart', '&show=payment-page'); 4847 hidePopup(); 4848 hidePopupMessage(); 4849 } else { 4850 $('#popup-message .popup-wraper').addClass('transferAddedToCart'); 4851 showPopupMessage(response.message, function () { 4852 $('#popup-message .popup-wraper').removeClass('transferAddedToCart'); 4853 }); 4854 $('#domainTransferName').val(''); 4855 $('#domainTransferCode').val(''); 4856 updateCart(); 4857 } 4858 } 4859 }, 'json'); 4860 return false; 4861} 4862 4863function domainTransfer_addDomainTransferToUs(id) { 4864 4865 $.post(AJAXACTIONS_URL + '?action=cart', { 4866 'type': 'addDomainTransferToUs', 4867 'id': id, 4868 'transferCode': $('#transferCode').val(), 4869 }, function(response) { 4870 if (response.status) { 4871 updateCart(); 4872 } 4873 showPopupMessage(response.message); 4874 }, 'json'); 4875 return false;
4876} 4877 4878/* ********************* */ 4879/* DOMAIN RENEW */ 4880/* ********************* */ 4881function domainRenew_addToCart() { 4882 var domain = ''; 4883 var period = 0; 4884 var i = 0; 4885 var data = ''; 4886 4887 $.each($('select[name=domains]'), function(index, element) { 4888 id = $(element).attr('id'); 4889 domain = $('#name_' + id).val(); 4890 period = parseInt($(element).val()); 4891 key = $('#key_' + id).val(); 4892 4893 if (period > 0) { 4894 if (data != '') { 4895 data = data + ','; 4896 } 4897 4898 data = data + '"' + i + '":{"name":"' + domain + '", "period":"' + period + '", "key":"' + key + '", "type":"1"}'; 4899 i++; 4900 } 4901 }); 4902 4903 var domains = JSON.parse('{' + data + '}'); 4904 4905 $.post(AJAXACTIONS_URL + '?action=cart', { 4906 'type': 'addDomains', 4907 'domains': domains 4908 }, function(response) { 4909 if (!response.status) { 4910 showPopupMessage(response.message); 4911 } else { 4912 window.location.href = '/order/step/1/'; 4913 } 4914 }, 'json'); 4915} 4916 4917/* ********************* */ 4918/* PREMIUM */ 4919/* ********************* */ 4920var BLOCK_ADD_TO_CART = false; 4921function premium_addToCart(type_id, period) { 4922 if (BLOCK_ADD_TO_CART === true) { 4923 return false; 4924 } 4925 BLOCK_ADD_TO_CART = true; 4926 // select 4927 if (typeof period === 'undefined') { 4928 var period = $('#period_' + type_id).val(); 4929 } 4930 // radio button 4931 if (typeof period === 'undefined') { 4932 period = $('input[name=period_' + type_id + ']:checked').val(); 4933 } 4934 4935 $.post(AJAXACTIONS_URL + '?action=cart', { 4936 'type': 'addPremium', 4937 'type_id': type_id, 4938 'months': period 4939 }, function(response) { 4940 BLOCK_ADD_TO_CART = false; 4941 if (response.status == 0) { 4942 showPopupMessage(response.message); 4943 } else { 4944 window.location.href = '/order/step/1/'; 4945 } 4946 }, 'json'); 4947} 4948function showExtendedFeatures () { 4949 $('a.showExtendedFeatures').hide(); 4950 $('a.hideExtendedFeatures').show(); 4951 $('table.dnsPlansTable tr.extendedDnsFeatures').show(); 4952} 4953function hideExtendedFeatures () { 4954 $('a.hideExtendedFeatures').hide(); 4955 $('a.showExtendedFeatures').show(); 4956 $('table.dnsPlansTable tr.extendedDnsFeatures').hide(); 4957} 4958 4959function premium_upgradePlan (type_id, confirmText) { 4960 showConfirmation(confirmText, function () { 4961 $.post(AJAXACTIONS_URL + '?action=premium', { 4962 'type': 'upgrade', 4963 'type_id': type_id 4964 }, function(response) { 4965 showPopupMessage(response.message, 4966 function () { 4967 location.reload(); 4968 }); 4969 }, 'json'); 4970 }); 4971} 4972 4973var blockActivatePremiumTrial = false; 4974function activatePremiumTrial (action) { 4975 if (blockActivatePremiumTrial == true) { 4976 return false; 4977 } 4978 blockActivatePremiumTrial = true; 4979 blockButton(action + '-button', action + '-loading', 'block'); 4980 4981 $.post(AJAXACTIONS_URL + '?action=premium', { 4982 'type': 'activateTrial', 4983 'trialAction': action 4984 }, function(response) { 4985 unBlockButton(action + '-button', action + '-loading', 'block'); 4986 blockActivatePremiumTrial = false; 4987 if (!response.status) { 4988 showPopupMessage(response.message); 4989 } else { 4990 showPopupMessage(response.message, 4991 function () { 4992 location.reload(); 4993 }); 4994 } 4995 }, 'json'); 4996} 4997 4998function useVoucher () { 4999 $.post(AJAXACTIONS_URL + '?action=vouchers', { 5000 'action': 'useVoucher', 5001 'code': $('#voucherCode').val(), 5002 }, function(response) { 5003 if (response.status == 1) { 5004 userData(); 5005 } 5006 showPopupMessage(response.message); 5007 }, 'json'); 5008} 5009 5010/* ********************* */ 5011/* ZONE MANAGEMENT */ 5012/* ********************* */ 5013var ZONE_RECORDS_PAGE = 1; 5014var ZONE_RECORDS_ORDER_BY = null; 5015var ZONE_GET_RECORDS_CALLBACK = false; 5016function zone_getRecords(type, page, order, callback) { 5017 if (typeof(type) != 'undefined' && type != '') { 5018 window.recordsType = type; 5019 } 5020 if (typeof(page) != 'undefined' && page != '') { 5021 ZONE_RECORDS_PAGE = page; 5022 } 5023 if (typeof(order) != 'undefined' && order != '') { 5024 ZONE_RECORDS_ORDER_BY = order; 5025 } 5026 5027 if (typeof(callback) !== 'undefined') { 5028 ZONE_GET_RECORDS_CALLBACK = callback; 5029 } 5030 5031 $.each($('.recordsType'), function(index, element) { 5032 if ($(element).attr('id') == 'records-' + window.recordsType) { 5033 $(element).parent('li').addClass('active'); 5034 } else { 5035 $(element).parent('li').removeClass('active'); 5036 } 5037 }); 5038 5039 var host = ''; 5040 if (ZONE_RECORDS_HOSTNAME) { 5041 host = '&host=' + ZONE_RECORDS_HOSTNAME; 5042 } 5043 5044 var location = ''; 5045 if (ZONE_RECORDS_LOCATION) { 5046 location = '&location=' + ZONE_RECORDS_LOCATION; 5047 } 5048 5049 showSplashScreen(); 5050 5051 if (SEARCH_BY_POINTS_TO !== null) { 5052 RELOAD_WITH_SEARCH = true; 5053 } 5054 5055 $.post(AJAXPAGES_URL + '?action=records', "&show=get&zone=" + window.domain + "&type=" + window.recordsType + '&order-by=' + ZONE_RECORDS_ORDER_BY + '&page=' + ZONE_RECORDS_PAGE + host + location, function(data) { 5056 if (data === 'error') { 5057 window.location = '/'; 5058 return true; 5059 } 5060 5061 $('#records-table').html(data); 5062 5063 loadJs(function () { 5064 $(".showRecordTitle").tooltip({ 5065 track: true, 5066 delay: 0, 5067 showURL: false, 5068 showBody: "<body>", 5069 fade: 250 5070 }); 5071 }); 5072 5073 $('#records-table') 5074 .off('click', '.record-copy-value') 5075 .on('click', '.record-copy-value', function () {
5076 copyRecordValueToClipboard(this); 5077 }); 5078 5079 hideSplashScreen(); 5080 5081 if (SEARCH_BY_POINTS_TO !== null) { 5082 zone_searchByPointsTo(); 5083 } 5084 5085 if (ZONE_GET_RECORDS_CALLBACK) { 5086 ZONE_GET_RECORDS_CALLBACK(); 5087 ZONE_GET_RECORDS_CALLBACK = false; 5088 } 5089 }); 5090} 5091 5092var blockEditButton = false; 5093function zone_editRecord(zone, id, type) { 5094 if (blockEditButton == true) { 5095 return false; 5096 } 5097 blockEditButton = true; 5098 blockButton('editRecordButton', 'loading_edit_record', 'block'); 5099 5100 var settings = new Object; 5101 settings['additional_data'] = new Object; 5102 5103 settings['host'] = $('#editRecordHost').val(); 5104 settings['record'] = $('#editRecordRecord').val(); 5105 settings['ttl'] = $('#editRecordTtl').val(); 5106 5107 var geodns_location = $('#addRecordGeoDNSLocation').val(); 5108 if (geodns_location) { 5109 settings['additional_data']['geodns_location'] = geodns_location; 5110 } 5111 5112 if (type == 'SRV') { 5113 settings['additional_data']['priority'] = $('#editRecordPriority').val(); 5114 settings['additional_data']['weight'] = $('#editRecordWeight').val(); 5115 settings['additional_data']['port'] = $('#editRecordPort').val(); 5116 } else if (type == 'MX') { 5117 settings['additional_data']['priority'] = $('#editRecordPriority').val(); 5118 } else if (type == 'WR') { 5119 settings['additional_data']['frame'] = $('#editRecordWRFrame:checked').val(); 5120 settings['additional_data']['frame_title'] = $('#editRecordWRFrameTitle').val(); 5121 settings['additional_data']['frame_description'] = $('#editRecordWRFrameDescription').val(); 5122 settings['additional_data']['frame_keywords'] = $('#editRecordWRFrameKeywords').val(); 5123 settings['additional_data']['frame_favicon'] = $('#editRecordWRFrameFaviconUrl').val(); 5124 settings['additional_data']['savepath'] = $('#editRecordWRSavePath:checked').val(); 5125 settings['additional_data']['wrtype'] = $('.editWRType:checked').val(); 5126 settings['additional_data']['mobile_meta'] = $('#editRecordWRFrameMobileMeta:checked').val(); 5127 } else if (type == 'RP') { 5128 settings['additional_data']['mail'] = $('#editRecordMail').val(); 5129 settings['additional_data']['txt'] = $('#editRecordTxt').val(); 5130 } else if (type == 'SSHFP') { 5131 settings['additional_data']['algorithm'] = $('#editRecordAlgorithm').val(); 5132 settings['additional_data']['type'] = $('#editRecordFingerprintType').val();; 5133 } else if (type == 'NAPTR') { 5134 settings['additional_data']['order'] = $('#editRecordOrder').val(); 5135 settings['additional_data']['pref'] = $('#editRecordPref').val(); 5136 settings['additional_data']['flag'] = $('#editRecordFlag').val(); 5137 settings['additional_data']['params'] = $('#editRecordParams').val(); 5138 settings['additional_data']['regexp'] = $('#editRecordRegexp').val(); 5139 settings['additional_data']['replace'] = $('#editRecordReplace').val(); 5140 }else if (type == 'CAA') { 5141 settings['additional_data']['flag'] = $('#editRecordCAAflag').val(); 5142 settings['additional_data']['type'] = $('#editRecordCAAtype').val(); 5143 settings['additional_data']['value'] = $('#editRecordCAAvalue').val(); 5144 } else if (type == 'TLSA') { 5145 settings['additional_data']['usage'] = $('#editRecordUsage').val(); 5146 settings['additional_data']['selector'] = $('#editRecordSelector').val(); 5147 settings['additional_data']['matching_type'] = $('#editRecordMatchingType').val(); 5148 } else if (type == 'DS') { 5149 settings['additional_data']['key_tag'] = $('#editRecordKeyTag').val(); 5150 settings['additional_data']['algorithm'] = $('#editRecordDsAlgorithm').val(); 5151 settings['additional_data']['digest_type'] = $('#editRecordDigestType').val(); 5152 } else if (type == 'CERT') { 5153 settings['additional_data']['type'] = $('#editRecordCertType').val(); 5154 settings['additional_data']['key_tag'] = $('#editRecordCertKeyTag').val(); 5155 settings['additional_data']['algorithm'] = $('#editRecordCertAlgorithm').val(); 5156 } else if (type == 'HINFO') { 5157 settings['additional_data']['cpu'] = $('#editRecordCPU').val(); 5158 settings['additional_data']['os'] = $('#editRecordOS').val(); 5159 } else if (type == 'LOC') { 5160 settings['additional_data']['lat_deg'] = $('#editRecordLatDeg').val(); 5161 settings['additional_data']['lat_min'] = $('#editRecordLatMin').val(); 5162 settings['additional_data']['lat_sec'] = $('#editRecordLatSec').val(); 5163 settings['additional_data']['lat_dir'] = $('#editRecordLatDir').val(); 5164 settings['additional_data']['long_deg'] = $('#editRecordLongDeg').val();
5165 settings['additional_data']['long_min'] = $('#editRecordLongMin').val(); 5166 settings['additional_data']['long_sec'] = $('#editRecordLongSec').val(); 5167 settings['additional_data']['long_dir'] = $('#editRecordLongDir').val(); 5168 settings['additional_data']['altitude'] = $('#editRecordAltitude').val(); 5169 settings['additional_data']['size'] = $('#editRecordSize').val(); 5170 settings['additional_data']['h_precision'] = $('#editRecordHPrecision').val(); 5171 settings['additional_data']['v_precision'] = $('#editRecordVPrecision').val(); 5172 } else if (type == 'SMIMEA') { 5173 settings['additional_data']['usage'] = $('#editRecordSmimeaUsage').val(); 5174 settings['additional_data']['selector'] = $('#editRecordSmimeaSelector').val(); 5175 settings['additional_data']['matching_type'] = $('#editRecordSmimeaMatchingType').val(); 5176 } else if (type == 'HTTPS' || type == 'SVCB') { 5177 settings['additional_data']['priority'] = $('#editRecordHttpsSVCBPriority').val(); 5178 settings['additional_data']['parameters'] = $('#editRecordParameters').val(); 5179 } 5180 5181 5182 $.post(AJAXACTIONS_URL + '?action=records', { 5183 'show': 'editRecord', 5184 'zone': zone, 5185 'record_id': id, 5186 'settings': settings, 5187 'note': $('#editRecordNote').val() 5188 }, function(data) { 5189 $('.editRecordField').css('border-color', 'black'); 5190 5191 $.each($('.editRecordField'), function(index, element) { 5192 $(element).tipsy('hide'); 5193 }); 5194 5195 blockEditButton = false; 5196 unBlockButton('editRecordButton', 'loading_edit_record', 'block'); 5197 response = JSON.parse(data); 5198 if (typeof(response.action) != 'undefined') { 5199 eval(response.action); 5200 } else if (response.status == 0) { 5201 var popupErrors = []; 5202 $.each(response.errors, function(index, message) { 5203 var elementSelector = '#editRecord' + index.charAt(0).toUpperCase() + index.slice(1); 5204 var element = $(elementSelector); 5205 5206 if (!element.length) { 5207 if (typeof message === 'string' && message !== '') { 5208 popupErrors.push(message); 5209 } 5210 return true; 5211 } 5212 5213 if ($.inArray(elementSelector, ['#editRecordKeyTag', '#editRecordDsAlgorithm', '#editRecordDigestType', '#editRecordCPU', '#editRecordOS', '#editRecordLatDeg', '#editRecordLatMin', '#editRecordLatSec', '#editRecordLatDir', '#editRecordLongDeg', '#editRecordLongMin', '#editRecordLongSec', '#editRecordLongDir', '#editRecordAltitude', '#editRecordSize', '#editRecordHPrecision', '#editRecordVPrecision']) > -1) { 5214 var gravity = 'n'; 5215 } else { 5216 var gravity = 'w'; 5217 } 5218 element.addClass('error'); 5219 element.attr('title', message); 5220 element.tipsy({ 5221 gravity: gravity, 5222 trigger: 'manual', 5223 html: false 5224 }); 5225 element.tipsy('show'); 5226 $(window).resize(function(){ 5227 element.tipsy('show'); 5228 }); 5229 $(window).scroll(function(){ 5230 element.tipsy('show'); 5231 }); 5232 5233 addCloudPageCallBack(function () { 5234 $(elementSelector).tipsy('hide'); 5235 $(window).scroll(function(){ 5236 element.tipsy('hide'); 5237 }); 5238 $(window).resize(function(){ 5239 element.tipsy('hide'); 5240 }); 5241 }); 5242 }); 5243 if (popupErrors.length) { 5244 showPopupMessage(popupErrors.join('<br>')); 5245 } 5246 } else { 5247 zone_getRecords(); 5248 hidePopup(0); 5249 zone_checkIfUpdated(zone); 5250 } 5251 }); 5252 5253} 5254 5255function zone_copyExistingRecord(zone_id, record_id) { 5256 $.post(AJAXACTIONS_URL + '?action=records', { 5257 'show': 'copyRecord', 5258 'zone': zone_id, 5259 'record': record_id 5260 }, function(data) { 5261 response = JSON.parse(data); 5262 if (typeof(response.action) != 'undefined') { 5263 eval(response.action); 5264 } else if (response.status == 0) { 5265 showPopupMessage(response.message); 5266 } else { 5267 additionalData = response.additional_data; 5268 showPopup('records', '&show=addNew&zone=' + zone_id + '&defaultType=' + response.type, function(){}, function() { 5269 $('#addRecordHost').val(response.host); 5270 $('#addRecordRecord').val(response.record); 5271 $('#addRecordTtl').val(response.ttl); 5272 if (additionalData.geodns_location) { 5273 $('#addRecordGeoDNSLocation').val(additionalData.geodns_location); 5274 } 5275 if (response.type == 'SRV') { 5276 $('#addRecordSRVPriority').val(additionalData.priority); 5277 $('#addRecordWeight').val(additionalData.weight); 5278 $('#addRecordPort').val(additionalData.port); 5279 } else if (response.type == 'MX') { 5280 $('#addRecordPriority').val(additionalData.priority); 5281 } else if (response.type == 'WR') { 5282 if (additionalData.frame == '1') { 5283 $('#addRecordWRFrame').prop('checked', true); 5284 $('#WRFrameOptions').css('display', 'block'); 5285 $('#WRTypeOptions').css('display', 'none'); 5286 } 5287 $('#addRecordWRFrame:checked').val(additionalData.frame); 5288 $('#addRecordWRFrameTitle').val(additionalData.frame_title); 5289 $('#addRecordWRFrameDescription').val(additionalData.frame_description); 5290 $('#addRecordWRFrameKeywords').val(additionalData.frame_keywords); 5291 $('#addRecordWRFrameFaviconUrl').val(additionalData.frame_favicon); 5292 $('#addRecordWRSavePath:checked').val(additionalData.savepath); 5293 if (additionalData.savepath == '1') { 5294 $('#addRecordWRSavePath').prop('checked', true); 5295 } 5296 if(additionalData.wrtype == '301') {
5297 $('#addWRType301').prop('checked', true); 5298 } else if (additionalData.wrtype == '302') { 5299 $('#addWRType302').prop('checked', true); 5300 } 5301 $('#addRecordWRFrameMobileMeta:checked').val(additionalData.mobile_meta); 5302 if (additionalData.mobile_meta == '1') { 5303 $('#addRecordWRFrameMobileMeta').prop('checked', true); 5304 } 5305 } else if (response.type == 'RP') { 5306 $('#addRecordMail').val(additionalData.mail); 5307 $('#addRecordTxt').val(additionalData.txt); 5308 } else if (response.type == 'SSHFP') { 5309 $('#addRecordAlgorithm').val(additionalData.algorithm); 5310 $('#addRecordFingerprintType').val(additionalData.type); 5311 } else if (response.type == 'NAPTR') { 5312 $('#addRecordOrder').val(additionalData.order); 5313 $('#addRecordPref').val(additionalData.pref); 5314 $('#addRecordFlag').val(additionalData.flag); 5315 $('#addRecordParams').val(additionalData.params); 5316 $('#addRecordRegexp').val(additionalData.regexp); 5317 $('#addRecordReplace').val(additionalData.replace); 5318 } else if (response.type == 'CAA') { 5319 $('#addRecordCAAflag').val(additionalData.flag); 5320 $('#addRecordCAAtype').val(additionalData.type); 5321 $('#addRecordCAAvalue').val(additionalData.value); 5322 } else if (response.type == 'TLSA') { 5323 $('#addRecordUsage').val(additionalData.usage); 5324 $('#addRecordSelector').val(additionalData.selector); 5325 $('#addRecordMatchingType').val(additionalData.matching_type); 5326 } else if (response.type == 'DS') { 5327 $('#addRecordKeyTag').val(additionalData.key_tag); 5328 $('#addRecordDsAlgorithm').val(additionalData.algorithm); 5329 $('#addRecordDigestType').val(additionalData.digest_type); 5330 } else if (response.type == 'CERT') { 5331 $('#addRecordCertType').val(additionalData.type); 5332 $('#addRecordCertKeyTag').val(additionalData.key_tag); 5333 $('#addRecordCertAlgorithm').val(additionalData.algorithm); 5334 } else if (response.type == 'HINFO') { 5335 $('#addRecordCPU').val(additionalData.cpu); 5336 $('#addRecordOS').val(additionalData.os); 5337 } else if (response.type == 'LOC') { 5338 $('#addRecordLatDeg').val(additionalData.lat_deg); 5339 $('#addRecordLatMin').val(additionalData.lat_min); 5340 $('#addRecordLatSec').val(additionalData.lat_sec); 5341 $('#addRecordLatDir').val(additionalData.lat_dir); 5342 $('#addRecordLongDeg').val(additionalData.long_deg); 5343 $('#addRecordLongMin').val(additionalData.long_min); 5344 $('#addRecordLongSec').val(additionalData.long_sec); 5345 $('#addRecordLongDir').val(additionalData.long_dir); 5346 $('#addRecordAltitude').val(additionalData.altitude); 5347 $('#addRecordSize').val(additionalData.size); 5348 $('#addRecordHPrecision').val(additionalData.h_precision); 5349 $('#addRecordVPrecision').val(additionalData.v_precision); 5350 } else if (response.type == 'SMIMEA') { 5351 $('#addRecordSmimeaUsage').val(additionalData.usage); 5352 $('#addRecordSmimeaSelector').val(additionalData.selector); 5353 $('#addRecordSmimeaMatchingType').val(additionalData.matching_type); 5354 } else if (response.type == 'HTTPS' || response.type == 'SVCB') { 5355 $('#addRecordHttpsSVCBPriority').val(additionalData.priority); 5356 $('#addRecordParameters').val(additionalData.parameters); 5357 } 5358 }); 5359 } 5360 }); 5361} 5362 5363function zone_deleteRecord(zone, id, confirmText) { 5364 showConfirmation(confirmText, function () { 5365 $.post(AJAXACTIONS_URL + '?action=records', { 5366 'type': 'deleteRecord', 5367 'zone': zone, 5368 'record_id': id 5369 }, function(data) { 5370 response = JSON.parse(data); 5371 if (typeof(response.action) != 'undefined') { 5372 eval(response.action); 5373 } 5374 if (!response.status) { 5375 showPopupMessage(response.message); 5376 } 5377 userData(); 5378 zone_getRecords(); 5379 zone_checkIfUpdated(zone); 5380 refreshRecordsCount(zone); 5381 }); 5382 }); 5383} 5384 5385function zone_addRecord_selectType() { 5386 var type = $('#addRecordType').val(); 5387 5388 $.each($('.addRecordField'), function(index, element) { 5389 $(element).tipsy('hide'); 5390 $(window).scroll(function(){ 5391 $(element).tipsy('hide'); 5392 }); 5393 }); 5394 $('.addRecordField').removeClass('error'); 5395 5396 $('.type_fields').hide(); 5397 $('.' + type + '_fields').show(); 5398 5399 if (type == 'RP' || type == 'NAPTR' || type == 'CAA' || type == 'HINFO' || type == 'LOC') { 5400 $('.recordContainter').hide(); 5401 } else { 5402 $('.recordContainter').show(); 5403 } 5404 5405 if (type == 'OPENPGPKEY' || type == 'SMIMEA') { 5406 $('.recordContainter .records-label').hide(); 5407 } else { 5408 $('.recordContainter .records-label').show(); 5409 } 5410 5411 fixPopupPosition('#cloudnspop'); 5412} 5413 5414var blockAddButton = false;
5415 5416function zone_checkFreeSSLForWR(zone) { 5417 $.post(AJAXACTIONS_URL + '?action=records', { 5418 'show': 'checkFreeSSL', 5419 'zone': zone 5420 }, function(data) { 5421 var response = JSON.parse(data); 5422 5423 if (typeof(response.action) != 'undefined') { 5424 eval(response.action); 5425 return; 5426 } 5427 5428 if (response.status == 0) { 5429 showConfirmation(response.message, function () { 5430 window.location.href = '/freessl-settings/domain/' + zone + '/'; 5431 }); 5432 } 5433 }); 5434} 5435 5436function zone_addRecord(zone) { 5437 if (blockAddButton == true) { 5438 return false; 5439 } 5440 blockAddButton = true; 5441 blockButton('saveButton', 'loading_add_record', 'block'); 5442 5443 var settings = new Object; 5444 settings['additional_data'] = new Object; 5445 5446 var type = $('#addRecordType').val(); 5447 5448 settings['host'] = $('#addRecordHost').val(); 5449 settings['record'] = $('#addRecordRecord').val(); 5450 settings['ttl'] = $('#addRecordTtl').val(); 5451 5452 var geodns_location = $('#addRecordGeoDNSLocation').val(); 5453 if (geodns_location) { 5454 settings['additional_data']['geodns_location'] = geodns_location; 5455 } 5456 5457 if (type == 'SRV') { 5458 settings['additional_data']['priority'] = $('#addRecordSRVPriority').val(); 5459 settings['additional_data']['weight'] = $('#addRecordWeight').val(); 5460 settings['additional_data']['port'] = $('#addRecordPort').val(); 5461 } else if (type == 'MX') { 5462 settings['additional_data']['priority'] = $('#addRecordPriority').val(); 5463 } else if (type == 'WR') { 5464 settings['additional_data']['frame'] = $('#addRecordWRFrame:checked').val(); 5465 settings['additional_data']['frame_title'] = $('#addRecordWRFrameTitle').val(); 5466 settings['additional_data']['frame_description'] = $('#addRecordWRFrameDescription').val(); 5467 settings['additional_data']['frame_keywords'] = $('#addRecordWRFrameKeywords').val(); 5468 settings['additional_data']['frame_favicon'] = $('#addRecordWRFrameFaviconUrl').val(); 5469 settings['additional_data']['savepath'] = $('#addRecordWRSavePath:checked').val(); 5470 settings['additional_data']['wrtype'] = $('.addWRType:checked').val(); 5471 settings['additional_data']['mobile_meta'] = $('#addRecordWRFrameMobileMeta:checked').val(); 5472 } else if (type == 'RP') { 5473 settings['additional_data']['mail'] = $('#addRecordMail').val(); 5474 settings['additional_data']['txt'] = $('#addRecordTxt').val(); 5475 } else if (type == 'SSHFP') { 5476 settings['additional_data']['algorithm'] = $('#addRecordAlgorithm').val(); 5477 settings['additional_data']['type'] = $('#addRecordFingerprintType').val(); 5478 } else if (type == 'NAPTR') { 5479 settings['additional_data']['order'] = $('#addRecordOrder').val(); 5480 settings['additional_data']['pref'] = $('#addRecordPref').val(); 5481 settings['additional_data']['flag'] = $('#addRecordFlag').val(); 5482 settings['additional_data']['params'] = $('#addRecordParams').val(); 5483 settings['additional_data']['regexp'] = $('#addRecordRegexp').val(); 5484 settings['additional_data']['replace'] = $('#addRecordReplace').val(); 5485 } else if (type == 'CAA') { 5486 settings['additional_data']['flag'] = $('#addRecordCAAflag').val(); 5487 settings['additional_data']['type'] = $('#addRecordCAAtype').val(); 5488 settings['additional_data']['value'] = $('#addRecordCAAvalue').val(); 5489 } else if (type == 'TLSA') { 5490 settings['additional_data']['usage'] = $('#addRecordUsage').val(); 5491 settings['additional_data']['selector'] = $('#addRecordSelector').val(); 5492 settings['additional_data']['matching_type'] = $('#addRecordMatchingType').val(); 5493 } else if (type == 'DS') { 5494 settings['additional_data']['key_tag'] = $('#addRecordKeyTag').val(); 5495 settings['additional_data']['algorithm'] = $('#addRecordDsAlgorithm').val(); 5496 settings['additional_data']['digest_type'] = $('#addRecordDigestType').val(); 5497 } else if (type == 'CERT') { 5498 settings['additional_data']['type'] = $('#addRecordCertType').val(); 5499 settings['additional_data']['key_tag'] = $('#addRecordCertKeyTag').val(); 5500 settings['additional_data']['algorithm'] = $('#addRecordCertAlgorithm').val(); 5501 } else if (type == 'HINFO') { 5502 settings['additional_data']['cpu'] = $('#addRecordCPU').val(); 5503 settings['additional_data']['os'] = $('#addRecordOS').val(); 5504 } else if (type == 'LOC') { 5505 settings['additional_data']['lat_deg'] = $('#addRecordLatDeg').val();
5506 settings['additional_data']['lat_min'] = $('#addRecordLatMin').val(); 5507 settings['additional_data']['lat_sec'] = $('#addRecordLatSec').val(); 5508 settings['additional_data']['lat_dir'] = $('#addRecordLatDir').val(); 5509 settings['additional_data']['long_deg'] = $('#addRecordLongDeg').val(); 5510 settings['additional_data']['long_min'] = $('#addRecordLongMin').val(); 5511 settings['additional_data']['long_sec'] = $('#addRecordLongSec').val(); 5512 settings['additional_data']['long_dir'] = $('#addRecordLongDir').val(); 5513 settings['additional_data']['altitude'] = $('#addRecordAltitude').val(); 5514 settings['additional_data']['size'] = $('#addRecordSize').val(); 5515 settings['additional_data']['h_precision'] = $('#addRecordHPrecision').val(); 5516 settings['additional_data']['v_precision'] = $('#addRecordVPrecision').val(); 5517 } else if (type == 'SMIMEA') { 5518 settings['additional_data']['usage'] = $('#addRecordSmimeaUsage').val(); 5519 settings['additional_data']['selector'] = $('#addRecordSmimeaSelector').val(); 5520 settings['additional_data']['matching_type'] = $('#addRecordSmimeaMatchingType').val(); 5521 } else if (type == 'HTTPS' || type == 'SVCB') { 5522 settings['additional_data']['priority'] = $('#addRecordHttpsSVCBPriority').val(); 5523 settings['additional_data']['parameters'] = $('#addRecordParameters').val(); 5524 } 5525 5526 $.post(AJAXACTIONS_URL + '?action=records', { 5527 'show': 'addRecord', 5528 'zone': zone, 5529 'recordType': type, 5530 'active': $('#inactive').is(':checked') ? 0 : 1, 5531 'settings': settings, 5532 'note': $('#noteRecord').val() 5533 }, function(data) { 5534 $('.addRecordField').removeClass('error'); 5535 5536 $.each($('.addRecordField'), function(index, element) { 5537 $(element).tipsy('hide'); 5538 }); 5539 unBlockButton('saveButton', 'loading_add_record', 'block'); 5540 blockAddButton = false; 5541 response = JSON.parse(data); 5542 if (typeof(response.action) != 'undefined') { 5543 eval(response.action); 5544 } else if (response.status == 0) { 5545 $.each(response.errors, function(index, message) { 5546 if (index == 'message') { 5547 showPopupMessage(message); 5548 } else { 5549 5550 var elementSelector = '#addRecord' + index.charAt(0).toUpperCase() + index.slice(1); 5551 var element = $(elementSelector); 5552 5553 if ($.inArray(elementSelector, ['#addRecordKeyTag', '#addRecordDsAlgorithm', '#addRecordDigestType', '#addRecordCPU', '#addRecordOS', '#addRecordLatDeg', '#addRecordLatMin', '#addRecordLatSec', '#addRecordLatDir', '#addRecordLongDeg', '#addRecordLongMin', '#addRecordLongSec', '#addRecordLongDir', '#addRecordAltitude', '#addRecordSize', '#addRecordHPrecision', '#addRecordVPrecision']) > -1) { 5554 var gravity = 'n'; 5555 } else if (elementSelector == '#addRecordType') { 5556 var gravity = 's'; 5557 } else { 5558 var gravity = 'w'; 5559 } 5560 5561 element.addClass('error'); 5562 element.attr('title', message); 5563 element.tipsy({ 5564 gravity: gravity, 5565 trigger: 'manual', 5566 html: false 5567 }); 5568 element.tipsy('show'); 5569 $(window).resize(function(){ 5570 element.tipsy('show'); 5571 }); 5572 $(window).scroll(function(){ 5573 element.tipsy('show'); 5574 }); 5575 5576 addCloudPageCallBack(function () { 5577 $(elementSelector).tipsy('hide'); 5578 $(window).scroll(function(){ 5579 element.tipsy('hide'); 5580 }); 5581 $(window).resize(function(){ 5582 element.tipsy('hide'); 5583 }); 5584 }); 5585 } 5586 }); 5587 } else { 5588 zone_getRecords(); 5589 userData(); 5590 hidePopup(0); 5591 zone_checkIfUpdated(zone); 5592 refreshRecordsCount(zone); 5593 if (type == 'WR') { 5594 zone_checkFreeSSLForWR(zone); 5595 } 5596 } 5597 }); 5598} 5599 5600var blockCopyRecordsButton = false; 5601function copyRecordsFromDomain(zone) { 5602 5603 if (blockCopyRecordsButton == true) { 5604 return false; 5605 } 5606 5607 var display = 'inline'; 5608 5609 if ($('body').width() < 670) { 5610 display = 'block'; 5611 } 5612 5613 blockCopyRecordsButton = true; 5614 blockButton('copyRecordsFrom', 'loading_records_copy', display); 5615 5616 $.post(AJAXACTIONS_URL + '?action=records', { 5617 'show': 'copyRecordsFrom', 5618 'from_domain': $('#from_domain').val(), 5619 'zone': zone 5620 }, function(response) { 5621 unBlockButton('copyRecordsFrom', 'loading_records_copy', display); 5622 blockCopyRecordsButton = false;
5623 if (response.status == 0) { 5624 showPopupMessage(response.message); 5625 $('#copyRecordsFrom').css('display', 'inline'); 5626 $('#loading_records_copy').css('display', 'none'); 5627 } else { 5628 window.location = '/records/domain/' + zone + '/'; 5629 } 5630 }, 'json'); 5631 return false; 5632} 5633 5634function copyRecordsToDomain(zone) { 5635 5636 $('#copyRecordsButton').css('display', 'none'); 5637 $('#loading_own_records_copy').css('display', 'inline'); 5638 var record = {}; 5639 var toDomain = $('#to_domain').val(); 5640 $('#recordsBody input:checked').each(function() { 5641 record[$(this).val()] = $(this).val(); 5642 5643 }); 5644 5645 $.post(AJAXACTIONS_URL + '?action=records', { 5646 'show': 'copyRecordsTo', 5647 'to_domain': toDomain, 5648 'zone': zone, 5649 'record': record 5650 }, function(response) { 5651 5652 if (response.status == 0) { 5653 if (typeof response.action != 'undefined') { 5654 window.location = response.action; 5655 } else { 5656 showPopupMessage(response.message); 5657 $('#copyRecordsButton').css('display', 'inline'); 5658 $('#loading_own_records_copy').css('display', 'none'); 5659 } 5660 } else { 5661 window.location = '/records/domain/' + response.zone_id + '/'; 5662 } 5663 }, 'json'); 5664 return false; 5665} 5666 5667blockTTLButton = false; 5668function zone_BulkTTL(zone) { 5669 if (blockTTLButton == true) { 5670 return false; 5671 } 5672 blockTTLButton = true; 5673 blockButton('bulkTTLbutton', 'loading_bulkttl'); 5674 var type = $('#bulkRecordType').val(); 5675 var ttl = $('#bulkRecordTtl').val(); 5676 5677 $.post(AJAXACTIONS_URL + '?action=records', { 5678 'show': 'bulkTTLChange', 5679 'zone': zone, 5680 'recordType': type, 5681 'ttl': ttl 5682 }, function(data) { 5683 blockTTLButton = false; 5684 unBlockButton('bulkTTLbutton', 'loading_bulkttl'); 5685 response = JSON.parse(data); 5686 if (typeof(response.action) != 'undefined') { 5687 eval(response.action); 5688 } else if (response.status == 0) { 5689 if (typeof(response.message) != 'undefined') { 5690 showPopupMessage(response.message); 5691 } 5692 } else { 5693 zone_getRecords(); 5694 hidePopup(0); 5695 zone_checkIfUpdated(zone); 5696 } 5697 }); 5698} 5699 5700function zone_WRFrameToggie() { 5701 if ($('#addRecordWRFrame').prop('checked') || $('#editRecordWRFrame').prop('checked')) { 5702 $('#WRFrameOptions').show(); 5703 $('#WRTypeOptions').hide(); 5704 } else { 5705 $('#WRFrameOptions').hide(); 5706 $('#WRTypeOptions').show(); 5707 } 5708} 5709 5710function checkClearable() { 5711 $(".clearable").each(function() { 5712 var input = $(this).find("input:text"); 5713 var clear_btn = $(this).find(".icon-clear"); 5714 5715 if (input.val()) { 5716 clear_btn.toggle(true); 5717 } 5718 5719 }); 5720} 5721 5722function clearableText(element) { 5723 $(element).closest('.clearable').each(function() { 5724 var clear_btn = $(this).find(".icon-clear"); 5725 clear_btn.toggle(!!element.value); 5726 }); 5727} 5728 5729function clearText(e, element, callback) { 5730 $(element).closest('.clearable').each(function() { 5731 var input = $(this).find("input:text"); 5732 5733 e.preventDefault(); 5734 input.val("").trigger("input"); 5735 if (callback !== 'undefined') { 5736 callback(); 5737 } 5738 }); 5739} 5740 5741function zone_getMailForwards(zone, page) { 5742 $('#forwards-table').html('<div class="a-c"><div class="lds-roller"><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div></div></div>'); 5743 5744 $.post(AJAXPAGES_URL + '?action=mail-forwards', { 5745 'show': 'get', 5746 'zone': zone, 5747 'page': page 5748 }, function(data) { 5749 $('#forwards-table').html(data); 5750 }); 5751} 5752 5753var blockAddMailForward = false; 5754function zone_addMailForward(zone, page) { 5755 if (blockAddMailForward == true) { 5756 return false; 5757 } 5758 blockAddMailForward = true; 5759 blockButton('addMailForwardButton', 'addMailForward_loading', 'block'); 5760 5761 $.each($('.mailForwardsPopupContainer input.input-text'), function (index, element) { 5762 $(element).tipsy('hide'); 5763 $(element).css('border-color', 'black'); 5764 }); 5765 $.post(AJAXACTIONS_URL + '?action=mail-forwards', { 5766 'show': 'add', 5767 'zone': $('#mailForwardDomain').val(), 5768 'sourceBox': $('#mailForwardSourceBox').val(), 5769 'sourcePrefix': $('#mailForwardSourcePrefix').val(), 5770 'destination': $('#mailForwardDestination').val() 5771 }, function(data) { 5772 unBlockButton('addMailForwardButton', 'addMailForward_loading', 'block'); 5773 blockAddMailForward = false; 5774 response = JSON.parse(data); 5775 if (typeof(response.action) != 'undefined') { 5776 eval(response.action); 5777 } else if (response.status == 0) { 5778 if (typeof(response.message) != 'undefined') { 5779 showPopupMessage('<span class="wb-bw">' + response.message + '</span>'); 5780 } 5781 5782 $.each(response.errors, function(index, value) { 5783 if (index == 0) { 5784 return false;
5785 } 5786 value = htmlspecialchars(value); 5787 var elementSelector = '#mailForward' + index.charAt(0).toUpperCase() + index.slice(1); 5788 var element = $(elementSelector); 5789 if (element.length == 0) { 5790 showPopupMessage('<span class="wb-bw">' + value + '</span>'); 5791 } else { 5792 element.css('border-color', 'red'); 5793 element.attr('title', value); 5794 element.tipsy({ 5795 gravity: 'n', 5796 trigger: 'manual', 5797 html: false 5798 }); 5799 element.tipsy('show'); 5800 $(window).resize(function(){ 5801 element.tipsy('show'); 5802 }); 5803 5804 $(window).scroll(function(){ 5805 element.tipsy('show'); 5806 }); 5807 5808 addCloudPageCallBack(function () { 5809 $(elementSelector).tipsy('hide'); 5810 $(window).scroll(function(){ 5811 element.tipsy('hide'); 5812 }); 5813 }); 5814 } 5815 }); 5816 } else { 5817 zone_getMailForwards(zone, page); 5818 hidePopup(0); 5819 userData(); 5820 } 5821 }); 5822} 5823 5824function zone_deleteMailForward(zone, forward, warning, page) { 5825 showConfirmation(warning, function () { 5826 $.post(AJAXACTIONS_URL + '?action=mail-forwards', { 5827 'show': 'del', 5828 'forward': forward, 5829 'zone': zone, 5830 }, function(data) { 5831 response = JSON.parse(data); 5832 if (typeof(response.action) != 'undefined') { 5833 eval(response.action); 5834 } else if (response.status == 0) { 5835 if (typeof(response.message) != 'undefined') { 5836 showPopupMessage(response.message); 5837 } 5838 } else { 5839 zone_getMailForwards(zone, page); 5840 hidePopup(0); 5841 userData(); 5842 } 5843 }); 5844 }); 5845} 5846 5847var blockEditMailForward = false; 5848function zone_editMailForward(forward, page) { 5849 if (blockEditMailForward == true) { 5850 return false; 5851 } 5852 blockEditMailForward = true; 5853 blockButton('editMailForwardButton', 'editMailForward_loading', 'block'); 5854 5855 $.each($('.mailForwardsPopupContainer input.input-text'), function (index, element) { 5856 $(element).tipsy('hide'); 5857 $(element).css('border-color', 'black'); 5858 }); 5859 5860 $.post(AJAXACTIONS_URL + '?action=mail-forwards', { 5861 'show': 'edit', 5862 'forward': forward, 5863 'sourceBox': $('#mailForwardSourceBox').val(), 5864 'sourcePrefix': $('#mailForwardSourcePrefix').val(), 5865 'destination': $('#mailForwardDestination').val() 5866 }, function(data) { 5867 unBlockButton('editMailForwardButton', 'editMailForward_loading', 'block'); 5868 blockEditMailForward = false; 5869 response = JSON.parse(data); 5870 if (typeof(response.action) != 'undefined') { 5871 eval(response.action); 5872 } else if (response.status == 0) { 5873 $.each(response.errors, function(index, value) { 5874 value = htmlspecialchars(value); 5875 if (index == 'mail-forward-id' || index == 'destination' || index == 'sourceBox' || index == 'sourcePrefix' || index == 'limit' || index == 'mail') { 5876 showPopupMessage('<span class="wb-bw">' + value + '</span>'); 5877 return true; 5878 } 5879 5880 var elementSelector = '#mailForward' + index.charAt(0).toUpperCase() + index.slice(1); 5881 var element = $(elementSelector); 5882 element.css('border-color', 'red'); 5883 element.attr('title', value); 5884 element.tipsy({ 5885 gravity: 'n', 5886 trigger: 'manual', 5887 html: false 5888 }); 5889 element.tipsy('show'); 5890 $(window).resize(function(){ 5891 element.tipsy('show'); 5892 }); 5893 5894 addCloudPageCallBack(function () { 5895 $(elementSelector).tipsy('hide'); 5896 }); 5897 }); 5898 } else { 5899 zone_getMailForwards(response.showZone, page); 5900 hidePopup(0); 5901 userData(); 5902 } 5903 }); 5904} 5905 5906function zone_changeMfStatus (zone_id, mf_id, page, status) { 5907 $.post(AJAXACTIONS_URL + '?action=mail-forwards', { 5908 'show': 'change-status', 5909 'id': mf_id, 5910 'zone_id': zone_id, 5911 'status': status 5912 }, function(response) { 5913 unBlockButton('editMailForwardButton', 'editMailForward_loading', 'block'); 5914 blockEditMailForward = false; 5915 if (response.status == 1) { 5916 zone_getMailForwards(zone_id, page); 5917 } else { 5918 showPopupMessage(response.message); 5919 } 5920 }, 'json'); 5921} 5922 5923function zone_getAxfr(zone) { 5924 $('#axfrBody').html(''); 5925 $('#axfrBody').append('<tr><td colspan="2"><div class="lds-roller"><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div></div> </td></tr>'); 5926 5927 if ($('#axfrBody').css('display') == 'none') { 5928 if ($.browser.msie) { 5929 $('#axfrBody').show(); 5930 } else { 5931 $('#axfrBody').slideDown(); 5932 } 5933 } 5934 5935 $.post(AJAXPAGES_URL + '?action=axfr', "&show=get&zone=" + zone, function(data) { 5936 if (data == 'error') { 5937 window.location = '/'; 5938 return true; 5939 } 5940 5941 $('#axfrBody').html(data); 5942 $(".showAXFRTitle").tooltip({ 5943 track: true, 5944 delay: 0, 5945 showURL: false, 5946 showBody: "<body>", 5947 fade: 250 5948 }); 5949 fixPopupPosition('#cloudnspop'); 5950 }); 5951} 5952 5953function zone_addAxfr(zone) { 5954 $.post(AJAXACTIONS_URL + '?action=axfr', { 5955 'show': 'add', 5956 'zone': zone, 5957 'ip': $('#axfrIp').val(), 5958 'note': $('#axfrNote').val() 5959 }, function(response) { 5960 if (typeof(response.action) != 'undefined') { 5961 eval(response.action); 5962 } else if (response.status == 0) { 5963 if (typeof(response.message) != 'undefined') { 5964 showPopupMessage(response.message); 5965 } 5966 } else { 5967 $('#axfrIp').val(''); 5968 $('#axfrNote').val(''); 5969 zone_getAxfr(zone); 5970 zone_checkIfUpdated(zone); 5971 } 5972 }, 'json'); 5973} 5974 5975function zone_delAxfr(zone, record_id, warning) { 5976 showConfirmation(warning, function () { 5977 $.post(AJAXACTIONS_URL + '?action=axfr', { 5978 'show': 'del', 5979 'zone': zone, 5980 'record_id': record_id 5981 }, function(data) { 5982 response = JSON.parse(data); 5983 if (typeof(response.action) != 'undefined') { 5984 eval(response.action); 5985 } else if (response.status == 0) { 5986 if (typeof(response.message) != 'undefined') { 5987 showPopupMessage(response.message); 5988 } 5989 } else { 5990 zone_getAxfr(zone); 5991 } 5992 }); 5993 }); 5994} 5995 5996blockBulkAdding = false;
5997function zone_addBulk(cloud, page, group) { 5998 var pageParam = ''; 5999 if (typeof(page) != 'undefined') { 6000 pageParam = '&page=' + page; 6001 } 6002 6003 var groupParam = ''; 6004 if (typeof(page) != 'undefined') { 6005 groupParam = '&group_id=' + group; 6006 } 6007 6008 if (blockBulkAdding == true) { 6009 return false; 6010 } 6011 blockBulkAdding = true; 6012 blockButton('addBulkButton', 'addBulkLoading', 'block'); 6013 $.post(AJAXACTIONS_URL + '?action=cloud', { 6014 'type': 'add', 6015 'domain': $('#bulkDomains').val(), 6016 'cloud': cloud 6017 }, function(data) { 6018 blockBulkAdding = false; 6019 unBlockButton('addBulkButton', 'addBulkLoading', 'block'); 6020 response = JSON.parse(data); 6021 if (typeof(response.action) != 'undefined') { 6022 eval(response.action); 6023 } else if (response.status != 0) { 6024 $('#bulkName').val(''); 6025 } 6026 6027 if (typeof(response.message) != 'undefined') { 6028 zone_getCloud(cloud, page, group); 6029 userData(); 6030 showPopupMessage(response.message); 6031 insideCloudPage("dashboard-zones", "main", "&show=zones" + pageParam + groupParam); 6032 } 6033 }); 6034} 6035 6036function zone_delBulk(cloud, bulk, warning, page, group, source) { 6037 source = source || 'zones'; 6038 6039 showConfirmation(warning, function () { 6040 showSplashScreen(); 6041 var pageParam = ''; 6042 if (source == 'zones' && typeof(page) != 'undefined') { 6043 pageParam = '&page=' + page; 6044 } 6045 6046 var groupParam = ''; 6047 if (source == 'zones' && typeof(group) != 'undefined' && group !== '') { 6048 groupParam = '&group_id=' + group; 6049 } 6050 6051 var sharedPageParam = ''; 6052 if (source == 'shared' && typeof(page) != 'undefined') { 6053 sharedPageParam = '&page=' + page; 6054 } 6055 6056 $.post(AJAXACTIONS_URL + '?action=cloud', { 6057 'type': 'del', 6058 'domain': bulk 6059 }, function(data) { 6060 userData(); 6061 zone_getCloud(cloud, page, group); 6062 insideCloudPage("dashboard-zones", "main", "&show=zones" + pageParam + groupParam, function(){ 6063 hideSplashScreen(); 6064 }); 6065 if ($('#shared-zones-table-body').length) { 6066 insideCloudPage('shared-zones-table-body', 'main', '&show=shared-zones-body' + sharedPageParam); 6067 } 6068 6069 }); 6070 }); 6071} 6072 6073function zone_getCloud(cloud, page, group) { 6074 var pageParam = ''; 6075 if (typeof(page) != 'undefined') { 6076 pageParam = '&page=' + page; 6077 } 6078 6079 var groupParam = ''; 6080 if (typeof(group) != 'undefined' && group !== '') { 6081 groupParam = '&group_id=' + group; 6082 } 6083 6084 insideCloudPage('cloudDomainsContainer', 'cloud', '&show=get&zone=' + cloud + pageParam + groupParam, function() { 6085 $('#cloudDomainsContainer a').tooltip({showURL: false}); 6086 fixPopupPosition('#cloudnspop'); 6087 }); 6088 6089 6090} 6091 6092function zone_setBulkMaster(domain, warning) { 6093 showConfirmation(warning, function () { 6094 showSplashScreen(); 6095 $.post(AJAXACTIONS_URL + '?action=cloud', { 6096 'type': 'setMaster', 6097 'domain': domain 6098 }, function(data) { 6099 window.location = '/records/domain/' + domain + '/show/cloud/'; 6100 }); 6101 }); 6102} 6103 6104var blockZoneShare = false; 6105function zone_shareSettings (zone_name) { 6106 if (blockZoneShare == true) { 6107 return false; 6108 } 6109 blockZoneShare = true; 6110 blockButton('shareZoneButton', 'shareZone_loading', 'block'); 6111 6112 $.post(AJAXACTIONS_URL + '?action=records', { 6113 'show': 'shareSettings', 6114 'mail': $('#share_with').val(), 6115 'zone': zone_name 6116 }, function(data) { 6117 unBlockButton('shareZoneButton', 'shareZone_loading', 'block'); 6118 blockZoneShare = false; 6119 response = JSON.parse(data); 6120 if (response.status == 0) { 6121 if (typeof(response.message) != 'undefined') { 6122 showPopupMessage(response.message); 6123 } 6124 } else { 6125 insideCloudPage('shareSettingsContainer', 'records', '&show=shareSettings&zone=' + zone_name); 6126 } 6127 }); 6128} 6129 6130var blockDelegateSubuser = false;
6131function zone_delegateSubuser (zone_id) { 6132 if (blockDelegateSubuser == true) { 6133 return false; 6134 } 6135 blockDelegateSubuser = true; 6136 blockButton('delegateZoneButton', 'delegateZone_loading', 'block'); 6137 6138 var subuser_id = $('#jobApiSubuser').val(); 6139 $.post(AJAXACTIONS_URL + '?action=records', { 6140 'show': 'delegateToSubuser', 6141 'zone': zone_id, 6142 'auth-id': subuser_id 6143 }, function(response) { 6144 blockDelegateSubuser = false; 6145 unBlockButton('delegateZoneButton', 'delegateZone_loading', 'block'); 6146 6147 if (response.status == 1) { 6148 showPopupMessage(response.message); 6149 showPopup('records', '&show=shareSettings&zone=' + zone_id); 6150 } else { 6151 showPopupMessage(response.message); 6152 } 6153 }, 'json'); 6154 6155 return false; 6156} 6157 6158var blockDelegateMonitoring = false; 6159function monitoring_delegateSubuser (record_id) { 6160 if (blockDelegateMonitoring == true) { 6161 return false; 6162 } 6163 blockDelegateMonitoring = true; 6164 blockButton('delegateMonitoringButton', 'delegateMonitoring_loading', 'block'); 6165 6166 var subuser_id = $('#monitoringApiSubuser').val(); 6167 $.post(AJAXACTIONS_URL + '?action=monitoring-records', { 6168 'type': 'delegateMonitoringToSubuser', 6169 'record_id': record_id, 6170 'auth-id': subuser_id 6171 }, function(response) { 6172 blockDelegateMonitoring = false; 6173 unBlockButton('delegateMonitoringButton', 'delegateMonitoring_loading', 'block') 6174 6175 if (response.status == 1) { 6176 showPopupMessage(response.message); 6177 showPopup('monitoring-records', '&show=share-settings&record=' + record_id); 6178 } else { 6179 showPopupMessage(response.message); 6180 } 6181 }, 'json'); 6182 6183 return false; 6184} 6185 6186function monitoring_deleteMonitoringApiDelegation (auth_id, monitoring_id, warning) { 6187 showConfirmation(warning, function () { 6188 $.post(AJAXACTIONS_URL + '?action=api-settings', { 6189 'action': 'deleteMonitoringApiDelegation', 6190 'auth-id': auth_id, 6191 'monitoring-id': monitoring_id 6192 }, function(data) { 6193 response = JSON.parse(data); 6194 if (response.status == 0) { 6195 showPopupMessage(response.message); 6196 } else { 6197 insideCloudPage('shareSettingsContainer', 'monitoring-records', '&show=share-settings&record=' + monitoring_id); 6198 } 6199 }); 6200 }); 6201} 6202 6203function zone_deleteZoneShare(zone_name, user_mail, warning) { 6204 showConfirmation(warning, function () { 6205 $.post(AJAXACTIONS_URL + '?action=records', { 6206 'show': 'deleteZoneShare', 6207 'mail': user_mail, 6208 'zone': zone_name 6209 }, function(data) { 6210 response = JSON.parse(data); 6211 if (response.status == 0) { 6212 if (typeof(response.message) != 'undefined') { 6213 showPopupMessage(response.message); 6214 } 6215 } else { 6216 insideCloudPage('shareSettingsContainer', 'records', '&show=shareSettings&zone=' + zone_name); 6217 } 6218 }); 6219 }); 6220} 6221 6222function zone_deleteYourZoneShare(zone_name, warning, page) { 6223 showConfirmation(warning, function () { 6224 $.post(AJAXACTIONS_URL + '?action=records', { 6225 'show': 'deleteYourZoneShare', 6226 'zone': zone_name, 6227 'page': page 6228 }, function(response) { 6229 if (!response.status) { 6230 if (typeof(response.message) != 'undefined') { 6231 showPopupMessage(response.message); 6232 } else { 6233 window.location = '/'; 6234 } 6235 } else if ($('#dashboard-shared-zones').length) { 6236 insideCloudPage('dashboard-shared-zones', 'main', '&show=sharedZones&page=' + response.page); 6237 } else { 6238 window.location = '/'; 6239 } 6240 }, 'json'); 6241 }); 6242} 6243 6244function zone_deleteZoneApiDelegation (authid, zoneid, warning, page) { 6245 showConfirmation(warning, function () { 6246 $.post(AJAXACTIONS_URL + '?action=api-settings', { 6247 'action': 'deleteZoneDelegation', 6248 'auth-id': authid, 6249 'zone-id': zoneid 6250 }, function(data) { 6251 response = JSON.parse(data); 6252 if (response.status == 0) { 6253 showPopupMessage(response.message); 6254 } else { 6255 insideCloudPage('shareSettingsContainer', 'records', '&show=shareSettings&zone=' + zoneid); 6256 } 6257 }); 6258 }); 6259} 6260 6261var isZoneUpdated = false; 6262var isCheckTriggered = false; 6263function zone_updateZoneIcon (zone_id, callback) { 6264 $.post(AJAXACTIONS_URL + '?action=main', { 6265 'type': 'checkZoneUpdateStatus', 6266 'zone': zone_id, 6267 }, function(response) { 6268 if (typeof(response) == 'undefined') { 6269 return false; 6270 } 6271 6272 if (response.status == true) { 6273 $("#updateZoneButton").removeClass('progress progress-icon'); 6274 $("#updateZoneButton").addClass('icon-ok'); 6275 $("#updateZoneButton span").html(__('Updated')); 6276 callback(true); 6277 } else { 6278 $("#updateZoneButton").removeClass('icon-ok'); 6279 $("#updateZoneButton").addClass('progress progress-icon'); 6280 $("#updateZoneButton span").html(__('Updating')); 6281 callback(false); 6282 } 6283 }, 'json'); 6284} 6285 6286var timer; 6287function zone_checkIfUpdated(zone) { 6288 6289 zone_updateZoneIcon(zone, function (isZoneUpdated) { 6290 if (!isZoneUpdated) { 6291 clearTimeout(timer); 6292 6293 timer = setTimeout(function() { 6294 zone_checkIfUpdated(zone); 6295 }, 10000); 6296 } 6297 }); 6298} 6299 6300function refreshUpdateRow(server_id, zone_id, timeout) { 6301 $.post(AJAXACTIONS_URL + '?action=records', { 6302 'type': 'refreshUpdateRow', 6303 'zone': zone_id, 6304 'server': server_id 6305 }, function (response) { 6306 if (typeof(response) == 'undefined') { 6307 return false;
6308 } 6309 6310 if (response.status == 1) { 6311 $('#soaCheck' + server_id).html('<span class="icon icon-ok icon-darker"> </span>'); 6312 clearInterval(timeout); 6313 } else { 6314 $('#soaCheck' + server_id).html('<span class="progress"></span>'); 6315 } 6316 }, 'json'); 6317} 6318 6319function zone_addMasterServer (zone) { 6320 $.post(AJAXACTIONS_URL + '?action=slave', { 6321 'type': 'addMasterServer', 6322 'zone': zone, 6323 'mip': $('#masterIP').val() 6324 }, function(data) { 6325 response = JSON.parse(data); 6326 6327 if (response.status == 0) { 6328 6329 if (typeof(response.message) != 'undefined') { 6330 showPopupMessage(response.message); 6331 } else { 6332 var message = ''; 6333 $.each(response.errors, function(key, error) { 6334 message += error; 6335 }); 6336 showPopupMessage(message); 6337 } 6338 } else { 6339 $('#masterIP').val(""); 6340 zone_checkIfUpdated(zone); 6341 insideCloudPage("mipTable", "slave", "&show=showMips&zone_id=" + zone); 6342 } 6343 }); 6344} 6345 6346function zone_deleteMasterServer (zone, id, warning) { 6347 showConfirmation(warning, function () { 6348 $.post(AJAXACTIONS_URL + '?action=slave', { 6349 'type': 'deleteMasterServer', 6350 'zone': zone, 6351 'mip': id 6352 }, function(data) { 6353 response = JSON.parse(data); 6354 6355 if (response.status == 0) { 6356 showPopupMessage(response.message); 6357 } else { 6358 zone_checkIfUpdated(zone); 6359 insideCloudPage("mipTable", "slave", "&show=showMips&zone_id=" + zone); 6360 } 6361 }); 6362 }); 6363} 6364 6365function getMasterServerSuggestions(e) { 6366 const input = document.getElementById('slaveMasterIp'); 6367 const box = document.getElementById('masterIpSuggestions'); 6368 const value = input.value.trim(); 6369 6370 if (e.type === 'keyup' && value === '') { 6371 box.classList.add('hidden'); 6372 box.innerHTML = ''; 6373 return; 6374 } 6375 6376 $.post(AJAXACTIONS_URL + '?action=slave', { 6377 'type': 'getMasterServerSuggestions', 6378 'search': value 6379 }, function (response) { 6380 if (!Array.isArray(response) || response.length === 0) { 6381 box.classList.add('hidden'); 6382 box.innerHTML = ''; 6383 return; 6384 } 6385 6386 box.innerHTML = response.map(row => ` 6387 <div onclick="document.getElementById('slaveMasterIp').value='${row.server}'; document.getElementById('masterIpSuggestions').classList.add('hidden');"><div class="searchTitle">${row.server} used by ${row.cnt} zones</div></div>`).join(''); 6388 box.classList.remove('hidden'); 6389 }, 6390 'json' 6391 ); 6392} 6393 6394function zone_showImportTransferHostSearch() { 6395 $('.import-transfer-host-label').hide(); 6396 $('.search-by-import-transfer-host').css('display', 'inline-flex'); 6397 $('#importTransferHostInput').focus(); 6398} 6399 6400function zone_checkUncheckAllImportTransfer(controller) { 6401 var isChecked = $('#' + controller).prop('checked'); 6402 6403 $('#checkthemall, #checkallBottom').prop('checked', isChecked); 6404 6405 var rows = isChecked 6406 ? $('#exportedRecordsBody tr.import-transfer-record-row:not(.records-hide)') 6407 : $('#exportedRecordsBody tr.import-transfer-record-row'); 6408 6409 rows.each(function() { 6410 $(this).find('input[type="checkbox"]').prop('checked', isChecked); 6411 $(this).toggleClass('select', isChecked); 6412 }); 6413} 6414 6415function zone_filterImportTransferRecords() { 6416 var host = ($('#importTransferHostInput').val() || '').toLowerCase(); 6417 var hasFilter = host.length > 0; 6418 var visibleCount = 0; 6419 6420 $('#exportedRecordsBody tr.import-transfer-record-row').each(function() { 6421 var rowHost = $(this).find('.import-transfer-host').text().toLowerCase(); 6422 var isVisible = (!host || rowHost.indexOf(host) !== -1); 6423 6424 $(this).toggleClass('records-hide', !isVisible); 6425 6426 if (isVisible) { 6427 visibleCount++; 6428 } 6429 }); 6430 6431 var visibleRows = $('#exportedRecordsBody tr.import-transfer-record-row:not(.records-hide)'); 6432 var visibleChecked = visibleRows.find('input[type="checkbox"]:checked').length; 6433 6434 $('#checkthemall, #checkallBottom').prop('checked', visibleRows.length > 0 && visibleChecked === visibleRows.length); 6435 6436 $('#importTransferFilterWarning').toggleClass('records-hide', !hasFilter || visibleCount > 0); 6437 fixPopupPosition('#cloudnspop'); 6438} 6439 6440var records = []; 6441function zone_extractAXFR(zone_id, zone_name) { 6442 records = []; 6443 $('#importTransferFilterWarning').addClass('records-hide'); 6444 $('#importTransferHostInput').val('').trigger('input'); 6445 $('#loading_records').css('display', 'block'); 6446 $('#recordsTable').css('display', 'none'); 6447 $('#exportedRecordsBody').html(''); 6448 $.post(AJAXACTIONS_URL + '?action=records', { 6449 'show': 'extractAXFR', 6450 'server': $('#server').val(), 6451 'zone': zone_id 6452 }, function(data) { 6453 var response = JSON.parse(data); 6454 if (typeof response.action !== 'undefined') { 6455 eval(response.action); 6456 return false;
6457 } 6458 $('#loading_records').css('display', 'none'); 6459 if (typeof(response.message) == 'string') { 6460 showPopupMessage(response.message); 6461 } else { 6462 $('.importAXFRContainer .table-h-scroll').css('display', 'block'); 6463 $('#recordsTable').css('display', 'inline-table'); 6464 $('#recordsTableFoot').css('display', 'inline-table'); 6465 records = []; 6466 $('#exportedRecordsBody').html(''); 6467 6468 $.each(response.records, function(key, record) { 6469 // these are the records to be imported, this is a global var, used in zone_importExtractedRecords() 6470 records.push(record); 6471 var hostTitle = record['shortHost'] && record['shortHost']['title'] ? record['shortHost']['title'] : record['displayHost']; 6472 var recordTitle = record['shortRecord'] && record['shortRecord']['title'] ? record['shortRecord']['title'] : record['displayRecord']; 6473 6474 $('#exportedRecordsBody').append('<tr class="import-transfer-record-row"><td class="checkbox-cell a-l"><label class="s-t"><input id="check_' + key + '" type="checkbox" class="minus999em" name="record[' + key +']" value="' + key +'"><span class="checkbox"></span></label></td><td class="a-l overflowHidden"><div class="overflowHiddenContainer"><div class="overflowHiddenContent showImportTitle host-name import-transfer-host" title="' + htmlspecialchars(hostTitle) + '">' + htmlspecialchars(record['displayHost']) + '</div></div></td><td class="type-column a-l">' + record['type'] + '</td><td class="a-l overflowHidden"><div class="overflowHiddenContainer"><div class="overflowHiddenContent showImportTitle" title="' + htmlspecialchars(recordTitle) +'">' + htmlspecialchars(record['displayRecord']) +'</div></div></td><td class="a-l">' + record['ttl'] + '</td></tr>'); 6475 }); 6476 var unsupported = response.unsupported; 6477 if (unsupported.length != '') { 6478 showPopupMessage(__('cannot_add_unsupported_records') + ':<br><br><div class="wb-bw">' + htmlspecialchars(unsupported).replace(/\n/g, '<br>') + '</div>', undefined, function() { 6479 6480 fixPopupPosition('#popup-message'); 6481 setTimeout(function () { 6482 positionRelative('#popup-message', true); 6483 }, 1000); 6484 }); 6485 6486 } 6487 $(".showImportTitle").tooltip({ 6488 track: true, 6489 delay: 0, 6490 showURL: false, 6491 showBody: "<body>", 6492 fade: 250 6493 }); 6494 6495 fixPopupPosition('#cloudnspop'); 6496 checkWidth('table-h-scroll'); 6497 } 6498 }); 6499} 6500 6501function zone_importTransferDeletionConfirm (warning) { 6502 if ($('#deleteExisting').is(':checked')) { 6503 showConfirmation(warning, function(){}, function () { 6504 $('#deleteExisting').prop('checked', false); 6505 }); 6506 } 6507 return true; 6508} 6509 6510var importCalled = false; 6511function zone_importExtractedRecords (zone, warning) { 6512 if (importCalled == true) { 6513 // the function is called and we don't want to import the records every time the button is pushed 6514 return false; 6515 } 6516 6517 importCalled = true; 6518 blockButton('importRecordsBtn', 'loading', 'block'); 6519 6520 var chosenRecords = []; 6521 // the value is an int from 0 to count($record_we_get_from_dig_axfr) 6522 $('#exportedRecordsBody tr.import-transfer-record-row input:checked').each(function() { 6523 // pushing only the records with the checked values 6524 chosenRecords.push(records[$(this).val()]); 6525 }); 6526 6527 $.post(AJAXACTIONS_URL + '?action=records', { 6528 'show': 'importExtracted', 6529 'deleteExisting': $('#deleteExisting').is(':checked') ? 1 : 0, 6530 'zone': zone, 6531 'records': JSON.stringify(chosenRecords), 6532 }, function(response) { 6533 if (typeof(response.action) != 'undefined') { 6534 eval(response.action); 6535 } else if (typeof(response.message) == 'string') { 6536 showPopupMessage(response.message); 6537 } else { 6538 var errors = ''; 6539 var errorsCount = 0; 6540 $.each(response.message, function(key, error) { 6541 errors += error + '<br />'; 6542 errorsCount++; 6543 }); 6544 6545 showPopupMessage(errors); 6546 zone_getRecords(); 6547 zone_checkIfUpdated(zone); 6548 } 6549 unBlockButton('importRecordsBtn', 'loading', 'block'); 6550 importCalled = false; 6551 }, 'json'); 6552} 6553 6554function toggleRecordTypes() { 6555 $('#recordTypes label input').prop('disabled', false); 6556 $('#recordTypes').css('display', 'block'); 6557 if ($('#fileFormat').val() == 'tinydns') { 6558 $('#recordTypes label input').prop('disabled', 'disabled'); 6559 $('#recordTypes').css('display', 'none'); 6560 } 6561} 6562 6563function zone_deleteZone(warning, zone) { 6564 showConfirmation(warning, function () { 6565 showSplashScreen(); 6566 $.post(AJAXACTIONS_URL + '?action=main', { 6567 'type': 'deleteZone', 6568 'zone': zone 6569 }, function(data) { 6570 response = JSON.parse(data); 6571 hideSplashScreen(); 6572 if (!response.status) { 6573 showPopupMessage(response.message); 6574 } else { 6575 window.location = '/main/'; 6576 } 6577 }); 6578 }); 6579} 6580 6581function zone_changeOwnership (zone_name) { 6582 var newOwner = encodeURIComponent($('#transfer_to').val()); 6583 var customerID = htmlspecialchars($('#customer_id').val()); 6584 6585 $.post(AJAXACTIONS_URL + '?action=records', { 6586 'show': 'changeOwnership', 6587 'newOwner': newOwner, 6588 'confirm': $('#confirm').val(), 6589 'zone': zone_name, 6590 'customerID' : customerID 6591 }, function(data) { 6592 response = JSON.parse(data); 6593 6594 if (response.status == 2) { 6595 showPopup('records', '&show=confirmChangeOwnership&newOwner=' + newOwner + '&zone=' + zone_name + '&customerID=' + customerID); 6596 } else if (response.status == 0) { 6597 if (typeof(response.message) != 'undefined') { 6598 showPopupMessage(response.message); 6599 } 6600 } else { 6601 window.location = '/main/'; 6602 } 6603 }); 6604} 6605 6606function zone_parkedShowTemplate() { 6607 var template = $('#templates').select().val(); 6608 if (template == 0) { 6609 $('#showTemplate').html(''); 6610 } else { 6611 $('#showTemplate').html('<img src="/images/parked/parked-template-' + template + '.jpg" alt="" style="width: 100%; margin: 10px 0;" />'); 6612 } 6613} 6614 6615function zone_parkedSaveSettings(domain) { 6616 6617 $.post(AJAXACTIONS_URL + '?action=parked', { 6618 'action': 'settings', 6619 'template': $('#templates').select().val(), 6620 'title': $('#title').val(), 6621 'keywords': $('#keywords').val(), 6622 'description': $('#description').val(), 6623 'contact_form': $("input[type='radio'][name='contact_form']:checked").val(), 6624 'domain': domain 6625 }, function(response) { 6626 if (typeof(response.message) != 'undefined') { 6627 showPopupMessage(response.message); 6628 } 6629 }, 'json'); 6630 return false;
6631} 6632 6633function zone_changeSelectRecordsAction (zone) { 6634 var action = $('#action').val(); 6635 if (action == 'delete') { 6636 $('#deleteSelected').css('display', 'inline'); 6637 $('#copySelected').css('display', 'none'); 6638 $('#ttlChangeSelected').css('display', 'none'); 6639 $('#changeLocation').css('display', 'none'); 6640 $('#pauseSelected').css('display', 'none'); 6641 $('#activateSelected').css('display', 'none'); 6642 } else if (action == 'ttl') { 6643 $('#ttlChangeSelected').css('display', 'inline'); 6644 $('#deleteSelected').css('display', 'none'); 6645 $('#copySelected').css('display', 'none'); 6646 $('#changeLocation').css('display', 'none'); 6647 $('#pauseSelected').css('display', 'none'); 6648 $('#activateSelected').css('display', 'none'); 6649 } else if (action == 'location') { 6650 $('#ttlChangeSelected').css('display', 'none'); 6651 $('#deleteSelected').css('display', 'none'); 6652 $('#copySelected').css('display', 'none'); 6653 $('#changeLocation').css('display', 'inline'); 6654 $('#pauseSelected').css('display', 'none'); 6655 $('#activateSelected').css('display', 'none'); 6656 } else if (action == 'pause') { 6657 $('#pauseSelected').css('display', 'inline'); 6658 $('#copySelected').css('display', 'none'); 6659 $('#ttlChangeSelected').css('display', 'none'); 6660 $('#changeLocation').css('display', 'none'); 6661 $('#deleteSelected').css('display', 'none'); 6662 $('#activateSelected').css('display', 'none'); 6663 } else if (action == 'activate') { 6664 $('#activateSelected').css('display', 'inline'); 6665 $('#copySelected').css('display', 'none'); 6666 $('#ttlChangeSelected').css('display', 'none'); 6667 $('#changeLocation').css('display', 'none'); 6668 $('#deleteSelected').css('display', 'none'); 6669 $('#pauseSelected').css('display', 'none'); 6670 } else { 6671 $('#copySelected').css('display', 'inline'); 6672 $('#deleteSelected').css('display', 'none'); 6673 $('#ttlChangeSelected').css('display', 'none'); 6674 $('#changeLocation').css('display', 'none'); 6675 $('#pauseSelected').css('display', 'none'); 6676 $('#activateSelected').css('display', 'none'); 6677 if ($('#copySelected').is(':empty')) { 6678 $('#loading_records_copy').css('display', 'inline'); 6679 showZonesToCopyRecordsFrom(zone); 6680 } 6681 } 6682} 6683 6684function zone_changeZoneStatus(zone, warning) { 6685 if (typeof(warning) == 'undefined') { 6686 executeZoneStatusChange(zone); 6687 } else { 6688 showConfirmation(warning, function () { 6689 executeZoneStatusChange(zone); 6690 }) 6691 } 6692} 6693 6694function deleteSelectedRecords(zone, warning) { 6695 showConfirmation(warning, function() { 6696 6697 var record = {}; 6698 $('#recordsBody input:checked').each(function() { 6699 if ($(this).parents('.records.select')[0]) { 6700 record[$(this).val()] = $(this).val(); 6701 } 6702 }); 6703 6704 $('#deleteSelected').css('display', 'none'); 6705 $('#changeLocation').css('display', 'none'); 6706 $('#pauseSelected').css('display', 'none'); 6707 $('#activateSelected').css('display', 'none'); 6708 $('#loading_records_copy').css('display', 'inline'); 6709 6710 $.post(AJAXACTIONS_URL + '?action=records', { 6711 'type': 'deleteSelectedRecords', 6712 'zone': zone, 6713 'record': JSON.stringify(record) 6714 }, function(response) { 6715 if (response.status == 0) { 6716 $('#deleteSelected').css('display', 'inline'); 6717 $('#loading_records_copy').css('display', 'none'); 6718 showPopupMessage(response.message); 6719 } else { 6720 forcedTitleHide(); 6721 zone_getRecords(); 6722 userData(); 6723 if ($('#checkall').prop('checked')) { 6724 $('#checkall').prop('checked', false); 6725 } 6726 zone_checkIfUpdated(zone); 6727 refreshRecordsCount(zone); 6728 } 6729 }, 'json'); 6730 return false; 6731 }); 6732} 6733 6734function pauseSelectedRecords(zone, warning) { 6735 showConfirmation(warning, function() { 6736 6737 var record = {}; 6738 $('#recordsBody input:checked').each(function() { 6739 if ($(this).parents('.records.select')[0]) { 6740 record[$(this).val()] = $(this).val(); 6741 } 6742 }); 6743 6744 $('#deleteSelected').css('display', 'none'); 6745 $('#changeLocation').css('display', 'none'); 6746 $('#pauseSelected').css('display', 'none'); 6747 $('#activateSelected').css('display', 'none'); 6748 $('#loading_records_copy').css('display', 'inline'); 6749 6750 $.post(AJAXACTIONS_URL + '?action=records', { 6751 'type': 'pauseSelectedRecords', 6752 'zone': zone,
6753 'record': JSON.stringify(record) 6754 }, function(response) { 6755 if (response.status == 0) { 6756 $('#pauseSelected').css('display', 'inline'); 6757 $('#loading_records_copy').css('display', 'none'); 6758 showPopupMessage(response.message, function() { 6759 location.reload(); 6760 }); 6761 } else { 6762 forcedTitleHide(); 6763 zone_getRecords(); 6764 userData(); 6765 if ($('#checkall').prop('checked')) { 6766 $('#checkall').prop('checked', false); 6767 } 6768 zone_checkIfUpdated(zone); 6769 } 6770 }, 'json'); 6771 return false; 6772 }); 6773} 6774 6775function activateSelectedRecords(zone, warning) { 6776 showConfirmation(warning, function() { 6777 6778 var record = {}; 6779 $('#recordsBody input:checked').each(function() { 6780 if ($(this).parents('.records.select')[0]) { 6781 record[$(this).val()] = $(this).val(); 6782 } 6783 }); 6784 6785 $('#deleteSelected').css('display', 'none'); 6786 $('#changeLocation').css('display', 'none'); 6787 $('#pauseSelected').css('display', 'none'); 6788 $('#activateSelected').css('display', 'none'); 6789 $('#loading_records_copy').css('display', 'inline'); 6790 6791 $.post(AJAXACTIONS_URL + '?action=records', { 6792 'type': 'activateSelectedRecords', 6793 'zone': zone, 6794 'record': JSON.stringify(record) 6795 }, function(response) { 6796 if (response.status == 0) { 6797 $('#activateSelected').css('display', 'inline'); 6798 $('#loading_records_copy').css('display', 'none'); 6799 showPopupMessage(response.message, function () { 6800 location.reload(); 6801 }); 6802 } else { 6803 forcedTitleHide(); 6804 zone_getRecords(); 6805 userData(); 6806 if ($('#checkall').prop('checked')) { 6807 $('#checkall').prop('checked', false); 6808 } 6809 zone_checkIfUpdated(zone); 6810 } 6811 }, 'json'); 6812 return false; 6813 }); 6814} 6815 6816function changeTTLofSelectedRecords (zone) { 6817 var record = {}; 6818 $('#recordsBody input:checked').each(function() { 6819 record[$(this).val()] = $(this).val(); 6820 6821 }); 6822 6823 $('#ttlChangeSelected').css('display', 'none'); 6824 $('#changeLocation').css('display', 'none'); 6825 $('#loading_records_copy').css('display', 'inline'); 6826 6827 $.post(AJAXACTIONS_URL + '?action=records', { 6828 'type': 'changeTTLofSelectedRecords', 6829 'zone': zone, 6830 'ttl': $('#ttlValues').val(), 6831 'record': JSON.stringify(record) 6832 }, function(response) { 6833 if (response.status == 0) { 6834 $('#ttlChangeSelected').css('display', 'inline'); 6835 $('#loading_records_copy').css('display', 'none'); 6836 showPopupMessage(response.message); 6837 } else { 6838 forcedTitleHide(); 6839 zone_getRecords(); 6840 if ($('#checkall').prop('checked')) { 6841 $('#checkall').prop('checked', false); 6842 } 6843 zone_checkIfUpdated(zone); 6844 } 6845 }, 'json'); 6846 return false; 6847} 6848 6849function changeLocationOfSelectedRecords (zone) { 6850 var record = {}; 6851 $('#recordsBody input:checked').each(function() { 6852 record[$(this).val()] = $(this).val(); 6853 6854 }); 6855 6856 $('#ttlChangeSelected').css('display', 'none'); 6857 $('#deleteSelected').css('display', 'none'); 6858 $('#loading_records_copy').css('display', 'inline'); 6859 6860 $.post(AJAXACTIONS_URL + '?action=records', { 6861 'type': 'changeLocationOfSelectedRecords', 6862 'zone': zone, 6863 'location': $('#locationValues').val(), 6864 'record': JSON.stringify(record) 6865 }, function(response) { 6866 if (response.status == 0) { 6867 $('#changeLocation').css('display', 'inline'); 6868 $('#loading_records_copy').css('display', 'none'); 6869 showPopupMessage(response.message); 6870 } else { 6871 forcedTitleHide(); 6872 zone_getRecords(); 6873 if ($('#checkall').prop('checked')) { 6874 $('#checkall').prop('checked', false); 6875 } 6876 zone_checkIfUpdated(zone); 6877 } 6878 }, 'json'); 6879 return false; 6880} 6881 6882function showZonesToCopyRecordsFrom (zone) { 6883 6884 $.post(AJAXPAGES_URL + '?action=records', { 6885 'show': 'showZonesToCopyRecordsFrom', 6886 'zone': zone 6887 }, function(data) { 6888 $('#copySelected').html(data); 6889 $('#loading_records_copy').css('display', 'none'); 6890 }); 6891} 6892 6893function showImportPage(action, ajaxData) { 6894 $('#cloudnspop').addClass('popup-import-chooser'); 6895 $('#cloudnspop .popup-wraper').css({ 6896 'width': '', 6897 'max-width': '', 6898 'min-width': '' 6899 }); 6900 6901 showPopup(action, ajaxData, function() { 6902 $('#cloudnspop').removeClass('popup-import-chooser'); 6903 $('#cloudnspop .popup-wraper').css({ 6904 'width': '', 6905 'max-width': '', 6906 'min-width': '' 6907 }); 6908 }); 6909} 6910 6911function showImportTransferPage(action, ajaxData) { 6912 $('#cloudnspop').removeClass('popup-import-chooser'); 6913 $('#cloudnspop').addClass('popup-import-transfer'); 6914 $('#cloudnspop .popup-wraper').css({ 6915 'width': '', 6916 'max-width': '', 6917 'min-width': '' 6918 }); 6919 6920 showPopup(action, ajaxData, function() { 6921 $('#cloudnspop').removeClass('popup-import-transfer'); 6922 $('#cloudnspop .popup-wraper').css({ 6923 'width': '', 6924 'max-width': '', 6925 'min-width': '' 6926 }); 6927 }, function() { 6928 fixPopupPosition('#cloudnspop'); 6929 }); 6930} 6931 6932 6933function showSOAPage(action, ajaxData) { 6934 $('#popup-content').css('min-height', '42px'); 6935 showPopup(action, ajaxData, function() { 6936 $('#popup-content').css('min-height', '300px'); 6937 }); 6938} 6939function zone_activateRecord(record_id, domain_id) { 6940 6941 $.post(AJAXACTIONS_URL + '?action=records', { 6942 'show': 'changeRecordStatus', 6943 'status': '1', 6944 'record_id': record_id, 6945 'zone': domain_id 6946 }, function(response) { 6947 if (response.status == 0) { 6948 if (typeof(response.message) != 'undefined') { 6949 showPopupMessage(response.message); 6950 } else { 6951 var show = ''; 6952 6953 $.each(response.errors, function(key, error) { 6954 $.each(error, function(type, message) { 6955 if (type != 'colliding') { 6956 show += message + '<br />'; 6957 } 6958 }); 6959 }); 6960 showPopupMessage(show); 6961 } 6962 } else { 6963 zone_getRecords(); 6964 zone_checkIfUpdated(domain_id); 6965 } 6966 }, 'json'); 6967 return false;
6968 6969} 6970function zone_deactivateRecord(record_id, domain_id, warning) { 6971 showConfirmation(warning, function () { 6972 $.post(AJAXACTIONS_URL + '?action=records', { 6973 'show': 'changeRecordStatus', 6974 'status': '0', 6975 'record_id': record_id, 6976 'zone': domain_id 6977 }, function(response) { 6978 if (response.status == 0) { 6979 if (typeof(response.message) != 'undefined') { 6980 showPopupMessage(response.message); 6981 } else { 6982 var show = ''; 6983 6984 $.each(response.errors, function(key, error) { 6985 $.each(error, function(type, message) { 6986 show += message + '<br />'; 6987 }); 6988 }); 6989 showPopupMessage(show); 6990 } 6991 } else { 6992 zone_getRecords(); 6993 zone_checkIfUpdated(domain_id); 6994 } 6995 }, 'json'); 6996 return false; 6997 }); 6998} 6999 7000var activating = false; 7001function activate_dynamicURL(domain_id, record_id) { 7002 if (activating == true) { 7003 return false; 7004 } 7005 activating = true; 7006 blockButton('activateDynURL', 'activatingDynURL', 'block'); 7007 $.post(AJAXACTIONS_URL + '?action=records', { 7008 'show': 'activateDynamicUrl', 7009 'record_id': record_id, 7010 'zone': domain_id 7011 }, function(response) { 7012 unBlockButton('activateDynURL', 'activatingDynURL'); 7013 if (response.status == 0) { 7014 hidePopup(); 7015 showPopupMessage(response.message); 7016 zone_getRecords(); 7017 } else { 7018 hideCloudPage(); 7019 zone_getRecords(); 7020 show_dynamicURL(domain_id, record_id); 7021 userData(); 7022 } 7023 }, 'json'); 7024 activating = false; 7025 return false; 7026} 7027 7028function deactivate_dynamicURL(domain_id, record_id, confirmText) { 7029 showConfirmation(confirmText, function () { 7030 $('#editDynURL').css('display', 'inline-block'); 7031 $.post(AJAXACTIONS_URL + '?action=records', { 7032 'show': 'deactivateDynamicUrl', 7033 'record_id': record_id, 7034 'zone': domain_id 7035 }, function(response) { 7036 if (response.status == 0) { 7037 hidePopup(); 7038 showPopupMessage(response.message); 7039 zone_getRecords(); 7040 } else { 7041 hidePopup(); 7042 zone_getRecords(); 7043 show_dynamicURL(domain_id, record_id); 7044 userData(); 7045 } 7046 }, 'json'); 7047 return false; 7048 }); 7049} 7050 7051var changing = false; 7052function change_dynamicURL(domain_id, record_id, confirmText) { 7053 if (changing == true) { 7054 return false; 7055 } 7056 changing = true; 7057 7058 showConfirmation(confirmText, function () { 7059 $('#editDynURL').css('display', 'inline-block'); 7060 $.post(AJAXACTIONS_URL + '?action=records', { 7061 'show': 'changeDynamicUrl', 7062 'record_id': record_id, 7063 'zone': domain_id 7064 }, function(response) { 7065 if (response.status == 0) { 7066 hidePopup(); 7067 } else { 7068 changing = false; 7069 hidePopup(); 7070 show_dynamicURL(domain_id, record_id); 7071 showPopupMessage(response.message); 7072 } 7073 }, 'json'); 7074 return false; 7075 }); 7076 changing = false; 7077} 7078 7079function show_dynamicURL(domain_id, record_id) { 7080 showPopup('records', '&show=dynamicUrl&zone=' + domain_id + '&record=' + record_id); 7081} 7082 7083function zone_showFailover (zone_id, record_id, page) { 7084 var pageParam = ''; 7085 if (typeof(page) != 'undefined') { 7086 pageParam = '&page=' + page; 7087 } 7088 7089 var scroll = $(window).scrollTop(); 7090 $.post(AJAXACTIONS_URL + '?action=records', { 7091 'type': 'failover', 7092 'zone': zone_id, 7093 'record_id': record_id 7094 }, function(response) { 7095 if (typeof(response.action) !== 'undefined') { 7096 eval(response.action); 7097 } else { 7098 if (response.status == 0) { 7099 showPopup('records', '&show=failover&zone=' + zone_id + '&record=' + record_id + pageParam, function () { 7100 $(window).scrollTop(scroll); 7101 }); 7102 } else { 7103 window.location = '/failover-manage/domain/' + zone_id + '/record/' + record_id + '/'; 7104 } 7105 } 7106 }, 'json'); 7107 return false; 7108} 7109 7110function zone_createMonitoringFromRecord(zone_id, record_id, page) { 7111 var pageParam = ''; 7112 if (typeof(page) != 'undefined') { 7113 pageParam = '&page=' + page; 7114 } 7115 7116 var scroll = $(window).scrollTop(); 7117 $.post(AJAXACTIONS_URL + '?action=records', { 7118 'type': 'createMonitoringFromDNSRecord', 7119 'zone': zone_id, 7120 'record_id': record_id 7121 }, function(response) { 7122 if (typeof(response.action) !== 'undefined') { 7123 eval(response.action); 7124 } else { 7125 if (response.status == 0) { 7126 var recordData = { 7127 record_type: response.record_type, 7128 ip: response.ip, 7129 host: response.host, 7130 dns_responses: response.dns_responses 7131 } 7132 showPopup('monitoring-records', '&show=add-new' + pageParam, function() { 7133 $(window).scrollTop(scroll); 7134 }, function() { 7135 if (recordData.record_type == 'A' || recordData.record_type == 'AAAA') { 7136 $('#fo_ip').val(recordData.ip); 7137 $('#fo_check_type').val(17); 7138 } else if (recordData.record_type == 'NS') { 7139 $('#fo_ip').val(recordData.ip); 7140 $('#fo_check_type').val(10); 7141 $('#fo_dns_host').val(recordData.host); 7142 $('#fo_dns_type').val(recordData.record_type); 7143 $('#fo_dns_response').val(recordData.dns_responses); 7144 } 7145 7146 dashboard_monitoringChangeType(); 7147 monitoring_checkIfValidHost(); 7148 }); 7149 } 7150 } 7151 }, 'json'); 7152 return false;
7153} 7154 7155function zone_failoverChangeType () { 7156 var foType = parseInt($('#fo_check_type').val()); 7157 $('.monitoringType').css('display', 'none'); 7158 $('.monitoringType'+ foType).css('display', ''); 7159 7160 fixPopupPosition('#cloudnspop'); 7161} 7162function zone_failoverChangeDownEvent () { 7163 var downEventHandler = $('#fo_down_event_handler').val(); 7164 $('.monitoringDownEvent').css('display', 'none'); 7165 $('.monitoringDownEvent'+ downEventHandler).css('display', ''); 7166 7167 // down event handler - monitoring 7168 if (downEventHandler == 0) { 7169 $('#fo_up_handler_active').attr('disabled', 'disabled'); 7170 } else { 7171 $('#fo_up_handler_active').removeAttr('disabled'); 7172 } 7173 7174 if (downEventHandler != 2) { 7175 $('#fo_main_ip').attr('readonly', 'readonly'); 7176 } else { 7177 $('#fo_main_ip').removeAttr('readonly'); 7178 } 7179 7180 fixPopupPosition('#cloudnspop'); 7181} 7182 7183function zone_failoverToggleMailInput() { 7184 $('#notification_mail').prop('disabled', false); 7185 if ($('#mail_notifications_disable').is(':checked')) { 7186 $('#notification_mail').prop('disabled', true); 7187 } 7188} 7189 7190function zone_failoverActivate (zone_id, record_id) { 7191 $.post(AJAXACTIONS_URL + '?action=records', { 7192 'type': 'activateFailover', 7193 'zone': zone_id, 7194 'record_id': record_id, 7195 'check_type': $('#fo_check_type').val(), 7196 'monitoring_region': $('#fo_monitoring_region').val(), 7197 'check_period': $('#fo_check_period').val(), 7198 'main_ip': $('#fo_main_ip').val(), 7199 'http_host': $('#fo_http_host').val(), 7200 'http_port': $('#fo_http_port').val(), 7201 'http_path': $('#fo_http_path').val(), 7202 'http_content': $('#fo_http_content').val(), 7203 'http_protocol': $('input[name=web_protocol]:checked').val(), 7204 'http_custom_string': $('input[name=web_custom_string]:checked').val(), 7205 'port': $('#fo_port').val(), 7206 'dns_host': $('#fo_dns_host').val(), 7207 'dns_type': $('#fo_dns_type').val(), 7208 'dns_response': $('#fo_dns_response').val(), 7209 'down_event_handler': $('#fo_down_event_handler').val(), 7210 'up_event_handler': $('#fo_up_event_handler').val(), 7211 'backup_ip_1': $('#fo_backup_ip_1').val(), 7212 'backup_ip_2': $('#fo_backup_ip_2').val(), 7213 'backup_ip_3': $('#fo_backup_ip_3').val(), 7214 'backup_ip_4': $('#fo_backup_ip_4').val(), 7215 'backup_ip_5': $('#fo_backup_ip_5').val(), 7216 'mail_notifications': $('#mail_notifications_enable').is(':checked') ? 1 : 0, 7217 'notification_mail': $('#notification_mail').val(), 7218 'state': $('#monitoring_state_active').is(':checked') ? 1 : 0, 7219 'deactivate_record': $('#fo_deactivate_record').is(':checked') ? 1 : 0, 7220 'latency_limit': $('#fo_latency_limit').val(), 7221 'ping_timeout': $('#fo_ping_timeout').val(), 7222 'ping_threshold': $('#fo_ping_threshold').val(), 7223 'http_request_type': $('#http_request_type').val(), 7224 'connection_security': $('#connection_security').val(), 7225 'header': $('#fo_header').is(':checked') ? 1 : 0, 7226 'header_name': $('#fo_header_name').val(), 7227 'header_value': $('#fo_header_value').val(),
7228 'http_timeout': $('#fo_http_timeout').val(), 7229 'open_port': $('#monitoring_port_open').is(':checked') ? 1 : 0 7230 }, function(response) { 7231 if (typeof(response.action) !== 'undefined') { 7232 eval(response.action); 7233 } else { 7234 if (!response.status) { 7235 showPopupMessage(htmlspecialchars(response.message)); 7236 } else { 7237 window.location = '/failover-manage/domain/' + zone_id + '/record/' + record_id + '/'; 7238 } 7239 } 7240 }, 'json'); 7241 return false; 7242} 7243function zone_failoverModify (zone_id, record_id, page, from_page, dashboard_page) { 7244 $.post(AJAXACTIONS_URL + '?action=records', { 7245 'type': 'modifyFailover', 7246 'zone': zone_id, 7247 'record_id': record_id, 7248 'check_type': $('#fo_check_type').val(), 7249 'monitoring_region': $('#fo_monitoring_region').val(), 7250 'check_period': $('#fo_check_period').val(), 7251 'main_ip': $('#fo_main_ip').val(), 7252 'http_host': $('#fo_http_host').val(), 7253 'http_port': $('#fo_http_port').val(), 7254 'http_path': $('#fo_http_path').val(), 7255 'http_content': $('#fo_http_content').val(), 7256 'http_protocol': $('input[name=web_protocol]:checked').val(), 7257 'http_custom_string': $('input[name=web_custom_string]:checked').val(), 7258 'port': $('#fo_port').val(), 7259 'dns_host': $('#fo_dns_host').val(), 7260 'dns_type': $('#fo_dns_type').val(), 7261 'dns_response': $('#fo_dns_response').val(), 7262 'down_event_handler': $('#fo_down_event_handler').val(), 7263 'up_event_handler': $('#fo_up_event_handler').val(), 7264 'backup_ip_1': $('#fo_backup_ip_1').val(), 7265 'backup_ip_2': $('#fo_backup_ip_2').val(), 7266 'backup_ip_3': $('#fo_backup_ip_3').val(), 7267 'backup_ip_4': $('#fo_backup_ip_4').val(), 7268 'backup_ip_5': $('#fo_backup_ip_5').val(), 7269 'header': $('#fo_header').is(':checked') ? 1 : 0, 7270 'header_name': $('#fo_header_name').val(), 7271 'header_value': $('#fo_header_value').val(), 7272 'mail_notifications': $('#mail_notifications_enable').is(':checked') ? 1 : 0, 7273 'notification_mail': $('#notification_mail').val(), 7274 'state': $('#monitoring_state_active').is(':checked') ? 1 : 0, 7275 'deactivate_record': $('#fo_deactivate_record').is(':checked') ? 1 : 0, 7276 'latency_limit': $('#fo_latency_limit').val(), 7277 'ping_timeout': $('#fo_ping_timeout').val(), 7278 'ping_threshold': $('#fo_ping_threshold').val(), 7279 'http_request_type': $('#http_request_type').val(), 7280 'connection_security': $('#connection_security').val(),
7281 'http_timeout': $('#fo_http_timeout').val(), 7282 'open_port': $('#monitoring_port_open').is(':checked') ? 1 : 0, 7283 }, function(response) { 7284 if (typeof(response.action) !== 'undefined') { 7285 eval(response.action); 7286 } else { 7287 if (!response.status) { 7288 showPopupMessage(htmlspecialchars(response.message)); 7289 } else { 7290 showPopupMessage(htmlspecialchars(response.message), function() { 7291 if (response.status == 1) { 7292 if (from_page == 'dashboard') { 7293 userData(); 7294 insideCloudPage('dashboard-failover-records', 'failover-records', '&show=showRecords&page=' + dashboard_page); 7295 } else { 7296 window.location = '/failover-manage/domain/' + zone_id + '/record/' + record_id + '/'; 7297 } 7298 } 7299 }); 7300 } 7301 } 7302 }, 'json'); 7303 return false; 7304} 7305function zone_failoverDeactivate(zone_id, record_id, page, warning, from_page) { 7306 var pageParam = ''; 7307 if (typeof(page) != 'undefined') { 7308 pageParam = '&page=' + page; 7309 } 7310 showConfirmation(warning, function () { 7311 $.post(AJAXACTIONS_URL + '?action=records', { 7312 'type': 'deactivateFailover', 7313 'zone': zone_id, 7314 'record_id': record_id 7315 }, function(response) { 7316 if (typeof(response.action) !== 'undefined') { 7317 eval(response.action); 7318 } else { 7319 if (!response.status) { 7320 showPopupMessage(response.message); 7321 } else { 7322 if (from_page == 'dashboard') { 7323 userData(); 7324 insideCloudPage('dashboard-failover-records', 'failover-records', '&show=showRecords&page=' + page); 7325 } else { 7326 window.location = '/records/domain/' + zone_id + '/'; 7327 } 7328 } 7329 } 7330 }, 'json'); 7331 return false; 7332 }); 7333} 7334 7335function zone_failoverMonitoringLog (zone_id, record_id, page, select, type, sortBy) { 7336 if (typeof page === 'undefined') { 7337 page = 1; 7338 } 7339 7340 if (typeof sortBy === 'undefined' || sortBy === null) { 7341 sortBy = ''; 7342 } 7343 7344 if (type === 'date') { 7345 7346 var fromDate = $('#fromDate').val(); 7347 var toDate = $('#toDate').val(); 7348 7349 var dateRegex = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/; 7350 7351 var invalid = false; 7352 7353 if (fromDate != '' && !dateRegex.test(fromDate)) { 7354 $('#fromDate').attr('title', 'Date must be in format YYYY-MM-DD'); 7355 $('#fromDate').tipsy({ 7356 gravity: 's', 7357 trigger: 'manual', 7358 html: false 7359 }).tipsy('show'); 7360 7361 $('#fromDate').one('change', function () { 7362 $(this).tipsy('hide'); 7363 }); 7364 7365 invalid = true; 7366 } 7367 7368 if (toDate != '' && !dateRegex.test(toDate)) { 7369 $('#toDate').attr('title', 'Date must be in format YYYY-MM-DD'); 7370 $('#toDate').tipsy({ 7371 gravity: 's', 7372 trigger: 'manual', 7373 html: false 7374 }).tipsy('show'); 7375 7376 $('#toDate').one('change', function () { 7377 $(this).tipsy('hide'); 7378 }); 7379 7380 invalid = true; 7381 } 7382 if (!invalid && validateDateRange(fromDate, toDate)) { 7383 invalid = true; 7384 } 7385 7386 if (invalid) { 7387 return false; 7388 } 7389 7390 var hadFrom = /(?:^|&)fromDate=/.test(sortBy); 7391 var hadTo = /(?:^|&)toDate=/.test(sortBy); 7392 7393 sortBy = sortBy.replace(/&fromDate=[^&]*/g, ''); 7394 sortBy = sortBy.replace(/&toDate=[^&]*/g, ''); 7395 7396 if (fromDate === '' && toDate === '') { 7397 if (!hadFrom && !hadTo) { 7398 return; 7399 } 7400 } else { 7401 if (fromDate !== '') { 7402 sortBy += '&fromDate=' + encodeURIComponent(fromDate); 7403 } 7404 if (toDate !== '') { 7405 sortBy += '&toDate=' + encodeURIComponent(toDate); 7406 } 7407 } 7408 } else { 7409 if (select !== '') { 7410 var value = $(select).val(); 7411 sortBy = sortBy + '&' + type + '=' + value; 7412 } 7413 } 7414 7415 insideCloudPage('fo_monitoring_table', 'records', '&show=failoverMonitoringLog&zone=' + zone_id + '&record_id=' + record_id + '&page=' + page + sortBy, function () { 7416 $('.tipsy').remove(); 7417 }); 7418 return false; 7419} 7420 7421function validateDateRange (fromDate, toDate) { 7422 if (toDate !== '' && fromDate !== '' && toDate < fromDate) { 7423 $('#toDate').attr('title', '"To" date cannot be earlier than "From" date'); 7424 $('#toDate').tipsy({ 7425 gravity: 's', 7426 trigger: 'manual', 7427 html: false 7428 }).tipsy('show'); 7429 7430 $('#toDate').one('change', function () { 7431 $(this).tipsy('hide'); 7432 }); 7433 7434 return true; 7435 } 7436 return false;
7437} 7438 7439function zone_failoverActionsLog (zone_id, record_id, page) { 7440 if (typeof page === 'undefined') { 7441 page = 1; 7442 } 7443 insideCloudPage('fo_actions_table', 'records', '&show=failoverActionsLog&zone='+ zone_id +'&record_id='+ record_id +'&page='+page); 7444 return false; 7445} 7446 7447function failover_showNotifications (record_id, page, domain_id) { 7448 if (typeof page === 'undefined') { 7449 page = 1; 7450 } 7451 7452 showPopup("records", "&show=failover-notifications&record=" + record_id + "&zone=" + domain_id + "&page=" + page); 7453 return false; 7454} 7455 7456function failover_showNotificationsTable (record_id, page, domain_id) { 7457 if (typeof page === 'undefined') { 7458 page = 1; 7459 } 7460 7461 insideCloudPage("notifications", "records", "&show=notifications-table&record=" + record_id + "&zone=" + domain_id + "&page=" + page); 7462 return false; 7463} 7464 7465function failover_createNotification (record_id, domain_id) { 7466 var type = $('#type').val(); 7467 var value = ''; 7468 var code = ''; 7469 var id = ''; 7470 if (type == '1') { 7471 value = $('#email').val(); 7472 } else if (type == 2 || type == 3) { 7473 value = $('#url').val(); 7474 } else if (type == 4) { 7475 code = $('#telnocc').val(); 7476 value = $('#telno').val(); 7477 } else if (type == 5) { 7478 value = $('#message').val(); 7479 code = $('#botToken').val(); 7480 id = $('#chatID').val(); 7481 } else { 7482 value = $('#discordMessage').val(); 7483 code = $('#discordToken').val(); 7484 id = $('#discordChatID').val(); 7485 } 7486 7487 $.post(AJAXACTIONS_URL + '?action=records', { 7488 'type': 'create-failover-notification', 7489 'record_id': record_id, 7490 'zone': domain_id, 7491 'nType': type, 7492 'value': value, 7493 'code': code, 7494 'id': id 7495 }, function(response) { 7496 if (!response.status) { 7497 showPopupMessage(response.message); 7498 } else { 7499 showPopupMessage(response.message); 7500 failover_showNotifications(record_id, 1, domain_id); 7501 } 7502 }, 'json'); 7503} 7504 7505function failover_deleteNotification (id, record_id, domain_id, page, warning) { 7506 showConfirmation(warning, function () { 7507 $.post(AJAXACTIONS_URL + '?action=records', { 7508 'type': 'delete-failover-notification', 7509 'record_id': record_id, 7510 'zone': domain_id, 7511 'id': id 7512 }, function(response) { 7513 if (!response.status) { 7514 showPopupMessage(response.message); 7515 } else { 7516 failover_showNotifications(record_id, page, domain_id); 7517 } 7518 }, 'json'); 7519 }); 7520} 7521 7522function equalizeFOHostnameValues (element) { 7523 var elementClass = $(element).attr("class"); 7524 var value = $(element).val(); 7525 7526 if (elementClass == 'fo-domain' || elementClass == 'fo-domainm') { 7527 $('.fo-domain').val(value); 7528 $('.fo-domainm').val(value); 7529 } 7530 if (elementClass == 'fo-port' || elementClass == 'fo-portm') { 7531 $('.fo-port').val(value); 7532 $('.fo-portm').val(value); 7533 } 7534 if (elementClass == 'fo-path' || elementClass == 'fo-pathm') { 7535 $('.fo-path').val(value); 7536 $('.fo-pathm').val(value); 7537 } 7538 if (elementClass == 'fo-url' || elementClass == 'fo-urlm') { 7539 $('.fo-url').val(value); 7540 $('.fo-urlm').val(value); 7541 } 7542 if (elementClass == 'fo-audio-threshold' || elementClass == 'fo-audio-thresholdm') { 7543 $('.fo-audio-threshold').val(value); 7544 $('.fo-audio-thresholdm').val(value); 7545 } 7546} 7547 7548function zone_getSecondaryZoneFile (zone_id) { 7549 showSplashScreen(); 7550 $.post(AJAXACTIONS_URL + '?action=slave', { 7551 'type': 'getSecondaryZoneFile', 7552 'zone': zone_id 7553 }, function(response) { 7554 hideSplashScreen(); 7555 if (!response.status) { 7556 showPopupMessage(response.message); 7557 } else { 7558 var blob = new Blob([response.file], { type: "application/octetstream" }); 7559 var isIE = false || !!document.documentMode; 7560 if (isIE) { 7561 window.navigator.msSaveBlob(blob, fileName); 7562 } else { 7563 var url = URL.createObjectURL(blob); 7564 var atag = $('<a />', { 7565 'href': url, 7566 'download': response.zone, 7567 'text': "click" 7568 }).hide().appendTo("body")[0].click(); 7569 7570 URL.revokeObjectURL(url); 7571 } 7572 } 7573 }, 'json'); 7574} 7575 7576function toggleHttpProtocol () { 7577 if ($('#web_protocol_https').is(':checked')) { 7578 $('#webProtocolUrl').html('https'); 7579 } else { 7580 $('#webProtocolUrl').html('http'); 7581 } 7582} 7583 7584/* ********************* */ 7585/* PROFILE */ 7586/* ********************* */ 7587function profile_saveSubscriptions() { 7588 $.post(AJAXACTIONS_URL + '?action=profile', { 7589 'type': 'saveMailSettings', 7590 'form': { 7591 'domain_promotions': $('#domain_promotions').is(':checked') ? 1 : 0, 7592 'premium_promotions': $('#premium_promotions').is(':checked') ? 1 : 0, 7593 'ssl_promotions': $('#ssl_promotions').is(':checked') ? 1 : 0, 7594 'monitoring_promotions': $('#monitoring_promotions').is(':checked') ? 1 : 0, 7595 'newsletter': $('#newsletter').is(':checked') ? 1 : 0, 7596 'maintenance': $('#maintenance').is(':checked') ? 1 : 0, 7597 'failover_weekly': $('#failover_weekly').is(':checked') ? 1 : 0, 7598 'monitoring_weekly': $('#monitoring_weekly').is(':checked') ? 1 : 0, 7599 'free_ssl_notify': $('#free_ssl_notify').is(':checked') ? 1 : 0 7600 } 7601 }, function(response) { 7602 if (typeof(response.action) != 'undefined') { 7603 eval(response.action); 7604 } else { 7605 showPopupMessage(response.message); 7606 } 7607 }, 'json'); 7608} 7609 7610function showMHBody(num) { 7611 $('#MHBody' + num).toggle(); 7612 $('#MHBody' + num + ' td').css('background-color', '#EEEBEB'); 7613 $(this).css('background-color', '#EEEBEB'); 7614} 7615 7616function showMHMessage (message_id) { 7617 $.post(AJAXACTIONS_URL + '?action=profile', { 7618 'show': 'showMessage', 7619 'id': message_id 7620 }, function(response) { 7621 7622 }, 'json'); 7623} 7624 7625function webAccess_changeIpRestriction() { 7626 $.post(AJAXACTIONS_URL + '?action=profile', { 7627 'type': 'changeIpRestriction', 7628 'restriction_mode': $('#change_ip_restriction').is(':checked') ? 1 : 0 7629 7630 }, function(response) { 7631 if (typeof(response.action) != 'undefined') { 7632 eval(response.action); 7633 } else { 7634 if (response.status == 1) { 7635 window.location.href = '/profile/sub-page/web-access/'; 7636 } else { 7637 showPopupMessage(response.message); 7638 } 7639 } 7640 }, 'json'); 7641} 7642
7643function webAccess_addNewIp() { 7644 $.post(AJAXACTIONS_URL + '?action=profile', { 7645 'type': 'webAccess_addNewIP', 7646 'allowed_ip': $('#allowed_ip').val() 7647 7648 }, function(response) { 7649 if (response.status == 1) { 7650 insideCloudPage("IPlist", "profile", "&show=webAccess_getIPs"); 7651 $('#allowed_ip').val(''); 7652 } else { 7653 showPopupMessage(response.message); 7654 } 7655 }, 'json'); 7656} 7657 7658function webAccess_deleteIP(id, warning) { 7659 showConfirmation(warning, function () { 7660 $.post(AJAXACTIONS_URL + '?action=profile', { 7661 'type': 'webAccess_deleteIP', 7662 'row_id': id 7663 7664 }, function(response) { 7665 if (response.status == 1) { 7666 insideCloudPage("IPlist", "profile", "&show=webAccess_getIPs"); 7667 } else { 7668 showPopupMessage(response.message); 7669 } 7670 }, 'json'); 7671 }); 7672} 7673 7674function webAccess_enable2FA() { 7675 $.post(AJAXACTIONS_URL + '?action=profile', { 7676 'type': 'webAccess_enable2FA' 7677 7678 }, function(response) { 7679 if (response.status == 1) { 7680 showPopup("profile", "&show=webAccess_show2faQR", null, function(){ 7681 fixPopupPosition('#cloudnspop', true, true); 7682 }); 7683 } else { 7684 showPopupMessage(response.message); 7685 } 7686 }, 'json'); 7687} 7688 7689function webAccess_activate2FA() { 7690 $.post(AJAXACTIONS_URL + '?action=profile', { 7691 'type': 'webAccess_activate2FA', 7692 'token': $('#login2FAToken').val(), 7693 'password': $('#password').val() 7694 7695 }, function(response) { 7696 if (response.status == 1) { 7697 insideCloudPage("show2FA", "profile", "&show=webAccess_show2FA"); 7698 hidePopup(); 7699 } 7700 showPopupMessage(response.message, function() { 7701 insideCloudPage("ipRestrictionCheckbox", "profile", "&show=webAccess_getIpRestriction"); 7702 }); 7703 }, 'json'); 7704} 7705 7706function webAccess_deactivate2FA() { 7707 $.post(AJAXACTIONS_URL + '?action=profile', { 7708 'type': 'webAccess_deactivate2FA', 7709 'password': $('#depassword').val(), 7710 'token': $('#detoken2fa').val() 7711 7712 }, function(response) { 7713 if (response.status == 1) { 7714 insideCloudPage("show2FA", "profile", "&show=webAccess_show2FA"); 7715 } 7716 showPopupMessage(response.message, function() { 7717 insideCloudPage("ipRestrictionCheckbox", "profile", "&show=webAccess_getIpRestriction"); 7718 }); 7719 }, 'json'); 7720} 7721 7722function webAccess_show2faSecret () { 7723 $.post(AJAXACTIONS_URL + '?action=profile', { 7724 'type': 'webAccess_show2faSecret', 7725 'password': $('#password').val(), 7726 'token': $('#token2fa').val() 7727 7728 }, function(response) { 7729 if (response.status == 1) { 7730 showPopup('profile', '&show=webAccess_show2faSecret'); 7731 } else { 7732 showPopupMessage(response.message); 7733 } 7734 }, 'json'); 7735} 7736 7737function profile_doDeposite (type_id) { 7738 $.post(AJAXACTIONS_URL + '?action=cart', { 7739 'type': 'addDeposit', 7740 'type_id': type_id, 7741 'amount': $('#amount').val() 7742 }, function(response) { 7743 if (response.status == 0) { 7744 if (typeof response.redirect != 'undefined') { 7745 window.location.href = response.redirect; 7746 return false; 7747 } 7748 showPopupMessage(response.message); 7749 } else { 7750 window.location.href = '/order/step/1/'; 7751 } 7752 }, 'json'); 7753} 7754 7755function profile_saveWebSettings () { 7756 $.post(AJAXACTIONS_URL + '?action=profile', { 7757 'type': 'saveWebSettings', 7758 'rows_per_page': $('#rows_per_page').val(), 7759 'notes': $('#notes').is(':checked') ? 1 : 0, 7760 'disable_records': $('#disableRecords').is(':checked') ? 1 : 0, 7761 'enable_records_pagination': $('#recordsPagination').is(':checked') ? 1 : 0, 7762 'groups': $('#groups').is(':checked') ? 1 : 0, 7763 'default_ttl': $('#default_ttl').val(), 7764 'notify_on_login': $('#notifyOnLogin').is(':checked') ? 1 : 0, 7765 'preferred_currency': $('#preferred_currency').val(), 7766 'default_dashboard': $('#default_dashboard').val(), 7767 }, function(response) { 7768 if (typeof response.action !== 'undefined') { 7769 eval(response.action); 7770 return false; 7771 } 7772 if (response.status == 0) { 7773 if (typeof(response.message) == 'object') { 7774 $.each(response.message, function(type, message) { 7775 var element = $('#' + type); 7776 element.attr('title', message); 7777 element.tipsy({ 7778 gravity: 'w', 7779 trigger: 'manual', 7780 html: false 7781 }); 7782 element.tipsy('show'); 7783 $(window).resize(function(){ 7784 element.tipsy('show'); 7785 }); 7786 }); 7787 } else { 7788 showPopupMessage(response.message); 7789 } 7790 } else { 7791 showPopupMessage(response.message); 7792 } 7793 }, 'json'); 7794} 7795 7796function profile_saveAccountSettings () { 7797 $.post(AJAXACTIONS_URL + '?action=profile', { 7798 'type': 'saveAccountSettings', 7799 'balance_notify': $('#balanceNotify').val(), 7800 'additional_email': $('#additionalMail').val(), 7801 'invocies_email': $('#invoicesMail').val(), 7802 'time_zone': $('#timeZone').val(), 7803 'remaining_zones_notification': $('#remainingZonesNotification').val(), 7804 'restricted_invoice_download': $('#restrictedInvoiceDownload').is(':checked') ? 1 : 0, 7805 'monitoring_service_email': $('#monitoringServiceEmail').val() 7806 }, function(response) { 7807 if (typeof response.action !== 'undefined') { 7808 eval(response.action); 7809 return false;
7810 } 7811 if (response.status == 0) { 7812 if (typeof(response.message) == 'object') { 7813 $.each(response.message, function(type, message) { 7814 var element = $('#' + type); 7815 element.attr('title', message); 7816 element.tipsy({ 7817 gravity: 'w', 7818 trigger: 'manual', 7819 html: false 7820 }); 7821 element.tipsy('show'); 7822 $(window).resize(function(){ 7823 element.tipsy('show'); 7824 }); 7825 }); 7826 } else { 7827 showPopupMessage(response.message); 7828 } 7829 } else { 7830 showPopupMessage(response.message); 7831 } 7832 }, 'json'); 7833} 7834 7835function profile_saveSOASettings () { 7836 $.post(AJAXACTIONS_URL + '?action=profile', { 7837 'type': 'saveSOASettings', 7838 'admin_mail': $('#soaAdminMail').val(), 7839 'primary_ns': $('#soaServer').val(), 7840 'refresh': $('#soaRefresh').val(), 7841 'retry': $('#soaRetry').val(), 7842 'expire': $('#soaExpire').val(), 7843 'ttl': $('#soaTtl').val() 7844 }, function(response) { 7845 if (typeof response.action !== 'undefined') { 7846 eval(response.action); 7847 return false; 7848 } 7849 if (response.status == 0) { 7850 if (typeof(response.message) == 'object') { 7851 $.each(response.message, function(type, message) { 7852 var element = $('#' + type); 7853 element.attr('title', message); 7854 element.tipsy({ 7855 gravity: 'w', 7856 trigger: 'manual', 7857 html: false 7858 }); 7859 element.tipsy('show'); 7860 $(window).resize(function(){ 7861 element.tipsy('show'); 7862 }); 7863 }); 7864 } else { 7865 showPopupMessage(response.message); 7866 } 7867 } else { 7868 showPopupMessage(response.message); 7869 } 7870 }, 'json'); 7871} 7872 7873function profile_saveDefaultNs () { 7874 var servers = {}; 7875 for (i = 1; i <= 6; i++) { 7876 if (typeof($('#ns_' + i).val()) != 'undefined' && $('#ns_' + i).val() != '') { 7877 servers[i] = $('#ns_' + i).val(); 7878 } 7879 } 7880 7881 $.post(AJAXACTIONS_URL + '?action=profile', { 7882 'type': 'saveDefaultNs', 7883 'servers': servers 7884 }, function(response) { 7885 if (typeof response.action !== 'undefined') { 7886 eval(response.action); 7887 return false; 7888 } 7889 if (response.status == 0) { 7890 if (typeof(response.message) == 'object') { 7891 $.each(response.message, function(type, message) { 7892 var element = $('#' + type); 7893 element.attr('title', message); 7894 element.tipsy({ 7895 gravity: 'w', 7896 trigger: 'manual', 7897 html: false 7898 }); 7899 element.tipsy('show'); 7900 $(window).resize(function(){ 7901 element.tipsy('show'); 7902 }); 7903 }); 7904 } else { 7905 showPopupMessage(response.message); 7906 } 7907 } else { 7908 showPopupMessage(response.message); 7909 } 7910 7911 }, 'json'); 7912} 7913 7914function profile_changePassword () { 7915 $.each($('.input-text-big'), function (index, element) { 7916 $(element).tipsy('hide'); 7917 }); 7918 $.post(AJAXACTIONS_URL + '?action=profile', { 7919 'type': 'changePassword', 7920 'current_password': $('#current_password').val(), 7921 'new_password': $('#new_password').val(), 7922 'verify_password': $('#verify_password').val(), 7923 'twofa_token': $('#twofa_token').val() 7924 }, function(response) { 7925 if (typeof response.action !== 'undefined') { 7926 eval(response.action); 7927 return false; 7928 } 7929 if (response.status == 0) { 7930 if (typeof(response.message) == 'object') { 7931 $.each(response.message, function(type, message) { 7932 var element = $('#' + type); 7933 element.attr('title', message); 7934 element.tipsy({ 7935 gravity: 'w', 7936 trigger: 'manual', 7937 html: false 7938 }); 7939 element.tipsy('show'); 7940 $(window).resize(function(){ 7941 element.tipsy('show'); 7942 }); 7943 }); 7944 } else { 7945 showPopupMessage(response.message); 7946 } 7947 } else { 7948 showPopupMessage(response.message, function() { 7949 window.location = '/'; 7950 }); 7951 } 7952 }, 'json'); 7953} 7954 7955function profile_changeMail () { 7956 7957 $.each($('.input-text-big'), function (index, element) { 7958 $(element).tipsy('hide'); 7959 }); 7960 $.post(AJAXACTIONS_URL + '?action=profile', { 7961 'type': 'changeMail', 7962 'new_mail': $('#new_mail').val(), 7963 'verify_mail': $('#verify_mail').val(), 7964 'password': $('#password').val() 7965 }, function(response) { 7966 if (typeof response.action !== 'undefined') { 7967 eval(response.action); 7968 return false; 7969 } 7970 if (response.status == 0) { 7971 if (typeof(response.message) == 'object') { 7972 $.each(response.message, function(type, message) { 7973 var element = $('#' + type); 7974 element.attr('title', message); 7975 element.tipsy({ 7976 gravity: 'w', 7977 trigger: 'manual', 7978 html: false 7979 }); 7980 element.tipsy('show'); 7981 $(window).resize(function(){ 7982 element.tipsy('show'); 7983 }); 7984 }); 7985 } else { 7986 showPopupMessage(response.message); 7987 } 7988 } else { 7989 showPopupMessage(response.message); 7990 } 7991 }, 'json'); 7992} 7993 7994function toggleVatField() { 7995 var $country = $('#country, #orderCountry'); 7996 7997 var vatCountries = $country.data('vat-countries'); 7998 var selectedCountry = $country.val(); 7999 8000 if (vatCountries && vatCountries.includes(selectedCountry)) { 8001 $('.vat-row').show(); 8002 } else { 8003 $('.vat-row').hide(); 8004 $('#vat').val(''); 8005 } 8006} 8007 8008var blockConstactsSave = false;
8009function profile_saveContactDetails () { 8010 var mobile = false; 8011 if ($('body').width() < 800) { 8012 mobile = true; 8013 } 8014 if (blockConstactsSave === true) { 8015 return false; 8016 } 8017 blockConstactsSave = true; 8018 blockButton('updateContacts', 'checkout_loading'); 8019 $.each($('.input-text'), function (index, element) { 8020 $(element).tipsy('hide'); 8021 $(element).removeClass('error'); 8022 }); 8023 $('.select').tipsy('hide'); 8024 $.post(AJAXACTIONS_URL + '?action=profile', { 8025 'type': 'saveContactDetails', 8026 'name': $('#name').val(), 8027 'company': $('#company').val(), 8028 'vat': $('#vat').val(), 8029 'eik': $('#eik').val(), 8030 'address': $('#address').val(), 8031 'zip': $('#zip').val(), 8032 'city': $('#city').val(), 8033 'state': $('#state').val(), 8034 'country': $('#country').val(), 8035 'telno': $('#telno').val(), 8036 'telnocc': $('#telnocc').val(), 8037 'faxno': $('#faxno').val(), 8038 'faxnocc': $('#faxnocc').val(), 8039 'password': $('#password').val() 8040 }, function(response) { 8041 if (typeof response.action !== 'undefined') { 8042 eval(response.action); 8043 return false; 8044 } 8045 blockConstactsSave = false; 8046 unBlockButton('updateContacts', 'checkout_loading'); 8047 $('#password').val(''); 8048 if (response.status == 0) { 8049 if (typeof(response.errors) == 'object') { 8050 if (mobile == true) { 8051 var mobileErrorMessage = ''; 8052 var errorCounter = 0; 8053 } 8054 $.each(response.errors, function(type, message) { 8055 var element = $('#' + type); 8056 element.addClass('error'); 8057 if (mobile == true) { 8058 var errorType = $('#' + type + 'Label').text(); 8059 if (type == 'telnocc' || type == 'telno') { 8060 errorType = $('#telnoLabel').text(); 8061 } 8062 if (type == 'faxnocc' || type == 'faxno') { 8063 errorType = $('#faxnoLabel').text(); 8064 } 8065 errorCounter++; 8066 mobileErrorMessage += "<strong>" + errorType + "</strong>" + "<br>" + message + "<br><br>"; 8067 } else { 8068 if (type == 'telnocc' || type == 'faxnocc') { 8069 var tipsyGravity = 'e'; 8070 } else { 8071 var tipsyGravity = 'w'; 8072 } 8073 element.attr('title', message); 8074 element.tipsy({ 8075 gravity: tipsyGravity, 8076 trigger: 'manual', 8077 html: true 8078 }); 8079 element.tipsy('show'); 8080 $(window).resize(function(){ 8081 element.tipsy('show'); 8082 }); 8083 } 8084 }); 8085 if (mobile == true) { 8086 if (errorCounter < 2) { 8087 mobileErrorMessage = mobileErrorMessage.substring(0, mobileErrorMessage.lastIndexOf("<br>")); 8088 } 8089 showPopupMessage(__('following_error_occured') + ":<br><br>" + mobileErrorMessage); 8090 } 8091 } else { 8092 showPopupMessage(response.errors); 8093 } 8094 } else { 8095 showPopupMessage(response.message); 8096 } 8097 }, 'json'); 8098} 8099 8100function metadataEntryMetod (type) { 8101 $('.metadataMethod').css('display', 'none'); 8102 if (type == 2) { 8103 $('#metadataMethodFile').css('display', 'block'); 8104 } else { 8105 $('#metadataMethodText').css('display', 'block'); 8106 } 8107} 8108 8109function deleteSamlProvider (saml_id, warning) { 8110 showConfirmation(warning, function () { 8111 $.post(AJAXACTIONS_URL + '?action=profile', { 8112 'action': 'deleteSaml', 8113 'saml_id': saml_id, 8114 }, function(response) { 8115 showPopupMessage(response.message); 8116 if (response.status == 1) { 8117 insideCloudPage('samlLogins', 'profile', '&show=saml-logins'); 8118 } 8119 }, 'json'); 8120 }); 8121} 8122 8123/* ********************* */ 8124/* API-HELP */ 8125/* ********************* */ 8126function toggleMenu(act) { 8127 $('li#' + act + ' ul.' + act).toggle('fast'); 8128 if ($('li#' + act).attr('class') == 'open') { 8129 $('li#' + act).removeClass('open').addClass('closed'); 8130 $('li#' + act + ' a img.'+ act).attr('src', '/images/icons/nav-plus.gif'); 8131 } else { 8132 $('li#' + act).removeClass('closed').addClass('open'); 8133 $('li#' + act + ' img.'+ act).attr("src", "/images/icons/nav-minus.gif"); 8134 } 8135 8136 $('li#' + act + ' li').css('list-style-image', 'none'); 8137 8138} 8139 8140/* ********************* */ 8141/* ORDERS */ 8142/* ********************* */ 8143function refreshPaymentMethods() { 8144 var country = $('#orderCountry').val(); 8145 var currency = $('input[name=currency]:checked').val(); 8146 $('.paymentMethod').hide(); 8147 $('.paymentMethod'+ currency +'All').show(); 8148 $('.paymentMethod'+ currency + country).show(); 8149 8150 $('.paymentMethodDisabled' + country).hide(); 8151 8152 $('.paymentMethod:visible input:enabled:first').prop('checked', true); 8153} 8154 8155/* ********************* */ 8156/* DNS SERVERS */ 8157/* ********************* */ 8158function DNServer_addToCart(location, server) { 8159 $.post(AJAXACTIONS_URL + '?action=cart', { 8160 'type': 'addServer', 8161 'location': location, 8162 'server': server 8163 }, function(response) { 8164 if (!response.status) { 8165 showPopupMessage(response.message); 8166 } else { 8167 window.location.href = '/order/step/1/'; 8168 } 8169 }, 'json'); 8170} 8171 8172// Global execution code 8173function keyUpHandler(key) { 8174 // Escape 8175 if (key == 27) { 8176 // confirmation popup 8177 if ($('#popup-confirmation').hasClass('show')) { 8178 hideConfirmation(0); 8179 return; 8180 } 8181 // cloud message - old design 8182 else if ($('#cloudMessage:visible').length > 0) { 8183 hideCloudMessage(0); 8184 return; 8185 } 8186 // popup message - new design 8187 else if ($('#popup-message').hasClass('show')) { 8188 hidePopupMessage(0); 8189 return; 8190 } 8191 8192 // cloud page - old design 8193 else if ($('#cloudPage:visible').length > 0) { 8194 hideCloudPage(0); 8195 return; 8196 } 8197 8198 // popup - new design 8199 else if ($('#cloudnspop').hasClass('show')) { 8200 hidePopup(0); 8201 return; 8202 } 8203 } 8204 8205 // enter 8206 if (key == 13) { 8207 // confirmation popup 8208 if ($('#popup-confirmation').hasClass('show')) { 8209 hideConfirmation(1); 8210 return; 8211 } 8212 } 8213 8214 // space 8215 if (key == 32) { 8216 // confirmation popup 8217 if ($('#popup-confirmation').hasClass('show')) { 8218 hideConfirmation(1); 8219 return false;
8220 } 8221 } 8222} 8223$(function() { 8224 $(document).keyup(function(event) { 8225 return keyUpHandler(event.which); 8226 }); 8227}); 8228 8229/* ********************* */ 8230/* DOMAINS PRICING LIST */ 8231/* ********************* */ 8232 8233function domains_changeCategory (tab) { 8234 /* the two tabs */ 8235 $('ul.domainCategorieTabs li').removeClass('active'); 8236 $('#' + tab).addClass('active'); 8237 8238 /* showing and hiding the different categories depending on which tab is clicked */ 8239 $('.tlds').toggle(); 8240}; 8241 8242function refreshCountryPaymentMethods() { 8243 $('.payment-method').hide(); 8244 $('.default_method').show(); 8245 $('.' + $('#country').val() + '_method').show(); 8246 $('.' + $('#country').val() + '_disabled_method').hide(); 8247} 8248 8249function checkUncheckAll (controller, container, exclude, excludeClass) { 8250 if (typeof(exclude) == 'undefined') { 8251 exclude = 'undefinedID'; 8252 } 8253 if (typeof(excludeClass) == 'undefined') { 8254 excludeClass = 'undefinedClass'; 8255 } 8256 var isChecked = $('#' + controller).prop('checked'); 8257 $('#' + container).find('input[type="checkbox"]').not('#' + exclude).not('.' + excludeClass).prop('checked', isChecked); 8258 $('#' + container).find('tr').not('#' + exclude).not('.' + excludeClass).removeClass('select'); 8259 if (isChecked === true) { 8260 $('#' + container).find('tr').not('#' + exclude).not('.' + excludeClass).addClass('select'); 8261 } 8262 8263 zone_toggleMobileFooterActions(); 8264} 8265 8266function markRowSelected(selector, row) { 8267 var isChecked = $(selector).prop('checked'); 8268 8269 $('#' + row).removeClass('select'); 8270 if (isChecked === true) { 8271 $('#' + row).addClass('select'); 8272 } 8273 8274 zone_toggleMobileFooterActions(); 8275} 8276 8277function zone_toggleMobileFooterActions() { 8278 var hasSelected = $('#recordsBody tr.records.select input[type="checkbox"]:checked').length > 0; 8279 $('#records-table .records-table + .table-footer').toggleClass('has-selected-records', hasSelected); 8280} 8281 8282/* *************************** */ 8283/* GLOBAL AND USERS TEMPLATES */ 8284/* *************************** */ 8285 8286function templates_updateRecordHost (domain) { 8287 var host = htmlspecialchars($('#host').val()); 8288 8289 var explodedHostName = shortenLongString(host + '.' + domain, 25); 8290 var checked = ''; 8291 if ($('#wr').is(':checked')) { 8292 checked = 'checked="checked"'; 8293 } 8294 8295 var forwww = ''; 8296 forwww += '<div>'; 8297 forwww += '<label class="label-auto" for="wr">'; 8298 8299 forwww += '<input type="checkbox" name="wr" id="wr" onClick="templates_updateWR(\'' + domain + '\');" ' + checked + '/> '; 8300 forwww += '<span class="checkbox"></span>'; 8301 forwww += 'Create Web Redirect for the root domain to http://'; 8302 forwww += '<span class="newHost" title="http://www.' + domain + '">www.' + domain + '</span>'; 8303 forwww += '</div>'; 8304 forwww += '</label>'; 8305 forwww += '</div>' 8306 8307 if (host != 'www') { 8308 8309 $.each($('.WR'), function (index, element) { 8310 $(element).tipsy('hide'); 8311 }); 8312 $('#forwww').empty(); 8313 $('#WRrecord').remove(); 8314 } else { 8315 $('#forwww').html(forwww); 8316 } 8317 8318 $('div.newHost').html(''); 8319 $('div.newHost').html(host +'.'+ domain); 8320 $("div.newHost").prop('title', explodedHostName); 8321 $("div.newHost, span.newHost").tooltip({ 8322 track: true, 8323 delay: 0, 8324 showURL: false, 8325 showBody: "<body>", 8326 fade: 250 8327 }); 8328} 8329 8330function templates_updateWR (domain) { 8331 var host = htmlspecialchars($('#host').val()); 8332 8333 $.each($('.WR'), function (index, element) { 8334 $(element).tipsy('hide'); 8335 }); 8336 $('#WRrecord').remove(); 8337 if ($('#wr').is(':checked') && host == 'www') { 8338 $('#templatesRecordsBody').append('<tr id="WRrecord"><td class="checkbox-cell a-l"><label class="s-t"><input id="check_wrcheck" type="checkbox" value="wrcheck" checked="checked"><span class="checkbox"></span></label></td><td class="addRecordField host-column a-l overflowHidden"><div class="WR overflowHiddenContainer"><div class="showWRtitle overflowHiddenContent" title="' + domain + '">'+ domain + '</div></div></td><td>WR</td><td class="pointsto-column overflowHidden"><div class="overflowHiddenContainer"><div class="overflowHiddenContent showWRtitle" title="http://' + host +'.'+ domain + '">http://www.'+ domain + '</div></div></td><td>3600</td></tr>'); 8339 } 8340 8341 $(".showWRtitle").tooltip({ 8342 track: true, 8343 delay: 0, 8344 showURL: false, 8345 showBody: "<body>", 8346 fade: 250 8347 }); 8348 fixPopupPosition('#cloudnspop'); 8349} 8350 8351function templates_enableService (domain, service) { 8352 $.each($('.' + service), function (index, element) { 8353 $(element).tipsy('hide'); 8354 }); 8355 $('#WRrecord').remove(); 8356 if ($('#' + service).is(':checked')) { 8357 $('#templatesRecordsBody').append('<tr id="' + service + '"><td class="' + service + ' addRecordField">'+ domain + '</td><td>WR</td><td><div>http://</div>
8357<div class="showTitle" title="' + host +'.'+ domain + '>' + host +'.'+ domain + '</div></td><td>3600</td></tr>'); 8358 } 8359} 8360 8361function insertARecords (domain, template) { 8362 var host = htmlspecialchars($('#host').val()); 8363 8364 $.each($('.addRecordField'), function (index, element) { 8365 $(element).tipsy('hide'); 8366 }); 8367 8368 var records = ''; 8369 if (template == 'blogger') { 8370 records += '<tr class="Arecord"><td class="checkbox-cell a-l"><label class="s-t"><input id="check_1" type="checkbox" value="1" checked="checked"><span class="checkbox"></span></label></td><td class="A addRecordField host-column a-l overflowHidden"><div class="overflowHiddenContainer"><div title="'+ domain +'" class="overflowHiddenContent showArecordTitle">'+ domain + '</div></div></td><td>A</td><td class="pointsto-column a-l overflowHidden"><div class="overflowHiddenContainer"><div title="216.239.32.21" class="showArecordTitle overflowHiddenContent">216.239.32.21</div></div></td><td>3600</td></tr>'; 8371 records += '<tr class="Arecord"><td class="checkbox-cell a-l"><label class="s-t"><input id="check_2" type="checkbox" value="2" checked="checked"><span class="checkbox"></span></label></td><td class="A addRecordField host-column a-l overflowHidden"><div class="overflowHiddenContainer"><div title="'+ domain +'" class="overflowHiddenContent showArecordTitle">'+ domain + '</div></div></td><td>A</td><td class="pointsto-column a-l overflowHidden"><div class="overflowHiddenContainer"><div title="216.239.34.21" class="showArecordTitle overflowHiddenContent">216.239.34.21</div></div></td><td>3600</td></tr>'; 8372 records += '<tr class="Arecord"><td class="checkbox-cell a-l"><label class="s-t"><input id="check_3" type="checkbox" value="3" checked="checked"><span class="checkbox"></span></label></td><td class="A addRecordField host-column a-l overflowHidden"><div class="overflowHiddenContainer"><div title="'+ domain +'" class="overflowHiddenContent showArecordTitle">'+ domain + '</div></div></td><td>A</td><td class="pointsto-column a-l overflowHidden"><div class="overflowHiddenContainer"><div title="216.239.36.21" class="showArecordTitle overflowHiddenContent">216.239.36.21</div></div></td><td>3600</td></tr>'; 8373 records += '<tr class="Arecord"><td class="checkbox-cell a-l"><label class="s-t"><input id="check_4" type="checkbox" value="4" checked="checked"><span class="checkbox"></span></label></td><td class="A addRecordField host-column a-l overflowHidden"><div class="overflowHiddenContainer"><div title="'+ domain +'" class="overflowHiddenContent showArecordTitle">'+ domain + '</div></div></td><td>A</td><td class="pointsto-column a-l overflowHidden"><div class="overflowHiddenContainer"><div title="216.239.38.21" class="showArecordTitle overflowHiddenContent">216.239.38.21</div></div></td><td>3600</td></tr>'; 8374 } else if (template == 'shopify') { 8375 records += '<tr class="Arecord"><td class="checkbox-cell a-l"><label class="s-t"><input id="check_1" type="checkbox" value="1" checked="checked"><span class="checkbox"></span></label></td><td class="A addRecordField noHost host-column a-l overflowHidden"><div class="overflowHiddenContainer"><div title="'+ domain +'" class="overflowHiddenContent showArecordTitle">' + domain + '</div></div></td><td>A</td><td class="pointsto-column a-l overflowHidden"><div class="overflowHiddenContainer"><div title="' + $('#ltoken').val() + '" class="newPointsTo record overflowHiddenContent showArecordTitle">' + $('#ltoken').val() +'</div></div></td><td>3600</td></tr>'; 8376 } 8377 8378 if (host == 'www') { 8379 $('.Arecord').remove(); 8380 $('#templatesRecordsBody').prepend(records); 8381 } else { 8382 $('.Arecord').remove(); 8383 } 8384 8385 $(".showArecordTitle").tooltip({ 8386 track: true, 8387 delay: 0, 8388 showURL: false, 8389 showBody: "<body>", 8390 fade: 250 8391 }); 8392} 8393 8394function templates_updateRecordstokens (domain, record) { 8395 var stoken = htmlspecialchars($('#stoken').val()); 8396 var ltoken = htmlspecialchars($('#ltoken').val()); 8397 8398 var newRecord = ''; 8399 if(typeof(record) != "undefined") { 8400 newRecord = '.' + record; 8401 if (record == '') { 8402 newRecord = record; 8403 } 8404 } 8405 8406 var explodedLtokenName = shortenLongString(ltoken + newRecord, 25); 8407 var explodedStokenName = shortenLongString(stoken + '.' + domain, 25); 8408 8409 if(typeof(stoken) != "undefined" && stoken !== null) { 8410 $('#newStoken').html(stoken + '.' + domain); 8411 $('#newStoken').prop('title', explodedStokenName); 8412 $('#newStoken').addClass('showRecordTitle'); 8413 } 8414 if(typeof(ltoken) != "undefined" && ltoken !== null) { 8415 $('#newLtoken').html(ltoken + newRecord); 8416 $('#newLtoken').prop('title', explodedLtokenName); 8417 $('#newLtoken').addClass('showRecordTitle'); 8418 } 8419 checkWidth('table-h-scroll.templates-table'); 8420 $(".showRecordTitle").tooltip({ 8421 track: true, 8422 delay: 0, 8423 showURL: false, 8424 showBody: "<body>", 8425 fade: 250 8426 }); 8427} 8428 8429function templates_updateRecordsMXtoken (domain, record) { 8430 var mxtoken = $('#mxtoken').val(); 8431 var newMX = htmlspecialchars(mxtoken + '.' + record); 8432 var shortMXname = shortenLongString(newMX, 25); 8433 8434 if(typeof(mxtoken) != "undefined" && mxtoken !== null) { 8435 $('#newMXtoken').html(newMX); 8436 $('#newMXtoken').prop('title', shortMXname); 8437 $('#newMXtoken').addClass('showRecordTitle'); 8438 $(".newMXtoken, .showRecordTitle").tooltip({ 8439 track: true, 8440 delay: 0, 8441 showURL: false, 8442 showBody: "<body>", 8443 fade: 250 8444 }); 8445 checkWidth('table-h-scroll.templates-table'); 8446 } 8447} 8448 8449function templates_updateWixHostname(domain) { 8450 var wixHostname = $('#wixHostname').val(); 8451 8452 if (typeof(wixHostname) != "undefined" && wixHostname !== null) { 8453 var escapedHostname = $('<div>').text(wixHostname).html(); 8454 var shortRecord = shortenLongString(escapedHostname, 25); 8455 $('.newWixHostname').text(escapedHostname); 8456 $('.newWixHostname').prop('title', shortRecord); 8457 $('.newWixHostname').addClass('showRecordTitle'); 8458 } 8459 8460 checkWidth('table-h-scroll.templates-table'); 8461 $(".showRecordTitle").tooltip({ 8462 track: true, 8463 delay: 0, 8464 showURL: false, 8465 showBody: "<body>", 8466 fade: 250 8467 }); 8468} 8469 8470function templates_updateRecordsSRVtoken(domain, additionalData) { 8471 var srvToken = $('#srvToken').val(); 8472 8473 if (typeof(srvToken) != "undefined" && srvToken !== null) { 8474 $('.newSRVtoken').each(function() { 8475 var existingData = $(this).attr('data-additional-data'); 8476 var newRecord = ''; 8477 8478 if (typeof(existingData) === 'undefined' || existingData === null) { 8479 newRecord = htmlspecialchars(srvToken); 8480 } else { 8481 newRecord = htmlspecialchars(existingData + ' ' + srvToken); 8482 } 8483 8484 var shortSRVname = shortenLongString(newRecord, 25); 8485 8486 $(this).html(newRecord); 8487 $(this).prop('title', shortSRVname); 8488 $(this).addClass('showRecordTitle'); 8489 $(this).tooltip({ 8490 track: true, 8491 delay: 0, 8492 showURL: false, 8493 showBody: "<body>", 8494 fade: 250 8495 }); 8496 }); 8497 checkWidth('table-h-scroll.templates-table'); 8498 } 8499} 8500 8501function templates_updateRecordPointsTo (domain, record) { 8502 var host = htmlspecialchars($('#host').val()); 8503 8504 if (typeof(record) == "undefined") { 8505 var record = htmlspecialchars($('#ltoken').val()); 8506 } 8507 8508 var shortHostName = shortenLongString(host + '.' + domain + '.' + record, 25); 8509 var shortRecordName = shortenLongString(record, 25); 8510 8511 if(typeof(host) != "undefined" && host !== null) { 8512 $('#newPointsTo').html(host + '.' + domain + '.' + record); 8513 $('#newPointsTo').prop('title', shortHostName); 8514 $('#newPointsTo').addClass('showRecordTitle'); 8515 $('.newPointsTo').html(record); 8516 $('.newPointsTo').prop('title', shortRecordName); 8517 $('.newPointsTo').addClass('showRecordTitle'); 8518 8519 $(".showRecordTitle").tooltip({ 8520 track: true, 8521 delay: 0, 8522 showURL: false, 8523 showBody: "<body>", 8524 fade: 250 8525 }); 8526 checkWidth('table-h-scroll.templates-table'); 8527 } 8528} 8529 8530function templates_updateRecordPointsToWithoutHost(domain, record) { 8531 var host = 'mail'; 8532 if (typeof (record) == "undefined") { 8533 var record = htmlspecialchars($('#ltoken').val()); 8534 } 8535 8536 var shortHostName = shortenLongString(host + '.' + domain + '.' + record, 25); 8537 var shortRecordName = shortenLongString(record, 25); 8538 8539 $('#newPointsTo').html(host + '.' + domain + '.' + record); 8540 $('#newPointsTo').prop('title', shortHostName); 8541 $('#newPointsTo').addClass('showRecordTitle'); 8542 $('.newPointsTo').html(record); 8543 $('.newPointsTo').prop('title', shortRecordName); 8544 $('.newPointsTo').addClass('showRecordTitle'); 8545 8546 $(".showRecordTitle").tooltip({ 8547 track: true, 8548 delay: 0, 8549 showURL: false, 8550 showBody: "<body>", 8551 fade: 250 8552 }); 8553 checkWidth('table-h-scroll.templates-table'); 8554} 8555
8556function templates_updateRecordGitHub (domain, record) { 8557 var record = htmlspecialchars($('#ltoken').val()) + '.' + record; 8558 var shortRecord = shortenLongString(record, 25); 8559 8560 $('.newPointsTo').html('<div title="' + shortRecord +'" class="overflowHiddenContent showRecordTitle">' + record + '</div>'); 8561 8562 $(".showRecordTitle").tooltip({ 8563 track: true, 8564 delay: 0, 8565 showURL: false, 8566 showBody: "<body>", 8567 fade: 250 8568 }); 8569 checkWidth('table-h-scroll.templates-table'); 8570} 8571 8572function templates_chooseVerification (domain, record) { 8573 var host = htmlspecialchars($('#stoken').val()); 8574 8575 var shortRecordName = shortenLongString(record, 25); 8576 var shortHostName = shortenLongString(host + '.' + domain, 25); 8577 8578 $('#verify-record').remove(); 8579 $('#proveOwnership').css('display', 'none'); 8580 if ($('#verify').is(':checked')) { 8581 $('#proveOwnership').css('display', 'inline'); 8582 $('#templatesRecordsBody').append('<tr id="verify-record"><td class="checkbox-cell a-l"><label class="s-t"><input id="check_verifycheck" type="checkbox" value="verifycheck" checked="checked"><span class="checkbox"></span></label></td><td class="verify host-column a-l overflowHidden"><div class="CNAME overflowHiddenContainer"><div title="' + shortHostName + '" id="newStoken" class="overflowHiddenContent showRecordTitle">' + host + '.' + domain + '</div></div></td><td>CNAME</td><td class="pointsto-column a-l overflowHidden"><div class="overflowHiddenContainer"><div class="newHost overflowHiddenContent showRecordTitle" title="' + shortRecordName + '">' + record + '</div></div></td><td>3600</td></tr>'); 8583 $(".showRecordTitle").tooltip({ 8584 track: true, 8585 delay: 0, 8586 showURL: false, 8587 showBody: "<body>", 8588 fade: 250 8589 }); 8590 checkWidth('table-h-scroll.templates-table'); 8591 fixPopupPosition('#cloudnspop'); 8592 } 8593} 8594 8595function templates_chooseVerificationMethod (domain, record) { 8596 var host = htmlspecialchars($('#stoken').val()); 8597 var hostname = ''; 8598 var shortHost = ''; 8599 8600 $('#verify-record').remove(); 8601 $('#proveOwnership').css('display', 'none'); 8602 8603 if ($('#verify-CNAME').is(':checked')) { 8604 if (host !== null) { 8605 shortHost = shortenLongString(domain, 25); 8606 hostname = domain; 8607 } else { 8608 shortHost = shortenLongString(host + '.' + domain, 25); 8609 hostname = host + '.' + domain; 8610 } 8611 8612 var shortRecord = shortenLongString(record, 25); 8613 $('#proveOwnership').css('display', 'inline'); 8614 $('#templatesRecordsBody').append('<tr id="verify-record"><td class="checkbox-cell a-l"><label class="s-t"><input id="check_cnamecheck" type="checkbox" value="cnamecheck" checked="checked"><span class="checkbox"></span></label></td><td class="verify addRecordField host-column a-l overflowHidden"><div class="overflowHiddenContainer"><div class="help overflowHiddenContent showTitle" title="' + shortHost + '">' + hostname + '</div></div></td><td>CNAME</td><td class="pointsto-column a-l overflowHidden"><div class="overflowHiddenContainer"><div class="newHost overflowHiddenContent showTitle" title="' + shortRecord + '">' + record + '</div></div></td><td>3600</td></tr>'); 8615 } 8616 if ($('#verify-TXT').is(':checked')) { 8617 var splitedRecord = record.split("="); 8618 var shortHost = shortenLongString(splitedRecord[0] + '=' + host
8618+ '.' + splitedRecord[1], 25); 8619 $('#proveOwnership').css('display', 'inline'); 8620 $('#templatesRecordsBody').append('<tr id="verify-record"><td class="checkbox-cell a-l"><label class="s-t"><input id="check_txtcheck" type="checkbox" value="txtcheck" checked="checked"><span class="checkbox"></span></label></td><td class="verify host-column a-l overflowHidden"><div class="overflowHiddenContainer"><div class="TXT addRecordField help overflowHiddenContent showRecordTitle" title="' + domain + '">' + domain + '"</div></div></td><td>TXT</td><td class="pointsto-column a-l overflowHidden"><div class="overflowHiddenContainer"><div class="newHost overflowHiddenContent showRecordTitle" title="' + shortHost + '">' + splitedRecord[0] + '=' + host + '.' + splitedRecord[1] + '</div></div></td><td>3600</td></tr>'); 8621 } 8622 $(".showRecordTitle").tooltip({ 8623 track: true, 8624 delay: 0, 8625 showURL: false, 8626 showBody: "<body>", 8627 fade: 250 8628 }); 8629} 8630 8631function templates_updateZohoToken (domain, cname, txt) { 8632 var host = htmlspecialchars($('#stoken').val()); 8633 8634 if ($('#verify-CNAME').is(':checked')) { 8635 var shortHost = shortenLongString(host + '.' + domain, 25); 8636 var shortRecord = shortenLongString(cname, 25); 8637 $('#templatesRecordsBody #verify-record').html('<td class="checkbox-cell a-l"><label class="s-t"><input id="check_cnamecheck" type="checkbox" value="cnamecheck" checked="checked"><span class="checkbox"></span></label></td><td class="verify addRecordField host-column a-l overflowHidden"><div class="CNAME overflowHiddenContainer"><div class="overflowHiddenContent showRecordTitle" title="' + shortHost + '">' + host + '.' + domain + '</div></div></td><td>CNAME</td><td class="pointsto-column a-l overflowHidden"><div class="overflowHiddenContainer"><div class="newHost overflowHiddenContent showRecordTitle" title="' + shortRecord + '">' + cname + '</div></div></td><td>3600</td>'); 8638 } 8639 if ($('#verify-TXT').is(':checked')) { 8640 var splitedRecord = txt.split("="); 8641 var shortHost = shortenLongString(splitedRecord[0] + '=' + host
8641+ splitedRecord[1], 25); 8642 $('#templatesRecordsBody #verify-record').html('<td class="checkbox-cell a-l"><label class="s-t"><input id="check_txtcheck" type="checkbox" value="txtcheck" checked="checked"><span class="checkbox"></span></label></td><td class="verify host-column a-l overflowHidden"><div class="TXT overflowHiddenContainer"><div title = "' + domain + '" class="TXT addRecordField overflowHiddenContent showRecordTitle">' + domain + '</div></div></td><td>TXT</td><td class="pointsto-column a-l overflowHidden"><div class="overflowHiddenContainer"><div class="newHost overflowHiddenContent showRecordTitle" title="' + shortHost + '">' + splitedRecord[0] + '=' + host + splitedRecord[1] + '</div></div></td><td>3600</td>'); 8643 } 8644 8645 $(".showRecordTitle").tooltip({ 8646 track: true, 8647 delay: 0, 8648 showURL: false, 8649 showBody: "<body>", 8650 fade: 250 8651 }); 8652 checkWidth('table-h-scroll.templates-table'); 8653} 8654 8655function templates_updateProveOwnership (domain) { 8656 if ($('#wr').is(':checked')) { 8657 $('#txttokenWrap').css('display', 'inline'); 8658 $('#templatesRecordsBody').append('<tr id="TXTrecord"><td class="checkbox-cell a-l"><label class="s-t"><input id="check_txtcheck" type="checkbox" value="txtcheck" checked="checked"><span class="checkbox"></span></label></td><td class="TXT host-column a-l overflowHidden"><div class="overflowHiddenContainer"><div title="'+ domain +'" class="overflowHiddenContent showRecordTitle">' + domain + '</div></div></td><td>TXT</td><td class="pointsto-column a-l overflowHidden"><div class="overflowHiddenContainer"><div id="newTXT" clas="overflowHiddenContent showRecordTitle" title="mailru-domain:"></div></div></td><td>3600</td></tr>'); 8659 $(".showRecordTitle").tooltip({ 8660 track: true, 8661 delay: 0, 8662 showURL: false, 8663 showBody: "<body>", 8664 fade: 250 8665 }); 8666 } else { 8667 $('#txttokenWrap').css('display', 'none'); 8668 $('#TXTrecord').remove(); 8669 } 8670} 8671 8672function templates_updateTXTtoken (domain) { 8673 if ($('#wr').is(':checked')) { 8674 var txtrecord = htmlspecialchars($('#ltoken').val()); 8675 var shortRecord = shortenLongString(txtrecord, 25); 8676 $('#TXTrecord').html('<td class="checkbox-cell a-l"><label class="s-t"><input id="check_txtcheck" type="checkbox" value="txtcheck" checked="checked"><span class="checkbox"></span></label></td><td class="TXT host-column a-l overflowHidden"><div class="overflowHiddenContainer"><div class="help showMXTitle overflowHiddenContent" title="' + domain + '">' + domain + '</div></div></td><td>TXT</td><td class="pointsto-column a-l overflowHidden"><div class="overflowHiddenContainer"><div id="newTXT" title="' + shortRecord + '" class="showMXTitle overflowHiddenContent">' + txtrecord + '</div></div></td><td>3600</td>'); 8677 $(".showMXTitle").tooltip({ 8678 track: true, 8679 delay: 0, 8680 showURL: false, 8681 showBody: "<body>", 8682 fade: 250 8683 }); 8684 } else { 8685 $('#TXTrecord').remove(); 8686 } 8687} 8688 8689function templates_updateMXhost (domain) { 8690 var newHost = htmlspecialchars($('#host').val()); 8691 var shortName = shortenLongString(newHost + '.' + domain, 32); 8692 8693 if (newHost != '') { 8694 $('.MX').html('<div title="' + shortName + '" class="newHost showRecordTitle overflowHiddenContent">' + newHost + '.' + domain + '</div>'); 8695 } else { 8696 $('.MX').html('<div title="' + domain + '" class="newHost showRecordTitle overflowHiddenContent">' + domain + '</div>'); 8697 } 8698 $(".showRecordTitle").tooltip({ 8699 track: true, 8700 delay: 0, 8701 showURL: false, 8702 showBody: "<body>", 8703 fade: 250 8704 }); 8705 checkWidth('table-h-scroll.templates-table'); 8706} 8707 8708function shortenLongString (string, cutBy) { 8709 var title = ''; 8710 8711 for (var i = 0; i < string.length; i++) { 8712 var part = string.substr(i * cutBy, cutBy); 8713 8714 if (part.length > 0) { 8715 title += part +'<br>'; 8716 } 8717 } 8718 8719 return title; 8720} 8721 8722function templates_updateAhost (domain) { 8723 var newHost = htmlspecialchars($('#host').val()); 8724 var shortHost = shortenLongString(newHost + '.' + domain, 25) 8725 8726 if (newHost != '') { 8727 $('.A').html('<div title="' + shortHost + '" class="newHost overflowHiddenContent showArecordTitle">' + newHost + '.' + domain + '</div>'); 8728 $('#newRecord').html(newHost + '.' + domain); 8729 $('#newRecord').prop('title', shortHost); 8730 $('#newRecord').addClass('showArecordTitle'); 8731 } else { 8732 $('.A').html('<div title="' + domain + '" class="newHost overflowHiddenContent showArecordTitle">' + domain + '</div>'); 8733 $('#newRecord').html('minecraft.' + domain); 8734 $('#newRecord').prop('title', 'minecraft.' + domain); 8735 $('#newRecord').addClass('showArecordTitle'); 8736 } 8737 $(".newHost, .showArecordTitle").tooltip({ 8738 track: true, 8739 delay: 0, 8740 showURL: false, 8741 showBody: "<body>", 8742 fade: 250 8743 }); 8744 checkWidth('table-h-scroll.templates-table'); 8745} 8746 8747function templates_updateRecordCloludcone (domain, record) { 8748 var newRecord = record + htmlspecialchars($('#ltoken').val()); 8749 var shortRecord = shortenLongString(newRecord, 25); 8750 8751 $('#newLtoken').html(newRecord); 8752 $('#newLtoken').prop('title', shortRecord); 8753 $('#newLtoken').addClass('showRecordTitle'); 8754 8755 $(".showRecordTitle").tooltip({ 8756 track: true, 8757 delay: 0, 8758 showURL: false, 8759 showBody: "<body>", 8760 fade: 250 8761 }); 8762 checkWidth('table-h-scroll.templates-table'); 8763} 8764 8765function templates_updateHostTeamspeak (domain) { 8766 var host = htmlspecialchars($('#host').val()); 8767 if (host != '') { 8768 var newHost = host + '.' + domain; 8769 } else { 8770 var newHost = domain; 8771 } 8772 $('#newSRVRecord').html('<div class="help" style="width: 210px; overflow: hidden;" title="' + newHost + '" class="newRecord fleft">' + newHost + '</div>'); 8773 $(".help").tooltip({ 8774 track: true, 8775 delay: 0, 8776 showURL: false, 8777 showBody: "<body>", 8778 fade: 250 8779 }); 8780} 8781function templates_updateTeamspeak (domain, additional_data) { 8782 var host = htmlspecialchars($('#host').val()); 8783 if (host != '') { 8784 var record = $('#host').val() + '.' + domain; 8785 } else { 8786 var record = domain; 8787 } 8788 var newRecord = additional_data + ' ' + htmlspecialchars($('#stoken').val()) + ' ' + record; 8789 var shortRecord = shortenLongString(newRecord, 25); 8790 8791 $('#newSRVRecord').html('<div class="overflowHiddenContent showSRVRecordTitle" title="' + shortRecord + '">' + newRecord + '</div>'); 8792 $(".showSRVRecordTitle").tooltip({ 8793 track: true, 8794 delay: 0, 8795 showURL: false, 8796 showBody: "<body>", 8797 fade: 250 8798 }); 8799} 8800 8801var blockFormSubmit = false;
8802function templates_activate(zone, template, deactivateRecords) { 8803 if (blockFormSubmit == true) { 8804 return false; 8805 } 8806 blockFormSubmit = true; 8807 var host = htmlspecialchars($('#host').val()); 8808 8809 var checkedRecords = []; 8810 $('#templatesRecordsBody input:checked').each(function() { 8811 checkedRecords.push($(this).val()); 8812 }); 8813 8814 var mobile = false; 8815 if ($('.popup').width() < 1024) { 8816 mobile = true; 8817 } 8818 8819 blockButton('activateButton', 'activate_template_loading'); 8820 $.post(AJAXACTIONS_URL + '?action=templates', { 8821 'show': 'activate', 8822 'zone': zone, 8823 'host': host, 8824 'template': template, 8825 'wr': $('input#wr').is(':checked') ? 1 : 0, 8826 'verify': $('input#verify').is(':checked') ? 1 : 0, 8827 'verify-TXT': $('input#verify-TXT').is(':checked') ? 1 : 0, 8828 'verify-CNAME': $('input#verify-CNAME').is(':checked') ? 1 : 0, 8829 'pointsto': $('#pointsto').val(), 8830 'stoken': $('#stoken').val(), 8831 'ltoken': $('#ltoken').val(), 8832 'mxtoken': $('#mxtoken').val(), 8833 'srvtoken': $('#srvToken').val(), 8834 'wixHostname': $('#wixHostname').val(), 8835 'checkedRecords': checkedRecords, 8836 'recordsForDeactivation' : deactivateRecords, 8837 'mobile': mobile 8838 }, function(data) { 8839 $.each($('#templates-form input'), function (index, element) { 8840 $(element).tipsy('hide'); 8841 }); 8842 $.each($('#templates-form div'), function (index, element) { 8843 $(element).tipsy('hide'); 8844 }); 8845 8846 response = JSON.parse(data); 8847 8848 $('#templates-form').data('errors', ''); 8849 8850 if (typeof(response.action) != 'undefined') { 8851 eval(response.action); 8852 } else if (response.status == 0) { 8853 unBlockButton('activateButton', 'activate_template_loading'); 8854 blockFormSubmit = false; 8855 if (typeof(response.message) != 'undefined') { 8856 showPopupMessage(response.message); 8857 } else if (typeof(response.deactivateCollidingRecords) != 'undefined'){ 8858 showConfirmation(response.warning, function () { 8859 templates_activate(zone, template, response.deactivateCollidingRecords); 8860 }); 8861 } else { 8862 $('#templates-form').data('errors', response.errors); 8863 if ($('#templates-form').length > 0 && typeof $('#templates-form').data('errors') != 'undefined') { 8864 var popupMessage = ''; 8865 $.each($('#templates-form').data('errors'), function(index, error) { 8866 $.each(error, function(type, message) { 8867 popupMessage += message + '<br>'; 8868 if (mobile !== true) { 8869 $.each($('.' + type), function (index, element) { 8870 $(element).attr('title', message); 8871 $(element).tipsy({ 8872 gravity: 'w', 8873 trigger: 'manual', 8874 html: false 8875 }); 8876 $(element).tipsy('show'); 8877 8878 addCloudPageCallBack(function () { 8879 $(element).tipsy('hide'); 8880 }); 8881 }); 8882 } 8883 }); 8884 }); 8885 if (mobile === true) { 8886 showPopupMessage(popupMessage); 8887 $.each($('#templates-form input'), function (index, element) { 8888 $(element).tipsy('hide'); 8889 }); 8890 } 8891 } 8892 8893 $(window).resize(function(){ 8894 if ($('.popup').width() < 1024) { 8895 mobile = true; 8896 } else { 8897 mobile = false; 8898 } 8899 if ($('#templates-form').length > 0 && typeof $('#templates-form').data('errors') != 'undefined') { 8900 $.each($('#templates-form').data('errors'), function(index, error) { 8901 $.each(error, function(type, message) { 8902 popupMessage = message; 8903 if (mobile !== true) { 8904 $.each($('.' + type), function (index, element) { 8905 $(element).attr('title', message); 8906 $(element).tipsy({ 8907 gravity: 'w', 8908 trigger: 'manual', 8909 html: false 8910 }); 8911 $(element).tipsy('show'); 8912 8913 addCloudPageCallBack(function () { 8914 $(element).tipsy('hide'); 8915 $(window).off('resize'); 8916 }); 8917 }); 8918 } 8919 }); 8920 }); 8921 8922 if (mobile === true) { 8923 showPopupMessage(popupMessage); 8924 $.each($('#templates-form input'), function (index, element) { 8925 $(element).tipsy('hide'); 8926 }); 8927 } else { 8928 hidePopupMessage(); 8929 } 8930 } 8931 }); 8932 } 8933 } else { 8934 $('.addRecordField').tipsy('hide'); 8935 $('.record').tipsy('hide'); 8936 window.location = '/records/domain/' + zone + '/'; 8937 } 8938 }); 8939} 8940 8941function forcedTitleHide () { 8942 $("#tooltip").hide(); 8943} 8944 8945/* ********************* */ 8946/* API */ 8947/* ********************* */ 8948
8949function api_addNewUser () { 8950 $.post(AJAXACTIONS_URL + '?action=api-settings', { 8951 'action': 'addNewUser', 8952 'password': $('#password').val(), 8953 'ip': $('#ip').val() 8954 }, function(data) { 8955 response = JSON.parse(data); 8956 if (response.status == 0) { 8957 showPopupMessage(response.message); 8958 } else { 8959 hidePopup(); 8960 insideCloudPage("apiUsers", "api-settings", "&show=apiUsers&page=" + response.page); 8961 } 8962 }); 8963} 8964 8965function api_changePassword (page) { 8966 $.post(AJAXACTIONS_URL + '?action=api-settings', { 8967 'action': 'changePassword', 8968 'auth-id': $('#auth-id').val(), 8969 'password': $('#password').val() 8970 }, function(data) { 8971 response = JSON.parse(data); 8972 if (response.status == 0) { 8973 showPopupMessage(response.message); 8974 } else { 8975 hidePopup(); 8976 insideCloudPage("apiUsers", "api-settings", "&show=apiUsers&page=" + page); 8977 showPopupMessage(response.message); 8978 } 8979 }); 8980} 8981 8982function api_addNewIP (page) { 8983 $.post(AJAXACTIONS_URL + '?action=api-settings', { 8984 'action': 'addNewIp', 8985 'auth-id': $('#auth-id').val(), 8986 'ip': $('#ip').val() 8987 }, function(data) { 8988 response = JSON.parse(data); 8989 if (response.status == 0) { 8990 showPopupMessage(response.message); 8991 } else { 8992 hidePopup(); 8993 insideCloudPage("apiUsers", "api-settings", "&show=apiUsers&page=" + page); 8994 showPopupMessage(response.message); 8995 } 8996 }); 8997} 8998 8999function api_changeStatus (authid, page, warning) { 9000 showConfirmation(warning, function () { 9001 $.post(AJAXACTIONS_URL + '?action=api-settings', { 9002 'action': 'changeStatus', 9003 'auth-id': authid 9004 }, function(data) { 9005 response = JSON.parse(data); 9006 if (response.status == 0) { 9007 showPopupMessage(response.message); 9008 } else { 9009 hidePopup(); 9010 insideCloudPage("apiUsers", "api-settings", "&show=apiUsers&page=" + page); 9011 } 9012 }); 9013 }); 9014} 9015 9016function api_deleteIP (authid, ip, page, warning) { 9017 showConfirmation(warning, function () { 9018 $.post(AJAXACTIONS_URL + '?action=api-settings', { 9019 'action': 'deleteIp', 9020 'auth-id': authid, 9021 'ip': ip 9022 }, function(data) { 9023 response = JSON.parse(data); 9024 if (response.status == 0) { 9025 showPopupMessage(response.message); 9026 } else { 9027 hidePopup(); 9028 insideCloudPage("apiUsers", "api-settings", "&show=apiUsers&page=" + page); 9029 } 9030 }); 9031 }); 9032} 9033 9034function api_deleteUser (authid, warning, page) { 9035 showConfirmation(warning, function () { 9036 $.post(AJAXACTIONS_URL + '?action=api-settings', { 9037 'action': 'deleteUser', 9038 'auth-id': authid, 9039 'page': page 9040 }, function(data) { 9041 response = JSON.parse(data); 9042 if (response.status == 0) { 9043 showPopupMessage(response.message); 9044 } else { 9045 hidePopup(); 9046 insideCloudPage("apiUsers", "api-settings", "&show=apiUsers&page=" + response.page); 9047 } 9048 }); 9049 }); 9050} 9051 9052/* sub users */ 9053function api_addNewSubUser () { 9054 $.post(AJAXACTIONS_URL + '?action=api-settings', { 9055 'action': 'addNewSubUser', 9056 'user': $('#user').val(), 9057 'password': $('#password').val(), 9058 'ip': $('#ip').val(), 9059 'zones': $('#zones').val(), 9060 'mailforwards': $('#mailforwards').val(), 9061 'failover_checks': $('#failover_checks').val(), 9062 'monitoring_checks': $('#monitoring_checks').val(), 9063 'records': $('#records').val(), 9064 'access_level': $('input[name="access_level"]:checked').val(), 9065 9066 }, function(data) { 9067 response = JSON.parse(data); 9068 if (response.status == 0) { 9069 showPopupMessage(response.message); 9070 } else { 9071 hidePopup(); 9072 insideCloudPage("apiSubUsers", "api-settings", "&show=apiSubUsers&page=" + response.page); 9073 } 9074 }); 9075} 9076 9077function api_changeSubPassword (page) { 9078 $.post(AJAXACTIONS_URL + '?action=api-settings', { 9079 'action': 'changeSubPassword', 9080 'auth-id': $('#auth-id').val(), 9081 'password': $('#password').val() 9082 }, function(data) { 9083 response = JSON.parse(data); 9084 if (response.status == 0) { 9085 showPopupMessage(response.message); 9086 } else { 9087 hidePopup(); 9088 insideCloudPage("apiSubUsers", "api-settings", "&show=apiSubUsers&page=" + page); 9089 showPopupMessage(response.message); 9090 } 9091 }); 9092} 9093 9094function api_addNewSubIP (page) { 9095 $.post(AJAXACTIONS_URL + '?action=api-settings', { 9096 'action': 'addNewSubIp', 9097 'auth-id': $('#auth-id').val(), 9098 'ip': $('#ip').val() 9099 }, function(data) { 9100 response = JSON.parse(data); 9101 if (response.status == 0) { 9102 showPopupMessage(response.message); 9103 } else { 9104 hidePopup(); 9105 insideCloudPage("apiSubUsers", "api-settings", "&show=apiSubUsers&page=" + page); 9106 showPopupMessage(response.message); 9107 } 9108 }); 9109} 9110 9111function api_changeSubStatus (authid, job, page) { 9112 $.post(AJAXACTIONS_URL + '?action=api-settings', { 9113 'action': 'changeSubStatus', 9114 'auth-id': authid, 9115 'job': job, 9116 'remove_zones_delegation': $('#edit_zone_delegation').prop('checked') ? 1 : 0 9117 }, function (data) { 9118 response = JSON.parse(data); 9119 if (response.status == 0) { 9120 showPopupMessage(response.message); 9121 } else { 9122 hidePopup(); 9123 insideCloudPage("apiSubUsers", "api-settings", "&show=apiSubUsers&page=" + page); 9124 } 9125 }); 9126} 9127 9128function api_deleteSubIP (authid, ip, page, warning) { 9129 showConfirmation(warning, function () { 9130 $.post(AJAXACTIONS_URL + '?action=api-settings', { 9131 'action': 'deleteSubIp', 9132 'auth-id': authid, 9133 'ip': ip 9134 }, function(data) { 9135 response = JSON.parse(data); 9136 if (response.status == 0) { 9137 showPopupMessage(response.message); 9138 } else { 9139 hidePopup(); 9140 insideCloudPage("apiSubUsers", "api-settings", "&show=apiSubUsers&page=" + page); 9141 } 9142 }); 9143 }); 9144} 9145 9146function api_deleteSubUser (authid, warning, page) { 9147 showConfirmation(warning, function () { 9148 $.post(AJAXACTIONS_URL + '?action=api-settings', { 9149 'action': 'deleteSubUser', 9150 'auth-id': authid, 9151 'page': page 9152 }, function(data) { 9153 response = JSON.parse(data); 9154 if (response.status == 0) { 9155 showPopupMessage(response.message); 9156 } else { 9157 hidePopup(); 9158 insideCloudPage("apiSubUsers", "api-settings", "&show=apiSubUsers&page=" + response.page); 9159 } 9160 }); 9161 }); 9162} 9163 9164function api_getSubUserZones (authid, page) { 9165 insideCloudPage('apiSubUserZones', 'api-settings', '&show=subUserZonesList&auth-id=' + authid + '&page=' + page, function() { 9166 $('#apiSubUserZones a').tooltip({showURL: false}); 9167 fixPopupPosition('#cloudnspop'); 9168 }); 9169} 9170 9171function api_getSubUserMonitorings (authid, page) { 9172 insideCloudPage('apiSubUserMonitoringChecks', 'api-settings', '&show=subUserMonitoringChecksList&auth-id=' + authid + '&page=' + page, function() { 9173 $('#apiSubUserMonitoringChecks a').tooltip({showURL: false}); 9174 fixPopupPosition('#cloudnspop'); 9175 }); 9176} 9177 9178function api_getSubUserRegisteredDomains (authid, page) { 9179 insideCloudPage('apiSubUserRegisteredDomains', 'api-settings', '&show=subUserRegisteredDomainsList&auth-id=' + authid + '&page=' + page, function() { 9180 $('#apiSubUserRegisteredDomains a').tooltip({showURL: false}); 9181 fixPopupPosition('#cloudnspop'); 9182 }); 9183} 9184 9185var blockApiDelegateMonitorings = false;
9186function api_delegateMonitoringCheck (authid, page) { 9187 if (blockApiDelegateMonitorings == true) { 9188 return false; 9189 } 9190 blockApiDelegateMonitorings = true; 9191 blockButton('apiDelegateMonitoringButton', 'apiDelegateMonitoring_loading', 'block'); 9192 9193 $.post(AJAXACTIONS_URL + '?action=api-settings', { 9194 'action': 'delegateMonitoring', 9195 'auth-id': authid, 9196 'monitoring-id': $('#monitoringRecords').select().val() 9197 }, function(data) { 9198 unBlockButton('apiDelegateMonitoringButton', 'apiDelegateMonitoring_loading', 'block'); 9199 blockApiDelegateMonitorings = false; 9200 response = JSON.parse(data); 9201 if (response.status == 0) { 9202 showPopupMessage(response.message); 9203 } else { 9204 showPopup('api-settings', '&show=subUserMonitoringChecks&auth-id=' + authid + '&page=' + page); 9205 insideCloudPage("apiSubUsers", "api-settings", "&show=apiSubUsers&page=" + page); 9206 } 9207 }); 9208} 9209 9210function api_deleteMonitoringCheckDelegation (authid, monitoringid, warning, page) { 9211 showConfirmation(warning, function () { 9212 $.post(AJAXACTIONS_URL + '?action=api-settings', { 9213 'action': 'deleteMonitoringCheckDelegation', 9214 'auth-id': authid, 9215 'monitoring-id': monitoringid 9216 }, function(response) { 9217 if (response.status == 0) { 9218 showPopupMessage(response.message); 9219 } else { 9220 showPopup('api-settings', '&show=subUserMonitoringChecks&auth-id=' + authid + '&page=' + page); 9221 insideCloudPage("apiSubUsers", "api-settings", "&show=apiSubUsers&page=" + page); 9222 } 9223 }, 'json'); 9224 }); 9225} 9226 9227var blockApiDelegateZone = false; 9228function api_delegateZone (authid, page) { 9229 if (blockApiDelegateZone == true) { 9230 return false; 9231 } 9232 blockApiDelegateZone = true; 9233 blockButton('apiDelegateZoneButton', 'apiDelegateZone_loading', 'block'); 9234 9235 $.post(AJAXACTIONS_URL + '?action=api-settings', { 9236 'action': 'delegateZone', 9237 'auth-id': authid, 9238 'zone-id': $('#zones').select().val() 9239 }, function(data) { 9240 unBlockButton('apiDelegateZoneButton', 'apiDelegateZone_loading', 'block'); 9241 blockApiDelegateZone = false; 9242 response = JSON.parse(data); 9243 if (response.status == 0) { 9244 showPopupMessage(response.message); 9245 } else { 9246 showPopup('api-settings', '&show=subUserZones&auth-id=' + authid + '&page=' + page); 9247 insideCloudPage("apiSubUsers", "api-settings", "&show=apiSubUsers&page=" + page); 9248 } 9249 }); 9250} 9251 9252function api_deleteZoneDelegation (authid, zoneid, warning, page) { 9253 showConfirmation(warning, function () { 9254 $.post(AJAXACTIONS_URL + '?action=api-settings', { 9255 'action': 'deleteZoneDelegation', 9256 'auth-id': authid, 9257 'zone-id': zoneid 9258 }, function(data) { 9259 response = JSON.parse(data); 9260 if (response.status == 0) { 9261 showPopupMessage(response.message); 9262 } else { 9263 showPopup('api-settings', '&show=subUserZones&auth-id=' + authid + '&page=' + page); 9264 insideCloudPage("apiSubUsers", "api-settings", "&show=apiSubUsers&page=" + page); 9265 } 9266 }); 9267 }); 9268} 9269 9270var blockApiDelegateRegisteredDomain = false; 9271function api_delegateRegisteredDomain (authid, page) { 9272 if (blockApiDelegateRegisteredDomain == true) { 9273 return false; 9274 } 9275 blockApiDelegateRegisteredDomain = true; 9276 blockButton('apiDelegateRegisteredDomainButton', 'apiDelegateRegisteredDomain_loading', 'block'); 9277 9278 $.post(AJAXACTIONS_URL + '?action=api-settings', { 9279 'action': 'delegateRegisteredDomain', 9280 'auth-id': authid, 9281 'domain-id': $('#registeredDomains').select().val() 9282 }, function(data) { 9283 unBlockButton('apiDelegateRegisteredDomainButton', 'apiDelegateRegisteredDomain_loading', 'block'); 9284 blockApiDelegateRegisteredDomain = false; 9285 response = JSON.parse(data); 9286 if (response.status == 0) { 9287 showPopupMessage(response.message); 9288 } else { 9289 showPopup('api-settings', '&show=subUserRegisteredDomains&auth-id=' + authid + '&page=' + page); 9290 insideCloudPage("apiSubUsers", "api-settings", "&show=apiSubUsers&page=" + page); 9291 } 9292 }); 9293} 9294 9295function api_deleteRegisteredDomainDelegation (authid, domainid, warning, page) { 9296 showConfirmation(warning, function () { 9297 $.post(AJAXACTIONS_URL + '?action=api-settings', { 9298 'action': 'deleteRegisteredDomainDelegation', 9299 'auth-id': authid, 9300 'domain-id': domainid 9301 }, function(data) { 9302 response = JSON.parse(data); 9303 if (response.status == 0) { 9304 showPopupMessage(response.message); 9305 } else { 9306 showPopup('api-settings', '&show=subUserRegisteredDomains&auth-id=' + authid + '&page=' + page); 9307 insideCloudPage("apiSubUsers", "api-settings", "&show=apiSubUsers&page=" + page); 9308 } 9309 }); 9310 }); 9311} 9312 9313function api_zonesLimitEdit (page) { 9314 var auth_id = $("#auth-id").val(); 9315 9316 $.post(AJAXACTIONS_URL + '?action=api-settings', { 9317 'action': 'editZonesLimit', 9318 'auth-id': auth_id, 9319 'zones': $("#zones").val() 9320 }, function(data) { 9321 response = JSON.parse(data); 9322 if (response.status == 0) { 9323 showPopupMessage(response.message); 9324 } else { 9325 hidePopup(); 9326 showPopup('api-settings', '&show=subUserSettings&auth-id=' + auth_id + '&page=' + page); 9327 } 9328 }); 9329} 9330 9331function api_recordsLimitEdit (page) { 9332 var records = $("#records").val(); 9333 var auth_id = $("#auth-id").val(); 9334 if (records == 'â') { 9335 records = -1; 9336 } 9337 $.post(AJAXACTIONS_URL + '?action=api-settings', { 9338 'action': 'editRecordsLimit', 9339 'auth-id': auth_id, 9340 'records': records 9341 }, function(data) { 9342 response = JSON.parse(data); 9343 if (response.status == 0) { 9344 showPopupMessage(response.message); 9345 } else { 9346 hidePopup(); 9347 showPopup('api-settings', '&show=subUserSettings&auth-id=' + auth_id + '&page=' + page); 9348 } 9349 }); 9350} 9351 9352function api_mailForwardsLimitEdit (page) { 9353 var auth_id = $("#auth-id").val(); 9354 9355 $.post(AJAXACTIONS_URL + '?action=api-settings', { 9356 'action': 'editMailForwardsLimit', 9357 'auth-id': auth_id, 9358 'mailforwards': $("#mailforwards").val() 9359 }, function(data) { 9360 response = JSON.parse(data); 9361 if (response.status == 0) { 9362 showPopupMessage(response.message); 9363 } else { 9364 hidePopup(); 9365 showPopup('api-settings', '&show=subUserSettings&auth-id=' + auth_id + '&page=' + page); 9366 } 9367 }); 9368} 9369 9370function api_failoverChecksEdit (page) { 9371 var auth_id = $("#auth-id").val(); 9372 9373 $.post(AJAXACTIONS_URL + '?action=api-settings', { 9374 'action': 'editFailoverChecks', 9375 'auth-id': auth_id, 9376 'failover-checks': $("#failover_checks").val() 9377 }, function(data) { 9378 response = JSON.parse(data); 9379 if (response.status == 0) { 9380 showPopupMessage(response.message); 9381 } else { 9382 hidePopup(); 9383 showPopup('api-settings', '&show=subUserSettings&auth-id=' + auth_id + '&page=' + page); 9384 } 9385 }); 9386} 9387 9388function api_monitoringChecksEdit (page) { 9389 var auth_id = $("#auth-id").val(); 9390 9391 $.post(AJAXACTIONS_URL + '?action=api-settings', { 9392 'action': 'editMonitoringChecks', 9393 'auth-id': auth_id, 9394 'monitoring-checks': $("#monitoring_checks").val() 9395 }, function(response) { 9396 if (response.status == 0) { 9397 showPopupMessage(response.message); 9398 } else { 9399 hidePopup(); 9400 showPopup('api-settings', '&show=subUserSettings&auth-id=' + auth_id + '&page=' + page); 9401 } 9402 }, 'json'); 9403} 9404 9405function api_editSubUserPanel(auth_id) { 9406 9407 $.post(AJAXACTIONS_URL + '?action=api-settings', { 9408 'action': 'editSubUserPanel', 9409 'auth_id': auth_id, 9410 'panel_id': $("#api_panels").val(), 9411 }, function(data) { 9412 response = JSON.parse(data); 9413 if (response.status == 0) { 9414 showPopupMessage(response.message); 9415 } else { 9416 hidePopup(); 9417 showPopup('api-settings', '&show=subUserSettings&auth-id=' + auth_id); 9418 } 9419 }); 9420} 9421 9422function api_editSubUsername (authid, page) { 9423 $.post(AJAXACTIONS_URL + '?action=api-settings', { 9424 'action': 'editSubUsername', 9425 'auth-id': authid, 9426 'username': $('#username').val() 9427 }, function(data) { 9428 response = JSON.parse(data); 9429 if (response.status == 0) { 9430 showPopupMessage(response.message); 9431 } else { 9432 showPopupMessage(response.message); 9433 insideCloudPage("apiSubUsers", "api-settings", "&show=apiSubUsers&page=" + page); 9434 } 9435 }); 9436} 9437
9438function api_addNewPanel (page) { 9439 $.post(AJAXACTIONS_URL + '?action=api-settings', { 9440 'action': 'createPanel', 9441 'domain': $('#domain').val() 9442 }, function(data) { 9443 response = JSON.parse(data); 9444 9445 if (response.status == 1) { 9446 hidePopup(); 9447 insideCloudPage("resellersPanel", "api-settings", "&show=resellersPanel&page=" + page); 9448 showPopup('api-settings', '&show=panelSettingsEdit&id=' + response.panel + '&page=' + page); 9449 } else { 9450 showPopupMessage(response.message); 9451 } 9452 }); 9453} 9454 9455function api_deletePanel (id, page, warning) { 9456 showConfirmation(warning, function () { 9457 $.post(AJAXACTIONS_URL + '?action=api-settings', { 9458 'action': 'deletePanel', 9459 'id': id 9460 }, function(data) { 9461 response = JSON.parse(data); 9462 9463 showPopupMessage(response.message); 9464 if (response.status == 1) { 9465 insideCloudPage("resellersPanel", "api-settings", "&show=resellersPanel&page=" + page); 9466 } 9467 }); 9468 }); 9469} 9470 9471function api_changeAcessLevel (id, write) { 9472 $.post(AJAXACTIONS_URL + '?action=api-settings', { 9473 'action': 'changeAccessLevel', 9474 'auth_id': id, 9475 'write': write 9476 }, function(data) { 9477 response = JSON.parse(data); 9478 if (response.status == 0) { 9479 showPopupMessage(response.message); 9480 } else { 9481 hidePopup(); 9482 showPopup('api-settings', '&show=subUserSettings&auth-id=' + id); 9483 } 9484 }); 9485} 9486 9487function api_subUserZonesGroup (sub_id, page) { 9488 showPopup('api-settings', '&show=subUserZonesGroupChange&auth-id=' + sub_id + '&page=' + page + ''); 9489} 9490 9491function api_subUserZonesGroupChange (sub_id, page) { 9492 $.post(AJAXACTIONS_URL + '?action=api-settings', { 9493 'action': 'api_subUserZonesGroupChange', 9494 'auth_id': sub_id, 9495 'group_id': $('#group').val(), 9496 'to_all_zones': $('#toAllZones').is(':checked') ? 1 : 0, 9497 }, function(response) { 9498 if (response.status == 0) { 9499 showPopupMessage(response.message); 9500 } else { 9501 hidePopup(); 9502 showPopupMessage(response.message); 9503 showPopup('api-settings', '&show=subUserSettings&auth-id=' + sub_id); 9504 } 9505 }, 'json'); 9506} 9507 9508function api_subUserMonitoringGroup (sub_id, page) { 9509 showPopup('api-settings', '&show=subUserMonitoringGroupChange&auth-id=' + sub_id + '&page=' + page + ''); 9510} 9511 9512function api_subUserMonitoringGroupChange (sub_id, page) { 9513 $.post(AJAXACTIONS_URL + '?action=api-settings', { 9514 'action': 'api_subUserMonitoringGroupChange', 9515 'auth_id': sub_id, 9516 'group_id': $('#group').val(), 9517 'to_all_records': $('#toAllRecords').is(':checked') ? 1 : 0, 9518 }, function(response) { 9519 if (response.status == 0) { 9520 showPopupMessage(response.message); 9521 } else { 9522 hidePopup(); 9523 showPopupMessage(response.message); 9524 showPopup('api-settings', '&show=subUserSettings&auth-id=' + sub_id); 9525 } 9526 }, 'json'); 9527} 9528 9529function deactivate_sub2fa (sub_id, warning, page) { 9530 showConfirmation(warning, function () { 9531 $.post(AJAXACTIONS_URL + '?action=api-settings', { 9532 'action': 'api_subUserDeactivate2fa', 9533 'auth_id': sub_id, 9534 }, function(response) { 9535 showPopupMessage(response.message); 9536 if (response.status == 1) { 9537 insideCloudPage("apiSubUsers", "api-settings", "&show=apiSubUsers&page=" + page); 9538 } 9539 }, 'json'); 9540 }); 9541} 9542 9543function api_removeToAllZonesCheckbox () { 9544 if ($('#group').val() == '0') { 9545 $('#toAllZonesCheckbox').css('display', 'none'); 9546 $('#toAllZonesCheckbox input#toAllZones').attr('disabled', 'disabled'); 9547 $('#toAllZonesCheckbox input#toAllZones').prop('checked', false ); 9548 $('#toAllZonesCheckbox input#toAllRecords').attr('disabled', 'disabled'); 9549 $('#toAllZonesCheckbox input#toAllRecords').prop('checked', false ); 9550 } else { 9551 $('#toAllZonesCheckbox').css('display', 'block'); 9552 $('#toAllZonesCheckbox input#toAllZones').prop('disabled', false); 9553 $('#toAllZonesCheckbox input#toAllRecords').prop('disabled', false); 9554 } 9555} 9556 9557var domain_records = []; 9558var reverse_records = []; 9559var parked_records = []; 9560var enum_records = []; 9561function setRecordTypes (domain, reverse, parked, enumt) { 9562 domain_records = domain; 9563 reverse_records = reverse; 9564 parked_records = parked; 9565 enum_records = enumt; 9566} 9567 9568function api_panelSettingsEdit (id) { 9569 var settings = { 9570 logo: $('#logo_url').val(), 9571 favicon: $('#favicon').val(), 9572 header_color: $('#header_color').val(), 9573 header_links_color: $('#header_links_color').val(), 9574 sub_header_color: $('#sub_header_color').val(), 9575 sub_header_links_color: $('#sub_header_links_color').val(), 9576 buttons_color: $('#buttons_color').val(), 9577 links_color: $('#links_color').val(), 9578 lang_default: $('#lang_default').val(), 9579 rows_per_page: $('#rows_per_page').val(), 9580 contact_url: $('#contact_url').val(), 9581 hide_nameserver_ips: $('#hide_nameserver_ips').is(':checked') ? 1 : 0, 9582 feature_hide_nameservers: $('#feature_hide_nameservers').is(':checked') ? 1 : 0, 9583 feature_zone_count: $('#feature_zone_count').is(':checked') ? 1 : 0, 9584 feature_add_zone: $('#feature_add_zone').is(':checked') ? 1 : 0, 9585 feature_delete_zones: $('#feature_delete_zones').is(':checked') ? 1 : 0, 9586 feature_cloud_domains: $('#feature_cloud_domains').is(':checked') ? 1 : 0, 9587 feature_disable_zones_and_records: $('#feature_disable_zones_and_records').is(':checked') ? 1 : 0, 9588 feature_dnssec: $('#feature_dnssec').is(':checked') ? 1 : 0, 9589 feature_soa: $('#feature_soa').is(':checked') ? 1 : 0, 9590 feature_transfers: $('#feature_transfers').is(':checked') ? 1 : 0, 9591 feature_update_zone: $('#feature_update_zone').is(':checked') ? 1 : 0, 9592 feature_zone_import: $('#feature_zone_import').is(':checked') ? 1 : 0, 9593 feature_zone_export: $('#feature_zone_export').is(':checked') ? 1 : 0, 9594 feature_freessl: $('#feature_freessl').is(':checked') ? 1 : 0, 9595 feature_records_pagination: $('#feature_records_pagination').is(':checked') ? 1 : 0, 9596 feature_disable_primary_domain_zones: $('#feature_disable_primary_domain_zones').is(':checked') ? 1 : 0, 9597 feature_disable_secondary_domain_zones: $('#feature_disable_secondary_domain_zones').is(':checked') ? 1 : 0, 9598 feature_disable_primary_reverse_zones: $('#feature_disable_primary_reverse_zones').is(':checked') ? 1 : 0, 9599 feature_disable_secondary_reverse_zones: $('#feature_disable_secondary_reverse_zones').is(':checked') ? 1 : 0, 9600 feature_disable_primary_enum_zones: $('#feature_disable_primary_enum_zones').is(':checked') ? 1 : 0, 9601 feature_disable_secondary_enum_zones: $('#feature_disable_secondary_enum_zones').is(':checked') ? 1 : 0, 9602 feature_disable_dynamic_url: $('#feature_disable_dynamic_url').is(':checked') ? 1 : 0, 9603 feature_domain_records: [], 9604 feature_reverse_records: [], 9605 feature_parked_records: [], 9606 feature_enum_records: [], 9607 feature_dns_statistics: $('#feature_dns_statistics').is(':checked') ? 1 : 0, 9608 feature_hide_not_available_record_types: $('#feature_hide_not_available_record_types').is(':checked') ? 1 : 0, 9609 feature_include_notes: $('#feature_include_notes').is(':checked') ? 1 : 0, 9610 }; 9611 9612 $.each(domain_records, function(id, type) { 9613 if ($('#feature_domain_records_' + type).is(':checked')) { 9614 settings['feature_domain_records'].push(type); 9615 } 9616 9617 }); 9618 9619 $.each(reverse_records, function(id, type) { 9620 if ($('#feature_reverse_records_' + type).is(':checked')) { 9621 settings['feature_reverse_records'].push(type); 9622 } 9623 }); 9624 9625 $.each(parked_records, function(id, type) { 9626 if ($('#feature_parked_records_' + type).is(':checked')) { 9627 settings['feature_parked_records'].push(type); 9628 } 9629 }); 9630 9631 $.each(enum_records, function(id, type) { 9632 if ($('#feature_enum_records_' + type).is(':checked')) { 9633 settings['feature_enum_records'].push(type); 9634 } 9635 }); 9636 9637 $('.panel-input').removeClass('error'); 9638 $('#logo_url').tipsy('hide'); 9639 $('#favicon').tipsy('hide'); 9640 $('#header_color').tipsy('hide'); 9641 $('#header_links_color').tipsy('hide'); 9642 $('#sub_header_color').tipsy('hide'); 9643 $('#sub_header_links_color').tipsy('hide'); 9644 $('#buttons_color').tipsy('hide'); 9645 $('#links_color').tipsy('hide'); 9646 $('#lang_default').tipsy('hide'); 9647 $('#rows_per_page').tipsy('hide'); 9648 $('#contact_url').tipsy('hide'); 9649 $(window).scroll(function(){ 9650 $('#logo_url').tipsy('hide'); 9651 $('#favicon').tipsy('hide'); 9652 $('#header_color').tipsy('hide'); 9653 $('#header_links_color').tipsy('hide'); 9654 $('#sub_header_color').tipsy('hide'); 9655 $('#sub_header_links_color').tipsy('hide'); 9656 $('#buttons_color').tipsy('hide'); 9657 $('#links_color').tipsy('hide'); 9658 $('#lang_default').tipsy('hide'); 9659 $('#rows_per_page').tipsy('hide'); 9660 $('#contact_url').tipsy('hide'); 9661 }); 9662 $(window).resize(function(){ 9663 $('#logo_url').tipsy('hide'); 9664 $('#favicon').tipsy('hide'); 9665 $('#header_color').tipsy('hide'); 9666 $('#header_links_color').tipsy('hide'); 9667 $('#sub_header_color').tipsy('hide'); 9668 $('#sub_header_links_color').tipsy('hide'); 9669 $('#buttons_color').tipsy('hide'); 9670 $('#links_color').tipsy('hide'); 9671 $('#lang_default').tipsy('hide'); 9672 $('#rows_per_page').tipsy('hide'); 9673 $('#contact_url').tipsy('hide'); 9674 }); 9675 $.post(AJAXACTIONS_URL + '?action=api-settings', { 9676 'action': 'editPanelSettings', 9677 'id': id, 9678 'settings': settings 9679 }, function(data) { 9680 response = JSON.parse(data); 9681 if (typeof response.message != 'undefined') { 9682 showPopupMessage(response.message); 9683 } 9684 if (response.status == 0) { 9685 if (typeof(response.errors) == 'object') { 9686 $.each(response.errors, function(type, message) { 9687 var element = $('#' + type); 9688 element.attr('title', message); 9689 element.tipsy({ 9690 gravity: 'w', 9691 trigger: 'manual', 9692 html: true 9693 }); 9694 element.tipsy('show'); 9695 $(window).resize(function(){ 9696 element.tipsy('show'); 9697 }); 9698 $(window).scroll(function(){ 9699 element.tipsy('show'); 9700 }); 9701 9702 addCloudPageCallBack(function () { 9703 $(element).tipsy('hide'); 9704 $(window).scroll(function(){ 9705 element.tipsy('hide'); 9706 }); 9707 $(window).resize(function(){ 9708 element.tipsy('hide'); 9709 }); 9710 }); 9711 9712 element.addClass('error'); 9713 }); 9714 } 9715 } 9716 if (response.status == 1) { 9717 hidePopup(); 9718 } 9719 }); 9720} 9721 9722function external_saveSubscriptions() { 9723 $.post(AJAXACTIONS_URL + '?action=index', { 9724 'type': 'externalSaveMailSettings', 9725 'form': { 9726 'domain_promotions': $('#domain_promotions').is(':checked') ? 1 : 0, 9727 'premium_promotions': $('#premium_promotions').is(':checked') ? 1 : 0, 9728 'newsletter': $('#newsletter').is(':checked') ? 1 : 0, 9729 'ssl_promotions': $('#ssl_promotions').is(':checked') ? 1 : 0, 9730 'monitoring_promotions': $('#monitoring_promotions').is(':checked') ? 1 : 0, 9731 'maintenance': $('#maintenance').is(':checked') ? 1 : 0, 9732 'failover_weekly': $('#failover_weekly').is(':checked') ? 1 : 0, 9733 'monitoring_weekly': $('#monitoring_weekly').is(':checked') ? 1 : 0, 9734 'free_ssl_notify': $('#free_ssl_notify').is(':checked') ? 1 : 0 9735 }, 9736 'user_id': $('#user_id').val(), 9737 'hash': $('#key').val() 9738 }, function(response) { 9739 if (typeof(response.action) != 'undefined') { 9740 eval(response.action); 9741 } else { 9742 showPopupMessage(response.message); 9743 } 9744 }, 'json'); 9745} 9746 9747function notes_addEditZone (page, group_id, zone) { 9748 $.post(AJAXACTIONS_URL + '?action=notes', { 9749 'action': 'addEditZone', 9750 'type_name': $('#type_name').val(), 9751 'note': $('#note').val() 9752 }, function(response) { 9753 showPopupMessage(response.message); 9754 if (typeof(page) != 'undefined') { 9755 insideCloudPage("dashboard-zones", "main", "&show=zones&page=" + page + '&group_id=' + group_id); 9756 } 9757 9758 insideCloudPage('showNote', 'main', '&show=note&zone_id=' + zone); 9759 }, 'json'); 9760} 9761 9762function notes_addEditRecord (type, page, order) { 9763 $.post(AJAXACTIONS_URL + '?action=notes', { 9764 'action': 'addEditRecord', 9765 'type_name': $('#type_name').val(), 9766 'record_id': $('#record_id').val(), 9767 'note': $('#note').val() 9768 }, function(response) { 9769 if (response.status == 0) { 9770 showPopupMessage(response.message); 9771 } else { 9772 hidePopup(); 9773 zone_getRecords(type, page, order); 9774 } 9775 }, 'json'); 9776} 9777 9778function notes_addEditDomain (sortby, page, domain) { 9779 var scroll = $(window).scrollTop(); 9780 $.post(AJAXACTIONS_URL + '?action=notes', { 9781 'action': 'addEditDomain', 9782 'type_name': $('#type_name').val(), 9783 'note': $('#note').val() 9784 }, function(response) { 9785 showPopupMessage(response.message); 9786 if (typeof(page) != 'undefined') { 9787 insideCloudPage("dashboard-domains", "main", "&show=domains&sortBy="
9787+ sortby + "&page=" + page, function() { 9788 $('html').scrollTop(scroll); 9789 }); 9790 } 9791 insideCloudPage('showNote', 'main', '&show=note-domain&domain=' + domain); 9792 }, 'json'); 9793} 9794 9795function notes_addEditAPIUser (page) { 9796 $.post(AJAXACTIONS_URL + '?action=notes', { 9797 'action': 'addEditAPIUser', 9798 'type_name': $('#type_name').val(), 9799 'note': $('#note').val() 9800 }, function(response) { 9801 showPopupMessage(response.message); 9802 if (typeof(page) != 'undefined') { 9803 insideCloudPage("apiUsers", "api-settings", "&show=apiUsers&page=" + page); 9804 } 9805 }, 'json'); 9806} 9807 9808function notes_addEditAPISubUser (page) { 9809 $.post(AJAXACTIONS_URL + '?action=notes', { 9810 'action': 'addEditAPISubUser', 9811 'type_name': $('#type_name').val(), 9812 'note': $('#note').val() 9813 }, function(response) { 9814 showPopupMessage(response.message); 9815 if (typeof(page) != 'undefined') { 9816 insideCloudPage("apiSubUsers", "api-settings", "&show=apiSubUsers&page=" + page); 9817 } 9818 }, 'json'); 9819} 9820 9821function notes_addEditSSL (page, group_id, user_id) { 9822 var domain = $('#domain').val(); 9823 $.post(AJAXACTIONS_URL + '?action=notes', { 9824 'action': 'addEditSSL', 9825 'type_name': $('#type_name').val(), 9826 'note': $('#note').val() 9827 }, function(response) { 9828 showPopupMessage(response.message); 9829 if (typeof(domain) != 'undefined' && domain != '') { 9830 insideCloudPage("ssl-certificates", "domainManage", "&show=ssl-certificates&domain=" + domain + "&page=" + page + "&group_id=" + group_id, function() { 9831 $(".showSSLTitle, .showSSLTitleBody, .help").tooltip({ 9832 track: true, 9833 delay: 0, 9834 showURL: false, 9835 showBody: "<body>", 9836 fade: 250 9837 }); 9838 }); 9839 } else { 9840 if (typeof(page) != 'undefined') { 9841 insideCloudPage("dashboard-ssl-certificates", "main", "&show=ssl-certificates&page=" + page + "&group_id=" + group_id); 9842 } 9843 } 9844 }, 'json'); 9845} 9846 9847function notes_addEditMonitoring (page, group_id) { 9848 $.post(AJAXACTIONS_URL + '?action=notes', { 9849 'action': 'addEditMonitoring', 9850 'type_name': $('#type_name').val(), 9851 'note': $('#note').val() 9852 }, function(response) { 9853 showPopupMessage(response.message); 9854 if (typeof(page) != 'undefined' || page != '') { 9855 insideCloudPage("dashboard-monitoring-records", "main", "&show=monitoring-records&page=" + page + "&group_id=" + group_id); 9856 } 9857 insideCloudPage('showNote', 'main', '&show=note-monitoring&monitoring-record=' + $('#type_name').val()); 9858 }, 'json'); 9859} 9860 9861function notes_addEditWebAccess () { 9862 $.post(AJAXACTIONS_URL + '?action=notes', { 9863 'action': 'addEditWebAccess', 9864 'type_name': $('#type_name').val(), 9865 'note': $('#note').val() 9866 }, function(response) { 9867 hidePopup(); 9868 showPopupMessage(response.message); 9869 if (typeof(page) != 'undefined') { 9870 insideCloudPage("IPlist", "profile", "&show=webAccess_getIPs"); 9871 } 9872 }, 'json'); 9873} 9874 9875function notes_addEditMips () { 9876 var zone = $('#type_name').val(); 9877 $.post(AJAXACTIONS_URL + '?action=notes', { 9878 'action': 'addEditMips', 9879 'type_name': zone, 9880 'record': $('#record_id').val(), 9881 'note': $('#note').val() 9882 }, function(response) { 9883 showPopupMessage(response.message); 9884 insideCloudPage("mipTable", "slave", "&show=showMips&zone_id=" + zone); 9885 }, 'json'); 9886} 9887 9888function notes_addEditAxfr () { 9889 var zone = $('#type_name').val(); 9890 $.post(AJAXACTIONS_URL + '?action=notes', { 9891 'action': 'addEditAxfr', 9892 'type_name': zone, 9893 'record': $('#record_id').val(), 9894 'note': $('#note').val() 9895 }, function(response) { 9896 showPopupMessage(response.message); 9897 showPopup('axfr', '&show=showPage&zone=' + zone); 9898 }, 'json'); 9899} 9900 9901function showLineChart(data, daily) { 9902 if (typeof window.myLine !== 'undefined') { 9903 window.myLine.destroy(); 9904 } 9905 9906 var lineChartData = data; 9907 var chartElement = document.getElementById(element_id); 9908 9909 if (!chartElement) { 9910 return false; 9911 } 9912 9913 if (typeof(daily) == 'undefinded') { 9914 var daily = true; 9915 } 9916 9917 var ctx = chartElement.getContext("2d"); 9918 9919 window.myLine = new Chart(ctx, { 9920 type: 'line', 9921 data: lineChartData, 9922 options: { 9923 elements: { 9924 line: { 9925 tension: 0.4 // smooth lines 9926 }, 9927 }, 9928 scales: { 9929 x: { 9930 grid: { 9931 display:false 9932 }, 9933 9934 ticks: { 9935 maxTicksLimit: 25, 9936 autoSkip: false 9937 }, 9938 }, 9939 y: { 9940 ticks: { 9941 maxTicksLimit: 25, 9942 autoSkip: true, 9943 callback: function(value) {if (value % 1 === 0 && value >= 0) {return value;}} 9944 }, 9945 } 9946 } 9947 }, 9948 }); 9949 9950 if (date.length < 8) { 9951 $('#'+element_id).click(function(evt){ 9952 var activePoints = myLine.getElementsAtEventForMode(evt, 'nearest', { intersect: true }, true); 9953 9954 if (activePoints.length > 0) { 9955 var str = lineChartData.labels[activePoints[0].index]; 9956 var dateLink = str; 9957 9958 if (date.length > 1) { 9959 dateLink = str.replace(/-/g, ""); 9960 } 9961 if (showLink[dateLink] == true && daily) { 9962 var url = "/stats/domain/"+ zone +"/date/" + dateLink + "/"; 9963 window.location = url; 9964 } 9965 } 9966 }); 9967 } 9968} 9969 9970function showUptimeLineChart(data, canvasId) { 9971 var lineChartData = data; 9972 var chartElement = typeof canvasId === 'string' ? document.getElementById(canvasId) : canvasId; 9973 9974 if (!chartElement) { 9975 return false;
9976 } 9977 9978 if (chartElement.uptimeLineChart) { 9979 chartElement.uptimeLineChart.destroy(); 9980 } 9981 9982 var ctx = chartElement.getContext("2d"); 9983 9984 var isDarkTheme = document.querySelector('link[href*="darktheme.css"]') || document.cookie.split(';').some(function(cookie) { 9985 return cookie.trim() === 'theme=dark'; 9986 }); 9987 9988 if (isDarkTheme) { 9989 Chart.defaults.borderColor = '#7c7c7c'; 9990 Chart.defaults.color = '#fff'; 9991 } 9992 9993 chartElement.uptimeLineChart = new Chart(ctx, { 9994 type: 'line', 9995 data: lineChartData, 9996 options: { 9997 elements: { 9998 line: { 9999 tension: 0.4 10000 }, 10001 }, 10002 scales: { 10003 x: { 10004 grid: { 10005 display:false 10006 }, 10007 10008 ticks: { 10009 autoSkip: false, 10010 maxRotation: 90, 10011 minRotation: 90, 10012 callback: function (value, index, ticks) { 10013 const labelStep = 10; 10014 const step = Math.max(1, Math.ceil(ticks.length / labelStep)); 10015 10016 if (index % step === 0) { 10017 return this.getLabelForValue(value); 10018 } 10019 return ''; 10020 } 10021 }, 10022 }, 10023 y: { 10024 min: -0.5, 10025 max: 100.5, 10026 ticks: { 10027 maxTicksLimit: 25, 10028 autoSkip: true, 10029 callback: function (value) { 10030 if (value <= 0) { 10031 return '0%'; 10032 } 10033 if (value >= 100) { 10034 return '100%'; 10035 } 10036 10037 if (value % 1 === 0 && value >= 0) { 10038 return number_format(value) + '%'; 10039 } 10040 return number_format(Math.floor(value)) + '%'; 10041 } 10042 }, 10043 } 10044 }, 10045 }, 10046 }); 10047 return chartElement.uptimeLineChart; 10048} 10049 10050function expandWiki(article) { 10051 if (typeof(article) != 'undefined') { 10052 $('#menu li').each( function() { 10053 if ( $('#' + article).parents('ul').length > 0 ) { 10054 $('#' + article ).children('a').addClass('active'); 10055 $('#' + article ).parents('li').children('a').addClass('active'); 10056 } 10057 }); 10058 } 10059 10060 $('#menu li').each(function() { 10061 if ($(this).children('ul').length > 0) { 10062 $(this).addClass('drop-down'); 10063 var span = $('<span class="open"></span>').click(function( ) { 10064 wikiOpen(this); 10065 }); 10066 $(this).children('a').after(span); 10067 if ($(this).children('a').attr('class') == 'active') { 10068 $(this).children('span').removeClass('open').addClass('close').click(function( ) { 10069 wikiClose(this); 10070 }); 10071 } 10072 } 10073 }); 10074} 10075 10076function wikiOpen (element) { 10077 $(element).parent('li').children('a').addClass('active'); 10078 $(element).removeClass('open').addClass('close').click(function () { 10079 wikiClose(this); 10080 }); 10081} 10082 10083function wikiClose (element) { 10084 $(element).parent('li').children('a').removeClass('active'); 10085 $(element).removeClass('close').addClass('open').click(function () { 10086 wikiOpen(this); 10087 }); 10088} 10089 10090function filterTLDs () { 10091 var tld = $('#tldFilter').val().toLowerCase(); 10092 10093 if (tld.length >= 1) { 10094 var nomatch = $('td.tld:not(:contains("' + tld + '"))'); 10095 var match = $('td.tld:contains("' + tld + '")'); 10096 10097 nomatch.parents('tr').addClass('tldsHide'); 10098 match.parents('tr').removeClass('tldsHide'); 10099 } else { 10100 $('.tlds').removeClass('tldsHide'); 10101 } 10102} 10103 10104function enablePrivacyProtection (id, product_name) { 10105 $.post(AJAXACTIONS_URL + '?action=cart', { 10106 'type': 'enablePrivacyProtection', 10107 'id': id, 10108 'product_name': product_name 10109 }, function(response) { 10110 if (response.status == 1) { 10111 10112 $('#privacy_' + id).html('<a href="javascript: void(0);" onClick="disablePrivacyProtection(' + id + ', \'' + product_name + '\')"><span title="' + response.tooltip + '" class="icon-privacy-protection icon icon-dark showTitle"> </span></a>'); 10113 $(".showTitle").tooltip({ 10114 track: true, 10115 delay: 0, 10116 showURL: false, 10117 showBody: "<body>", 10118 fade: 250 10119 }); 10120 } else { 10121 showPopupMessage(response.message); 10122 } 10123 }, 'json'); 10124} 10125 10126function disablePrivacyProtection (id, product_name) { 10127 $.post(AJAXACTIONS_URL + '?action=cart', { 10128 'type': 'disablePrivacyProtection', 10129 'id': id, 10130 'product_name': product_name 10131 }, function(response) { 10132 if (response.status == 1) { 10133 $('#privacy_' + id).html('<a href="javascript: void(0);" onClick="enablePrivacyProtection(' + id + ', \'' + product_name + '\')"><span title="' + response.tooltip + '" class="icon-privacy-protection icon icon-bright showTitle"> </span></a>'); 10134 $(".showTitle").tooltip({ 10135 track: true, 10136 delay: 0, 10137 showURL: false, 10138 showBody: "<body>", 10139 fade: 250 10140 }); 10141 } else { 10142 showPopupMessage(response.message); 10143 } 10144 }, 'json'); 10145} 10146 10147function activateCartDNSAutorenewal (product_id, type) { 10148 $.post(AJAXACTIONS_URL + '?action=cart', { 10149 'type': 'activateCartDNSAutorenewal', 10150 'product_id': product_id 10151 }, function(response) { 10152 if (response.status == 1) { 10153 if (type == 'domain') { 10154 $('#autorenewal-domain-' + product_id).html('<span class="icon icon-ok"></span>
10154 ' + translate('auto_renewal_activated')); 10155 } else if (type == 'monitoring') { 10156 $('#autorenewal-monitoring').html('<span class="icon icon-ok"></span> ' + translate('auto_renewal_activated')); 10157 } else if (type == 'ssl') { 10158 $('#autorenewal-ssl-' + product_id).html('<span class="icon icon-ok"></span> ' + translate('auto_renewal_activated')); 10159 } else { 10160 $('#autorenewal').html('<span class="icon icon-ok"></span> ' + translate('auto_renewal_activated')); 10161 } 10162 insideCloudPage('cart-products', 'cart', '&show=products-table'); 10163 $(".showTitle").tooltip({ 10164 track: true, 10165 delay: 0, 10166 showURL: false, 10167 showBody: "<body>", 10168 fade: 250 10169 }); 10170 } else { 10171 showPopupMessage(response.message); 10172 } 10173 }, 'json'); 10174} 10175 10176function disableCartDNSAutorenewal (product_id) { 10177 $.post(AJAXACTIONS_URL + '?action=cart', { 10178 'type': 'disableCartDNSAutorenewal', 10179 'product_id': product_id 10180 }, function(response) { 10181 if (response.status == 1) { 10182 insideCloudPage('cart-products', 'cart', '&show=products-table'); 10183 $(".showTitle").tooltip({ 10184 track: true, 10185 delay: 0, 10186 showURL: false, 10187 showBody: "<body>", 10188 fade: 250 10189 }); 10190 } else { 10191 showPopupMessage(response.message); 10192 } 10193 }, 'json'); 10194} 10195 10196 function updateCart () { 10197 $.post(AJAXACTIONS_URL + '?action=cart', { 10198 'type': 'updateCart', 10199 }, function(response) { 10200 10201 if (typeof(response) == 'undefined') { 10202 return false; 10203 } 10204 10205 if (response.message > 0) { 10206 $('#cartHeaderProducts').css('display', 'inline-block'); 10207 $('#cartHeaderProductsTitle').css('display', 'inline-block'); 10208 $('#cartLogin').css('display', 'inline-block'); 10209 $('#sign-in').css('display', 'none'); 10210 } else { 10211 $('#cartHeaderProducts').css('display', 'none'); 10212 if (!response.logged) { 10213 $('#cartHeaderProductsTitle').css('display', 'none'); 10214 $('#cartLogin').css('display', 'none'); 10215 $('#sign-in').css('display', 'inline-block'); 10216 } 10217 } 10218 10219 $('#cartHeaderProductsTitle').attr('title', translate('cart_menu').replace('%s', response.message)); 10220 $("#cartHeaderProductsTitle").tooltip({ 10221 track: true, 10222 delay: 0, 10223 showURL: false, 10224 showBody: "<body>", 10225 fade: 250 10226 }); 10227 $('#cartHeaderProducts').html(response.message); 10228 }, 'json'); 10229 } 10230 10231 function cartUsePromoCode () { 10232 $.post(AJAXACTIONS_URL + '?action=cart', { 10233 'type': 'usePromoCode', 10234 'code': $('#cartPromoCode').val() 10235 }, function(response) { 10236 if (typeof(response) == 'undefined') { 10237 return false; 10238 } 10239 if (!response.status) { 10240 showPopupMessage(response.message); 10241 } else { 10242 insideCloudPage('cart-products', 'cart', '&show=products-table'); 10243 insideCloudPage('cart-payment', 'cart', '&show=payment-page'); 10244 } 10245 }, 'json'); 10246 } 10247 10248 function cartAddMonitoringUpsell (type_id, parent_id) { 10249 $.post(AJAXACTIONS_URL + '?action=cart', { 10250 'type': 'addMonitoringUpsell', 10251 'type_id': type_id, 10252 'parent_id': parent_id 10253 }, function(response) { 10254 if (!response.status) { 10255 showPopupMessage(response.message); 10256 } else { 10257 updateCart(); 10258 insideCloudPage('cart-products', 'cart', '&show=products-table'); 10259 insideCloudPage('cart-payment', 'cart', '&show=payment-page'); 10260 } 10261 }, 'json'); 10262 } 10263 10264 function cartAddDnsUpsell (type_id, parent_id) { 10265 $.post(AJAXACTIONS_URL + '?action=cart', { 10266 'type': 'cartAddDnsUpsell', 10267 'type_id': type_id, 10268 'parent_id': parent_id 10269 }, function(response) { 10270 if (!response.status) { 10271 showPopupMessage(response.message); 10272 } else { 10273 updateCart(); 10274 insideCloudPage('cart-products', 'cart', '&show=products-table'); 10275 insideCloudPage('cart-payment', 'cart', '&show=payment-page'); 10276 } 10277 }, 'json'); 10278 } 10279 10280 function cartAddSslUpsell (type_id, parent_id) { 10281 $.post(AJAXACTIONS_URL + '?action=cart', { 10282 'type': 'cartAddSslUpsell', 10283 'type_id': type_id, 10284 'parent_id': parent_id, 10285 }, function(response) { 10286 if (!response.status) { 10287 showPopupMessage(response.message); 10288 } else { 10289 updateCart(); 10290 insideCloudPage('cart-products', 'cart', '&show=products-table'); 10291 insideCloudPage('cart-payment', 'cart', '&show=payment-page'); 10292 } 10293 }, 'json'); 10294 } 10295 10296 function monitoringPromo_addToCart (type_id) { 10297 var period = $('input[name=period_' + type_id + ']:checked').val(); 10298 10299 $.post(AJAXACTIONS_URL + '?action=monitoring-promo', { 10300 'type': 'addToCart', 10301 'type_id': type_id, 10302 'months': period 10303 }, function(response) { 10304 if (!response.status) { 10305 if (typeof(response.message) == 'undefined') { 10306 window.location.href = '/'; 10307 } else { 10308 showPopupMessage(response.message); 10309 } 10310 } else { 10311 window.location.href = '/order/step/1/'; 10312 } 10313 }, 'json'); 10314 } 10315 10316function premiumPromo_addToCart(type_id) { 10317 $.post(AJAXACTIONS_URL + '?action=dns-promo', { 10318 'type': 'addToCart', 10319 'type_id': type_id 10320 }, function (response) { 10321 if (!response.status) { 10322 if (typeof (response.message) == 'undefined') { 10323 window.location.href = '/'; 10324 } else { 10325 showPopupMessage(response.message); 10326 } 10327 } else { 10328 window.location.href = '/order/step/1/'; 10329 } 10330 }, 'json'); 10331} 10332 10333function bundlePromo_addToCart(name, tld) { 10334 $.post(AJAXACTIONS_URL + '?action=bundle-promo', { 10335 'type': 'addToCart', 10336 'name': name, 10337 'tld': tld 10338 }, function (response) { 10339 if (!response.status) { 10340 if (typeof (response.message) == 'undefined') { 10341 window.location.href = '/'; 10342 } else { 10343 showPopupMessage(response.message); 10344 } 10345 } else { 10346 window.location.href = '/order/step/1/'; 10347 } 10348 }, 'json'); 10349} 10350 10351function toggleCustomStringOptions () { 10352 if (parseInt($('#fo_check_type').val()) != 18) { 10353 return false;
10354 } 10355 if ($('#web_custom_string_yes').is(':checked')) { 10356 $('.customStringOptions').css('display', 'block'); 10357 fixPopupPosition('#cloudnspop'); 10358 } else { 10359 $('.customStringOptions').css('display', 'none'); 10360 } 10361} 10362 10363 function playVideo () { 10364 $('#indexVideo').html('<iframe id="indexVideo" style="width:100%; max-width:512px; height:288px;" src="https://www.youtube.com/embed/eZcOmhm2THI?rel=0&autoplay=1" frameborder="0" allowfullscreen></iframe>'); 10365 $('#videoThumb').css('display', 'none'); 10366 } 10367 10368 function blockButton (button_name, loading, display) { 10369 if (typeof(display) == 'undefined') { 10370 display = 'inline'; 10371 } 10372 10373 $('#' + button_name).data('start', new Date()); 10374 $('#' + button_name).prop('disabled', true); 10375 $('#' + button_name).css('display', 'none'); 10376 $('#' + loading).css('display', display); 10377 } 10378 10379 function unBlockButton (button_name, loading, display) { 10380 if (typeof(display) == 'undefined') { 10381 display = 'inline'; 10382 } 10383 if ($('#' + button_name).length > 0) { 10384 if (typeof $('#' + button_name).data('start') != 'undefined') { 10385 var start = $('#' + button_name).data('start').getTime(); 10386 } else { 10387 var start = (new Date).getTime(); 10388 } 10389 var now = (new Date).getTime(); 10390 var delay = 0; 10391 10392 if (start + 1000 > now) { 10393 delay = start + 1000 - now; 10394 } 10395 setTimeout(function () { 10396 $('#' + button_name).prop('disabled', false); 10397 $('#' + button_name).css('display', display); 10398 $('#' + loading).css('display', 'none'); 10399 }, delay); 10400 } 10401 } 10402 10403function showSplashScreen() { 10404 $('#splashScreen').show(); 10405} 10406 10407function hideSplashScreen() { 10408 $('#splashScreen').hide(); 10409} 10410 10411function showMessageBody(num) { 10412 $('.messageBody.msg' + num).toggle('fast'); 10413 if ($('.messageBody.msg' + num).hasClass('open')) { 10414 $('.messageBody.msg' + num).removeClass('open').addClass('closed'); 10415 $('.messageBodyContainer' + num + ' img.'+ num).attr('src', '/images/icons/nav-plus.gif'); 10416 } else { 10417 $('.messageBody.msg' + num).removeClass('closed').addClass('open'); 10418 $('.messageBodyContainer' + num + ' img.'+ num).attr("src", "/images/icons/nav-minus.gif"); 10419 } 10420} 10421 10422function rateMessagePopup(message_id, rating, key, z) { 10423 $.post(AJAXACTIONS_URL + '?action=rating', { 10424 'action': 'checkRating', 10425 'message_id': message_id, 10426 'rating': rating, 10427 'key': key 10428 }, function(response) { 10429 if (response.status == 0) { 10430 showPopupMessage(response.message); 10431 } else { 10432 showPopup('rating', '&show=addComment&message_id=' + message_id + '&key=' + key + '&rating=' + rating + '&z=' + z); 10433 } 10434 }, 'json'); 10435} 10436 10437var blockRateMessage = false; 10438function rateMessage(message_id, key, z) { 10439 if (blockRateMessage == true) { 10440 return false; 10441 } 10442 blockRateMessage = true; 10443 blockButton('rateMessageButton', 'rateMessage_loading', 'block'); 10444 var rating = $('#ratingVal').val(); 10445 $.post(AJAXACTIONS_URL + '?action=rating', { 10446 'action': 'rating', 10447 'message_id': message_id, 10448 'rating': rating, 10449 'key': key 10450 }, function(response) { 10451 unBlockButton('rateMessageButton', 'rateMessage_loading', 'block'); 10452 blockRateMessage = false; 10453 if (response.status == 0) { 10454 showPopupMessage(response.message); 10455 } else { 10456 var position = getStarsPosition(rating); 10457 var comment = $('#comment').val(); 10458 $('.rating' + z +' span').css('width', position); 10459 commentRating(message_id, key, comment); 10460 } 10461 }, 'json'); 10462} 10463 10464function commentRating(message_id, key, comment) { 10465 $.post(AJAXACTIONS_URL + '?action=rating', { 10466 'action': 'commentRating', 10467 'comment': comment, 10468 'message_id': message_id, 10469 'key': key 10470 }, function(response) { 10471 if (response.status == 0) { 10472 showPopupMessage(response.message); 10473 } else { 10474 hidePopup(); 10475 } 10476 }, 'json'); 10477} 10478 10479function getStarsPosition(num) { 10480 var position = '0'; 10481 if (num == 1) { 10482 position = '20%'; 10483 } else if (num == 2) { 10484 position = '40%'; 10485 } else if (num == 3) { 10486 position = '60%'; 10487 } else if (num == 4) { 10488 position = '80%'; 10489 } else if (num == 5) { 10490 position = '100%'; 10491 } else { 10492 position = '0'; 10493 } 10494 10495 return position; 10496} 10497 10498function markAllRead () { 10499 $.post(AJAXACTIONS_URL + '?action=support', { 10500 'action': 'markAllRead' 10501 }, function(response) { 10502 window.location = '/support/'; 10503 return true; 10504 }); 10505} 10506 10507function closeTicket (ticket_id, warning) { 10508 showConfirmation(warning, function () { 10509 $.post(AJAXACTIONS_URL + '?action=support', { 10510 'action': 'closeTicket', 10511 'ticket_id': ticket_id 10512 }, function(response) { 10513 eval(response.action); 10514 return true; 10515 }, 'json'); 10516 }); 10517} 10518 10519function checkIfFileAttached() { 10520 if ($('#file').val()) { 10521 $('#resetFileButton').css('display', 'inline-block'); 10522 } 10523} 10524 10525function resetAttachedFile() { 10526 $('#file').val(''); 10527 $('#resetFileButton').css('display', 'none'); 10528} 10529 10530var blockConfirmMailChange = false;
10531function confirmMailChange (token) { 10532 if (blockConfirmMailChange == true) { 10533 return false; 10534 } 10535 blockConfirmMailChange = true; 10536 blockButton('confirmMailChangeButton', 'confirmMailChange_loading', 'block'); 10537 10538 $.post(AJAXACTIONS_URL + '?action=index', { 10539 'type': 'processMailChange', 10540 'token': token 10541 }, function(response) { 10542 unBlockButton('confirmMailChangeButton', 'confirmMailChange_loading', 'block'); 10543 blockConfirmMailChange = false; 10544 showPopupMessage(response.message); 10545 hidePopup(); 10546 }, 'json'); 10547} 10548var blockConfirmAllowedIP = false; 10549function confirmAllowedIP (token, limited) { 10550 if (blockConfirmAllowedIP == true) { 10551 return false; 10552 } 10553 blockConfirmAllowedIP = true; 10554 blockButton('confirmAllowedIpButton', 'confirmAllowedIp_loading', 'block'); 10555 blockButton('confirmAllowedIpButtonTwo', 'confirmAllowedIp_loading', 'block'); 10556 10557 $.post(AJAXACTIONS_URL + '?action=index', { 10558 'type': 'processAllowedIP', 10559 'token': token, 10560 'limited': limited 10561 }, function(response) { 10562 unBlockButton('confirmAllowedIpButton', 'confirmAllowedIp_loading', 'block'); 10563 unBlockButton('confirmAllowedIpButtonTwo', 'confirmAllowedIp_loading', 'block'); 10564 blockConfirmAllowedIP = false; 10565 showPopupMessage(response.message); 10566 hidePopup(); 10567 }, 'json'); 10568} 10569 10570function removeTipsy () { 10571 $('.tipsy').remove(); 10572} 10573 10574function showLanguages (event) { 10575 if (!$(".lang-bar .drop-down-menu").hasClass('active')) { 10576 $(".lang-bar .drop-down-menu").addClass("active"); 10577 event.stopPropagation(); 10578 } 10579 10580 $(document).on("click", function (e) { 10581 $(".lang-bar .drop-down-menu").removeClass("active"); 10582 $(document).off('click'); 10583 }); 10584} 10585 10586function showThemes (event) { 10587 if (!$(".theme-bar .drop-down-menu").hasClass('active')) { 10588 $(".theme-bar .drop-down-menu").addClass("active"); 10589 event.stopPropagation(); 10590 } 10591 10592 $(document).on("click", function (e) { 10593 $(".theme-bar .drop-down-menu").removeClass("active"); 10594 $(document).off('click'); 10595 }); 10596} 10597 10598/* testimonials */ 10599 10600var leftIncrement = 1210; 10601var page = 1; 10602// when clicking on a dot we go to the exact page 10603function carouselPagination (n) { 10604 carouselSlide (page = n); 10605} 10606// when clicking on the arrows we are incrementing or decrementing the page 10607function carouselPlus(n) { 10608 carouselSlide(page += n); 10609} 10610 10611// calculating and showing the pages(dots) under the testimonials 10612function carouselCountPages(testimonialsCount) { 10613 10614 $('#carousel-indicator').html(''); 10615 10616 //1200px 10617 var viewportW = $('.carousel-viewport').width(); 10618 if (viewportW < 1200) { 10619 var perPage = 1; 10620 var count = Math.round(testimonialsCount/perPage); 10621 $('.carousel-overview > ul').width(viewportW-5); 10622 $('.carousel-overview > ul > li').css('margin', 'auto'); 10623 $('.carousel-overview').width((viewportW*count)); 10624 leftIncrement = viewportW; 10625 10626 $(".carousel-overview").animate({left:-leftIncrement*(page-1)}, 5); 10627 } else { 10628 var perPage = 2; 10629 var count = Math.round(testimonialsCount/perPage); 10630 10631 // calculates the page after the resizing 10632 if (page > count) { 10633 page = Math.round(page/perPage); 10634 } 10635 // resetting the leftIncrement in case it 10636 // was changed for small rez above 10637 leftIncrement = 1210; 10638 10639 $(".carousel-overview").animate({left:-leftIncrement*(page-1)}, 5); 10640 $('.carousel-overview > ul').css('width', 'auto'); 10641 $('.carousel-overview > ul > li').css('margin', '0 30px'); 10642 $('.carousel-overview').width((viewportW*count)); 10643 } 10644 10645 var dots = ''; 10646 for (var i=1;i<=count;i++) { 10647 var active = ''; 10648 10649 if (i == page) { 10650 active = ' class="active"'; 10651 } 10652 dots += '<span' + active + ' onClick="carouselPagination(' + i + ');"></span>'; 10653 } 10654 10655 $('#carousel-indicator').html(dots); 10656} 10657 10658function carouselSlide (n) { 10659 var dots = $('#carousel-indicator').find('span'); 10660 var pages = dots; 10661 var offset = 0; 10662 10663 if (page > 0 && n <= pages.length) { 10664 offset -= (leftIncrement * (n-1)); 10665 } else if (n < 0) { 10666 offset += (leftIncrement * (n-1)); 10667 } else { 10668 offset = 0; 10669 page = 1; 10670 } 10671 // restore the class of all dosts to empty 10672 for (i = 0; i < dots.length; i++) { 10673 dots[i].className = dots[i].className.replace("active", ""); 10674 } 10675 // changes the value of left to the new one 10676 $(".carousel-overview").animate({left:offset}, 500); 10677 // marcs the active dot as active :) 10678
10679 dots[(page-1)].className += "active"; 10680} 10681 10682/* Autorenewals */ 10683var blockBillingCreate = false; 10684function createPayment () { 10685 if (blockBillingCreate == true) { 10686 return false; 10687 } 10688 blockBillingCreate = true; 10689 blockButton('create_button', 'create_loading'); 10690 10691 $.post(AJAXACTIONS_URL + '?action=billing', { 10692 'action': 'create', 10693 'method': $('#method').val() 10694 }, function(response) { 10695 if (response.status == 0 && response.contacts == 0) { 10696 blockBillingCreate = false; 10697 unBlockButton('create_button', 'create_loading'); 10698 $('.popup-wraper').addClass('popup-700'); 10699 showPopupMessage(response.message, function(){ 10700 $('.tipsy').hide(); 10701 $('.popup-wraper').removeClass('popup-700'); 10702 }); 10703 } else if (response.status == 0) { 10704 blockBillingCreate = false; 10705 unBlockButton('create_button', 'create_loading'); 10706 showPopupMessage(response.message); 10707 } else if (typeof(response.url) != 'undefined') { 10708 /** 10709 * don't unblock here, because there might be a delay 10710 * and the button can be pressed again 10711 **/ 10712 window.location = response.url; 10713 } else { 10714 blockBillingCreate = false; 10715 unBlockButton('create_button', 'create_loading'); 10716 showPopupMessage(response.message); 10717 } 10718 }, 'json'); 10719} 10720 10721var blockContactsSave = false; 10722function billing_saveContacts () { 10723 if (blockContactsSave == true) { 10724 return false; 10725 } 10726 blockContactsSave = true; 10727 blockButton('saveContacts', 'contacts_loading'); 10728 10729 $.each($('.input-text'), function (index, element) { 10730 $(element).tipsy('hide'); 10731 }); 10732 $('.select').tipsy('hide'); 10733 $.post(AJAXACTIONS_URL + '?action=profile', { 10734 'type': 'saveContactDetails', 10735 'name': $('#name').val(), 10736 'company': $('#company').val(), 10737 'vat': $('#vat').val(), 10738 'eik': $('#eik').val(), 10739 'address': $('#address').val(), 10740 'zip': $('#zip').val(), 10741 'city': $('#city').val(), 10742 'state': $('#state').val(), 10743 'country': $('#country').val(), 10744 'telno': $('#telno').val(), 10745 'telnocc': $('#telnocc').val(), 10746 'password': $('#password').val() 10747 }, function(response) { 10748 if (typeof response.action !== 'undefined') { 10749 eval(response.action); 10750 return false; 10751 } 10752 $('#password').val(''); 10753 if (response.status == 0) { 10754 unBlockButton('saveContacts', 'contacts_loading', 'block'); 10755 blockContactsSave = false; 10756 if (typeof(response.errors) == 'object') { 10757 $.each(response.errors, function(type, message) { 10758 var element = $('#' + type); 10759 if (type == 'telnocc') { 10760 var tipsyGravity = 'e'; 10761 } else { 10762 var tipsyGravity = 'w'; 10763 } 10764 element.attr('title', message); 10765 element.tipsy({ 10766 gravity: tipsyGravity, 10767 trigger: 'manual', 10768 html: true 10769 }); 10770 element.tipsy('show'); 10771 }); 10772 10773 $(window).resize(function(){ 10774 $.each(response.errors, function(type, message) { 10775 var element = $('#' + type); 10776 if (type == 'telnocc') { 10777 var tipsyGravity = 'e'; 10778 } else { 10779 var tipsyGravity = 'w'; 10780 } 10781 element.attr('title', message); 10782 element.tipsy({ 10783 gravity: tipsyGravity, 10784 trigger: 'manual', 10785 html: true 10786 }); 10787 element.tipsy('show'); 10788 }); 10789 }); 10790 10791 $(window).scroll(function(){ 10792 $.each(response.errors, function(type, message) { 10793 var element = $('#' + type); 10794 if (type == 'telnocc') { 10795 var tipsyGravity = 'e'; 10796 } else { 10797 var tipsyGravity = 'w'; 10798 } 10799 element.attr('title', message); 10800 element.tipsy({ 10801 gravity: tipsyGravity, 10802 trigger: 'manual', 10803 html: true 10804 }); 10805 element.tipsy('show'); 10806 }); 10807 }); 10808 } else { 10809 showPopupMessage(response.errors); 10810 } 10811 } else { 10812 createPayment(); 10813 } 10814 }, 'json'); 10815} 10816 10817function verifyPayment (id) { 10818 $.post(AJAXACTIONS_URL + '?action=billing', { 10819 'action': 'verify', 10820 'id': id 10821 }, function(response) { 10822 if (response.status == 0) { 10823 showPopupMessage(response.message); 10824 insideCloudPage("methodsTable", "billing", "&show=methodsTable"); 10825 } else if (typeof(response.url) != 'undefined') { 10826 window.location = response.url; 10827 } else { 10828 showPopupMessage(response.message); 10829 } 10830 }, 'json'); 10831} 10832 10833var blockAdyenVerify = false; 10834function billing_adyenVerify (id) { 10835 10836 $('#encryptedCardNumber').tipsy('hide'); 10837 $('#encryptedExpiryMonth').tipsy('hide'); 10838 $('#encryptedExpiryYear').tipsy('hide'); 10839 $('#encryptedSecurityCode').tipsy('hide'); 10840 $('#holderName').tipsy('hide'); 10841 10842 if (blockAdyenVerify == true) { 10843 return false;
10844 } 10845 blockAdyenVerify = true; 10846 blockButton('verifyAdyenMethod', 'loading_adyen', 'block'); 10847 10848 $.post(AJAXACTIONS_URL + '?action=billing', { 10849 'action': 'adyenVerify', 10850 'id': id, 10851 'encryptedExpiryMonth': $('#encryptedMonthBlob').val(), 10852 'encryptedExpiryYear': $('#encryptedYearBlob').val(), 10853 'encryptedCardNumber': $('#encryptedCardBlob').val(), 10854 'encryptedSecurityCode': $('#encryptedCvcBlob').val(), 10855 'holderName': $('#holderName').val(), 10856 }, function(response) { 10857 unBlockButton('verifyAdyenMethod', 'loading_adyen'); 10858 blockAdyenVerify = false; 10859 if (response.status == 0) { 10860 if (typeof(response.errors) != 'undefined') { 10861 $.each(response.errors, function(index, message) { 10862 var element = $('#' + index); 10863 var tipsyGravity = 'w'; 10864 if (index == 'encryptedExpiryMonth') { 10865 tipsyGravity = 'n'; 10866 } 10867 element.addClass('border-color', 'red'); 10868 element.attr('title', message); 10869 element.tipsy({ 10870 gravity: tipsyGravity, 10871 trigger: 'manual', 10872 html: false 10873 }); 10874 element.tipsy('show'); 10875 $(window).resize(function(){ 10876 element.tipsy('show'); 10877 }); 10878 }); 10879 } else { 10880 showPopupMessage(response.message); 10881 } 10882 } else if (typeof response.redirect !== 'undefined') { 10883 $('#adyen_redirect_form_container').html(response.redirect); 10884 $('#adyen_redirect_form').submit(); 10885 } else { 10886 window.location = '/billing/activate-payment-method/activated/'; 10887 } 10888 }, 'json'); 10889} 10890 10891var blockPlanDelete = false; 10892function cancelPayment (id, warning) { 10893 if (typeof(warning) == 'undefined') { 10894 executeCancelPayemnt(id, warning); 10895 } else { 10896 showConfirmation(warning, function () { 10897 executeCancelPayemnt(id, warning); 10898 }); 10899 } 10900} 10901 10902function billing_editMethodLabel (id) { 10903 $.post(AJAXACTIONS_URL + '?action=billing', { 10904 'action': 'editLabel', 10905 'id': id, 10906 'label': $('#label').val() 10907 }, function(response) { 10908 showPopupMessage(response.message); 10909 if (response.status == 1) { 10910 insideCloudPage("methodsTable", "billing", "&show=methodsTable"); 10911 hidePopup(); 10912 } 10913 }, 'json'); 10914} 10915 10916function executeCancelPayemnt (id, warning) { 10917 if (blockPlanDelete == true) { 10918 return false; 10919 } 10920 blockPlanDelete = true; 10921 blockButton('delete_plan_' + id + '_button', 'delete_plan_' + id + '_loading'); 10922 $.post(AJAXACTIONS_URL + '?action=billing', { 10923 'action': 'cancel', 10924 'id': id, 10925 }, function(response) { 10926 blockPlanDelete = false; 10927 unBlockButton('delete_plan_' + id + '_button', 'delete_plan_' + id + '_loading'); 10928 if (response.status == 0) { 10929 showPopupMessage(response.message); 10930 } else { 10931 insideCloudPage("methodsTable", "billing", "&show=methodsTable"); 10932 } 10933 }, 'json'); 10934} 10935 10936function makeDefualt (id) { 10937 $.post(AJAXACTIONS_URL + '?action=billing', { 10938 'action': 'makeDefault', 10939 'id': id, 10940 }, function(response) { 10941 showPopupMessage(response.message); 10942 if (response.status == 1) { 10943 insideCloudPage("methodsTable", "billing", "&show=methodsTable"); 10944 } 10945 }, 'json'); 10946} 10947 10948var blockDomainAdd = false; 10949function addDomainAutorenewal(id, warning, billing, domain_name, sortBy, page) { 10950 showConfirmation(warning, function () { 10951 var scroll = $(window).scrollTop(); 10952 if (blockDomainAdd == true) { 10953 return false; 10954 } 10955 blockDomainAdd = true; 10956 blockButton('domainActivateIcon_' + id, 'autorenewal_domain_' + id + '_loading'); 10957 if (typeof(billing) != 'undefined') { 10958 blockButton('domainsPopupButton', 'domainsPopupLoading'); 10959 } 10960 $.post(AJAXACTIONS_URL + '?action=billing', { 10961 'action': 'addDomainAutorenewal', 10962 'id': id, 10963 }, function(response) { 10964 blockDomainAdd = false; 10965 unBlockButton('domainActivateIcon_' + id, 'autorenewal_domain_' + id + '_loading'); 10966 if (typeof(billing) != 'undefined') { 10967 unBlockButton('domainsPopupButton', 'domainsPopupLoading'); 10968 } 10969 if (response.status == 0) { 10970 showPopupMessage(response.message); 10971 } else { 10972 if (typeof(billing) == 'undefined') { 10973 if (typeof(domain_name) != 'undefined' || domain_name != null) { 10974 insideCloudPage('domainRenew', 'domainRenew', '&show=view-page&filter=' + domain_name); 10975 } else { 10976 showPopup('domainRenew', '&show=view-popup'); 10977 insideCloudPage("dashboard-domains", "main", "&show=domains"); 10978 } 10979 } else { 10980 if (billing != 'dashboard-billing') { 10981 insideCloudPage("domainsTable", "billing", "&show=domainsTable&page=1"); 10982 } 10983 if (billing == 'dashboard-billing') { 10984 insideCloudPage("dashboard-domains", "main", "&show=domains&page=" + page + "&sortBy="
10984+ sortBy, function() { 10985 $('html').scrollTop(scroll); 10986 }); 10987 } 10988 hidePopup(); 10989 $('html').scrollTop(scroll); 10990 showPopupMessage(response.message); 10991 } 10992 } 10993 }, 'json'); 10994 }); 10995} 10996 10997function billing_addDomainAutorenewal () { 10998 if (blockDomainAdd == true) { 10999 return false; 11000 } 11001 blockDomainAdd = true; 11002 blockButton('domainsPopupButton', 'domainsPopupLoading'); 11003 var id = $('#addDomainName').val(); 11004 $.post(AJAXACTIONS_URL + '?action=billing', { 11005 'action': 'getDomainAutorenewalConfirmation', 11006 'id': id, 11007 }, function(response) { 11008 blockDomainAdd = false; 11009 unBlockButton('domainsPopupButton', 'domainsPopupLoading'); 11010 if (response.status == 0) { 11011 showPopupMessage(response.message); 11012 } else { 11013 addDomainAutorenewal(id, response.message, 'billing'); 11014 } 11015 }, 'json'); 11016 11017} 11018 11019function dashboard_addDomainAutorenewal (id, page, sortBy) { 11020 if (blockDomainAdd == true) { 11021 return false; 11022 } 11023 blockDomainAdd = true; 11024 blockButton('domainsPopupButton', 'domainsPopupLoading'); 11025 $.post(AJAXACTIONS_URL + '?action=billing', { 11026 'action': 'getDomainAutorenewalConfirmation', 11027 'id': id, 11028 }, function(response) { 11029 blockDomainAdd = false; 11030 unBlockButton('domainsPopupButton', 'domainsPopupLoading'); 11031 if (response.status == 0) { 11032 showPopupMessage(response.message); 11033 } else { 11034 addDomainAutorenewal(id, response.message, 'dashboard-billing', null, sortBy, page); 11035 } 11036 }, 'json'); 11037 11038} 11039 11040function dashboard_reloadDomainsTableBody() { 11041 if (typeof window.dashboardDomainsBodyUrl == 'undefined') { 11042 return false; 11043 } 11044 11045 insideCloudPage('domains-table-body', 'main', window.dashboardDomainsBodyUrl); 11046} 11047 11048function dashboard_reloadFailoverTableBody() { 11049 if (typeof window.dashboardFailoverBodyUrl == 'undefined') { 11050 return false; 11051 } 11052 11053 insideCloudPage('failover-table-body', 'failover-records', window.dashboardFailoverBodyUrl); 11054} 11055 11056function dashboard_reloadZonesTableBody() { 11057 if (typeof window.dashboardZonesBodyUrl == 'undefined') { 11058 return false; 11059 } 11060 11061 insideCloudPage('zones-table-body', 'main', window.dashboardZonesBodyUrl, function () { 11062 if (typeof window.dashboardZonesTableBodyCallback == 'function') { 11063 window.dashboardZonesTableBodyCallback(); 11064 } 11065 }); 11066} 11067 11068function dashboard_reloadSharedZonesTableBody() { 11069 if (typeof window.dashboardSharedZonesBodyUrl == 'undefined') { 11070 return false; 11071 } 11072 11073 insideCloudPage('shared-zones-table-body', 'main', window.dashboardSharedZonesBodyUrl, function () { 11074 if (typeof window.dashboardSharedZonesTableBodyCallback == 'function') { 11075 window.dashboardSharedZonesTableBodyCallback(); 11076 } 11077 }); 11078} 11079 11080function dashboard_reloadSslTableBody() { 11081 if (typeof window.dashboardSslBodyUrl == 'undefined') { 11082 return false; 11083 } 11084 11085 insideCloudPage('ssl-table-body', 'main', window.dashboardSslBodyUrl, function () { 11086 if (typeof window.dashboardSslTableBodyCallback == 'function') { 11087 window.dashboardSslTableBodyCallback(); 11088 } 11089 }); 11090} 11091 11092function dashboard_reloadSharedSslTableBody() { 11093 if (typeof window.dashboardSharedSslBodyUrl == 'undefined') { 11094 return false; 11095 } 11096 11097 insideCloudPage('shared-ssls-table-body', 'main', window.dashboardSharedSslBodyUrl, function () { 11098 if (typeof window.dashboardSharedSslTableBodyCallback == 'function') { 11099 window.dashboardSharedSslTableBodyCallback(); 11100 } 11101 }); 11102} 11103 11104function dashboard_reloadGoogleWorkspaceTableBody() { 11105 if (typeof window.dashboardGoogleWorkspaceBodyUrl == 'undefined') { 11106 return false; 11107 } 11108 11109 insideCloudPage('gw-table-body', 'main', window.dashboardGoogleWorkspaceBodyUrl, function () { 11110 if (typeof window.dashboardGoogleWorkspaceTableBodyCallback == 'function') { 11111 window.dashboardGoogleWorkspaceTableBodyCallback(); 11112 } 11113 }); 11114} 11115 11116function dashboard_reloadMonitoringTableBody() { 11117 if (typeof window.dashboardMonitoringBodyUrl == 'undefined') { 11118 return false; 11119 } 11120 11121 insideCloudPage('monitoring-table-body', 'main', window.dashboardMonitoringBodyUrl); 11122} 11123 11124function dashboard_reloadSharedMonitoringTableBody() { 11125 if (typeof window.dashboardSharedMonitoringBodyUrl == 'undefined') { 11126 return false; 11127 } 11128 11129 insideCloudPage('shared-monitoring-records-table-body', 'main', window.dashboardSharedMonitoringBodyUrl, function () { 11130 if (typeof window.dashboardSharedMonitoringTableBodyCallback == 'function') { 11131 window.dashboardSharedMonitoringTableBodyCallback(); 11132 } 11133 }); 11134} 11135 11136function initDashboardRefreshTooltip(scope) { 11137 var $targets = (scope ? $(scope) : $(document)).find('.dashboard-refresh-tooltip'); 11138 $targets.each(function () { 11139 if ($.data(this, 'tooltip')) { 11140 return; 11141 } 11142 $(this).tooltip({ 11143 track: true, 11144 delay: 0, 11145 showURL: false, 11146 showBody: "<body>", 11147 fade: 250 11148 }); 11149 }); 11150} 11151 11152var blockDomainDelete = false;
11153function billing_cancelDomainAutorenewal (id, page) { 11154 if (blockDomainDelete == true) { 11155 return false; 11156 } 11157 blockDomainDelete = true; 11158 blockButton('delete_domain_' + id + '_button', 'delete_domain_' + id + '_loading'); 11159 $.post(AJAXACTIONS_URL + '?action=billing', { 11160 'action': 'cancelDomainAutorenewal', 11161 'id': id, 11162 }, function(response) { 11163 blockDomainDelete = false; 11164 unBlockButton('delete_domain_' + id + '_button', 'delete_domain_' + id + '_loading'); 11165 if (response.status == 0) { 11166 showPopupMessage(response.message); 11167 } else { 11168 insideCloudPage("domainsTable", "billing", "&show=domainsTable&page=" + page); 11169 } 11170 }, 'json'); 11171} 11172 11173var unblockcancelDomainAutorenewal = false; 11174function domainRenew_cancelDomainAutorenewal (id, name, warning, popup) { 11175 showConfirmation(warning, function () { 11176 if (unblockcancelDomainAutorenewal == true) { 11177 return false; 11178 } 11179 unblockcancelDomainAutorenewal = true; 11180 blockButton('domainDeactivateIcon_' + id, 'autorenewal_domain_' + id + '_loading'); 11181 $.post(AJAXACTIONS_URL + '?action=billing', { 11182 'action': 'cancelDomainAutorenewal', 11183 'id': id, 11184 }, function(response) { 11185 unblockcancelDomainAutorenewal = false; 11186 unBlockButton('domainDeactivateIcon_' + id, 'autorenewal_domain_' + id + '_loading'); 11187 if (response.status == 0) { 11188 showPopupMessage(response.message); 11189 } else { 11190 if (typeof(popup) != 'undefined') { 11191 showPopup('domainRenew', '&show=view-popup'); 11192 insideCloudPage("dashboard-domains", "main", "&show=domains"); 11193 } else { 11194 insideCloudPage('domainRenew', 'domainRenew', '&show=view-page&filter=' + name); 11195 } 11196 } 11197 }, 'json'); 11198 }); 11199} 11200 11201var blockAddSSLAutorenewalButton = false; 11202function dashboard_addSSLAutorenewal(id, page, warning, billing, domain, ssl) { 11203 showConfirmation(warning, function () { 11204 if (blockAddSSLAutorenewalButton == true) { 11205 return false; 11206 } 11207 blockAddSSLAutorenewalButton = true; 11208 if (typeof (billing) != 'undefined') { 11209 blockButton('sslsPopupButton', 'sslsPopupLoading'); 11210 } else { 11211 blockButton('sslActivateIcon_' + id, 'autorenewal_' + id + '_loading', 'block'); 11212 } 11213 11214 $.post(AJAXACTIONS_URL + '?action=billing', { 11215 'action': 'addSSLAutorenewal', 11216 'id': id, 11217 }, function (response) { 11218 blockAddSSLAutorenewalButton = false; 11219 if (typeof (billing) != 'undefined') { 11220 unBlockButton('sslsPopupButton', 'sslsPopupLoading'); 11221 } else { 11222 unBlockButton('sslActivateIcon_' + id, 'autorenewal_' + id + '_loading', 'block'); 11223 } 11224 11225 if (response.status == 0) { 11226 showPopupMessage(response.message); 11227 } else { 11228 if (typeof (billing) == 'undefined') { 11229 showPopupMessage(response.message); 11230 insideCloudPage("dashboard-ssl-certificates", "main", "&show=ssl-certificates&page=" + page); 11231 hidePopup(); 11232 } else if (billing == 'ssl-table') { 11233 showPopupMessage(response.message); 11234 insideCloudPage('ssl-certificates', 'domainManage', '&show=ssl-certificates&domain=' + encodeURIComponent(domain) + '&ssl=' + ssl + '&page=' + page, function() { 11235 $(".showSSLTitle, .showSSLTitleBody, .help").tooltip({ 11236 track: true, 11237 delay: 0, 11238 showURL: false, 11239 showBody: "<body>", 11240 fade: 250 11241 }); 11242 }); 11243 hidePopup(); 11244 } else { 11245 showPopupMessage(response.message); 11246 insideCloudPage("sslTable", "billing", "&show=sslTable&page=1"); 11247 hidePopup(); 11248 } 11249 } 11250 }, 'json'); 11251 }); 11252} 11253 11254function billing_addSSLAutorenewal () { 11255 if (blockAddSSLAutorenewalButton == true) { 11256 return false; 11257 } 11258 blockAddSSLAutorenewalButton = true; 11259 blockButton('sslsPopupButton', 'sslsPopupLoading'); 11260 var id = $('#addSSLs').val(); 11261 $.post(AJAXACTIONS_URL + '?action=billing', { 11262 'action': 'getSSLsAutorenewalConfirmation', 11263 'id': id, 11264 }, function(response) { 11265 blockAddSSLAutorenewalButton = false; 11266 unBlockButton('sslsPopupButton', 'sslsPopupLoading'); 11267 if (response.status == 0) { 11268 showPopupMessage(response.message); 11269 } else { 11270 dashboard_addSSLAutorenewal(id, 1, response.message, 'billing'); 11271 } 11272 }, 'json'); 11273 11274} 11275 11276var blockCancelSSLAutorenewalButton = false;
11277function dashboard_cancelSSLAutorenewal(id, page, warning, domain, ssl) { 11278 showConfirmation(warning, function () { 11279 if (blockCancelSSLAutorenewalButton == true) { 11280 return false; 11281 } 11282 blockCancelSSLAutorenewalButton = true; 11283 blockButton('sslDeactivateIcon_' + id, 'autorenewal_' + id + '_loading'); 11284 11285 $.post(AJAXACTIONS_URL + '?action=billing', { 11286 'action': 'cancelSSLAutorenewal', 11287 'id': id, 11288 }, function(response) { 11289 blockCancelSSLAutorenewalButton = false; 11290 unBlockButton('sslDeactivateIcon_' + id, 'autorenewal_' + id + '_loading'); 11291 if (response.status == 0) { 11292 showPopupMessage(response.message); 11293 } else { 11294 if (typeof(domain) !== 'undefined') { 11295 insideCloudPage('ssl-certificates', 'domainManage', '&show=ssl-certificates&domain=' + domain + '&ssl=' + ssl + '&page=' + page, function() { 11296 $(".showSSLTitle, .showSSLTitleBody, .help").tooltip({ 11297 track: true, 11298 delay: 0, 11299 showURL: false, 11300 showBody: "<body>", 11301 fade: 250 11302 }); 11303 }); 11304 } else { 11305 insideCloudPage("dashboard-ssl-certificates", "main", "&show=ssl-certificates&page=" + page); 11306 } 11307 } 11308 }, 'json'); 11309 }); 11310} 11311 11312var blockSSLDelete = false; 11313function cancelSSLAutorenewal (id, page) { 11314 if (blockSSLDelete == true) { 11315 return false; 11316 } 11317 blockSSLDelete = true; 11318 blockButton('delete_ssl_' + id + '_button', 'delete_ssl_' + id + '_loading'); 11319 $.post(AJAXACTIONS_URL + '?action=billing', { 11320 'action': 'cancelSSLAutorenewal', 11321 'id': id, 11322 }, function(response) { 11323 blockSSLDelete = false; 11324 unBlockButton('delete_ssl_' + id + '_button', 'delete_ssl_' + id + '_loading'); 11325 if (response.status == 0) { 11326 showPopupMessage(response.message); 11327 } else { 11328 insideCloudPage("sslTable", "billing", "&show=sslTable&page=" + page); 11329 } 11330 }, 'json'); 11331} 11332 11333function billing_cancelPlanAutorenewal() { 11334 $.post(AJAXACTIONS_URL + '?action=billing', { 11335 'action': 'cancelPlanAutorenewal' 11336 }, function(response) { 11337 if (response.status == 0) { 11338 showPopupMessage(response.message); 11339 } else { 11340 insideCloudPage("planTable", "billing", "&show=planTable"); 11341 } 11342 }, 'json'); 11343} 11344 11345function billing_changePlanAutorenewalPeriod () { 11346 $.post(AJAXACTIONS_URL + '?action=billing', { 11347 'action': 'changePlanAutorenewalPeriod', 11348 'period': $('input[name="period"]:checked').val(), 11349 }, function(response) { 11350 if (response.status == 0) { 11351 showPopupMessage(response.message); 11352 } else { 11353 insideCloudPage("planTable", "billing", "&show=planTable"); 11354 hidePopup(); 11355 } 11356 }, 'json'); 11357} 11358 11359var blockPlanButton = false; 11360function subscription_addPlanAutorenewal() { 11361 if (blockPlanButton == true) { 11362 return false; 11363 } 11364 blockPlanButton = true; 11365 blockButton('planButton', 'plan_loading'); 11366 $.post(AJAXACTIONS_URL + '?action=billing', { 11367 'action': 'addPlanAutorenewal', 11368 'period': $('input[name="renewal_period"]:checked').val() 11369 }, function(response) { 11370 if (response.status == 0) { 11371 blockPlanButton = false; 11372 unBlockButton('planButton', 'plan_loading'); 11373 showPopupMessage(response.message); 11374 } else if (typeof(response.order_id) != 'undefined') { 11375 $('#processWaiting').css('display', 'block'); 11376 setTimeout(function () { 11377 window.location = '/orders/view/' + response.order_id + '/'; 11378 }, 10000); 11379 } else { 11380 window.location = '/subscription/'; 11381 } 11382 }, 'json'); 11383} 11384 11385function subscription_cancelPlanAutorenewal(warning) { 11386 showConfirmation(warning, function () { 11387 $.post(AJAXACTIONS_URL + '?action=billing', { 11388 'action': 'cancelPlanAutorenewal' 11389 }, function(response) { 11390 if (response.status == 0) { 11391 showPopupMessage(response.message); 11392 } else { 11393 window.location = '/subscription/'; 11394 } 11395 }, 'json'); 11396 }); 11397} 11398 11399function subscription_hasNoPaymentMethod () { 11400 $.post(AJAXACTIONS_URL + '?action=billing', { 11401 'action': 'hasNoPaymentMethod' 11402 }, function(response) { 11403 window.location = '/billing/'; 11404 }, 'json'); 11405} 11406 11407 11408 11409var blockAddGWAutorenewalButton = false; 11410function dashboard_addGWAutorenewal(id, page, warning, billing) { 11411 showConfirmation(warning, function () { 11412 if (blockAddGWAutorenewalButton == true) { 11413 return false; 11414 } 11415 blockAddGWAutorenewalButton = true; 11416 if (typeof (billing) != 'undefined') { 11417 blockButton('gwPopupButton', 'gwPopupLoading'); 11418 } else { 11419 blockButton('gwActivateIcon_' + id, 'autorenewal_' + id + '_loading', 'block'); 11420 } 11421 11422 $.post(AJAXACTIONS_URL + '?action=billing', { 11423 'action': 'addGWAutorenewal', 11424 'id': id, 11425 }, function (response) { 11426 blockAddGWAutorenewalButton = false;
11427 if (typeof (billing) != 'undefined') { 11428 unBlockButton('gwPopupButton', 'gwPopupLoading'); 11429 } else { 11430 unBlockButton('gwActivateIcon_' + id, 'autorenewal_' + id + '_loading', 'block'); 11431 } 11432 if (response.status == 0) { 11433 showPopupMessage(response.message); 11434 } else { 11435 if (typeof (billing) == 'undefined') { 11436 showPopupMessage(response.message); 11437 insideCloudPage("dashboard-google-workspace", "main", "&show=google-workspace&page=" + page); 11438 hidePopup(); 11439 } else { 11440 showPopupMessage(response.message); 11441 insideCloudPage("gwTable", "billing", "&show=gwTable&page=1"); 11442 hidePopup(); 11443 } 11444 } 11445 }, 'json'); 11446 }); 11447} 11448 11449function billing_addGWAutorenewal () { 11450 if (blockAddGWAutorenewalButton == true) { 11451 return false; 11452 } 11453 blockAddGWAutorenewalButton = true; 11454 blockButton('gwPopupButton', 'gwPopupLoading'); 11455 var id = $('#addGWs').val(); 11456 $.post(AJAXACTIONS_URL + '?action=billing', { 11457 'action': 'getGWAutorenewalConfirmation', 11458 'id': id, 11459 }, function(response) { 11460 blockAddGWAutorenewalButton = false; 11461 unBlockButton('gwPopupButton', 'gwPopupLoading'); 11462 if (response.status == 0) { 11463 showPopupMessage(response.message); 11464 } else { 11465 dashboard_addGWAutorenewal(id, 1, response.message, 'billing'); 11466 } 11467 }, 'json'); 11468 11469} 11470 11471var blockCancelGWAutorenewalButton = false; 11472function dashboard_cancelGWAutorenewal(id, page, warning) { 11473 showConfirmation(warning, function () { 11474 if (blockCancelGWAutorenewalButton == true) { 11475 return false; 11476 } 11477 blockCancelGWAutorenewalButton = true; 11478 blockButton('gwDeactivateIcon_' + id, 'autorenewal_' + id + '_loading'); 11479 $.post(AJAXACTIONS_URL + '?action=billing', { 11480 'action': 'cancelGWAutorenewal', 11481 'id': id, 11482 }, function(response) { 11483 blockCancelGWAutorenewalButton = false; 11484 unBlockButton('gwDeactivateIcon_' + id, 'autorenewal_' + id); 11485 if (response.status == 0) { 11486 showPopupMessage(response.message); 11487 } else { 11488 insideCloudPage("dashboard-google-workspace", "main", "&show=google-workspace&page=" + page); 11489 } 11490 }, 'json'); 11491 }); 11492} 11493 11494var blockGWDelete = false; 11495function cancelGWAutorenewal (id, page) { 11496 if (blockGWDelete == true) { 11497 return false; 11498 } 11499 blockGWDelete = true; 11500 blockButton('delete_gw_' + id + '_button', 'delete_gw_' + id + '_loading'); 11501 $.post(AJAXACTIONS_URL + '?action=billing', { 11502 'action': 'cancelGWAutorenewal', 11503 'id': id, 11504 }, function(response) { 11505 blockGWDelete = false; 11506 unBlockButton('delete_gw_' + id + '_button', 'delete_gw_' + id + '_loading'); 11507 if (response.status == 0) { 11508 showPopupMessage(response.message); 11509 } else { 11510 insideCloudPage("gwTable", "billing", "&show=gwTable&page=" + page); 11511 } 11512 }, 'json'); 11513} 11514 11515/* Autorenewals EOF */ 11516 11517/* Domain Pricing Page */ 11518function openBulkDomainRegistration () { 11519 $('#cloudnspop .popup-content').addClass('popup-content-tabs'); 11520 showPopup('domainRegister', '&show=viewRegister', function() { 11521 $('#cloudnspop .popup-content').removeClass('popup-content-tabs'); 11522 }, function(){ 11523 domain_showBulkRegistration(); 11524 }); 11525} 11526 11527 11528/* *** Responsive *** */ 11529 11530/* Mobile menu */ 11531 11532function openMobileMenu () { 11533 $(window).resize(function() { 11534 if($(this).width() > 870) { 11535 $('.mobile-nav').removeClass('show'); 11536 $('#mobileNavBtn').removeClass("close"); 11537 } 11538 }); 11539 11540 $('.open-drop-down + .menu').css('display', 'none'); 11541 $('.mobile-nav').toggleClass("show"); 11542 $('#mobileNavBtn').toggleClass("close"); 11543} 11544 11545function expandMobileMenu (element) { 11546 $(element).toggleClass('open'); 11547} 11548 11549function openWikiMenu () { 11550 $('.wiki-menu').toggleClass("show"); 11551 $('#mobileWikiBtn').toggleClass("close"); 11552} 11553 11554function showFeatures (type, element) { 11555 var translation = ''; 11556 11557 if (type == 'basic') { 11558 translation = 'basic_features'; 11559 } 11560 11561 if (type == 'extended') { 11562 translation = 'extended_features'; 11563 } 11564 11565 if (type == 'check') { 11566 translation = 'check_types'; 11567 } 11568 11569 if (type == 'notification') { 11570 translation = 'notification_types'; 11571 } 11572 11573 $(element).text(function(i, text) { 11574 return text === "+ " + __(translation) ? "- " + __(translation) : "+ " + __(translation); 11575 }); 11576 11577 $('.' + type + 'Features').toggleClass(type + "FeaturesHide"); 11578} 11579 11580/* Table scroll */ 11581function checkWidth (element, secondElement){ 11582 if (typeof(secondElement) != 'undefined') { 11583 var compareTo = secondElement; 11584 } else { 11585 var compareTo = element; 11586 } 11587 var width = $("." + compareTo).width(); 11588 if ($("." + element + " table").width() > width) { 11589 $("." + element).addClass("overx"); 11590 if (element == 'table-h-scroll.table-zones') {
11591 $("#dnsLimits").css('width', width - 20); 11592 } 11593 } else { 11594 $("." + element).removeClass("overx"); 11595 } 11596} 11597 11598function showScrollArrows () { 11599 var width = 0; 11600 var set = $(".tabs-scroll li"); 11601 set.each(function(index, element){ 11602 width += $(this).width(); 11603 if (element != (set.length - 1)) { 11604 width += parseInt($(this).css("margin-right")); 11605 } 11606 }); 11607 11608 var outerWidth = $('.tabs-scroll ul').width(); 11609 if (width > outerWidth) { 11610 $('.scrollArrow').css('display', 'block'); 11611 } else { 11612 $('.scrollArrow').css('display', 'none'); 11613 } 11614} 11615 11616var SITE_DIRECTION = 'ltr'; 11617function checkDirection (direction) { 11618 if (direction == 'rtl') { 11619 SITE_DIRECTION = 'rtl'; 11620 } 11621} 11622 11623var z = 0; 11624var tabsScroll = 0; 11625function tabsSlideLeft () { 11626 z = tabsScroll = 0; 11627 $(".tabs-scroll ul").animate({scrollLeft: "0"}); 11628} 11629 11630function tabsSlideRight (tab) { 11631 var set = $(".tabs-scroll li"); 11632 11633 if (typeof(tab) != 'undefined') { 11634 z = tab; 11635 for (var i=1; i<=z; i++) { 11636 tabsScroll += parseInt($(".tabs-scroll ul li.tab" + i).width()) + parseInt($(".tabs-scroll ul li.tab" + i).css("margin-right")); 11637 } 11638 } else { 11639 if (z < set.length) { 11640 z++; 11641 } 11642 $(".tabs-scroll ul li.tab" + (set.length-2)).css("margin-right", "15px"); 11643 var newMargin = $(".tabs-scroll ul li.tab" + z).width() + parseInt($(".tabs-scroll ul li.tab" + z).css("margin-right")); 11644 if (newMargin > tabsScroll) { 11645 tabsScroll += newMargin; 11646 } 11647 } 11648 11649 if (z+2 >= set.length) { 11650 $(".tabs-scroll ul").addClass('responsiveScroll'); 11651 } else { 11652 $(".tabs-scroll ul").removeClass('responsiveScroll'); 11653 } 11654 11655 if (SITE_DIRECTION == 'rtl') { 11656 $('.tabs-scroll ul').animate({scrollLeft: "-=" + tabsScroll}); 11657 } else { 11658 $('.tabs-scroll ul').animate({scrollLeft: "+=" + tabsScroll}); 11659 } 11660} 11661 11662function toggleZoneMenu (id) { 11663 $('.zones-menu.menu ul').not('#menu-' + id).css('display', 'none'); 11664 $('#menu-' + id).toggle(); 11665 if ($('#menu-' + id).is(':visible')) { 11666 $('#dashboard-zones table').css('padding-bottom', $('#menu-' + id).height()); 11667 } else { 11668 $('#dashboard-zones table').css('padding-bottom', '0'); 11669 } 11670} 11671 11672function toggleSharedZoneMenu (id) { 11673 $('.shared-menu.menu ul').not('#shared-menu-' + id).css('display', 'none'); 11674 $('#shared-menu-' + id).toggle(); 11675 if ($('#shared-menu-' + id).is(':visible')) { 11676 $('#dashboard-shared-zones table').css('padding-bottom', $('#shared-menu-' + id).height()); 11677 } else { 11678 $('#dashboard-shared-zones table').css('padding-bottom', '0'); 11679 } 11680} 11681 11682function toggleSSLMenu (id) { 11683 $('.ssl-menu.menu ul').not('#ssl-menu-' + id).css('display', 'none'); 11684 $('.shared-ssl-menu.menu ul').css('display', 'none'); 11685 $('#dashboard-shared-ssls table').css('padding-bottom', '0'); 11686 11687 $('#ssl-menu-' + id).toggle(); 11688 if ($('#ssl-menu-' + id).is(':visible')) { 11689 $('#dashboard-ssl-certificates table').css('padding-bottom', $('#ssl-menu-' + id).height()); 11690 } else { 11691 $('#dashboard-ssl-certificates table').css('padding-bottom', '0'); 11692 } 11693} 11694 11695function toggleSharedSSLMenu (id) { 11696 $('.shared-ssl-menu.menu ul').not('#shared-ssl-menu-' + id).css('display', 'none'); 11697 $('.ssl-menu.menu ul').css('display', 'none'); 11698 $('#dashboard-ssl-certificates table').css('padding-bottom', '0'); 11699 11700 $('#shared-ssl-menu-' + id).toggle(); 11701 if ($('#shared-ssl-menu-' + id).is(':visible')) { 11702 $('#dashboard-shared-ssls table').css('padding-bottom', $('#shared-ssl-menu-' + id).height()); 11703 } else { 11704 $('#dashboard-shared-ssls table').css('padding-bottom', '0'); 11705 } 11706} 11707 11708function hideSSLMenus () { 11709 $('.ssl-menu.menu ul').css('display', 'none'); 11710 $('.shared-ssl-menu.menu ul').css('display', 'none'); 11711 11712 $('#dashboard-ssl-certificates table').css('padding-bottom', '0'); 11713 $('#dashboard-shared-ssls table').css('padding-bottom', '0'); 11714} 11715 11716$(document).on('click.sslMenus', function (event) { 11717 if ($(event.target).closest('.ssl-menu.menu, .shared-ssl-menu.menu').length) { 11718 return; 11719 } 11720 11721 hideSSLMenus(); 11722}); 11723 11724function toggleRecordsMenu (id) { 11725 11726 $('.records-menu.menu ul').not('#records-menu-' + id).css('display', 'none'); 11727 $('#records-menu-' + id).toggle(); 11728 if ($('#records-menu-' + id).is(':visible')) { 11729 $('#records-table table').css('padding-bottom', $('#records-menu-' + id).height()); 11730 } else { 11731 $('#records-table table').css('padding-bottom', '0'); 11732 } 11733} 11734 11735function toggleZoneButtonMenu (id) { 11736 $('.zones-button-menu.menu ul').not('#button-menu-' + id).css('display', 'none'); 11737 $('#button-menu-' + id).toggle(); 11738 if ($('#button-menu-' + id).is(':visible')) { 11739 $('#zone-name-wraper').attr('style', 'padding-bottom: ' + $('#button-menu-' + id).height() + 'px !important');
11740 $('#quickSearchWraper').css('top', '1px'); 11741 } else { 11742 $('#zone-name-wraper').css('padding-bottom', '0'); 11743 $('#quickSearchWraper').css('top', '-30px'); 11744 } 11745} 11746 11747function toggleGoogleWorkspaceMenu (id) { 11748 $('.gw-menu.menu ul').not('#gw-menu-' + id).css('display', 'none'); 11749 $('#gw-menu-' + id).toggle(); 11750 if ($('#gw-menu-' + id).is(':visible')) { 11751 $('#dashboard-google-workspace table').css('padding-bottom', $('#gw-menu-' + id).height()); 11752 } else { 11753 $('#dashboard-google-workspace table').css('padding-bottom', '0'); 11754 } 11755} 11756 11757function toggleMonitoringMenu (id) { 11758 $('.monitoring-records-menu ul').not('#monitoring-records-menu-' + id).css('display', 'none'); 11759 $('#monitoring-records-menu-' + id).toggle(); 11760 if ($('#monitoring-records-menu-' + id).is(':visible')) { 11761 $('#dashboard-monitoring-records table').css('padding-bottom', $('#monitoring-records-menu-' + id).height()); 11762 } else { 11763 $('#dashboard-monitoring-records table').css('padding-bottom', '0'); 11764 } 11765} 11766 11767function toggleFailoverMenu(id) { 11768 $('.failover-records-menu ul').not('#failover-records-menu-' + id).css('display', 'none'); 11769 $('#failover-records-menu-' + id).toggle(); 11770 if ($('#failover-records-menu-' + id).is(':visible')) { 11771 $('#dashboard-failover-records table').css('padding-bottom', $('#failover-records-menu-' + id).height()); 11772 } else { 11773 $('#dashboard-failover-records table').css('padding-bottom', '0'); 11774 } 11775} 11776 11777function toggleBackupsMenu (id) { 11778 $('.zones-menu.menu ul').not('#menu-' + id).css('display', 'none'); 11779 $('#menu-' + id).toggle(); 11780 if ($('#menu-' + id).is(':visible')) { 11781 $('#backups-table table').css('padding-bottom', $('#menu-' + id).height()); 11782 } else { 11783 $('#backups-table table').css('padding-bottom', '0'); 11784 } 11785} 11786 11787function toggleBackupsRecordsMenu (id) { 11788 $('.records-menu.menu ul').not('#records-menu-' + id).css('display', 'none'); 11789 $('#records-menu-' + id).toggle(); 11790 if ($('#records-menu-' + id).is(':visible')) { 11791 $('#backup-zone-table table').css('padding-bottom', $('#records-menu-' + id).height()); 11792 $('#backup-deleted-zone-records-table table').css('padding-bottom', $('#records-menu-' + id).height()); 11793 } else { 11794 $('#backup-zone-table table').css('padding-bottom', '0'); 11795 $('#backup-deleted-zone-records-table table').css('padding-bottom', '0'); 11796 } 11797} 11798 11799function showFreeSslDeleted (zone_id) { 11800 showPopup('view-dns-backup-deleted', '&show=freessl&zone=' + zone_id); 11801} 11802 11803var blockAdyen = false; 11804function submit_adyenCardDetails (id) { 11805 11806 $('#encryptedCardNumber').tipsy('hide'); 11807 $('#encryptedExpiryMonth').tipsy('hide'); 11808 $('#encryptedExpiryYear').tipsy('hide'); 11809 $('#encryptedSecurityCode').tipsy('hide'); 11810 $('#holderName').tipsy('hide'); 11811 11812 if (blockAdyen == true) { 11813 return false; 11814 } 11815 blockAdyen = true; 11816 blockButton('submitCardDetails', 'loading_adyen'); 11817 11818 $.post(AJAXACTIONS_URL + '?action=order', { 11819 'action': 'adyenCardDetails', 11820 'order_id': id, 11821 'encryptedExpiryMonth': $('#encryptedMonthBlob').val(), 11822 'encryptedExpiryYear': $('#encryptedYearBlob').val(), 11823 'encryptedCardNumber': $('#encryptedCardBlob').val(), 11824 'encryptedSecurityCode': $('#encryptedCvcBlob').val(), 11825 'holderName': $('#holderName').val(), 11826 'currency': $('#currency').val(), 11827 }, function(response) { 11828 unBlockButton('submitCardDetails', 'loading_adyen'); 11829 blockAdyen = false; 11830 11831 if (response.status == 0) { 11832 if (typeof(response.errors) != 'undefined') { 11833 $.each(response.errors, function(index, message) { 11834 var element = $('#' + index); 11835 var tipsyGravity = 'w'; 11836 if (index == 'encryptedExpiryMonth') { 11837 tipsyGravity = 'n'; 11838 } 11839 if (index == 'amount') { 11840 tipsyGravity = 'e'; 11841 } 11842 element.addClass('border-color', 'red'); 11843 element.attr('title', message); 11844 element.tipsy({ 11845 gravity: tipsyGravity, 11846 trigger: 'manual', 11847 html: false 11848 }); 11849 element.tipsy('show'); 11850 $(window).resize(function(){ 11851 element.tipsy('show'); 11852 }); 11853 }); 11854 } else { 11855 showPopupMessage(response.message); 11856 } 11857 } else if (typeof response.redirect !== 'undefined') { 11858 $('#adyen_redirect_form_container').html(response.redirect); 11859 $('#adyen_redirect_form').submit(); 11860 } else if (typeof(response.url) != 'undefined') { 11861 window.location = response.url; 11862 } else { 11863 window.location = '/payment/notify/success/'; 11864 } 11865 11866 }, 'json'); 11867} 11868 11869var blockAdyenCheckout = false;
11870function submit_adyenCheckoutCardDetails (id) { 11871 11872 $('#encryptedCardNumber').tipsy('hide'); 11873 $('#encryptedExpiryMonth').tipsy('hide'); 11874 $('#encryptedExpiryYear').tipsy('hide'); 11875 $('#encryptedSecurityCode').tipsy('hide'); 11876 $('#holderName').tipsy('hide'); 11877 11878 if (blockAdyenCheckout == true) { 11879 return false; 11880 } 11881 blockAdyenCheckout = true; 11882 blockButton('submitCardDetails', 'loading_adyen'); 11883 11884 $.post(AJAXACTIONS_URL + '?action=order', { 11885 'action': 'adyenCheckoutCardDetails', 11886 'order_id': id, 11887 'encryptedExpiryMonth': $('#encryptedMonthBlob').val(), 11888 'encryptedExpiryYear': $('#encryptedYearBlob').val(), 11889 'encryptedCardNumber': $('#encryptedCardBlob').val(), 11890 'encryptedSecurityCode': $('#encryptedCvcBlob').val(), 11891 'holderName': $('#holderName').val(), 11892 'currency': $('#currency').val(), 11893 }, function(response) { 11894 unBlockButton('submitCardDetails', 'loading_adyen'); 11895 blockAdyenCheckout = false; 11896 11897 if (response.status == 0) { 11898 if (typeof(response.errors) != 'undefined') { 11899 $.each(response.errors, function(index, message) { 11900 var element = $('#' + index); 11901 var tipsyGravity = 'w'; 11902 if (index == 'encryptedExpiryMonth') { 11903 tipsyGravity = 'n'; 11904 } 11905 if (index == 'amount') { 11906 tipsyGravity = 'e'; 11907 } 11908 element.addClass('border-color', 'red'); 11909 element.attr('title', message); 11910 element.tipsy({ 11911 gravity: tipsyGravity, 11912 trigger: 'manual', 11913 html: false 11914 }); 11915 element.tipsy('show'); 11916 $(window).resize(function(){ 11917 element.tipsy('show'); 11918 }); 11919 }); 11920 } else { 11921 showPopupMessage(response.message); 11922 } 11923 } else if (typeof response.redirect !== 'undefined') { 11924 $('#adyen_redirect_form_container').html(response.redirect); 11925 $('#adyen_redirect_form').submit(); 11926 } else if (typeof(response.url) != 'undefined') { 11927 window.location = response.url; 11928 } else { 11929 window.location = '/payment/notify/success/'; 11930 } 11931 11932 }, 'json'); 11933} 11934 11935function show30DaysStats (zone_id) { 11936 $('.popup-wraper').addClass('popup-700'); 11937 showPopup('main', '&show=stats30days&zone=' + zone_id, function () { 11938 $('.popup-wraper').removeClass('popup-700'); 11939 }); 11940} 11941 11942function openSubheaderMenu () { 11943 $('#subHeaderMobileMenu').toggle(); 11944} 11945 11946function zone_menuButtonsSizes () { 11947 $('.control-menu button').height('auto'); 11948 var btnWidth = $('.control-menu button').width(); 11949 var btnHeight = $('.control-menu button').height(); 11950 11951 if (btnWidth < btnHeight) { 11952 if (btnWidth+10 > btnHeight) { 11953 $('.control-menu button').height(btnWidth+10); 11954 } 11955 } else { 11956 $('.control-menu button').height(btnWidth); 11957 } 11958} 11959 11960function showNewsArticle (element, selector) { 11961 $(element).parents("." + selector).toggleClass(selector + "-focus"); 11962} 11963 11964function copyToClipboard (id) { 11965 var copyText = document.getElementById("url-" + id); 11966 11967 if (copyText.type === "hidden") { 11968 var tempElement = document.createElement("textarea"); 11969 tempElement.value = copyText.value; 11970 document.body.appendChild(tempElement); 11971 tempElement.select(); 11972 document.execCommand("copy"); 11973 document.body.removeChild(tempElement); 11974 } else { 11975 copyText.select(); 11976 document.execCommand("copy"); 11977 } 11978} 11979 11980blockCopyBtn = false; 11981function copyTextToClipboard (element, to_copy, btn, btn_loader) { 11982 blockCopyBtn = true; 11983 11984 var display = 'block'; 11985 var temp = $("<input>"); 11986 $("body").append(temp); 11987 11988 if (element == 'url') { 11989 var url = window.location.href; 11990 temp.val(url).select(); 11991 } else if (element == 'textarea') { 11992 temp.val($('#' + to_copy).val()).select(); 11993 } else { 11994 temp.val($('#' + to_copy).text()).select(); 11995 } 11996 11997 if (element = 'promo') { 11998 display = 'inline-block'; 11999 } 12000 12001 document.execCommand("copy"); 12002 blockButton(btn, btn_loader, display); 12003 if (document.execCommand("copy")) { 12004 unBlockButton(btn, btn_loader, display); 12005 blockCopyBtn = false; 12006 } 12007 temp.remove(); 12008} 12009 12010function copyRecordValueToClipboard(element) { 12011 var item = $(element); 12012 var textElement = item.find('.record-copy-text'); 12013 var value = item.attr('data-copy-value') || $.trim(item.text()); 12014 12015 if (!textElement.length) { 12016 textElement = item; 12017 } 12018 12019 var temp = $('<textarea>'); 12020 $('body').append(temp); 12021 temp.val(value).select(); 12022 document.execCommand('copy'); 12023 temp.remove(); 12024 12025 var copiedElement = item.find('.record-copy-copied'); 12026 12027 textElement.addClass('hidden'); 12028 copiedElement.removeClass('hidden'); 12029 12030 clearTimeout(item.data('copy-timeout')); 12031 item.data('copy-timeout', setTimeout(function () { 12032 copiedElement.addClass('hidden'); 12033 textElement.removeClass('hidden'); 12034 }, 1000)); 12035} 12036 12037function copyPromoCode (to_copy) { 12038 var temp = $("<input>"); 12039 $("body").append(temp); 12040 temp.val($('#' + to_copy).text()).select(); 12041 12042 //show temporary tipsy 12043 element = $('#'+to_copy); 12044 message = 'Copied'; 12045 gravity = 'w'; 12046 12047 element.attr('title', message); 12048 element.tipsy({ 12049 gravity: gravity, 12050 trigger: 'manual', 12051 fade: true, 12052 html: true 12053 }); 12054 12055 element.tipsy('show'); 12056 document.execCommand("copy"); 12057 12058 setTimeout(function () { 12059 $(element).tipsy('hide'); 12060 }, 1000); 12061 12062 temp.remove(); 12063 12064 addCloudPageCallBack(function () { 12065 $(element).tipsy('hide'); 12066 }); 12067} 12068 12069function generateSpfRecord () { 12070 var spf_string = 'v=spf1 '; 12071 var a_record = $('#spf_a_yes').is(':checked') ? 'a ' : ''; 12072 var mx_record = $('#spf_mx_yes').is(':checked') ? 'mx ' : ''; 12073 var ipv4 = $('#ipv4').val().split(' ').filter(element => element).map(i => 'ip4:' + i).join(' ') + ' '; 12074 var ipv6 = $('#ipv6').val().split(' ').filter(element => element).map(i => 'ip6:' + i).join(' ') + ' '; 12075 var include = $('#include').val().split(' ').filter(element => element).map(i => 'include:' + i).join(' ') + ' '; 12076 var policy = $('#policy').val(); 12077 12078 if (policy == '1') { 12079 policy = ' -all'; 12080 } else if (policy == '2') { 12081 policy = ' ~all'; 12082 } else if (policy == '3') { 12083 policy = ' ?all'; 12084 } 12085 12086 spf_string = spf_string.concat(mx_record).concat(a_record).concat(ipv4).concat(ipv6).concat(include).trim().concat(policy); 12087 12088 $(".spf_record").val(spf_string); 12089 12090 $("textarea").each(function () { 12091 this.setAttribute("style", "height:" + (this.scrollHeight) + "px;"); 12092 }).on("input", function () { 12093 this.style.height = (this.scrollHeight) + "px"; 12094 }); 12095} 12096 12097function generateDmarcRecord () { 12098 var dmarc_string = ''; 12099 var policy = $("input[type='radio'][name='dmarc_policy']:checked").val(); 12100 var version = $('#protocol_version').val(); 12101 var filtering = $('#filtering').val(); 12102 var interval = $('#interval').val(); 12103 var forensic = $('#forensic').val(); 12104 var aggregate = $('#aggregate').val(); 12105 12106 if (version) { 12107 version = 'v=' + version + ';'; 12108 } else { 12109 version = ''; 12110 } 12111 12112 if (policy) { 12113 policy = 'p=' + policy + ';' 12114 } else { 12115 policy = ''; 12116 } 12117 12118 if (filtering) { 12119 filtering = 'pct=' + filtering + ';'; 12120 } else { 12121 filtering = ''; 12122 } 12123 12124 if (interval) { 12125 interval = 'ri=' + interval; 12126 } else { 12127 interval = ''; 12128 } 12129 12130 if (forensic) { 12131 forensic = $('#forensic').val().split(' ').filter(element => element).map(i => 'mailto:' + i); 12132 var forensic_result = ''; 12133 12134 if (forensic.length === 1) { 12135 forensic_result = forensic[0]; 12136 } else { 12137 var forensic_last = forensic.pop(); 12138 forensic_result = forensic.join(',') + ',' + forensic_last; 12139 } 12140 12141 var forensic_string = 'ruf=' + forensic_result + ';'; 12142 } else { 12143 var forensic_string = ''; 12144 } 12145 12146 if (aggregate) { 12147 aggregate = $('#aggregate').val().split(' ').filter(element => element).map(i => 'mailto:' + i); 12148 var aggregate_result = ''; 12149 12150 if (aggregate.length === 1) { 12151 aggregate_result = aggregate[0]; 12152 } else { 12153 var aggregate_last = aggregate.pop(); 12154 aggregate_result = aggregate.join(',') + ',' + aggregate_last; 12155 } 12156
12157 var aggregate_string = 'rua=' + aggregate_result + ';'; 12158 } else { 12159 aggregate_string = ''; 12160 } 12161 12162 dmarc_string = dmarc_string.concat(version).concat(policy).concat(filtering).concat(aggregate_string).concat(forensic_string).concat(interval); 12163 12164 $(".dmarc_record").val(dmarc_string); 12165 12166 $("textarea").each(function () { 12167 this.setAttribute("style", "height:" + (this.scrollHeight) + "px;"); 12168 }).on("input", function () { 12169 this.style.height = (this.scrollHeight) + "px"; 12170 }); 12171} 12172 12173function attachFormValidation(selector, type, formSelector, tipTargetSelector, gravity) { 12174 var field = $(selector); 12175 12176 if (!field.length) { 12177 return; 12178 } 12179 12180 var form; 12181 if (formSelector) { 12182 form = $(formSelector); 12183 } else { 12184 form = field.closest('form'); 12185 } 12186 12187 if (!form.length) { 12188 return; 12189 } 12190 12191 // contacts[mail] and reg_mail/admin_mail -> mail 12192 var baseField = ''; 12193 if (type) { 12194 baseField = type.toString(); 12195 12196 var bracketMatch = baseField.match(/^contacts\[(.+)\]$/); 12197 if (bracketMatch && bracketMatch[1]) { 12198 baseField = bracketMatch[1]; 12199 } else { 12200 baseField = baseField.replace(/^[^_]+_/, ''); 12201 } 12202 12203 if (baseField === 'address1') { 12204 baseField = 'address'; 12205 } 12206 } 12207 12208 if (baseField === 'company') { 12209 var raw = (type || '').toString(); 12210 raw = raw.replace(/^contacts\[|\]$/g, ''); // contacts[company] -> company 12211 12212 var prefix = (raw.match(/^(.*_)?company$/) || [, ''])[1] || ''; 12213 var eikKey = prefix + 'eik'; 12214 12215 var eikField = form.find('#' + eikKey + ',[name="' + eikKey + '"]'); 12216 12217 if (eikField.length) { 12218 field.on('input change', function () { 12219 var companyValue = (field.val() || '').toString().trim(); 12220 12221 eikField.removeData('last-validated-value'); 12222 12223 if (companyValue === '') { 12224 eikField.trigger('focusout'); 12225 } 12226 }); 12227 } 12228 } 12229 12230 var tipTarget; 12231 if (tipTargetSelector) { 12232 tipTarget = $(tipTargetSelector); 12233 } else { 12234 tipTarget = field; 12235 } 12236 12237 if (!gravity) { 12238 gravity = 'w'; 12239 } 12240 12241 var debounceTimer = null; 12242 12243 field.on('focusout', function () { 12244 var value = ''; 12245 if (field.val() != undefined && field.val() != null) { 12246 value = field.val().toString(); 12247 } 12248 12249 var lastValue = field.data('last-validated-value'); 12250 12251 if (lastValue != undefined && lastValue == value) { 12252 return; 12253 } 12254 12255 if (debounceTimer) { 12256 clearTimeout(debounceTimer); 12257 } 12258 12259 debounceTimer = setTimeout(function () { 12260 12261 // Clear previous error state 12262 field.removeClass('error'); 12263 tipTarget.removeClass('error'); 12264 tipTarget.removeAttr('title'); 12265 12266 try { 12267 tipTarget.tipsy('hide'); 12268 } catch (e) { 12269 } 12270 12271 // reg_mail and contacts[mail] -> mail 12272 var pairs = []; 12273 12274 form.find('input, select, textarea').each(function () { 12275 12276 if (this.type === 'submit' || 12277 this.type === 'button' || 12278 this.type === 'hidden') { 12279 return; 12280 } 12281 12282 var rawName = this.name || this.id; 12283 if (!rawName) { 12284 return; 12285 } 12286 12287 var key = rawName.toString(); 12288 12289 var match = key.match(/^contacts\[(.+)\]$/); 12290 if (match && match[1]) { 12291 key = match[1]; 12292 } else { 12293 key = key.replace(/^[^_]+_/, ''); 12294 } 12295 12296 if (key === 'address1') { 12297 key = 'address'; 12298 } 12299 12300 if (!key) { 12301 return; 12302 } 12303 12304 var el = $(this); 12305 12306 if (el.is(':disabled')) { 12307 return; 12308 } 12309 12310 var val; 12311
12312 if (this.type === 'checkbox' || this.type === 'radio') { 12313 if (!el.is(':checked')) { 12314 return; 12315 } 12316 val = el.val(); 12317 } else { 12318 val = el.val(); 12319 } 12320 12321 pairs.push({ 12322 name: key, 12323 value: val 12324 }); 12325 }); 12326 12327 var serialized = $.param(pairs); 12328 12329 $.post(AJAXACTIONS_URL + '?action=order', { 12330 action: 'validateContactField', 12331 field: baseField, 12332 form: serialized 12333 }, 12334 function (response) { 12335 12336 if (!response) { 12337 return; 12338 } 12339 12340 if (response.status === 1) { 12341 field.data('last-validated-value', value); 12342 return; 12343 } 12344 12345 if (response.status === 0 && 12346 response.errors && 12347 response.errors[baseField]) { 12348 12349 field.addClass('error'); 12350 12351 tipTarget 12352 .addClass('error') 12353 .attr('title', response.errors[baseField]) 12354 .tipsy({ 12355 gravity: gravity, 12356 trigger: 'manual', 12357 html: true 12358 }) 12359 .tipsy('show'); 12360 } 12361 12362 field.data('last-validated-value', value); 12363 }, 'json'); 12364 }, 150); 12365 }); 12366} 12367 12368function attachFormValidationAuto(formSelector) { 12369 var form = $(formSelector); 12370 12371 if (!form.length) { 12372 return; 12373 } 12374 12375 form.find('input, select, textarea').each(function () { 12376 12377 if (this.type === 'submit' || this.type === 'button' || this.type === 'hidden') { 12378 return; 12379 } 12380 12381 if ($(this).data('skip-auto-validation')) { 12382 return; 12383 } 12384 12385 var fieldType = this.name || this.id; 12386 if (!fieldType) { 12387 return; 12388 } 12389 12390 // for *_telnocc and contacts[telnocc] 12391 if (/(^|_)telnocc$/.test(fieldType) || fieldType === 'contacts[telnocc]') { 12392 12393 var id = this.id; 12394 var tipTarget = null; 12395 12396 if (id) { 12397 tipTarget = formSelector + ' label[for="' + id + '"]'; 12398 } 12399 12400 attachFormValidation(this, fieldType, formSelector, tipTarget, 'e'); 12401 return; 12402 } 12403 12404 attachFormValidation(this, fieldType, formSelector); 12405 }); 12406} 12407 12408function deleteFromCart (product_id) { 12409 $.post(AJAXACTIONS_URL + '?action=order', { 12410 'action': 'deleteFromCart', 12411 'product_id': product_id 12412 }, function(response) { 12413 if (response.status == 0) { 12414 showPopupMessage(response.message); 12415 } else { 12416 insideCloudPage('cart-products', 'cart', '&show=products-table'); 12417 insideCloudPage('cart-payment', 'cart', '&show=payment-page'); 12418 updateCart(); 12419 } 12420 }, 'json'); 12421} 12422 12423function checkContacts() { 12424 var scroll = $('#cartForm').offset().top; 12425 12426 $.post(AJAXACTIONS_URL + '?action=order', { 12427 'action': 'checkContacts', 12428 'form': $('#cartForm').serialize(), 12429 }, function (response) { 12430 if (response.status == 0) { 12431 if (typeof (response.message) != 'undefined') { 12432 showPopupMessage(response.message); 12433 } else if (typeof (response.errors) != 'undefined') { 12434 $(document).scrollTop(scroll); 12435 var tos = false;
12436 var gravity = 'w'; 12437 $.each(response.errors, function (type, message) { 12438 if (type == 'tos') { 12439 tos = true; 12440 gravity = 'e'; 12441 } 12442 element = $('#cartForm #' + type); 12443 12444 if (type == 'payment_method') { 12445 gravity = 'e'; 12446 element = $('#cartForm input[type="radio"][name="payment_method"]:checked + span'); 12447 } 12448 12449 if (type == 'telnocc' || type == 'faxnocc') { 12450 gravity = 'e'; 12451 element = $('#cartForm label[for="' + type + '"]'); 12452 } 12453 12454 if (type == 'telnocc' || type == 'faxnocc') { 12455 $('#cartForm #' + type).addClass('error'); 12456 } else { 12457 element.addClass('error'); 12458 } 12459 element.attr('title', message); 12460 element.tipsy({ 12461 gravity: gravity, 12462 trigger: 'manual', 12463 html: true 12464 }); 12465 element.tipsy('show'); 12466 }); 12467 $(window).resize(function () { 12468 $.each(response.errors, function (type, message) { 12469 if (type == 'tos') { 12470 tos = true; 12471 gravity = 'e'; 12472 } 12473 element = $('#cartForm #' + type); 12474 12475 if (type == 'payment_method') { 12476 gravity = 'e'; 12477 element = $('#cartForm input[type="radio"][name="payment_method"]:checked + span'); 12478 } 12479 12480 element.addClass('error'); 12481 element.attr('title', message); 12482 element.tipsy({ 12483 gravity: gravity, 12484 trigger: 'manual', 12485 html: true 12486 }); 12487 element.tipsy('show'); 12488 }); 12489 }); 12490 if (tos) { 12491 scrolll = $('#tos').offset().top; 12492 $(document).scrollTop(scrolll); 12493 } 12494 } 12495 } else { 12496 insideCloudPage('cart-products', 'cart', '&show=products-table'); 12497 insideCloudPage('cart-payment', 'cart', '&show=payment-page'); 12498 updateCart(); 12499 } 12500 }, 'json'); 12501} 12502 12503var BLOCK_CHECKOUT_BUTTON = false; 12504function submitCartOrder () { 12505 if (BLOCK_CHECKOUT_BUTTON === true) { 12506 return false; 12507 } 12508 BLOCK_CHECKOUT_BUTTON = true; 12509 blockButton('checkout_button', 'checkout_loading'); 12510 var scroll = $('#cartForm').offset().top; 12511 12512 $.post(AJAXACTIONS_URL + '?action=order', { 12513 'action': 'submitOrder', 12514 'form': $('#cartForm').serialize(), 12515 'cvv': $('#encryptedCvcBlob').val(), 12516 'tos': $('#tos_checkbox').is(':checked') ? 1 : 0, 12517 }, function(response) { 12518 12519 BLOCK_CHECKOUT_BUTTON = false;
12520 unBlockButton('checkout_button', 'checkout_loading', 'inline'); 12521 if (typeof response.redirect !== 'undefined') { 12522 $('#adyen_redirect_form_container').html(response.redirect); 12523 $('#adyen_redirect_form').submit(); 12524 } else if (typeof(response.url) != 'undefined') { 12525 window.location = response.url; 12526 } else { 12527 $.each($(':input'), function(index, element) { 12528 $('#tos').tipsy('hide'); 12529 $(element).tipsy('hide'); 12530 $(element).removeClass('error'); 12531 }); 12532 if (response.status == 0) { 12533 if (typeof(response.message) != 'undefined') { 12534 showPopupMessage(response.message); 12535 } else if (typeof(response.errors) != 'undefined') { 12536 $(document).scrollTop(scroll); 12537 var tos = false; 12538 var gravity = 'w'; 12539 $.each(response.errors, function(type, message) { 12540 if (type == 'tos') { 12541 tos = true; 12542 gravity = 'e'; 12543 } 12544 element = $('#cartForm #' + type); 12545 12546 if (type == 'payment_method') { 12547 gravity = 'e'; 12548 element = $('#cartForm input[type="radio"][name="payment_method"]:checked + span'); 12549 } 12550 12551 if (type == 'telnocc' || type == 'faxnocc') { 12552 gravity = 'e'; 12553 element = $('#cartForm label[for="' + type + '"]'); 12554 } 12555 12556 if (type == 'telnocc' || type == 'faxnocc') { 12557 $('#cartForm #' + type).addClass('error'); 12558 } else { 12559 element.addClass('error'); 12560 } 12561 element.attr('title', message); 12562 element.tipsy({ 12563 gravity: gravity, 12564 trigger: 'manual', 12565 html: true 12566 }); 12567 element.tipsy('show'); 12568 }); 12569 $(window).resize(function(){ 12570 $.each(response.errors, function(type, message) { 12571 if (type == 'tos') { 12572 tos = true; 12573 gravity = 'e'; 12574 } 12575 element = $('#cartForm #' + type); 12576 12577 if (type == 'payment_method') { 12578 gravity = 'e'; 12579 element = $('#cartForm input[type="radio"][name="payment_method"]:checked + span'); 12580 } 12581 12582 element.addClass('error'); 12583 element.attr('title', message); 12584 element.tipsy({ 12585 gravity: gravity, 12586 trigger: 'manual', 12587 html: true 12588 }); 12589 element.tipsy('show'); 12590 }); 12591 }); 12592 if (tos) { 12593 scrolll = $('#tos').offset().top; 12594 $(document).scrollTop(scrolll); 12595 } 12596 } 12597 } else { 12598 insideCloudPage('cart-products', 'cart', '&show=products-table'); 12599 insideCloudPage('cart-payment', 'cart', '&show=payment-page'); 12600 updateCart(); 12601 } 12602 } 12603 }, 'json'); 12604} 12605 12606function payOrderAgain (order_id) { 12607 if (BLOCK_CHECKOUT_BUTTON === true) { 12608 return false; 12609 } 12610 BLOCK_CHECKOUT_BUTTON = true; 12611 blockButton('checkout_button', 'checkout_loading'); 12612 $.post(AJAXACTIONS_URL + '?action=orders', { 12613 'action': 'payOrderAgain', 12614 'order_id': order_id, 12615 'cvv': $('#encryptedCvcBlob').val(), 12616 'method': $('[name=payment_method]:radio:checked').val() 12617 }, function(response) { 12618 12619 BLOCK_CHECKOUT_BUTTON = false; 12620 unBlockButton('checkout_button', 'checkout_loading', 'inline'); 12621 if (typeof response.redirect !== 'undefined') { 12622 $('#adyen_redirect_form_container').html(response.redirect); 12623 $('#adyen_redirect_form').submit(); 12624 } else if (typeof(response.url) != 'undefined') { 12625 window.location = response.url; 12626 } else { 12627 showPopupMessage(response.message); 12628 } 12629 }, 'json'); 12630} 12631 12632BLOCK_TRY_AGAIN_BUTTON = false; 12633function orderAutoRenewalTryAgain (order_id) { 12634 if (BLOCK_TRY_AGAIN_BUTTON === true) { 12635 return false; 12636 } 12637 BLOCK_TRY_AGAIN_BUTTON = true; 12638 12639 blockButton('try_again_button', 'try_again_loading', 'inline'); 12640 $.post(AJAXACTIONS_URL + '?action=orders', { 12641 'action': 'autoRenewalTryAgain', 12642 'order_id': order_id 12643 }, function(response) { 12644 12645 BLOCK_TRY_AGAIN_BUTTON = false; 12646 unBlockButton('try_again_button', 'try_again_loading', 'inline'); 12647 if (typeof response.action !== 'undefined' && typeof response.message === 'undefined') { 12648 window.location = '/'; 12649 return; 12650 } 12651 if (response.status == 1) { 12652 window.location = response.url; 12653 } else { 12654 showPopupMessage(response.message); 12655 } 12656 }, 'json'); 12657} 12658 12659function zone_showHostSearch () { 12660 $('.host-filed').css('display', 'none'); 12661 $('.search-by-host').css('display', 'flex'); 12662 $('#hostInput').focus(); 12663} 12664 12665function zone_showPointstoSearch () { 12666 $('.points-to-filed').css('display', 'none'); 12667 $('.search-by-points-to').css('display', 'flex'); 12668 $('#pointsToInput').focus(); 12669 $('#pointsToInput').val(SEARCH_BY_POINTS_TO); 12670} 12671 12672var BLOCK_HOST_SEARCH = false;
12673var ZONE_RECORDS_HOSTNAME = null; 12674function zone_searchByHost (pagination) { 12675 if (BLOCK_HOST_SEARCH == true) { 12676 return false; 12677 } 12678 BLOCK_HOST_SEARCH = true; 12679 blockButton('hostsearch_button', 'hostsearch_loading'); 12680 12681 var tld = $('#hostInput').val().toLowerCase(); 12682 12683 if (typeof(pagination) == undefined) { 12684 if (tld.length >= 1) { 12685 12686 var nomatch = $('td div.host-name:not(:contains("' + tld + '"))'); 12687 var match = $('td div.host-name:contains("' + tld + '")'); 12688 12689 nomatch.parents('tr').addClass('records-hide'); 12690 match.parents('tr').removeClass('records-hide'); 12691 } else { 12692 $('.records').removeClass('records-hide'); 12693 } 12694 12695 BLOCK_HOST_SEARCH = false; 12696 unBlockButton('hostsearch_button', 'hostsearch_loading'); 12697 } else { 12698 ZONE_RECORDS_HOSTNAME = tld; 12699 zone_getRecords(); 12700 BLOCK_HOST_SEARCH = false; 12701 unBlockButton('hostsearch_button', 'hostsearch_loading'); 12702 } 12703} 12704 12705var ZONE_RECORDS_LOCATION = null; 12706function zone_searchByLocation (pagination) { 12707 12708 var location = $('#location').val(); 12709 12710 if (typeof(pagination) == undefined) { 12711 if (location.length >= 1) { 12712 12713 var nomatch = $('td div.host-name:not(:contains("' + location + '"))'); 12714 var match = $('td div.host-name:contains("' + location + '")'); 12715 12716 nomatch.parents('tr').addClass('records-hide'); 12717 match.parents('tr').removeClass('records-hide'); 12718 } else { 12719 $('.records').removeClass('records-hide'); 12720 } 12721 12722 } else { 12723 ZONE_RECORDS_LOCATION = location; 12724 zone_getRecords(); 12725 } 12726} 12727 12728var BLOCK_POINTSTO_SEARCH = false; 12729var SEARCH_BY_POINTS_TO = null; 12730var RELOAD_WITH_SEARCH = false; 12731function zone_searchByPointsTo () { 12732 if (typeof $('#pointsToInput').val() === 'undefined' || $('#pointsToInput').val().length == 0 && SEARCH_BY_POINTS_TO !== null && RELOAD_WITH_SEARCH !== true) { 12733 SEARCH_BY_POINTS_TO = null; 12734 } else { 12735 RELOAD_WITH_SEARCH = false; 12736 } 12737 12738 if (BLOCK_POINTSTO_SEARCH == true) { 12739 return false; 12740 } 12741 12742 BLOCK_POINTSTO_SEARCH = true; 12743 blockButton('pointsto_button', 'pointsto_loading'); 12744 12745 var record = typeof $('#pointsToInput').val() !== 'undefined' ? $('#pointsToInput').val().toLowerCase() : ''; 12746 if (!SEARCH_BY_POINTS_TO || record.length > 0) { 12747 SEARCH_BY_POINTS_TO = record; 12748 } 12749 12750 if (SEARCH_BY_POINTS_TO.length >= 1) { 12751 zone_showPointstoSearch(); 12752 checkClearable(); 12753 var nomatch = $('td div.pointsto-filed:not(:contains("' + SEARCH_BY_POINTS_TO + '"))'); 12754 var match = $('td div.pointsto-filed:contains("' + SEARCH_BY_POINTS_TO + '")'); 12755 $('.filter-warning').addClass('records-hide'); 12756 $('.ns-warning').addClass('records-hide'); 12757 12758 if (match.length < 1) { 12759 $('.hidden-filter-warning').removeClass('records-hide'); 12760 } 12761 12762 nomatch.parents('tr').addClass('records-hide'); 12763 match.parents('tr').removeClass('records-hide'); 12764 } else { 12765 $('.records').removeClass('records-hide'); 12766 $('.ns-warning').removeClass('records-hide'); 12767 $('.filter-warning').removeClass('records-hide'); 12768 $('.hidden-filter-warning').addClass('records-hide'); 12769 SEARCH_BY_POINTS_TO = null; 12770 } 12771 BLOCK_POINTSTO_SEARCH = false; 12772 unBlockButton('pointsto_button', 'pointsto_loading'); 12773} 12774 12775function resizeWikiVideo () { 12776 var width = $('.wiki-content iframe').width(); 12777 var unit = (width/16); 12778 var height = (unit*9); 12779 $('.wiki-content iframe').height(height); 12780} 12781 12782function resizeFilterInput () { 12783 if ($('body').width() <= 870) { 12784 $('input.tld-filter').width('10px'); 12785 var tldWidth = $('tr.tlds:not(".tldsHide")').children('td.tld').width(); 12786 $('input.tld-filter').width(tldWidth); 12787 } 12788} 12789 12790function checkLivechatMail () { 12791 12792 var element = $('#livechatMail'); 12793 12794 element.tipsy('hide'); 12795 element.removeClass('error'); 12796 12797 var regex = /^[^\s@]+@[^\s@]+\.[a-zA-z]+$/; 12798 if (!regex.test(element.val())) { 12799 element.addClass('error'); 12800 element.attr('title', 'You need to enter a valid email address'); 12801 element.tipsy({ 12802 gravity: 's', 12803 trigger: 'manual', 12804 html: true 12805 }); 12806 element.tipsy('show'); 12807 $(window).resize(function(){ 12808 element.tipsy('show'); 12809 }); 12810 } else { 12811 Tawk_API.setAttributes({'name' : element.val(), 'email' : element.val() }, function(error){}); 12812 Tawk_API.popup(); 12813 hidePopupMessage(); 12814 } 12815} 12816 12817function showHideClearButton(id) { 12818 var inputVal = $('#ns_' + id).val(); 12819 12820 if (inputVal != '') { 12821 $('#clear_ns_' + id).removeClass('hidden'); 12822 } else { 12823 $('#clear_ns_' + id).addClass('hidden'); 12824 } 12825} 12826 12827function checkOrderStatus(order, status, time, callback) { 12828 $.post(AJAXACTIONS_URL + '?action=orders', { 12829 'type': 'getOrderStatus', 12830 'order_id': order 12831 }, function(newStatus) { 12832 if (newStatus != status) { 12833 callback(); 12834 } else { 12835 setTimeout(function () { 12836 checkOrderStatus(order, status, time, callback); 12837 }, time); 12838 } 12839 }, 'json'); 12840} 12841 12842function landing_dnsPremiumPromo (type_id, period) { 12843 $.post(AJAXACTIONS_URL + '?action=premium-dns-promo', { 12844 'type': 'orderPremiumDnsPromo', 12845 'type_id': type_id, 12846 'period': period 12847 }, function(response) { 12848 if (!response.status) { 12849 showPopupMessage(response.message); 12850 } else { 12851 window.location = '/order/step/1/type/dns-promo'; 12852 } 12853 }, 'json'); 12854 return false;
12855} 12856 12857function dnsPremiumPromo_addToCart (type_id) { 12858 $.post(AJAXACTIONS_URL + '?action=premium-dns-promo', { 12859 'type': 'addToCart', 12860 'type_id': type_id 12861 }, function(response) { 12862 if (!response.status) { 12863 showPopupMessage(response.message); 12864 } else { 12865 window.location.href = '/order/step/1/'; 12866 } 12867 }, 'json'); 12868 return false; 12869} 12870 12871function dedicatedIpsPromo_addToCart (type_id) { 12872 var period = $('input[name=period_' + type_id + ']:checked').val(); 12873 12874 $.post(AJAXACTIONS_URL + '?action=premium-dns-promo', { 12875 'type': 'dedicatedIps', 12876 'type_id': type_id, 12877 'months': period 12878 }, function(response) { 12879 if (!response.status) { 12880 showPopupMessage(response.message); 12881 } else { 12882 window.location.href = '/order/step/1/'; 12883 } 12884 }, 'json'); 12885 return false; 12886} 12887 12888var loadHcaptchaId = false; 12889function loadHcaptcha (callback) { 12890 if (typeof callback !== 'undefined') { 12891 loadHcaptchaId = callback; 12892 } 12893 12894 if (typeof hcaptcha === 'undefined') { 12895 var script = document.createElement('script'); 12896 script.src = "https://js.hcaptcha.com/1/api.js?render=explicit"; 12897 document.head.appendChild(script); 12898 12899 script.onload = function () { 12900 var interval = setInterval(function () { 12901 if (typeof window.hcaptcha.render !== 'undefined') { 12902 clearInterval(interval); 12903 12904 if (loadHcaptchaId) { 12905 loadHcaptchaId(); 12906 } 12907 } 12908 }, 100); 12909 }; 12910 12911 script.onerror = function () { 12912 loadJs(function () { 12913 loadHcaptchaId(); 12914 }, 'hcaptcha'); 12915 }; 12916 } else { 12917 if (loadHcaptchaId) { 12918 loadHcaptchaId(); 12919 } 12920 } 12921} 12922 12923function externalJobs_addNew (type, values) { 12924 12925 var request = { 12926 'request' : 'addNew', 12927 'type' : parseInt(type), 12928 'data' : {} 12929 }; 12930 12931 switch (request.type) { 12932 // export failover history 12933 case 7: 12934 request.data.record_id = values.record_id; 12935 request.data.domain_id = values.domain_id; 12936 request.data.fullhost = values.fullhost; 12937 request.data.type = values.type; 12938 request.data.record_type = values.record_type; 12939 request.data.record_record = values.record_record; 12940 break; 12941 // export zones 12942 case 11: 12943 request.data.user_id = values.user_id; 12944 break; 12945 // export monitoring history 12946 case 18: 12947 request.data.record_id = values.record_id; 12948 request.data.name = values.name; 12949 request.data.type = values.type; 12950 if (values.type == 'history') { 12951 request.data.fromDate = $('#fromDate').val() || ''; 12952 request.data.toDate = $('#toDate').val() || ''; 12953 } 12954 break; 12955 } 12956 12957 $.post(AJAXACTIONS_URL + '?action=jobs', request, function (response) { 12958 if (!response.status) { 12959 var popupMessage = ''; 12960 $.each(response.errors, function (index, message) { 12961 popupMessage += message + '<br>'; 12962 }); 12963 showPopupMessage(popupMessage); 12964 } else { 12965 window.location = '/jobs/job/' + response.job_id + '/'; 12966 return true; 12967 } 12968 }, 'json'); 12969} 12970 12971function monitoring_addToCart (type_id, selector, productType) { 12972 12973 var period = $('input[name=' + selector + 'period_' + type_id + ']:checked').val(); 12974 12975 $.post(AJAXACTIONS_URL + '?action=cart', { 12976 'type': 'addMonitoring', 12977 'type_id': type_id, 12978 'months': period, 12979 'product_type': productType 12980 }, function(response) { 12981 if (!response.status) { 12982 showPopupMessage(response.message); 12983 } else { 12984 window.location.href = '/order/step/1/'; 12985 } 12986 }, 'json'); 12987} 12988 12989var blockActivateMonitoringTrial = false; 12990function monitoring_startTrial (action) { 12991 if (blockActivateMonitoringTrial == true) { 12992 return false; 12993 } 12994 blockActivateMonitoringTrial = true; 12995 blockButton(action + '-button', action + '-loading', 'block'); 12996 12997 $.post(AJAXACTIONS_URL + '?action=monitoring', { 12998 'type': 'activateTrial', 12999 'trialAction': action 13000 }, function(response) { 13001 unBlockButton(action + '-button', action + '-loading', 'block'); 13002 blockActivateMonitoringTrial = false;
13003 if (!response.status) { 13004 showPopupMessage(response.message); 13005 } else { 13006 showPopupMessage(response.message, 13007 function () { 13008 location.reload(); 13009 }); 13010 } 13011 }, 'json'); 13012} 13013 13014var blockUpgradeMonitoringPlan = false; 13015function monitoring_upgradePlan (type, confirmText) { 13016 if (blockUpgradeMonitoringPlan == true) { 13017 return false; 13018 } 13019 showConfirmation(confirmText, function () { 13020 blockUpgradeMonitoringPlan = true; 13021 blockButton('monitoring-upgrade-' + type + '-button', 'monitoring-upgrade-' + type + '-loading', 'block'); 13022 13023 $.post(AJAXACTIONS_URL + '?action=monitoring', { 13024 'type': 'upgrade', 13025 'type_id': type 13026 }, function(response) { 13027 unBlockButton('monitoring-upgrade-' + type + '-button', 'monitoring-upgrade-' + type + '-loading', 'block'); 13028 blockUpgradeMonitoringPlan = false; 13029 if (!response.status) { 13030 showPopupMessage(response.message); 13031 } else { 13032 showPopupMessage(response.message, 13033 function () { 13034 location.reload(); 13035 }); 13036 } 13037 }, 'json'); 13038 }); 13039} 13040 13041function monitoring_upgradeChecks (checks, confirmText) { 13042 showConfirmation(confirmText, function () { 13043 blockUpgradeMonitoringChecks = true; 13044 blockButton('add_checks_button', 'add_checks_loading', 'block'); 13045 13046 $.post(AJAXACTIONS_URL + '?action=monitoring', { 13047 'type': 'upgradeChecks', 13048 'checks': checks 13049 }, function(response) { 13050 unBlockButton('add_checks_button', 'add_checks_loading', 'inline-block'); 13051 blockUpgradeMonitoringChecks = false; 13052 if (!response.status) { 13053 showPopupMessage(response.message); 13054 } else { 13055 showPopupMessage(response.message, 13056 function () { 13057 location.reload(); 13058 }); 13059 } 13060 }, 'json'); 13061 }); 13062} 13063 13064var blockUpgradeMonitoringChecks = false; 13065function monitoring_getChecksUpgradeTime () { 13066 if (blockUpgradeMonitoringPlan == true) { 13067 return false; 13068 } 13069 var checks = $('#additional_checks').val(); 13070 $.post(AJAXACTIONS_URL + '?action=monitoring', { 13071 'type': 'getUpgradeChecksTimeMessage', 13072 'checks': checks 13073 }, function(response) { 13074 if (response.status == 0) { 13075 showPopupMessage(response.message); 13076 } else { 13077 monitoring_upgradeChecks(checks, response.message); 13078 } 13079 }, 'json'); 13080} 13081 13082var blockMonitoringAddAutorenewal = false; 13083function monitoring_addAutorenewal() { 13084 if (blockMonitoringAddAutorenewal == true) { 13085 return false; 13086 } 13087 blockMonitoringAddAutorenewal = true; 13088 blockButton('planButton', 'plan_loading'); 13089 $.post(AJAXACTIONS_URL + '?action=billing', { 13090 'action': 'addMonitoringAutorenewal' 13091 }, function(response) { 13092 if (response.status == 0) { 13093 blockMonitoringAddAutorenewal = false; 13094 unBlockButton('planButton', 'plan_loading'); 13095 showPopupMessage(response.message); 13096 } else if (typeof(response.order_id) != 'undefined') { 13097 $('#processWaiting').css('display', 'block'); 13098 setTimeout(function () { 13099 window.location = '/orders/view/' + response.order_id + '/'; 13100 }, 10000); 13101 } else { 13102 window.location = '/subscription-monitoring/'; 13103 } 13104 }, 'json'); 13105} 13106 13107function monitoring_cancelAutorenewal(warning) { 13108 showConfirmation(warning, function () { 13109 $.post(AJAXACTIONS_URL + '?action=billing', { 13110 'action': 'cancelMonitoringAutorenewal' 13111 }, function(response) { 13112 if (response.status == 0) { 13113 showPopupMessage(response.message); 13114 } else { 13115 window.location = '/subscription-monitoring/'; 13116 } 13117 }, 'json'); 13118 }); 13119} 13120 13121function monitoring_resetKey (id, warning) { 13122 showConfirmation(warning, function () { 13123 $.post(AJAXACTIONS_URL + '?action=monitoring', { 13124 'type': 'resetKey', 13125 'id': id 13126 }, function(response) { 13127 if (response.status == 0) { 13128 showPopupMessage(response.message); 13129 } else { 13130 showPopupMessage(response.message, function() { 13131 window.location = '/monitoring-records/record/' + id + '/'; 13132 }); 13133 } 13134 }, 'json'); 13135 }); 13136} 13137 13138var blockMonitoringContactsSave = false; 13139function monitoring_saveContacts (record_id) { 13140 if (blockMonitoringContactsSave == true) { 13141 return false; 13142 } 13143 blockMonitoringContactsSave = true; 13144 blockButton('saveContacts', 'contacts_loading'); 13145 13146 $.each($('.input-text'), function (index, element) { 13147 $(element).tipsy('hide'); 13148 }); 13149 $('.select').tipsy('hide'); 13150 $.post(AJAXACTIONS_URL + '?action=profile', { 13151 'type': 'saveContactDetails', 13152 'name': $('#name').val(), 13153 'company': $('#company').val(), 13154 'vat': $('#vat').val(), 13155 'eik': $('#eik').val(), 13156 'address': $('#address').val(), 13157 'zip': $('#zip').val(), 13158 'city': $('#city').val(), 13159 'state': $('#state').val(), 13160 'country': $('#country').val(), 13161 'telno': $('#telno').val(), 13162 'telnocc': $('#telnocc').val(), 13163 'password': $('#password').val() 13164 }, function(response) { 13165 if (typeof response.action !== 'undefined') { 13166 eval(response.action); 13167 return false;
13168 } 13169 $('#password').val(''); 13170 if (response.status == 0) { 13171 unBlockButton('saveContacts', 'contacts_loading', 'block'); 13172 blockMonitoringContactsSave = false; 13173 if (typeof(response.errors) == 'object') { 13174 $.each(response.errors, function(type, message) { 13175 var element = $('#' + type); 13176 if (type == 'telnocc') { 13177 var tipsyGravity = 'e'; 13178 } else { 13179 var tipsyGravity = 'w'; 13180 } 13181 element.attr('title', message); 13182 element.tipsy({ 13183 gravity: tipsyGravity, 13184 trigger: 'manual', 13185 html: true 13186 }); 13187 element.tipsy('show'); 13188 }); 13189 13190 $(window).resize(function(){ 13191 $.each(response.errors, function(type, message) { 13192 var element = $('#' + type); 13193 if (type == 'telnocc') { 13194 var tipsyGravity = 'e'; 13195 } else { 13196 var tipsyGravity = 'w'; 13197 } 13198 element.attr('title', message); 13199 element.tipsy({ 13200 gravity: tipsyGravity, 13201 trigger: 'manual', 13202 html: true 13203 }); 13204 element.tipsy('show'); 13205 }); 13206 }); 13207 13208 $(window).scroll(function(){ 13209 $.each(response.errors, function(type, message) { 13210 var element = $('#' + type); 13211 if (type == 'telnocc') { 13212 var tipsyGravity = 'e'; 13213 } else { 13214 var tipsyGravity = 'w'; 13215 } 13216 element.attr('title', message); 13217 element.tipsy({ 13218 gravity: tipsyGravity, 13219 trigger: 'manual', 13220 html: true 13221 }); 13222 element.tipsy('show'); 13223 }); 13224 }); 13225 } else { 13226 showPopupMessage(response.errors); 13227 } 13228 } else { 13229 monitoring_createNotification(record_id); 13230 } 13231 }, 'json'); 13232} 13233 13234function monitoring_copyExistingRecord(record_id, page) { 13235 $.post(AJAXACTIONS_URL + '?action=monitoring-records', { 13236 'action': 'copyMonitoringRecord', 13237 'record_id': record_id, 13238 }, function(data) { 13239 response = JSON.parse(data); 13240 if (typeof(response.action) != 'undefined') { 13241 eval(response.action); 13242 } else if (response.record_status == 0) { 13243 showPopupMessage(response.message); 13244 } else { 13245 additionalData = response.additional_data; 13246 showPopup('monitoring-records', '&show=add-new&page=' + page, function(){}, function() { 13247 $('#fo_name').val(response.name); 13248 if (response.check_type_id != 12) { 13249 $('#fo_ip').val(response.ip); 13250 13251 $('#fo_ip').on('input', function() { 13252 let value = $(this).val(); 13253 let isIP = /^(\d{1,3}\.){3}\d{1,3}$/.test(value) || /^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$/.test(value); 13254 13255 $('.fo_host_ip_choice').css('display', isIP ? 'none' : 'flex'); 13256 }); 13257 13258 $('#fo_ip').trigger('input'); 13259 } 13260 $('#fo_check_type').val(response.check_type_id); 13261 13262 if (response.check_type_id != 10) { 13263 $('#fo_monitoring_region').val(response.monitoring_region); 13264 } 13265 13266 $('#fo_check_period').val(response.check_period); 13267 $('#fo_status_change_checks').val(response.status_change_checks); 13268 13269 if (response.state == 1) { 13270 $('#monitoring_state_active').prop('checked', true); 13271 } else { 13272 $('#monitoring_state_paused').prop('checked', true); 13273 } 13274 13275 if (response.check_type_id == 4 || response.check_type_id == 5 || response.check_type_id == 6 || response.check_type_id == 7) { 13276 $('#fo_http_host').val(response.check_settings.host); 13277 $('#fo_http_port').val(response.check_settings.port); 13278 $('#fo_http_path').val(response.check_settings.path); 13279 $('#fo_http_status_code').val(response.check_settings.http_status_code); 13280 $('#fo_http_timeout').val(response.check_settings.timeout); 13281 } 13282 13283 if (response.config.ip_type == 1) { 13284 $('#ip_type_both').prop('checked', true); 13285 } 13286 13287 if (response.config.ip_type == 2) { 13288 $('#ip_type_ipv4').prop('checked', true); 13289 } 13290 13291 if (response.config.ip_type == 3) { 13292 $('#ip_type_ipv6').prop('checked', true); 13293 } 13294 13295 if (response.check_type_id == 6 || response.check_type_id == 7 ) { 13296 13297 $('#fo_http_content').val(response.check_settings.content); 13298 13299 if (response.check_settings.content_match == 1) { 13300 $('#fo_http_match_type_exact').prop('checked', true); 13301 } 13302 13303 if (response.check_settings.content_match == 2) { 13304 $('#fo_http_match_type_keyword').prop('checked', true); 13305 } 13306 13307 if (response.check_settings.content_match == 3) { 13308 $('#fo_http_match_type_regex').prop('checked', true); 13309 } 13310 } 13311 13312 if (response.check_type_id == 8 || response.check_type_id == 9 || response.check_type_id == 15) { 13313 $('#fo_port').val(response.check_settings.port); 13314 13315 if (response.check_settings.open == 1) { 13316 $('#monitoring_port_open').prop('checked', true); 13317 } 13318 13319 if (response.check_settings.open == 0) { 13320 $('#monitoring_port_closed').prop('checked', true); 13321 } 13322 } 13323 13324 if (response.check_type_id == 10) { 13325 $('#fo_dns_host').val(response.check_settings.host); 13326 $('#fo_dns_type').val(response.check_settings.query_type); 13327 $('#fo_dns_response').val(response.check_settings.response); 13328 } 13329 13330 if (response.check_type_id == 13) { 13331 $('#fo_ssl_host').val(response.check_settings.host); 13332 $('#fo_ssl_port').val(response.check_settings.port); 13333 $('#fo_ssl_timeout').val(response.check_settings.timeout); 13334 $('#fo_notification_days').val(response.config.notification_days); 13335 $('#fo_self_cacert').prop('checked', response.check_settings.cacert) 13336 $('#fo_ssl_cacert').val(response.check_settings.cacert); 13337 } 13338 13339 if (response.check_type_id == 16) { 13340 $('#fo_url').val(response.check_settings.url); 13341 $('#fo_audio_threshold').val(response.check_settings.audio_threshold); 13342 } 13343 13344 if(response.check_type_id == 17) { 13345 $('#fo_ping_threshold').val(response.check_settings.ping_threshold); 13346 $('#fo_latency_limit').val(response.check_settings.latency_limit); 13347 $('#fo_ping_timeout').val(response.check_settings.timeout); 13348 } 13349 if(response.check_type_id == 18) { 13350 if (response.check_settings.http_protocol === 'https') { 13351 $('#web_protocol_https').prop('checked', true); 13352 $('#web_protocol_http').prop('checked', false); 13353 } else { 13354 $('#web_protocol_https').prop('checked', false); 13355 $('#web_protocol_http').prop('checked', true); 13356 } 13357 $('#fo_http_host').val(response.check_settings.host); 13358 $('#fo_http_port').val(response.check_settings.port); 13359 $('#fo_http_path').val(response.check_settings.path); 13360 $('#fo_http_status_code').val(response.check_settings.http_status_code); 13361 $('#fo_http_content').val(response.check_settings.content); 13362 $('#http_request_type').val(response.check_settings.http_request_type); 13363 $('#fo_http_timeout').val(response.check_settings.timeout); 13364 $('#fo_header').prop('checked', 13365 response.check_settings.header_name && 13366 response.check_settings.header_value && 13367 response.check_settings.header_name.length > 0 && 13368 response.check_settings.header_value.length > 0 13369 ); 13370 $('#fo_header_name').val(response.check_settings.header_name); 13371 $('#fo_header_value').val(response.check_settings.header_value); 13372 13373 if (response.check_settings.content_match == 1) { 13374 $('#web_custom_string_yes').prop('checked', true); 13375 $('#fo_http_match_type_exact').prop('checked', true); 13376 } 13377 13378 if (response.check_settings.content_match == 2) { 13379 $('#web_custom_string_yes').prop('checked', true); 13380 $('#fo_http_match_type_keyword').prop('checked', true); 13381 } 13382 13383 if (response.check_settings.content_match == 3) { 13384 $('#web_custom_string_yes').prop('checked', true); 13385 $('#fo_http_match_type_regex').prop('checked', true); 13386 } 13387 13388 if (response.check_settings.content_match == undefined) { 13389 $('#web_custom_string_no').prop('checked', true); 13390 } 13391 } 13392 13393 if(response.check_type_id == 15){ 13394 $('#connection_security').val(response.check_settings.connection_security); 13395 } 13396 }); 13397 } 13398 }); 13399} 13400 13401function billing_cancelMonitoringAutorenewal() { 13402 $.post(AJAXACTIONS_URL + '?action=billing', { 13403 'action': 'cancelMonitoringAutorenewal' 13404 }, function(response) { 13405 if (response.status == 0) { 13406 showPopupMessage(response.message); 13407 } else { 13408 insideCloudPage("monitoringTable", "billing", "&show=monitoringTable"); 13409 } 13410 }, 'json'); 13411} 13412 13413function billing_changeMonitoringAutorenewalPeriod () { 13414 $.post(AJAXACTIONS_URL + '?action=billing', { 13415 'action': 'changeMonitoringAutorenewalPeriod', 13416 'period': $('input[name="period"]:checked').val(), 13417 }, function(response) { 13418 if (response.status == 0) { 13419 showPopupMessage(response.message); 13420 } else { 13421 insideCloudPage("monitoringTable", "billing", "&show=monitoringTable"); 13422 hidePopup(); 13423 } 13424 }, 'json'); 13425} 13426 13427function billing_changeGwAutorenewalPeriod (id) { 13428 $.post(AJAXACTIONS_URL + '?action=billing', { 13429 'action': 'changeGwAutorenewalPeriod', 13430 'period': $('input[name="period"]:checked').val(), 13431 'gw_id': id 13432 }, function(response) { 13433 if (response.status == 0) { 13434 showPopupMessage(response.message); 13435 } else { 13436 insideCloudPage("gwTable", "billing", "&show=gwTable&page=1"); 13437 hidePopup(); 13438 } 13439 }, 'json'); 13440} 13441 13442function billing_changeDomainAutorenewalPeriod (id) { 13443 $.post(AJAXACTIONS_URL + '?action=billing', { 13444 'action': 'changeDomainAutorenewalPeriod', 13445 'period': $('input[name="period"]:checked').val(), 13446 'domain_id': id 13447 }, function(response) { 13448 if (response.status == 0) { 13449 showPopupMessage(response.message); 13450 } else { 13451 insideCloudPage("domainsTable", "billing", "&show=domainsTable&page=1"); 13452 hidePopup(); 13453 } 13454 }, 'json'); 13455} 13456 13457function api_showSubIdSearch () { 13458 $('.sub-id-filed').css('display', 'none'); 13459 $('#sub-id-title').css('display', 'none'); 13460 $('.search-by-sub-id').css('display', 'flex'); 13461} 13462 13463function api_showSubUserSearch () { 13464 $('.sub-user-filed').css('display', 'none'); 13465 $('#sub-user-title').css('display', 'none'); 13466 $('.search-by-sub-user').css('display', 'flex'); 13467} 13468 13469function api_searchBySubUser (page) { 13470 13471 var apiUserId = $('#idInput').val();
13472 var apiUser = $('#userInput').val(); 13473 13474 insideCloudPage('subUsersTableBody', 'api-settings', '&show=apiSubUsersTable&page=' + page + '&api-user-id=' + apiUserId + '&api-user=' + apiUser); 13475} 13476 13477function hideSubSearchForms () { 13478 if ($('#userInput').val() == 0) { 13479 $('.sub-user-filed').css('display', 'inline-block'); 13480 $('#sub-user-title').css('display', 'inline-block'); 13481 $('.search-by-sub-user').css('display', 'none'); 13482 } 13483 if ($('#idInput').val() == 0) { 13484 $('.sub-id-filed').css('display', 'inline-block'); 13485 $('#sub-id-title').css('display', 'inline-block'); 13486 $('.search-by-sub-id').css('display', 'none'); 13487 } 13488} 13489 13490function fixTableColSpan (groups, element) { 13491 var windowWidth = $(window).width(); 13492 13493 if (groups == 1) { 13494 $(element).attr('colspan', 2); 13495 } else { 13496 if (windowWidth <= 1020) { 13497 $(element).attr('colspan', 2); 13498 } else { 13499 $(element).attr('colspan', 3); 13500 } 13501 } 13502} 13503 13504function tools_changeMethodOptions () { 13505 var toolType = $('.search-tool').val(); 13506 $('.search-resolver').css('display', 'none'); 13507 $('.search-location').css('display', 'none'); 13508 $('.search-record-type').css('display', 'none'); 13509 $('.search-nameserver').css('display', 'none'); 13510 13511 if (toolType == 'ip' || toolType == 'audit') { 13512 $('.search-resolver').css('display', ''); 13513 } 13514 if (toolType == 'speed') { 13515 $('.search-location').css('display', ''); 13516 $('.search-record-type').css('display', ''); 13517 $('.search-nameserver').css('display', ''); 13518 } 13519} 13520 13521function zone_namedCheckzone (zone_id) { 13522 $.post(AJAXACTIONS_URL + '?action=records', { 13523 'show': 'named-checkzone', 13524 'zone': zone_id 13525 }, function (data) { 13526 if (typeof(data.action) != 'undefined') { 13527 eval(data.action); 13528 } else { 13529 showPopupMessage(data); 13530 } 13531 }); 13532} 13533 13534function useForAllContactTypes () { 13535 if ($('#useForAllContactTypes').is(':checked')) { 13536 $('table.contacts').css('display', 'none'); 13537 $('#reg_contacts').css('display', 'table'); 13538 $('#registrant_contacts').css('display', 'table'); 13539 } else { 13540 $('table.contacts').css('display', 'table'); 13541 } 13542} 13543 13544 13545var removedColspan = null; 13546function changeColspan(element, compareWidth, originalValue) { 13547 var width = $("body").width(); 13548 var $table = $(".table-zones"); 13549 13550 if (width <= compareWidth) { 13551 $.each(element, function (elm, value) { 13552 var newColspan = (originalValue + value); 13553 $table.find('.' + elm).attr('colspan', newColspan); 13554 13555 if (value == 0) { 13556 var $removeColspan = $table.find('.heading-first-row .' + elm); 13557 13558 if ($removeColspan.length > 0) { 13559 removedColspan = $removeColspan.detach(); 13560 } 13561 } 13562 }); 13563 } 13564 13565 if (width > compareWidth) { 13566 if (removedColspan && $table.find('.heading-first-row .removeColspan').length === 0) { 13567 $table.find(".heading-first-row").append(removedColspan); 13568 removedColspan = null; 13569 } 13570 13571 $.each(element, function (elm, value) { 13572 $table.find('.' + elm).attr('colspan', originalValue); 13573 }); 13574 } 13575} 13576 13577function scrollPageTo (elementName) { 13578 const scrollToElement = document.getElementById(elementName); 13579 const yOffset = -100; 13580 const y = scrollToElement.getBoundingClientRect().top + window.pageYOffset + yOffset; 13581 window.scrollTo({ top: y, behavior: 'smooth' }); 13582 setTimeout(() => { 13583 $('#' + elementName).focus(); 13584 }, 300); 13585} 13586 13587function sendContactForm() { 13588 $.post(AJAXACTIONS_URL + '?action=case-studies', { 13589 'action': 'sendContactForm', 13590 'name': $('#name').val(), 13591 'email': $('#email').val(), 13592 'company': $('#company').val(), 13593 'challenges': $('#challenges').val(), 13594 'number-of-domains': $('#number-of-domains').val(), 13595 'number-of-ssls': $('#number-of-ssls').val(), 13596 'number-of-users': $('#number-of-users').val(), 13597 'type': $('#type').val(), 13598 'form_type': $('#form-type').val() 13599 }, function (data) { 13600 response = JSON.parse(data); 13601 if (response.status == 0) { 13602 $('#name').css('border-color', ''); 13603 $('#email').css('border-color', ''); 13604 $('#challenges').css('border-color', ''); 13605 for (i = 0; i < response.errors.length; i++) { 13606 $('#' + response.errors[i]).css('border-color', 'red'); 13607 } 13608 } else { 13609 $('#name').val('').css('border-color', ''); 13610 $('#email').val('').css('border-color', ''); 13611 $('#company').val(''); 13612 $('#challenges').val('').css('border-color', ''); 13613 $('#number-of-domains').val('').css('border-color', ''); 13614 $('#number-of-ssls').val('').css('border-color', ''); 13615 $('#number-of-users').val('').css('border-color', ''); 13616 showPopupMessage(response.message); 13617 } 13618 }); 13619} 13620 13621function getOffer (product) { 13622 13623 var name = $('#name').val(); 13624 var mail = $('#mail').val(); 13625 var ddos = $('[name=ddos]:radio:checked').val(); 13626 var zones = $('#zones').val(); 13627 var records = $('#records').val(); 13628 var queries = $('#queries').val(); 13629 var queryPeaks = $('#queryPeaks').val(); 13630 var forwards = $('#forwards').val(); 13631 var geodns = $('[name=geodns]:radio:checked').val(); 13632 var dedicatedServerNames = $('[name=dedicatedServerNames]:radio:checked').val(); 13633 var requirements = $('#requirements').val(); 13634 var hcaptchaResponse = ''; 13635 13636 if ($('#offer-form .h-captcha').length && typeof hcaptcha_id !== 'undefined') { 13637 hcaptchaResponse = hcaptcha.getResponse(hcaptcha_id); 13638 } 13639 13640 $.post(AJAXACTIONS_URL + '?action=get-offer', { 13641 'action': 'getOffer', 13642 'name': name, 13643 'mail': mail, 13644 'ddos': ddos, 13645 'zones': zones, 13646 'records': records, 13647 'queries': queries, 13648 'queryPeaks': queryPeaks, 13649 'forwards': forwards, 13650 'geodns': geodns, 13651 'dedicatedServerNames': dedicatedServerNames, 13652 'requirements': requirements, 13653 'product': product, 13654 'hcaptcha': hcaptchaResponse 13655 13656 }, function (data) { 13657 response = JSON.parse(data); 13658 13659 if (response.status == 1) { 13660 if (typeof(response.plan) != 'undefined') { 13661 showPopup('get-offer', '&show=planInfo&i
13661d='+response.plan+'&name='+name+'&mail='+mail+'&ddos='+ddos+'&zones='+zones+'&records='+records+'&queries='+queries+'&queryPeaks='+queryPeaks+'&forwards='+forwards+'&geodns='+geodns+'&dedicatedServerNames='+dedicatedServerNames+'&requirements='+requirements); 13662 } else { 13663 sendToSales(product); 13664 } 13665 } else { 13666 window.location = response.redirect; 13667 } 13668 }); 13669} 13670 13671function sendToSales (product) { 13672 $.post(AJAXACTIONS_URL + '?action=get-offer', { 13673 'action': 'sendToSales', 13674 'name': $('#name').val(), 13675 'mail': $('#mail').val(), 13676 'ddos': $('[name=ddos]:radio:checked').val(), 13677 'zones': $('#zones').val(), 13678 'records': $('#records').val(), 13679 'queries': $('#queries').val(), 13680 'queryPeaks': $('#queryPeaks').val(), 13681 'forwards': $('#forwards').val(), 13682 'geodns': $('[name=geodns]:radio:checked').val(), 13683 'dedicatedServerNames': $('[name=dedicatedServerNames]:radio:checked').val(), 13684 'requirements': $('#requirements').val(), 13685 'product': product 13686 }, function (data) { 13687 response = JSON.parse(data); 13688 window.location = response.redirect; 13689 }); 13690} 13691 13692function sortDomainPricingList (element, category) { 13693 var order = $('.' + element).hasClass('ASC') ? 'DESC' : 'ASC'; 13694 var orderBy = element; 13695 $('.' + element).removeClass('ASC'); 13696 $('.' + element).removeClass('DESC'); 13697 $('.arrow-span').removeClass('up').removeClass('sorting-arrow'); 13698 13699 if (order == 'DESC' && element != 'privacy-protection' && element != 'dnssec') { 13700 orderBy += '-desc'; 13701 } 13702 13703 if (order == 'ASC' && (element == 'privacy-protection' || element == 'dnssec')) { 13704 orderBy += '-asc'; 13705 } 13706 13707 insideCloudPage('domain-pricing-list-table', 'domain-pricing-list', '&show=table&order-by=' + orderBy + '&category=' + category, function() { 13708 $('.' + element).removeClass('ASC').removeClass('DESC'); 13709 $('.' + element).addClass(order); 13710 if (order == 'ASC') { 13711 $('.' + element).next('.arrow-span').addClass('sorting-arrow up'); 13712 13713 } else { 13714 $('.' + element).next('.arrow-span').removeClass('up'); 13715 $('.' + element).next('.arrow-span').addClass('sorting-arrow'); 13716 } 13717 }); 13718} 13719 13720function initMap() { 13721 var defaultZoom = 2; 13722 var isMobile = window.innerWidth <= 768; 13723 13724 loadJs(function () { 13725 var map = L.map('map', { 13726 center: [31.505, -0.09], 13727 zoom: defaultZoom, 13728 dragging: isMobile, 13729 maxBounds: [ 13730 [-90, -180], 13731 [90, 180] 13732 ], 13733 zoomControl: false, 13734 minZoom: 2, 13735 maxZoom: 7 13736 }); 13737 var data = mapContent; 13738 // ÐÐ±Ñ Ð¾Ð¶Ð´Ð°Ð½Ðµ на обекÑиÑе в GeoJSON и добавÑне на latency Ñ Ð½Ñкакво random ÑиÑло за Ñега 13739 data.features.forEach(function (feature) { 13740 feature.properties.latency = Math.random() * 100; 13741 }); 13742 13743 L.geoJSON(data, { 13744 style: function (feature) { 13745 var latency = feature.properties.latency; 13746 var fillColor = latency > 50 ? 'red' : 'green'; 13747 13748 return { 13749 fillColor: fillColor, 13750 weight: 0.3, 13751 opacity: 1, 13752 color: 'white', 13753 fillOpacity: 0.7 13754 }; 13755 }, 13756 onEachFeature: function (feature, layer) { 13757 layer.on('click', function () { 13758 var countryInfo = feature.properties; 13759 alert('Country: ' + countryInfo.name + '\nLatency: ' + countryInfo.latency); 13760 }); 13761 13762 var latency = feature.properties.latency; 13763 var fillColor = latency > 50 ? 'red' : 'green'; 13764 13765 // ÐобавÑне на ÑÑбиÑие за навлизане на миÑкаÑа в дÑÑжава (mouseout) 13766 layer.on('mouseover', function () { 13767 layer.setStyle({ 13768 fillColor: fillColor, 13769 fillOpacity: 0.3 13770 }); 13771 }); 13772 13773 // ÐобавÑне на ÑÑбиÑие за напÑÑкане на миÑкаÑа (mouseout) 13774 layer.on('mouseout', function () { 13775 layer.setStyle({ 13776 fillColor: fillColor, 13777 fillOpacity: 0.7 13778 }); 13779 }); 13780 } 13781 }).addTo(map); 13782 13783 //забÑанÑва zoom ÑÑÑ ÑкÑола 13784 map.scrollWheelZoom.disable(); 13785 13786 //zoom + бÑÑон 13787 document.getElementById('zoom-in-button').addEventListener('click', function () { 13788 var currentZoom = map.getZoom(); 13789 var newZoom = currentZoom + 1; 13790 map.setZoom(newZoom); 13791 }); 13792 13793 //zoom - бÑÑон 13794 document.getElementById('zoom-out-button').addEventListener('click', function () { 13795 var currentZoom = map.getZoom(); 13796 var newZoom = currentZoom - 1; 13797 map.setZoom(newZoom); 13798 }); 13799 13800 //ТÑк Ñе позволÑва меÑÑенеÑо по каÑÑаÑа, Ñамо ако е ÑазлиÑен Ð¾Ñ deffault-Ð½Ð¸Ñ Ð¸Ð»Ð¸ е на мобилно 13801 map.on('zoomend', function () { 13802 var currentZoom = map.getZoom(); 13803 13804 if (isMobile) { 13805 map.dragging.enable(); 13806 } else { 13807 if (currentZoom !== defaultZoom) { 13808 map.dragging.enable(); 13809 } else { 13810 map.dragging.disable();
13811 map.setView([51.505, -0.09], defaultZoom); 13812 } 13813 } 13814 }); 13815 }, 'map'); 13816} 13817 13818function toggleFileInput() { 13819 var selectFileRadio = document.getElementById("select_file"); 13820 var fileInput = document.getElementById("file_input"); 13821 var textInput = document.getElementById("text_input"); 13822 13823 if (selectFileRadio.checked) { 13824 fileInput.style.display = "block"; 13825 textInput.style.display = "none"; 13826 } else { 13827 fileInput.style.display = "none"; 13828 textInput.style.display = "block"; 13829 } 13830} 13831 13832function changeTheme(theme, url, version) { 13833 13834 if (typeof(url) != 'undefined' && typeof(version) != 'undefined') { 13835 var link = document.createElement('link'); 13836 link.href = url + "/css/darktheme.css?ver=" + version; 13837 link.rel = "stylesheet"; 13838 link.type = "text/css"; 13839 link.defer = true; 13840 document.head.appendChild(link); 13841 } 13842 13843 $.post(AJAXACTIONS_URL + '?action=themes', { 13844 'type': 'changeTheme', 13845 'theme': theme 13846 }, function(response) { 13847 if (response) { 13848 location.reload(); 13849 } 13850 }, 'json'); 13851 13852} 13853 13854function getFromRedirectUrl () { 13855 var isEditMode = $('#editRecordRecord').length > 0; 13856 var prefix = isEditMode ? 'editRecord' : 'addRecord'; 13857 13858 $('#' + prefix + 'WRFrameTitle').val(''); 13859 $('#' + prefix + 'WRFrameDescription').val(''); 13860 $('#' + prefix + 'WRFrameKeywords').val(''); 13861 $('#' + prefix + 'WRFrameFaviconUrl').val(''); 13862 13863 var url = $('#' + prefix + 'Record').val().trim(); 13864 13865 showPopupMessage('<div class="a-c"><div class="lds-roller"><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div></div></div>'); 13866 13867 $.post(AJAXACTIONS_URL + '?action=records', { 13868 'type': 'getUrlMetadata', 13869 'url': url, 13870 'zone': window.domain 13871 }, function(response) { 13872 hidePopupMessage(); 13873 if (response.status == 1) { 13874 if (response.title) $('#' + prefix + 'WRFrameTitle').val(response.title); 13875 if (response.description) $('#' + prefix + 'WRFrameDescription').val(response.description); 13876 if (response.keywords) $('#' + prefix + 'WRFrameKeywords').val(response.keywords); 13877 if (response.favicon) $('#' + prefix + 'WRFrameFaviconUrl').val(response.favicon); 13878 13879 showPopupMessage(response.message); 13880 } else { 13881 showPopupMessage(response.message); 13882 } 13883 }, 'json'); 13884 13885 return false; 13886} 13887 13888function refreshRecordsCount (zoneId) { 13889 $.post(AJAXACTIONS_URL + '?action=records', { 13890 'show': 'refreshRecordsCount', 13891 'zone': zoneId 13892 }, function(response) { 13893 if (response && response.count) { 13894 $('.records-count').text(response.count); 13895 } 13896 }, 'json'); 13897} 13898 13899function scrollToFailoverTable() { 13900 if ($('.table-failover-records').length) { 13901 $('html, body').animate({ 13902 scrollTop: $('.table-failover-records').offset().top 13903 }, 500); 13904 } 13905} 13906 13907var BLOCK_PROFILE_EMAIL_HISTORY_DOMAIN_SEARCH = false; 13908var PROFILE_EMAIL_HISTORY_DOMAIN = null; 13909 13910function profile_getEmailHistory(page) { 13911 var emailHistoryPage = (typeof page !== 'undefined' && page !== '') ? page : 1; 13912 var domain = ''; 13913 13914 if (PROFILE_EMAIL_HISTORY_DOMAIN && PROFILE_EMAIL_HISTORY_DOMAIN.length > 0) { 13915 domain = '&domain=' + encodeURIComponent(PROFILE_EMAIL_HISTORY_DOMAIN); 13916 } 13917 13918 insideCloudPage('profile-email-history', 'profile', '&show=email_history&page=' + emailHistoryPage + domain); 13919} 13920 13921function profile_searchEmailHistoryDomain(pagination) { 13922 if (BLOCK_PROFILE_EMAIL_HISTORY_DOMAIN_SEARCH === true) { 13923 return false; 13924 } 13925 13926 BLOCK_PROFILE_EMAIL_HISTORY_DOMAIN_SEARCH = true; 13927 blockButton('emailHistoryDomainSearchButton', 'emailHistoryDomainSearchLoading'); 13928 13929 var domain = $('#emailHistoryDomainInput').val().toLowerCase().trim(); 13930 13931 if (typeof(pagination) == 'undefined') { 13932 if (domain.length >= 1) { 13933 var nomatch = $('td.email-history-domain-name:not(:contains("' + domain + '"))'); 13934 var match = $('td.email-history-domain-name:contains("' + domain + '")'); 13935 13936 nomatch.parents('tr.email-history-row').addClass('records-hide'); 13937 match.parents('tr.email-history-row').removeClass('records-hide'); 13938 } else { 13939 $('tr.email-history-row').removeClass('records-hide'); 13940 } 13941 13942 BLOCK_PROFILE_EMAIL_HISTORY_DOMAIN_SEARCH = false;
13943 unBlockButton('emailHistoryDomainSearchButton', 'emailHistoryDomainSearchLoading'); 13944 } else { 13945 PROFILE_EMAIL_HISTORY_DOMAIN = domain; 13946 profile_getEmailHistory(); 13947 13948 BLOCK_PROFILE_EMAIL_HISTORY_DOMAIN_SEARCH = false; 13949 unBlockButton('emailHistoryDomainSearchButton', 'emailHistoryDomainSearchLoading'); 13950 } 13951} 13952 13953function initMonitoringTableBody() { 13954 $("#monitoring-table-body .showMonitoringRecordsTitle").tooltip({ 13955 track: true, 13956 delay: 0, 13957 showURL: false, 13958 showBody: "<body>", 13959 fade: 250 13960 }); 13961 13962 $("#monitoring-table-body .notes-on-click").off('click.monitoring').on('click.monitoring', function(e) { 13963 e.preventDefault(); 13964 e.stopPropagation(); 13965 }); 13966} 13967 13968function initZoneTableBody() { 13969 $("#zones-table-body .showZonesTitle, #zones-table-body a.csvZonesExport").tooltip({ 13970 track: true, 13971 delay: 0, 13972 showURL: false, 13973 showBody: "<body>", 13974 fade: 250 13975 }); 13976} 13977 13978function initSharedZonesTableBody() { 13979 $("#shared-zones-table-body .showTitleShared").tooltip({ 13980 track: true, 13981 delay: 0, 13982 showURL: false, 13983 showBody: "<body>", 13984 fade: 250 13985 }); 13986} 13987 13988function initFailoverTableBody() { 13989 $("#failover-table-body .showFailoverTitle").tooltip({ 13990 track: true, 13991 delay: 0, 13992 showURL: false, 13993 showBody: "<body>", 13994 fade: 250 13995 }); 13996}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.