Mon Dec 18 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
<script>
        window.setTimeout(function() {
          ;(function() {
            var lang = selectedLang
            var fullLangName = $('#simplified_langselect_title strong').text().replace('Learn', '').trim()
        
            // Step 1:  Create dom nodes
            var productDescription = ''
            + '<div class="product-desc">'
            + '	<div class="oct_2016_language_header">Learn ' + fullLangName + '</div>'
            + '	<h3>Download + 24 month Subscription Box</h3>'
            + '	<p>'
            + '		Grab the classic Rosetta Stone box and get access to a 24 month'
            + '		subscription, which also includes a code to download Rosetta Stone'
            + '		on your computer. Featuring TruAccent® speech-recognition technology,'
            + ' 	it’s the only program that gets you talking like a local.'
            + '	</p>'
            + '	<div class="guarantee">'
            + '	 	<div></div>'
            + '		<div>'
            + '			<h3>PURCHASE WITH CONFIDENCE</h3>'
            + '			<p>'
            + '				No long-term commitments. Cancel anytime.'
            + '				30-Day Money back guarantee.'
            + '			</p>'
            + '		</div>'
            + '	</div>'
            + '</div>'
            ;
        
            var stripes = ''
            + '<svg class="gifting_bg" style="width: 100%; height: 100%; position: absolute; top: 0; left: 0; z-index: 0;" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid slice">'
            + '			<rect x="0" y="0" width="100%" height="100%" style="fill: url(#yllines);"></rect>'
            + '		</svg>'
            + '		<svg aria-hidden="" id="gifting_bg_defs" width="1px" height="1px" style="z-index: -1; position: absolute; left: -100vw; border: 5px solid black">'
            + '			<defs>'
            + '				<pattern id="redlines" x="0" y="0" width="20" height="100" patternUnits="userSpaceOnUse" patternTransform="rotate(50)"></pattern>'
            + '				<rect x="0" y="0" height="100" width="10" style="stroke: none; fill: #ffffff; fill-opacity: .10;"></rect>'
            + '				</pattern>'
            + '				<pattern id="redlinesb" x="0" y="0" width="20" height="100" patternUnits="userSpaceOnUse" patternTransform="translate(-6.1, 0) rotate(50)">'
            + '				<rect x="0" y="0" height="100" width="10" style="stroke: none; fill: #ffffff; fill-opacity: .10;"></rect>'
            + '				</pattern>'
            + '				<pattern id="yllines" x="0" y="0" width="30" height="100" patternUnits="userSpaceOnUse" patternTransform="translate(-1, 0) rotate(50)" style="display: inline;">'
            + '				<rect x="0" y="0" height="100" width="15" style="stroke: none; fill: #ffffff; fill-opacity: .15;"></rect>'
            + '				</pattern>'
            + '			</defs>'
            + '		</svg>'
            ;
        
            
            var index = RSI({cat:lang, lvl:'S5'}).length ? -1 : -2
        
            // This is the "Learn {lang}. Subscription Box. lorem lorem lorem.."
            $('.oct_2016_gold_bg .js_product_boxes_desktop').prepend(productDescription)
            
                        // $('.cddl_test_link').html('Rosetta Stone Subscription box')
            // The grey header over the product section
            $('.oct_2016_gold_bg .oct_2016_product_square.js_oct_2016_product').eq(index)
            .find('.oct_2016_product_square_content .oct_2016_product_square_header')
            .show().find('span').hide()
            //.html('24-MONTH')
              .siblings('div')
            .html('Download + 24 month Subscription Box')
            
            // Yellow stripes in gold bg section
            $('.oct_2016_container.oct_2016_gold_bg').append(stripes)
            
            // Mobile's "Looking for our CD ROM products" becomes this
            $('.cddl_test_link').html('Rosetta Stone Subscription box').removeClass('cddl_test_link')
        
            // Change msrp
            $('.oct_2016_gold_bg .oct_2016_multipay_strikeprice_square').html('$279')
        
            // Change price
            $('.oct_2016_gold_bg .js_oct_2016_price.js_cddl_media').html('179')
        
        
            // Change msrp
            $('.oct_2016_gold_bg .oct_2016_product_square.js_oct_2016_product').eq(index)
            .find('.js_oct_2016_price.js_cddl_media').eq(0)
            .html('179')
        
            // Step 2: magic
            var productImg, ptoSku, msrp;
            switch (lang)
            {
              case 'eng':
                productImg = 'English_box_DL_24.png'
                ptoSku = 91190
                break;
              case 'fra':
                productImg = 'French_box_DL_24.png'
                ptoSku = 91192					
                break;
              case 'deu':
                productImg = 'German_box_DL_24.png'
                ptoSku = 91194			
                break;
              case 'ita':
                productImg = 'Italian_box_DL_24.png'
                ptoSku = 91196				
                break;			
              case 'chi':
                productImg = 'Chinese_box_DL_24.png'
                ptoSku = 91200				
                break;
              case 'jpn':
                productImg = 'Japanese_box_DL_24.png'
                ptoSku = 91208						
                break;
              default:
                productImg = 'Agnostic_box_DL_24.png'
                ptoSku = 91187					
                break;
            }
        
            $('.oct_2016_gold_bg .oct_2016_product_square.js_oct_2016_product')
            .css({
              'background-image' : 'url("https://www.rosettastone.com/lp/globals/img/retailboxes/' + productImg + '")'
            })
            var cartindex = RSI({cat:lang, lvl:'S5'}).length ? 2 : 1

            $cartButton = $('.oct_2016_gold_bg .oct_2016_addtocart_square.js_oct_2016_addtocart.js_cddl_media').eq(cartindex)

            var currentHref = $cartButton.attr('href')

            // replace promocode, if any            
            currentHref = currentHref.replace(/([\?&])pc=([^&]*)/, '$1pc=SR_Sitewide_Sale')
            
            var newHref = currentHref.replace(/\/sku\/\d+/i, '/sku/' + ptoSku)
            $cartButton.attr('href', newHref)
            $('.oct_2016_gold_bg .oct_2016_product_square.js_oct_2016_product input').unbind()
            .click(function() {
              var href = $cartButton.attr('href')
              var symbol = href.indexOf('?') == -1 ? '?' : '&'
              href = $(this).is(':checked') ? href + symbol + 'gifting=1' : href.replace(symbol + 'gifting=1', '')  
              $cartButton.attr('href', href)
            })
          })();
        }, 3000)				
    </script>