Frequently Asked Questions

To find the answer you're looking for, search below or click on a topic. If you can't find what you're looking for please call us on 0800 861 862, Monday to Friday, 8am - 6pm.

What is hotpoints?


hotpoints is Westpac's credit card rewards programme and is available on any Westpac hotpoints credit card (hotpoints Mastercard, hotpoints Platinum Mastercard, hotpoints WORLD Mastercard and BusinessPLUS Mastercard).


Every eligible1 dollar you spend on a Westpac hotpoints credit card earns you hotpoints that you can redeem for a wide range of rewards.

How do I earn hotpoints?


Every time you use your Westpac hotpoints credit card for an eligible purchase, you will earn hotpoints.

How can I get a Westpac hotpoints credit card?


You can apply for a Westpac hotpoints credit card via our website westpac.co.nz/credit-cards/hotpoints, or if you are already an existing Westpac customer, via Westpac One® digital banking.

How many hotpoints can I earn?


Different Westpac hotpoints credit cards have different earn rates.


We have:

• three personal Westpac hotpoints credit cards which are intended wholly or predominantly for personal, domestic, or household purposes. To see which personal card might be best for you, use the hotpoints calculator. These cards earn hotpoints on a tiered earn rate basis; and


• one business Westpac hotpoints credit card, BusinessPLUS Mastercard, which is intended wholly for purposes other than personal, domestic or household purposes.


You can also visit us on westpac.co.nz/credit-cards/hotpoints for a full list of tiers and earn rates on our personal Westpac hotpoints credit cards, and on BusinessPLUS Mastercard® with hotpoints® | Westpac NZ for the earn rate on our BusinessPLUS Mastercard®.

How do I use my hotpoints to get rewards?


To redeem your hotpoints, you can log into Westpac One digital banking and either turn on hotpoints Pay for your next purchase or click ‘Visit the hotpoints website for more ways to redeem hotpoints’.


Once on the website, you'll be able to choose what type of reward you are looking for. You'll also be able to donate your hotpoints to the Westpac Rescue Helicopter, make a contribution to a Westpac KiwiSaver Scheme Account and use your points for qualifying purchases you've made on your Westpac hotpoints credit card in the last 90 days.

Do hotpoints have an expiry period or time limit?


Yes, hotpoints earned on an account are valid for 35 months from the date they are awarded and will expire at the end of the relevant calendar month.


When you make a redemption or use hotpoints Pay, your oldest points will be used first.

How much does it cost to be a member of hotpoints?


Your annual credit card fee relates to the maintenance of your Westpac hotpoints credit card, including the hotpoints programme. There is no additional membership cost.

Do additional/joint cards accrue hotpoints separately, or do they do so to a “common” (e.g. main cardholder’s) account?


Each Westpac hotpoints credit card account, once opened, will be automatically enrolled in the hotpoints programme, and hotpoints will be earned every time a credit card (whether a main, joint or additional card) or other payment instrument linked to an account is used for eligible purchases or payments.


Main and joint cardholders, as applicable, can each redeem hotpoints earned; however, additional cardholders are unable to redeem hotpoints earned.


I have more than one hotpoints credit card account, how do I transfer points between them?


You’ll need to call us on 0800 861 862, weekdays from 8am – 6pm, and we can transfer your points to one of your other Westpac hotpoints credit accounts.

Can I gift my hotpoints to someone else with another hotpoints credit card account?


No. You are not able to gift your hotpoints to another customer with another Westpac hotpoints credit card account.

How do I log into the hotpoints website?


Simply log into Westpac One and select hotpoints below your list of accounts. Once on the hotpoints page, you can click ‘Visit the hotpoints website for more ways to redeem hotpoints’ below the relevant Westpac hotpoints credit card. If you have more than one Westpac hotpoints credit card, each card will be displayed individually.


After clicking the link, you will be securely logged into hotpoints online to redeem and view your account information. If you want to use a different Westpac hotpoints credit card account, you'll need to log in using the link under your preferred card.

Is there a minimum amount of hotpoints I can redeem?


You’ll need hotpoints to the values listed below for each redemption method:


• hotpoints Pay - $3.

• Gift cards or eCards -$20

• Westpac KiwiSaver Scheme Account - $20.

• Westpac Rescue Helicopter Charity - $5

Can an additional cardholder redeem hotpoints?


No, additional cardholders are unable to redeem hotpoints.

How do I enter my KiwiSaver details?


When you make a redemption for a Westpac KiwiSaver Scheme Account contribution, you will enter your KiwiSaver account details during the checkout process. The first time you redeem, you’ll need to add these details. When you redeem again, you can choose to use existing details, or add a new account. You can also update the details against an existing Westpac KiwiSaver Scheme Account number.

Can I make a KiwiSaver Contribution to multiple KiwiSaver accounts?


Yes. You can make multiple redemptions, and then select the Westpac KiwiSaver Scheme Account for each one, during the checkout process. You can add new KiwiSaver account details for any redemption by selecting the 'Add' option.

My KiwiSaver redemption didn’t go through, what should I do?


If we can’t process your Westpac KiwiSaver Scheme Account contribution, you may have entered incorrect details relating to the account. You’ll receive a letter or email to say that it wasn’t processed, and your points weren’t redeemed. You can try again and check the details you entered, and update them if they are wrong. If you need to change the Westpac KiwiSaver Scheme Account number, just call us on 0800 861 862, weekdays 8am-6pm.

When I redeem my hotpoints for gift cards, can I request specific denominations?


Yes, when you order gift cards or eCards you can add specific denominations to your cart. For example, to redeem $60 of Farmers gift cards in $20 denominations, select the $20 Farmers Gift Card and change the quantity to 3 and then add to cart.

Can I have my gift cards redemption delivered by courier?


Gift card redemptions are sent by standard post and will be delivered within standard postal timeframes. If the total gift card value in your redemption transaction is $500 or more, this will be couriered free of charge, and a signature will be required for delivery. The estimated courier delivery time frame is 3 to 7 working days from dispatch.

I've closed my hotpoints credit card, why can't I log in to hotpoints online?


Once we have received your closure request, your Westpac hotpoints credit card will be removed from your Westpac One digital banking profile, together with the link to log in to hotpoints online.


Your hotpoints membership will not however be cancelled until closure of your Westpac hotpoints credit card account (this is when the outstanding balance on your account has been paid) and any hotpoints earned on your account can continue to be redeemed within 90 days of closure. Any hotpoints remaining after this date will expire.


Therefore, following cancellation up until 90 days following closure, you will be able to redeem hotpoints over the phone by calling 0800 861 862, weekdays from 8am - 6pm. However, during this period, you won’t be able to:


• redeem hotpoints online,


• redeem hotpoints for hotpoints Pay

What happens to my hotpoints if I change from one hotpoints credit card to another hotpoints credit card?


Any hotpoints earned will be transferred to your new Westpac hotpoints credit card account. However, please note that the original expiry period will still apply. Refer to ‘Do hotpoints have an expiry period or time limit?’

What happens to my hotpoints in the event of my death/the death of a joint cardholder?


If you’re a sole cardholder, we’ll reach out to the appropriate estate representative as part of our deceased estates process and at their discretion they will either:


(i) transfer the hotpoints earned on your account to another Westpac hotpoints credit card account; and/or


(ii) redeem the hotpoints earned on your account.


Please note: we’ll refund any hotpoints earned on your account that expire between the time of your death and the applicable transfer/redemption.


If you are a joint cardholder and the other joint cardholder dies, we will reach out to you as part of our deceased estates process to discuss your Westpac hotpoints credit card account as well as the hotpoints earned on the account.







How does hotpoints Pay work?

hotpoints Pay lets you redeem your earned points on future or past purchases, either by toggling it on in Westpac One so your next purchase is paid for with points instead of credit, or by applying your points to purchases you’ve made in the last 90 days.

What can I use hotpoints Pay for?

hotpoints Pay gives you the freedom to use your hotpoints in the way that’s best for you. You can use your hotpoints to pay for your morning coffee, groceries, bills, spontaneous nights out, new furniture, birthday presents, or even your next holiday!


You can use hotpoints Pay for eligible transactions, wherever Mastercard is accepted, whether you’re in store, overseas, or shopping online. See the hotpoints terms and conditions for further details.

Why have you charged my card rather than redeem my points after I turned on hotpoints Pay?

To use hotpoints Pay, your credit card makes a purchase first. If you have turned on hotpoints Pay for your next purchase, it will automatically redeem your hotpoints when your next eligible transaction is made. Then you'll see a credit for that dollar amount come back onto your credit card account within two business days. We recommend you turn on hotpoints Pay just before the purchase you want to use it for, so you know how your points will be used. You'll also earn hotpoints on the purchase amount.

Do I earn hotpoints on the purchases I make when using hotpoints Pay?

Yes, because you are using your hotpoints Mastercard, you'll earn hotpoints on the purchase at the same time as you redeem with hotpoints Pay.

How do I turn on hotpoints Pay to make a purchase?

To turn on hotpoints Pay for your next purchase, follow the steps below:

  1. Log into Westpac One digital banking.
  2. Select ‘hotpoints’ under your accounts.
  3. Turn on hotpoints Pay for your next purchase.
  4. Your points will be used next time you make a purchase with your hotpoints Mastercard.
Step1
Step2
Step3
Step4

Your account will be credited with the transaction amount within two business days.


If we have your mobile number, you’ll receive a text message confirming you’ve successfully used hotpoints Pay. Make sure your mobile number is up-to-date to receive these notifications.


After your transaction has gone through, hotpoints Pay will automatically turn off. To use hotpoints for another purchase, simply start over and turn on hotpoints Pay again.


You can also call us on 0800 861 862, weekdays between 8am and 6pm, and we can turn on hotpoints Pay for you.


How do I use hotpoints Pay on past purchases?

  1. Log into Westpac One digital banking.
  2. Select ‘hotpoints’ under your accounts.
  3. Select ‘Visit the hotpoints website for more ways to redeem hotpoints’.
  4. When you land on the hotpoints website, click on the hotpoints Pay tile.
  5. This will direct you to the hotpoints Pay page where you can click ‘Use hotpoints Pay for past purchases’.
  6. Select your card and date range and then search your transactions for the purchase you would like to redeem your points on.
Step 1
Step 2
Step 3
Step 4
Step 5
Step 6

If we have your email address, we’ll send you a confirmation email. To use your hotpoints for another past purchase, simply go back to your transaction list and choose another transaction.


Is there a minimum purchase or points amount I need to use hotpoints Pay?

Yes, you’ll need at least $3 worth of Hotpoints to redeem.

What if I don’t have enough points to pay for my whole purchase?

If you turn on hotpoints Pay for your next purchase, but you don't have enough points to pay the full amount, your whole hotpoints balance will be used, and you'll receive the dollar credit for that partial amount of your purchase. If you use hotpoints Pay to redeem for a purchase you've already made within the last 90 days, you'll need enough hotpoints to cover the full purchase amount.

How do I see my redemption history?

You can see your hotpoints Pay redemption history on the hotpoints website in the 'My Account' section. hotpoints Pay offers real-time purchase information, so you'll be able to see information on purchases that you've made but that may have not yet been cleared by Westpac.

What should I do if I do not receive a text message notification after my hotpoints Pay purchase?

If you did not receive a notification that you believe you should have received, we may not have your mobile phone number. You can load this into the 'Personal Details' section of your Profile in Westpac One digital banking. You can also check the redemption history page in the hotpoints website and check the transactions on your credit card in Westpac One.

If I have more than one card in my hotpoints account, can I choose which one I want to use for hotpoints Pay?

Yes. When you have logged in to Westpac One and selected ‘hotpoints’, you will be able to see each of your cards with the option ‘Turn on hotpoints Pay to use hotpoints for your next purchase’ below them. When you make your next purchase on the card you select, this will use hotpoints Pay.

Does the hotpoints Pay amount count towards my monthly payment?

Use of hotpoints Pay does not count towards your account’s minimum payment requirements. See the Conditions of Use for more information.

When will the dollar credit come back into my credit card account after I've done a hotpoints Pay redemption?

You'll see the dollar credit on your account within two business days.

How can I tell which item on my statement is the hotpoints Pay redemption?

Your hotpoints Pay redemptions will be called 'hotpoints Pay' on the list of purchases on your statement, and you'll see the corresponding dollar credit amount for your redemption. You can also see your redemptions and transactions in your account history on the hotpoints website.

If I've got two hotpoints accounts, how do I combine my balances so I can use all my points for one hotpoints Pay redemption?

You'll need to transfer all of your points into one account first, by calling us on 0800 861 862, weekdays between 8am and 6pm. Once you've done that, log into Westpac One digital banking, select 'hotpoints', and turn on hotpoints Pay for the card you have transferred your points to. Your hotpoints will be used for the next purchase you make with that card.


Terms and exclusions apply. Credit Card Conditions of Use for the applicable card apply. Find out more at westpac.co.nz/hotpointspay

I have more than one hotpoints account, can I choose which one I want to use for hotpoints Pay?

Yes. When you log into Westpac One and select ‘hotpoints’ you’ll be able to see your various hotpoints accounts and will have the option to turn on hotpoints clearly visible below each card.

Can I use Apple Pay or Google Pay when I use hotpoints Pay?

Yes. If your Westpac hotpoints credit card has been loaded into Apple Pay or Google Pay, you’ll be able to use these methods for purchases after turning on hotpoints Pay in Westpac One digital banking. You can also use hotpoints Pay on purchases you've already made using Apple Pay or Google Pay, within the last 90 days, as long as you have enough hotpoints to pay for those purchases in full.

How do I use my Westpac hotpoints Mastercard loaded into Apple Pay or Google Pay for my next purchase for hotpoints Pay?

If you want to turn on hotpoints Pay for your next purchase using Apple Pay or Google Pay, simply select your normal physical card from the drop-down list of cards. This will pick up your next purchase, including one you make with Apple Pay or Google Pay.

I accidentally used hotpoints Pay for the wrong purchase, what can I do?

If you turned on hotpoints Pay and the wrong purchase was used for hotpoints Pay, we are not able to reverse the redemption. However, the dollar credit for your purchase will come into your account, so you will still receive the benefit from your hotpoints. It’s a good idea to go back and turn off hotpoints Pay if you don’t go through with your purchase after you have turned it on. You can easily do this in Westpac One.

Why did my hotpoints Pay redemption decline?

Your hotpoints Pay redemption may have been declined because:


• hotpoints Pay was not turned on for your next transaction;

• your transaction amount is under $3;

• the transaction type is not eligible for hotpoints Pay;

• your transaction was declined;

• you have insufficient limit on your credit card for the transaction; or

• there may be a block on your credit card or on your account.


However you can still use hotpoints Pay to redeem on eligible transactions up to 90 days later provided you have enough hotpoints to cover the full amount, by logging in to the hotpoints website to view the list of eligible transactions in the 'hotpoints Pay' section. If you have any questions, call us on 0800 861 862, weekdays from 8am to 6pm.

If I refund my hotpoints Pay purchase, what happens?

If you refund an item you have paid for with your hotpoints credit card, the hotpoints you earned on that purchase will be reversed. If you also used hotpoints Pay for that purchase, the points you used will not be added back to your account, but the dollar credit remains on your account.

What if a merchant places a hold on my card, for example when I book a hotel or swipe at a petrol pump?

If you’ve turned on hotpoints Pay and the next time you use your card is for an authorisation such as hotel bookings or petrol, hotpoints Pay will use your hotpoints against the authorisation amount, not the final purchase amount. We recommend you turn on hotpoints Pay just before you plan to use your card, so you know which purchase it's used on. For example, if the petrol station places a $200 hold on your card but the cost of your petrol is $80, hotpoints Pay will be used for the $200 amount. You'll see a $200 credit back on your account, rather than an $80 credit.

My card is blocked but I have a lot of hotpoints, can I use hotpoints Pay?

Your card must be able to make a successful purchase before hotpoints Pay will work. If you have blocked your card after making a hotpoints Pay purchase, the credit will still be applied to your credit card account.

My card is nearly at its limit, but I have a lot of hotpoints, can I use hotpoints Pay?

If your purchase will take your card over its limit, your purchase will be declined and hotpoints Pay won't work. You can still redeem for other reward options, such as gift cards or charity donations, which don't require the use of your credit card.

