Thu Oct 20 2016
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
var boxmarkup = `
<div class="spo4_product">
    <div class="g">
      <h3 class="spo4_title">3 Month</h3>

      <h4>Access</h4>
    </div>
    <span class="spo4_price"><sup>$</sup><span class="monthly">26</span>
        <span> / Month</span>
    </span>

    <div class="g">
      
      <a href=
      "https://secure.rosettastone.com/us_en_store_view/checkout/cart/add/sku/24362/category_id/eng/?pc=amsterdam_S5">
      Add to Cart</a>
      <form class="gift"><label><input type="checkbox">Give as a gift!</label></form>
      <span class="spo4_sub">$<span class="spo4_full">79</span> due at
      purchase</span>
    </div>
</div>
`;

var spo_styles = `
<style>
    .spo4_price sup,
    .spo4_product h3 {
        font-family: GothamBold, sans-serif;
        font-size: 1.5em
    }
    .spo4_product {
        display: flex;
        flex-flow: column nowrap;
        justify-content: space-around;
        align-items: center;
        margin: 1.25em;
        width: 15em;
        height: 15em;
        background-color: white;
        border: 2px solid #ddd;
        padding: 0 1em;
    }
    
    .spo4_product .g {
        align-items: center;
        display: flex;
        flex-flow: column
    }
    .spo4_product h3 {
        font-size: 1.33em;
        font-weight: 700;
        margin-top: .5em;
        text-transform: uppercase;
    }
    .spo4_product .g h4 {
        text-transform: uppercase;
    }
    .spo4_product .g:first-child::after {
        content: "";
        display: block;
        width: 12em;
        height: 1px;
        margin-top: 1.5em;
        border-top: .15em solid #ccc;
    }
    .spo4_price sup {
        position: relative;
        top: -.5em;
        color: #0098db;
    }
    .spo4_price .monthly {
        font-family: GothamMedium, sans-serif;
        font-size: 2.75em;
        color: #0098db;
    }
    .spo4_price span:nth-child(3) {
        
        font-size: 1.25em;
        font-family: GothamLight;

    }
    .spo4_product a {
        font-family: GothamMedium, sans-serif;
        font-size: .93em;
        padding: .8em;
        width: 10em;
        background: #0098db;
        border-radius: 3px;
        color: #fff;
        text-decoration: none;
        text-transform: uppercase;
        text-align: center;
    }
    .spo4_product .gift {
        padding: .33em 0;
        font-family: GothamLight;
        vertical-align: middle;
        margin-top: .5em;

        
    }
    .spo4_product .gift label{
        display: flex;
        flex-flow: row nowrap;
        justify-content: space-around;
    }
    .spo4_sub {
        margin-top: .33em;
        font-size: .75em;
        font-family: GothamLight;
    }
</style>
`;



var spo_products = [
    {'lvl': '01', 'media': 'subscription'},
    {'lvl': '06', 'media': 'subscription'},
    {'lvl': '12', 'media': 'subscription'},
    {'lvl': '24', 'media': 'subscription'}
];

var monthly_index = {
    "03": 23,
    "06": 15,
    "12": 12,
    "24": 10
};


$('head').append($(spo_styles));

var spo_elements = spo_products
    .map(function(v){ var inf = RSI(v); return inf.length ? inf[0] : null })
    .filter(function(v){ return v; })
    .map(function(v){
        var $el = $(boxmarkup);
        var islifetime = !!(v.lvl == 'lifetime');
        $el.find('.spo4_title').text( islifetime ? 'Lifetime' : parseInt(v.lvl, 10) + ' Month'  );
        monthly_index[v.lvl] && $el.find('.spo4_price .monthly').text(monthly_index[v.lvl]);
        if(islifetime){
            $el.find('.spo4_price .monthly ~ span').remove();
            $el.find('.spo4_sub').text('One time payment');
        }
        else {
            $el.find('.spo4_full').text( v.price );
        }
        $el.find('a').attr('href', v.cart);
        return $el;
    });

// spo_elements.push( (function(v){
//         var $el = $(boxmarkup);
//         $el.find('.spo4_title').text( 'Lifetime'  );
//         monthly_index[v.lvl] && $el.find('.spo4_price .monthly').text(monthly_index[v.lvl]);
//         $el.find('.spo4_full').text( v.price );
//         return $el;
//     })({lvl: "lifetime"}) );


$('.blockbuy')
    .empty()
    .css({display: 'flex', "flex-flow": "row wrap", "justify-content": "center"})
    .append(spo_elements);

$('img[src*="lockup"]').attr('src', '../assets/catalog16/subs_lock.png');