- 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
- 236
- 237
- 238
- 239
- 240
- 241
- 242
- 243
- 244
- 245
- 246
- 247
- 248
- 249
- 250
- 251
- 252
- 253
- 254
- 255
- 256
- 257
- 258
- 259
- 260
- 261
- 262
- 263
- 264
- 265
- 266
- 267
- 268
- 269
- 270
- 271
- 272
- 273
- 274
- 275
- 276
- 277
- 278
- 279
- 280
- 281
- 282
- 283
- 284
- 285
- 286
- 287
- 288
- 289
- 290
- 291
- 292
- 293
- 294
- 295
- 296
- 297
- 298
- 299
- 300
- 301
- 302
- 303
- 304
- 305
- 306
- 307
- 308
- 309
- 310
- 311
- 312
- 313
- 314
- 315
- 316
- 317
- 318
- 319
- 320
- 321
- 322
- 323
- 324
- 325
- 326
- 327
- 328
- 329
- 330
- 331
- 332
- 333
- 334
- 335
- 336
- 337
- 338
- 339
- 340
- 341
- 342
- 343
- 344
- 345
- 346
- 347
- 348
- 349
- 350
- 351
- 352
- 353
- 354
- 355
- 356
- 357
- 358
- 359
- 360
- 361
- 362
- 363
- 364
- 365
- 366
- 367
- 368
- 369
- 370
- 371
- 372
- 373
- 374
- 375
- 376
- 377
- 378
- 379
- 380
- 381
- 382
- 383
- 384
- 385
- 386
- 387
- 388
- 389
- 390
- 391
- 392
- 393
- 394
- 395
- 396
- 397
- 398
- 399
- 400
- 401
- 402
- 403
- 404
var isDesktop = (function() {
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)){
return false
}else{
return true
}
})();
/*
* How overlays work:
* In the html, give all triggers a .overlay-trigger class
* and overlay=<id> where id is the id of the div to show
* inside the overlay. Put overlays inside
* the <div id='overlays'></div> element
*/
var $overlays = $('#overlays')
$('.overlay-trigger').click(function(e) {
e.preventDefault()
var overlay_to_show = '#' + $(this).data('overlay')
if (!isDesktop && overlay_to_show == '#overlay-photos') {
return
}
$overlays.fadeIn()
$overlays.find(overlay_to_show).fadeIn()
})
$overlays.find('a.close').click(function(e) {
e.preventDefault()
var $visible_overlay = $overlays.find('> div:visible')
$visible_overlay.fadeOut()
$overlays.fadeOut()
// stop any videos if this overlay has one
var id = $visible_overlay.find('iframe').attr('id')
try {
players[id].stopVideo()
} catch(e) {}
})
/* These are overlays for the photos section
* they require a bit of extra work because they
* contain a slider, and some paragraph with each image.
* Each img should have the paragraph text in
* data-text=...
*/
if (isDesktop) {
$photo_div = $overlays.find('#overlay-photos').find('.photo')
$('.photos > img').click(function(e) {
e.preventDefault()
// This chapters images. Will be used in overlay slideshow
var $images = $(this).parent().children()
// Get index of image clicked so we open slideshow on it
var index = $images.index($(this))
// Change the empty img src inside lightbox to the src of img just clicked
$photo_div.find('img').attr('src', $(this).attr('src').replace('__Thumbs/', ''))
// Handle next/prev clicks. We simply update the img src and data-text
$('span.prev, span.next').click(function(e) {
if ($(this).attr('class') == 'prev')
index = typeof $images[index - 1] != 'undefined' ? --index : $images.length
if ($(this).attr('class') == 'next')
index = typeof $images[index + 1] != 'undefined' ? ++index : 0
var image_to_show = $images.get(index)
// Image animation effects
var $img = $photo_div.find('img')
$img.attr('src', $(image_to_show).attr('src').replace('__Thumbs/', ''))
})
})
}
// Scroll to sweepstakes section when a cta is clicked.
/*$('a[href^="#woobox"]').on('click', function(e) {
e.preventDefault()
var target = $(this.getAttribute('href'))
$('html, body').stop().animate({
scrollTop: (target.offset().top - $('#nav').height()) + 'px'
}, 1000)
})*/
$('a.sweepstakes').eq(0).click(function() {
var $target = $('.demo-cta').eq(0)
scroll($target)
$target.find('a').click()
})
$('div.avventura a').click(function() {
scroll($('a[href^="#1"]'))
})
// Handles newsletter form submission
$('#newsletter form').submit(processForm)
// Shows demo forms, and handles submission
$('#chapters').on('click', '.demo-cta a', function(e) {
e.preventDefault()
$(this).siblings('form').slideDown().submit(processForm)
})
// Scrolls to a target on the page
function scroll(target) {
$('html, body').stop().animate({
scrollTop: (target.offset().top - $('#nav').height()) + 'px'
}, 1000)
}
// Scroll to chapter when image in overlay is clicked
$('#overlay-checkpoints-grid li a').click(function(e) {
e.preventDefault()
$(this).parents('#overlay-checkpoints-grid').find('a.close').click()
scroll($('a[href^="#' + $(this).data('scrollto') + '"]'))
})
// scroll to a chapter if theres a url param
if (grabUrlParam('chapter')) {
scroll($('a[href^="#' + grabUrlParam('chapter') + '"]'))
}
/*
* Grabs a url param from the url.
* returns null if not found
*/
function grabUrlParam(name) {
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
return null;
else
return results[1];
}
$(function() {
$(document).trigger('demo_events_version',{version: 1})
})
/*
* Handles form submissions such as demo
* or newsletter updates
*/
function processForm(e) {
e.preventDefault()
$loader = $(e.target).find('div.loader')
$notification = $(this).find('div.notification')
// hide previous error, if any
$notification.hide()
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);
}
// not using input[type=email] because its ie10+
var email = $(this).find('input:first-of-type').val()
var langcode = $(this).find('select').val()
if (!validateEmail(email)) {
$notification.fadeIn()
return
} else {
$notification.fadeOut()
}
//briteverify sometimes takes a while, show loader now
$loader.show()
// data to send to ec
var data = {
email : email,
cis_name : 'Flash demo',
newsletter_type : $(this).data('newslettertype'),
website: 'US_WEBSITE',
form_url : 'avventura',
cid : grabUrlParam('cid') || ''
};
// Need to send a few extras values to EC if its demo form
if (data.newsletter_type == 'Top_Landing_Peterdemo') {
data.demo_lang = langcode
data.form_type = 'demo'
data.demo_type = isDesktop ? 'Demo_Desktop' : 'Demo_Mobile'
}
// called by briterify if email is valid
var success = function() {
$notification.hide()
$loader.hide()
var save_url = (window.location.href.match(/www.rosetta/) ? 'http://www' : 'http://www.stg')
+ '.rosettastone.com/?p_p_id=rosettaajaxsubmit_WAR_rosettaajaxsubmitportlet&p_p_lifecycle=2&redirect2mobile=no';
var request = $.ajax({
url: save_url,
type: "POST",
data: data
})
.done(function(msg) {
if (JSON.parse(msg)[0]['cisFlag'] == 'true') {
if (data.newsletter_type == 'Top_Landing_Peterupdates') {
/* This was an email submission for newsletter */
$('#newsletter').html("<h1 style='font-size:2.5em;margin-bottom: 10px'>Thanks!</h1>You'll receive updates about Peter as he travels down the boot.")
if (RSUI.util.getCookie('avventura_newsletter') == null) {
RSUI.util.setCookie('avventura_newsletter', "1", 1, 30 * 1000 * 60 * 60 * 24);
var days_til_expiration = 30;
var expiration = new Date(new Date().getTime() + days_til_expiration*24*60*60*1000).toUTCString();
s.events = "event19, event119"
s.tl()
delete s.events;
}
/*****************************************************************************************
AMOBEE LEAD CONVERSION PIXEL
Other names: Adconion, amgdgt
Owners: Caitlin and Nakesa
Placements: all demos and peterb signups (/lp/peter/)
Purpose: tracking leads
Other notes: the CID should start with: ba-bn-ab
Date added: July 7, 2016
*****************************************************************************************/
try{
(function amobee_adconion() {
var cid = 'ba-bn-ab';
if(window.location.href.match(cid) || document.referrer.match(cid)){
var cachebuster = Math.floor(Math.random()*999999999999);
var amobee_pixel = document.createElement('img');
amobee_pixel.setAttribute('src','https://ad.amgdgt.com/ads/?t=ap&px=69698&rnd='+cachebuster);
amobee_pixel.setAttribute('width','1');
amobee_pixel.setAttribute('height','1');
amobee_pixel.setAttribute('border','0');
document.body.appendChild(amobee_pixel);
}
})();
}
catch(e){}
} else {
/* This was an email submission for demo */
if (RSUI.util.getCookie('demotaken') == null) {
$(document).trigger('demo_email',{email: email})
RSUI.util.setCookie('demotaken', "1", 1, 30 * 1000 * 60 * 60 * 24);
var days_til_expiration = 30;
var expiration = new Date(new Date().getTime() + days_til_expiration*24*60*60*1000).toUTCString();
document.cookie='rsDemoEmail='+email+'; expires='+expiration+'; path=/; domain=.rosettastone.com';
}
open_demo(langcode)
}
}
})
}.bind(this, data)
var invalid = function() {
$notification.fadeIn()
$loader.hide()
}
verify_real_email(email, success, invalid)
}
/*
* Opens demo by creating iframe.
* Also stores data in ec
*
* @param {langcode} str
* 3 letter language code (ita, esp, etc)
*/
function open_demo(langcode) {
var langcode = langcode || 'ita'
var langmap = {
'fra': 'en-fr',
'deu': 'en-de',
'ita': 'en-it',
'eng': 'en-en',
'esp': 'en-es'
}
var stg_or_not = window.location.href.match(/\.stg\./i) ? 'stg.':'';
var demourl = 'http://resources.' + stg_or_not + 'rosettastone.com/CDN/us/rs-i-demo-6/?lang=' + langmap[langcode]
var demoFrame = ""
+ "<iframe "
+ " id='demo'"
+ " src='"+ demourl + "'"
+ " width='100%'"
+ " height='100%'"
+ " scrolling='no'"
+ "></iframe>"
;
$(document).trigger('demo_start')
if (isDesktop) {
$overlays.show().find('#overlay-demo')
.show()
.find('.overlay-content > .iframe')
.append(demoFrame)
} else {
window.location.href = demourl
}
}
/**************************************************
BRITEVERIFY EMAIL VERIFICATION
***************************************************/
function get_token(){
window.briteverifyToken = false;
var form_token = '4047df1c-5078-4e96-b335-f61aa2b92891'; // public key
var url = 'https://forms-api-v1.briteverify.com/api/submissions/view.json?callback=getBriteverifyToken&form_token='+form_token+'&_='+Date.now();
// append script to body to get cross-domain jsonp data
var script = document.createElement('script');
script.src = url;
document.body.appendChild(script);
window.getBriteverifyToken = function(data){
window.briteverifyToken = data.token;
delete window.getBriteverifyToken;
document.body.removeChild(script);
}
}
// if the demo hasn't already been taken, get an email verification token
if(!RSUI.util.getCookie('demotaken')) {
get_token();
}
function verify_real_email(email,success,failure){
if(window.briteverifyToken) {
var token = window.briteverifyToken;
var url = 'https://forms-api-v1.briteverify.com/api/submissions/verify.json?callback=briteverify&form_token=4047df1c-5078-4e96-b335-f61aa2b92891&token='+token+'&email='+email+'&_='+Date.now();
var script = document.createElement('script');
script.src = url;
document.body.appendChild(script);
// if the script url doesn't work (maybe they changed the api)
script.onerror = function(e) {
};
window.briteverify = function(data){
try {
// if email is valid
if(data.status!=='invalid'){
success()
} else {
failure();
}
document.body.removeChild(script);
} catch(e) {
success();
}
delete window.briteverify;
}
} else {
// if no token, ignore verification and move on
success();
}
}