console.log('JWT blank. Not taking any login action.');
//************************************************
//********** GLOBAL PD/ONE VARIABLES *************
//************************************************
var pdCategoryId = "900";
//************************************************
//************ 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=1937219", "js");
pdLoadJsCssFile("https://cdn.practicaldatacore.com/my-justforjeeps-com/mod_pdOneStyleEditor/pdPublicStyle.css?cb=484304", "css");
//*** CATEGORY ID:900****
//*** PRODUCT ID:****
//*** PRODUCT ID LIST CSV:****
//**** INCLUDE CATEGORY PAGE JAVASCRIPT ****
var pdStarsRefreshFlag = true;
function pdDisplayCategoryStars() {
if(pdStarsRefreshFlag == true) {
document.querySelectorAll("div[productId='6347'], div[data-itemid='6347'], .pdRatingStarsWrapper[data-itemid='6347']").forEach(function(element) {
element.innerHTML = "
";
});
document.querySelectorAll("div[productId='6434'], div[data-itemid='6434'], .pdRatingStarsWrapper[data-itemid='6434']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='6493'], div[data-itemid='6493'], .pdRatingStarsWrapper[data-itemid='6493']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='6810'], div[data-itemid='6810'], .pdRatingStarsWrapper[data-itemid='6810']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='6869'], div[data-itemid='6869'], .pdRatingStarsWrapper[data-itemid='6869']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='6924'], div[data-itemid='6924'], .pdRatingStarsWrapper[data-itemid='6924']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='6925'], div[data-itemid='6925'], .pdRatingStarsWrapper[data-itemid='6925']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='6926'], div[data-itemid='6926'], .pdRatingStarsWrapper[data-itemid='6926']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='6929'], div[data-itemid='6929'], .pdRatingStarsWrapper[data-itemid='6929']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='7248'], div[data-itemid='7248'], .pdRatingStarsWrapper[data-itemid='7248']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='7294'], div[data-itemid='7294'], .pdRatingStarsWrapper[data-itemid='7294']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='7295'], div[data-itemid='7295'], .pdRatingStarsWrapper[data-itemid='7295']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='7297'], div[data-itemid='7297'], .pdRatingStarsWrapper[data-itemid='7297']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='7298'], div[data-itemid='7298'], .pdRatingStarsWrapper[data-itemid='7298']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='7299'], div[data-itemid='7299'], .pdRatingStarsWrapper[data-itemid='7299']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='7302'], div[data-itemid='7302'], .pdRatingStarsWrapper[data-itemid='7302']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='7303'], div[data-itemid='7303'], .pdRatingStarsWrapper[data-itemid='7303']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='7309'], div[data-itemid='7309'], .pdRatingStarsWrapper[data-itemid='7309']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='7310'], div[data-itemid='7310'], .pdRatingStarsWrapper[data-itemid='7310']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='7502'], div[data-itemid='7502'], .pdRatingStarsWrapper[data-itemid='7502']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='7685'], div[data-itemid='7685'], .pdRatingStarsWrapper[data-itemid='7685']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='7689'], div[data-itemid='7689'], .pdRatingStarsWrapper[data-itemid='7689']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='8016'], div[data-itemid='8016'], .pdRatingStarsWrapper[data-itemid='8016']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='8052'], div[data-itemid='8052'], .pdRatingStarsWrapper[data-itemid='8052']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='8053'], div[data-itemid='8053'], .pdRatingStarsWrapper[data-itemid='8053']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='8260'], div[data-itemid='8260'], .pdRatingStarsWrapper[data-itemid='8260']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='8261'], div[data-itemid='8261'], .pdRatingStarsWrapper[data-itemid='8261']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='8262'], div[data-itemid='8262'], .pdRatingStarsWrapper[data-itemid='8262']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='8263'], div[data-itemid='8263'], .pdRatingStarsWrapper[data-itemid='8263']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='8281'], div[data-itemid='8281'], .pdRatingStarsWrapper[data-itemid='8281']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='8316'], div[data-itemid='8316'], .pdRatingStarsWrapper[data-itemid='8316']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='8333'], div[data-itemid='8333'], .pdRatingStarsWrapper[data-itemid='8333']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='8347'], div[data-itemid='8347'], .pdRatingStarsWrapper[data-itemid='8347']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='8348'], div[data-itemid='8348'], .pdRatingStarsWrapper[data-itemid='8348']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='8349'], div[data-itemid='8349'], .pdRatingStarsWrapper[data-itemid='8349']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='8352'], div[data-itemid='8352'], .pdRatingStarsWrapper[data-itemid='8352']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='8371'], div[data-itemid='8371'], .pdRatingStarsWrapper[data-itemid='8371']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='8377'], div[data-itemid='8377'], .pdRatingStarsWrapper[data-itemid='8377']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='8391'], div[data-itemid='8391'], .pdRatingStarsWrapper[data-itemid='8391']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='8485'], div[data-itemid='8485'], .pdRatingStarsWrapper[data-itemid='8485']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='8533'], div[data-itemid='8533'], .pdRatingStarsWrapper[data-itemid='8533']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='8534'], div[data-itemid='8534'], .pdRatingStarsWrapper[data-itemid='8534']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='8544'], div[data-itemid='8544'], .pdRatingStarsWrapper[data-itemid='8544']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='8545'], div[data-itemid='8545'], .pdRatingStarsWrapper[data-itemid='8545']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='8582'], div[data-itemid='8582'], .pdRatingStarsWrapper[data-itemid='8582']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='8630'], div[data-itemid='8630'], .pdRatingStarsWrapper[data-itemid='8630']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='8631'], div[data-itemid='8631'], .pdRatingStarsWrapper[data-itemid='8631']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='8634'], div[data-itemid='8634'], .pdRatingStarsWrapper[data-itemid='8634']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='8635'], div[data-itemid='8635'], .pdRatingStarsWrapper[data-itemid='8635']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='8686'], div[data-itemid='8686'], .pdRatingStarsWrapper[data-itemid='8686']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='8706'], div[data-itemid='8706'], .pdRatingStarsWrapper[data-itemid='8706']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='8707'], div[data-itemid='8707'], .pdRatingStarsWrapper[data-itemid='8707']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='8708'], div[data-itemid='8708'], .pdRatingStarsWrapper[data-itemid='8708']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='8767'], div[data-itemid='8767'], .pdRatingStarsWrapper[data-itemid='8767']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='8821'], div[data-itemid='8821'], .pdRatingStarsWrapper[data-itemid='8821']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='8824'], div[data-itemid='8824'], .pdRatingStarsWrapper[data-itemid='8824']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='8833'], div[data-itemid='8833'], .pdRatingStarsWrapper[data-itemid='8833']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='9026'], div[data-itemid='9026'], .pdRatingStarsWrapper[data-itemid='9026']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='9027'], div[data-itemid='9027'], .pdRatingStarsWrapper[data-itemid='9027']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='9030'], div[data-itemid='9030'], .pdRatingStarsWrapper[data-itemid='9030']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='9107'], div[data-itemid='9107'], .pdRatingStarsWrapper[data-itemid='9107']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='9111'], div[data-itemid='9111'], .pdRatingStarsWrapper[data-itemid='9111']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='9299'], div[data-itemid='9299'], .pdRatingStarsWrapper[data-itemid='9299']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='9369'], div[data-itemid='9369'], .pdRatingStarsWrapper[data-itemid='9369']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='9381'], div[data-itemid='9381'], .pdRatingStarsWrapper[data-itemid='9381']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='9383'], div[data-itemid='9383'], .pdRatingStarsWrapper[data-itemid='9383']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='9384'], div[data-itemid='9384'], .pdRatingStarsWrapper[data-itemid='9384']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='9399'], div[data-itemid='9399'], .pdRatingStarsWrapper[data-itemid='9399']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='9462'], div[data-itemid='9462'], .pdRatingStarsWrapper[data-itemid='9462']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='9506'], div[data-itemid='9506'], .pdRatingStarsWrapper[data-itemid='9506']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='8282'], div[data-itemid='8282'], .pdRatingStarsWrapper[data-itemid='8282']").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.