65 lines
3.0 KiB
Smarty
Executable File
65 lines
3.0 KiB
Smarty
Executable File
<script type="text/javascript">{literal}
|
|
function hideExpressCart(event){
|
|
if($(".button.expresscart.active").parent().parent().has($(event.target)).length == 0 || $(".button.expresscart.active") == $(event.target)) {
|
|
event.data.m.removeClass('active');
|
|
$(".expresscart_frame").hide();
|
|
$("html").unbind("click", hideExpressCart);
|
|
$('a.button').css('opacity', 1);
|
|
|
|
$('.close_popup').remove();
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function showExpressCart(event) {
|
|
var m = $(event.target);
|
|
m.toggleClass('active');
|
|
|
|
if(m.parent().children(".expresscart_frame:visible").length > 0) {
|
|
event.data = {m: m};
|
|
hideExpressCart(event);
|
|
} else {
|
|
m.parent().children(".expresscart_frame").slideDown(function() {
|
|
if(m.parent().children(".expresscart_frame").children("p.loading").length > 0) {
|
|
var id_product = m.parent().children(".button.ajax_add_to_cart_button").attr("rel").split("_")[3];
|
|
m.parent().children(".expresscart_frame").append("<iframe src=\"{/literal}{$base_dir_ssl}{literal}modules/expresscart/ajax.php?id_product=" + id_product + "\" style=\"display: none;\" border=\"0\" marginheight=\"0\" marginwidth=\"0\" frameborder=\"0\" onload=\"$(this).show(); $(this).parent().children('p.loading').remove();\"></iframe>");
|
|
|
|
}
|
|
$(m).parent().append('<a href="#" class="close_popup"></a>');
|
|
$('.close_popup', $(m).parent()).click(function() {
|
|
$(this).remove();
|
|
hideExpressCart(event);
|
|
});
|
|
});
|
|
|
|
$('a.button').css('opacity', 0);
|
|
|
|
}
|
|
$("html").bind("click", {m: m}, hideExpressCart);
|
|
return false;
|
|
}
|
|
|
|
function initButtons() {
|
|
$('.button.ajax_add_to_cart_button.exclusive:visible').hide().after("{/literal}<a title=\"{l s='Express cart' mod='expresscart'}\" onclick=\"showExpressCart(event); return false;\" class=\"button expresscart\">{l s='Express cart' mod='expresscart'}</a><div class=\"expresscart_frame\"><p class=\"loading\"><img src=\"{$img_dir|replace:'"':'"'}ajax-loader.gif\" alt=\"\" /></p></div>{literal}");
|
|
|
|
// if(!$.browser.msie || $.browser.msie && $.browser.version.slice(0, 1) > 8) {
|
|
// $('.button.ajax_add_to_cart_button.exclusive:visible').hide().after("{/literal}<a title=\"{l s='Express cart' mod='expresscart'}\" onclick=\"showExpressCart(event); return false;\" class=\"button expresscart\">{l s='Express cart' mod='expresscart'}</a><div class=\"expresscart_frame\"><p class=\"loading\"><img src=\"{$img_dir|replace:'"':'"'}ajax-loader.gif\" alt=\"\" /></p></div>{literal}");
|
|
// } else {
|
|
// $('.button.ajax_add_to_cart_button.exclusive:visible').hide().after($("{/literal}<a title=\"{l s='Express cart' mod='expresscart'}\" class=\"button expresscart\">{l s='Express cart' mod='expresscart'}</a><div class=\"expresscart_frame\"><p class=\"loading\"><img src=\"{$img_dir|replace:'"':'"'}ajax-loader.gif\" alt=\"\" /></p></div>{literal}").click(function(event) {
|
|
// showExpressCart(event);
|
|
// return false;
|
|
// }));
|
|
// }
|
|
}
|
|
|
|
$(document).ready(function() {
|
|
initButtons();
|
|
|
|
$("#product_list").bind("updated", function() {
|
|
initButtons();
|
|
return false;
|
|
});
|
|
|
|
});
|
|
{/literal}</script>
|