Added changes from eb94b51 TMMeilleur/PrestaShop

This commit is contained in:
alexey-svistunov
2013-11-08 21:00:00 +02:00
parent d3100acef2
commit 6f5c9044d3
87 changed files with 4285 additions and 152 deletions
@@ -36,10 +36,10 @@ $(document).ready(function()
// Click on color
$('#layered_form input[type=button], #layered_form label.layered_color').live('click', function()
{
if (!$('input[name='+$(this).attr('name')+'][type=hidden]').length)
$('<input />').attr('type', 'hidden').attr('name', $(this).attr('name')).val($(this).attr('rel')).appendTo('#layered_form');
if (!$('input[name='+$(this).prop('name')+'][type=hidden]').length)
$('<input />').prop('type', 'hidden').prop('name', $(this).prop('name')).val($(this).prop('rel')).appendTo('#layered_form');
else
$('input[name='+$(this).attr('name')+'][type=hidden]').remove();
$('input[name='+$(this).prop('name')+'][type=hidden]').remove();
reloadContent();
});
@@ -52,17 +52,17 @@ $(document).ready(function()
// Changing content of an input text
$('#layered_form input.layered_input_range').live('keyup', function()
{
if ($(this).attr('timeout_id'))
window.clearTimeout($(this).attr('timeout_id'));
if ($(this).prop('timeout_id'))
window.clearTimeout($(this).prop('timeout_id'));
// IE Hack, setTimeout do not acept the third parameter
var reference = this;
$(this).attr('timeout_id', window.setTimeout(function(it) {
if (!$(it).attr('id'))
$(this).prop('timeout_id', window.setTimeout(function(it) {
if (!$(it).prop('id'))
it = reference;
var filter = $(it).attr('id').replace(/^layered_(.+)_range_.*$/, '$1');
var filter = $(it).prop('id').replace(/^layered_(.+)_range_.*$/, '$1');
var value_min = parseInt($('#layered_'+filter+'_range_min').val());
if (isNaN(value_min))
@@ -83,9 +83,9 @@ $(document).ready(function()
});
$('#layered_block_left .radio').live('click', function() {
var name = $(this).attr('name');
var name = $(this).prop('name');
$.each($(this).parent().parent().find('input[type=button]'), function (it, item) {
if ($(item).hasClass('on') && $(item).attr('name') != name) {
if ($(item).hasClass('on') && $(item).prop('name') != name) {
$(item).click();
}
});
@@ -95,7 +95,7 @@ $(document).ready(function()
// Click on label
$('#layered_block_left label a').live({
click: function() {
var disable = $(this).parent().parent().find('input').attr('disabled');
var disable = $(this).parent().parent().find('input').prop('disabled');
if (disable == ''
|| typeof(disable) == 'undefined'
|| disable == false)
@@ -109,13 +109,13 @@ $(document).ready(function()
layered_hidden_list = {};
$('.hide-action').live('click', function() {
if (typeof(layered_hidden_list[$(this).parent().find('ul').attr('id')]) == 'undefined' || layered_hidden_list[$(this).parent().find('ul').attr('id')] == false)
if (typeof(layered_hidden_list[$(this).parent().find('ul').prop('id')]) == 'undefined' || layered_hidden_list[$(this).parent().find('ul').prop('id')] == false)
{
layered_hidden_list[$(this).parent().find('ul').attr('id')] = true;
layered_hidden_list[$(this).parent().find('ul').prop('id')] = true;
}
else
{
layered_hidden_list[$(this).parent().find('ul').attr('id')] = false;
layered_hidden_list[$(this).parent().find('ul').prop('id')] = false;
}
hideFilterValueAction(this);
});
@@ -128,10 +128,10 @@ $(document).ready(function()
while ($('#selectPrductSort').length) { // Because ids are duplicated
// Unbind event change on #selectPrductSort
$('#selectPrductSort').unbind('change');
$('#selectPrductSort').attr('onchange', '');
$('#selectPrductSort').prop('onchange', '');
$('#selectPrductSort').addClass('selectProductSort');
$('#selectPrductSort').attr('id', 'selectPrductSort'+id);
$('label[for=selectPrductSort]').attr('for', 'selectPrductSort'+id);
$('#selectPrductSort').prop('id', 'selectPrductSort'+id);
$('label[for=selectPrductSort]').prop('for', 'selectPrductSort'+id);
id++;
}
@@ -145,7 +145,7 @@ $(document).ready(function()
reloadContent();
});
$('.js-nb_item').unbind('change').attr('onchange', '');
$('.js-nb_item').unbind('change').prop('onchange', '');
$('.js-nb_item').live('change', function(event) {
$('.js-nb_item').val($(this).val());
@@ -158,7 +158,7 @@ $(document).ready(function()
function hideFilterValueAction(it)
{
if (typeof(layered_hidden_list[$(it).parent().find('ul').attr('id')]) == 'undefined' || layered_hidden_list[$(it).parent().find('ul').attr('id')] == false)
if (typeof(layered_hidden_list[$(it).parent().find('ul').prop('id')]) == 'undefined' || layered_hidden_list[$(it).parent().find('ul').prop('id')] == false)
{
$(it).parent().find('.hiddable').hide();
$(it).parent().find('.hide-action.less').hide();
@@ -221,21 +221,21 @@ function initLayered()
function paginationButton() {
$('div.pagination a').not(':hidden').each(function () {
if ($(this).attr('href').search('&p=') == -1) {
if ($(this).prop('href').search('&p=') == -1) {
var page = 1;
}
else {
var page = $(this).attr('href').replace(/^.*&p=(\d+).*$/, '$1');
var page = $(this).prop('href').replace(/^.*&p=(\d+).*$/, '$1');
}
var location = window.location.href.replace(/#.*$/, '');
$(this).attr('href', location+current_friendly_url.replace(/\/page-(\d+)/, '')+'/page-'+page);
$(this).prop('href', location+current_friendly_url.replace(/\/page-(\d+)/, '')+'/page-'+page);
});
$('div.pagination li').not('.current, .disabled').each(function () {
var nbPage = 0;
if ($(this).hasClass('pagination_next'))
nbPage = parseInt($('div.pagination li.current').children().html())+ 1;
nbPage = parseInt($('div.pagination li.current').children().children().html())+ 1;
else if ($(this).hasClass('pagination_previous'))
nbPage = parseInt($('div.pagination li.current').children().html())- 1;
nbPage = parseInt($('div.pagination li.current').children().children().html())- 1;
$(this).children().children().click(function () {
if (nbPage == 0)
@@ -250,35 +250,39 @@ function paginationButton() {
});
}
function showAllButton() {
}
function cancelFilter()
{
$('#enabled_filters a').live('click', function(e)
{
if ($(this).attr('rel').search(/_slider$/) > 0)
if ($(this).prop('rel').search(/_slider$/) > 0)
{
if ($('#'+$(this).attr('rel')).length)
if ($('#'+$(this).prop('rel')).length)
{
$('#'+$(this).attr('rel')).slider('values' , 0, $('#'+$(this).attr('rel')).slider('option' , 'min' ));
$('#'+$(this).attr('rel')).slider('values' , 1, $('#'+$(this).attr('rel')).slider('option' , 'max' ));
$('#'+$(this).attr('rel')).slider('option', 'slide')(0,{values:[$('#'+$(this).attr('rel')).slider( 'option' , 'min' ), $('#'+$(this).attr('rel')).slider( 'option' , 'max' )]});
$('#'+$(this).prop('rel')).slider('values' , 0, $('#'+$(this).prop('rel')).slider('option' , 'min' ));
$('#'+$(this).prop('rel')).slider('values' , 1, $('#'+$(this).prop('rel')).slider('option' , 'max' ));
$('#'+$(this).prop('rel')).slider('option', 'slide')(0,{values:[$('#'+$(this).prop('rel')).slider( 'option' , 'min' ), $('#'+$(this).prop('rel')).slider( 'option' , 'max' )]});
}
else if($('#'+$(this).attr('rel').replace(/_slider$/, '_range_min')).length)
else if($('#'+$(this).prop('rel').replace(/_slider$/, '_range_min')).length)
{
$('#'+$(this).attr('rel').replace(/_slider$/, '_range_min')).val($('#'+$(this).attr('rel').replace(/_slider$/, '_range_min')).attr('limitValue'));
$('#'+$(this).attr('rel').replace(/_slider$/, '_range_max')).val($('#'+$(this).attr('rel').replace(/_slider$/, '_range_max')).attr('limitValue'));
$('#'+$(this).prop('rel').replace(/_slider$/, '_range_min')).val($('#'+$(this).prop('rel').replace(/_slider$/, '_range_min')).prop('limitValue'));
$('#'+$(this).prop('rel').replace(/_slider$/, '_range_max')).val($('#'+$(this).prop('rel').replace(/_slider$/, '_range_max')).prop('limitValue'));
}
}
else
{
if ($('option#'+$(this).attr('rel')).length)
if ($('option#'+$(this).prop('rel')).length)
{
$('#'+$(this).attr('rel')).parent().val('');
$('#'+$(this).prop('rel')).parent().val('');
}
else
{
$('#'+$(this).attr('rel')).attr('checked', false);
$('.'+$(this).attr('rel')).attr('checked', false);
$('#layered_form input[type=hidden][name='+$(this).attr('rel')+']').remove();
$('#'+$(this).prop('rel')).prop('checked', false);
$('.'+$(this).prop('rel')).prop('checked', false);
$('#layered_form input[type=hidden][name='+$(this).prop('rel')+']').remove();
}
}
reloadContent();
@@ -292,13 +296,13 @@ function openCloseFilter()
{
if ($(this).html() == '&lt;')
{
$('#'+$(this).attr('rel')).show();
$('#'+$(this).prop('rel')).show();
$(this).html('v');
$(this).parent().removeClass('closed');
}
else
{
$('#'+$(this).attr('rel')).hide();
$('#'+$(this).prop('rel')).hide();
$(this).html('&lt;');
$(this).parent().addClass('closed');
}
@@ -321,8 +325,8 @@ function reloadContent(params_plus)
if (!ajaxLoaderOn)
{
$('#product_list').prepend($('#layered_ajax_loader').html());
$('#product_list').css('opacity', '0.7');
$('.product_list').prepend($('#layered_ajax_loader').html());
$('.product_list').css('opacity', '0.7');
ajaxLoaderOn = 1;
}
@@ -331,7 +335,7 @@ function reloadContent(params_plus)
var sliderStart = $(this).slider('values', 0);
var sliderStop = $(this).slider('values', 1);
if (typeof(sliderStart) == 'number' && typeof(sliderStop) == 'number')
data += '&'+$(this).attr('id')+'='+sliderStart+'_'+sliderStop;
data += '&'+$(this).prop('id')+'='+sliderStart+'_'+sliderStop;
});
$(['price', 'weight']).each(function(it, sliderType)
@@ -343,9 +347,9 @@ function reloadContent(params_plus)
});
$('#layered_form .select option').each( function () {
if($(this).attr('id') && $(this).parent().val() == $(this).val())
if($(this).prop('id') && $(this).parent().val() == $(this).val())
{
data += '&'+$(this).attr('id') + '=' + $(this).val();
data += '&'+$(this).prop('id') + '=' + $(this).val();
}
});
@@ -399,13 +403,13 @@ function reloadContent(params_plus)
$('.category-product-count').html(result.categoryCount);
if (result.productList)
$('#product_list').replaceWith(utf8_decode(result.productList));
$('.product_list').replaceWith(utf8_decode(result.productList));
else
$('#product_list').html('');
$('.product_list').html('');
$('#product_list').css('opacity', '1');
$('.product_list').css('opacity', '1');
if ($.browser.msie) // Fix bug with IE8 and aliasing
$('#product_list').css('filter', '');
$('.product_list').css('filter', '');
if (result.pagination.search(/[^\s]/) >= 0) {
if ($(result.pagination).find('ul.pagination').length)
@@ -442,7 +446,7 @@ function reloadContent(params_plus)
val = $('div.pagination .js-nb_item').val();
$('div.pagination .js-nb_item').children().each(function(it, option) {
if (option.value == val)
$(option).attr('selected', true);
$(option).prop('selected', true);
else
$(option).removeAttr('selected');
});
@@ -485,7 +489,7 @@ function reloadContent(params_plus)
lockLocationChecking = true;
if(slideUp)
$.scrollTo('#product_list', 400);
$.scrollTo('.product_list', 400);
updateProductUrl();
$('.hide-action').each(function() {
@@ -530,11 +534,11 @@ function updateProductUrl()
{
// Adding the filters to URL product
if (typeof(param_product_url) != 'undefined' && param_product_url != '' && param_product_url !='#') {
$.each($('ul#product_list li.ajax_block_product .product_img_link,'+
'ul#product_list li.ajax_block_product h3 a,'+
'ul#product_list li.ajax_block_product .product_desc a,'+
'ul#product_list li.ajax_block_product .lnk_view'), function() {
$(this).attr('href', $(this).attr('href') + param_product_url);
$.each($('ul.product_list li.ajax_block_product .product_img_link,'+
'ul.product_list li.ajax_block_product h3 a,'+
'ul.product_list li.ajax_block_product .product_desc a,'+
'ul.product_list li.ajax_block_product .lnk_view'), function() {
$(this).prop('href', $(this).prop('href') + param_product_url);
});
}
}