"; dwr.engine._ieConditions[cond] = !!(div.getElementsByTagName("p").length); } return dwr.engine._ieConditions[cond]; }, tokenify: function(number) var tokenbuf = []; var charmap = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ*$"; var remainder = number; while (remainder > 0) tokenbuf.push(charmap.charAt(remainder & 0x3F)); remainder = Math.floor(remainder / 64); return tokenbuf.join(""); , addEventListener: function(elem, name, func) if (elem.addEventListener) elem.addEventListener(name, func, false); else elem.attachEvent("on" + name, func); , isCallOptionArgument: function(lastArg) , logHandlerEx: function(func) try func(); catch (ex) dwr.engine._debug("Exception occured in user-specified handler:"); dwr.engine._debug(ex); }; dwr.engine._initializer.init(); dwr.hub = publish: function(topicName, data) dwr.engine._execute(null, '__System', 'publish', topicName, data, ); , subscribe: function(topicName, callback, scope, subscriberData) var subscription = "" + dwr.hub._subscriptionId; dwr.hub._subscriptionId++; dwr.hub._subscriptions[subscription] = callback: callback, scope: scope, subscriberData: subscriberData ; dwr.engine._execute(null, '__System', 'subscribe', topicName, subscription, ); return subscription; , _remotePublish: function(subscriptionId, publishData) var subscriptionData = dwr.hub._subscriptions[subscriptionId]; if (!subscriptionData) return; subscriptionData.callback.call(subscriptionData.scope, publishData, subscriptionData .subscriberData); , _subscriptionId: 0, _subscriptions: ; dwr.data = StoreChangeListener: itemRemoved: function(source, itemId) , itemAdded: function(source, item) , itemChanged: function(source, item, changedAttributes) , Cache: function(storeId, listener) this.storeId = storeId; this.listener = listener; ; dwr.data.Cache.prototype.viewRegion = function(region, callbackObj) if (!region) region = ; if (!region.start) region.start = 0; if (!region.count) region.count = -1; if (!region.sort) region.sort = []; else for (var index = 0; index ').replace(/"/g,'"').replace(/'/g,''');;dwr.util.unescapeHtml = function(original) return original.replace(//g,'>').replace(/"/g,'"').replace(/'/g,"'").replace(/&/g,'&');;dwr.util.replaceXmlCharacters = function(original) original = original.replace("&", "+");original = original.replace("", "\u203A");original = original.replace("\'", "\u2018");original = original.replace("\"", "\u201C");return original;;dwr.util.containsXssRiskyCharacters = function(original) original.indexOf('\'') != -1;dwr.util.onReturn = function(event, action) if (!event) event = window.event;if (event && event.keyCode && event.keyCode == 13) action();;dwr.util.selectRange = function(ele, start, end) ele = dwr.util._getElementById(ele, "selectRange()");if (ele == null) return;if (ele.setSelectionRange) ele.setSelectionRange(start, end);else if (ele.createTextRange) var range = ele.createTextRange();range.moveStart("character", start);range.moveEnd("character", end - ele.value.length);range.select();ele.focus();;dwr.util.byId = function() var elems = [];for (var i = 0; i options.shortStringMaxLength)str = str.substring(0, options.shortStringMaxLength-3) + "...";if (options.escapeHtml) var lines = str.split("\n");for (var i = 0; i 0)reply = "[...]";elsereply = "[]";else var strarr = [];strarr.push("[");var count = 0;for (var i = 0; i 0) strarr.push(", ");if (showLevels == 1) if (count == options.oneLineMaxItems) strarr.push("...");break;else strarr.push(options.lineTerminator + indent(indentDepth+1, options));if (i != count) strarr.push(i);strarr.push(":");strarr.push(recursive(itemvalue, showLevels-1, indentDepth+1, options));count++;if (showLevels > 1) strarr.push(options.lineTerminator + indent(indentDepth, options));strarr.push("]");reply = strarr.join("");else if (dwr.util._isObject(data) && !dwr.util._isDate(data)) if (showLevels == 0) reply = dwr.util._detailedTypeOf(data);else var strarr = [];if (dwr.util._detailedTypeOf(data) != "Object") strarr.push(dwr.util._detailedTypeOf(data));if (typeof data.valueOf() != "object") strarr.push(":");strarr.push(recursive(data.valueOf(), 1, indentDepth, options));strarr.push(" ");strarr.push("");var isDomObject = dwr.util._isHTMLElement(data);var count = 0;for (var prop in data) var propvalue = data[prop];if (isDomObject) if (propvalue == null) continue;if (typeof propvalue == "function") continue;if (skipDomProperties[prop]) continue;if (prop.toUpperCase() == prop) continue;if (count > 0) strarr.push(", ");if (showLevels == 1) if (count == options.oneLineMaxItems) strarr.push("...");break;else strarr.push(options.lineTerminator + indent(indentDepth+1, options));strarr.push(prop.length > options.propertyNameMaxLength ? prop.substring(0, options.propertyNameMaxLength-3) + "..." : prop);strarr.push(":");strarr.push(recursive(propvalue, showLevels-1, indentDepth+1, options));count++;if (showLevels > 1 && count > 0) strarr.push(options.lineTerminator + indent(indentDepth, options));strarr.push("");reply = strarr.join("");else reply = "" + data;return reply;catch(err) return (err.message ? err.message : ""+err);function indent(count, options) var strarr = [];strarr.push(options.baseIndent);for (var i=0; i= 1) ele = nodes.item(0);if (ele == null) dwr.util._debug("setValue() can't find an element with id/name: " + orig + ".");return;dwr.util.highlight(ele, options);if (dwr.util._isHTMLElement(ele, "select")) if (ele.type == "select-multiple" && dwr.util._isArray(val)) dwr.util._selectListItems(ele, val);else dwr.util._selectListItem(ele, val);return;if (dwr.util._isHTMLElement(ele, "input")) ele.type == "checkbox") if (nodes && nodes.length >= 1) for (var i = 0; i = 1) ele = nodes.item(0);if (ele == null) dwr.util._debug("getValue() can't find an element with id/name: " + orig + ".");return "";if (dwr.util._isHTMLElement(ele, "select")) if (ele.type == "select-multiple") var reply = new Array();for (var i = 0; i = 1) for (var i = 0; i = 1) var reply = [];for (var i = 0; i 0 && dwr.util._isObject(data[0])) for (var i = 0; i 0 && dwr.util._isObject(data[0])) for (var i = 0; i 0 && dwr.util._isObject(data[prop][0])) dwr.util._getValuesRecursive(data[prop], subidpath, depth-1, options);else if (typeof data[prop] == "function") else if (dwr.util.byId(subidpath) != null ;dwr.util.addOptions = function(ele, data ) ele = dwr.util._getElementById(ele, "addOptions()");if (ele == null) return;var useOptions = dwr.util._isHTMLElement(ele, "select");var useLi = dwr.util._isHTMLElement(ele, ["ul", "ol"]);if (!useOptions && !useLi) dwr.util._debug("addOptions() can only be used with select/ul/ol elements. Attempt to use: " + dwr.util._detailedTypeOf(ele));return;if (data == null) return;var argcount = arguments.length;var options = ;var lastarg = arguments[argcount - 1];if (argcount > 2 && dwr.util._isObject(lastarg)) options = lastarg;argcount--;var arg3 = null; if (argcount >= 3) arg3 = arguments[2];var arg4 = null; if (argcount >= 4) arg4 = arguments[3];if (!options.optionCreator && useOptions) options.optionCreator = dwr.util._defaultOptionCreator;if (!options.optionCreator && useLi) options.optionCreator = dwr.util._defaultListItemCreator;options.document = ele.ownerDocument;var text, value, li;if (dwr.util._isArray(data)) for (var i = 0; i 0) ele.removeChild(ele.firstChild);;dwr.util.addRows = function(ele, data, cellFuncs, options) ele = dwr.util._getElementById(ele, "addRows()");if (ele == null) return;if (!dwr.util._isHTMLElement(ele, ["table", "tbody", "thead", "tfoot"])) dwr.util._debug("addRows() can only be used with table, tbody, thead and tfoot elements. Attempt to use: " + dwr.util._detailedTypeOf(ele));return;if (!options) options = ;if (!options.rowCreator) options.rowCreator = dwr.util._defaultRowCreator;if (!options.cellCreator) options.cellCreator = dwr.util._defaultCellCreator;options.document = ele.ownerDocument;var tr, rowNum;if (dwr.util._isArray(data)) for (rowNum = 0; rowNum oldidpath.length) if (currId.substr(0, oldidpath.length) == oldidpath) var trailingChar = currId.charAt(oldidpath.length);if (trailingChar == "." if (newId) ele.setAttribute("id", newId);else ele.removeAttribute("id");var children = ele.childNodes;for (var i = 0; i 0 && dwr.util._isObject(value[0])) var subTemplateId = idpath + "." + prop;var subTemplateEle = dwr.util.byId(subTemplateId);if (subTemplateEle != null) dwr.util._cloneNodeForValuesRecursive(subTemplateEle, value, subTemplateId, options);else if (dwr.util._isObject(value)) dwr.util._cloneSubArrays(value, idpath + "." + prop, options);;dwr.util._getElementById = function(ele, source) var orig = ele;ele = dwr.util.byId(ele);if (ele == null) dwr.util._debug(source + " can't find an element with id: " + orig + ".");return ele;;dwr.util._isHTMLElement = function(ele, nodeName) if (ele == null ;dwr.util._detailedTypeOf = function(x) var reply = typeof x;if (reply == "object") reply = Object.prototype.toString.apply(x);reply = reply.substring(8, reply.length-1);return reply;;dwr.util._isObject = function(data) return (data && typeof data == "object");;dwr.util._isArray = function(data) return (data && Object.prototype.toString.call(data)=="[object Array]");;dwr.util._isArrayLike = function(data) data!="[object Object]")&& !dwr.util._isString(data)&& !dwr.util._isFunction(data)&& !data.tagName;;dwr.util._isString = function(data) ;dwr.util._isFunction = function(data) Object.prototype.toString.call(data) == "[object Function]")&& data != "[object NodeList]");;dwr.util._isDate = function(data) return (data && Object.prototype.toString.call(data)=="[object Date]");;dwr.util._importNode = function(doc, importedNode, deep) var newNode;if (importedNode.nodeType == 1 ) newNode = doc.createElement(importedNode.nodeName);for (var i = 0; i " + debug.innerHTML;if (contents.length > 2048) contents = contents.substring(0, 2048);debug.innerHTML = contents;; if (typeof dwr == 'undefined' dwr.engine == undefined) throw new Error( 'You must include DWR engine before including this file'); (function() if (dwr.engine._getObject("geographyController") == undefined) var p; p = ; p.getPostCodeMap = function(p0, p1, callback) return dwr.engine._execute(p._path, 'geographyController', 'getPostCodeMap', arguments); ; p.getSubCountries = function(p0, callback) return dwr.engine._execute(p._path, 'geographyController', 'getSubCountries', arguments); ; p.getSuburbsForPostCode = function(p0, p1, callback) return dwr.engine._execute(p._path, 'geographyController', 'getSuburbsForPostCode', arguments); ; p.getState = function(p0, p1, callback) return dwr.engine._execute(p._path, 'geographyController', 'getState', arguments); ; dwr.engine._setObject("geographyController", p); )(); if (typeof dwr == 'undefined' dwr.engine == undefined) throw new Error( 'You must include DWR engine before including this file'); (function() if (dwr.engine._getObject("shippingAjaxController") == undefined) var p; p = ; p.getDeliveryDates = function(p0, p1, callback) return dwr.engine._execute(p._path, 'shippingAjaxController', 'getDeliveryDates', arguments); ; dwr.engine._setObject("shippingAjaxController", p); )(); if (typeof dwr == 'undefined' dwr.engine == undefined) throw new Error( 'You must include DWR engine before including this file'); (function() if (dwr.engine._getObject("customerAjaxController") == undefined) var p; p = ; p.deleteQffMember = function(callback) return dwr.engine._execute(p._path, 'customerAjaxController', 'deleteQffMember', arguments); ; p.bookClubOptIn = function(callback) return dwr.engine._execute(p._path, 'customerAjaxController', 'bookClubOptIn', arguments); ; p.bookClubOptOut = function(callback) return dwr.engine._execute(p._path, 'customerAjaxController', 'bookClubOptOut', arguments); ; p.isCustomerEmail = function(p1, p2, callback) return dwr.engine._execute(p._path, 'customerAjaxController', 'isCustomerEmail', arguments); ; p.validateQffMemberId = function(p0, p1, callback) return dwr.engine._execute(p._path, 'customerAjaxController', 'validateQffMemberId', arguments); ; dwr.engine._setObject("customerAjaxController", p); )(); function isBotUserAgent() duckduckgo function lazyLoadScript(url, callback) if (isBotUserAgent()) return; var head = document.getElementsByTagName('head')[0]; var script = document.createElement('script'); script.defer = true; script.type = 'text/javascript'; script.src = url; head.appendChild(script); script.onload = callback; lazyLoadScript(" ", function() citrusAd = CitrusAd.init(" -integration.citrusad.com/v1"); ) var customPath = " -resources"; window.dataLayer = window.dataLayer []; function gtag() dataLayer.push(arguments); gtag('js', new Date()); gtag('config', 'AW-1071893088'); (function(w, d, s, l, i) []; w[l].push( 'gtm.start': new Date().getTime(), event: 'gtm.js' ); var f = d.getElementsByTagName(s)[0], j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : ''; j.async = true; j.src = ' =' + i + dl; f.parentNode.insertBefore(j, f); )(window, document, 'script', 'dataLayer', 'GTM-N74L7GH'); var _gaq = _gaq []; _gaq.push(['_setAccount', "UA-413837-1"]); _gaq.push(['_trackPageview']); _gaq.push(['_setCustomVar', 1, 'Site', "PC", 2]); (function() var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? ' : ' + 'stats.g.doubleclick.net/dc.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); )(); (function(i, s, o, g, r, a, m) )(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga'); ga('create', "UA-413837-3", 'auto'); ga('send', 'pageview'); (function() window._pxAppId = 'PXNs7aBMIv'; // Custom parameters // window._pxParam1 = ""; var p = document.getElementsByTagName('script')[0], s = document.createElement('script'); s.async = 1; s.src = ' '; p.parentNode.insertBefore(s, p); ()); var citrusAd = CitrusAd.init(" -integration.citrusad.com/v1"); var advertTrackerRaw = localStorage.getItem('advertTracker') var advertTracker = JSON.parse(advertTrackerRaw) if (advertTrackerRaw && window.location.pathname != advertTracker.pathname) localStorage.removeItem('advertTracker') (function() var bk = document.createElement('script'); bk.type = 'text/javascript'; bk.async = true; bk.src = ('https:' == document.location.protocol ? ' : ' + 'static.booktopia.com.au/cart-widget/v1/booktopia-cart-widget-ext.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(bk, s); )(); function getCookie(cname) var name = cname + "="; var decodedCookie = decodeURIComponent(document.cookie); var ca = decodedCookie.split(';'); for (var i = 0; i a color: #075f20 !important; if (typeof String.prototype.trim !== 'function') String.prototype.trim = function() return this.replace(/^\s+; function isEmpty(str) return (!str function isBlank(str) return (!str function hasStorage() return typeof(Storage) !== "undefined"; function currentTimestamp() var d = new Date(); return d.getTime(); function formatShortDate(date) try var dd = date.getDate(); var mm = date.getMonth() + 1; var yyyy = "" + date.getFullYear(); return (dd 0); function numDigits(number) var numDigits = 0; var tempNumber = number; while (tempNumber > 0) tempNumber = parseInt(tempNumber / 10); numDigits++; return numDigits; function isDigit(string) var regex = new RegExp("\\d"); return regex.test(string); function getThirdPartyCheckoutData(serviceName, successHandler) try checkoutAjaxController.getThirdPartyCheckoutData(serviceName, successHandler); catch (e) if (window.console && console.warn) console.warn(e); function startSubmit(elem) var innerHTML = jQuery(elem).html(), elemWidth = jQuery(elem).outerWidth(), elemHeight = jQuery(elem).outerHeight(); jQuery(elem).prop('disabled', true).html('').css( 'opacity': '0.5', 'width': elemWidth, 'height': elemHeight ).attr('data-innerhtml', innerHTML); function endSubmit(elem) jQuery(elem).prop('disabled', false).html(jQuery(elem).data('innerhtml')).css('opacity', '1'); function getParameterByName(name, url) # function reportCitrusClick(id, redirectUrl) if (isBotUserAgent()) return; if (typeof citrusAd !== 'undefined' && citrusAd) citrusAd.reportClick(id).then(function(result) window.location.href = redirectUrl; ).catch(function(error) console.log('error ', error); window.location.href = redirectUrl; ); function reportCitrusImpression(id) if (isBotUserAgent()) return; if (typeof citrusAd !== 'undefined' && citrusAd) citrusAd.reportImpression(id).then(function(result) ).catch(function(error) console.log('error ', error); ); function fireImpactIdentifyAndCheckClickId(customerSession) if (currentPageNav !== "help") if (customerSession.signedIn) ire('identify', customerId: customerSession.emarsysCustomerUid, customerEmail: customerSession.sha1Email ); else ire('identify', customerId: "", customerEmail: "" ); if (customerSession.irClickId === "") ire('generateClickId', function(clickId) customerSessionAjaxController.updateImpactClickId(clickId); if (currentPageNav === "receipt" && typeof impactConvert === "function") impactConvert(clickId); ); else if (currentPageNav === "receipt" && typeof impactConvert === "function") impactConvert(customerSession.irClickId); function resetPostcode() localStorage.removeItem('postcode'); localStorage.removeItem('suburb'); jQuery(function() var specialOccasionIconHtml = ""; if (jQuery("#product-browse .product-results").length) jQuery("#product-browse .product-results li").each(function() if (jQuery(this).find(".in-stock").length) jQuery(this).find(".image").append(specialOccasionIconHtml); ); else if (jQuery("#manage-account.wishlist").length) jQuery("#wishlist table").each(function() if (jQuery(this).find(".in-stock").length) jQuery(this).find(".image > a").append(specialOccasionIconHtml); ); ); function validateEmail(emailElement) if (emailElement.checkValidity) return emailElement.checkValidity(); else (([a-zA-Z\-0-9]+\.)+[a-zA-Z]2,))$/; return re.test(emailElement.value); function initGoogleAuth() try var googleClientId = document.getElementById("google-signin-client_id").getAttribute("content"), isGoogleSignInEnabled = (document.getElementById("google-signin-client_id").dataset.enabled === 'true'); gapi.load('auth2', function() gapi.auth2.init( client_id: googleClientId, fetch_basic_profile: false, scope: 'profile' ).then(function() var isSignedInGoogle = gapi.auth2.getAuthInstance().isSignedIn.get(), isSignedInBooktopia = jQuery('body').hasClass('signed-in'); if (!isSignedInBooktopia && isSignedInGoogle) googleSignOut(); if (!isSignedInBooktopia && isGoogleSignInEnabled) lazyLoadScript(' ', function() if (typeof google !== "undefined") google.accounts.id.initialize( client_id: googleClientId, callback: function(response) jQuery( '') .append('').appendTo( 'body').submit(); ); setTimeout(function() google.accounts.id.prompt(); , 5000); ) , function(e) console.warn('Google auth2 error: ', e); ); ); catch (e) console.log(e); return; function googleSignOut() try gapi.auth2.getAuthInstance().signOut(); catch (e) console.log(e); return; function switchTabs(tabLink) tabLink = jQuery(tabLink); var tabId = tabLink.attr("data-tab"), tabGroup = tabLink.closest(".tabs"); tabGroup.find(".tab.selected").removeClass("selected"); tabLink.closest(".tab").addClass("selected"); tabGroup.find(".tab-content.active").removeClass("active"); tabGroup.find("#" + tabId).addClass("active"); function validateForm(formId) var jFormId = jQuery("#" + formId), allInput = jFormId.find(':input'), isValid = true; allInput.each(function(i, input) jQuery(input).one('input', function() jQuery(this).parents('.field').removeClass('error'); jQuery(this).parents('.field').find('.input-error').remove(); ); jQuery(input).parents('.field').removeClass('error'); jQuery(input).parents('.field').find('.input-error').remove(); if (!input.validity.valid) jQuery(input).parents('.field').addClass('error'); if (input.validity.valueMissing) jQuery(input).parents('.field').append( 'Please enter a value.'); if (input.validity.typeMismatch) jQuery(input).parents('.field').append( 'Please enter valid email address.'); isValid = false; ); return isValid; function escapeHtml(input) return input.replace(//g, ">") function addProductToCartReload(url, productCode, quantity, binding, preOrder, availableDate, languageCodes, supplierItemStatus, publisher, hasStockAvailable) if (window.BKT_GLOBALS.isMobileSession) var parentID = "#booktopia-notification-wrapper", responseContainerID = "#hidden-response-from-ajax", contentContainerID = "#total-cart-item-mobile"; else var parentID = "#shopping-cart-popup", responseContainerID = "#add-cart-page-placeholder", contentContainerID = "#add-cart-page-content"; if (productPopupsV2(binding, preOrder, availableDate, languageCodes, supplierItemStatus, publisher, hasStockAvailable)) var data = "cartItem[0].pID": productCode, "cartItem[0].skuGuid": productCode, "cartItem[0].quantity": quantity ; jQuery(parentID).find(responseContainerID).load(url + ' ' + contentContainerID, data, function() window.location.reload(); ); function isCustomSearchPopulated() function htmlEncode(value) return $('').text(value).html(); function scrollToElement(element, offset, speed) $('html, body').animate( scrollTop: element.offset().top - offset , speed); function lazyLoadPopup(url, className) $.ajax( method: "GET", url: url ).done(function(htmlResponse) createModal('iframe-modal', className); $('#iframe-modal-container').html(htmlResponse); showModalContent($('#iframe-modal')); $('#iframe-modal').addClass('b-show-modal'); ); ; function validQuantity(quantity) return quantity !== null && quantity !== "" && !isNaN(quantity) && quantity >= 0; function saveCustomerFeedback(productUid, feedbackType) var feedbackTypeStr = null; switch (feedbackType) case 1: default: feedbackTypeStr = "SHOPPING CART RECOMMENDATIONS"; customerFeedbackAjaxController.recordFeedback(productUid, feedbackTypeStr); jQuery(".feedback-link").text("Thank you!"); jQuery(".feedback-link").contents().unwrap().wrap(""); function initCustomerSession(event, trigger) function updateBookClubMemberStatus(session) if (session.signedIn && !session.wholesaleCustomer) if (session.qualified) jQuery('.intro-text.qualified').show(); else jQuery('.intro-text.not-qualified').show(); if (!session.signedIn) jQuery('.book-club-btn').remove(); jQuery('.book-club-buy-now').attr( 'onclick': '' ); removeMemberDisplay(); else if (session.wholesaleCustomer) jQuery('.book-club-btn').remove(); jQuery('.book-club-buy-now').attr( 'onclick': 'toggleModal("#book-club-templates"); displayBookClubModal("#book-club-not-eligible",this);', 'href': 'javascript:void(0)' ); removeMemberDisplay(); else if (session.signedIn && session.optIn) jQuery('.book-club-btn').css( 'display': 'block' ); jQuery('.book-club-buy-now').remove(); showMemberDisplay(); else jQuery('.book-club-btn').remove(); jQuery('.book-club-buy-now').attr( 'onclick': 'toggleModal("#book-club-templates"); displayBookClubModal("#book-club-join-now",this);', 'href': 'javascript:void(0)' ); removeMemberDisplay(); function removeMemberDisplay() jQuery('.has-member-price .member-sale-price').remove(); jQuery('.has-member-price .regular-price').remove(); jQuery('.has-member-price .member-price-buy-now').remove(); jQuery('.has-member-price .save.member-price').remove(); function displayJoinBookClubModalOnRedirect() buyBundle = getParameterByName("bundle", window.location.search) if (buyBundle === null function updateDisplayCartQuantityCallback(quantity) var savedQuantity = null; var valid = true; if ((valid = validQuantity(quantity))) updateDisplayCartQuantity(quantity, true); else savedQuantity = parseInt(getStateValue("shoppingCartQty")); updateDisplayCartQuantity(savedQuantity, false); return valid; function updateDisplayCartQuantity(quantity, updateState) if (!validQuantity(quantity)) jQuery('#shopping-cart-summary').removeClass('full'); jQuery("#numItemsQty").text(""); jQuery("#numItemsUnits").text(""); return false; if (quantity > 0) jQuery('#shopping-cart-summary').addClass('full'); else jQuery('#shopping-cart-summary').removeClass('full'); jQuery("#numItemsQty").text(quantity); jQuery("#numItemsUnits").text(quantity == 1 ? "item" : "items"); if (updateState) setStateValue("shoppingCartQty", quantity); return true; function updateLocalEmptyCart() setStateValue("shoppingCartQty", "0"); $(function() initCustomerSession(this, 'footer'); ) function triggerSameDayDeliveryCountDown(sessionServerTime) if (jQuery("#product").length && jQuery("#currentTimeAEST").length) var serverDateTime = new Date(sessionServerTime); jQuery("#currentTimeAEST").val(toTwoDigits(serverDateTime.getHours()) + ":" + toTwoDigits(serverDateTime .getMinutes()) + ":" + toTwoDigits(serverDateTime.getSeconds())); function handleKoboPlus(session) if (session.signedIn && session.koboEBookSubscribed) jQuery("body").addClass("kobo-plus-member"); else jQuery("body").removeClass("kobo-plus-member"); ; function productPopups(binding, preOrder, availableDate, languageCodes, hasStockAvailable) hasStockAvailable function productPopupsV2(binding, preOrder, availableDate, languageCodes, supplierItemStatus, publisherName, hasStockAvailable) function checkProductAvailabilityCallback(data, url, productId, productCode, quantity, binding, preOrder, availableDate, languageCodes, isBookClubProduct, hasStockAvailable) if (!data) alert( "This product may have just sold out, or has become unavailable a short time ago.\n\nPlease select another title, search again, or click on the Author's name to see if there are any other titles by that Author that may interest you."); else if (productPopups(binding, preOrder, availableDate, languageCodes, hasStockAvailable)) if (isBookClubProduct) customerSessionAjaxController.getCustomerSession(function(session) if (session.wholesaleCustomer) toggleModal("#book-club-templates"); displayBookClubModal("#book-club-not-eligible"); else if (!session.optIn) toggleModal("#book-club-templates"); displayBookClubModal("#book-club-join-now"); else addToCart(url, productCode, quantity); ) else addToCart(url, productCode, quantity); function checkFormat(binding) function checkLanguage(languageCodes) languageCodes.trim() === "") return true; languageCodes = languageCodes.toUpperCase(); var languagesArray = (languageCodes.indexOf(',') > -1 ? languageCodes.split(',') : languageCodes.split(' ')); if (languagesArray.length == 0) return true; for (var i = 0; i -1) theLink.href = window.location.protocol + "//" + window.location.host + window.location.pathname + "?keywords=" + encodeURIComponent(keywords) + "&productType=" + productType; return false; return true; function autoCompleteOnSelect(suggestion) var searchForm = jQuery('#searchform'); $(this).trigger('blur'); if (suggestion.pageUrl) window.location = suggestion.pageUrl; else if (suggestion.context) searchForm.find("select[name='productType']").val(suggestion.context); window.location = searchForm.attr('action') + '?' + searchForm.serialize() + '&suggested=L'; function autoCompleteTransformResult(response) var suggestions = JSON.parse(response); return suggestions: $.map(suggestions.suggestions, function(dataItem) var contextName = null, data = dataItem.data; if (dataItem.context && (contextName = window.lookaheadSuffixes[dataItem.context])) data['contextName'] = contextName; return value: dataItem.value, data: data, context: dataItem.context, pageUrl: dataItem.pageUrl ; ) ; function autoCompleteFormatResult(suggestion, currentValue) var baseFormat = jQuery.Autocomplete.formatResult(suggestion, currentValue); var contextName = null; var htmlResult = ''; if (suggestion.context && (contextName = window.lookaheadSuffixes[suggestion.context])) htmlResult += '' + baseFormat + ' ' + contextName + ''; else if (suggestion.context) htmlResult += '' + baseFormat + ' ' + suggestion.context + ''; else htmlResult += baseFormat; return htmlResult; $(function() window.lookaheadSuffixes = "ser": "Series", "cat": "Category", "prm": "Collection", "917504": "Books", "917505": "eBooks", "917506": "DVDs", "917507": "Audio CDs", "917508": "Magazines", "917510": "Audiobooks", "917503": "Stationery" ; $("select[name='productType']").on('change', function() $('#header-search-box').autocomplete().setOptions( params: productType: this.value ); ); ); function emarsysAddMobileTag(mobile) if (typeof mobile != 'undefined' && mobile && "true" == mobile) ScarabQueue.push(['tag', 'mobile']); function emarsysSetTestMode(testMode) if (typeof testMode != 'undefined' && testMode && "true" == testMode) ScarabQueue.push(['testMode']); function emarsysPushProductView(customerUidPk, isbn, mobile, testMode) if (!isBlank(isbn)) if (!isEmpty(customerUidPk)) ScarabQueue.push(['setCustomerId', customerUidPk]); ScarabQueue.push(['cart', []]); emarsysSetTestMode(testMode); ScarabQueue.push(['view', isbn]); emarsysAddMobileTag(mobile); ScarabQueue.push(['go']); function emarsysPushCategoryView(customerUidPk, categoryPath, mobile, testMode) if (!isBlank(categoryPath)) if (!isEmpty(customerUidPk)) ScarabQueue.push(['setCustomerId', customerUidPk]); ScarabQueue.push(['cart', []]); emarsysSetTestMode(testMode); ScarabQueue.push(['category', categoryPath]); emarsysAddMobileTag(mobile); ScarabQueue.push(['go']); function emarsysPushSearchTerm(customerUidPk, searchTerm, mobile, testMode) if (!isBlank(searchTerm)) if (!isEmpty(customerUidPk)) ScarabQueue.push(['setCustomerId', customerUidPk]); ScarabQueue.push(['cart', []]); emarsysSetTestMode(testMode); ScarabQueue.push(['searchTerm', searchTerm]); emarsysAddMobileTag(mobile); ScarabQueue.push(['go']); function emarsysPushPurchase(customerUidPk, orderNo, itemArray, mobile, testMode) if (!isBlank(orderNo)) if (!isEmpty(customerUidPk)) ScarabQueue.push(['setCustomerId', customerUidPk]); ScarabQueue.push(['cart', []]); emarsysSetTestMode(testMode); ScarabQueue.push(['purchase', orderId: orderNo, items: itemArray ]); emarsysAddMobileTag(mobile); ScarabQueue.push(['go']); function emarsysPushDefault(customerUidPk, mobile, testMode) if (!isEmpty(customerUidPk)) ScarabQueue.push(['setCustomerId', customerUidPk]); ScarabQueue.push(['cart', []]); emarsysSetTestMode(testMode); emarsysAddMobileTag(mobile); ScarabQueue.push(['go']); ; function setCookie(cname, cvalue, exdays) var d = new Date(); d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); var expires = "expires=" + d.toUTCString(); document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; ; $(function() $('#select-delivery-cta, #header-postcode, #lux-select-delivery-cta').on('click', function() toggleLocationModalLUX(); ); var deliverEstimateFlag = getParameterByName("deliveryEstimate", window.location.href); if (deliverEstimateFlag && deliverEstimateFlag === '1') toggleLocationModalLUX(); $(document).on('submit', '#delivery-estimate-form-header', function(e) e.preventDefault(); var _this = $(this); var postcode = $(this).find('#apply-delivery-input-postcode-header').val(), suburb = $(this).find('#apply-delivery-input-suburb-header').val(); if (postcode === '' ); $(document).on('click', '#delivery-location-selector .cancel', function(e) e.preventDefault(); $('#delivery-location-selector').hide(); ); $(window).on('click', function(e) if ($(e.target).closest('#select-delivery-wrapper')[0] !== jQuery( '#select-delivery-wrapper')[0]) $('#delivery-location-selector').hide(); ); $(window).on('load', function() if (window.BKT_GLOBALS.occasion.enabled && window.BKT_GLOBALS.occasion.occasionName !== "" && jQuery('#product').length > 0) $.ajax( method: "GET", url: '/news236.html' ).done(function(result) content = $('').append(result).find('#content').html(); if (window.BKT_GLOBALS.isMobileSession) $('#tab-occasion').html(content); else $('#delivery').html(content); ); ); ) function selectSuburb() $('#apply-delivery-input-header').autocomplete( width: 233, minChars: 3, maxHeight: 600, appendTo: $('#delivery-input-wrapper'), lookup: function(query, done) jQuery("#apply-delivery-input-suburb-header").val(query); correctPostcode = false; geographyController.getSuburbsForPostCode("AU", query, function(suburbs) var result = []; if (suburbs.length > 0) correctPostcode = true; $('#apply-delivery-input-suburb-header').val(suburbs[0]); $('#apply-delivery-input-postcode-header').val(query); for (var i = 0; i ' + suggestion.data + ' - ' + suggestion.value + ''; , ); function toggleLocationModalLUX() var localPostcode = localStorage.getItem('postcode'); appendModalTemplate("#delivery-location-selector", "#delivery-location-selector-template"); if (window.BKT_GLOBALS.isMobileSession) if (localPostcode !== null) $('#delivery-notification-modal').find('h3').text('Change your Delivery Location'); openBooktopiaNotification("#delivery-notification-modal"); else if (localPostcode !== null) $('#delivery-location-selector').find('h3').text('Change your Delivery Location'); $('#delivery-location-selector').toggle(); selectSuburb(); function displayDeliveryIcon() var themeStyle = window.BKT_GLOBALS.occasion.theme, occasionName = window.BKT_GLOBALS.occasion.occasionName, style = 'style="' + themeStyle + '"'; $('.delivery-icon,.arrives-by-text').remove(); var html = 'Arrives by ' + occasionName + ''; var htmlWithText = 'Arrives By ' + occasionName + ''; if (window.BKT_GLOBALS.isMobileSession) $('#wishlist-container').length > 0) $('.in-stock').closest('.product').find('.image a').append(html); $('.in-stock').closest('.product').find('.container-prod-details ').prepend(htmlWithText); else $('.in-stock').closest('.product').find('.image a').append(html); function initDeliveryLocation(session) { if (window.BKT_GLOBALS.occasion.enabled !== "true") return false; localStorage.removeItem('inStockDeliveryForPostcode'); var isPDP = $('#product').length > 0, isCart = window.BKT_GLOBALS.currentNav === "shopping-cart", localPostcode = localStorage.getItem('postcode'), localSuburb = localStorage.getItem('suburb'), cutoffDate = window.BKT_GLOBALS.occasion.cutoffDate, themeStyle = window.BKT_GLOBALS.occasion.theme, occasionName = window.BKT_GLOBALS.occasion.occasionName, style = 'style="' + themeStyle + '"'; if (localPostcode && localSuburb) var postcode = localPostcode, suburb = localSuburb; else if (session.signedIn && session.zipOrPostalCode) var postcode = session.zipOrPostalCode, suburb = session.suburb; setPostcodeAndSuburb(postcode, suburb); if (postcode !== undefined && suburb !== undefined) { $('#header-postcode').css( 'display': 'flex' ); if (window.BKT_GLOBALS.isMobileSession) $('#header-postcode').find('span').text(postcode); $('#select-delivery-cta').hide(); else { $('#select-delivery-cta').html('' + '' + 'Deliver to ' + '' + postcode + ', ' + suburb + '
Download Save State Naruto Ninja Heroes 3
2ff7e9595c
Komen