- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
// Experience 1
// RUN THIS IS CATALOG
if (!!window.location.href.match(/learn-/)) {
$('#giftinglevelselect').on('change', function(e) {
update_html_and_cartlink(e.target.value, $('#giftingproduct_cartlink'))
})
var newdata = {
"06": { dollar: '19', cents: '84', total: '107.94', currentpromo: 'parthenon_', newpromo: 'taxday' },
"12": { dollar: '14', cents: '92', total: '179.04', currentpromo: 'parthenon_', newpromo: 'taxday' }
}
/*
var newdata = {
"03": { dollar: '18', cents: '99', total: '56.97', currentpromo: 'parthenon', newpromo: 'mountfuji' },
"06": { dollar: '16', cents: '99', total: '101.94', currentpromo: 'parthenon', newpromo: 'goldengate' },
"12": { dollar: '12', cents: '99', total: '155.88', currentpromo: 'parthenon', newpromo: 'goldengate' },
"24": { dollar: '8', cents: '49', total: '203.76', currentpromo: 'parthenon', newpromo: 'goldengate' }
}
*/
function update_html_and_cartlink (lvl, $cartbtn) {
if ( !(lvl in newdata))
{
return
}
if (typeof $cartbtn == 'undefined')
{
var $cartbtn = $('a.js_oct_2016_addtocart[data-lvl="'+lvl+'"]')
}
else
{
// MEANS THIS FN IS BEING CALLED FROM EGIFT CHANGE
$('p#giftingproduct_saleprice').html('$' + newdata[lvl].dollar)
$('.giftingproduct_buysection > div > p:first-of-type').html('.' + newdata[lvl].cents)
}
var href = $cartbtn.attr('href')
var re = new RegExp(newdata[lvl].currentpromo, "g");
var newhref = href.replace(re, newdata[lvl].newpromo);
$cartbtn.attr('href', newhref)
// DOM changes - desktop
$('span.oct_2016_big_price_square[data-lvl="'+lvl+'"] > div > p:first-of-type').html('.'+newdata[lvl].cents)
var $cents = $('span.oct_2016_big_price_square[data-lvl="'+lvl+'"] > div').detach()
$('span.oct_2016_big_price_square[data-lvl="'+lvl+'"]').text(newdata[lvl].dollar)
$('span.oct_2016_big_price_square[data-lvl="'+lvl+'"]').append($cents)
$('span.oct_2016_big_price_square[data-lvl="'+lvl+'"]').parent().find('.oct_2016_msrp_square strong').html('$'+newdata[lvl].total)
// DOM changes - mobile
$('.mobile_price.js_oct_2016_price.no_month[data-lvl="'+lvl+'"]').html(newdata[lvl].dollar)
$('.mobile_price.js_oct_2016_price.no_month[data-lvl="'+lvl+'"] + .productcents > p:first-of-type').html('.'+newdata[lvl].cents)
$('span.oct_2016_big_price_square[data-lvl="'+lvl+'"]').parents('.oct_2016_product_square_middle').find('strong').html('$'+newdata[lvl].total)
}
$.each($('a.js_oct_2016_addtocart'), function(i, e) {
var lvl = $(e).attr('data-lvl')
if (lvl in newdata) {
update_html_and_cartlink(lvl)
}
})
} else {
// RUN THIS IF LP
var destination = {
sitewide: 'taxday24M749',
rmsitewide: 'taxday24M699',
sale: 'taxday24M699',
earthday749: 'earthday24m749',
earthday699: 'earthday24m699',
taxday749: 'taxday24m749',
taxday699: 'taxday24m699',
aprilshowers11: 'aprilshowers24m11',
aprilshowers749:'aprilshowers24m749',
aprilshowers699:'aprilshowers24m699',
earthday599: 'earthday24m599',
taxday599: 'taxday24m599'
}
Object.keys(destination).forEach(function(e,i) {
if (e == RSI.rsi) {
var re = new RegExp(e, "g");
var dst = window.location.href.replace(re, destination[e]);
window.location.href = dst
}
})
}