console.log('JWT blank. Not taking any login action.'); //************************************************ //********** GLOBAL PD/ONE VARIABLES ************* //************************************************ var pdCategoryId = "109"; //************************************************ //************ 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-nutsinbulk-com/mod_bigcommerce/pdCompiledScript.js?cb=1937341", "js"); pdLoadJsCssFile("https://cdn.practicaldatacore.com/my-nutsinbulk-com/mod_pdOneStyleEditor/pdPublicStyle.css?cb=484335", "css"); //*** CATEGORY ID:109**** //*** PRODUCT ID:**** //*** PRODUCT ID LIST CSV:**** //**** INCLUDE CATEGORY PAGE JAVASCRIPT **** var pdStarsRefreshFlag = true; function pdDisplayCategoryStars() { if(pdStarsRefreshFlag == true) { document.querySelectorAll("div[productId='1232'], div[data-itemid='1232'], .pdRatingStarsWrapper[data-itemid='1232']").forEach(function(element) { element.innerHTML = "
(1 reviews)"; }); document.querySelectorAll("div[productId='1234'], div[data-itemid='1234'], .pdRatingStarsWrapper[data-itemid='1234']").forEach(function(element) { element.innerHTML = "
(1 reviews)"; }); document.querySelectorAll("div[productId='1271'], div[data-itemid='1271'], .pdRatingStarsWrapper[data-itemid='1271']").forEach(function(element) { element.innerHTML = "
(4 reviews)"; }); document.querySelectorAll("div[productId='1277'], div[data-itemid='1277'], .pdRatingStarsWrapper[data-itemid='1277']").forEach(function(element) { element.innerHTML = "
(1 reviews)"; }); document.querySelectorAll("div[productId='1278'], div[data-itemid='1278'], .pdRatingStarsWrapper[data-itemid='1278']").forEach(function(element) { element.innerHTML = ""; }); document.querySelectorAll("div[productId='1282'], div[data-itemid='1282'], .pdRatingStarsWrapper[data-itemid='1282']").forEach(function(element) { element.innerHTML = "
(2 reviews)"; }); document.querySelectorAll("div[productId='1284'], div[data-itemid='1284'], .pdRatingStarsWrapper[data-itemid='1284']").forEach(function(element) { element.innerHTML = "
(2 reviews)"; }); document.querySelectorAll("div[productId='1285'], div[data-itemid='1285'], .pdRatingStarsWrapper[data-itemid='1285']").forEach(function(element) { element.innerHTML = "
(1 reviews)"; }); document.querySelectorAll("div[productId='1292'], div[data-itemid='1292'], .pdRatingStarsWrapper[data-itemid='1292']").forEach(function(element) { element.innerHTML = ""; }); document.querySelectorAll("div[productId='1293'], div[data-itemid='1293'], .pdRatingStarsWrapper[data-itemid='1293']").forEach(function(element) { element.innerHTML = "
(1 reviews)"; }); document.querySelectorAll("div[productId='1331'], div[data-itemid='1331'], .pdRatingStarsWrapper[data-itemid='1331']").forEach(function(element) { element.innerHTML = "
(1 reviews)"; }); document.querySelectorAll("div[productId='1352'], div[data-itemid='1352'], .pdRatingStarsWrapper[data-itemid='1352']").forEach(function(element) { element.innerHTML = ""; }); document.querySelectorAll("div[productId='1376'], div[data-itemid='1376'], .pdRatingStarsWrapper[data-itemid='1376']").forEach(function(element) { element.innerHTML = "
(2 reviews)"; }); document.querySelectorAll("div[productId='1382'], div[data-itemid='1382'], .pdRatingStarsWrapper[data-itemid='1382']").forEach(function(element) { element.innerHTML = ""; }); document.querySelectorAll("div[productId='1413'], div[data-itemid='1413'], .pdRatingStarsWrapper[data-itemid='1413']").forEach(function(element) { element.innerHTML = "
(1 reviews)"; }); document.querySelectorAll("div[productId='1422'], div[data-itemid='1422'], .pdRatingStarsWrapper[data-itemid='1422']").forEach(function(element) { element.innerHTML = "
(8 reviews)"; }); document.querySelectorAll("div[productId='1443'], div[data-itemid='1443'], .pdRatingStarsWrapper[data-itemid='1443']").forEach(function(element) { element.innerHTML = ""; }); document.querySelectorAll("div[productId='1444'], div[data-itemid='1444'], .pdRatingStarsWrapper[data-itemid='1444']").forEach(function(element) { element.innerHTML = "
(4 reviews)"; }); document.querySelectorAll("div[productId='1445'], div[data-itemid='1445'], .pdRatingStarsWrapper[data-itemid='1445']").forEach(function(element) { element.innerHTML = ""; }); document.querySelectorAll("div[productId='1461'], div[data-itemid='1461'], .pdRatingStarsWrapper[data-itemid='1461']").forEach(function(element) { element.innerHTML = "
(3 reviews)"; }); document.querySelectorAll("div[productId='1464'], div[data-itemid='1464'], .pdRatingStarsWrapper[data-itemid='1464']").forEach(function(element) { element.innerHTML = "
(4 reviews)"; }); document.querySelectorAll("div[productId='1469'], div[data-itemid='1469'], .pdRatingStarsWrapper[data-itemid='1469']").forEach(function(element) { element.innerHTML = "
(1 reviews)"; }); document.querySelectorAll("div[productId='1495'], div[data-itemid='1495'], .pdRatingStarsWrapper[data-itemid='1495']").forEach(function(element) { element.innerHTML = "
(1 reviews)"; }); document.querySelectorAll("div[productId='1515'], div[data-itemid='1515'], .pdRatingStarsWrapper[data-itemid='1515']").forEach(function(element) { element.innerHTML = "
(4 reviews)"; }); document.querySelectorAll("div[productId='1543'], div[data-itemid='1543'], .pdRatingStarsWrapper[data-itemid='1543']").forEach(function(element) { element.innerHTML = "
(2 reviews)"; }); document.querySelectorAll("div[productId='1544'], div[data-itemid='1544'], .pdRatingStarsWrapper[data-itemid='1544']").forEach(function(element) { element.innerHTML = "
(2 reviews)"; }); document.querySelectorAll("div[productId='1546'], div[data-itemid='1546'], .pdRatingStarsWrapper[data-itemid='1546']").forEach(function(element) { element.innerHTML = "
(3 reviews)"; }); document.querySelectorAll("div[productId='1547'], div[data-itemid='1547'], .pdRatingStarsWrapper[data-itemid='1547']").forEach(function(element) { element.innerHTML = "
(4 reviews)"; }); document.querySelectorAll("div[productId='1548'], div[data-itemid='1548'], .pdRatingStarsWrapper[data-itemid='1548']").forEach(function(element) { element.innerHTML = "
(14 reviews)"; }); document.querySelectorAll("div[productId='1549'], div[data-itemid='1549'], .pdRatingStarsWrapper[data-itemid='1549']").forEach(function(element) { element.innerHTML = "
(4 reviews)"; }); document.querySelectorAll("div[productId='1550'], div[data-itemid='1550'], .pdRatingStarsWrapper[data-itemid='1550']").forEach(function(element) { element.innerHTML = "
(13 reviews)"; }); document.querySelectorAll("div[productId='1551'], div[data-itemid='1551'], .pdRatingStarsWrapper[data-itemid='1551']").forEach(function(element) { element.innerHTML = "
(3 reviews)"; }); document.querySelectorAll("div[productId='1552'], div[data-itemid='1552'], .pdRatingStarsWrapper[data-itemid='1552']").forEach(function(element) { element.innerHTML = "
(4 reviews)"; }); document.querySelectorAll("div[productId='1555'], div[data-itemid='1555'], .pdRatingStarsWrapper[data-itemid='1555']").forEach(function(element) { element.innerHTML = "
(5 reviews)"; }); document.querySelectorAll("div[productId='1556'], div[data-itemid='1556'], .pdRatingStarsWrapper[data-itemid='1556']").forEach(function(element) { element.innerHTML = "
(1 reviews)"; }); document.querySelectorAll("div[productId='1560'], div[data-itemid='1560'], .pdRatingStarsWrapper[data-itemid='1560']").forEach(function(element) { element.innerHTML = "
(2 reviews)"; }); document.querySelectorAll("div[productId='1569'], div[data-itemid='1569'], .pdRatingStarsWrapper[data-itemid='1569']").forEach(function(element) { element.innerHTML = ""; }); document.querySelectorAll("div[productId='1571'], div[data-itemid='1571'], .pdRatingStarsWrapper[data-itemid='1571']").forEach(function(element) { element.innerHTML = "
(1 reviews)"; }); document.querySelectorAll("div[productId='1601'], div[data-itemid='1601'], .pdRatingStarsWrapper[data-itemid='1601']").forEach(function(element) { element.innerHTML = "
(1 reviews)"; }); document.querySelectorAll("div[productId='1603'], div[data-itemid='1603'], .pdRatingStarsWrapper[data-itemid='1603']").forEach(function(element) { element.innerHTML = "
(3 reviews)"; }); document.querySelectorAll("div[productId='1607'], div[data-itemid='1607'], .pdRatingStarsWrapper[data-itemid='1607']").forEach(function(element) { element.innerHTML = "
(1 reviews)"; }); document.querySelectorAll("div[productId='1619'], div[data-itemid='1619'], .pdRatingStarsWrapper[data-itemid='1619']").forEach(function(element) { element.innerHTML = "
(2 reviews)"; }); document.querySelectorAll("div[productId='1622'], div[data-itemid='1622'], .pdRatingStarsWrapper[data-itemid='1622']").forEach(function(element) { element.innerHTML = "
(6 reviews)"; }); document.querySelectorAll("div[productId='1636'], div[data-itemid='1636'], .pdRatingStarsWrapper[data-itemid='1636']").forEach(function(element) { element.innerHTML = "
(2 reviews)"; }); document.querySelectorAll("div[productId='1639'], div[data-itemid='1639'], .pdRatingStarsWrapper[data-itemid='1639']").forEach(function(element) { element.innerHTML = ""; }); document.querySelectorAll("div[productId='1658'], div[data-itemid='1658'], .pdRatingStarsWrapper[data-itemid='1658']").forEach(function(element) { element.innerHTML = "
(27 reviews)"; }); document.querySelectorAll("div[productId='1659'], div[data-itemid='1659'], .pdRatingStarsWrapper[data-itemid='1659']").forEach(function(element) { element.innerHTML = "
(20 reviews)"; }); document.querySelectorAll("div[productId='1660'], div[data-itemid='1660'], .pdRatingStarsWrapper[data-itemid='1660']").forEach(function(element) { element.innerHTML = "
(5 reviews)"; }); document.querySelectorAll("div[productId='2201'], div[data-itemid='2201'], .pdRatingStarsWrapper[data-itemid='2201']").forEach(function(element) { element.innerHTML = "
(1 reviews)"; }); document.querySelectorAll("div[productId='2211'], div[data-itemid='2211'], .pdRatingStarsWrapper[data-itemid='2211']").forEach(function(element) { element.innerHTML = "
(4 reviews)"; }); document.querySelectorAll("div[productId='1663'], div[data-itemid='1663'], .pdRatingStarsWrapper[data-itemid='1663']").forEach(function(element) { element.innerHTML = ""; }); document.querySelectorAll("div[productId='1361'], div[data-itemid='1361'], .pdRatingStarsWrapper[data-itemid='1361']").forEach(function(element) { element.innerHTML = "
(3 reviews)"; }); 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 = "
Earn 0 Rewards Points for this item! Learn More...
";}); //*** END public_mod_myRewards_getRenderedPromotionMessagingJsInsertionCode *** //*** BEGIN public_mod_myRewards_getRenderedPromotionPopupJsInsertionCode *** document.body.insertAdjacentHTML("beforeend", "
Rewards Members Enjoy Great Benefits!
1
Join
It\'s free - get started now!
2
Earn
Points for purchases, referrals & more!
3
Redeem
Redeem for store credit and special offers!
Sign Up Login
Earn Points
Create an account
100 points
Make a purchase
1 point per $1
Refer friends
10 points per sign up
10 points per order
Write a review
10 points
"); //*** 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\",\"name\":\"Nuts In Bulk\",\"url\":\"https:\\/\\/www.nutsinbulk.com\\/\",\"address\":{\"@type\":\"PostalAddress\",\"streetAddress\":\"Superior Nut Company, Inc.\",\"addressLocality\":\"Cambridge\",\"addressRegion\":\"Massachusetts\",\"addressCountry\":\"US\",\"postalCode\":\"02141\"},\"founders\":[{\"@type\":\"Person\"}],\"contactPoint\":{\"@type\":\"ContactPoint\",\"email\":\"info@nutsinbulk.com\",\"telephone\":\"+1-800-988-7136\",\"contactType\":\"Customer Support\"}}" document.getElementsByTagName('head')[0].appendChild(script); ; function pdInjectAccountLinkModifications() { //***** INJECT REWARDS LINK **** jQuery(".navBar-section li:nth-child(2)").after(''); } pdInjectAccountLinkModifications();var pdPublicUrl = 'https://my.nutsinbulk.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("
Sign In My Account My Rewards
Create a Rewards Account! Earn 100 Starter Points
"); //*** COMPLETEION CALLBACK try{pdContentRenderCompleted()}catch(e){}; //*** done.