Wed Apr 12 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
  • 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
function __setECPopup($){
var popuphtml = `
<div class="__ecPopup">
    <div class="__ecPopup_dialog">
        <div class="__ecPopup_dialog_head">
            <svg width="4em" height="2em">
                <use xlink:href="#rs_svglogo" />
            </svg>
            <span class="__ecPopup_quit">&#x274c;</span>
        </div>
        <h2><span>Deals.</span> <span><b>Discount</b>.</span> <span>Fun</span></h2>
        <p>Be the first to receive exclusive offers, news, learning tips and more!</p>
        <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_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: white;
    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: black;
    border: none;
}
#__ecPopup_ecForm label span {
    position: absolute;
    color: gray;
    left: .5em;
    top: .5em;
    display: inline-block;
    background: white;
    box-sizing: border-box;
}


#__ecPopup_ecForm label input:valid + span {
    top: -1.2em;
    color: black;
    background: transparent;
}
#__ecPopup_ecForm label input:focus + span {
    top: -1.2em;
    color: black;
    background: transparent;
}
#__ecPopup_ecForm input[type="submit"]{
    margin: 1em auto .5em auto;
    display: block;
    padding: .75em;
    width: 90%;
    text-align: center;
    font-family: GothamBook, sans-serif;
    font-weight: bold;
    background-color: #FABF2C;
    border: none;
    box-shadow: 1px 1px 4px -2px black;
    color: #333;
    cursor: pointer;
}
.__ecPopup_sideimage {
    display: block;
    position: absolute;
    bottom: 1em;
    right: -1em;
    width: 9em;
    height: 9em;
    outline: none;
    
    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 h2 {
        font-size: 2.5em;
    }

    .__ecPopup_dialog p, #__ecPopup_ecForm {
        font-size: 1.5em;
    }

    #__ecPopup_ecForm label span {
        top: .4em;
    }

    #__ecPopup_ecForm label input[type="email"] {
        padding: .45em;
    }
    #__ecPopup_ecForm input[type="submit"]{
        padding: 1em;
        box-shadow: 2px 2px 7px -2px black;
    }
    .__ecPopup_sideimage {
        display: block;
        position: absolute;
        bottom: 1em;
        right: -3.9em;
        width: 18.3em;
        height: 13.4em;
        
    }

}
</style>
`;
if($('.__ecPopup').length){
    $('.__ecPopup').css('display','block');
    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('click','.__ecPopup', function(ev){
        if($(ev.target).is('.__ecPopup')){
           __clearECPopup(); 
        }
    });
}

}

function __clearECPopup(){
    $('.svglogo g g:first-child > path').attr('fill','#231F1F');
    $('.__ecPopup').css('display','none');
}

function __genericEC(emailval){
    return jQuery.post('http://www.rosettastone.com?p_p_id=rosettaajaxsubmit_WAR_rosettaajaxsubmitportlet&p_p_lifecycle=2', {
            email: emailval,
            cis_name: 'WS1759Test',
            newsletter_type: "DTC_newsletter",
            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($);
    }
}

__setECPopup($);

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

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