Thu Apr 13 2017
Copied to clipboard! Copy reply
  • 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
function __setECPopup($){
var popuphtml = '<div class=__ecPopup><div class=__ecPopup_dialog aria-describedby=ecd_p aria-labelledby=ecd_h2 role=dialog><div class=__ecPopup_dialog_head><svg height=2.5em width=5em><use xlink:href=#rs_svglogo /></svg> <span aria-role=button class=__ecPopup_quit tabindex=0>āŒ</span></div><h2 id=ecd_h2><span>Deals.</span> <span><b>Discount</b>.</span> <span>Fun</span></h2><p id=ecd_p>Be the first to receive exclusive offers, news, learning tips and more!<form id=__ecPopup_ecForm><label><input type=email maxlength=100 required> <span>Your Email</span></label><input type=submit value="GET ON THE LIST!"></form><div class=__ecPopup_sideimage></div></div></div><style>.__ecPopup{position:fixed;display:block;top:0;bottom:0;left:0;right:0;background:rgba(0,0,0,.65);text-align:left;z-index:100;font-size:12px}.__ecPopup_quit{position:absolute;top:.75em;right:1em;cursor:pointer}.__ecPopup_quit:focus{outline:1px solid #fabf2c}.__ecPopup_dialog{font-family:GothamLight,"Gotham HTF Book",sans-serif;position:relative;top:50%;left:50%;transform:translate(-50%,-50%);background-color:#009bd0;display:inline-block;padding:.5em 1em 2em 1em;color:#fff;border-top:4px solid #fabf2c}.__ecPopup_dialog_head{display:block;width:100%}.__ecPopup_dialog h2{text-transform:uppercase;margin:.1em auto;font-weight:100}.__ecPopup_dialog h2 b{font-family:GothamMedium,"Gotham HTF Bold",sans-serif;font-weight:300}.__ecPopup_dialog p{max-width:15em;line-height:1.25;margin-top:.4em}#__ecPopup_ecForm{max-width:11.2em;position:relative;margin-top:1.5em}#__ecPopup_ecForm label{width:100%;font:inherit}#__ecPopup_ecForm label input{font:inherit}#__ecPopup_ecForm label input[type=email]{box-sizing:border-box;width:100%;padding:.45em;color:#000;border:none}#__ecPopup_ecForm label span{position:absolute;color:gray;left:.5em;top:.5em;display:inline-block;background:#fff;box-sizing:border-box}#__ecPopup_ecForm label input:valid+span{top:-1.2em;color:#000;background:0 0}#__ecPopup_ecForm label input:focus+span{top:-1.2em;color:#000;background:0 0}#__ecPopup_ecForm input[type=submit]{font-size:.75em;margin:1em auto .5em auto;display:block;padding:.5em;width:90%;text-align:center;font-family:GothamBook,sans-serif;font-weight:700;background-color:#fabf2c;border:none;box-shadow:1px 1px 4px -2px #000;color:#333;cursor:pointer}#__ecPopup_ecForm input[type=submit]:focus{outline:1px solid #bbb}.__ecPopup_sideimage{display:block;position:absolute;bottom:-1em;right:-3em;width:7.6em;height:9em;outline:0;background-size:contain;background-repeat:no-repeat}@media (min-width:375px){.__ecPopup_sideimage{background-image:url(http://www.rosettastone.com/assets/test/Phone.png)}}@media (min-width:375px){.__ecPopup{font-size:16px}}@media (min-width:800px){.__ecPopup_dialog{min-width:34em}.__ecPopup_dialog h2{font-size:2.5em}#__ecPopup_ecForm,.__ecPopup_dialog p{font-size:1.5em}#__ecPopup_ecForm label span{top:.4em;font-size:1em}#__ecPopup_ecForm label input[type=email]{padding:.5em}#__ecPopup_ecForm input[type=submit]{font-size:.7em;padding:1em;box-shadow:2px 2px 7px -2px #000}.__ecPopup_sideimage{display:block;position:absolute;bottom:1.6em;right:-3.9em;width:18.3em;height:15.5em}}</style>';
if($('.__ecPopup').length){
    $('.__ecPopup').css('display','block');
    setTimeout(__ECFocus, 500);
    return;
}
else {
    $('body').append(popuphtml);
    $('.svglogo').attr('id','rs_svglogo');
    $('.svglogo g g:first-child > path').attr('fill','white');
    $(document).on('submit','#__ecPopup_ecForm', function handleECSubmit(ev){
        ev.preventDefault();
        var email = $('#__ecPopup_ecForm input[type="email"]').val();
        __genericEC(email).always(__clearECPopup);
    });
    $(document).on('click','.__ecPopup_quit', __clearECPopup);
    $(document).on('keydown','.__ecPopup_quit', function(e){ 
        e.which == "13" && __clearECPopup();
        if(e.which == "9" && !!e.shiftKey){
            e.preventDefault();
            $('#__ecPopup_ecForm input[type="submit"]').get(0).focus();
        } 
    });
    $(document).on('keydown','#__ecPopup_ecForm input[type="submit"]', function(e){ 
        if(e.which == "9" && !e.shiftKey){
            e.preventDefault();
            $('.__ecPopup_quit').get(0).focus();
        } 
    });
    $(document).on('click','.__ecPopup', function(ev){
        if($(ev.target).is('.__ecPopup')){
           __clearECPopup(); 
        }
    });

    
    setTimeout(__ECFocus, 500);
    
}

}

function __ECFocus(){
    document.querySelector('#__ecPopup_ecForm input[type="email"]').focus();
}
function __clearECPopup(){
    $('.svglogo g g:first-child > path').attr('fill','#231F1F');
    $('.__ecPopup').css('display','none');
    document.body.focus();
}

function __genericEC(emailval){
    return jQuery.post('http://www.rosettastone.com?p_p_id=rosettaajaxsubmit_WAR_rosettaajaxsubmitportlet&p_p_lifecycle=2', {
            email: emailval,
            cis_name: 'Top_Catalog_LearnPage',
            demo_type: 'DealsSignup_Desktop',
            newsletter_type: "Top_Catalog_LearnPage",
            website: 'US_WEBSITE',
            form_url: "/personal",
            cid: jQuery.trim(RSUI.util.getCookie("affiliate"))
        }
    );
}

// Test via a getter in the options object to see if the passive property is accessed
var supportsPassive = false;
try {
  var opts = Object.defineProperty({}, 'passive', {
    get: function() {
      supportsPassive = true;
    }
  });
  window.addEventListener("test", null, opts);
} catch (e) {}

function _listenMouse(e){
    //console.log(e.screenY + '::' + _woh);
    if(e.screenY < _woh){
        window.clearTimeout(__ECTO);
        window.removeEventListener('mousemove', _listenMouse);
        __setECPopup($);
    }
}

var __ECTO, _woh;
$(function(){
    __ECTO = setTimeout(function(){
        !!supportsPassive && window.removeEventListener('mousemove', _listenMouse);
        __setECPopup($);
    }, 9000);

    if(!!supportsPassive){
        _woh = window.outerHeight*(0.1) + (window.outerHeight - window.innerHeight);
        window.addEventListener('mousemove', _listenMouse, {passive: true});
    }
});