| 1 |
jQuery(document).ready( function($) { |
| 2 |
$('body input[type="submit"]').each( function(i,e) { |
| 3 |
if( "confirm" == $(this).attr("name") ) { |
| 4 |
$(this).parents("form").attr("id","delivery-form"); |
| 5 |
$(this).parents("form").attr("name","delivery_form"); |
| 6 |
} |
| 7 |
}); |
| 8 |
if ( 'link' == escott_params.card_activate ) { |
| 9 |
var agree_dialog = '<div id="escott-agree-dialog">' |
| 10 |
+'<textarea class="escott_agreement_message" readonly>'+escott_params.message.agreement+'</textarea>' |
| 11 |
+'<div class="send agree_form_send">' |
| 12 |
+'<input type="button" id="escott_agree_cancel" class="back_to_delivery_button" value="'+escott_params.message.disagree+'" /> ' |
| 13 |
+'<input type="button" id="escott_agree_next" class="to_confirm_button" value="'+escott_params.message.agree+'" />' |
| 14 |
+'</div>' |
| 15 |
+'</div><input type="hidden" id="escott_agree" value="">'; |
| 16 |
// $("#delivery-form").after(agree_dialog); |
| 17 |
$(agree_dialog).appendTo($("#delivery-form")); |
| 18 |
$("#escott-agree-dialog .send").css("text-align","center"); |
| 19 |
$("#escott-agree-dialog").css("display","none"); |
| 20 |
} |
| 21 |
}); |
| 22 |
jQuery( function($) { |
| 23 |
$("#escott-agree-dialog").dialog({ |
| 24 |
bgiframe: true, |
| 25 |
autoOpen: false, |
| 26 |
height: "400", |
| 27 |
width: "200", |
| 28 |
resizable: true, |
| 29 |
modal: true, |
| 30 |
create: function() { |
| 31 |
$("#escott-agree-dialog").parent(".ui-dialog").attr("id","escott-dialog"); |
| 32 |
}, |
| 33 |
open: function() { |
| 34 |
}, |
| 35 |
close: function() { |
| 36 |
} |
| 37 |
}); |
| 38 |
|
| 39 |
$(document).on( "click", "#escott_agree_next", function(e) { |
| 40 |
$("#escott_agree").val("agree"); |
| 41 |
$("#escott-agree-dialog").dialog("close"); |
| 42 |
var element = document.createElement("input"); |
| 43 |
element.setAttribute("type","hidden"); |
| 44 |
element.setAttribute("name","confirm"); |
| 45 |
element.setAttribute("value","confirm"); |
| 46 |
document.delivery_form.appendChild(element); |
| 47 |
document.delivery_form.submit(); |
| 48 |
return true; |
| 49 |
}); |
| 50 |
|
| 51 |
$(document).on( "click", "#escott_agree_cancel", function(e) { |
| 52 |
$("#escott_agree").val(""); |
| 53 |
$("#escott-agree-dialog").dialog("close"); |
| 54 |
}); |
| 55 |
|
| 56 |
$(document).on( "click", ".to_confirm_button", function(e) { |
| 57 |
if( $("#payment_name_"+uscesL10n.escott_link_payment_id).prop("checked") && 'link' == escott_params.card_activate ) { |
| 58 |
if ( "agree" == $("#escott_agree").val() ) { |
| 59 |
// $("#delivery-form").submit(); |
| 60 |
// return true; |
| 61 |
} else { |
| 62 |
e.preventDefault(); |
| 63 |
e.stopPropagation(); |
| 64 |
$("#escott-agree-dialog").dialog("open"); |
| 65 |
return false; |
| 66 |
} |
| 67 |
} |
| 68 |
}); |
| 69 |
}); |
| 70 |
|