Last active
May 19, 2016 21:53
-
-
Save tobsn/2767881bdeb343f8857c43e81ac70f8b to your computer and use it in GitHub Desktop.
clickfunnel snippets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="de elInputWrapper elSelectFormBox de-editable de-input-block elAlign_center elMargin0" id="tmp_select_input-97365" data-de-type="select-input" data-de-editing="false" data-title="select input form" data-ce="false" data-trigger="none" data-animate="fade" data-delay="500" type="state" style="margin-top: 10px; outline: none; cursor: pointer;"> | |
| <label class="elInputLabel"> | |
| <select name="state" class="elInput elSelectInput elInput100 elAlign_left elInputMid elInputStyl0 elInputBG1 elInputBR5 elInputI0 elInputIBlack elInputIRight required0 elInput-Select1 garlic-auto-save" data-type="state"> | |
| <option value="AL">Alabama</option> | |
| <option value="AK">Alaska</option> | |
| <option value="AZ">Arizona</option> | |
| <option value="AR">Arkansas</option> | |
| <option value="CA">California</option> | |
| <option value="CO">Colorado</option> | |
| <option value="CT">Connecticut</option> | |
| <option value="DE">Delaware</option> | |
| <option value="DC">District of Columbia</option> | |
| <option value="FL">Florida</option> | |
| <option value="GA">Georgia</option> | |
| <option value="HI">Hawaii</option> | |
| <option value="ID">Idaho</option> | |
| <option value="IL">Illinois</option> | |
| <option value="IN">Indiana</option> | |
| <option value="IA">Iowa</option> | |
| <option value="KS">Kansas</option> | |
| <option value="KY">Kentucky</option> | |
| <option value="LA">Louisiana</option> | |
| <option value="ME">Maine</option> | |
| <option value="MD">Maryland</option> | |
| <option value="MA">Massachusetts</option> | |
| <option value="MI">Michigan</option> | |
| <option value="MN">Minnesota</option> | |
| <option value="MS">Mississippi</option> | |
| <option value="MO">Missouri</option> | |
| <option value="MT">Montana</option> | |
| <option value="NE">Nebraska</option> | |
| <option value="NV">Nevada</option> | |
| <option value="NH">New Hampshire</option> | |
| <option value="NJ">New Jersey</option> | |
| <option value="NM">New Mexico</option> | |
| <option value="NY">New York</option> | |
| <option value="NC">North Carolina</option> | |
| <option value="ND">North Dakota</option> | |
| <option value="OH">Ohio</option> | |
| <option value="OK">Oklahoma</option> | |
| <option value="OR">Oregon</option> | |
| <option value="PA">Pennsylvania</option> | |
| <option value="RI">Rhode Island</option> | |
| <option value="SC">South Carolina</option> | |
| <option value="SD">South Dakota</option> | |
| <option value="TN">Tennessee</option> | |
| <option value="TX">Texas</option> | |
| <option value="UT">Utah</option> | |
| <option value="VT">Vermont</option> | |
| <option value="VA">Virginia</option> | |
| <option value="WA">Washington</option> | |
| <option value="WV">West Virginia</option> | |
| <option value="WI">Wisconsin</option> | |
| <option value="WY">Wyoming</option> | |
| </label> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // needs a id="ordertotal" element - adds 8 dollar for s&h, see code | |
| $(document).ready(function() { | |
| $('input[type=radio][name="purchase[product_id]"]').change(function(){ | |
| $('#ordertotal').text('$'+((Number($(this).siblings('.elOrderProductOptinPrice').text().replace(/[^0-9\.]+/g,''))||0)+8)); | |
| }); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'garlic:'+document.location.host+'*>input.address' | |
| 'garlic:'+document.location.host+'*>input.city' | |
| 'garlic:'+document.location.host+'*>input.email' | |
| 'garlic:'+document.location.host+'*>input.name' | |
| 'garlic:'+document.location.host+'*>input.phone' | |
| 'garlic:'+document.location.host+'*>input.shipping_address' | |
| 'garlic:'+document.location.host+'*>input.shipping_city' | |
| 'garlic:'+document.location.host+'*>input.shipping_state' | |
| 'garlic:'+document.location.host+'*>input.shipping_zip' | |
| 'garlic:'+document.location.host+'*>input.state' | |
| 'garlic:'+document.location.host+'*>input.zip' | |
| 'garlic:'+document.location.host+'*>select.country' | |
| 'garlic:'+document.location.host+'*>select.shipping_country' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var ordertotal=0; | |
| $('div[data-cf-product-price="true"]').each(function(i,d){ | |
| ordertotal += Number($(this).text().replace(/[^0-9\.]+/g,'')) | |
| }); | |
| $('#ordertotal').text('$'+ordertotal); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- TOTAL & TAX CALCULATIONS --> | |
| <!-- ONLY EDIT SHIPPINGPRICE IF NEEDED! --> | |
| <script type="text/javascript"> | |
| var _SHIPPINGPRICE=8 | |
| $(function() { | |
| var _TAXOBJ={default:[]}; | |
| $('label[data-cf-product-name=true]').each(function(){ | |
| var t=$(this),p=t.closest('div.elOrderProductOptinProducts'),m=i=-1; | |
| if(m=t.text().match(/^\[([a-z]{2}):(\d+\.\d+):(\d+\.\d+)\]/i)){ | |
| i=t.siblings('input[type="radio"]'); | |
| i.attr('data-taxesbrutto',m[3]); | |
| i.attr('data-taxesnetto',m[2]); | |
| i.attr('data-taxstate',m[1]); | |
| t.text(t.text().replace(/^(\[[a-z]{2}:\d+\.\d+:\d+\.\d+\]\s+?)/i,'')); | |
| _TAXOBJ[m[1]]||(_TAXOBJ[m[1]]=[]); | |
| _TAXOBJ[m[1]].push(p); | |
| p.hide(); | |
| } | |
| else { | |
| _TAXOBJ.default.push(p); | |
| } | |
| }); | |
| $('select[name="state"]').change(function(){ | |
| var state = $('option:selected', this).val(); | |
| $('div.elOrderProductOptinProducts').hide(); | |
| _TAXOBJ[state]||(state='default'); | |
| $.each(_TAXOBJ[state],function(i,v){ | |
| v.show(); | |
| }); | |
| if( $('input[type="radio"][name="purchase[product_id]"]:checked:visible').length == 0 ) { | |
| _TAXOBJ[state][0].find('input[type="radio"][name="purchase[product_id]"]').prop('checked',true).trigger('change'); | |
| } | |
| $('table#taxline').toggle((state!=='default')); | |
| $('table#taxline').parent().parent().prev('div.elSeperator').toggle((state!=='default')); | |
| }); | |
| $('input[type=radio][name="purchase[product_id]"]').change(function(){ | |
| var t = $('input[type=radio][name="purchase[product_id]"]:checked'), | |
| price = ( Number( t.siblings('.elOrderProductOptinPrice').text().replace(/[^0-9\.]+/g,'') ) || 0 ), | |
| total = price+_SHIPPINGPRICE, | |
| tax = 0; | |
| if( t.attr('data-taxesbrutto') ) { | |
| total = t.attr('data-taxesbrutto'); | |
| $('#taxamount').text( '$' + Number( t.attr('data-taxesbrutto') - t.attr('data-taxesnetto') ).toFixed( 2 ) ); | |
| } | |
| $('#ordertotal').text('$'+total); | |
| }); | |
| // multiple change triggers for slow loading CF resources | |
| for(var i=0;i<3;i++){ | |
| setTimeout(function(){ | |
| $('select[name="state"]').trigger('change'); | |
| $('input[type=radio][name="purchase[product_id]"]').trigger('change') | |
| },(i*1000)+1); | |
| } | |
| }); | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment