1function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 2function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; } 3function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } } 4function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } 5; 6// 7function log() { 8 return false; 9} 10function hide_loader() { 11 jQuery('.loader-main').hide(); 12} 13 14// get param from URL 15function getQueryString(name) { 16 var result = location.href.match(new RegExp("[\?\&]" + name + "=([^\&]+)", "i")); 17 if (result == null || result.length < 1) { 18 return ""; 19 } 20 return decodeURIComponent(result[1]); 21} 22function get_cookie(name) { 23 var matches = document.cookie.match(new RegExp("(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)")); 24 return matches ? decodeURIComponent(matches[1]) : undefined; 25} 26 27/** 28* Check if WebReg theme and layout cookie is set. If not, evaluate if security questions should appear on the first 29* page of WebReg. The cookie data for layout should always override window object. This function was created because 30* we were only checking theme/layout cookies on page load. 31* 32* @param {object} data - Registration data to set 33*/ 34function setTheme(data) { 35 var webRegThemeCookie = window.UTILS.getCookie('WebregTheme'), 36 webRegThemeLayoutCookie = window.UTILS.getCookie('WebregLayout'); 37 if (webRegThemeCookie && webRegThemeLayoutCookie) { 38 data.theme = webRegThemeCookie; 39 data.layout = webRegThemeLayoutCookie; 40 } 41} 42 43/** 44* Check window.pageData for data to include in regData cookie for webreg 45* @returns {{}} 46*/ 47function getRegDataFromPageData() { 48 var regData = {}, 49 pageData = window.pageData; 50 var sourceClass = pageData.Source.sourceClassId ? pageData.Source.sourceClassId.toLowerCase() : ''; 51 regData = { 52 source: pageData.SourceId ? pageData.SourceId : '', 53 offer: pageData.Offer ? pageData.Offer.OfferId : '', 54 promocode: pageData.Source ? pageData.Source.PromoCode : '', 55 hpc: sourceClass === '60' ? 1 : 0, 56 trackingBrowser: pageData.IpAddress ? pageData.IpAddress + '.' + pageData.VisitorId : '' 57 }; 58 return regData; 59} 60 61/** 62* Iterate over URL params to build JSON object, used to store in regData cookie for webreg
63* @param urlParams 64*/ 65function processUrlParameters(arg, regdata) { 66 var i, 67 // loop counter 68 param, 69 // will hold each parameter/value pair in a temporary array 70 prop, 71 regData = regdata, 72 // break the url parameters string into an array of strings for each parameter 73 urlParams = arg.split('&'), 74 // lookup object to match possible URL parameters to their reg object counterparts 75 expectedUrlParameters = { 76 PromoCode: 'promocode', 77 offer: 'offer', 78 hpc: 'hpc', 79 // hpc = hide promo code 80 theme: 'theme', 81 layout: 'layout', 82 Email: 'email' 83 }; 84 // iterate through the parameters 85 for (i = 0; i < urlParams.length; i++) { 86 // split each string into an array containing the param/value pair 87 param = urlParams[i].split('='); 88 89 // if the parameter matches one of our expected URL parameters 90 if (expectedUrlParameters[param[0]]) { 91 // convert properties to lowercase so that properties match 92 // corresponding data attributes in register buttons (promocode) 93 prop = param[0].toLowerCase(); 94 if (param[0] == 'Email') { 95 param[1] = decodeURIComponent(param[1]); 96 } 97 // build regData object 98 regData[prop] = decodeURI(param[1]); 99 } 100 } 101 return regData; 102} 103 104/** 105* Get data needed for WebRegistration, obtain either from pageData or from URL Params 106*/ 107function getRegData() { 108 var urlParams = location.search.substr(location.search.indexOf('?') + 1), 109 // string of URL parameters 110 regData = {}, 111 // empty object to hold registration data 112 hashIndex = urlParams.indexOf('#!'); // position of the hash in the query string 113 114 // Set default custom theme/layout 115 setTheme(regData); 116 117 // strip out hash from query string if present 118 if (hashIndex !== -1) { 119 urlParams = urlParams.substring(0, hashIndex - 1); 120 } 121 122 // if no url params, set appropriate logging message 123 if (urlParams !== '') { 124 regData = processUrlParameters(urlParams, regData); 125 } 126 127 // Extend regData with data obtained from PageData 128 regData = jQuery.extend(true, {}, getRegDataFromPageData(), regData); 129 return regData; 130} 131 132/** 133* Update regData cookie with any new info (promocodes, etc) 134* @param data 135*/ 136function updateRegDataCookie(data) { 137 var regData, newRegData, domain; 138 139 // If there's data to process 140 if (data) { 141 regData = window.UTILS.getCookie('regData'); 142 143 // If data exists parse it 144 if (regData) { 145 regData = JSON.parse(regData); 146 } 147 if (localStorage.getItem('manual_promocode')) { 148 //set at promo-code.js, when redirected from welcome/getstamps/promo-code 149 data['promocode'] = regData['promocode']; 150 localStorage.removeItem('manual_promocode'); 151 } 152 153 // Merge data 154 newRegData = jQuery.extend(true, {}, regData, data); 155 domain = '.' + window.UTILS.getDomainname(); 156 157 // Set cookie 158 window.UTILS.setCookie('regData', JSON.stringify(newRegData), 0, '/', domain); 159 } 160} 161 162/** 163* Execute pre-registration functionality and redirect to webreg. 164* @param {object} obj - DOM object that was clicked 165*/ 166function register(obj) { 167 var btn = obj, 168 dataAttr = jQuery(btn).data(), 169 regData = {}, 170 redirectLocation = window.pageData.Urls.Registration, 171 dataNewTabExists = jQuery(btn)[0].hasAttribute('data-new-tab'), 172 promise = null; 173 174 //(Special Condition) Grab any data attributes and values from registration buttons and create a JSON object 175 if (dataAttr) { 176 jQuery.each(dataAttr, function (k, v) { 177 regData[k] = v; 178 }); 179 } 180 // Write registration info to cookie for use in webreg 181 jQuery.when(updateRegDataCookie(regData)).done(function () { 182 //log info 183 var regDataCookie = window.UTILS.getCookie('regData'), 184 logData, 185 promise; 186 logData = regDataCookie.split('{').join('').split('}').join('').split('"').join('').split(':').join('=').split(',').join(', reg-data-'); 187 if (regDataCookie) { 188 promise = log({ 189 content: { 190 category: 'registration_btn_clicked', 191 regCookieData: logData 192 } 193 }); 194 } else { 195 promise = log({ 196 content: { 197 category: 'warning', 198 message: 'No regData cookie found.' 199 } 200 }); 201 } 202 if (localStorage.getItem('manual_promocode')) { 203 localStorage.removeItem('manual_promocode'); 204 } 205 if (dataNewTabExists) { 206 window.open(redirectLocation, '_blank'); 207 } else { 208 window.location.href = redirectLocation; 209 } 210 }); 211} 212function setStoreIntegrationIdCookies() { 213 var pathname = window.location.pathname; 214 var storeintegrationid_cookievalue; 215 switch (pathname) { 216 case '/partner/bigcommerce-app/': 217 storeintegrationid_cookievalue = 'bigcommerce'; 218 break; 219 case '/partner/shopify-app/': 220 storeintegrationid_cookievalue = 'shopify'; 221 break; 222 } 223 if (storeintegrationid_cookievalue) { 224 var cookieData = { 225 storeIntegrationId: { 226 value: storeintegrationid_cookievalue, 227 expires: 1, 228 domain: '.stamps.com' 229 }, 230 redirect_location: { 231 value: 'Orders', 232 expires: 365, 233 domain: '.stamps.com' 234 } 235 }; 236 for (var key in cookieData) { 237 if (!cookieData.hasOwnProperty(key)) { 238 continue; 239 }
240 var obj = cookieData[key]; 241 var value = obj.value ? obj.value : ''; 242 var expires = obj.expires ? obj.expires : 365; 243 var path = obj.path ? obj.path : '/'; 244 var domain = obj.domain ? obj.domain : window.UTILS.getDomainname(); 245 window.UTILS.setCookie(key, value, expires, path, domain); 246 } 247 } 248} 249function getSystemInfo() { 250 var userAgent = navigator.userAgent; 251 var appVersion = navigator.appVersion; 252 var OSName = ""; 253 var OSbit = ""; 254 var info = {}; 255 256 // get OS 257 if (appVersion.indexOf("Win") !== -1) { 258 OSName = "Windows"; 259 } else if (appVersion.indexOf("Mac") !== -1) { 260 OSName = "MacOS"; 261 } else if (appVersion.indexOf("X11") !== -1) { 262 OSName = "UNIX"; 263 } else if (appVersion.indexOf("Linux") !== -1) { 264 OSName = "Linux"; 265 } else if (userAgent.match(/Tablet|iPad/i)) { 266 OSName = "Tablet"; 267 } else if (userAgent.match(/Mobile|Windows Phone|Lumia|Android|webOS|iPhone|iPod|Blackberry|PlayBook|BB10|Opera Mini|\bCrMo\/|Opera Mobi/i)) { 268 OSName = "Phone"; 269 } else { 270 OSName = "Unknown OS"; 271 } 272 273 // get OS bit version 274 if (userAgent.indexOf("WOW64") !== -1 || userAgent.indexOf("Win64") !== -1) { 275 OSbit = 'x64'; 276 } else { 277 OSbit = 'x86'; 278 } 279 info.os = OSName; 280 info.osbit = OSbit; 281 return info; 282} 283 284// custom select 285function create_custom_select($selects) { 286 $selects.each(function (index, el) { 287 var $this = jQuery(this); 288 var select_label_text = $this.find('option:first').text(); 289 290 // create custom select markup 291 $this.wrap('<div class="select-wrapper"></div>'); 292 var $wrapper = $this.closest('.select-wrapper'); 293 $wrapper.append('<div class="select-label">' + select_label_text + '</div>'); 294 $wrapper.append('<div class="chosen-item">'); 295 $wrapper.append('<ul class="select-ul">'); 296 297 // populate ul with all select items 298 var $list = $wrapper.find('ul'); 299 var offset = 0; 300 var item_height = 36; 301 $this.find('option').each(function (index, el) { 302 if (index < 1) return; 303 var disabled = jQuery(el).attr('disabled') ? 'disabled' : ''; 304 var text = jQuery(el).text(); 305 jQuery(el).val(jQuery(el).val().replace(/\s+/g, '_')); // require for correct work with data attr 306 var item = "<li data-val=\"".concat(jQuery(el).val(), "\" data-offset=\"").concat(offset, "\" ").concat(disabled, ">").concat(text, "</li>"); 307 $list.append(jQuery(item)); 308 offset += item_height; 309 }); 310 }); 311} 312function add_textarea_label_class($input) { 313 $input.each(function (index, el) { 314 var $this = jQuery(this); 315 $this.closest('.wpcf7-form-control-wrap').addClass('wrap-label'); 316 }); 317} 318 319// Integrations page 320var filters = document.querySelectorAll(".nav-integrations-link"); 321var projects = document.querySelectorAll(".integrations-project"); 322if (filters.length > 0) { 323 var _iterator = _createForOfIteratorHelper(filters), 324 _step; 325 try { 326 for (_iterator.s(); !(_step = _iterator.n()).done;) { 327 var link = _step.value; 328 link.addEventListener("click", filterProjects); 329 } 330 } catch (err) { 331 _iterator.e(err); 332 } finally { 333 _iterator.f(); 334 } 335} 336function filterProjects(e) { 337 e.preventDefault(); 338 var _iterator2 = _createForOfIteratorHelper(filters), 339 _step2; 340 try { 341 for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { 342 var eachFilter = _step2.value; 343 eachFilter.classList.remove('active'); 344 } 345 } catch (err) { 346 _iterator2.e(err); 347 } finally { 348 _iterator2.f(); 349 } 350 var filter = this.dataset.filter; 351 var _iterator3 = _createForOfIteratorHelper(projects), 352 _step3; 353 try { 354 for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { 355 var project = _step3.value; 356 if (filter == "all") { 357 project.style.display = "initial"; 358 this.classList.add("active"); 359 } else if (project.classList.contains(filter)) { 360 project.style.display = "initial"; 361 this.classList.add("active"); 362 } else { 363 project.style.display = "none"; 364 } 365 } 366 } catch (err) { 367 _iterator3.e(err); 368 } finally { 369 _iterator3.f(); 370 } 371} 372 373// check promocode 374function check_promocode(promo_value, source_cpt_id) { 375 if (promo_value < 1) { 376 return false;
377 } 378 jQuery.ajax({ 379 url: myajax.url, 380 method: 'GET', 381 data: { 382 'action': 'get-promocode', 383 'nonce': myajax.nonce, 384 'promocode_value': promo_value 385 }, 386 success: function success(response) { 387 if (response.PromoCode) { 388 updateRegDataCookie({ 389 "promocode": response.PromoCode 390 }); 391 } 392 window.location.href = window.pageData.Urls.Registration; 393 }, 394 error: function error(e) { 395 console.log(e); 396 window.location.href = window.pageData.Urls.Registration; 397 } 398 }); 399} 400(function ($) { 401 if (window.location.pathname.localeCompare("/registration/") == 0 || window.location.pathname.localeCompare("/registration") == 0) { 402 typeof updateRegDataCookie !== 'undefined' && updateRegDataCookie(getRegData()); 403 window.location.href = window.pageData.Urls.Registration; 404 } 405 var sysinfo = getSystemInfo(); 406 if (sysinfo) { 407 if (sysinfo.os !== 'Windows') { 408 jQuery('.windows-only').hide(); 409 } 410 var app_link = jQuery('.download-software-start__title a'); 411 if (sysinfo.osbit === 'x86' && app_link.length) { 412 app_link.attr('href', app_link.attr('href').replace('stamps64.exe', 'stamps.exe')); 413 } 414 } 415 function checkStickyBottomOffer() { 416 var siteFooter = document.querySelector('.site-footer'); 417 var offerBar = document.querySelector('.offer-bar-wrapper.sticky-bottom'); 418 419 // Check if we have an offer bar and a footer. Add spacing to account for it. 420 if (offerBar && siteFooter) { 421 siteFooter.classList.add('offerbar-footer-spacing'); 422 } else { 423 if (!offerBar && siteFooter.classList.contains('offerbar-footer-spacing')) { 424 siteFooter.classList.remove('offerbar-footer-spacing'); 425 } 426 } 427 } 428 429 // document is ready 430 jQuery(document).ready(function () { 431 console.log('referrer: ', myajax.referrer); 432 if (myajax.referrer && myajax.referrer.length > 0 && myajax.referrer.toLowerCase().indexOf('.stamps.com') == -1) { 433 var domain = '.' + window.UTILS.getDomainname(); 434 window.UTILS.setCookie('referrer', myajax.referrer, 0, '/', domain); 435 } 436 // Log Analytics Initialization details- set window.pageData.analyticsDetails data 437 getAnalyticsToInitialize(); 438 // create custom selects 439 //create_custom_select(jQuery('select:not(".skipselect")')); 440 //wrap label for textarea 441 add_textarea_label_class(jQuery('.wpcf7-textarea')); 442 443 // wrapp submit btn to have a spiner animation 444 jQuery('input[type="submit"]').parent().addClass('submit-wrapper'); 445 446 // popup form 447 jQuery('.popup-form__title').on('click', function (e) { 448 var $popup_form = jQuery(this).closest('.popup-form-wrapper'); 449 if ($popup_form.hasClass('show-form')) { 450 $popup_form.removeClass('show-form'); 451 $popup_form.addClass('hide-form'); 452 } else { 453 $popup_form.addClass('show-form'); 454 $popup_form.removeClass('hide-form'); 455 } 456 }); 457 458 // check if form input not empty 459 /* jQuery('input[type="text"], input[type="email"], input[type="url"], input[type="password"], input[type="tel"], input[type="number"], textarea').on('keyup', function(e) { 460 let $this = jQuery(this); 461 if ($this.val().length > 0) { 462 $this.addClass('not-empty'); 463 $this.closest('.wpcf7-form-control-wrap').addClass('not-empty'); 464 } else { 465 $this.removeClass('not-empty'); 466 $this.closest('.wpcf7-form-control-wrap').removeClass('not-empty'); 467 } 468 }); */ 469 470 jQuery('input, textarea').on('focus', function (e) { 471 jQuery(this).closest('.wpcf7-form-control-wrap').addClass('focused-field'); 472 }); 473 jQuery('label[for="promocode-field"]').on('click focus', function () { 474 jQuery(this).siblings('#promoCode').focus(); 475 }); 476 jQuery('input, textarea').on('blur', function (e) { 477 jQuery(this).closest('.wpcf7-form-control-wrap').removeClass('focused-field'); 478 }); 479 480 // show/hide custom select options 481 jQuery(document).on('click', '.chosen-item, .select-label', function (e) { 482 var $this = jQuery(this); 483 var $current_select = $this.closest('.select-wrapper'); 484 jQuery('.select-wrapper').not($current_select).removeClass('open').find('ul').slideUp(); 485 $current_select.toggleClass('open').find('ul').slideToggle(); 486 }); 487 488 // close custom select on click outside it 489 jQuery(document).on('click', function (e) { 490 var $target = jQuery(e.target); 491 if (!$target.closest('.select-wrapper').length) { 492 jQuery('.select-wrapper').removeClass('open').find('ul').slideUp(); 493 } 494 }); 495 496 // choose select option on custom select option click 497 jQuery(document).on('click', '.select-wrapper ul li', function (e) { 498 var $this = jQuery(this); 499 var $wrapper = $this.closest('.select-wrapper'); 500 var $chosen_item = $wrapper.find('.chosen-item'); 501 var val = $this.data('val'); 502 var text = $this.text(); 503 var $locations = jQuery('input[name="locations"]'); 504 var $shipping_volume = jQuery('input[name="shipping_volume"]'); 505 if ($this.attr('disabled')) { 506 return false;
507 } 508 $wrapper.find('li').removeAttr('selected'); 509 $this.attr('selected', true); 510 $wrapper.addClass('not-empty'); 511 $chosen_item.text(text); 512 $locations.val(text); 513 if (text == 'Not Shipping') { 514 $shipping_volume.val('None'); 515 } else { 516 $shipping_volume.val(text); 517 } 518 if (text == "1 location") { 519 $locations.val("1"); 520 } 521 $this.closest('ul').slideUp(); 522 $wrapper.find('option').attr('selected', false); 523 // need to use 'prop'. With 'attr' there is an issue in Safari 524 $wrapper.find("option[value='" + val + "']").prop('selected', true); 525 }); 526 jQuery('.select-wrapper select').on('focus', function (e) { 527 var $this = jQuery(this); 528 $this.closest('.select-wrapper').addClass('focused'); 529 }); 530 jQuery('.select-wrapper select').on('blur', function (e) { 531 var $this = jQuery(this); 532 $this.closest('.select-wrapper').removeClass('focused'); 533 jQuery('.select-wrapper').removeClass('open').find('ul').slideUp(); 534 }); 535 536 // add key support for a custom select 537 jQuery('.select-wrapper select').on('keyup', function (e) { 538 var $this = jQuery(this); 539 var val = $this.val() === '' ? 'empty' : $this.val(); 540 var $current_select = $this.closest('.select-wrapper'); 541 var $chosen_item = $current_select.find('.chosen-item'); 542 var $current_item = $current_select.find('[data-val=' + val + ']'); 543 var text = $current_select.find('[data-val="' + val + '"]').text(); 544 var key = e.which; 545 var $items_list = $current_select.find('ul'); 546 var $locations = jQuery('input[name="locations"]'); 547 $current_select.find('option').attr('selected', false); 548 if (key !== 27 && !$current_select.hasClass('open')) { 549 $current_select.addClass('open').find('ul').slideDown(); 550 } 551 552 // esc 553 if (key === 27) { 554 $current_select.removeClass('focused'); 555 $current_select.removeClass('open').find('ul').slideUp(); 556 $current_select.find('option[value="' + val + '"]').attr('selected', true); 557 } 558 559 // space | enter 560 if (key === 13 || key === 32) { 561 jQuery('.select-wrapper').not($current_select).removeClass('open').find('ul').slideUp(); 562 $current_select.toggleClass('open').find('ul').slideToggle(); 563 $current_select.find('option[value="' + val + '"]').attr('selected', true); 564 } 565 566 // up + right 567 $current_select.find('li').removeClass('selected'); 568 if (key === 38 || key === 37) { 569 $current_item.addClass('selected'); 570 $chosen_item.text(text); 571 $locations.val(text); 572 if (text == "1 location") { 573 $locations.val("1"); 574 } 575 $current_select.addClass('not-empty'); 576 $current_select.find('option[value="' + val + '"]').attr('selected', true); 577 } 578 579 // down + left 580 if (key === 40 || key === 39) { 581 $current_item.addClass('selected'); 582 $chosen_item.text(text); 583 $locations.val(text); 584 if (text == "1 location") { 585 $locations.val("1"); 586 } 587 $current_select.addClass('not-empty'); 588 $current_select.find('option[value="' + val + '"]').attr('selected', true); 589 } 590 $items_list.scrollTop($current_item.data('offset')); 591 }); 592 593 // Offer details element click 594 jQuery('.show-offer-details').on('click', function (e) { 595 e.preventDefault(); 596 jQuery(this).attr('aria-expanded', 'true'); 597 jQuery('.offer-details-popup').removeClass('hide'); 598 jQuery('body').addClass('fixed'); 599 }); 600 601 // custom modal element click 602 jQuery('.custom-modal').on('click', function (e) { 603 e.preventDefault(); 604 var $this = jQuery(this); 605 var ytid = $this.data('ytid'); 606 var vimeoid = $this.data('vimeoid'); 607 var $modal_wrapper = jQuery('#custom-modal'); 608 var $popup_content = $modal_wrapper.find('.popup-content'); 609 var src = ''; 610 if ($modal_wrapper.length) { 611 if (ytid) { 612 src = 'https://www.youtube.com/embed/' + ytid + '?autoplay=0'; 613 } 614 if (vimeoid) { 615 src = 'https://player.vimeo.com/video/' + vimeoid + '?autoplay=1'; 616 } 617 if (ytid || vimeoid) { 618 $modal_wrapper.addClass('video-popup'); 619 var $iframe = "<iframe\n width=\"560\"\n height=\"315\"\n src=\"".concat(src, "\"\n title=\"Popup\"\n frameborder=\"0\"\n allow=\"autoplay; accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture\"\n allowfullscreen>\n </iframe>"); 620 $popup_content.html($iframe); 621 } 622 if ($this.attr('src') || $this.data('modal-image-src')) { 623 $modal_wrapper.addClass('image-popup'); 624 var modal_image_src = $this.data('modal-image-src'); 625 var _src = modal_image_src ? modal_image_src : $this.attr('src'); 626 var classes = $this[0].attributes.class.value; 627 var $image = "<figure>\n <img src=\"".concat(_src, "\" alt=\"popup image\" class=\"").concat(classes, "\">\n </figure>"); 628 $popup_content.html($image); 629 } 630 if ($this.data('modal-info')) { 631 var data = $this.closest('.features-list__item').find('.modal
631-info').html(); 632 $popup_content.html(''); 633 $popup_content.html(data); 634 } 635 if ($this.data('modal-name')) { 636 var target_modal_name = $this.data('modal-name'); 637 var target_modal_content = jQuery('[data-modal="' + target_modal_name + '"]').html(); 638 $popup_content.html(''); 639 $popup_content.html(target_modal_content); 640 } 641 if ($popup_content.html().length > 0) { 642 jQuery('body').addClass('fixed'); 643 $modal_wrapper.attr('aria-modal', 'true'); 644 $modal_wrapper.attr('aria-hidden', 'false'); 645 $modal_wrapper.removeClass('hide'); 646 jQuery('.popup-wrapper .close-popup').focus(); 647 } 648 } 649 }); 650 651 // Close popup 652 jQuery(document).on('click', function (event) { 653 var $this = jQuery(event.target); 654 if ($this.hasClass('close-popup') || !$this.closest('.popup').length && $this.closest('.popup-wrapper').length) { 655 var $modal_wrapper = jQuery('.popup-wrapper'); 656 $modal_wrapper.removeClass('video-popup').removeClass('image-popup'); 657 $modal_wrapper.attr('aria-modal', 'false'); 658 $modal_wrapper.attr('aria-hidden', 'true'); 659 $modal_wrapper.addClass('hide'); 660 $modal_wrapper.find('iframe').attr('src', ''); 661 jQuery('.show-offer-details').attr('aria-expanded', 'false'); 662 jQuery('body').removeClass('fixed'); 663 } 664 }); 665 666 // add additional attributes to the dropdown item 667 jQuery('[data-toggle="dropdown"]').attr('role', 'button').on('mouseover', function (e) { 668 if (jQuery(window).width > 991) { 669 jQuery(this).attr('aria-expanded', 'true'); 670 } 671 }).on('mouseleave', function (e) { 672 if (jQuery(window).width > 991) { 673 jQuery(this).attr('aria-expanded', 'false'); 674 } 675 }).on('click', function (e) { 676 e.preventDefault(); 677 console.log('ccll'); 678 if (jQuery(this).attr('aria-expanded') === 'false') { 679 jQuery(this).attr('aria-expanded', true); 680 } else { 681 jQuery(this).attr('aria-expanded', false); 682 } 683 jQuery(this).next('ul').slideToggle(); 684 }).on('keydown', function (e) { 685 if (e.which === 32 || e.which === 13) { 686 e.preventDefault(); 687 if (jQuery(this).attr('aria-expanded') == 'false') { 688 jQuery(this).attr('aria-expanded', true); 689 jQuery(this).next('ul').slideDown(); 690 } else { 691 jQuery(this).attr('aria-expanded', false); 692 jQuery(this).next('ul').slideUp(); 693 } 694 // jQuery(this).next('ul').slideToggle(); 695 } 696 }); 697 698 // implement menu accordion functionality on mobile devices 699 jQuery(document).on('click', '.accordion-mobile .menu-title button', function (e) { 700 if (jQuery(window).width() < 768) { 701 var $this = jQuery(this); 702 if ($this.attr('aria-expanded') === 'false') { 703 $this.attr('aria-expanded', true); 704 } else { 705 $this.attr('aria-expanded', false); 706 } 707 $this.closest('.accordion-mobile').find('ul').slideToggle(); 708 } else { 709 return false; 710 } 711 }); 712 jQuery('.site-footer .accordion-mobile').each(function (index) { 713 var accordion_title_id = jQuery(this).find('button').attr('id'); 714 jQuery(this).find('nav').attr({ 715 'aria-labelledby': accordion_title_id 716 }); 717 }); 718 719 // add keyboard support for mobile navigation 720 jQuery(document).on('keydown', '.menu-title button', function (e) { 721 if (e.which === 32 || e.which === 13) { 722 var $this = jQuery(this); 723 e.preventDefault(); 724 if ($this.attr('aria-expanded') === 'false') { 725 $this.attr('aria-expanded', true); 726 } else { 727 $this.attr('aria-expanded', false); 728 } 729 $this.closest('.accordion-mobile').find('ul').slideToggle(); 730 } 731 }); 732 733 // on scroll functionality 734 var scroll_top = 0; 735 /* if (jQuery('.offer-bar-wrapper').length && jQuery(window).width() > 768) { 736 let $offer_bar_wrapper = jQuery('.offer-bar-wrapper'); 737 let offer_bar_offset = $offer_bar_wrapper.offset().top; 738 let $offer_bar = jQuery('.offer-bar'); 739 let offer_bar_height = $offer_bar.height(); 740 let $body = jQuery('body'); 741 742 jQuery(document).on('scroll', function(e) { 743 scroll_top = jQuery(this).scrollTop(); 744 745 if (jQuery('.samples-container .offer-bar-wrapper').length) { 746 return false; 747 } 748 749 if (jQuery('.offer-bar-wrapper').length) { 750 if (scroll_top > offer_bar_offset) { 751 $body.css({ 752 'padding-top': offer_bar_height 753 });
754 $offer_bar_wrapper.addClass('fixed-bar'); 755 } else { 756 $body.css({ 757 'padding-top': '0' 758 }); 759 $offer_bar_wrapper.removeClass('fixed-bar'); 760 } 761 } 762 }); 763 } */ 764 765 checkStickyBottomOffer(); 766 767 // show/hide promocode 768 jQuery('.promocode-wrapper .message').on('click', function (e) { 769 e.preventDefault(); 770 var $btn = jQuery(this).find('.open-promocode-input'); 771 $btn.attr('aria-expanded', true); 772 jQuery('.home .grecaptcha-badge').css('visibility', 'visible'); 773 jQuery('.main-header__right').addClass('show-promo'); 774 jQuery('#promocode').css('display', 'flex'); 775 jQuery('.main-header__right .promocode-wrapper div[role="form"]'); 776 jQuery('#promocode-field').focus(); 777 jQuery('#promocode .submit-btn').removeAttr('disabled'); 778 }); 779 // Remove the label when someone starts typing. 780 jQuery('#promocode-field').on('keyup', function (e) { 781 if (jQuery('#promocode-field').val().length === 0) { 782 jQuery('.promocode label').css('opacity', '1'); 783 } else { 784 jQuery('.promocode label').css('opacity', '0'); 785 } 786 }); 787 // close promocode input 788 jQuery(document).on('click', '.promocode-wrapper .close', function (e) { 789 jQuery('.home .grecaptcha-badge').css('visibility', 'hidden'); 790 jQuery('.main-header__right').removeClass('show-promo'); 791 jQuery('.open-promocode-input').attr('aria-expanded', false).focus(); 792 jQuery('.main-header__right .promocode-wrapper form'); 793 jQuery('#promo-trigger').focus(); 794 jQuery('#promocode').css('display', 'none'); 795 jQuery('#promocode .submit-btn').attr('disabled', 'true'); 796 }); 797 var counter = 0; 798 jQuery('.mobile-promo-trigger').on('click', function (e) { 799 e.preventDefault(); 800 jQuery('.main-header__right').toggleClass('show-promo'); 801 if (counter % 2 === 0) { 802 jQuery('.main-header__right .promocode-wrapper form').css('display', 'flex'); 803 jQuery('#promocode .submit-btn').removeAttr('disabled'); 804 } else { 805 jQuery('#promocode .submit-btn').attr('disabled', 'true'); 806 jQuery('.main-header__right .promocode-wrapper form').css('display', 'none'); 807 } 808 if (jQuery(this).attr('aria-expanded') == 'false') { 809 jQuery(this).attr('aria-expanded', true); 810 } else { 811 jQuery(this).attr('aria-expanded', false); 812 } 813 jQuery(document).find('#promocode-field').blur(); 814 jQuery(document).find('#promocode-field').focus(); 815 counter++; 816 }); 817 jQuery('.navbar-toggler').on('click', function () { 818 var menu = document.getElementById('main-navigation'); 819 if (menu.classList.contains('show')) { 820 menu.classList.remove('show'); 821 menu.classList.add('collapse'); 822 } else { 823 menu.classList.add('show'); 824 menu.classList.remove('collapse'); 825 } 826 }); 827 // do nothing if click on '.inactive' btn 828 jQuery('.inactive').on('click', function (e) { 829 return false; 830 }); 831 832 // 833 var $submit_promo = jQuery('.promocode').find('.submit-btn'); 834 jQuery('.promocode-value').on('keyup', function (e) { 835 var $this = jQuery(this); 836 var val = $this.val(); 837 if (val.length > 0) { 838 $this.addClass('not-empty'); 839 $submit_promo.removeClass('inactive'); 840 } else { 841 $submit_promo.addClass('inactive'); 842 $this.removeClass('not-empty'); 843 } 844 }); 845 846 /** 847 * check promocode in url params 848 * We are not using URLSearchParams for ie11 compatibility 849 **/ 850 // let promocode = getQueryString('promocode'); 851 // var paths = ['/quickbooks/shipping-manager/plan-selection/', 852 // '/quickbooks/shipping-manager/plan-selection/confirm/', 853 // '/tellafriend/landing/' 854 // ] 855 // if (promocode && (paths.indexOf(window.location.pathname) < 0) ) { 856 // check_promocode(promocode, myajax.source_cpt_id); 857 // } 858 859 // check promocode on sumbit // radio funnel header 860 jQuery('.promocode input[type=submit]').on('click', function (e) { 861 e.preventDefault(); 862 var promocode_value = jQuery('.promocode input[type=text]').val(); 863 if (promocode_value) { 864 check_promocode(promocode_value, myajax.source_cpt_id); 865 } else { 866 window.location.href = window.pageData.Urls.Registration; 867 } 868 }); 869 870 // get tracking data 871 var tries = 0; 872 function get_tracking_data(tracking_number) { 873 var $submit = jQuery('.tracking-form form input[type="submit"]'); 874 jQuery.ajax({ 875 url: myajax.url, 876 method: 'POST', 877 data: { 878 'action': 'get-tracking-details', 879 'nonce': myajax.nonce, 880 'tracking-number': tracking_number 881 }, 882 beforeSend: function beforeSend() { 883 $submit.addClass('disabled'); 884 }, 885 success: function success(response) { 886 console.log(response); 887 $submit.removeClass('disabled'); 888 if (response && response.hasOwnProperty('errors')) { 889 jQuery('form .error-message').html(response.errors[0].error_message).show(); 890 } else { 891 window.location.href = window.location.origin + '/tracking-details/?t=' + tracking_number; 892 } 893 }, 894 error: function error(response) { 895 console.log('tries: ', tries); 896 if (tries >= 2) { 897 tries = 0; 898 var $modal_wrapper = jQuery('.popup-wrapper'); 899 var $popup_content = $modal_wrapper.find('.popup-content'); 900 jQuery('body').addClass('fixed'); 901 $modal_wrapper.attr('aria-modal', 'true'); 902 $modal_wrapper.attr('aria-hidden', 'false'); 903 $modal_wrapper.removeClass('hide'); 904 jQuery('.popup-wrapper .close-popup').focus(); 905 if (response.status === 408 || response.status === 500) { 906 $popup_content.html(jQuery('.error-modal-content').html()); 907 } else { 908 $popup_content.html(response.statusText); 909 } 910 $submit.removeClass('disabled'); 911 return false;
912 } else { 913 tries++; 914 get_tracking_data(tracking_number); 915 } 916 } 917 }); 918 } 919 920 // check tracking number 921 jQuery('.tracking-form form input[type="submit"]').on('click', function (e) { 922 e.preventDefault(); 923 var $this = jQuery(this); 924 var tracking_number = jQuery('.tracking-form form input[type="text"]').val(); 925 if (tracking_number.length < 1) { 926 jQuery('.tracking-form form input[type="text"]').addClass('validation_error'); 927 return false; 928 } else { 929 jQuery('.tracking-form form input[type="text"]').removeClass('validation_error'); 930 } 931 if ($this.hasClass('disabled')) { 932 return false; 933 } else { 934 get_tracking_data(tracking_number); 935 } 936 }); 937 938 // 939 jQuery('.see-more-details').on('click', function () { 940 jQuery('.tracking-details__list').slideDown(); 941 jQuery(this).addClass('d-none'); 942 jQuery('.see-less-details').removeClass('d-none'); 943 }); 944 jQuery('.see-less-details').on('click', function () { 945 jQuery('.tracking-details__list').slideUp(); 946 jQuery('.see-more-details').removeClass('d-none'); 947 jQuery(this).addClass('d-none'); 948 }); 949 950 // on page load update regData cookie with current info needed for webreg 951 updateRegDataCookie(getRegData()); 952 jQuery('.register, .get-started-btn').click(function (event) { 953 var element = this; 954 event.preventDefault(); 955 setStoreIntegrationIdCookies(); 956 if (typeof newrelic !== 'undefined') { 957 newrelic.addPageAction('get-started-btn', { 958 TrackingName: pageData.pageName 959 }); 960 } 961 register(element); 962 }); 963 jQuery('.login-btn').click(function (e) { 964 e.preventDefault(); 965 setStoreIntegrationIdCookies(); 966 window.location.href = window.pageData.WebPostageSignInUrl; 967 }); 968 969 // show popup form after 10s 970 if (jQuery('.popup-form-wrapper').length && jQuery(window).width() > 768) { 971 var $popup_form_wrapper = jQuery('.popup-form-wrapper'); 972 setTimeout(function () { 973 if (!$popup_form_wrapper.hasClass('show-form')) { 974 $popup_form_wrapper.addClass('show-form'); 975 } 976 }, 10000); 977 } 978 979 // show collapsed content 980 jQuery('.show-collapsed-content').on('click', function (e) { 981 e.preventDefault(); 982 jQuery(this).closest('.collapsed-content').find('.collapsed-content__text').slideToggle(); 983 }); 984 var accordion = document.querySelectorAll('.accordion-button'); 985 var accordion_content = document.querySelectorAll('.accordion-collapse'); 986 var _loop = function _loop(i) { 987 accordion[i].addEventListener('click', function (e) { 988 e.preventDefault(); 989 accordion_content[i].classList.toggle('show'); 990 accordion_content[i].classList.toggle('collapse'); 991 }); 992 }; 993 for (var i = 0; i < accordion.length; i++) { 994 _loop(i); 995 } 996 // 997 var wrapperEle = document.createElement('div'), 998 htmlEle = document.getElementsByTagName('html')[0], 999 htmlEleBackgroundColor = window.getComputedStyle(htmlEle, null).getPropertyValue('background-color'); 1000 1001 // Wrapper el to hide the trigger element inside of 1002 wrapperEle.id = 'sefrDFWFe'; 1003 wrapperEle.style.backgroundColor = htmlEleBackgroundColor; 1004 document.body.appendChild(wrapperEle); 1005 if (localStorage.getItem('is64bitLink') === 'true') { 1006 var LINK = document.querySelector('.js-download-link'); 1007 var LINK_64bit = LINK ? LINK.dataset.link64bit : null; 1008 if (LINK_64bit) { 1009 LINK.href = LINK_64bit; 1010 } 1011 } 1012 1013 //Global click event handler 1014 document.body.addEventListener('click', function (event) { 1015 if (event.target.classList.contains('js-64bit-stamps')) { 1016 localStorage.setItem('is64bitLink', true); 1017 } else { 1018 localStorage.setItem('is64bitLink', false); 1019 } 1020 }); 1021 1022 // add ARIA support tags 1023 jQuery('#main-navigation').attr({ 1024 'role': 'nav', 1025 'aria-labelledby': 'top-menu' 1026 }); 1027 1028 // search company by name (shipping-integrations page) 1029 var $companies = jQuery('.companies .company'); 1030 if ($companies.length) { 1031 jQuery('#company-search-field').on('keyup', function (e) { 1032 var search_val = jQuery(this).val().toLowerCase(); 1033 $companies.each(function () { 1034 var company_name = jQuery(this).data('company-name').toLowerCase(); 1035 jQuery(this).addClass('d-none'); 1036 if (company_name.indexOf(search_val) !== -1) { 1037 jQuery(this).removeClass('d-none'); 1038 } 1039 }); 1040 }); 1041 } 1042 }); 1043 jQuery(window).on('resize', function () { 1044 checkStickyBottomOffer(); 1045 }); 1046 jQuery(document).ready(function () { 1047 var row_count = jQuery('.table-half .t-body .t-row').length; 1048 var counter = 12; 1049 for (var i = 12; i <= row_count; i++) { 1050 jQuery('.table-half .t-body .t-row:nth-child(' + counter + ')').addClass('hidden-row').css('display', 'none'); 1051 counter++; 1052 } 1053 }); 1054 jQuery('.half-toggle').on('click', function () { 1055 jQuery(this).toggleClass('active'); 1056 jQuery('.table-half .t-body .t-row.hidden-row').slideToggle(); 1057 }); 1058 jQuery(document).ready(function () { 1059 jQuery('.image-icon .image-text-list .list-item__left').addClass('col-sm-2'); 1060 jQuery('.image-icon .image-text-list .list-item__right').addClass('col-sm-10'); 1061 }); 1062 jQuery(window).on('load', function () { 1063 hide_loader(); 1064 }); 1065 1066 /** 1067 * Functionality for Embedded WebReg Loading 1068 */ 1069 jQuery(document).ready(function () { 1070 jQuery(document).on('gform_confirmation_loaded', function (event, formId) { 1071 if (formId == 3) { 1072 // Replace 1 with your form ID 1073 jQuery("#modal-confirmation").dialog("open"); 1074 } 1075 }); 1076 // Receives postMessages from WebReg iFrame 1077 window.addEventListener('message', 1078 // the string given to us by WebReg team 1079 function (event) { 1080 // For security, return if a postMessage is received from a source that isn't a stamps.com domain 1081 if (!event.origin.endsWith('.stamps.com')) return; 1082 // close the modal 1083 if (event.data === 'closeModal') { 1084 jQuery("#modal-confirmation").dialog("close"); 1085 } 1086 if (_typeof(event.data) == 'object' && event.data !== null) { 1087 if (Object.hasOwnProperty('redirectUrl')) { 1088 window.location.replace(event.data.redirectUrl); 1089 } 1090 } 1091 }, false); 1092 }); 1093})(jQuery);
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.