- 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
- 139
- 140
- 141
- 142
- 143
- 144
- 145
- 146
- 147
- 148
- 149
- 150
- 151
- 152
- 153
- 154
- 155
- 156
- 157
- 158
- 159
- 160
- 161
- 162
- 163
- 164
- 165
- 166
- 167
- 168
- 169
- 170
- 171
- 172
- 173
- 174
- 175
- 176
- 177
- 178
- 179
- 180
- 181
- 182
- 183
- 184
- 185
- 186
- 187
- 188
- 189
- 190
/*
https://www.rosettastone.com/lp/cyber-files/black-friday-background.svg
https://www.rosettastone.com/lp/cyber-files/cyber-monday-background.svg
*/
$('.home-rto').remove();
(function () {
function getLocalTimeTOESTEquiv( ) {
var offset = -5;
var targetTime = new Date();
var ESTTime = new Date( targetTime.getTime() + (offset * 60 + targetTime.getTimezoneOffset()) * 60 * 1000 );
return ESTTime;
}
function removeRTO(){
$('.home-rto').remove();
}
function offerScheduler () {
var ESTTime = getLocalTimeTOESTEquiv();
if( ESTTime.getDate() >= 26 ){
return "CE";
}
if( ESTTime.getDate() >= 25 && ESTTime.getHours() >= 12 ){
return "CE";
}
if( ESTTime.getDate() >= 21 && ESTTime.getHours() >= 19 ){
return "BF";
}
if( ESTTime.getDate() >= 15 ){
return "BF";
}
}
// function to be expanded to support Cyber monday and black friday offer
var offer = 'BF'//offerofferScheduler();
window.isDesktop = !/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
// test for mobile (not tablet and not desktop)
window.isMobile = !isDesktop && !/iPad/i.test(navigator.userAgent);
// test for tablet (not tablet and not desktop)
window.isTablet = !isDesktop && !isMobile;
function insertCSSFORResponsiveness() {
var homeRTOStyles = document.createElement('style');
var homeRTOStylesCSS = '' +
'.home-rto.mobile{'+
'display: none;'+
'}'+
'.home-rto.desktop{'+
'display: none;'+
'}'+
'@media only screen and (max-width: 872px) {'+
'.home-rto.mobile{'+
'display: block;'+
'}'+
'.home-rto.desktop{'+
'display: none;'+
'}'+
'}'+
'@media only screen and (min-width: 872px) {'+
'.home-rto.mobile{'+
'display: none;'+
'}'+
'.home-rto.desktop{'+
'display: flex;'+
'}'+
'}'
homeRTOStyles.innerHTML = homeRTOStylesCSS;
document.querySelector('head').appendChild(homeRTOStyles);
}
insertCSSFORResponsiveness();
var offerModel = {
BF: {
HTML: "<div class='home-rto desktop' style=''>\
<div class='action-container' style='padding: 12px;'>\
<p style=' margin:0px; font-family: Effra;font-size: 24px;letter-spacing: 1px;line-height: 32px;'><b style='font-size: 32px;'>Black Friday Sale.</b><br/>Shop our best deal of the season.</p>\
<div style='margin-top:12px;'>\
<button class='leadRTOButton' style='border:none; margin-left:12px; padding: 9px 24px; font-size: 16px; background-color: rgb(52,155,222); color: white; border-radius: 22px; cursor: pointer; font-weight: bold;'><a style='color:white' href='https://www.rosettastone.com/lp/sbsr/sitewide'>SHOP NOW</a></button>\
</div>\
</div>\<img class='close' src='https://www.rosettastone.com/lp/cyber-files/close-button-white.svg' style='position: absolute; padding:20px; right:12px; top: 12px' />\
</div>",
style : "flex-direction: column;justify-content: center;align-items: center;position: relative; width:100%;opacity: 1;z-index: 300;transform: translateY(0%);transition: all 2s; background-color:#0097D9; text-align: center; color:white;background: url(https://www.rosettastone.com/lp/cyber-files/black-friday-background.svg); background-size: cover;min-height: 244px;",
mobileHTML: "<div class='home-rto mobile' style=''>\
<div class='action-container' style='padding: 0px 12px;padding-top: 24px;'>\
<img class='close' src='https://www.rosettastone.com/lp/cyber-files/close-button-white.svg' style='position: absolute; right:12px; top: 12px; padding:20px;' />\
<div style=' margin:0px; font-family: Effra;font-size: 24px;letter-spacing: 0.23px;line-height: 19px;display: flex; flex-direction: column; align-items:center'><b>Black Friday Sale.</b>\
<p style='margin: 15px;'>Shop our best deal of the season.</p></div><div style='margin-top:12px; display:flex; align-items: center ;justify-content: center; flex-direction: column'></div>\
</div>\<button class='leadRTOButton' style='min-height:70px; width: 100%;border:none; font-size: 16px; background-color: black; color: white; height: 100%; font-weight: bold; '><a style='color:white' href='https://www.rosettastone.com/lp/sbsr/sitewide'>SHOP NOW</a></button>\
</div>",
mobileStyle : "flex-direction: row;justify-content: space-between;align-items: center;bottom:0px;position: fixed; width:100%;opacity: 1;z-index: 300;transform: translateY(0%);transition: all 2s; background-color:#0097D9; min-height: 140px; color:white",
},
CM: {
HTML: "<div class='home-rto desktop' style=''>\
<div class='action-container' style='padding: 12px; color: black;'>\
<p style=' margin:0px; font-family: Effra;font-size: 24px;letter-spacing: 1px;line-height: 32px;'><b style='font-size: 32px;'>Cyber Monday Sale.</b><br/>Shop our best offer of the year.</p>\
<div style='margin-top:12px;'>\
<button class='leadRTOButton' style='border:none; margin-left:12px; padding: 9px 24px; font-size: 16px; background-color: rgb(52,155,222); color: white; border-radius: 22px; cursor: pointer; font-weight: bold;'><a style='color:white' href='https://www.rosettastone.com/lp/sbsr/sitewide'>SHOP NOW</a></button>\
</div>\</div>\<img class='close' src='https://www.rosettastone.com/lp/cyber-files/close-button-white.svg' style='position: absolute; padding:20px; right:12px; top: 12px;background: black;opacity: 0.5;border-radius: 25px;' />\
</div>",
style : "flex-direction: column;justify-content: center;align-items: center;position: relative; width:100%;opacity: 1;z-index: 300;transform: translateY(0%);transition: all 2s; background-color:#0097D9; text-align: center; color:white;background: url(https://www.rosettastone.com/lp/cyber-files/cyber-monday-background.svg); background-size: cover;min-height: 244px;",
mobileHTML: "<div class='home-rto mobile' style=''>\
<div class='action-container' style='padding: 0px 12px;padding-top: 24px;'>\
<img class='close' src='https://www.rosettastone.com/lp/cyber-files/close-button-white.svg' style='position: absolute; right:12px; top: 12px; padding:20px;' />\
<div style=' margin:0px; font-family: Effra;font-size: 24px;letter-spacing: 0.23px;line-height: 19px;display: flex; flex-direction: column; align-items:center'><b>Cyber Monday Sale.</b>\
<p style='margin: 15px;'>Shop our best offer of the year.</p></div><div style='margin-top:12px; display:flex; align-items: center ;justify-content: center; flex-direction: column'></div>\
</div>\<button class='leadRTOButton' style='min-height:70px; width: 100%;border:none; font-size: 16px; background-color: black; color: white; height: 100%; font-weight: bold; '><a style='color:white' href='https://www.rosettastone.com/lp/sbsr/sitewide'>SHOP NOW</a></button>\
</div>",
mobileStyle : "flex-direction: row;justify-content: space-between;align-items: center;bottom:0px;position: fixed; width:100%;opacity: 1;z-index: 300;transform: translateY(0%);transition: all 2s; background-color:#0097D9; min-height: 140px; color:white",
},
CE: {
HTML: "<div class='home-rto desktop' style=''>\
<div class='action-container' style='padding: 12px; color: black;'>\
<p style=' margin:0px; font-family: Effra;font-size: 24px;letter-spacing: 1px;line-height: 32px;'><b style='font-size: 32px;'>Cyber Monday Sale: EXTENDED.</b><br/>Shop our best deal of the season.</p>\
<div style='margin-top:12px;'>\
<button class='leadRTOButton' style='border:none; margin-left:12px; padding: 9px 24px; font-size: 16px; background-color: rgb(52,155,222); color: white; border-radius: 22px; cursor: pointer; font-weight: bold;'><a style='color:white' href='https://www.rosettastone.com/lp/sbsr/sitewide'>SHOP NOW</a></button>\
</div>\
</div>\
<div class='home-rto gdpr_target'></div>\
<img class='close' src='https://www.rosettastone.com/lp/cyber-files/close-button-white.svg' style='position: absolute; padding:20px; right:12px; top: 12px; background: black;opacity: 0.5;border-radius: 25px; ' />\
</div>",
style : "flex-direction: column;justify-content: center;align-items: center;position: relative; width:100%;opacity: 1;z-index: 300;transform: translateY(0%);transition: all 2s; background-color:#0097D9; text-align: center; color:white;background: url(https://www.rosettastone.com/lp/cyber-files/cyber-monday-extended.svg); background-size: cover;min-height: 214px;",
mobileHTML: "<div class='home-rto mobile' style=''>\
<div class='action-container' style='padding: 0px 12px;padding-top: 24px;'>\
<img class='close' src='https://www.rosettastone.com/lp/cyber-files/close-button-white.svg' style='position: absolute; right:12px; top: 12px; padding:20px;' />\
<div style=' margin:0px; font-family: Effra;font-size: 24px;letter-spacing: 0.23px;line-height: 19px;display: flex; flex-direction: column; align-items:center'><b>Cyber Monday Sale: EXTENDED.</b>\
<p style='margin: 15px;'>Shop our best deal of the season.</p></div><div style='margin-top:12px; display:flex; align-items: center ;justify-content: center; flex-direction: column'></div>\
</div>\<button class='leadRTOButton' style='min-height:70px; width: 100%;border:none; font-size: 16px; background-color: black; color: white; height: 100%; font-weight: bold; '><a style='color:white' href='https://www.rosettastone.com/lp/sbsr/sitewide'>SHOP NOW</a></button>\
</div>",
mobileStyle : "flex-direction: row;justify-content: space-between;align-items: center;bottom:0px;position: fixed; width:100%;opacity: 1;z-index: 300;transform: translateY(0%);transition: all 2s; background-color:#0097D9; min-height: 140px; color:white",
}
}
function isMobile () {
return window.isMobile;
}
let $html = $(offerModel[offer].HTML);
let $htmlMobile = $(offerModel[offer].mobileHTML);
$html.attr('style', offerModel[offer].style );
$htmlMobile.attr('style', offerModel[offer].mobileStyle);
$('body').prepend( $html );
$('body').prepend( $htmlMobile);
$('.close').on('click', removeRTO )
if( isDesktop ){
window.addEventListener('scroll' , (e) => {
if( window.scrollY > 300 ){
$('.home-rto.desktop').css('position', 'fixed');
$('.home-rto.desktop').css('top', '68px');
}
if( window.scrollY == 0 ){
$('.home-rto.desktop').css('position', 'relative');
$('.home-rto.desktop').css('top', '0px');
}
})
}
// Because CTA doesn't work in FF, use this
$('.leadRTOButton').click(function() {
window.location.href = $(this).find('a').attr('href')
})
})();