console.log('JWT blank. Not taking any login action.');
//************************************************
//********** GLOBAL PD/ONE VARIABLES *************
//************************************************
var pdCategoryId = "932";
//************************************************
//************ JS/CSS FILE ROUTINES *************
//************************************************
function pdLoadJsCssFile(filename, filetype){
if (filetype=="js") {
var fileref=document.createElement('script');
fileref.setAttribute("type","text/javascript");
fileref.setAttribute("async",true);
fileref.setAttribute("src", filename);
}
else if (filetype=="css") {
var fileref=document.createElement("link");
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", filename);
}
if (typeof fileref!="undefined")
document.getElementsByTagName("head")[0].appendChild(fileref);
}
//************************************************
//****** PD/ONE FEATURE SPECIFIC CSS/JS *********
//************************************************
pdLoadJsCssFile("https://cdn.practicaldatacore.com/my-justforjeeps-com/mod_bigcommerce/pdCompiledScript.js?cb=1938235", "js");
pdLoadJsCssFile("https://cdn.practicaldatacore.com/my-justforjeeps-com/mod_pdOneStyleEditor/pdPublicStyle.css?cb=484558", "css");
//*** CATEGORY ID:932****
//*** PRODUCT ID:****
//*** PRODUCT ID LIST CSV:****
//**** INCLUDE CATEGORY PAGE JAVASCRIPT ****
var pdStarsRefreshFlag = true;
function pdDisplayCategoryStars() {
if(pdStarsRefreshFlag == true) {
document.querySelectorAll("div[productId='6258'], div[data-itemid='6258'], .pdRatingStarsWrapper[data-itemid='6258']").forEach(function(element) {
element.innerHTML = "
";
});
document.querySelectorAll("div[productId='6327'], div[data-itemid='6327'], .pdRatingStarsWrapper[data-itemid='6327']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='6330'], div[data-itemid='6330'], .pdRatingStarsWrapper[data-itemid='6330']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='6426'], div[data-itemid='6426'], .pdRatingStarsWrapper[data-itemid='6426']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='6427'], div[data-itemid='6427'], .pdRatingStarsWrapper[data-itemid='6427']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='6428'], div[data-itemid='6428'], .pdRatingStarsWrapper[data-itemid='6428']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='6453'], div[data-itemid='6453'], .pdRatingStarsWrapper[data-itemid='6453']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='6454'], div[data-itemid='6454'], .pdRatingStarsWrapper[data-itemid='6454']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='6687'], div[data-itemid='6687'], .pdRatingStarsWrapper[data-itemid='6687']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='6736'], div[data-itemid='6736'], .pdRatingStarsWrapper[data-itemid='6736']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='6758'], div[data-itemid='6758'], .pdRatingStarsWrapper[data-itemid='6758']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='6775'], div[data-itemid='6775'], .pdRatingStarsWrapper[data-itemid='6775']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='6780'], div[data-itemid='6780'], .pdRatingStarsWrapper[data-itemid='6780']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='6785'], div[data-itemid='6785'], .pdRatingStarsWrapper[data-itemid='6785']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='7046'], div[data-itemid='7046'], .pdRatingStarsWrapper[data-itemid='7046']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='7047'], div[data-itemid='7047'], .pdRatingStarsWrapper[data-itemid='7047']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='7154'], div[data-itemid='7154'], .pdRatingStarsWrapper[data-itemid='7154']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='7156'], div[data-itemid='7156'], .pdRatingStarsWrapper[data-itemid='7156']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='7157'], div[data-itemid='7157'], .pdRatingStarsWrapper[data-itemid='7157']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='7158'], div[data-itemid='7158'], .pdRatingStarsWrapper[data-itemid='7158']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='7159'], div[data-itemid='7159'], .pdRatingStarsWrapper[data-itemid='7159']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='7164'], div[data-itemid='7164'], .pdRatingStarsWrapper[data-itemid='7164']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='7187'], div[data-itemid='7187'], .pdRatingStarsWrapper[data-itemid='7187']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='7207'], div[data-itemid='7207'], .pdRatingStarsWrapper[data-itemid='7207']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='7208'], div[data-itemid='7208'], .pdRatingStarsWrapper[data-itemid='7208']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='7214'], div[data-itemid='7214'], .pdRatingStarsWrapper[data-itemid='7214']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='7226'], div[data-itemid='7226'], .pdRatingStarsWrapper[data-itemid='7226']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='7229'], div[data-itemid='7229'], .pdRatingStarsWrapper[data-itemid='7229']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='7318'], div[data-itemid='7318'], .pdRatingStarsWrapper[data-itemid='7318']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='7359'], div[data-itemid='7359'], .pdRatingStarsWrapper[data-itemid='7359']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='7365'], div[data-itemid='7365'], .pdRatingStarsWrapper[data-itemid='7365']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='7370'], div[data-itemid='7370'], .pdRatingStarsWrapper[data-itemid='7370']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='7371'], div[data-itemid='7371'], .pdRatingStarsWrapper[data-itemid='7371']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='7372'], div[data-itemid='7372'], .pdRatingStarsWrapper[data-itemid='7372']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='7373'], div[data-itemid='7373'], .pdRatingStarsWrapper[data-itemid='7373']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='7378'], div[data-itemid='7378'], .pdRatingStarsWrapper[data-itemid='7378']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='7460'], div[data-itemid='7460'], .pdRatingStarsWrapper[data-itemid='7460']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='7467'], div[data-itemid='7467'], .pdRatingStarsWrapper[data-itemid='7467']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='7485'], div[data-itemid='7485'], .pdRatingStarsWrapper[data-itemid='7485']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='7822'], div[data-itemid='7822'], .pdRatingStarsWrapper[data-itemid='7822']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='7893'], div[data-itemid='7893'], .pdRatingStarsWrapper[data-itemid='7893']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='7931'], div[data-itemid='7931'], .pdRatingStarsWrapper[data-itemid='7931']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='7953'], div[data-itemid='7953'], .pdRatingStarsWrapper[data-itemid='7953']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='8142'], div[data-itemid='8142'], .pdRatingStarsWrapper[data-itemid='8142']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='8243'], div[data-itemid='8243'], .pdRatingStarsWrapper[data-itemid='8243']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='8244'], div[data-itemid='8244'], .pdRatingStarsWrapper[data-itemid='8244']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='8285'], div[data-itemid='8285'], .pdRatingStarsWrapper[data-itemid='8285']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='8341'], div[data-itemid='8341'], .pdRatingStarsWrapper[data-itemid='8341']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='8374'], div[data-itemid='8374'], .pdRatingStarsWrapper[data-itemid='8374']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='8516'], div[data-itemid='8516'], .pdRatingStarsWrapper[data-itemid='8516']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='8730'], div[data-itemid='8730'], .pdRatingStarsWrapper[data-itemid='8730']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='8731'], div[data-itemid='8731'], .pdRatingStarsWrapper[data-itemid='8731']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='8819'], div[data-itemid='8819'], .pdRatingStarsWrapper[data-itemid='8819']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='8825'], div[data-itemid='8825'], .pdRatingStarsWrapper[data-itemid='8825']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='9085'], div[data-itemid='9085'], .pdRatingStarsWrapper[data-itemid='9085']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='9238'], div[data-itemid='9238'], .pdRatingStarsWrapper[data-itemid='9238']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='9317'], div[data-itemid='9317'], .pdRatingStarsWrapper[data-itemid='9317']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='9372'], div[data-itemid='9372'], .pdRatingStarsWrapper[data-itemid='9372']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='9390'], div[data-itemid='9390'], .pdRatingStarsWrapper[data-itemid='9390']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='9469'], div[data-itemid='9469'], .pdRatingStarsWrapper[data-itemid='9469']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='9489'], div[data-itemid='9489'], .pdRatingStarsWrapper[data-itemid='9489']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='9591'], div[data-itemid='9591'], .pdRatingStarsWrapper[data-itemid='9591']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='9592'], div[data-itemid='9592'], .pdRatingStarsWrapper[data-itemid='9592']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='9599'], div[data-itemid='9599'], .pdRatingStarsWrapper[data-itemid='9599']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='9631'], div[data-itemid='9631'], .pdRatingStarsWrapper[data-itemid='9631']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='9662'], div[data-itemid='9662'], .pdRatingStarsWrapper[data-itemid='9662']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='9733'], div[data-itemid='9733'], .pdRatingStarsWrapper[data-itemid='9733']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='7379'], div[data-itemid='7379'], .pdRatingStarsWrapper[data-itemid='7379']").forEach(function(element) {
element.innerHTML = "";
});
pdStarsRefreshFlag = false;
}
}
pdDisplayCategoryStars();
function pdRefreshCategoryStarsDelayed() {
pdStarsRefreshFlag = true;
setTimeout(pdDisplayCategoryStars, 500);
}
try {
document.getElementById('product-listing-container').addEventListener('DOMSubtreeModified', function() {
pdRefreshCategoryStarsDelayed();
});
} catch(e){};
//*** BEGIN public_mod_myRewards_getRenderedPromotionMessagingJsInsertionCode ***
document.querySelectorAll("div.pdRewardsPromoMessage[productId=\"\"], div.pdRewardsPromoMessage[data-itemid=\"\"]").forEach(function(div) { div.innerHTML = "";});
//*** END public_mod_myRewards_getRenderedPromotionMessagingJsInsertionCode ***
//*** BEGIN public_mod_myRewards_getRenderedPromotionPopupJsInsertionCode ***
document.body.insertAdjacentHTML("beforeend", "");
//*** END public_mod_myRewards_getRenderedPromotionPopupJsInsertionCode ***
//*** public_mod_structuredData_renderJsonByItemId found
//*** public_mod_structuredData enabled
var script = document.createElement('script');
script.setAttribute('type', 'application/ld+json');
script.innerHTML = "{\"@context\":\"http:\\/\\/schema.org\",\"@type\":\"Organization\",\"sameAs\":[\"https://www.facebook.com/JustForJeeps\",\"https://twitter.com/JustForJeeps\",\"https://www.instagram.com/justforjeeps/\",\"https://www.pinterest.com/justforjeeps/\"],\"name\":\"JustForJeeps.com\",\"url\":\"https:\\/\\/www.justforjeeps.com\\/\",\"address\":{\"@type\":\"PostalAddress\",\"streetAddress\":\"56 Boston Providence Tpke\",\"addressLocality\":\"Norwood\",\"addressRegion\":\"MA\",\"addressCountry\":\"US\",\"postalCode\":\"02062\"},\"founders\":[{\"@type\":\"Person\",\"name\":\"Peter Catanese\"}],\"logo\":\"https:\\/\\/my.justforjeeps.com\\/pd_custom\\/core\\/structuredData\\/images\\/imageCompanyLogo.jpg\",\"foundingDate\":\"2004\",\"contactPoint\":{\"@type\":\"ContactPoint\",\"email\":\"support@justforjeeps.com\",\"telephone\":\"+1-888-651-5337\",\"contactType\":\"Customer Support\"}}"
document.getElementsByTagName('head')[0].appendChild(script); ;
var script = document.createElement('script');
script.setAttribute('type', 'application/ld+json');
script.innerHTML = "{\"@context\":\"http:\\/\\/schema.org\",\"@type\":\"LocalBusiness\",\"address\":{\"@type\":\"PostalAddress\"},\"priceRange\":\"0.6700-3465.9900\"}"
document.getElementsByTagName('head')[0].appendChild(script); ;
function pdInjectAccountLinkModifications() {
//***** INJECT REWARDS LINK ****
jQuery(".navBar-section li:nth-child(2)").after('Rewards');
//***** INJECT OLDER ORDER HISTORY LINK ****
jQuery(".navBar-section li:nth-child(1)").after('Older Orders');
}
pdInjectAccountLinkModifications();var pdPublicUrl = 'https://my.justforjeeps.com/';
jQuery(document).ready(function(){
const urlParams = new URLSearchParams(location.search);
var prevLinkElem = jQuery('.navBar-section .is-active').data("pdLinkElem");
var prevLinkTarget = jQuery('.navBar-section .is-active').data("pdLinkElemTarget");
if (prevLinkElem && prevLinkTarget) {
jQuery(prevLinkTarget).html(prevLinkElem);
jQuery('.navBar-section .is-active').data("pdLinkElem", false);
jQuery('.navBar-section .is-active').data("pdLinkElemTarget", false);
}
if (urlParams.has('pd_module_content')){
var module = urlParams.get('pd_module_content');
var subNav = urlParams.get('pd_module_subNav');
var moduleTitle = jQuery('#pdContent_'+module+' a').html();
var currentUrl = window.location.href;
var currentUrlNoQuery = currentUrl.substring(0, currentUrl.indexOf('?'));
console.log(currentUrlNoQuery);
var currentTab = jQuery('.navBar-section .is-active').html();
if (jQuery('.navBar-section .is-active').hasClass('pdLinkEvent') == false){
if(jQuery('.navBar-section .is-active .navBar-action').length){
}
else {
jQuery('.navBar-section .is-active').html(''+currentTab+'');
}
}
jQuery('.navBar-section .is-active').data("pdLinkElemTarget", '#pdContent_'+module);
jQuery('.navBar-section .is-active').data("pdLinkElem", jQuery('#pdContent_'+module).html());
jQuery('#pdContent_'+module).html(jQuery('#pdContent_'+module+' a').text());
jQuery('.navBar-section .is-active').removeClass('is-active');
jQuery('#pdContent_'+module).addClass('is-active');
jQuery('.page-heading').html(moduleTitle);
if (subNav !== '' && subNav !== null){
url = pdPublicUrl+'/'+module+'/'+subNav+'.php?module='+module;
}
else {
url = pdPublicUrl+'/'+module+'/index.php?module='+module;
}
pdOneAjaxLinkHandler(url);
}
});
jQuery(document).on('submit', '.pdModal form', function(e){
e.preventDefault();
e.stopImmediatePropagation()
pdOneAjaxFormHandler(this);
});
jQuery(document).on('submit', '#pdModuleContent form', function(e){
e.preventDefault();
e.stopImmediatePropagation()
pdOneAjaxFormHandler(this);
});
jQuery(document).on('click', '.pdLinkEvent', function(e){
var currentUrl = window.location.href;
var currentTab = jQuery('.navBar-section .is-active .navBar-action').html();
console.log(jQuery(this).html());
if (jQuery('.navBar-section .is-active').hasClass('pdLinkEvent') == false){
jQuery('.navBar-section .is-active').html(''+currentTab+'');
}
jQuery('.navBar-section .is-active').removeClass('is-active');
jQuery(this).parent().addClass('is-active');
var url = jQuery(this).attr('href');
e.preventDefault();
e.stopImmediatePropagation()
pdOneAjaxLinkHandler(url);
});
jQuery(document).on('click', '#pdModuleContent a', function(e) {
var url = jQuery(this).attr('href');
jQuery(this).attr("href", "#");
e.preventDefault();
pdOneAjaxLinkHandler(url);
});
function pdOneAjaxLinkHandler(url){
console.log("pdOneAjaxLinkHandler:" + url);
var currModule = jQuery('#pdModuleContent').attr('data-currmodule');
var externalLink = false;
//assume http or https is external link
var testUrl = url;
var testUrlNoQuery = url.substring(0, testUrl.indexOf('?'));
if (testUrlNoQuery !== ''){
if ((url.includes('https://') || url.includes('http://')) && !testUrlNoQuery.includes('mod_')){
externalLink = true;
}
}
if (!externalLink && currModule !== '' && currModule !== undefined) {
testUrl = testUrl.replace('https://', '');
testUrl = testUrl.replace('http://', '');
replaceStart = testUrl.indexOf('/');
if (replaceStart == -1){
replaceStart = 0;
}
testurl = testUrl.substring(replaceStart);
//If no 'mod_' present assume reference path to current module and create absolute path
if (!url.includes('mod_')){
url = pdPublicUrl+'/'+currModule+'/'+testurl+'?module='+currModule;
}
//Else assume link to other module and create absolute path
else {
url = pdPublicUrl+'/'+testurl+'?module='+currModule;
}
}
//Perform ajax if not linking to external site
if (!externalLink){
if (url.includes('?')){
url += '&mode=inject';
}
else {
url += '?mode=inject';
}
jQuery.ajax({
'async': true,
'global': false,
'xhrFields': {
withCredentials: true
},
'type': "POST",
'crossDomain': true,
'url': url,
'success': function(result) {
console.log('success');
jQuery('.account-content').html(result);
},
error: function(errMsg) {
console.log('error');
console.log(errMsg['statusText']);
}
});
}
else {
// window.location.href = url;
}
}
function pdOneAjaxFormHandler(form, module){
currModule = jQuery('#pdModuleData').attr('data-currmodule');
if (currModule == undefined){
currModule = jQuery('#pdModuleContent').attr('data-currmodule');
}
formData = jQuery(form).serializeArray();
console.log(formData);
var method = jQuery(form).attr('method');
var url = jQuery(form).attr('action');
replaceStart = url.indexOf('/');
if (replaceStart == -1){
replaceStart = 0;
}
url = url.substring(replaceStart);
url = pdPublicUrl+'/'+currModule+'/'+url+'?module='+currModule;
if (url.includes('?')){
url += '&mode=inject';
}
else {
url += '?mode=inject';
}
if (url.includes('?')){
url += '&module='+currModule;
}
else {
url += '?module='+currModule;
}
jQuery.ajax({
'async': false,
'global': false,
'xhrFields': {
withCredentials: true
},
'type': method,
'crossDomain': true,
'url': url,
data: formData,
'success': function(result) {
console.log('success');
console.log(result);
jQuery(form).closest('#pdModuleContent').replaceWith(result);
},
error: function(errMsg) {
console.log('error');
console.log(errMsg);
}
});
}var script = document.createElement('style');
script.setAttribute('type', 'text/css');
script.innerHTML = ``;
document.getElementsByTagName('head')[0].appendChild(script);
if(jQuery('#pd_pdOneBanner').length) {
//*** BANNER ALREADY EXISTS, DO NOT RE-INSERT
} else {
jQuery("body").prepend('');
}
jQuery("#pd_pdOneBanner").html("");
//*** COMPLETEION CALLBACK
try{pdContentRenderCompleted()}catch(e){};
//*** done.