console.log('JWT blank. Not taking any login action.');
//************************************************
//********** GLOBAL PD/ONE VARIABLES *************
//************************************************
var pdCategoryId = "42";
//************************************************
//************ 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-southernhomebrew-com/mod_bigcommerce/pdCompiledScript.js?cb=1938003", "js");
//*** CATEGORY ID:42****
//*** PRODUCT ID:****
//*** PRODUCT ID LIST CSV:****
//**** INCLUDE CATEGORY PAGE JAVASCRIPT ****
var pdStarsRefreshFlag = true;
function pdDisplayCategoryStars() {
if(pdStarsRefreshFlag == true) {
document.querySelectorAll("div[productId='138'], div[data-itemid='138'], .pdRatingStarsWrapper[data-itemid='138']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='179'], div[data-itemid='179'], .pdRatingStarsWrapper[data-itemid='179']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='195'], div[data-itemid='195'], .pdRatingStarsWrapper[data-itemid='195']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='213'], div[data-itemid='213'], .pdRatingStarsWrapper[data-itemid='213']").forEach(function(element) {
element.innerHTML = "
(1 reviews)";
});
document.querySelectorAll("div[productId='214'], div[data-itemid='214'], .pdRatingStarsWrapper[data-itemid='214']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='250'], div[data-itemid='250'], .pdRatingStarsWrapper[data-itemid='250']").forEach(function(element) {
element.innerHTML = "
(1 reviews)";
});
document.querySelectorAll("div[productId='288'], div[data-itemid='288'], .pdRatingStarsWrapper[data-itemid='288']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='289'], div[data-itemid='289'], .pdRatingStarsWrapper[data-itemid='289']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='301'], div[data-itemid='301'], .pdRatingStarsWrapper[data-itemid='301']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='330'], div[data-itemid='330'], .pdRatingStarsWrapper[data-itemid='330']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='368'], div[data-itemid='368'], .pdRatingStarsWrapper[data-itemid='368']").forEach(function(element) {
element.innerHTML = "
(1 reviews)";
});
document.querySelectorAll("div[productId='427'], div[data-itemid='427'], .pdRatingStarsWrapper[data-itemid='427']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='486'], div[data-itemid='486'], .pdRatingStarsWrapper[data-itemid='486']").forEach(function(element) {
element.innerHTML = "
(1 reviews)";
});
document.querySelectorAll("div[productId='518'], div[data-itemid='518'], .pdRatingStarsWrapper[data-itemid='518']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='532'], div[data-itemid='532'], .pdRatingStarsWrapper[data-itemid='532']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='533'], div[data-itemid='533'], .pdRatingStarsWrapper[data-itemid='533']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='537'], div[data-itemid='537'], .pdRatingStarsWrapper[data-itemid='537']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='539'], div[data-itemid='539'], .pdRatingStarsWrapper[data-itemid='539']").forEach(function(element) {
element.innerHTML = "
(1 reviews)";
});
document.querySelectorAll("div[productId='542'], div[data-itemid='542'], .pdRatingStarsWrapper[data-itemid='542']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='557'], div[data-itemid='557'], .pdRatingStarsWrapper[data-itemid='557']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='666'], div[data-itemid='666'], .pdRatingStarsWrapper[data-itemid='666']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='752'], div[data-itemid='752'], .pdRatingStarsWrapper[data-itemid='752']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='778'], div[data-itemid='778'], .pdRatingStarsWrapper[data-itemid='778']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='779'], div[data-itemid='779'], .pdRatingStarsWrapper[data-itemid='779']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='786'], div[data-itemid='786'], .pdRatingStarsWrapper[data-itemid='786']").forEach(function(element) {
element.innerHTML = "
(1 reviews)";
});
document.querySelectorAll("div[productId='787'], div[data-itemid='787'], .pdRatingStarsWrapper[data-itemid='787']").forEach(function(element) {
element.innerHTML = "
(1 reviews)";
});
document.querySelectorAll("div[productId='840'], div[data-itemid='840'], .pdRatingStarsWrapper[data-itemid='840']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='1038'], div[data-itemid='1038'], .pdRatingStarsWrapper[data-itemid='1038']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='1097'], div[data-itemid='1097'], .pdRatingStarsWrapper[data-itemid='1097']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='1098'], div[data-itemid='1098'], .pdRatingStarsWrapper[data-itemid='1098']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='1100'], div[data-itemid='1100'], .pdRatingStarsWrapper[data-itemid='1100']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='1101'], div[data-itemid='1101'], .pdRatingStarsWrapper[data-itemid='1101']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='1118'], div[data-itemid='1118'], .pdRatingStarsWrapper[data-itemid='1118']").forEach(function(element) {
element.innerHTML = "
(1 reviews)";
});
document.querySelectorAll("div[productId='1201'], div[data-itemid='1201'], .pdRatingStarsWrapper[data-itemid='1201']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='1202'], div[data-itemid='1202'], .pdRatingStarsWrapper[data-itemid='1202']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='1531'], div[data-itemid='1531'], .pdRatingStarsWrapper[data-itemid='1531']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='1532'], div[data-itemid='1532'], .pdRatingStarsWrapper[data-itemid='1532']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='1533'], div[data-itemid='1533'], .pdRatingStarsWrapper[data-itemid='1533']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='1534'], div[data-itemid='1534'], .pdRatingStarsWrapper[data-itemid='1534']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='1535'], div[data-itemid='1535'], .pdRatingStarsWrapper[data-itemid='1535']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='1536'], div[data-itemid='1536'], .pdRatingStarsWrapper[data-itemid='1536']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='1537'], div[data-itemid='1537'], .pdRatingStarsWrapper[data-itemid='1537']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='1538'], div[data-itemid='1538'], .pdRatingStarsWrapper[data-itemid='1538']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='1597'], div[data-itemid='1597'], .pdRatingStarsWrapper[data-itemid='1597']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='1601'], div[data-itemid='1601'], .pdRatingStarsWrapper[data-itemid='1601']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='1629'], div[data-itemid='1629'], .pdRatingStarsWrapper[data-itemid='1629']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='1630'], div[data-itemid='1630'], .pdRatingStarsWrapper[data-itemid='1630']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='1632'], div[data-itemid='1632'], .pdRatingStarsWrapper[data-itemid='1632']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='1633'], div[data-itemid='1633'], .pdRatingStarsWrapper[data-itemid='1633']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='1634'], div[data-itemid='1634'], .pdRatingStarsWrapper[data-itemid='1634']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='1644'], div[data-itemid='1644'], .pdRatingStarsWrapper[data-itemid='1644']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='1645'], div[data-itemid='1645'], .pdRatingStarsWrapper[data-itemid='1645']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='1646'], div[data-itemid='1646'], .pdRatingStarsWrapper[data-itemid='1646']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='1696'], div[data-itemid='1696'], .pdRatingStarsWrapper[data-itemid='1696']").forEach(function(element) {
element.innerHTML = "";
});
document.querySelectorAll("div[productId='1905'], div[data-itemid='1905'], .pdRatingStarsWrapper[data-itemid='1905']").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){};
function pdInjectAccountLinkModifications() {
//***** INJECT OLDER ORDER HISTORY LINK ****
jQuery(".navBar-section li:nth-child(1)").after('Older Orders');
}
pdInjectAccountLinkModifications();var pdPublicUrl = 'https://my.southernhomebrew.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);
//*** COMPLETEION CALLBACK
try{pdContentRenderCompleted()}catch(e){};
//*** done.