I've made a large purchase on my credit card and used hotpoints Pay against this, but now I'm nearly at my maximum credit limit. How quickly will my available limit reflect the dollar credit, so I can continue to use my credit card?

Your overall credit card limit should not be impacted by your hotpoints Pay purchase. Although the dollar credit may take a few days to actually appear on your account, the redemption should remove the corresponding purchase from your available limit almost immediately, so you can continue to use your credit card for other purchases. You'll still receive a confirmation text message that the redemption was successful, before your limit is adjusted.

What if I make a purchase in a foreign currency?

If you want to use hotpoints Pay for a purchase you've made in a foreign currency, it will calculate the points needed based on Westpac's prevailing exchange rate in NZ dollars. Please note that there are some countries where Mastercard is not accepted.


Please note, the currency conversion fee is charged separately, so hotpoints Pay will only be used for your purchase amount and you’ll only be credited that amount.





Things you should know

hotpoints® terms and conditions apply.

1Certain purchases and transactions do not earn hotpoints (see the applicable Credit Card Conditions of Use for full details), including: fees, charges or interest, balance transfers, tax payments (including local council rates and ACC Levies), gambling chips or gambling transactions (including online gambling), cash withdrawals from your account, money orders, travellers cheques and foreign currencies in cash, business-related purchases made with a hotpoints Mastercard® other than a Westpac BusinessPLUS Mastercard® and transactions on any nominated account(s) linked to your hotpoints Mastercard.

hotpoints will be earned at the rates specified and published by us from time to time on our website at westpac.co.nz/hotpoints. Tiered earn rates will reset at the start of each calendar month. hotpoints earn rates and tiers, as applicable, are subject to change. There is a minimum number of hotpoints you must earn before you are eligible to redeem your hotpoints for any reward or for hotpoints Pay®. hotpoints terms and conditions apply. Reference to non-Westpac websites are provided for your convenience only. Westpac accepts no responsibility or the availability or content of such websites.

hotpoints® and hotpoints Pay® are registered trademarks of Westpac Banking Corporation.

Mastercard® is a registered trademark and the circles design is a trademark of Mastercard International Incorporated.

