Technical specifications
Download
}
} else if (lang == "de-de") {
if (country == "ch" || country == "at" || country == "be") {
lang = lang.split('-')[0] + '-' + country;
}
} else if (lang == "nl-nl") {
if (country == "be") {
lang = lang.split('-')[0] + '-' + country;
}
} else if (lang == "fr-fr") {
if (country == "be") {
lang = lang.split('-')[0] + '-' + country;
}
}
var shortLang = lang.split('-')[0];
if (shortLang == "fi" || shortLang == "vi") {
shortLang = "en"
}
if ($('html').attr('data-market-locale') == "en-emea" && lang == "cs-cz") {
shortLang = "en";
}
if (document.querySelectorAll('hero-customizer-v2').length) {
var groupsCount = 0;
var done = 0;
var ready = false;
window.addEventListener('customizer-groups-load', function (event) {
document.querySelector('.hero-customizer-v2-find-retailer').innerHTML +=
'
' +
alsoAvailableAtRetailerMessages[shortLang] +
':
';
document.querySelector('.hero-customizer-v2-find-retailer__icon').addEventListener('click',
function () {
document.querySelector('.hero-customizer-v2-find-retailer__retailers').style
.display = 'block';
document.querySelector('.hero-customizer-v2-find-retailer__retailers').classList
.add('active');
});
document.querySelector('.hero-customizer-v2-find-retailer__label').addEventListener('click',
function () {
document.querySelector('.hero-customizer-v2-find-retailer__retailers').style
.display = 'block';
document.querySelector('.hero-customizer-v2-find-retailer__retailers').classList
.add('active');
});
document.querySelector('.hero-customizer-v2-find-retailer__close').addEventListener('click',
function () {
document.querySelector('.hero-customizer-v2-find-retailer__retailers').classList
.remove('active');
document.querySelector('.hero-customizer-v2-find-retailer__retailers').style
.display = 'none';
});
groupsCount = event.detail.length;
event.detail.forEach(function (group) {
productList[group.groupId] = group;
productList[group.groupId]["retailers"] = [];
$.getJSON("https://retailersapi.jabra.com/v1/group/" + group.groupId +
"?marketlocale=" + lang,
function (jsonResult) {
if (jsonResult && jsonResult.length) {
var r = [],
l = "";
jsonResult.forEach(function (jsonResultLine) {
r.push(jsonResultLine);
});
productList[jsonResult[0].groupId]["retailers"] = r;
}
done++;
if (done == groupsCount) {
if ($('.topbanner__image-slider').hasClass(
'slick-initialized')) {
$('.topbanner__image-slider').slick('unslick');
}
$('.topbanner__image-img').each(function () {
if (!($(this).attr('data-id') in productList)) {
$(this).parent().remove();
}
});
$('.topbanner__color-dot').each(function () {
if (!($(this).attr('data-id') in productList)) {
$(this).remove();
}
});
$('.topbanner__image-slider').slick({
slidesToShow: 1,
dots: false,
arrows: false,
infinite: true,
fade: true
});
$('.topbanner__colors').css('visibility', 'visible');
var addedRetailers = [];
addedRetailers.push('Jabra');
var retailerLogosSpot = document.querySelector(
'.retailerLogosSpot .replacement-column-spot-rich-text');
var retailerLogoLinks = '';
var oldest = 9999999999999;
for (product in productList) {
for (retailer in productList[product]["retailers"]) {
if (productList[product]["retailers"][retailer]
.retailerName != "Jabra" && !addedRetailers
.includes(productList[product]["retailers"][
retailer
].retailerName) && (productList[product]
["retailers"][retailer]
.availableInRetailSpot === true || (lang
.toLowerCase() != "fr-fr" && lang
.toLowerCase() != "pl-pl" && lang
.toLowerCase() != "en-au" && lang
.toLowerCase() != "sv-se" && lang
.toLowerCase() != "nb-no" && lang
.toLowerCase() != "en-gb" && lang
.toLowerCase() != "en-sg" && lang
.toLowerCase() != "ru-ru" && lang
.toLowerCase() != "en-hk" && lang
.toLowerCase() != "tr-tr"))) {
addedRetailers.push(productList[product][
"retailers"
][retailer].retailerName);
retailerLogoLinks +=
'
';
}
}
for (attribute in productList[product].attributes) {
if (productList[product].attributes[attribute].key ==
"Meta_Launchdate") {
if (new Date(productList[product].attributes[
attribute].value).getTime() < oldest) {
oldest = new Date(productList[product]
.attributes[attribute].value).getTime();
}
}
};
}
if (oldest < 9999999999999 && Math.floor((new Date().getTime() -
new Date(oldest).getTime()) / 1000 / 2592000) < 6) {
// Show NEW
$('.topbanner .new-label').css('visibility', 'visible');
}
if (retailerLogoLinks !== '') {
retailerLogosSpot.innerHTML =
'
' +
alsoAvailableAtRetailerMessages[shortLang] + ':
';
retailerLogosSpot.innerHTML +=
'
' + retailerLogoLinks +
'
';
document.querySelector('.retailerLogosSpot').style.display =
'block';
}
}
});
});
});
window.addEventListener('customizer-selection-change', function (event) {
console.log('test');
if (document.querySelectorAll('buy-exclusive').length) {
document.querySelector('buy-exclusive').remove();
}
if (document.querySelectorAll('.exclusiveAtJabraNote').length) {
document.querySelector('.exclusiveAtJabraNote').remove();
}
var product = event.detail.groupId;
var retailerLogoLinks = '';
console.log(product);
//console.log(productList[product]["retailers"][0].exclusive);
//console.log(productList[product]["retailers"][0].retailerName);
if (productList[product] && productList[product]["retailers"] && productList[product][
"retailers"
].length == 1 && productList[product]["retailers"][0].exclusive == true && productList[
product]["retailers"][0].retailerName == "Jabra") {
console.log('t1');
document.querySelector('.hero-customizer-v2-find-retailer__retailers-list').innerHTML =
'';
document.querySelector('hero-customizer-v2-find-retailer').style.display = 'none';
// insert exclusive text
var newEl = document.createElement('p');
newEl.className = 'exclusiveAtJabraNote';
if (shortLang == "ja") {
newEl.innerHTML = '
' + window.location.hostname + ' ' +
availableExclusivelyAtJabraMessages[shortLang] + ' ';
} else {
newEl.innerHTML = '
' + availableExclusivelyAtJabraMessages[shortLang] + ' ' +
window.location.hostname + ' ';
}
var ref = document.querySelector('hero-customizer-v2-find-retailer');
insertAfter(newEl, ref);
} else if (productList[product] && productList[product]["retailers"] && productList[product]
["retailers"].length == 1 && productList[product]["retailers"][0].exclusive == true) {
console.log('t2');
//document.querySelector('.hero-customizer-v2-buttons').innerHTML = '
'+buyExclusivelyAtRetailerMessages[shortLang]+' ' + document.querySelector('.hero-customizer-v2-buttons').innerHTML;
$('.hero-customizer-v2-buttons').prepend(
'
' +
buyExclusivelyAtRetailerMessages[shortLang] + ' ');
document.querySelector('.hero-customizer-v2-find-retailer__retailers-list').innerHTML =
'';
document.querySelector('hero-customizer-v2-find-retailer').style.display = 'none';
document.querySelector('buy-exclusive').addEventListener('click', function () {
window.open(productList[product]["retailers"][0].productUrl, '_blank');
});
} else {
console.log('t3');
for (retailer in productList[product]["retailers"]) {
retailerLogoLinks +=
'
';
}
if (retailerLogoLinks !== '') {
document.querySelector('.hero-customizer-v2-find-retailer__retailers-list')
.innerHTML = retailerLogoLinks;
document.querySelector('hero-customizer-v2-find-retailer').style.display = 'block';
} else {
document.querySelector('.hero-customizer-v2-find-retailer__retailers-list')
.innerHTML = '';
document.querySelector('hero-customizer-v2-find-retailer').style.display = 'none';
}
}
});
} else {
// OLD VERSION
var groupLoadInterval, updated = 0;
var groups = [],
//productList = {},
done = 0,
groupsCount = 0;
if ($('.products-groups div[data-group]').length) {
groupLoadInterval = setInterval(function () {
updated = $('.products-groups div:not([data-group~="product.groupId"])').length;
empty = $('.products-groups div[data-group=""]').length;
if (updated == $('.products-groups div[data-group]').length && empty != $(
'.products-groups div[data-group]').length && $(
'.products-groups div[data-group]').attr('data-group') != '') {
clearInterval(groupLoadInterval);
loadRetailerLogos();
}
}, 1000);
} else {
loadRetailerLogos();
}
function loadRetailerLogos() {
$(".retailerLogos").each(function () {
var retailerList = $(this);
if (retailerList.length && (retailerList.attr('data-groups') || retailerList.find(
'.products-groups div[data-group]').length > 0)) {
if (retailerList.attr('data-groups')) {
var tempGroups = retailerList.attr('data-groups').split(",");
tempGroups.forEach(function (group) {
groups.push(group);
});
} else {
retailerList.find('.products-groups div[data-group]').each(function () {
groups.push($(this).attr('data-group'));
});
}
}
});
groups = groups.filter(Boolean);
groupsCount = groups.length;
for (i = 0; i < groups.length; i++) {
var groupId = groups[i];
productList[groupId] = [];
productList[groupId]["retailers"] = [];
$.getJSON("https://retailersapi.jabra.com/v1/group/" + groupId + "?marketlocale=" + lang,
function (jsonResult) {
if (jsonResult && jsonResult.length) {
var r = [],
l = "";
jsonResult.forEach(function (jsonResultLine) {
if (jsonResultLine.availableInRetailSpot === true || (lang
.toLowerCase() != "fr-fr" && lang.toLowerCase() !=
"pl-pl" && lang.toLowerCase() != "en-au" && lang
.toLowerCase() != "sv-se" && lang.toLowerCase() !=
"nb-no" && lang.toLowerCase() != "en-gb" && lang
.toLowerCase() != "en-sg" && lang.toLowerCase() !=
"ru-ru" && lang.toLowerCase() != "en-hk" && lang
.toLowerCase() != "tr-tr")) {
var productListLine = [];
"" == l && (l = jsonResultLine.productName), productListLine
.name = jsonResultLine.retailerName, productListLine.logo =
jsonResultLine.retailerLogoUrl, productListLine.link =
jsonResultLine.productUrl, productListLine.exclusive =
jsonResultLine.exclusive, r.push(productListLine);
}
});
productList[jsonResult[0].groupId]["retailers"] = r;
}
done++;
if (done == groupsCount) {
doneUpdateList();
}
});
}
}
function doneUpdateList() {
$(".retailerLogos").each(function () {
var usedCompanyNames = [];
var retailerList = $(this);
if (retailerList.length && (retailerList.attr('data-groups') || retailerList.find(
'.products-groups div[data-group]').length > 0)) {
var updateGroups = [];
if (retailerList.attr('data-groups')) {
updateGroups = retailerList.attr('data-groups').split(",");
} else {
retailerList.find('.products-groups div[data-group]').each(function () {
updateGroups.push($(this).attr('data-group'));
});
}
}
retailerList.html('');
for (i = 0; i < updateGroups.length; i++) {
if (updateGroups[i] in productList) {
for (j = 0; j < productList[updateGroups[i]]["retailers"].length; j++) {
if ($.inArray(productList[updateGroups[i]]["retailers"][j].name
.toLowerCase(), usedCompanyNames) == -1) {
usedCompanyNames.push(productList[updateGroups[i]]["retailers"][j].name
.toLowerCase());
if (productList[updateGroups[i]]["retailers"][j].link != "#") {
retailerList.append(
'
');
} else {
retailerList.append(
'
');
}
}
}
}
}
if (retailerList.html() == "") {
retailerList.prev('.retailerLogosTitle').css('display', 'none');
retailerList.closest('.retailerLogosSpot').hide();
} else {
retailerList.prev('.retailerLogosTitle').css('display', 'inline-block');
retailerList.closest('.retailerLogosSpot').show();
}
});
}
var availableAtPopupReady = false,
exclusiveReady = false;
function loadAvailableAt(t) {
$('.hero-customizer-spot__info-actions.info-item').removeClass('exclusive-block');
t != previousGroup && (availableAtPopupReady = false, exclusiveReady = false, $(
"#AvailableAtPopup, .availableAtBtn").hide(), previousGroup = t, $.getJSON(
"https://retailersapi.jabra.com/v1/group/" + t + "?marketlocale=" + lang,
function (t) {
$('.retailer-container').css('visibility', 'hidden');
var i = [],
l = "";
if (t.forEach(function (t) {
var e = [];
"" == l && (l = t.productName), e.name = t.retailerName, e.logo = t
.retailerLogoUrl, e.link = t.productUrl, e.exclusive = t.exclusive,
i.push(e)
}), i.length) {
if ($(".hero-customizer-spot__headline").length) {
if (i.length == 1 && i[0].exclusive == true) {
if (window.location.href.indexOf(
"www.jabra.com/bluetooth-headsets/jabra-elite-active-75t-preorder"
) !== -1) {
$(".availableAtBtn").removeClass('jbr-btn--dark').addClass(
'jbr-btn--exclusive jbr-btn--preorder').html(
preOrderExclusivelyAtRetailerMessages[shortLang] +
'
').attr('href', i[0].link).attr(
'target', '_blank');
$('.product-action--backorder').parentsUntil('product-action')
.hide();
// add class to parent
$('.hero-customizer-spot__info-actions.info-item').addClass(
'exclusive-block');
} else if (window.location.href.indexOf(
"www.jabra.ca/bluetooth-headsets/jabra-elite-active-75t") !== -
1) {
$(".availableAtBtn").removeClass('jbr-btn--dark').addClass(
'jbr-btn--exclusive jbr-btn--preorder').html(
preRegisterInterestExclusivelyAtRetailerMessages[
shortLang] + '
').attr('href', i[0]
.link).attr('target', '_blank');
$('.product-action--backorder').parentsUntil('product-action')
.hide();
// add class to parent
$('.hero-customizer-spot__info-actions.info-item').addClass(
'exclusive-block');
} else {
$(".availableAtBtn").removeClass('jbr-btn--dark').addClass(
'jbr-btn--exclusive').html(buyExclusivelyAtRetailerMessages[
shortLang] + '
').attr('href', i[0]
.link).attr('target', '_blank');
$('.product-action--backorder').parentsUntil('product-action')
.hide();
// add class to parent
$('.hero-customizer-spot__info-actions.info-item').addClass(
'exclusive-block');
}
exclusiveReady = true;
} else {
var e = $(".hero-customizer-spot__headline").text() != "" ? $(
".hero-customizer-spot__headline").text() : l;
$(".retailer-secret-container").length ? $(
".retailer-secret-container .retailer-container").html("") : $(
'.hero-customizer-spot__info-actions.info-item').append(
'
'
);
for (a = 0; a < i.length; a++) {
$(".retailer-secret-container .retailer-container").append(
'
');
}
height = $('.retailer-container').height() + 20;
$('.retailer-container').css('top', '-' + height + 'px');
setTimeout(function () {
$('.retailer-container').css('visibility', 'visible');
}, 1000);
$('.retailer-container a img').css('width', 'auto').css('height',
'auto');
$('.availableAtBtn').on('click', function () {
if ($('.retailer-container').css('top') == '0' || $(
'.retailer-container').css('top') == '0px') {
$('.retailer-container').css('top', '-' + height + 'px')
.css('box-shadow', 'none');
} else {
$('.retailer-container').css('top', '0').css(
'box-shadow',
'0px -10px 30px -10px rgba(0, 0, 0, 0.3)');
}
});
$(".availableAtBtn").removeClass('jbr-btn--exclusive').addClass(
'jbr-btn--dark').attr('href', '/where-to-buy/retailer-locator')
.attr('target', '_self').html(findRetailerMessages[shortLang]);
// remove parent class
availableAtPopupReady = true;
}
}
} else $("#AvailableAtList").length && ($("#AvailableAtList ul").html(""),
availableAtPopupReady = false, exclusiveReady = false)
if (availableAtPopupReady || exclusiveReady) {
$(".availableAtBtn").css('display', 'inline-block');
$('.product-action[href*="locator"]').css('display', 'none');
} else {
$(".availableAtBtn").css('display', 'none');
$('.product-action[href*="locator"]').css('display', 'inline-block');
}
}))
}
var interval, previousGroup = "",
height = 0;
(customizerSpot = $(".hero-customizer-spot"), customizerSpot.length), interval = setInterval(
function () {
var customizerScope = angular.element(document.querySelector(
'[ng-controller="HeroCustomizerController"]')).scope();
if (customizerScope === undefined) {
clearInterval(interval);
return;
}
$('.availableAtBtn').prependTo('.hero-customizer-spot__info-actions.info-item');
(customizerScope.selection !== undefined && customizerScope.selection.groupId != "") && (
clearInterval(interval), $('.hero-customizer-spot .availableAtBtn').replaceWith(
'
' +
findRetailerMessages[shortLang] + ' '), loadAvailableAt(customizerScope.selection
.groupId))
}, 500), customizerSpot.on("change", function () {
var customizerScope = angular.element(document.querySelector(
'[ng-controller="HeroCustomizerController"]')).scope();
if (customizerScope === undefined) {
return;
}
loadAvailableAt(customizerScope.selection.groupId)
}), customizerSpot.on("click", function () {
setTimeout(function () {
var customizerScope = angular.element(document.querySelector(
'[ng-controller="HeroCustomizerController"]')).scope();
if (customizerScope === undefined) {
return;
}
loadAvailableAt(customizerScope.selection.groupId)
}, 100)
}), customizerSpot.on("click", ".availableAtBtn", function (event) {
if (availableAtPopupReady) {
$("#AvailableAtPopup").show();
event.preventDefault();
return false;
}
});
}
})();