- 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
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
- 110
- 111
- 112
- 113
- 114
- 115
- 116
- 117
- 118
- 119
- 120
- 121
- 122
- 123
- 124
- 125
- 126
- 127
- 128
- 129
- 130
- 131
- 132
- 133
- 134
- 135
- 136
- 137
- 138
$(document).ready(function() {
var url = window.location.href;
var lang = url.match(/language=([a-z]{3})/)[1];
//update prices based on RSI object
$('.MEC_mobile_page-container input[name=product_option]').each(function(i,v) {
var rsidata = RSI({'cat': lang, 'lvl': $(this).attr('data-lvl'), 'media': $(this).attr('data-media')})[0];
$(this).parent().find('label span.MEC_mobile_strike-price').text('$'+rsidata['msrp']);
$(this).parent().find('label span.MEC_mobile_price').text('$'+rsidata['price']);
});
// swapping styling on online or download/cd picked
$('.MEC_mobile_js-option-picker').click(function(e) {
e.preventDefault();
e.stopPropagation();
if(!$(this).hasClass('MEC_mobile_picked')) {
if($(this).hasClass('MEC_mobile_pick-download')) {
$('.MEC_mobile_pick-cd-rom').removeClass('MEC_mobile_picked');
$('.MEC_mobile_pick-cd-rom').addClass('MEC_mobile_unpicked');
$('.MEC_mobile_pick-download').removeClass('MEC_mobile_unpicked');
$('.MEC_mobile_pick-download').addClass('MEC_mobile_picked');
$('.MEC_mobile_online-value-points').removeClass('MEC_mobile_hidden');
$('.MEC_mobile_digital-value-points').addClass('MEC_mobile_hidden');
$('.MEC_mobile_online-options').removeClass('MEC_mobile_hidden');
$('.MEC_mobile_digital-options').addClass('MEC_mobile_hidden');
$('.MEC_mobile_instant_or_cd_container').addClass('MEC_mobile_hidden');
} else {
$('.MEC_mobile_pick-download').removeClass('MEC_mobile_picked');
$('.MEC_mobile_pick-download').addClass('MEC_mobile_unpicked');
$('.MEC_mobile_pick-cd-rom').removeClass('MEC_mobile_unpicked');
$('.MEC_mobile_pick-cd-rom').addClass('MEC_mobile_picked');
$('.MEC_mobile_online-value-points').addClass('MEC_mobile_hidden');
$('.MEC_mobile_digital-value-points').removeClass('MEC_mobile_hidden');
$('.MEC_mobile_online-options').addClass('MEC_mobile_hidden');
$('.MEC_mobile_digital-options').removeClass('MEC_mobile_hidden');
$('.MEC_mobile_instant_or_cd_container').removeClass('MEC_mobile_hidden');
}
}
});
$('.MEC_mobile_page-container .MEC_mobile_js_option_button').click(function(e) {
e.preventDefault();
e.stopPropagation();
if(!$(this).hasClass('MEC_mobile_picked')) {
if($(this).hasClass('MEC_mobile_pick_download')) { // Instant Download
$(this).addClass('MEC_mobile_picked');
$('.MEC_mobile_page-container .MEC_mobile_pick_cd_rom').removeClass('MEC_mobile_picked');
$('.MEC_mobile_page-container .MEC_mobile_digital-options input[name=product_option]').each(function(i,v) {
$(this).attr('data-media','download');
// check if we already have checked an option if so we
// need to update the button url
if($(this)[0].checked) {
var rsidata = RSI({'cat': lang, 'lvl': $(this).attr('data-lvl'), 'media': $(this).attr('data-media')})[0];
$('.MEC_mobile_page-container .MEC_mobile_add-to-cart-button-container').find('a.MEC_mobile_blue-button').attr('href', rsidata['cart']);
if($('#MEC_mobile_gift-it')[0].checked) {
$('.MEC_mobile_page-container .MEC_mobile_add-to-cart-button-container').find('a.MEC_mobile_blue-button').attr('href', rsidata['cart']+'&gifting=1');
} else {
$('.MEC_mobile_page-container .MEC_mobile_add-to-cart-button-container').find('a.MEC_mobile_blue-button').attr('href', rsidata['cart']);
}
}
});
} else { // CDROM
$(this).addClass('MEC_mobile_picked');
$('.MEC_mobile_page-container .MEC_mobile_pick_download').removeClass('MEC_mobile_picked');
$('.MEC_mobile_page-container .MEC_mobile_digital-options input[name=product_option]').each(function(i,v) {
$(this).attr('data-media','box');
// check if we already have checked an option if so we
// need to update the button url
if($(this)[0].checked) {
var rsidata = RSI({'cat': lang, 'lvl': $(this).attr('data-lvl'), 'media': $(this).attr('data-media')})[0];
$('.MEC_mobile_page-container .MEC_mobile_add-to-cart-button-container').find('a.MEC_mobile_blue-button').attr('href', rsidata['cart']);
if($('#MEC_mobile_gift-it')[0].checked) {
$('.MEC_mobile_page-container .MEC_mobile_add-to-cart-button-container').find('a.MEC_mobile_blue-button').attr('href', rsidata['cart']+'&gifting=1');
} else {
$('.MEC_mobile_page-container .MEC_mobile_add-to-cart-button-container').find('a.MEC_mobile_blue-button').attr('href', rsidata['cart']);
}
}
});
}
}
});
$('.MEC_mobile_page-container input[name=product_option]').click(function(e) {
e.stopPropagation();
var rsidata = RSI({'cat': lang, 'lvl': $(this).attr('data-lvl'), 'media': $(this).attr('data-media')})[0];
if($('#MEC_mobile_gift-it')[0].checked) {
$('a.MEC_mobile_blue-button').attr('href', rsidata['cart']+'&gifting=1');
} else {
$('a.MEC_mobile_blue-button').attr('href', rsidata['cart']);
}
$('.MEC_mobile_gift-it').removeClass('MEC_mobile_hidden');
});
$('.MEC_mobile_js-gift-it').click(function(e) {
if($(this)[0].checked) {
$('.MEC_mobile_blue-button').attr('href', $('.MEC_mobile_blue-button').attr('href')+'&gifting=1');
} else {
$('.MEC_mobile_blue-button').attr('href', $('.MEC_mobile_blue-button').attr('href').substring(0,$('.MEC_mobile_blue-button').attr('href').length-10));
}
});
$('a.MEC_mobile_blue-button').click(function(e) {
e.stopPropagation();
var picked = false;
// need to check if we're on online or digital for mobile portion
if($('.MEC_mobile_picked').hasClass('MEC_mobile_pick-download')) {
$('.MEC_mobile_online-options input[name=product_option]').each(function(i,v) {
if($(this)[0].checked == true) {
picked = true;
}
});
} else if($('.MEC_mobile_picked').hasClass('MEC_mobile_pick-cd-rom')) {
$('.MEC_mobile_digital-options input[name=product_option]').each(function(i,v) {
if($(this)[0].checked == true) {
picked = true;
}
});
}
if(!picked) { e.preventDefault(); } // stop the click, no option selected
});
if($('.MEC_mobile_page-container').css('display') != 'none') { // mobile is showing on load
$('.MEC_mobile_online-option input#24m-mobile').trigger('click');
}
});