Fri Sep 16 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
let trmarkup = `<tr>
    <td class="spo_input online">
        <label data-rsiquery="{&#x22;media&#x22;: &#x22;subscription&#x22;, &#x22;lvl&#x22;: &#x22;1&#x22;}">
            <span>
                <input class="spo_radio" type="radio" name="olselect">
                <span class="spo_lvl">1 Month</span>
            </span>
            <span class="spo_price">$11.99</span>
        </label>
        <label data-rsiquery="{&#x22;media&#x22;: &#x22;subscription&#x22;, &#x22;lvl&#x22;: &#x22;12&#x22;}">
            <span>
                <input class="spo_radio" type="radio" name="olselect">
                <span class="spo_lvl">12 Month</span>
            </span>
            <span class="spo_price">$233</span>
        </label>
        <label data-rsiquery="{&#x22;media&#x22;: &#x22;subscription&#x22;, &#x22;lvl&#x22;: &#x22;lifetime&#x22;}">
            <span>
                <input class="spo_radio" type="radio" name="olselect">
                <span class="spo_lvl">Lifetime</span>
            </span>
            <span class="spo_price">$340</span>
        </label>
    </td>
    <td class="table-break">
    </td>
    <td class="spo_input download">
        <label data-rsiquery="{&#x22;media&#x22;: &#x22;download&#x22;, &#x22;lvl&#x22;: &#x22;L1&#x22;}">
            <span>
                <input class="spo_radio" type="radio" name="dlselect">
                <span class="spo_lvl">Level 1</span>
            </span>
            <span class="spo_price">$11.99</span>
        </label>
        <label data-rsiquery="{&#x22;media&#x22;: &#x22;download&#x22;, &#x22;lvl&#x22;: &#x22;S3&#x22;}">
            <span>
                <input class="spo_radio" type="radio" name="dlselect">
                <span class="spo_lvl">Levels 1-3</span>
            </span>
            <span class="spo_price">$233</span>
        </label>
        <label data-rsiquery="{&#x22;media&#x22;: &#x22;download&#x22;, &#x22;lvl&#x22;: &#x22;S5&#x22;}">
            <span>
                <input class="spo_radio" type="radio" name="dlselect">
                <span class="spo_lvl">Levels 1-5</span>
            </span>
            <span class="spo_price">$340</span>
        </label>
    </td>
</tr>`;

let spo_styles = `
<style>
    .spo_input label,  .spo_cd_upsell{
        display: flex;
        flex-flow: row nowrap;
        justify-content: space-between;
        margin: 1.33em auto;
        max-width: 15em;
    }
    .blockbuy .product-table{
        max-width: 60em;
    }
    .spo_cd_upsell {
        outline: 1px solid gray;
        padding: .75em;
    }
    .spo_cd_upsell input {
        margin-right: .5em;
    }
</style>
`;

//Remove CD column:
$('.product-table tbody td:last-child').remove();
//Change download column header copy:
$('.product-table th:last-child').text('DOWNLOAD')
$('.product-table tbody tr:nth-child(1) td:last-child p:first-child').text('INSTANT DOWNLOAD');

$('.product-table:eq(0) tbody tr:nth-child(2)').add('.product-table:eq(1) tbody tr:nth-child(1)').after($(trmarkup));
$('head').append($(spo_styles));
$('.dl-btn').after($('<label class="spo_cd_upsell"><span><input type="checkbox"><span>CD backup</span></span><span>+ $25.00</span></label>'));

$('.product-table tr:first-child td:first-child .dd').html($('.product-table tr:first-child td:first-child .dd').html().replace('total access','<b style="font-weight: bolder; color: black;">total access</b>').replace('for 24 months', ''));
$('.product-table tr:first-child td:nth-child(3) .dd').html('Own our desktop course <b style="font-weight: bolder; color: black;">forever</b><br>with Instant Download');
$('.product-table span.sale-price').remove();
var $lengthli = $('.product-table tbody tr:nth-child(2) td:first-child ul li:first-child');
$lengthli.html( 'Unlimited access for selected duration' );

function _resolveCartUrl(checkfunction_pairs, input_url){
    var ret = input_url;
    for(var l = checkfunction_pairs.length, i = 0; i < l; i++){
        ret = checkfunction_pairs[i][checkfunction_pairs[i][0].checked ? 1 : 2](ret)
    }
    return ret;
}
var fpairs = [];
(function buildpairs(fp){
    var upsell = document.querySelector('.spo_cd_upsell input');
    !!upsell && fp.push([upsell, 
        function do_upsell(t){ return t.replace(/\/category_id\/(...)(?:\/)?(?:related_sku\/\d+\/)?/i, '/category_id/$1/related_sku/52317/') },
        function undo_upsell(t){ return t.replace(/\/related_sku\/\d+/i, '') }]);

})(fpairs);
var getCatalogUrl = _resolveCartUrl.bind(this, fpairs);

$('.spo_cd_upsell input').on('change', function(el){
    console.log('check_change');
    $('.spo_cd_upsell input').prop('checked', $(this).prop('checked'));
})

$('.spo_input [data-rsiquery]').each(function(i,el){
  //console.log('%O', $(el).data('rsiquery') ); 
  var product_info = RSI( $(el).data('rsiquery') );
  //console.log('%O', product_info);
  var $el = $(el);
   
});