').insertAfter("header#header_main"); // Build search modal $('
').insertAfter("header#header_main"); // Build the Products drop down (desktop). (Insert it in front of KiwiSaver) if(show_store === true){ $( "#nav_holder > .row > #main > ul:last-child > li > a[aria-label=\"Gift cards\"], #nav_holder > .row > #main2 > ul:last-child > li > a[aria-label=\"Gift cards\"]" ).parent().before( '
  • hotpoints store menu' ); } // Build the About drop down. (Insert it in after of Gift Cards) $( "#nav_holder > .row > #main > ul:last-child > li > a[aria-label=KiwiSaver], #nav_holder > .row > #main2 > ul:last-child > li > a[aria-label=KiwiSaver]" ).parent().after( '
  • About Menu' ); // Build the About drop down. (Insert it in after of Gift Cards) $( "#nav_holder > .row > #main > ul:last-child > li > a[aria-label=KiwiSaver], #nav_holder > .row > #main2 > ul:last-child > li > a[aria-label=KiwiSaver]" ).parent().after( '
  • hotpoints calculator
  • ' ); // Build the FAQs link. (Insert it after Gift Card) $( "#nav_holder > .row > #main > ul:last-child > li > a[aria-label=About], #nav_holder > .row > #main2 > ul:last-child > li > a[aria-label=About]" ).parent().after( '
  • FAQs
  • ' ); // Build the Contact link. (Insert it after FAQs) $( "#nav_holder > .row > #main > ul:last-child > li > a[aria-label=FAQs], #nav_holder > .row > #main2 > ul:last-child > li > a[aria-label=FAQs]" ).parent().after( '
  • Contact us
  • ' ); //$( 'footer#footer_main #sitemap > .row > dl.small-60.medium-12.columns:first-child dd:last-child').after( '
    Terms and Conditions
    ' ); // Move last item in footer menu to bottom var fmenu_to_move = $( 'footer#footer_main #sitemap > .row > dl.small-60.medium-12.columns:nth-child(2)'); fmenu_to_move.find('dd a').each(function(){ var link = $.trim($(this).attr('href')); if(link.indexOf("www.westpac.co.nz")>=0){ $(this).addClass('icon-goto-grey'); } }); // Menu has not been rejigged yet so tell it to wait for other code to run first. setTimeout(function(){ $('footer#footer_main .copyright').append( $(''+fmenu_to_move.html()+'') ); // Build footer var about_footer = $( 'footer#footer_main .copyright span.termies dd:nth-child(2)'); $('footer#footer_main #sitemap dl').append( '
    '+about_footer.html()+'
    ' ); about_footer.remove(); },0); fmenu_to_move.remove(); $('#hotpoints_pay section.clear .red_border_height_1px').css('border-top', '0'); hide_add_to_cart_until_login = $('#login_desktop').length > 0 ? false : true; if($('#hero').length > 0){ setTimeout(function(){ console.log('NIVO CAROUSEL EXISTS ON PAGE'); $('#hero').each(function(){ console.log('Children count: ', $(this).find('#showMobile .nivoSlider a').length); if($(this).find('#showMobile .nivoSlider a').length <= 1){ if($(this).find('#showMobile .nivoSlider a').length == 0){ console.log('Children returned 0 so debug is: ', $(this).find('#showMobile .nivoSlider').html()); } $(this).addClass('no-nivo-controlNav'); $(this).find('#showMobile .nivoSlider a').css('cursor', 'default').removeAttr("target").attr('href', 'javascript:;'); }else{ $(this).find('.nivoSlider a').each(function(){ var hlink = $(this).attr('href'); if(hlink == 'javascript:;' || hlink == '#' || hlink.length == 0){ $(this).css('cursor', 'default').removeAttr("target").attr('href', 'javascript:;'); } }); } }); },0); } /* Apply fixes to HTML when not logged in */ if(!isLoggedin()){ /* User is not logged in */ $('#sitemap dd').each(function(){ var text = $.trim($(this).text()); if(text == 'contact us' || text == 'Points Gifting' || text == 'hotpoints store'){ $(this).remove(); } }); // console.log('redeem_link & pay_link: ', $('#hotpoints_pay a#pay_link, #hotpoints_pay a#redeem_link ').attr('href'), sso_login_url); // $('#hotpoints_pay a#pay_link, #hotpoints_pay a#redeem_link ').removeClass('csrfadd').removeClass('add_theme_root').attr( "href", sso_login_url ).html('Log in to hotpoints via Westpac One to redeem hotpoints'); // $('#hotpoints_pay a#pay_link').html('Log in to hotpoints via Westpac One to enable hotpoints Pay'); $('.top-box-container .top-box-item:first-child').attr('href', logged_out_box_A_link); $('.top-box-container .top-box-item:first-child').attr('target', logged_out_box_A_link_target); $('.top-box-item:first-child .top-box-info p.top-box-copy').html(logged_out_box_A_Body_Copy); $('.top-box-item:first-child .top-box-info span.top-box-heading').html(logged_out_box_A_heading); $('.top-box-container .top-box-item:last-child').attr('href', logged_out_box_B_link); $('.top-box-container .top-box-item:last-child').attr('target', logged_out_box_B_link_target); $('.top-box-item:last-child .top-box-info p.top-box-copy').html(logged_out_box_B_Body_Copy); $('.top-box-item:last-child .top-box-info span.top-box-heading').html(logged_out_box_B_heading); $('.charity .charity-copy-container p.charity_button_above_copy').html(logged_out_charityCopyAboveButton); $('.charity .charity-copy-container .charity-button').html(logged_out_charityButtonCopy); $('.charity .charity-copy-container .charity-button').attr('href', logged_out_charityButtonLink); $('.charity .charity-copy-container .charity-button').attr('target', logged_out_charityButtonLinkTarget); setTimeout(function(){ if($('#SPN_SHOP_PUBLIC .sub-category-menu > li').length>0){ console.log('Found category menu'); $('#SPN_SHOP_PUBLIC .sub-category-menu > li').each(function(){ var text = $.trim($(this).text()); /*console.log('Found menu item: ', text); */ if(text == 'What can I get now'){ $(this).remove(); /*console.log('Found "What can I get now" item, get item to the left: ', $(this).parent().find('li:nth-last-child(2)').html());*/ $(this).parent().find('li:nth-last-child(2)').css('border-right', '0px solid black'); } }); }else{ console.log('Not found category menu'); } }, 0); }else{ /* User is logged in */ availablePoints = parseInt($('#logged_panel .available_points .available_point_balance').html().replace(/,/g, ''), 10); // We want to override the link so it can't be clicked multiple times. // $('#hotpoints_pay a#pay_link, #hotpoints_pay a#redeem_link').on( "click", function() { // event.preventDefault(); // var goto_href = $( this ).attr('href'); // if(goto_href != 'javascript:;'){ // console.log('Click Detected on ', $( this ).html()); // $( this ).attr('href','javascript:;').css('display', 'inline-block').css('cursor', 'default').html(''); // window.location = goto_href; // } // }); $('.top-box-item:first-child').attr('href', logged_in_box_A_link); $('.top-box-item:first-child').attr('target', logged_in_box_A_link_target); $('.top-box-item:first-child .top-box-info p.top-box-copy').html(logged_in_box_A_Body_Copy); $('.top-box-item:first-child .top-box-info span.top-box-heading').html(logged_in_box_A_heading); $('.top-box-item:last-child').attr('href', logged_in_box_B_link); $('.top-box-item:last-child').attr('target', logged_in_box_B_link_target); $('.top-box-item:last-child .top-box-info p.top-box-copy').html(logged_in_box_B_Body_Copy); $('.top-box-item:last-child .top-box-info span.top-box-heading').html(logged_in_box_B_heading); $('.charity .charity-copy-container p.charity_button_above_copy').html(logged_in_charityCopyAboveButton); $('.charity .charity-copy-container .charity-button').html(logged_in_charityButtonCopy); $('.charity .charity-copy-container .charity-button').attr('href', logged_in_charityButtonLink); $('.charity .charity-copy-container .charity-button').attr('target', logged_in_charityButtonLinkTarget); if($('#available_point_balance').length > 0){ //$( ' Pts' ).appendTo( "#available_point_balance" ); //alert( $( '.hamburger-data ' ).html() ); //alert( $( '.hamburger-data .logged_panel_bottom .available_points .available_point_balance_label' ).html() ); $( '.hamburger-data .logged_panel_bottom .available_points' ).html('My account'); $( ".hamburger-data .logged_panel_bottom .available_points .available_point_balance_label" ).wrapInner( '' ); } console.log('Change contact us in crumbtrail:', $('#SPN_CONTACT_US.logged-in .general_contact .ada_breadcrumb').html(), $('#SPN_CONTACT_US.logged-in .general_contact').html(), $('#SPN_CONTACT_US.logged-in').html(), $('#SPN_CONTACT_US .general_contact .ada_breadcrumb').html()); if($('#SPN_CONTACT_US .general_contact .ada_breadcrumb').length > 0 && $('#SPN_CONTACT_US .general_contact .ada_breadcrumb').html() == 'Contact Us'){ $('#SPN_CONTACT_US .general_contact .ada_breadcrumb').html('Contact us'); console.log('Changed: ', $('#SPN_CONTACT_US .general_contact .ada_breadcrumb').html()); } var cartItemCount = $('header#header_main .header_nav_row #logged_panel .logged_panel_bottom li.cart_link a #cartItemCount'); if(cartItemCount.html() > 0){ cartItemCount.removeClass('empty'); }else{ cartItemCount.addClass('empty'); } addBackToHubButton(); } // $('a.add_theme_root').each(function(){ // if($(this).attr('href').substr(0,4)!='http'){ // $(this).attr('href', root_url+$(this).attr('href')).removeClass('add_theme_root'); // } // }); /*$('img.add_root').each(function(){ $(this).attr('src', asset_url+$(this).attr('src')).removeClass('add_root'); });*/ console.log('Available balance: ', availablePoints); /*if(!isMTF()){ $('#dtm_free_form1 a').each(function(){ var test_link = $(this).attr('href'); console.log('Link found: ', test_link); if(test_link && (test = test_link.indexOf("mtf.au.loyaltygateway.com")) !==-1){ We have found a link which uses this $(this).attr('href', test_link.substr(test+25)); console.log('The following link needs rewriting: ', test_link, $(this).attr('href')); }else if(test_link && (test = test_link.indexOf("mtf.loyaltygateway.com")) !==-1){ // We have found a link which uses this $(this).attr('href', test_link.substr(test+25)); console.log('The following link needs rewriting: ', test_link, $(this).attr('href')); } }); }*/ }; /*var checkForShopAJAXCall = function(elem, cat_id, event) { console.log('checkForShopAJAXCall CLICKED'); if(isShop() && !isProduct() && $(this).attr('href').toLowerCase().indexOf("/shop")!==-1 && cat_id){ event.preventDefault(); event.stopPropagation(); // This should have stopped everything but didn't if($('#hamburger-icon').hasClass('open')){ $('#hamburger-icon').trigger('click'); } console.log('Is a shop page, make ajax call and cancel click'); makeShopAJAXCall(elem, cat_id); console.log('Waiting'); return false; }else if($(this).attr('href').toLowerCase().indexOf("/shop")!==-1 && cat_id){ e.preventDefault(); console.log('Is a shop page, but also product or cart page so append category to the end of the URL and redirect*'); window.location.href = $(this).attr('href')+"&catToLoad="+encodeURIComponent(cat_id); } };*/ var makeShopAJAXCall = function(elem, cat_id, track_element) { console.log('Calling doAjaxCall10085 with cat_id: ',cat_id, elem.href); doAjaxCall10085('selectShopCatalog',cat_id); /*if(track_element === true){ console.log('Setting link to redirect to to : ', elem.href); element_tracking = elem.href; }*/ }; var processAddThemeRoot = function() { $('a.add_theme_root').each(function(){ if($(this).attr('href').substr(0,4)!='http'){ $(this).removeClass('add_theme_root'); console.log('Link to append theme root too: ', $(this).attr('href'), 'root: ', root_url); var appended_link = $(this).attr('href').substr(0,1) != '/' ? root_url+'/'+$(this).attr('href') : root_url+$(this).attr('href'); $(this).attr('href', appended_link); console.log('New link: ', $(this).attr('href'), 'should match ', appended_link); } }); }; var applyAboveFooter = function() { var pages_on = [ '#SPN_REWARDS_SUMMARY #AccountInformationForm', '#wish_list_main #wishlistUserItemList', '#transactionEraserWrapper', '#SPN_SHOPPINGCART #shoppingCartForm', '#SPN_CHECKOUT .mydetails-data', '#SPN_PAY_WITH_REWARDS #pwrIntro' ]; var pages_css = { '#SPN_REWARDS_SUMMARY #AccountInformationForm' : ' medium-45 eraser_footer', '#transactionEraserWrapper' : ' medium-45 eraser_footer', '#SPN_SHOPPINGCART #shoppingCartForm' : ' shopping_footer', '#SPN_CHECKOUT .mydetails-data' : ' medium-45 shopping_footer', '#SPN_PAY_WITH_REWARDS #pwrIntro' : ' medium-45 shopping_footer' }; var pages_html = { // My account page '#SPN_REWARDS_SUMMARY #AccountInformationForm' : '

    hotpoints® terms and conditions apply.

    Certain purchases and transactions do not earn hotpoints (see the applicable Credit Card Conditions of Use for full details), including: fees, charges or interest, balance transfers, tax payments (including local council rates and ACC Levies), gambling chips or gambling transactions (including online gambling), cash withdrawals from your account, money orders, travellers cheques and foreign currencies in cash, business-related purchases made with a hotpoints Mastercard® other than a Westpac BusinessPLUS Mastercard® and transactions on any nominated account(s) linked to your hotpoints Mastercard (the ‘excluded transactions’). The tiered earn rates will reset at the start of each calendar month.

    Only eligible transactions made with a hotpoints Mastercard can be used for hotpoints Pay. In addition, there is a minimum number of hotpoints that must be earned before you are eligible to redeem your hotpoints for any reward or for hotpoints Pay. See the applicable Credit Card Conditions of Use for full details.

    hotpoints® and hotpoints Pay® are registered trademarks of Westpac Banking Corporation.

    Mastercard® is a registered trademark and the circles design is a trademark of Mastercard International Incorporated.

    ', // My Wishlist '#wish_list_main #wishlistUserItemList' : '

    hotpoints® terms and conditions apply.

    Westpac is not the supplier of the goods and services that can be redeemed with hotpoints and does not guarantee the obligations of the supplier or any goods and services supplied. Any goods or services that are provided by a third party supplier may be withdrawn at any time.

    hotpoints® and hotpoints Pay® are registered trademarks of Westpac Banking Corporation.

    Mastercard® is a registered trademark and the circles design is a trademark of Mastercard International Incorporated.

    ', // Redeem / Transaction Eraser '#transactionEraserWrapper' : '

    hotpoints® terms and conditions apply.

    Only eligible transactions made with a hotpoints Mastercard can be used for hotpoints Pay. In addition, there is a minimum number of hotpoints that must be earned before you are eligible to redeem your hotpoints for any reward or for hotpoints Pay. See the applicable Credit Card Conditions of Use for full details.

    hotpoints® and hotpoints Pay® are registered trademarks of Westpac Banking Corporation.

    Mastercard® is a registered trademark and the circles design is a trademark of Mastercard International Incorporated.

    ', // My Cart (Items ) '#SPN_SHOPPINGCART #shoppingCartForm' : '

    hotpoints® terms and conditions apply.

    Westpac is not the supplier of the goods and services that can be redeemed with hotpoints and does not guarantee the obligations of the supplier or any goods and services supplied. Any goods or services that are provided by a third party supplier may be withdrawn at any time.

    hotpoints® and hotpoints Pay® are registered trademarks of Westpac Banking Corporation.

    Mastercard® is a registered trademark and the circles design is a trademark of Mastercard International Incorporated.

    ', // Checkout '#SPN_CHECKOUT .mydetails-data' : '

    hotpoints® terms and conditions apply.

    Westpac is not the supplier of the goods and services that can be redeemed with hotpoints and does not guarantee the obligations of the supplier or any goods and services supplied. Any goods or services that are provided by a third party supplier may be withdrawn at any time.

    hotpoints® and hotpoints Pay® are registered trademarks of Westpac Banking Corporation.

    Mastercard® is a registered trademark and the circles design is a trademark of Mastercard International Incorporated.

    ', // Enable hoptpoint pays '#SPN_PAY_WITH_REWARDS #pwrIntro' : '

    hotpoints® terms and conditions apply.

    Only eligible transactions made with a hotpoints Mastercard can be used for hotpoints Pay. In addition, there is a minimum number of hotpoints that must be earned before you are eligible to redeem your hotpoints for any reward or for hotpoints Pay. See the applicable Credit Card Conditions of Use for full details.

    hotpoints® and hotpoints Pay® are registered trademarks of Westpac Banking Corporation.

    Mastercard® is a registered trademark and the circles design is a trademark of Mastercard International Incorporated.

    ' }; console.log('pages_on: ', pages_on); console.log('Apply custom footer? Checking '+pages_on.length+' pages:'); for (var i = 0; i < pages_on.length; i++) { if($(pages_on[i]).length>0){ console.log('Yes, page '+i+' has '+pages_on[i], $(pages_on[i]).length); var add_styles = typeof pages_css[pages_on[i]] !== 'undefined' ? pages_css[pages_on[i]] : ''; var add_html = typeof pages_html[pages_on[i]] !== 'undefined' ? pages_html[pages_on[i]] : ''; $('

    Things you should know

    '+add_html+'
    ').insertBefore( '.footie' ); }else{ console.log('No, not on page '+i+' with '+pages_on[i], $(pages_on[i]).length); } } }; var applyPointGiftStyling = function() { console.log('Applying Point Gift Styling'); $('#rec_last_name').val('NA').addClass('disabled').css({ 'background-color': '#B4B7B9', 'color': '#949799'}).prop('readonly', true); marker = $('').insertBefore('#rec_last_name'); $('#rec_last_name').detach().attr('type', 'hidden').insertAfter(marker); marker.remove(); /* I think it can only change from a password field if user triggers event*/ if($('#rec_last_name').attr('type')!='hidden'){ $('#rec_last_name').remove(); $('').insertAfter('#rec_acc_num'); } if($('#rec_last_name').attr('type')=='hidden'){ $("label[for='rec_last_name']").css("visibility", "hidden").css("display", "none"); } if($('#rec_acc_num').attr('type')=='password'){ var item_val = $('#rec_acc_num').val(); var parent_ele = $('#rec_acc_num').parent(); $('#rec_acc_num').remove(); parent_ele.append(''); } }; var applyShoppingCartStyling = function() { console.log('Applying Shopping Cart Styling'); $('form#shoppingCartForm .cart_list div.item_row > .row > .columns:nth-child(1)').addClass('thumbnail'); $('form#shoppingCartForm .cart_list div.item_row > .row > .columns:nth-child(2)').addClass('heading'); $('form#shoppingCartForm .cart_list div.item_row > .row > .columns:nth-child(3)').addClass('details'); $("#SPN_SHOPPINGCART form#shoppingCartForm .cart_list div.item_row > .row .thumbnail img").each(function(){ /*console.log('Found basket image: ', href);*/ var split = $(this).attr('src').split("/"); var filename = split.pop(); filename = filename.substr(1); href = split.join("/"); /*console.log('Changed basket image: ', href+filename);*/ $(this).attr('src', href+'/'+filename); }); $("#SPN_SHOPPINGCART form#shoppingCartForm .cart_list div.item_row > .row .details").each(function(){ var totalPointsHtml = $(this).find('.item-total-points').html(); $(this).find('span.quantity .button span').html('Remove from cart'); var removeButton = $(this).find('span.quantity').html(); /*console.log('Remove button HTML: ', removeButton);*/ $(this).parent('.row').find('.item-points').append(totalPointsHtml); $(this).parent('.row').find('.item-points').append('
    ' + removeButton + '
    '); var getName = $(this).parent('.row').find('span.name').html(); console.log(getName); $(this).parent('.row').find('.thumbnail').append('
    ' + getName + '
    '); }); var cartItemCount = document.getElementById("cart_item_count").value; if(cartItemCount > 1){ $('#SPN_SHOPPINGCART form#shoppingCartForm #ajaxEventDiv').prepend('
    ' + cartItemCount + ' items in your cart
    '); } else { $('#SPN_SHOPPINGCART form#shoppingCartForm #ajaxEventDiv').prepend('
    ' + cartItemCount + ' item in your cart
    '); } $('#SPN_SHOPPINGCART input[aria-label="Quantity"]').each(function(){ var qnty = $(this).val(); var item_value = $(this).parent().parent().parent().find('> span:first-child span.points').html(); /* numberWithoutCommas() */ if(item_value){ $(this).parent().parent().parent().find('> span:first-child').after(''+qnty+''+numberWithCommas((numberWithoutCommas(item_value)*qnty))+''); } }); $('#SPN_SHOPPINGCART .heading .total_points.points_amount, #SPN_SHOPPINGCART .heading .total_points.points_only').each(function(){ console.log('Found .total_points.points_amount: ', $(this).find('.amount').length); if($(this).find('.amount').length == 0 || $(this).find('.amount').html() == '$0.00'){ $(this).css('visibility', 'hidden'); } }); console.log('Points only nodes: ', $('#SPN_SHOPPINGCART .heading .total_points.points_only').length, $('#SPN_SHOPPINGCART .heading').length, $('#SPN_SHOPPINGCART .points_only').length); /*$('#SPN_SHOPPINGCART .heading .total_points.points_only').each(function(){ console.log('Found .total_points.points_only: ', $(this).find('.amount').length); if($(this).find('.amount').length == 0){ $(this).append('$0.00'); } });*/ applyTotalCheckoutFooter('SPN_SHOPPINGCART'); }; var applyCheckoutStyling = function() { console.log('Applying Checkout Styling'); var firstNameText = document.getElementById("first_name_text").value; var lastNameText = document.getElementById("last_name_text").value; var phoneNum = document.getElementById("phone_number_new").value; if(phoneNum == ""){ phoneNum = document.getElementById("phone_number").value; } var emailAddr = document.getElementById("email_address").value; var pointsBalance = document.getElementById("available_point_balance").innerHTML; var categoryNameText = document.getElementById("category_name_text").value; var myDetailsData = '

    My details.

    ' + firstNameText + ' ' + lastNameText + '
    ' + phoneNum + '
    '; $('#SPN_CHECKOUT form#shoppingCartForm .cart_list:first').prepend(myDetailsData); $('#SPN_CHECKOUT form#shoppingCartForm .bodyBolded').html('eCards and receipts for Click & Collect store collection will be sent to the email address provided within 1 business day'); $('#SPN_CHECKOUT #shoppingCartForm #ajaxEventDiv .cart_list .item_row .ship_to label:first-child span:first-child, #SPN_CHECKOUT #shoppingCartForm #ajaxEventDiv .cart_list .item_row .ship_to .item_ship.item_ship_to').html('Delivery address.'); /* This was added by ricky but think its having adverse effects */ $('#SPN_CHECKOUT form#shoppingCartForm #ajaxEventDiv .cart_list div.item_row').prepend('

    Order details.

    '); $("#SPN_CHECKOUT form#shoppingCartForm #ajaxEventDiv .cart_list div.item_row").each(function(){ var productCount = $(this).find('.item-totals .value').html(); $(this).find('.item-details span.name').prepend(productCount + ' x '); if($(this).find('.item-total-points span.points_amount .amount').length) { $(this).find('.item-totals').after('
    Total amount to pay:
    '); $(this).find('.item-total-points span.points_amount .amount').appendTo($(this).find('.items-pay-amount')); } for (i = 1; i <= 10; i++) { /*console.log('Looking for: #div_item_mapping_info_'+i+'.');*/ if($('#div_item_mapping_info_'+i).length>0 && $.trim($('#div_item_mapping_info_'+i).html()).length>0){ console.log('Found non-empty: #div_item_mapping_info_'+i+'.'); if($('#div_item_mapping_info_'+i+' .edit_row').length==0 && $('#div_item_mapping_info_'+i+' #btn_add_map_info').length>0){ /* There is not a edit */ console.log('Found box which will need a line: #div_item_mapping_info_'+i+'.'); $('#div_item_mapping_info_'+i).addClass('add_line'); } } } }); if($('.payment_information.row .error').length > 0){ var error = $('.payment_information.row .error').html().replace('The Card Number or the Expiration Date entered is not valid.','The card number or the expiration date entered is not valid.'); $('.payment_information.row .error').html(error); } applyTotalCheckoutFooter('SPN_CHECKOUT'); if($('select#card_brand').length > 0){ $('select#card_brand option').each(function( index ) { if($(this).attr('value')!= 1){ $(this).remove(); } }); } }; var applySubCategoryStyling = function(calledFrom) { console.log('Applying Sub Category Styling, Currently: ', $('#container_shop_category_title .shop_category_title').text(), '"'+calledFrom+'"'); if( $('section#shop_offers #sidebar').length){ var subCategoryLinks = $('section#shop_offers #sidebar #offers_categories > .sidebar_menu li.active.submenu:last ul').html(); var catName = $('#container_shop_category_title .shop_category_title').text(); var search_term = getSearchTermFromURL(); $('.shop.page_content .page_intro .row nav.sidebar_menu').remove(); removeBackButton(); if (subCategoryLinks != null){ console.log('There are subCategoryLinks. . . ', "'"+search_term+"'", "'"+$('#search_string').val()+"'"); if(catName!='Search Results.'){ // If not a search result console.log('Not a search, so add sub category menu showing: ', subCategoryLinks); $('.shop.page_content .page_intro .row #container_shop_category_title') .after(''); }else{ // If a a search result remove the normal searches ApplySearchAreaChanges(); } }else{ console.log('No sub category links found.'); if(catName=='Search Results.'){ ApplySearchAreaChanges(); } } } }; var getAllRewards = function() { if(typeof show_all !== 'undefined'){ return {'id':show_all, 'link': root_url+'/shop/'+show_all+'?postaction=initActionShopCatalog&csrf_token='+getCSRFToken()}; } return false; }; var ApplySearchAreaChanges = function(catName) { // If a a search result remove the normal searches var all_rewards = getAllRewards(); console.log('Its a search and all rewards link exists, add back button to: ', all_rewards); if(all_rewards){ // Remove the menu item setTimeout(function(){ console.log('found h2 (title, span): ', $('h2.shop_category_title').length, $('h2.shop_category_title span').length); //$('h2.shop_category_title span').remove(); // Sometimes the shop_category_title returns with a br on the end. as it appears after the . it is not returned in the code. removeBackButton(); $('h2.shop_category_title').append('
    Back to all rewards'); //$('.shop.page_content .page_intro .row nav.sidebar_menu').remove(); // this appear to remove the menu after a search },100); } }; var removeBackButton = function(catName) { $('h2.shop_category_title .backcode').remove(); }; var applyTotalCheckoutFooter = function(div_id) { /* Footer with total number */ var footerCartDetails = $('#'+div_id+' form#shoppingCartForm .cart_list footer.item_row'); var totoalPoints = footerCartDetails.find('.total .points').text(); var totoalAmount = footerCartDetails.find('.total .amount').text(); if(totoalAmount === ''){ totoalAmount = '$00.00'; } console.log('Points: ' + totoalPoints + ' : ' + totoalAmount); footerCartDetails.append('
    Total hotpoints to be redeemed:'+ totoalPoints +'
    '+(totoalAmount != '$00.00' ? '
    Total you will pay:'+ totoalAmount +'
    You can choose to pay as much as you like in dollars and save your hotpoints.
    ' : '')+'
    hotpoints remaining:'+ numberWithCommas(availablePoints) +'
    '); }; var applyEllipsizeTextBoxStyling = function() { /* console.log('We have found '+$('.card_list .caption span').length+' products on this page to style'); */ $('.card_list .caption span').each(function(){ ellipsizeTextBox($(this)); }); searchForCSRFToken(); }; /* Apply modal changes here */ var applyModalStyle = function(style_id) { console.log('Running applyModalStyle'); /* Modal for Redeem (/transaction-eraser) page */ $('.modal_default').addClass(style_id); if(style_id == 'cacl_points_summary'){ var currency = $('.modal_default fieldset .value.currency').html(); var hotpoints = $('.modal_default fieldset label[for=pointsToRedeem] .value').html(); $('.modal_default fieldset label').css('display', 'none'); if($('.modal_default.cacl_points_summary .content h6').length>0){ console.log('Found the h6: ', $('.modal_default.cacl_points_summary .content h6').html()); var get_h6_text = $('.modal_default.cacl_points_summary .content h6').html().replace("To proceed with your order please read and accept our", "To proceed please read and accept our"); $('.modal_default.cacl_points_summary .content h6').html(get_h6_text); }else{ console.log('The h6 is missing'); } $( '

    '+currency+' equals '+hotpoints+' hotpoints. You\'ll see the dollar value of the hotpoints redeemed back in your account within 2 business days.

    ' ).appendTo('.modal_default fieldset > .row:first-child'); $('.modal_default fieldset button span').html('Go back'); $('.modal_default fieldset button.primary span').html('Accept'); } if(style_id == 'pt_cashback_summary'){ $('.modal_default header h3').html('Thank you!'); $('.modal_default .content p').addClass('pbody').html('Your hotpoints redemption is complete.'); $('.modal_default fieldset button.primary span').html('Close'); } }; var commentSlider = { 'config' : { 'container' : $('#testimonial_wrapper') }, 'init' : function(config) { console.log('Initialising testimonials'); if(config && typeof(config) == 'object') { $.extend(commentSlider.config, config); } commentSlider.autoslide = true; //wrapper commentSlider.$container = commentSlider.config.container; //all paragraph tags commentSlider.$paragraphs = commentSlider.$container. find('> div'); //all li tags commentSlider.$dots = commentSlider.$container. find('ul.dots-wrap > li'); //first li within ul.dots-wrap commentSlider.$firstDot = commentSlider.$container. find('ul.dots-wrap > li:first-child'); //first p tag within module wrapper commentSlider.$firstParagraph = commentSlider.$container. find('> div:first-child'); //setting first dot with .active class commentSlider.$firstDot.addClass('active'); //setting first paragraph tag with .active class commentSlider.$firstParagraph.addClass('activeText'); $('.testimonial_wrapper').on( "swipeleft", function(){ // show next image on swipe left alert('Swipe left detected'); }).on( "swiperight", function(){ // show prev image on swipe right alert('Swipe right detected'); }); //initializing functions and defining their parameters commentSlider.currentItem(commentSlider.$paragraphs, commentSlider.$dots); commentSlider.setActiveDot(commentSlider.$dots); commentSlider.pauseOnHover(commentSlider.$container); commentSlider.timer(); }, //timer function runs necesary functions every five seconds 'timer' : function() { if(testimonialAutoSlider===true){ setInterval(function(){ commentSlider.moveToNextSlide(commentSlider.$dots); }, 5000); } }, //timer function end //grabs current numerical class of dot clicked 'dotNumber' : function($dot) { var dotClassArray = []; var dotClassList = dotClassArray.push($dot.attr('class')); var splitArray = dotClassArray.toString().split(' '); for(i = 0; i < splitArray.length; i++) { if (splitArray[i] === "dot") { splitArray.splice(i, 1); var dotClickedNumber = splitArray[i]; commentSlider.paragraphNumber(dotClickedNumber, commentSlider.$paragraphs); } } },//end dotNumber 'paragraphNumber' : function(dotClickedNumber, $paragraphs) { $paragraphs.each(function() { var $paragraph = $(this); var paragraphClass = $paragraph.attr('class'); if(paragraphClass === dotClickedNumber) { $paragraph.addClass('activeText'); $paragraph.siblings().removeClass('activeText').addClass('slideLeft'); setTimeout(function () { $paragraph.siblings().removeClass('slideLeft'); }, 400); } }); },//end paragraphNumber //currentItem function gives every paragraph and dot a numerical class //based on their array position 'currentItem' : function($paragraphs, $dots) { $paragraphs.each(function(i) { var $paragraph = $(this); $paragraph.addClass([] + i); }); $dots.each(function(i) { var $dot = $(this); $dot.addClass([] + i); }); },//end currentItem //setActiveDot adds class active to whichever dot is clicked 'setActiveDot' : function($dots) { $dots.each( function() { var $dot = $(this); $dot.on('click', function() { if($dot.hasClass('active')) { return false; } else { $dot.addClass('active'); $dot.siblings().removeClass('active'); } commentSlider.dotNumber($dot); }); }); },//end setActiveDot //moveToNextSlide function works out the 'moveToNextSlide' : function($dots) { if(commentSlider.autoslide === true){ var click_next = false; $dots.each( function() { // Get the active dot. var $dot = $(this); if(click_next == true){ //console.log('Next slide is '+$dot.attr('class')); $dot.trigger('click'); click_next = false; }else if($dot.hasClass('active')) { //console.log('Active slide is '+$dot.attr('class')); click_next = true; } }); if(click_next === true){ //console.log('Must have been last slide, move to first'); var $dot = commentSlider.$firstDot; $dot.trigger('click'); } click_next = false; } }, //moveToNextSlide function works out the 'pauseOnHover' : function($slider) { $slider.on('mouseover', function() { commentSlider.autoslide = false; //console.log('Paused auto slide'); }).on('mouseleave', function() { commentSlider.autoslide = true; //console.log('resume auto slide'); }); } }; //initializes the entire thing by calling the init function $(document).ready(commentSlider.init); /* Incase its not avalable (i.e. ir.js is not included on a page) We define our own. */ if (typeof getCSRFToken === "undefined"){ var getCSRFToken = function() { if ($('#csrf_token_keeper').length>0) { return $('#csrf_token_keeper').val(); }else{ /*if($('a.tab-class:first-child').length > 0 && $('a.tab-class:first-child').attr('href').indexOf("?csrf_token=") !== -1){ return $('a.tab-class:first-child').attr('href').substr($('a.tab-class:first-child').attr('href').indexOf("?csrf_token="));*/ return window.location.href.substr(window.location.href.indexOf("?csrf_token=")); } }; } var numberWithCommas = function(x) { return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); }; var numberWithoutCommas = function(x) { return parseInt(x.replace(/\,/g,''),10); }; var ellipsizeTextBox = function(id, not_parent) { var not_parent = typeof not_parent === 'undefined' || not_parent === false ? false : true; var el = typeof id == 'string' ? $(id) : id; var wordArray = el.html().split(' '); if(not_parent){ while(el.prop("scrollHeight") > el.prop("offsetHeight")) { /*console.log(el.parent().prop("scrollHeight")+ ' > '+el.parent().prop("offsetHeight"), wordArray.join(' ') + '...'); */ wordArray.pop(); el.html(wordArray.join(' ') + '...'); } }else{ while(el.parent().prop("scrollHeight") > el.parent().prop("offsetHeight")) { /*console.log(el.parent().prop("scrollHeight")+ ' > '+el.parent().prop("offsetHeight"), wordArray.join(' ') + '...'); */ wordArray.pop(); el.html(wordArray.join(' ') + '...'); } } }; var showOnLoad = function() { console.log('body has loaded show hidden items: '); var show_on_load = []; /* for items not tagged with below style */ $('.show_on_load').removeClass('show_on_load'); for (var i = 0; i < show_on_load.length; i++) { var val = show_on_load[i]; console.log('showing: ', val); $(val).attr('style', function(i,s) { return (s || '') + 'visibility: visible !important;' }); } }; var highlightActiveMenus = function() { if($('.header_top_row ul.top-h-menu > li a').length){ console.log('Found '+$('.header_top_row ul.top-h-menu > li a').length+' menu items.'); }else{ console.log('NO MENU ITEMS FOUND.'); } $('.header_top_row ul.top-h-menu > li a').each(function(){ var links_to = ''; if($(this).attr('onclick') && $(this).attr('onclick').indexOf('naviagateHeaderMenu')!== -1){ links_to = removeNaviagateHeaderMenu($(this).attr('onclick')); console.log($(this).html()+' USES naviagateHeaderMenu', links_to); }else if($(this).attr('href') && $(this).attr('href').length && $(this).attr('href') == '#'){ links_to = getUrlFromHref($(this).attr('href')); console.log($(this).html()+' USES href', links_to); }else{ console.log($(this).html()+' USES unknown.'); } /*if(var links_to == window.location.href){ }*/ console.log(window.location.href, ' -> ', links_to); }); }; /* As the Products menu is on every page we need these functions if not loaded */ if (typeof doAjaxCall10085 === "undefined"){ var doAjaxCall10085 = function(ajaxevt, code) { showLoader(); var sortSelectId = 'selsort'; var orderByParam = ''; if (document.getElementById(sortSelectId)) { var orderBy = sessionStorage.getItem('orderBy') || $('#' + sortSelectId).children("option:selected").val(); orderByParam = '&orderby=' + orderBy; }; readTextWithPost('/rewards/AjaxDataServlet/','ajaxEvent='+ajaxevt+'&ajaxData='+code+orderByParam ,AjaxCallBack10085, -1, -1); }; var AjaxCallBack10085 = function( ajaxdata ) { if (ajaxdata) document.getElementById('shop_offers').innerHTML = ajaxdata; $.post('/rewards/SessionObject', function(data, status) { var pageContent = document.getElementById('page_content'); if (data.selectedCategory.backgroundImage === "" || data.selectedCategory.backgroundImage === null) { pageContent.style = "background-image: none;"; document.getElementByClassName('shop_category_title').style.display = 'none !important;'; } else { pageContent.style = "background-image: url('/rewards/ImageDisplayServlet?file=" + data.selectedCategory.backgroundImage + " '); background-repeat: no-repeat;"; } }); new SURPREENDA.SideBar(); BreadCrumbAjaxCall10085('refreshBreadCrumb'); refreshShopCategoryTitle(); if (typeof refreshStyles === 'function') refreshStyles(); var sortSelectId = 'selsort'; // Select the proper value in the sort order select. // 'orderBy' is saved in sessionStorage in the doSort function. var orderBy = sessionStorage.getItem('orderBy') || 'orderByPointsAsc'; document.getElementById(sortSelectId).value = orderBy; // Update the jQuery chosen component for the sort order // to select the same value that is selected // in the select element that it hides. $('#' + sortSelectId).trigger('chosen:updated'); if (setFocusOnProducts) { // on load, don't set the focus to products focusProducts(); } else { setFocusOnProducts = true; } sessionActivityHappened(); hideLoader(); }; } if (typeof getAjaxData === "undefined"){ console.log('Defining own version of getAjaxData'); var getAjaxData = function(ajaxevent, rewardMatrixItemId) { console.log('Running own version of getAjaxData'); /* added as mobile wishlist errors */ if(typeof rewardMatrixItemId === 'undefined'){ console.log('Usual version being used', typeof getAjaxData); ajaxdata = '&item_id='+document.getElementById("item_id").value ; if (ajaxevent == 'getNextItem' || ajaxevent == 'getPrevItem') { var itemIndex = document.getElementById("item_index").value; ajaxdata=ajaxdata+'&item_index='+ itemIndex; } else if (ajaxevent == 'AddPPItemAction' || ajaxevent == 'AddItemAction') { var qty = document.getElementById("qty").value; ajaxdata = ajaxdata + '&qty='+ qty; /* The below 3 items were commented out. */ if(typeof $('#txtPointsDonate').val() == 'undefined'){ var pointAmount = 1; var payAmount = 0; ajaxdata = ajaxdata + '&point_amount='+ pointAmount + '&pay_amount='+ payAmount; } } else if (ajaxevent == 'catAddTravelItemAction') { ajaxdata = ajaxdata + '&qty=1'; } else if (ajaxevent == 'AddRecurItem'){ var itemFreq = document.getElementById("itemFreq").value; ajaxdata = ajaxdata + '&itemFreq='+ itemFreq; } console.log('Running custom general getAjaxData function, appending: ', ajaxdata); return additionalRewardOptionParameters(ajaxdata); }else{ console.log('Passed in rewardMatrixItemId: '+rewardMatrixItemId+' version being used'); var qty = 1; var ajaxdata = '&item_id='+rewardMatrixItemId ; if (ajaxevent == 'AddPPItemAction' || ajaxevent == 'AddItemAction' || ajaxevent == 'catAddTravelItemAction') { ajaxdata = ajaxdata + '&qty='+ qty; } else if (ajaxevent == 'AddRecurItem'){ var itemFreq = document.getElementById("itemFreq").value; ajaxdata = ajaxdata + '&itemFreq='+ itemFreq; } return ajaxdata; } }; }else{ console.log('getAjaxData does not need defining'); } if (typeof additionalRewardOptionParameters === "undefined"){ var additionalRewardOptionParameters = function(ajaxdata) { console.log('Running custom additionalRewardOptionParameters, using: ', ajaxdata); var itemRewardOption = $('input[name=gc_reward_option]').val(); var selectedRewardOptionInput = $('input[name=selected_reward_option]').val(); if (itemRewardOption !== null && itemRewardOption === 'BOTH') { ajaxdata = ajaxdata + '&ro=' + selectedRewardOptionInput; } else if(itemRewardOption !== null && itemRewardOption === 'PHYSICAL') { ajaxdata = ajaxdata + '&ro=' + selectedRewardOptionInput; } else if(itemRewardOption !== null && itemRewardOption === 'VIRTUAL') { ajaxdata = ajaxdata + '&ro=' + selectedRewardOptionInput; } return ajaxdata; }; }else{ console.log('additionalRewardOptionParameters does not need defining'); } /*console.log('addVPPToCart is being overridden to test mobile issue'); function addVPPToCart(ajaxevt, rewardMatrixItemId, pointAmount, payAmount){ console.log('addVPPToCart triggered.'); var ajaxdata = getAjaxData(ajaxevt, rewardMatrixItemId, pointAmount, payAmount); ajaxdata = ajaxdata + '&point_amount='+ pointAmount + '&pay_amount='+ payAmount; showLoader(); readTextWithPost('/rewards/AjaxDataServlet/', 'ajaxEvent='+ajaxevt+'&ajaxData='+ajaxdata, function(ajaxdata){}); }*/ /* Hotpoint Pay */ var applyTransactionAccordion = function() { if($('#tetable').length>0){ console.log('Found tetable'); setTimeout(function(){ if($('#tetable ul li').length>0){console.log('Found '+$('#tetable ul li').length+' li tags in table');} $('#tetable ul li').each(function(){ if($(this).attr('data-dtr-index') == 3){ if($.trim($(this).find('.dtr-data').text()).length==0){ console.log('Found a hotpoints_to_redeem node: ', $(this).find('#amt').val(), $(this).find('#rate').val(), $(this).find('#amt').val()/$(this).find('#rate').val()); var hotpoints_to_redeem = $(this).find('#amt').val()/$(this).find('#rate').val(); $(this).find('.dtr-data').prepend(hotpoints_to_redeem.toFixed(2)); } } }); }, 100); } }; /*var updateTables = function() { if (($(window).width() < 767) && !switched ){ switched = true; $("table.responsive").each(function(i, element) { splitTable($(element)); }); applyTransactionAccordion(); return true; } else if (switched && ($(window).width() > 767)) { switched = false; $("table.responsive").each(function(i, element) { unsplitTable($(element)); }); } };*/ if (typeof addByEvtDetail === "undefined"){ console.log('Defining own addByEvtDetail function'); var addByEvtDetail = function(ajaxevt, rmids, qtys) { var element = document.getElementById('postaction'); if (typeof(element) != 'undefined' && element != null) { document.getElementById("postaction").value = ajaxevt; } if (ajaxevt == 'AddItemAction'){ var showEMailPopUp = false; if(!showEMailPopUp) { var cartHasItems = typeof document.getElementById("cartHasItems") == 'undefined' || document.getElementById("cartHasItems") == null || document.getElementById("cartHasItems").value == null ? 'false' : document.getElementById("cartHasItems").value; if (typeof document.getElementById("supportRecurRedeem") != 'undefined' && document.getElementById("supportRecurRedeem") != null && document.getElementById("supportRecurRedeem").value == 'true') { var cartHasRecurItem = document.getElementById("cartHasRecurItem").value; var itemRecurRedeem = document.getElementById("itemRecurRedeem"); if (itemRecurRedeem && itemRecurRedeem.checked) { ajaxevt = 'AddRecurItem'; document.getElementById("postaction").value = ajaxevt; if (cartHasItems == 'true') { var modal = new SURPREENDA.Modal({ el : '#tpl_lightbox_has_recur_item' , defaults : { width: 350 } }); $("form#form_recur_item fieldset p").text('Your shopping cart contains item(s) that will be cleared before this recurring item is added.'); document.getElementById("originalAction").value = ajaxevt; } else { doAjaxCall10088( ajaxevt, rmids, qtys ); } } else { if (cartHasRecurItem == 'true') { var modal = new SURPREENDA.Modal({ el : '#tpl_lightbox_has_recur_item' , defaults : { width: 350 } }); $("form#form_recur_item fieldset p").text('Your shopping cart contains a recurring item that will be cleared before this item is added.'); document.getElementById("originalAction").value = ajaxevt; } else { doAjaxCall10088( ajaxevt, rmids, qtys ); } } } else { doAjaxCall10088( ajaxevt, rmids, qtys ); } } } }; }else{ console.log('addByEvtDetail does not need defining'); } if (typeof doAjaxCall10088 === "undefined"){ var doAjaxCall10088 = function( ajaxevt , rmids, qtys) { console.log('Using Own version of doAjaxCall10088 function.', ajaxevt); if (rmids == null) { ajaxdata = getAjaxData(ajaxevt); } else { ajaxdata = getAjaxDataForConsolidated(ajaxevt, rmids, qtys); } showLoader(); readTextWithPost('/rewards/AjaxDataServlet/', 'ajaxEvent='+ajaxevt+'&ajaxData='+ajaxdata, AjaxCallBack10088); }; var AjaxCallBack10088 = function( ajaxdata ) { console.log('Using Own version of AjaxCallBack10088 function.', ajaxdata); var action = ''; if(typeof document.getElementById("postaction") != 'undefined' && document.getElementById("postaction") != null){ var action = document.getElementById("postaction").value; } console.log(ajaxdata); document.getElementById("form_10088").innerHTML = ajaxdata; if (action == 'AddPPItemAction' || action == 'AddItemAction' || action == 'AddRecurItem') { if (document.getElementById("errorMsg") !==null && document.getElementById("errorMsg").value != ''){ document.getElementById("qty").value = document.getElementById("selqty").value; } } else if (action == 'catAddTravelItemAction') { if (document.getElementById("errorMsg") !==null && document.getElementById("errorMsg").value != ''){ doSubmitTravelItem(); } } }; }else{ console.log('doAjaxCall10088 & AjaxCallBack10088 does not need defining'); } var myEle2 = document.getElementById("SPN_CHECKOUT"); console.log('myEle2: ', myEle2); if(myEle2 != null){ console.log('SPN_CHECKOUT exists so Defining AjaxCallBack10106'); var AjaxCallBack10106 = function( ajaxdata ) { console.log('Using Overriden version of AjaxCallBack10106 function.'); $.fancybox.hideActivity(); document.getElementById('ajaxEventDiv').innerHTML = ajaxdata; showPopup(); updateState(); disableSecondaryShippingOnLoad(); if(document.getElementById('initiate-authentication-script') != null){ initAuthResponseExists = true; eval(document.getElementById('initiate-authentication-script').text); } /*console.log('Before'); setTimeout(function () { if(document.getElementById('threedsFrictionLessRedirect') != null){console.log('Friction'); document.getElementById('threedsFrictionLessRedirect').setAttribute("style","height: 100hv"); } if(document.getElementById('challengeFrame') != null){ console.log('IFrame'); document.getElementById('challengeFrame').setAttribute("style","height: 100%;width: 100%"); } }, 2000);*/ /* applyTotalCheckoutFooter('SPN_CHECKOUT'); */ applyCheckoutStyling(); $.fancybox.hideActivity(); if($('#fancybox-loading').css('display')=='block'){ $('#fancybox-loading').hide(); } }; }else{ console.log('AjaxCallBack10106 does not need defining'); } var BreadCrumbAjaxCallBack10085 = function( ajaxdata ) { document.getElementById('breadcrumb').innerHTML = ajaxdata; processCrumbtrail(); }; var processCrumbtrail = function() { if($('#breadcrumb').length) { $( "ul#breadcrumb li" ).each(function( index ) { var bst = $(this).html(); if(bst.indexOf(">")){ bst = bst.replace(/>/g, '/'); $(this).html(bst); } /*console.log('Found crumbtrail element: ', $.trim($( this ).text()), $.trim($( this ).find( "a" ).text()));*/ if($.trim($( this ).find( "a" ).text()) == 'Shop the Catalog'){ $( this ).remove(); } }); } }; var removeNaviagateHeaderMenu = function(link_str) { var split = link_str.split("naviagateHeaderMenu("); var split2 = split[1].indexOf("?") !== -1 ? split[1].split("?") : split[1].split(","); var url_to_return = split2[0]; return url_to_return; }; var getUrlFromHref = function(link_str) { var url_to_return = link_str.substr(0, link_str.indexOf("?")); return url_to_return; }; console.log('defining own refreshShopCategoryTitle function'); var refreshShopCategoryTitle = function() { function done(result) { console.log('refreshShopCategoryTitle Done Called'); var shopCategoryContainer = document.getElementById('container_shop_category_title'); if (shopCategoryContainer) { shopCategoryContainer.innerHTML = result; if($('#container_shop_category_title .shop_category_title').length>0){ $('#container_shop_category_title .shop_category_title').html($.trim($('#container_shop_category_title .shop_category_title').html())+'.'); console.log('refreshShopCategoryTitle changed title to '+$.trim($('#container_shop_category_title .shop_category_title').html())); applySubCategoryStyling('refreshShopCategoryTitle'); } refreshRewardsByPointsBalanceTitle(); } } console.log('refreshShopCategoryTitle Called, Currently: ', document.getElementById('container_shop_category_title').innerHTML); readTextWithPost('/rewards/AjaxDataServlet/','ajaxEvent=refreshShopCategoryTitle', done, -1, -1); }; var applyCSRFToken = function(csrf_link) { bm_csrf_tkn = getCSRFToken(); if(bm_csrf_tkn !== 'undefined' && bm_csrf_tkn.length>0){ return csrf_link.indexOf("?") === -1 ? csrf_link+'?csrf_token='+bm_csrf_tkn : csrf_link+'&csrf_token='+bm_csrf_tkn } return; }; var searchForCSRFToken = function() { if(typeof bm_csrf_tkn !== 'undefined' && bm_csrf_tkn.length>0){ /*console.log('Found csrf links to replace: ', $( "a.csrfadd" ).length);*/ $( "a.csrfadd" ).each(function( index ) { if($( this ).attr('href').indexOf("csrf_token=") === -1){ $( this ).attr('href', applyCSRFToken($( this ).attr('href'))); } if(typeof $( this ).attr('data-add-anchor') != 'undefined' && $( this ).attr('data-add-anchor').length>0){ $( this ).attr('href', $( this ).attr('href')+'#'+$( this ).attr('data-add-anchor')); } }); /* If we want to add to buttons or forms add additional code here */ } }; var stickyMenu = function(triggeredOnResize) { scroll_top = $(document).scrollTop(); var compare_with = isMobile() ? menu_top_mobile : menu_top; var tag = isMobile() ? '.header_nav_row' : '.header_top_row'; var tag_rev = isMobile() ? '.header_top_row' : '.header_nav_row'; //
    //
    - becomes absolute if(loaded==true){ //console.log('menu top is at: ', menu_top, scroll_top, menu_display); if(scroll_top > compare_with){ menu_display = 'fixed'; //console.log('Menu is off the page, switching it to '+menu_display+'.'); $(tag).attr('style', 'position: '+menu_display+'; top: 0px !important'); if(triggeredOnResize === true){ $(tag_rev).attr('style', 'position: relative;'); } }else if (scroll_top <= compare_with){ menu_display = 'relative'; //console.log('Menu is on the page, switching it to '+menu_display+'.'); $(tag).attr('style', 'position: '+menu_display+'; top: '+compare_with+'px !important'); if(triggeredOnResize === true){ $(tag_rev).attr('style', 'position: absolute;'); } } } if(!isMobile() && $('#hamburger-icon').hasClass('open')){ $('#hamburger-icon').trigger('click'); } }; var bmAddToCart = function(container_id, limit) { var container_id = typeof container_id == 'undefined' ? '.charity-form-conatainer' : container_id; var field_type = container_id === '.charity-form-conatainer' ? ' option:selected' : ''; console.log('Container Id: ', container_id); /*bmAddToCart('.index.page_content.freeform_page_temp_content.about_anchor') */ if($('#available_point_balance').length > 0){ /* User is logged in */ console.log('Item selected: ', $(container_id+' #item_id'), $(container_id+' #item_id').val(), $(container_id+' #item_id').val().length); console.log('User has', availablePoints, "'"+($('#txtPointsDonate').length > 0 ? $('#txtPointsDonate').val() : 'Unknown input')+"'"); if(container_id === '.charity-form-conatainer'){ if(!$(container_id+' #item_id') || $(container_id+' #item_id').val().length==0){ /* Return error*/ alert('Please select a charity location.'); return; }else if($(container_id+' #qty').val().length == 0 || $(container_id+' #qty').val() <= 0){ alert('Please enter number of points/dollars.'); return; }else if($(container_id+' #qty').val() < 5){ alert('A minimum of $5 or 900 hotpoints is needed to make a donation.'); return; }else if(availablePoints < $('#txtPointsDonate').val()){ alert('You don\'t have enough hotpoints to cover this amount.'); return; } }else if(container_id === '.index.page_content.freeform_page_temp_content.about_anchor' && availablePoints < numberWithoutCommas($('#pointsValue').val())){ alert('You don\'t have enough hotpoints to cover this amount.'); return; }else{ if(!$(container_id+' #item_id') || $(container_id+' #item_id').val().length==0){ /* Return error */ alert('You must select an item'); return; }else if($(container_id+' #qty').val().length == 0 || $(container_id+' #qty').val() <= 0){ alert('You can not purchase 0 of this item'); return; } } console.log('available_point_balance exists so button should add to basket'); /* So set the onclick to add the item to the users basket */ addByEvtDetail('AddItemAction', null, null); }else{ /* Use is NOT logged in */ console.log('available_point_balance DOESN\'T exists so button should take you to login'); /* If addToCartAfterLogin is not set, Define it */ if (typeof addToCartAfterLogin === "undefined") { function addToCartAfterLogin() { var itemRecurRedeem = document.getElementById("itemRecurRedeem"); var isRecurRedeem = itemRecurRedeem && itemRecurRedeem.checked; var nextAjaxEvent = isRecurRedeem ? 'AddRecurItem' : 'AddItemAction'; openLoginAndThen(nextAjaxEvent, getAjaxData(nextAjaxEvent)); } } addToCartAfterLogin(); } }; var buildSearchResultFunctions = function (){ if (typeof doSearchEnterKey === "undefined") { console.log('defining doSearchEnterKey'); doSearchEnterKey = function(e) { if (!e) e = window.event; var keycode = e.keyCode; if (keycode == 13) { var node = e.srcElement; if (!node) { node = e.target; } // On pressing return trigger the BM search if (node.name == 'search_param') { bmDoSearch('searchByParam', node.value); } } }; }else{ console.log('doSearchEnterKey aleady defined'); } bmDoSearch = function( ajaxevt, code ) { // note ajaxevt is no longer needed if(code.length>0){ var csrf_tkn = getCSRFToken(); var query_str = csrf_tkn.length > 0 || window.location.href.indexOf("?")!==-1 ? '?csrf_token='+encodeURIComponent(csrf_tkn)+'&' : '?'; var url = getSiteRoot(); console.log( 'Non-shop search performed. Redirect.', url+"shop/"+query_str+"search_string="+encodeURIComponent(code)); window.location.href = url+"shop/"+query_str+"search_string="+encodeURIComponent(code); } }; /* Handles the search results*/ /*if (typeof AjaxCallBack10085 === "undefined"){ console.log('AjaxCallBack10085 not defined so defining own'); AjaxCallBack10085 = function( ajaxdata ) { //var id = $('#home_featured_offers').length > 0 ? 'home_featured_offers' : ($('#featured_offers').length > 0 ? 'featured_offers' : 'shop_offers'); //if(ajaxdata.indexOf('id="sidebar"')===-1){ // $('#'+id+' > .row .columns').first().attr('id','sidebar'); //} //document.getElementById(id).innerHTML = ajaxdata; //if($('#home_featured_offers').length>0){ // $('#home_featured_offers').css('display','block'); //} //if($('#shop_offers').length>0){ // $('#shop_offers').css('display','block'); //} if(element_tracking){ console.log('*AJAX completed and link store so redirect to: ', element_tracking); var tmp_element_tracking = element_tracking; element_tracking = false; window.location.href = tmp_element_tracking; } }; }else{ console.log('AjaxCallBack10085 already defined'); }*/ /*if (typeof doAjaxCall10085 === "undefined"){ console.log('doAjaxCall10085 not defined so defining own'); doAjaxCall10085 = function( ajaxevt, code ) { readTextWithPost('/rewards/AjaxDataServlet/','ajaxEvent='+ajaxevt+'&ajaxData='+code ,AjaxCallBack10085, -1, -1); }; }else{ console.log('doAjaxCall10085 already defined'); }*/ /* // IGNORE if (typeof doAjaxCall10085 === "undefined"){ console.log('doAjaxCall10085 not defined so defining own'); var doAjaxCall10085 = function( ajaxevt, code ) { var sortSelectId = 'selsort'; var orderByParam = ''; if (document.getElementById(sortSelectId)) { var orderBy = sessionStorage.getItem('orderBy') || $('#' + sortSelectId).children("option:selected").val(); orderByParam = '&orderby=' + orderBy; }; readTextWithPost('/rewards/AjaxDataServlet/','ajaxEvent='+ajaxevt+'&ajaxData='+code+orderByParam ,AjaxCallBack10085, -1, -1); }; }else{ console.log('doAjaxCall10085 defined'); }*/ }; var getSearchTermFromURL = function(){ var has_search = window.location.href.indexOf("search_string="); if(has_search !== -1){ return getUrlParameter('search_string'); } return false; }; var getCategoryFromURL = function(){ var has_category = window.location.href.indexOf("catToLoad="); if(has_category !== -1){ return getUrlParameter('catToLoad'); } return false; }; var getUrlParameter = function(name) { name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]'); var regex = new RegExp('[\\?&]' + name + '=([^&#]*)'); var results = regex.exec(location.search); return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' ')); }; var autoSubmitSearchFunctions = function (){ var search_term = getSearchTermFromURL(); console.log('Looking for Search term in URL & is show page: ', search_term, isShop()); var cat_id_to_load = getCategoryFromURL(); console.log('Looking for Category in URL & is show page: ', cat_id_to_load, isShop()); if(search_term && isShop()){ // Send it to normal search console.log('Found Search term in URL on Shop page: ', search_term); setTimeout(function(){ //$('.shop.page_content .page_intro .row nav.sidebar_menu').remove(); console.log('The following AJAX calls are in progress: ', $.xhrPool); $('#search_param_header').attr('value', search_term); $('#search_param_menu').attr('value', search_term); $('#search_string').attr('value', search_term); //.trigger("keyup"); // The below should do the same console.log('BM trigged doAjaxCall10085 searchByParam using: ', search_term, 'after calling abort all'); //$.xhrPool.abortAll(); doAjaxCall10085('searchByParam', search_term); }, 0); }else if(cat_id_to_load && isShop()){ console.log('Found category id in URL on Shop page: ', cat_id_to_load); setTimeout(function(){ console.log('The following AJAX calls are in progress: ', $.xhrPool); console.log('BM trigged doAjaxCall10085 selectShopCatalog using: ', cat_id_to_load, 'after calling abort all'); //$.xhrPool.abortAll(); doAjaxCall10085('selectShopCatalog',cat_id_to_load); }, 0); } }; var adjustDonationByPoints = function() { if($('#qty').length>0 && $('#txtPointsDonate').length>0){ var dollars = Math.floor($('#txtPointsDonate').val()/charityDonationPerPoint); $('#txtPointsDonate').val(dollars*charityDonationPerPoint); $('#qty').val(dollars); } }; var adjustDonationByDollar = function() { if($('#qty').length>0 && $('#txtPointsDonate').length>0){ $('#txtPointsDonate').val($('#qty').val()*charityDonationPerPoint); } }; console.log('Creating own AjaxCallBack10101 function'); var AjaxCallBack10101 = function( ajaxdata ) { console.log('Using Own version of AjaxCallBack10101 function.'); document.getElementById('ajaxEventDiv').innerHTML = ajaxdata; var itemCount = $("#cart_item_count").val(); $("nav#logged_panel li.cart_link a span").text(itemCount); $(".logged_panel_bottom ul.logged_panel_bottom_right li.cart_link a span").text(itemCount); $("#cart_item_count_text span").text(itemCount + (itemCount === "1" ? " item" : " items")); console.log('Rewrite element: ', $("#header#header_main .header_nav_row #logged_panel .logged_panel_bottom li.cart_link a").html(), $("#header#header_main .header_nav_row #logged_panel .logged_panel_bottom li.cart_link a").attr('aria-label'), $(".hamburger-data .logged-in-links .logged_panel_bottom li.cart_link a").html(), $(".hamburger-data .logged-in-links .logged_panel_bottom li.cart_link a").attr('aria-label')); console.log('Rewrite to: ', 'Shopping cart icon '+itemCount+' '+(itemCount === "1" ? " item" : " items")+' in cart'); $("#header#header_main .header_nav_row #logged_panel .logged_panel_bottom li.cart_link a, .hamburger-data .logged-in-links .logged_panel_bottom li.cart_link a").attr('aria-label', 'Shopping cart icon '+itemCount+' '+(itemCount === "1" ? " item" : " items")+' in cart'); applyShoppingCartStyling(); if($('#SPN_CHECKOUT #shoppingCartForm').length){ applyCheckoutStyling(); } readTextWithPost('/rewards/AjaxDataServlet/', 'ajaxEvent=initSideBar', AjaxCallBackRefreshSidebarAccountPanel,-1,-1); $('#cartUpdatedMessage').removeAttr('hidden'); $('#cartUpdatedMessage').focus(); }; console.log('Creating own CalculatedPointValueAjaxCallBack function'); var CalculatedPointValueAjaxCallBack = function(ajaxdata){ console.log('Using Own version of CalculatedPointValueAjaxCallBack function.'); var element = $(ajaxdata); document.getElementById('RewardsSummary').innerHTML = ajaxdata; if($('p.error', element).length == 0) { var modal = new SURPREENDA.Modal({ el : '#tpl_lightbox_pt_cashback' , defaults : { width: 350 } }); } initDataTables(); $('#fancybox-outer').removeClass('fancybox-popup'); applyModalStyle('cacl_points_summary'); }; console.log('Creating own PTCashbackAjaxCallBack function'); var PTCashbackAjaxCallBack = function(ajaxdata){ console.log('Using Own version of PTCashbackAjaxCallBack function.'); var element = $(ajaxdata); document.getElementById('RewardsSummary').innerHTML = ajaxdata; if($('p.error', element).length == 0) { var modal = new SURPREENDA.Modal({ el : '#tpl_lightbox_pt_cashback_message' , defaults : { width: 350 } }); readTextWithPost('/rewards/AjaxDataServlet/', 'ajaxEvent=initSideBar', AjaxCallBackRefreshSidebarAccountPanel,-1,-1); } initDataTables(); applyModalStyle('pt_cashback_summary'); }; console.log('Using Own version of AccountRTRAjaxCallBack function.'); var AccountRTRAjaxCallBack = function AccountRTRAjaxCallBack(ajaxData){ document.getElementById('tab1Content').innerHTML = ajaxData; var msg = document.getElementById('errorMessage').value; document.getElementById('page_status_rtr').innerHTML = msg; $('#fixedRedemptionAmt').autoNumeric('init'); $('#cardholderThreshold').autoNumeric('init'); applyPayWithRewards(); applyModalStyle('pt_cashback_summary'); }; var myEle2 = document.getElementById("contact"); if(myEle2 != null){ var ajaxCallUIMgmtCallBack = function ajaxCallUIMgmtCallBack( ajaxdata ) { document.getElementById('contact').innerHTML = ajaxdata; initialize(); formatTopOfBothContactPages(); formatTopOfContactPage(); var message_box = $(".success_message").length > 0 ? '.success_message' : '.error'; $([document.documentElement, document.body]).animate({ scrollTop: $(message_box).offset().top - 60 }, 2000); force_reinit = true; initializeAccordion(jQuery, window, document); //Accordion(element, options) } } var formatContactPage = function formatContactPage(){ formatTopOfContactPage(); $( '#case_issue_type option:disabled').html('Select the topic you\'d like to enquire about'); $( '

    Call us

    For hotpoints enquiries, please contact our hotpoints team:
    • 0800 861 862
    • Overseas +64 9 913 6226 (international toll charges apply)
    Weekdays, 8am to 6pm.
    For general card enquiries or to open Westpac hotpoints credit card account:
    • 0800 888 111
    • Overseas +64 9 914 8026 (international toll charges apply, feel free to call collect)
    Weekdays 7am to 8pm and 8am to 5pm on weekends & public holidays.

    Things you should know

    hotpoints® terms and conditions apply.

    Certain purchases and transactions do not earn hotpoints (see the applicable Credit Card Conditions of Use for full details), including: fees, charges or interest, balance transfers, tax payments (including local council rates and ACC Levies), gambling chips or gambling transactions (including online gambling), cash withdrawals from your account, money orders, travellers cheques and foreign currencies in cash, business-related purchases made with a hotpoints Mastercard® other than a Westpac BusinessPLUS Mastercard® and transactions on any nominated account(s) linked to your hotpoints Mastercard (the ‘excluded transactions’).

    Only eligible transactions made with a hotpoints Mastercard can be used for hotpoints Pay. In addition, there is a minimum number of hotpoints that must be earned before you are eligible to redeem your hotpoints for any reward or for hotpoints Pay. See the applicable Credit Card Conditions of Use for full details.

    hotpoints® and hotpoints Pay® are registered trademarks of Westpac Banking Corporation.

    Mastercard® is a registered trademark and the circles design is a trademark of Mastercard International Incorporated.

    ' ).insertAfter( "#contact" ); }; var formatTopOfBothContactPages = function formatTopOfBothContactPages(){ $( "#contact header").wrap( "
    " ); }; var formatTopOfContactPage = function formatTopOfContactPage(){ $( "#contact > header > hgroup > h3" ).html('How can we help today?'); $( '

    Have a question about hotpoints? You may be able to find your answer in our FAQs, otherwise send us a message or get in touch with the details below.

    ' ).appendTo( "section#contact header" ); console.log('CONTACT HEADER: ', $("section#contact header").html()); /*Replace text*/ $("label[for=name] span").html(function () { return $(this).html().replace("Name ", "Name ").replace("Contact us ", "Full name "); }); $("label[for=email_addr] span").html(function () { return $(this).html().replace("E-Mail ", "Email "); }); $("label[for=email_us_comment] span").html(function () { return $(this).html().replace("What's", "What is"); }); var other_id = ''; $("#case_issue_type option").each(function() { if ($.trim($(this).html())=='Other') { console.log('Option: ', $(this).attr('value')); other_id = $(this).attr('value'); $(this).remove(); }; }); console.log('other_id: ', other_id); if(other_id.length > 0){ $("#case_issue_type").append( "" ); } var tmp = $('#msg_primary_card_holder span').html(); console.log(tmp, 'trimed: ', $.trim(tmp.replace(" ", " ")) ); $('#msg_primary_card_holder').html( $.trim(tmp.replace(" ", " ")) ); // Icheck primary_holder $( '' ).insertAfter( "#primary_holder" ); }; /*----------Pay with rewards page------------*/ var applyPayWithRewards = function() { console.log('Running applyPayWithRewards'); /*$('#pwrIntro dd.rtr_settings fieldset .row:nth-of-type(2) .columns:nth-of-type(2) span:first-child').html('You currently have hotpoints to the value of '); */ $('#pwrIntro dd.rtr_settings fieldset .row:nth-of-type(1)').prepend('

    Use your hotpoints to cover your next purchase.
    Minimum spend $3.00

    '); /* Can't be CSS as it has a BR in between (can test 2 css statements but not until they give us access) */ if($('.pwrl.page_content #pwrIntro dd.rtr_settings fieldset .row:nth-last-of-type(1) .columns:nth-of-type(1) .twoLine button:not([disabled])').length>0){ console.log('Enable button is enabled'); $('.pwrl.page_content #pwrIntro dd.rtr_settings fieldset .row:nth-last-of-type(1) .columns:nth-of-type(1) .twoLine button:not([disabled])').parent().parent().parent().addClass('enable_not_disabled'); } /* console.log($('.pwrl.page_content #pwrIntro dd.rtr_settings fieldset .row:nth-last-of-type(1) .columns:nth-of-type(2) .twoLine button:not([disabled])').parent().parent().parent().html()); */ if($('.pwrl.page_content #pwrIntro dd.rtr_settings fieldset .row:nth-last-of-type(1) .columns:nth-of-type(2) .twoLine button:not([disabled])').length>0){ console.log('Disabled button is enabled'); $('.pwrl.page_content #pwrIntro dd.rtr_settings fieldset .row:nth-last-of-type(1) .columns:nth-of-type(2) .twoLine button:not([disabled])').parent().parent().parent().addClass('disable_not_disabled'); } console.log('Checking for select: ', $('.pwrl.page_content #pwrIntro dd.rtr_settings fieldset .row:nth-of-type(1) > div').length); if($('.pwrl.page_content #pwrIntro dd.rtr_settings fieldset .row:nth-of-type(1) > div').length > 1){ console.log('The select is missing'); $('.pwrp').parent().parent().addClass('noselect'); } /*This card is now enabled for hotpoints Pay. */ $('.pwrl.page_content #pwrIntro dd.rtr_settings fieldset .row:nth-last-of-type(1) .columns:nth-of-type(2) .twoLine button').each(function( index ) { console.log( index + ": " + $( this ).text() ); }); }; var myEle = document.getElementById("rec_last_name"); console.log('myEle: ', myEle); if(myEle != null){ console.log('rec_last_name exists so Defining ajaxCallBack'); var ajaxCallBack = function ( ajaxdata ) { $('#ajaxEventDiv').html(ajaxdata); $(document).foundation(); if (typeof refreshStyles === 'function') refreshStyles(); applyPointGiftStyling(); }; }else{ console.log('AjaxCallBack does not need defining'); } var goto = function(gotoURL, in_new_window){ if(typeof in_new_window == 'undefined' || in_new_window != '_blank'){ window.location.href=gotoURL; }else{ if(!window.open(gotoURL, '_blank')){ console.log('Open in new window blocked, redirecting current window'); window.location.href=gotoURL; } } }; var accepted = function(){ accepted = true; }; var matchCase = function(text, pattern) { var result = ''; for(var i = 0; i < text.length; i++) { var c = text.charAt(i); var p = pattern.charCodeAt(i); if(p >= 65 && p < 65 + 26) { result += c.toUpperCase(); } else { result += c.toLowerCase(); } } return result; }; var ScrollPageTo = function(item_to_scroll_to) { $([document.documentElement, document.body]).animate({ scrollTop: $("#"+item_to_scroll_to).offset().top }, 2000); }; var setCookie = function(name, value, days) { var expires = ""; if (days) { var date = new Date(); date.setTime(date.getTime() + (days*24*60*60*1000)); expires = "; expires=" + date.toUTCString(); } document.cookie = name + "=" + (value || "") + expires + "; path=/"; }; var getCookie = function(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null; }; var eraseCookie = function(name) { document.cookie = name +'=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;'; }; var initializeAccordion = function( $, window, document, undefined) { console.log('Accordion is being initialised.'); var pluginName = 'accordion', defaults = { transitionSpeed: 300, transitionEasing: 'ease', controlElement: '[data-control]', contentElement: '[data-content]', groupElement: '[data-accordion-group]', singleOpen: true }; function Accordion(element, options) { console.log('Accordion method called.'); this.element = element; this.options = $.extend({}, defaults, options); this._defaults = defaults; this._name = pluginName; this.init(); } Accordion.prototype.init = function () { console.log('Accordion init is running.'); var self = this, opts = self.options; var $accordion = $(self.element), $controls = $accordion.find('> ' + opts.controlElement), $content = $accordion.find('> ' + opts.contentElement); console.log('Accordion data: ', $accordion, $controls, $content); var accordionParentsQty = $accordion.parents('[data-accordion]').length, accordionHasParent = accordionParentsQty > 0; var closedCSS = { 'max-height': 0, 'overflow': 'hidden' }; var CSStransitions = supportsTransitions(); function debounce(func, threshold, execAsap) { var timeout; return function debounced() { var obj = this, args = arguments; function delayed() { if (!execAsap) func.apply(obj, args); timeout = null; }; if (timeout) clearTimeout(timeout); else if (execAsap) func.apply(obj, args); timeout = setTimeout(delayed, threshold || 100); }; } function supportsTransitions() { var b = document.body || document.documentElement, s = b.style, p = 'transition'; if (typeof s[p] == 'string') { return true; } var v = ['Moz', 'webkit', 'Webkit', 'Khtml', 'O', 'ms']; p = 'Transition'; for (var i=0; i [data-content]'), $childs = $content.find('[data-accordion].open > [data-content]'), $matched; if(!opts.singleOpen) { $childs = $childs.not($currentAccordion.siblings('[data-accordion].open').find('> [data-content]')); } $matched = $content.add($childs); if($parentAccordion.hasClass('open')) { $matched.each(function() { var currentHeight = $(this).data('oHeight'); switch (operation) { case '+': $(this).data('oHeight', currentHeight + qty); break; case '-': $(this).data('oHeight', currentHeight - qty); break; default: throw 'updateParentHeight method needs an operation'; } $(this).css('max-height', $(this).data('oHeight')); }); } } function refreshHeight($accordion) { if($accordion.hasClass('open')) { var $content = $accordion.find('> [data-content]'), $childs = $content.find('[data-accordion].open > [data-content]'), $matched = $content.add($childs); calculateHeight($matched); $matched.css('max-height', $matched.data('oHeight')); } } function closeAccordion($accordion, $content) { $accordion.trigger('accordion.close'); if(CSStransitions) { if(accordionHasParent) { var $parentAccordions = $accordion.parents('[data-accordion]'); updateParentHeight($parentAccordions, $accordion, $content.data('oHeight'), '-'); } $content.css(closedCSS); $accordion.removeClass('open'); } else { $content.css('max-height', $content.data('oHeight')); $content.animate(closedCSS, opts.transitionSpeed); $accordion.removeClass('open'); } } function openAccordion($accordion, $content) { $accordion.trigger('accordion.open'); if(CSStransitions) { toggleTransition($content); if(accordionHasParent) { var $parentAccordions = $accordion.parents('[data-accordion]'); updateParentHeight($parentAccordions, $accordion, $content.data('oHeight'), '+'); } requestAnimFrame(function() { $content.css('max-height', $content.data('oHeight')); }); $accordion.addClass('open'); } else { $content.animate({ 'max-height': $content.data('oHeight') }, opts.transitionSpeed, function() { $content.css({'max-height': 'none'}); }); $accordion.addClass('open'); } } function closeSiblingAccordions($accordion) { var $accordionGroup = $accordion.closest(opts.groupElement); var $siblings = $accordion.siblings('[data-accordion]').filter('.open'), $siblingsChildren = $siblings.find('[data-accordion]').filter('.open'); var $otherAccordions = $siblings.add($siblingsChildren); $otherAccordions.each(function() { var $accordion = $(this), $content = $accordion.find(opts.contentElement); closeAccordion($accordion, $content); }); $otherAccordions.removeClass('open'); } function toggleAccordion() { var isAccordionGroup = (opts.singleOpen) ? $accordion.parents(opts.groupElement).length > 0 : false; calculateHeight($content); if(isAccordionGroup) { closeSiblingAccordions($accordion); } if($accordion.hasClass('open')) { closeAccordion($accordion, $content); } else { openAccordion($accordion, $content); } } function addEventListeners() { console.log('In Accordion Setup'); $controls.on('click', toggleAccordion); $controls.on('accordion.toggle', function() { if(opts.singleOpen && $controls.length > 1) { return false; } toggleAccordion(); }); $controls.on('accordion.refresh', function() { refreshHeight($accordion); }); $(window).on('resize', debounce(function() { refreshHeight($accordion); })); } function setup() { console.log('In Accordion Setup', $content); $content.each(function() { console.log( $(this).html() ); var $curr = $(this); if($curr.css('max-height') != 0) { if(!$curr.closest('[data-accordion]').hasClass('open')) { $curr.css({ 'max-height': 0, 'overflow': 'hidden' }); } else { toggleTransition($curr); calculateHeight($curr); $curr.css('max-height', $curr.data('oHeight')); } } }); if(!$accordion.attr('data-accordion')) { $accordion.attr('data-accordion', ''); $accordion.find(opts.controlElement).attr('data-control', ''); $accordion.find(opts.contentElement).attr('data-content', ''); } } console.log('Accordion Setup being run', accordionParentsQty, $controls, $content); setup(); console.log('Accordion Setup complete'); console.log('Accordion addEventListeners being run'); addEventListeners(); console.log('Accordion addEventListeners added'); }; console.log('Accordion '+pluginName+' function is being called.', $.fn[pluginName]); $.fn[pluginName] = function ( options ) { console.log('In Accordion '+pluginName+' function.'); return this.each(function () { if (!$.data(this, 'plugin_' + pluginName)) { console.log('Data does not exist or force_reinit, so building.'); $.data( this, 'plugin_' + pluginName, new Accordion( this, options ) ); }else{ console.log('Data already exists so not recreating.'); } }); force_reinit = false; } if(force_reinit === true){ $.fn[pluginName] = $('section.multi-accordion section').each(function () { new Accordion( $(this), {} ); }); force_reinit = false; } console.log('Accordion '+pluginName+' function complete.', $.fn[pluginName]); }; /*--------------------------- Accordion --------------------------*/ /*! * jQuery Accordion 0.0.1 * (c) 2014 Victor Fernandez * MIT Licensed. */ var force_reinit = false; ;(function ( $, window, document, undefined ) { initializeAccordion($, window, document, undefined); })( jQuery, window, document ); /* Custom Js Script */ $(document).ready(function(e) { $.xhrPool = []; console.log('Is logged in? ', isLoggedin()); if(isLoggedin()){ $('body').addClass('logged-in'); } var user_name_line = $('#main2 .user_name_line a').length > 0 ? $('#main2 .user_name_line a').html() : ''; if($('.user_name_line a').length > 0){ $('.user_name_line a').html(''); } if($('.page_content').length == 0){ $('footer#footer_main').before('
    You must be logged in to view this page
    '); } /*$('#testimonials-slider').slick({ slidesToShow: 1, slidesToScroll: 1, dots: true, arrows: false });*/ processCrumbtrail(); if($('nav#logged_panel .logout_link_box a').length > 0){ $('nav#logged_panel .logout_link_box a').html('Log Out'); } if($('.freight').length > 0){ $('.freight').html('Includes delivery'); } $('.wish_list .add_to_cart_btn button').on('click', function(e) { console.log('Redeem wish list item clicked.'); }); // Hack to allow whole box to be clickable. $('#anyway-you-want li').on('click', function(e) { e.preventDefault(); window.location.href = $(this).find('a.card').attr('href'); }); $('.mobile-prev').on('click', function(e) { scroll_left = parseInt($('#top-categories').css('left')); last_item = $('#top-categories li').length; if(scroll_left == 0 || scroll_left == '0px'){ return false; } if($('.mobile-next').css('display') == 'none'){ $('.mobile-next').fadeIn(); } prev_slide_position = 0; i = 0; $('#top-categories li').each(function(){ i++; if(i === last_item){ var rightSide = ($(this).position().left + $(this).width()); position_left = parseInt(rightSide - viewable_width); }else{ position_left = $(this).position().left; } if($(this).position().left > 0 && scroll_left+position_left == 0){ $('#top-categories').animate({"left":'-'+prev_slide_position+'px'}, "slow"); if(prev_slide_position == 0 || prev_slide_position == '0px'){ $('.mobile-prev').fadeOut(); } return false; }else{ prev_slide_position = $(this).position().left; } }); }); $('.mobile-next').on('click', function(e) { scroll_left = parseInt($('#top-categories').css('left')); //alert('Carousel is at '+scroll_left); last_item = $('#top-categories li').length; //alert('slide '+last_item+' is the last item.'); viewable_width = $('#top-categories-contrainer').width(); //alert('viewable_width '+viewable_width); i = 0; $('#top-categories li').each(function(){ i++; if((scroll_left+$(this).position().left) > 0){ //var rightSide = ($(this).position().left + $(this).width()); move_to = '-'+$(this).position().left+'px'; if(i === last_item){ var rightSide = ($(this).position().left + $(this).width()); move_to = '-'+(rightSide - viewable_width)+'px'; } $('#top-categories').animate({"left":move_to}, "slow"); //$('#top-categories').css('left', '-'+($(this).position().left)+'px'); if(i === last_item){ $('.mobile-next').fadeOut(); } return false; } }); if(scroll_left == 0 || scroll_left == '0px'){ $('.mobile-prev').fadeIn(); } }); $('.add_to_wishlist_btn').each(function(){ if($(this).attr('data-analytics-event').indexOf("In Wishlist") >= 0){ $(this).prop('disabled', true); $(this).find('span').html('In Wishlist'); } }); $('.rm_from_wishlist_btn').each(function(){ $(this).find('span').html('Remove from Wishlist'); }); if($('#wishlistUserItemList h2').length == 1 && $('#wishlistUserItemList h2').html() == 'No items have been added to wish list.'){ $('#wishlistUserItemList h2').html('No items have been added to your Wishlist.'); } /* Handle the logo content */ /* $('#main2 h1 a').attr('href','javascript:;'); */ setTimeout(function(){ if($('#main2 h1 a.tab-class').length>0){ console.log('Found header logo'); $('#main2 h1 a.tab-class').attr('href','#').on('click', function(e) { /*var x = e.pageX - $(this).offset().left; var y = e.pageY - $(this).offset().top; var width = $(this).width(); var limit = $('body').width() > 641 ? 83 : 61; var check_val = x; console.log('Position clicked: ', x, y, width, ((x/width)*100), $('body').width()); e.preventDefault(); // - activate if it works // https://hotpoints.co.nz/ if(check_val <= limit){ // This needs to be changed to % now it can shrink. goto('https://www.westpac.co.nz', '_blank'); }else{*/ goto(root_url+'?csrf_token='+bm_csrf_tkn); //} }); }else{ console.log('NOT Found header logo'); } if($('footer#footer_main .footer-logo figure').length>0){ console.log('Found Footer logo'); $('footer#footer_main .footer-logo figure img').on('click', function(e) { var x = e.pageX - $(this).offset().left; var y = e.pageY - $(this).offset().top; console.log('Position clicked: ', x, y); e.preventDefault(); /* - activate if it works // https://hotpoints.co.nz/ */ if(x <= 76.5){ goto('https://www.westpac.co.nz/', '_blank'); }else{ goto(root_url+'?csrf_token='+bm_csrf_tkn); } }); }else{ console.log('NOT Found Footer logo'); } }, 0); /* Moves the header#header_main .header_top_row #nav_holder nav#main h1 to before header#header_main .header_nav_row #nav_holder2 #main2 ul#global_links */ $('header#header_main .header_top_row #nav_holder nav#main h1').insertBefore('header#header_main .header_nav_row #nav_holder2 #main2 ul#global_links'); // adds class to the main menu to make it easily identifible $('header#header_main .header_top_row #nav_holder nav#main > ul:last-child').addClass('top-h-menu'); // This is the hack for reloading after search $('#footer_main a, .top-h-menu a, a.mymenu').on('click', function(e) { console.log('A Footer link OR top-h-menu menu OR Hamburger Nav link has been clicked', $(this).attr('href').toLowerCase()); var tmp = $(this).attr('href').toLowerCase().replace("https://","").replace("http://","").split('/'); var cat_id = tmp.length >= 6 ? tmp[5].substr(0, tmp[5].indexOf("?")) : false; //mtf.au.loyaltygateway.com/rewards/phoenix/HOTPT_STD/shop/9795?postaction=initActionShopCatalog&csrf_token=evcj1inabizr console.log('Is Shop Category page check: ', isShop(), isProduct(), $(this).attr('href').toLowerCase().indexOf("/shop"), tmp, cat_id); if(isShop() && !isProduct() && $(this).attr('href').toLowerCase().indexOf("/shop")!==-1 && cat_id){ e.preventDefault(); console.log('Is a shop page, but not a product page so make ajax call and cancel click*'); makeShopAJAXCall($(this)[0], cat_id); }else if($(this).attr('href').toLowerCase().indexOf("/shop")!==-1 && cat_id){ e.preventDefault(); console.log('Is a shop page, but also product or cart page so append category to the end of the URL and redirect*'); window.location.href = $(this).attr('href')+"&catToLoad="+encodeURIComponent(cat_id); } }); /*Add copy - Removed */ $('.most_wanted_rewards .most_wanted_list').before('

    '+($('.most_redeemed_list .most_redeemed_heading').html())+'

    '); $('.most_redeemed_rewards .most_redeemed_list').before('

    What’s popular.

    '); /*Home page remove and add classes in grid */ /*$("#most_wanted_item_list, #most_redeemed_item_list, #point_balance_item_list").removeClass("small-block-grid-2 medium-block-grid-4"); $("#most_wanted_item_list, #most_redeemed_item_list, #point_balance_item_list").addClass("small-block-grid-1 medium-block-grid-2 large-block-grid-3");*/ /* FAQ Search - stop the form from submitting. */ if($(".index.page_content.freeform_page_temp_content.about_anchor.clear").length > 0){ var formBtn = $(".index.page_content.freeform_page_temp_content.about_anchor.clear button"); console.log('Form button: ', formBtn); if(formBtn.length > 0 && (typeof formBtn.attr('id') == 'undefined' || formBtn.attr('id').length == 0 || formBtn.attr('id') == 'question_search_button') && $(".index.page_content.freeform_page_temp_content.about_anchor.clear button").text() == 'Search'){ console.log('Button text: ', $(".index.page_content.freeform_page_temp_content.about_anchor.clear button").text()); $(".index.page_content.freeform_page_temp_content.about_anchor.clear form").attr('action', 'javascript:;').on('submit', function(e){ e.preventDefault(); return false; }); if($(".index.page_content.freeform_page_temp_content.about_anchor.clear button#question_search_button").length == 0){ $(".index.page_content.freeform_page_temp_content.about_anchor.clear button").attr('id','question_search_button')/*.attr('type','button')*/; } }else{ console.log('FAQ form missing: ', formBtn.length, formBtn.attr('id'), $(".index.page_content.freeform_page_temp_content.about_anchor.clear button").text()); } } console.log('General Page check: ', $('section.general.general_contact.page_content > .row').length); if($('section.general.general_contact.page_content > .row').length > 0){ $('section.general.general_contact.page_content > .row').addClass('page_intro'); } $("#offer_offer_highlight").removeClass("small-block-grid-2 medium-block-grid-3"); $("#offer_offer_highlight").addClass("small-block-grid-1 medium-block-grid-2 large-block-grid-3"); $("header#header_main").removeClass('hide-for-medium-down'); /* accordion call */ if($('.only-one').length) { $('.only-one [data-accordion]').accordion(); } if($('.multi-accordion').length) { $('.multi-accordion [data-accordion]').accordion({ singleOpen: false, collapsible: true }); } /* Adding Top logo */ $('header#header_main .header_nav_row #nav_holder2 h1 a').css("background-image", "url("+asset_url+(isWORLD() ? "/ProgramInfo/"+logo_path['world']+"/images/logo-hotpoints-world.png" : "/ProgramInfo/"+logo_path['standard']+"/images/logo-hotpoints.png")+")").addClass('csrfadd').attr('href', root_url); /* Cut and paste div's in header */ /* $('header#header_main .header_top_row').insertAfter('header#header_main .header_nav_row');*/ $('header#header_main .header_top_row #nav_holder nav#logged_panel').appendTo('header#header_main .header_nav_row #nav_holder2 #main2 '); $('header#header_main .header_nav_row nav#logged_panel').removeClass('small-60 medium-20 columns'); var myAccHref = $('#logged_panel .logged_panel_bottom li.user_name a').attr('href'); console.log('My Points Link: ', root_url+'/my-points', root_url); $('#logged_panel .logged_panel_bottom li.user_name').before('
    '); if($('#logged_panel').length == 0){ $('
  • ').prependTo('#aux ul'); $('#aux ul li:last-child').remove(); } /* Before Logged in panel*/ $('header#header_main .header_top_row #nav_holder nav#aux').appendTo('header#header_main .header_nav_row #nav_holder2 #main2'); $('header#header_main .header_nav_row nav#aux').removeClass('small-60 medium-20 columns'); if($('nav#aux').length) { $('nav#aux').clone().appendTo('.hamburger-data .logged-in-links'); $('.hamburger-data .logged-in-links nav#aux').removeClass('medium-20'); $('.hamburger-data .logged-in-links nav#aux').addClass('medium-40 medium-offset-10 logged-out-panel'); } /* Logged in panel in hamburger menu (No Hamburge Menu anymore) */ if($('nav#logged_panel').length) { $('nav#logged_panel').clone().appendTo('.hamburger-data .logged-in-links'); /*show-for-medium-down*/ $('.hamburger-data .logged-in-links #logged_panel').removeClass('medium-20'); $('.hamburger-data .logged-in-links #logged_panel').addClass('medium-40 medium-offset-10'); $( '.hamburger-data .logged_panel_bottom .available_points .available_point_balance_label' ).html('My account'); $( ".hamburger-data .logged_panel_bottom .available_points" ).wrapInner( '' ); } if($('#rec_last_name').length > 0){ applyPointGiftStyling(); } /*if($('#most_wanted_item_list, #most_redeemed_item_list').length > 0){ $('#most_wanted_item_list, #most_redeemed_item_list').removeClass('medium-block-grid-4').addClass('medium-block-grid-3'); }*/ /* Adding hamburger menu (mobile) & search*/ $("header#header_main .header_nav_row #nav_holder2 #main2 h1").before('
    '); $('header#header_main .header_nav_row #nav_holder2 #main2 ul#global_links').after('
    '); var navHt = $('header#header_main .header_nav_row').height(); var hamMenuHt = ($(window).height() - navHt); $('.search-data').css({ 'min-height': hamMenuHt, 'top': navHt + 1}); $("#hamburger-icon").on("click", function () { if($('.search-data').hasClass('open')){ $('#search-icon').trigger('click'); } $(this).toggleClass("open"); var hamburgerData = $(".hamburger-data"); if($(this).hasClass('open')){ $('body').css('overflowY','hidden'); $('.hamburger-wrapper.top').css('visibility','hidden'); hamburgerData.addClass('open'); } else{ $('body').css('overflowY','auto'); $('.hamburger-wrapper.top').css('visibility','visible'); hamburgerData.removeClass('open'); } }) $('#search-icon').on('click', function(){ if($('.hamburger-data').hasClass('open')){ $('#hamburger-icon').trigger('click'); } $(this).toggleClass('open'); var searchData = $('.search-data'); if($(this).hasClass('open')){ $('body').css('overflowY','hidden'); $('.search-wrapper.top').css('visibility','hidden'); searchData.addClass('open'); } else{ $('body').css('overflowY','auto'); $('.search-wrapper.top').css('visibility','visible'); searchData.removeClass('open'); } }); $('#search-close').on('click', function(){ $('body').css('overflowY','auto'); $('.search-wrapper.top').css('visibility','visible'); $('.search-data').removeClass('open'); }); $('#hamburger-close').on('click', function(){ $('body').css('overflowY','auto'); $('.hamburger-wrapper.top').css('visibility','visible'); $('.hamburger-data').removeClass('open'); }); /* Adding Login Mobile menu */ $('header#header_main .header_nav_row nav#aux').append(''); /* Footer copy */ //var termText = "There is a minimum number of hotpoints you must earn before you are eligible to redeem your hotpoints for any reward or for hotpoints Pay. Hotpoints terms and conditions apply. Reference to non-Westpac websites are provided for your convenience only. Westpac accepts no responsibility for the availability or content of such websites. hotpoints® and hotpoints Pay® are registered trademarks of Westpac Banking Corporation. Westpac's current credit card lending criteria apply to all applications and transfers. The information on this page is presented subject to our legal page and any other terms and conditions that Westpac may impose from time to time. It is subject to change without notification. BT Funds Management (NZ) Limited (BTNZ) is the scheme provider, and Westpac New Zealand Limited (WNZL) is the distributor of the Westpac KiwiSaver Scheme (Scheme). Investments made in the Scheme do not represent bank deposits or other liabilities of the Westpac Banking Corporation ABN 33 007 457 141, WNZL or other members of the Westpac Group, are subject to investment and other risks, including possible delays in payment of withdrawal amounts in some circumstances, and loss of investment value, including principal invested. None of BTNZ (as manager), any member of the Westpac group, The New Zealand Guardian Trust Company Limited (as supervisor), or any director or nominee of any of those entities, or any other person guarantees the Westpac KiwiSaver Scheme's performance, returns or repayment of capital. Mastercard is a registered trademark and the circles design is a trademark of Mastercard International Incorporated. Westpac New Zealand Limited."; $('footer#footer_main .copyright').html('

    © '+(new Date().getFullYear())+' Westpac New Zealand Limited

    '); if(isWORLD()){ $('').appendTo('footer#footer_main .copyright'); }else{ $('footer#footer_main .copyright').before(''); } //$('footer#footer_main .copyright').before('

    '+ termText +'

    '); $('header#header_main .header_nav_row').after('
    '); // Below takes header search and implements it in mobile search //var search_code = ''; //$(search_code).appendTo('.mobile_search_wrapper'); if($('#SPN_SHOP_PUBLIC .search-wrapper.top').length>0){console.log('SHOP HEADER SEARCH FOUND');}else{console.log('SHOP HEADER SEARCH NOT FOUND');} $('#SPN_SHOP_PUBLIC #search-icon, #SPN_SHOP_LOGGED #search-icon').css('visibility','hidden'); buildSearchResultFunctions(); autoSubmitSearchFunctions(); //xhr.abort() /*KiwiSaver Page*/ if($('.slider-redeem-container').length){ $('button.btn-link').addClass('kiwisaver_btn').attr('onclick', "bmAddToCart('.index.page_content.freeform_page_temp_content.about_anchor');"); if(!isLoggedin() && hide_add_to_cart_until_login===true){ console.log('Hide KiwiSaver Page Button'); $('button.btn-link').remove(); }else{ console.log('Logged in, do not hide KiwiSaver Page Button'); if($('#pointsValue').val() > availablePoints){ $('button.btn-link.kiwisaver_btn').addClass('disabled-element').prop('disabled', true); } } $('').insertAfter('.slider-redeem-container'); if($('#cartHasItems').length == 0){ $('').prependTo('.charity-form-conatainer'); } /* $('.slider-redeem-container').parent().find('form').remove();*/ } /*Donation Page*/ if( $('#txtPointsDonate').length){ $('#charity_form_btn').attr('onclick', "bmAddToCart();"); if(!isLoggedin() && hide_add_to_cart_until_login===true){ console.log('Hide Donation Page Button'); $('#charity_form_btn').remove(); }else{ console.log('Logged in, do not hide Donation Page Button'); } $(".charity-form-conatainer form").attr({"id": "form_10088", "name": "form_10088", "method": 'post'}).addClass('options'); $(".charity-form-conatainer #item_id option").remove(); console.log('donation_page_items object contains: ', donation_page_items); $(".charity-form-conatainer #item_id").append(''); for (var i = 0; i < donation_page_items.length; i++) { var product = donation_page_items[i]; console.log('Found product: ', product); $(".charity-form-conatainer #item_id").append(''); } $('').insertAfter('#txtPointsDonate'); if($('.charity-form-conatainer form').length > 0 && $('.charity-form-conatainer #cartHasItems').length == 0){ $('').prependTo('.charity-form-conatainer form'); } /*input[name=gc_reward_option] */ } /*Wishlist Counter*/ if($('.wishlist-counter-no').length && $('.wishlist_item_count').length) { var wishlistCount = $('.wishlist_link .wishlist_item_count').html(); $('.wishlist-counter-no').text(parseInt(wishlistCount)); if(parseInt(wishlistCount) == 1){ var wishlist_str = $('.wishlist-counter-no').parent().html(); $('.wishlist-counter-no').parent().html(wishlist_str.replace("products ", "product ")); } }else if($('.wishlist-counter-no').length){ $('.wishlist-counter-no').html(0); } /*----------Shop Page------------*/ $('section#shop_offers #pagecontent').removeClass('medium-45'); if( $('#shop_offers #shop_list .search_filter_order').length){ $('#shop_offers #shop_list .search_filter_order').insertAfter('#container_shop_category_title'); $('#container_shop_category_title .shop_category_title').html($.trim($('#container_shop_category_title .shop_category_title').html())+'.'); $('.shop.page_content .page_intro .search_filter_order').addClass('row collapse'); $('.shop.page_content .page_intro .search_filter_order > div').removeClass('medium-30 medium-15'); $('.shop.page_content .page_intro .search_filter_order > div').addClass('medium-20'); $('.shop.page_content .page_intro .search_filter_order > div:first-child').before('
    Arrange by:
    '); } /* To remove if they solve config if($('.giftcard-total .small-60.medium-30.columns').length>1){ $('.giftcard-total .small-60.medium-30.columns:last-child').css('display','none'); }*/ /* Adding product sub-categories */ //applySubCategoryStyling(); $('#totalPointsRedeemed p').first().html('Total redeemed hotpoints'); /*---------Checkout updates------*/ /*Replace text */ $("button.checkout span").text(function () { return $(this).text().replace("Checkout", "Checkout now"); }); $("button.continue_shopping span").text(function () { return $(this).text().replace("Continue Shopping", "Continue shopping"); }); $("button.change_address span").text(function () { return $(this).text().replace("Edit This Address", "Edit this address"); }); $("button.send_to_different_address span").text(function () { return $(this).text().replace("Send To Different Address", "Send to different address"); }); $("button.continue span").text(function () { return $(this).text().replace("Continue", "Place order"); }); $("button.shopping_cart span").text(function () { return $(this).text().replace("Previous", "Return to cart"); }); $(".edit_row .item_options label span").text(function () { return $(this).text().replace("Daytime Phone Number::", "Daytime phone number:"); }); /* Awaiting feedback fropm Josh. Shouldn't these be moved to applyCheckoutStyling function? if($('#SPN_CHECKOUT section.shop.checkout.page_content .cart_actions .chkt-actn-buttons').length){ var chkButtons = $('#SPN_CHECKOUT section.shop.checkout.page_content .cart_actions .chkt-actn-buttons'); chkButtons.prepend('
    '); chkButtons.find('button.continue').appendTo('.checkout-detail-buttons .checkout-button-left'); chkButtons.find('button.shopping_cart').appendTo('.checkout-detail-buttons .checkout-button-right'); }*/ /* Catalog page overrides */ if($('#selrange').length>0){ $('#selrange option:first-child').html('All hotpoints levels'); $('#selsort option').each(function(){ if($(this).html() != 'Alphabetical') $(this).html($(this).html().toLowerCase()); }); } if($('#gcConsolidated').length>0){ $('#gcConsolidated label.price, #gcConsolidated span.point-desc').each(function(){ $(this).html($(this).html().toLowerCase()); }); } if($('#add_to_cart').length > 0){ $('#add_to_cart span').html('Add to cart'); } if($('.wishlist.add_to_wishlist_btn').length > 0){ if($('.wishlist.add_to_wishlist_btn').attr('data-analytics-event').indexOf("In Wishlist") < 0){ $('.wishlist.add_to_wishlist_btn span').html('Add to Wishlist'); } } /*Replace Hotpoints H with h */ $(".price .point-desc").text(function () { return $(this).text().replace("Hotpoints", "hotpoints"); }); /*Replace D with d*/ $(".freight").text(function () { return $(this).text().replace("Delivery", "delivery"); }); /* product details page */ if($('.shop.shop_details.page_content .page_intro footer, .shop.shop_details_logged.page_content .page_intro footer').length){ $('.shop.shop_details.page_content .page_intro footer').insertAfter('.shop.shop_details.page_content .page_intro .row .item_details h2'); $('.shop.shop_details_logged.page_content .page_intro footer').insertAfter('.shop.shop_details_logged.page_content .page_intro .row .item_details h2'); $('.shop.page_content .page_intro .row .item_details p.description, .shop.page_content .page_intro .row .item_details > ul').insertAfter('.shop.page_content .page_intro .row .detail_image figure'); $('.shop.page_content .page_intro .row .item_details .shop_details_catalog_item > .columns').removeClass('medium-35 medium-push-25 end'); $('.shop.page_content .page_intro .row .detail_image .description').before('

    Description.

    '); /* Product box structure updates */ $('.shop.shop_details.page_content .page_intro .row .small-60.medium-25.columns, .shop.shop_details_logged.page_content .page_intro .row .small-60.medium-25.columns').removeClass('medium-25').addClass('medium-34'); $('.shop.shop_details.page_content .page_intro .row .small-60.medium-35.columns, .shop.shop_details_logged.page_content .page_intro .row .small-60.medium-35.columns').removeClass('medium-35 end').addClass('medium-25'); /*Product form details (We do first as sometimes there is more than one) */ if($('.shop.page_content .page_intro footer .price').length < 2){ console.log('Detecting price: ', $('.shop.page_content .page_intro footer .price').first().length, $('.shop.page_content .page_intro .row .item_details .shop_details_catalog_item').length); $('.shop.page_content .page_intro footer .price').first().prependTo('.shop.page_content .page_intro .row .item_details .shop_details_catalog_item'); } if($('.shop.page_content .page_intro footer .cash').length < 2){ $('.shop.page_content .page_intro footer .cash').first().prependTo('.shop.page_content .page_intro .row .item_details .shop_details_catalog_item'); } $('.shop.page_content .page_intro footer .vpp-points-amount span').text('hotpoints:'); $('.shop.page_content .page_intro footer .vpp-pay-amount span').text('Dollars to pay:'); /* Shop Details form */ $('.shop.page_content .page_intro .row .item_details .shop_details_catalog_item').after('
    '); $('.shop.page_content .page_intro .row .item_details .form-details-container').append('
    '); $('.shop.page_content .terms-and-cond').appendTo('.shop.page_content .page_intro .row .item_details .form-details-container'); $('.shop_details form .messages, .shop_details_logged form .messages').appendTo('.shop.page_content .page_intro .row .item_details .form-details-container'); $('.shop.page_content .item_details .add_to_cart_btn').appendTo('.shop.page_content .item_details .form-details-container .form-buttons'); $('.shop.page_content .item_details .add_to_wishlist').appendTo('.shop.page_content .item_details .form-details-container .form-buttons'); /* Adding star icon in wishlist */ if($('.shop.page_content .add_to_wishlist button.add_to_wishlist_btn').length>0 && (typeof $('.shop.page_content .add_to_wishlist button.add_to_wishlist_btn').attr('data-analytics-event') == 'undefined' || $('.shop.page_content .add_to_wishlist button.add_to_wishlist_btn').attr('data-analytics-event').indexOf("In Wishlist") < 0)){ $('.shop.page_content .add_to_wishlist button.add_to_wishlist_btn span').prepend(''); } /*if(!isLoggedin() && $('.vpp-pay-amount').length>0){ $('

    Points + Pay is only available for online redemptions at www.hotpoints.co.nz once you have logged in from Westpac Online Banking.

    ').appendTo('.item_details form .form-details-container .form-buttons'); }*/ if($('.vpp-pay-amount').length>0){ $('.item_details .shop_details_catalog_item label.quantity').parent().parent().after('
    Points + Pay (hotpoints T&Cs apply)
    Don\'t have enough points? Make up the difference using your hotpoints credit card.
    '); } } if($('.page_intro').length>0 && $('.terms-and-cond').length>0){ var spec_html = $('.terms-and-cond').html(); $('.terms-and-cond').remove(); /* This seems to write it back to same place rying append too???? */ /*$( '
    '+spec_html+'
    ' ).appendTo('.page_intro');*/ $( '
    '+spec_html+'
    ' ).insertAfter( ".description" ); /*$( '
    '+spec_html+'
    ' ).appendTo('.detail_image');*/ } applyEllipsizeTextBoxStyling(); /* Check for pagination on catalog page */ setTimeout(function(){ if($('#shop_list footer.bottom_footer #pagination').length>0){ console.log('Its a catalogue page and matched pagination div'); if($('#shop_list footer.bottom_footer #pagination ul li').length==0){ console.log('no pagingation displayed so delete the parent divs'); $('#shop_offers').addClass('nopages'); $('#shop_list footer.bottom_footer').remove(); } } }, 0); /*----------Account Page------------*/ if($('.rewards_summary.page_content').length){ var logoutLink = $('nav#logged_panel .logout_link_box').html(); var wishlistLink = $('.wishlist_link a').attr('href'); var wishlistCount = $('.wishlist_link .wishlist_item_count').html(); var balancePoints = $('#logged_panel .available_points .available_point_balance').html(); var myAccountSummery = ''; var customBox = '

    You have ' + parseInt(wishlistCount) + ' product'+(parseInt(wishlistCount) == 1 ? '' : 's')+' in your Wishlist.

    See how far away you are from redeeming your ideal items.

    '; /* View Statement */ $('button#view_statement span').html('Search'); /* Update profile */ $('.rewards_summary.page_content #profileWrapper #div_profile').prepend(customBox); $('.rewards_summary.page_content #profileWrapper #div_profile').prepend(myAccountSummery); /* My points page */ $('.rewards_summary.page_content #rewardSummaryWrapper #RewardsSummary').prepend(customBox); $('.rewards_summary.page_content #rewardSummaryWrapper #RewardsSummary').prepend(myAccountSummery); var accountHistoryData ='

    Account history.

    Want to see where you’ve been earning or spending your hotpoints? Track back your account history.

    Search your history:

    '; $('#rewardSummaryWrapper #AccountInformationForm').prepend(accountHistoryData); var eligibleTransactionsData ='

    Eligible transactions.

    '; $('#transactionEraserWrapper #AccountInformationForm').prepend(eligibleTransactionsData); $(".rewards_summary.page_content .page_intro #RewardsSummary #AccountInformationForm label > span").text(function () { return $(this).text().replace("Account Number", "My cards"); }); /* (XXX) Hotpoints expiring soon logic */ var month = new Array(); month[0] = "January"; month[1] = "February"; month[2] = "March"; month[3] = "April"; month[4] = "May"; month[5] = "June"; month[6] = "July"; month[7] = "August"; month[8] = "September"; month[9] = "October"; month[10] = "November"; month[11] = "December"; var d = new Date(), thisMonth = d.getMonth() + 1, nextMonth = month[d.getMonth() + 1], nextMonthPlus = month[d.getMonth() + 2], nMonth = thisMonth + 1, /*Next Month Number */ nnMonth = thisMonth + 2, /*Next to Next Month Number */ year = d.getFullYear(); /*Year*/ /*thisMonth = thisMonth < 10 ? '0' + thisMonth : '' + thisMonth; thisMonth = parseInt(thisMonth); nMonth = nMonth < 10 ? '0' + nMonth : '' + nMonth; nnMonth = nnMonth < 10 ? '0' + nnMonth : '' + nnMonth;*/ /*console.log(year, nMonth); */ var thisMonthRemPoints = '0', nextMonthRemPoints = '0', nnMonthRemPoints = '0'; $('#panel7 table.paginate_table .points-expire').each(function(){ var datestring = $(this).text(); var yearstring = datestring.substring(0, 4); var monthstring = datestring.substring(4, 6); var nextMonthYear = 1; var nnMonthYear = 1; if( thisMonth == 12){ nextMonthYear = year + 1; nnMonthYear = year + 1; nMonth = 1; nnMonth = 2; } else if( thisMonth == 11){ nextMonthYear = year; nnMonthYear = year + 1; nMonth = 12; nnMonth = 1; } else{ nextMonthYear = year; nnMonthYear = year; nMonth = nMonth; nnMonth = nnMonth; } /* For this month */ if( yearstring == year && monthstring == thisMonth){ thisMonthRemPoints = parseInt($(this).closest('tr').find('.numeric').text().replace(/,/g, '')); } /* For next month */ if( yearstring == nextMonthYear && monthstring == nMonth){ nextMonthRemPoints = parseInt($(this).closest('tr').find('.numeric').text().replace(/,/g, '')); } /* For next to next month */ if( yearstring == nnMonthYear && monthstring == nnMonth){ nnMonthRemPoints = parseInt($(this).closest('tr').find('.numeric').text().replace(/,/g, '')); } }); var totalPointsRem = parseInt(thisMonthRemPoints) + parseInt(nextMonthRemPoints) + parseInt(nnMonthRemPoints); var hotPointsExpirySoon = '

    '+ numberWithCommas(totalPointsRem) +' hotpoints expiring soon.

    • ' + numberWithCommas(thisMonthRemPoints) + '
      This Month
    • '+ numberWithCommas(nextMonthRemPoints) +'
      '+ nextMonth +'
    • '+ numberWithCommas(nnMonthRemPoints) +'
      '+ nextMonthPlus +'

    Make sure you spend your hotpoints before they expire.

    '; $('.rewards_summary.page_content #rewardSummaryWrapper .page_intro #RewardsSummary #dlPrinterFriendlyContent').prepend(hotPointsExpirySoon); /*var remove_if_starts_with = [ 'BusinessPlus hotpoints MC', 'BusinessPlus hotpoints Mastercard', 'hotpoints Platinum MC', 'Platinum MC', 'Platinum hotpoints MC', 'hotpoints MC', 'hotpoints Mastercard', 'hotpoints Platinum Mastercard', 'Platinum Mastercard', 'Platinum hotpoints Mastercard', 'hotpoints World MC', 'hotpoints World Mastercard' ]*/ } /* Checkout and Cart Processes */ if($('#SPN_SHOPPINGCART #shoppingCartForm').length){ applyShoppingCartStyling(); } if($('#SPN_CHECKOUT').length >0){ if(!$('.wizard-3').length){ $('