- 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
- 191
- 192
- 193
- 194
- 195
- 196
- 197
- 198
- 199
- 200
- 201
- 202
- 203
- 204
- 205
- 206
- 207
- 208
- 209
- 210
- 211
- 212
- 213
- 214
- 215
- 216
- 217
- 218
- 219
- 220
- 221
- 222
- 223
- 224
- 225
- 226
- 227
- 228
- 229
- 230
- 231
- 232
- 233
- 234
- 235
var isDesktop = !/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
$('.rto-submit').click(function(e) {
e.preventDefault()
var email = $('.rto-email-input').val()
if (validateEmail(email))
{
verify_real_email(email, onBVSuccess, onBVError)
$('.form-error').hide()
}
else
{
// Show error
onBVError()
}
});
function validateEmail(email) {
var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test(email);
}
function onBVSuccess (email)
{
$('.form-error').hide()
jQuery.when( submitEmailToEC(email, lang) ).then(
// Success - email saved to EC
function()
{
fireAnalytics();
displaySuccessMessage();
},
// Rejected from EC
function()
{
$('.form-error').show()
})
}
function onBVError ()
{
$('.form-error').show()
}
function verify_real_email(email, onBVSuccess, onBVError)
{
// success_callback == onBVSuccess, failure_callback == onBVError
// make sure all parameters are used
if(!email || !onBVSuccess || !onBVError){
return;
}
// if gdpr consent isn't given, skip the validation and go straight to the demo
var gdpr_consent_given = window.gdpr && window.gdpr.email_consent && window.gdpr.email_consent != null;
if (!gdpr_consent_given)
{
onBVSuccess(email);
return;
}
// if request isn't found in 2 sec or less, move on without it
window.briteverify_timeout_finished_first = false;
window.briteverify_api_finished_first = false;
setTimeout(function() {
if(!window.briteverify_api_finished_first)
{
window.briteverify_timeout_finished_first = true;
onBVSuccess(email);
}
}, 2000);
// hit briteverify api (https://support.briteverify.com/javascript-api)
var data = {
username: 'pestes',
address: email
};
var url = 'https://bpi.briteverify.com/emails.json';
$.get(url, data, function (results) {
if(!window.briteverify_timeout_finished_first && results && results.status)
{
window.briteverify_api_finished_first = true;
if (results.status === 'invalid')
{
onBVError();
}
else
{
onBVSuccess(email);
}
}
},'jsonp');
}
function submitEmailToEC(email, lang) {
var lang = lang || 'esp'
var gdpr_consent_given = window.gdpr && window.gdpr.email_consent && window.gdpr.email_consent != null;
if ( gdpr_consent_given == null )
{
console.log('GDPR consent not given, email not captured');
displaySuccessMessage();
return;
}
var defer = jQuery.Deferred()
var baseURL = (window.location.href.search(/(\.stg\.)|(local)/i)>-1 ?
'https://www.stg' :
'https://www')
+ '.rosettastone.com/?redirect2mobile=no&p_p_id=rosettaajaxsubmit_WAR_rosettaajaxsubmitportlet&p_p_lifecycle=2&data=';
var data = {
email : email,
cis_name : 'GetOnTheList',
website: 'US_WEBSITE',
form_type : 'demo',
demo_lang: lang,
demo_type : isDesktop ? 'Specialoffer_Desktop' : 'Specialoffer_Mobile',
form_url : window.location.pathname,
cid : _satellite.getVar("mostrecentcampaign"),
newsletter_type : "Bottom_Landing_GOTL",
consent_type : ( window.gdpr && window.gdpr.email_consent ) || null,
visit_country_code : ( window.gdpr && window.gdpr.country_code ) || null
}
var request = jQuery.ajax({
contentType: "application/json; charset=utf-8",
url: baseURL + encodeURIComponent(JSON.stringify(data)),
type: "GET",
data:data
});
request.done(function(msg) {
if (/"cisFlag":"true"/.test(msg))
{
// record the email in a cookie that expires in 30 days
RSUI.util.setCookie("curEmailIdsc",email)
RSUI.util.setCookie('demotaken', "1", 1, 30 * 1000 * 60 * 60 * 24);
//document.cookie = 'curEmailIdsc='+email+'; max-age='+60*60*24*30+'; path=/;';
defer.resolve('success')
}
else
{
onBVError()
}
})
return defer.promise()
}
// end SubmitEmailToEC
function fireAnalytics()
{
s.events = '';
s.events = s.events+', event54';
s.tl()
}
function displaySuccessMessage ()
{
$('.rto-body').hide()
$('.rto-header').html('Thank you! Check your inbox for your exclusive offer!')
window.setTimeout(function() {
$('.rto-wrapper').fadeOut(3000)
}, 3000)
}
$('.rto-close').click(function(e) {
e.preventDefault();
$('.rto-wrapper').slideUp()
})
$('.rto-close').click(function(e) {
e.preventDefault();
$('.rtoblob-wrapper').fadeOut()
$('.rto-overlay').fadeOut()
})
/** Show blob only if user is about to exit **/
var hasBlobBeenShown = false;
$("body").mousemove(function(e) {
if (hasBlobBeenShown)
{
return
}
var mousex= e.pageX;
var mousey = e.pageY;
//console.log(`x: ${mousex} y:${mousey}`)
var innerwidth = window.innerWidth
if ( (innerwidth - mousex) <= 300 && mousey <= 100 )
{
$('.rtoblob-wrapper').fadeIn()
$('.rto-overlay').fadeIn()
hasBlobBeenShown = true;
}
})
{
"email": "vjohn@rosettastone.com",
"demo_lang": "esp",
"cis_name": "mobile demo",
"website": "US_WEBSITE",
"form_type": "demo",
"demo_type": "Demo_Desktop",
"form_url": "homepage",
"newsletter_type": "Mid_Catalog_LearnPage",
"cid": "",
"consent_type": "implicit",
"visit_country_code": "US"
}