Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into bootstrap
Conflicts: admin-dev/themes/default/css/admin.css admin-dev/themes/default/template/controllers/carrier_wizard/helpers/form/form.tpl admin-dev/themes/default/template/controllers/carrier_wizard/helpers/form/form_ranges.tpl admin-dev/themes/default/template/controllers/categories/helpers/form/form.tpl admin-dev/themes/default/template/controllers/home/content.tpl admin-dev/themes/default/template/controllers/localization/content.tpl admin-dev/themes/default/template/controllers/orders/_customized_data.tpl admin-dev/themes/default/template/controllers/orders/_new_product.tpl admin-dev/themes/default/template/controllers/orders/_product_line.tpl admin-dev/themes/default/template/controllers/orders/helpers/view/view.tpl admin-dev/themes/default/template/controllers/tax_rules/helpers/list/list_header.tpl admin-dev/themes/default/template/footer.tpl controllers/admin/AdminCarrierWizardController.php controllers/admin/AdminCarriersController.php controllers/admin/AdminCmsController.php controllers/admin/AdminLocalizationController.php controllers/admin/AdminManufacturersController.php controllers/admin/AdminSuppliersController.php css/admin.css js/admin-products.js js/admin_carrier_wizard.js translations/fr.gzip
This commit is contained in:
@@ -1326,8 +1326,9 @@ product_tabs['Suppliers'] = new function(){
|
||||
$('#suppliers_accordion').accordion({
|
||||
collapsible: true,
|
||||
autoHeight: true,
|
||||
heightStyle: "content"});
|
||||
}, 1000);
|
||||
heightStyle: "content"
|
||||
});
|
||||
}, 1000);
|
||||
|
||||
// Resize the accordion once the page is visible because of the bug with accordions initialized
|
||||
// inside a display:none block not having the correct size.
|
||||
|
||||
+9
-3
@@ -119,7 +119,8 @@ function copy2friendlyURL()
|
||||
|
||||
function copyMeta2friendlyURL()
|
||||
{
|
||||
$('#input_link_rewrite_' + id_language).val(str2url($('#name_' + id_language).val().replace(/^[0-9]+\./, ''), 'UTF-8'));
|
||||
if (!$('input[name="id_cms"]').length)
|
||||
$('#link_rewrite_' + id_language).val(str2url($('#name_' + id_language).val().replace(/^[0-9]+\./, ''), 'UTF-8'));
|
||||
}
|
||||
|
||||
function updateCurrentText()
|
||||
@@ -183,10 +184,15 @@ function changeFormLanguage(id_language_new, iso_code, employee_cookie)
|
||||
|
||||
// For multishop checkboxes
|
||||
$('.multishop_lang_'+id_language_new).show().siblings('div[class^=\'multishop_lang_\']').hide();
|
||||
|
||||
$('.language_flags').hide();
|
||||
if (employee_cookie)
|
||||
$.post("ajax.php", { form_language_id: id_language_new });
|
||||
$.post("index.php", {
|
||||
action: 'formLanguage',
|
||||
tab: 'AdminEmployees',
|
||||
ajax: 1,
|
||||
token: employee_token,
|
||||
form_language_id: id_language_new
|
||||
});
|
||||
id_language = id_language_new;
|
||||
|
||||
updateCurrentText();
|
||||
|
||||
+153
-93
@@ -25,7 +25,6 @@
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
validateAndAddRangeButtonDisplay();
|
||||
bind_inputs();
|
||||
initCarrierWizard();
|
||||
if (parseInt($('input[name="is_free"]:checked').val()))
|
||||
@@ -45,7 +44,8 @@ function initCarrierWizard()
|
||||
'onLeaveStep' : onLeaveStepCallback,
|
||||
'onFinish' : onFinishCallback,
|
||||
'transitionEffect' : 'slideleft',
|
||||
'enableAllSteps' : enableAllSteps
|
||||
'enableAllSteps' : enableAllSteps,
|
||||
'keyNavigation' : false
|
||||
});
|
||||
displayRangeType();
|
||||
}
|
||||
@@ -64,7 +64,7 @@ function displayRangeType()
|
||||
$('.price_unit').show();
|
||||
$('.weight_unit').hide();
|
||||
}
|
||||
|
||||
is_freeClick($('input[name="is_free"]:checked'));
|
||||
$('.range_type').html(string);
|
||||
}
|
||||
|
||||
@@ -105,8 +105,8 @@ function onLeaveStepCallback(obj, context)
|
||||
{
|
||||
if (context.toStep == nbr_steps)
|
||||
displaySummary();
|
||||
|
||||
return validateSteps(context.fromStep); // return false to stay on step and true to continue navigation
|
||||
|
||||
return validateSteps(context.fromStep, context.toStep); // return false to stay on step and true to continue navigation
|
||||
}
|
||||
|
||||
function displaySummary()
|
||||
@@ -127,39 +127,49 @@ function displaySummary()
|
||||
|
||||
// Tax and calculation mode for the shipping cost
|
||||
tmp = summary_translation_shipping_cost.replace('@s2', '<strong>' + $('#id_tax_rules_group option:selected').text() + '</strong>');
|
||||
if ($('#billing_price').attr('checked'))
|
||||
tmp = tmp.replace('@s1', summary_translation_price);
|
||||
else if ($('#billing_weight').attr('checked'))
|
||||
tmp = tmp.replace('@s1', summary_translation_weight);
|
||||
else
|
||||
tmp = tmp.replace('@s1', '<strong>' + summary_translation_undefined + '</strong>');
|
||||
|
||||
if ($('#billing_price').attr('checked'))
|
||||
tmp = tmp.replace('@s1', summary_translation_price);
|
||||
else if ($('#billing_weight').attr('checked'))
|
||||
tmp = tmp.replace('@s1', summary_translation_weight);
|
||||
else
|
||||
tmp = tmp.replace('@s1', '<strong>' + summary_translation_undefined + '</strong>');
|
||||
|
||||
|
||||
|
||||
$('#summary_shipping_cost').html(tmp);
|
||||
|
||||
// Weight or price ranges
|
||||
$('#summary_range').html(summary_translation_range);
|
||||
$('#summary_range').html(summary_translation_range+' '+summary_translation_range_limit);
|
||||
|
||||
|
||||
if ($('input[name="shipping_method"]:checked').val() == 1)
|
||||
unit = PS_WEIGHT_UNIT;
|
||||
else
|
||||
unit = currency_sign;
|
||||
|
||||
var range_inf = summary_translation_undefined;
|
||||
var range_sup = summary_translation_undefined;
|
||||
|
||||
/*
|
||||
$('input[name$="range_inf[]"]').each(function(){
|
||||
if (!isNaN(parseFloat($(this).val())) && (range_inf == summary_translation_undefined || range_inf < $(this).val()))
|
||||
$('tr.range_inf td input').each( function()
|
||||
{
|
||||
if (!isNaN(parseFloat($(this).val())) && (range_inf == summary_translation_undefined || range_inf > $(this).val()))
|
||||
range_inf = $(this).val();
|
||||
});
|
||||
*/
|
||||
range_inf = $('tr.range_inf td input:first').val();
|
||||
range_sup = $('tr.range_sup td input:last').val();
|
||||
|
||||
$('input[name$="range_sup[]"]').each(function(){
|
||||
if (!isNaN(parseFloat($(this).val())) && (range_sup == summary_translation_undefined || range_sup > $(this).val()))
|
||||
$('tr.range_sup td input').each( function(){
|
||||
if (!isNaN(parseFloat($(this).val())) && (range_sup == summary_translation_undefined || range_sup < $(this).val()))
|
||||
range_sup = $(this).val();
|
||||
});
|
||||
|
||||
$('#summary_range').html(
|
||||
$('#summary_range').html()
|
||||
.replace('@s1', '<strong>' + range_inf + '</strong>')
|
||||
.replace('@s2', '<strong>' + range_sup + '</strong>')
|
||||
.replace('@s1', '<strong>' + range_inf +' '+ unit + '</strong>')
|
||||
.replace('@s2', '<strong>' + range_sup +' '+ unit + '</strong>')
|
||||
.replace('@s3', '<strong>' + $('#range_behavior option:selected').text().toLowerCase() + '</strong>')
|
||||
);
|
||||
|
||||
if ($('#is_free_on').attr('checked'))
|
||||
$('span.is_free').hide();
|
||||
// Delivery zones
|
||||
$('#summary_zones').html('');
|
||||
$('.input_zone').each(function(){
|
||||
@@ -182,34 +192,43 @@ $('input[name$="range_inf[]"]').each(function(){
|
||||
});
|
||||
}
|
||||
|
||||
function validateSteps(step_number)
|
||||
function validateSteps(fromStep, toStep)
|
||||
{
|
||||
$('.wizard_error').remove();
|
||||
var is_ok = true;
|
||||
form = $('#carrier_wizard #step-'+step_number+' form');
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url : validate_url,
|
||||
async: false,
|
||||
dataType: 'json',
|
||||
data : form.serialize()+'&step_number='+step_number+'&action=validate_step&ajax=1',
|
||||
success : function(datas)
|
||||
{
|
||||
if (datas.has_error)
|
||||
if ((multistore_enable && fromStep == 3) || (!multistore_enable && fromStep == 2))
|
||||
{
|
||||
if (toStep > fromStep && !$('#is_free_on').attr('checked') && !validateRange(2))
|
||||
is_ok = false;
|
||||
}
|
||||
|
||||
$('.wizard_error').remove();
|
||||
if (is_ok)
|
||||
{
|
||||
form = $('#carrier_wizard #step-'+fromStep+' form');
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url : validate_url,
|
||||
async: false,
|
||||
dataType: 'json',
|
||||
data : form.serialize()+'&step_number='+fromStep+'&action=validate_step&ajax=1',
|
||||
success : function(datas)
|
||||
{
|
||||
is_ok = false;
|
||||
|
||||
$('input').focus( function () {
|
||||
$(this).removeClass('field_error');
|
||||
});
|
||||
displayError(datas.errors, step_number);
|
||||
resizeWizard();
|
||||
if (datas.has_error)
|
||||
{
|
||||
is_ok = false;
|
||||
|
||||
$('input').focus( function () {
|
||||
$(this).removeClass('field_error');
|
||||
});
|
||||
displayError(datas.errors, fromStep);
|
||||
resizeWizard();
|
||||
}
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||
jAlert("TECHNICAL ERROR: \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
|
||||
}
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||
jAlert("TECHNICAL ERROR: \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
return is_ok;
|
||||
}
|
||||
|
||||
@@ -252,21 +271,6 @@ function bind_inputs()
|
||||
return false;
|
||||
});
|
||||
|
||||
/*
|
||||
$('#validate_range_button').off('click').on('click', function () {
|
||||
index = $('tr.fees_all td:last').index();
|
||||
if (validateRange(index))
|
||||
{
|
||||
enableRange(index);
|
||||
$('.currency_sign').show();
|
||||
}
|
||||
else
|
||||
disableRange(index);
|
||||
validateAndAddRangeButtonDisplay();
|
||||
return false;
|
||||
});
|
||||
*/
|
||||
|
||||
$('tr.fees td input:checkbox').off('change').on('change', function () {
|
||||
|
||||
if($(this).is(':checked'))
|
||||
@@ -294,22 +298,31 @@ $('#validate_range_button').off('click').on('click', function () {
|
||||
enableRange(index);
|
||||
else
|
||||
disableRange(index);
|
||||
validateAndAddRangeButtonDisplay();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$('tr.fees_all td input:text').keypress( function (evn) {
|
||||
index = $(this).parent('td').index();
|
||||
if (evn.keyCode == 13)
|
||||
return false;
|
||||
});
|
||||
|
||||
$('tr.range_sup td input:text, tr.range_inf td input:text').typeWatch({
|
||||
captureLength: 0,
|
||||
highlight: false,
|
||||
wait: 1000,
|
||||
callback: function() {
|
||||
|
||||
index = $(this.el).closest('td').index();
|
||||
if (validateRange(index))
|
||||
enableRange(index);
|
||||
else
|
||||
disableRange(index);
|
||||
range_sup = $('tr.range_sup td:eq('+index+')').children('input:text').val().trim();
|
||||
range_inf = $('tr.range_inf td:eq('+index+')').children('input:text').val().trim();
|
||||
if (range_sup != '' && range_inf != '')
|
||||
{
|
||||
if (validateRange(index))
|
||||
enableRange(index);
|
||||
else
|
||||
disableRange(index);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -379,9 +392,9 @@ function showFees()
|
||||
{
|
||||
//enable only if zone is active
|
||||
tr = $(this).closest('tr');
|
||||
if ($(tr).index() > 2 && $(tr).find('td:eq(1) input').attr('checked') && $('tr.fees_all td:eq('+$(this).index()+')').hasClass('validated') || $(tr).hasClass('range_sup') || $(tr).hasClass('range_inf'))
|
||||
$(this).find('input:text').val('').removeAttr('disabled');
|
||||
|
||||
validate = $('tr.fees_all td:eq('+$(this).index()+')').hasClass('validated');
|
||||
if ($(tr).index() > 2 && $(tr).find('td:eq(1) input').attr('checked') && validate || !$(tr).hasClass('range_sup') || !$(tr).hasClass('range_inf'))
|
||||
$(this).find('input:text').removeAttr('disabled');
|
||||
$(this).find('input:text, button').css('background-color', '').css('border-color', '');
|
||||
$(this).find('button').css('background-color', '').css('border-color', '').removeAttr('disabled');
|
||||
$(this).css('background-color', '');
|
||||
@@ -456,12 +469,26 @@ function validateRange(index)
|
||||
return is_ok;
|
||||
}
|
||||
|
||||
function enableZone(index)
|
||||
{
|
||||
$('tr.fees').each( function () {
|
||||
$(this).find('td:eq('+index+')').children('input').removeAttr('disabled');
|
||||
});
|
||||
}
|
||||
|
||||
function disableZone(index)
|
||||
{
|
||||
$('tr.fees').each( function () {
|
||||
$(this).find('td:eq('+index+')').children('input').attr('disabled', 'disabled');
|
||||
});
|
||||
}
|
||||
|
||||
function enableRange(index)
|
||||
{
|
||||
$('tr.fees').each( function () {
|
||||
//only enable fees for enabled zones
|
||||
if ($(this).find('td').find('input:checkbox').attr('checked') == 'checked')
|
||||
$(this).find('td:eq('+index+')').find('input').removeAttr('disabled');
|
||||
enableZone(index);
|
||||
});
|
||||
$('span.fees_all').show();
|
||||
$('tr.fees_all td:eq('+index+')').find('input').show().removeAttr('disabled');
|
||||
@@ -476,7 +503,7 @@ function disableRange(index)
|
||||
$('tr.fees').each( function () {
|
||||
//only enable fees for enabled zones
|
||||
if ($(this).find('td').find('input:checkbox').attr('checked') == 'checked')
|
||||
$(this).find('td:eq('+index+')').find('input').attr('disabled', 'disabled');
|
||||
disableZone(index);
|
||||
});
|
||||
$('tr.fees_all td:eq('+index+')').find('input').attr('disabled', 'disabled');
|
||||
$('tr.fees_all td:eq('+index+')').removeClass('validated').addClass('not_validated');
|
||||
@@ -502,7 +529,6 @@ function add_new_range()
|
||||
});
|
||||
$('tr.delete_range td:last').after('<td><button class="btn btn-default">'+labelDelete+'</button</td>');
|
||||
|
||||
validateAndAddRangeButtonDisplay();
|
||||
bind_inputs();
|
||||
rebuildTabindex();
|
||||
displayRangeType();
|
||||
@@ -540,22 +566,7 @@ function rebuildTabindex()
|
||||
});
|
||||
}
|
||||
|
||||
function validateAndAddRangeButtonDisplay()
|
||||
{
|
||||
return;
|
||||
if ($('tr.fees_all td:last').hasClass('validated'))
|
||||
{
|
||||
$('.validate_range').hide();
|
||||
$('.new_range').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
$('.validate_range').show();
|
||||
$('.new_range').hide();
|
||||
}
|
||||
}
|
||||
|
||||
function reorderRange(current_index, new_index)
|
||||
function repositionRange(current_index, new_index)
|
||||
{
|
||||
$('tr.range_sup, tr.range_inf, tr.fees_all, tr.fees, tr.delete_range ').each(function () {
|
||||
$(this).find('td:eq('+current_index+')').each( function () {
|
||||
@@ -565,11 +576,13 @@ function reorderRange(current_index, new_index)
|
||||
});
|
||||
}
|
||||
|
||||
function checkRangeContinuity()
|
||||
function checkRangeContinuity(reordering)
|
||||
{
|
||||
return true;
|
||||
reordering = typeof reordering !== 'undefined' ? reordering : false;
|
||||
res = true;
|
||||
return true;//TODO
|
||||
$('tr.range_sup td').not('.range_type, .range_sign, tr.range_sup').each( function ()
|
||||
|
||||
$('tr.range_sup td').not('.range_type, .range_sign').each( function ()
|
||||
{
|
||||
index = $(this).index();
|
||||
if (index > 2)
|
||||
@@ -580,11 +593,58 @@ function checkRangeContinuity()
|
||||
prev_range_sup = parseFloat($('tr.range_sup td:eq('+prev_index+')').find('input:text').val().trim());
|
||||
prev_range_inf = parseFloat($('tr.range_inf td:eq('+prev_index+')').find('input:text').val().trim());
|
||||
if (range_inf < prev_range_inf || range_sup < prev_range_sup)
|
||||
{
|
||||
res = false;
|
||||
if (reordering)
|
||||
{
|
||||
new_position = getCorrectRangePosistion(range_inf, range_sup);
|
||||
if (new_position)
|
||||
repositionRange(index, new_position);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
if (res)
|
||||
$('.ranges_not_follow').fadeOut();
|
||||
else
|
||||
$('.ranges_not_follow').fadeIn();
|
||||
resizeWizard();
|
||||
}
|
||||
|
||||
function getCorrectRangePosistion(current_inf, current_sup)
|
||||
{
|
||||
new_position = false;
|
||||
$('tr.range_sup td').not('.range_type, .range_sign').each( function ()
|
||||
{
|
||||
index = $(this).index();
|
||||
range_sup = parseFloat($('tr.range_sup td:eq('+index+')').children('input:text').val().trim());
|
||||
next_range_inf = 0
|
||||
if ($('tr.range_inf td:eq('+index+1+')').length)
|
||||
next_range_inf = parseFloat($('tr.range_inf td:eq('+index+1+')').children('input:text').val().trim());
|
||||
if (current_inf >= range_sup && current_sup < next_range_inf)
|
||||
new_position = index;
|
||||
});
|
||||
return new_position;
|
||||
}
|
||||
|
||||
function checkAllZones(elt)
|
||||
{
|
||||
if($(elt).is(':checked'))
|
||||
{
|
||||
$('.input_zone').attr('checked', 'checked');
|
||||
$('.fees input:text').each( function () {
|
||||
index = $(this).parent().index();
|
||||
if ($('tr.fees_all td:eq('+index+')').hasClass('validated'))
|
||||
{
|
||||
$(this).removeAttr('disabled');
|
||||
$('.fees_all td:eq('+index+') input:text').removeAttr('disabled');
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
$('.input_zone').removeAttr('checked');
|
||||
$('.fees input:text, .fees_all input:text').attr('disabled', 'disabled').val('');
|
||||
}
|
||||
|
||||
}
|
||||
+3
-3
@@ -26,9 +26,9 @@
|
||||
function ajaxStates (id_state_selected)
|
||||
{
|
||||
$.ajax({
|
||||
url: "ajax.php",
|
||||
url: "index.php",
|
||||
cache: false,
|
||||
data: "ajaxStates=1&no_empty=1&id_country="+$('#id_country').val() + "&id_state=" + $('#id_state').val(),
|
||||
data: "token="+state_token+"&ajax=1&action=states&tab=AdminStates&no_empty=1&id_country="+$('#id_country').val() + "&id_state=" + $('#id_state').val(),
|
||||
success: function(html)
|
||||
{
|
||||
if (html == 'false')
|
||||
@@ -59,4 +59,4 @@ function ajaxStates (id_state_selected)
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,521 @@
|
||||
/*!
|
||||
* jQuery Migrate - v1.2.1 - 2013-05-08
|
||||
* https://github.com/jquery/jquery-migrate
|
||||
* Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors; Licensed MIT
|
||||
*/
|
||||
(function( jQuery, window, undefined ) {
|
||||
// See http://bugs.jquery.com/ticket/13335
|
||||
// "use strict";
|
||||
jQuery.migrateMute = true;
|
||||
|
||||
var warnedAbout = {};
|
||||
|
||||
// List of warnings already given; public read only
|
||||
jQuery.migrateWarnings = [];
|
||||
|
||||
// Set to true to prevent console output; migrateWarnings still maintained
|
||||
// jQuery.migrateMute = false;
|
||||
|
||||
// Show a message on the console so devs know we're active
|
||||
if ( !jQuery.migrateMute && window.console && window.console.log ) {
|
||||
window.console.log("JQMIGRATE: Logging is active");
|
||||
}
|
||||
|
||||
// Set to false to disable traces that appear with warnings
|
||||
if ( jQuery.migrateTrace === undefined ) {
|
||||
jQuery.migrateTrace = true;
|
||||
}
|
||||
|
||||
// Forget any warnings we've already given; public
|
||||
jQuery.migrateReset = function() {
|
||||
warnedAbout = {};
|
||||
jQuery.migrateWarnings.length = 0;
|
||||
};
|
||||
|
||||
function migrateWarn( msg) {
|
||||
var console = window.console;
|
||||
if ( !warnedAbout[ msg ] ) {
|
||||
warnedAbout[ msg ] = true;
|
||||
jQuery.migrateWarnings.push( msg );
|
||||
if ( console && console.warn && !jQuery.migrateMute ) {
|
||||
console.warn( "JQMIGRATE: " + msg );
|
||||
if ( jQuery.migrateTrace && console.trace ) {
|
||||
console.trace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function migrateWarnProp( obj, prop, value, msg ) {
|
||||
if ( Object.defineProperty ) {
|
||||
// On ES5 browsers (non-oldIE), warn if the code tries to get prop;
|
||||
// allow property to be overwritten in case some other plugin wants it
|
||||
try {
|
||||
Object.defineProperty( obj, prop, {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
migrateWarn( msg );
|
||||
return value;
|
||||
},
|
||||
set: function( newValue ) {
|
||||
migrateWarn( msg );
|
||||
value = newValue;
|
||||
}
|
||||
});
|
||||
return;
|
||||
} catch( err ) {
|
||||
// IE8 is a dope about Object.defineProperty, can't warn there
|
||||
}
|
||||
}
|
||||
|
||||
// Non-ES5 (or broken) browser; just set the property
|
||||
jQuery._definePropertyBroken = true;
|
||||
obj[ prop ] = value;
|
||||
}
|
||||
|
||||
if ( document.compatMode === "BackCompat" ) {
|
||||
// jQuery has never supported or tested Quirks Mode
|
||||
migrateWarn( "jQuery is not compatible with Quirks Mode" );
|
||||
}
|
||||
|
||||
|
||||
var attrFn = jQuery( "<input/>", { size: 1 } ).attr("size") && jQuery.attrFn,
|
||||
oldAttr = jQuery.attr,
|
||||
valueAttrGet = jQuery.attrHooks.value && jQuery.attrHooks.value.get ||
|
||||
function() { return null; },
|
||||
valueAttrSet = jQuery.attrHooks.value && jQuery.attrHooks.value.set ||
|
||||
function() { return undefined; },
|
||||
rnoType = /^(?:input|button)$/i,
|
||||
rnoAttrNodeType = /^[238]$/,
|
||||
rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
|
||||
ruseDefault = /^(?:checked|selected)$/i;
|
||||
|
||||
// jQuery.attrFn
|
||||
migrateWarnProp( jQuery, "attrFn", attrFn || {}, "jQuery.attrFn is deprecated" );
|
||||
|
||||
jQuery.attr = function( elem, name, value, pass ) {
|
||||
var lowerName = name.toLowerCase(),
|
||||
nType = elem && elem.nodeType;
|
||||
|
||||
if ( pass ) {
|
||||
// Since pass is used internally, we only warn for new jQuery
|
||||
// versions where there isn't a pass arg in the formal params
|
||||
if ( oldAttr.length < 4 ) {
|
||||
migrateWarn("jQuery.fn.attr( props, pass ) is deprecated");
|
||||
}
|
||||
if ( elem && !rnoAttrNodeType.test( nType ) &&
|
||||
(attrFn ? name in attrFn : jQuery.isFunction(jQuery.fn[name])) ) {
|
||||
return jQuery( elem )[ name ]( value );
|
||||
}
|
||||
}
|
||||
|
||||
// Warn if user tries to set `type`, since it breaks on IE 6/7/8; by checking
|
||||
// for disconnected elements we don't warn on $( "<button>", { type: "button" } ).
|
||||
if ( name === "type" && value !== undefined && rnoType.test( elem.nodeName ) && elem.parentNode ) {
|
||||
migrateWarn("Can't change the 'type' of an input or button in IE 6/7/8");
|
||||
}
|
||||
|
||||
// Restore boolHook for boolean property/attribute synchronization
|
||||
if ( !jQuery.attrHooks[ lowerName ] && rboolean.test( lowerName ) ) {
|
||||
jQuery.attrHooks[ lowerName ] = {
|
||||
get: function( elem, name ) {
|
||||
// Align boolean attributes with corresponding properties
|
||||
// Fall back to attribute presence where some booleans are not supported
|
||||
var attrNode,
|
||||
property = jQuery.prop( elem, name );
|
||||
return property === true || typeof property !== "boolean" &&
|
||||
( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?
|
||||
|
||||
name.toLowerCase() :
|
||||
undefined;
|
||||
},
|
||||
set: function( elem, value, name ) {
|
||||
var propName;
|
||||
if ( value === false ) {
|
||||
// Remove boolean attributes when set to false
|
||||
jQuery.removeAttr( elem, name );
|
||||
} else {
|
||||
// value is true since we know at this point it's type boolean and not false
|
||||
// Set boolean attributes to the same name and set the DOM property
|
||||
propName = jQuery.propFix[ name ] || name;
|
||||
if ( propName in elem ) {
|
||||
// Only set the IDL specifically if it already exists on the element
|
||||
elem[ propName ] = true;
|
||||
}
|
||||
|
||||
elem.setAttribute( name, name.toLowerCase() );
|
||||
}
|
||||
return name;
|
||||
}
|
||||
};
|
||||
|
||||
// Warn only for attributes that can remain distinct from their properties post-1.9
|
||||
if ( ruseDefault.test( lowerName ) ) {
|
||||
migrateWarn( "jQuery.fn.attr('" + lowerName + "') may use property instead of attribute" );
|
||||
}
|
||||
}
|
||||
|
||||
return oldAttr.call( jQuery, elem, name, value );
|
||||
};
|
||||
|
||||
// attrHooks: value
|
||||
jQuery.attrHooks.value = {
|
||||
get: function( elem, name ) {
|
||||
var nodeName = ( elem.nodeName || "" ).toLowerCase();
|
||||
if ( nodeName === "button" ) {
|
||||
return valueAttrGet.apply( this, arguments );
|
||||
}
|
||||
if ( nodeName !== "input" && nodeName !== "option" ) {
|
||||
migrateWarn("jQuery.fn.attr('value') no longer gets properties");
|
||||
}
|
||||
return name in elem ?
|
||||
elem.value :
|
||||
null;
|
||||
},
|
||||
set: function( elem, value ) {
|
||||
var nodeName = ( elem.nodeName || "" ).toLowerCase();
|
||||
if ( nodeName === "button" ) {
|
||||
return valueAttrSet.apply( this, arguments );
|
||||
}
|
||||
if ( nodeName !== "input" && nodeName !== "option" ) {
|
||||
migrateWarn("jQuery.fn.attr('value', val) no longer sets properties");
|
||||
}
|
||||
// Does not return so that setAttribute is also used
|
||||
elem.value = value;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
var matched, browser,
|
||||
oldInit = jQuery.fn.init,
|
||||
oldParseJSON = jQuery.parseJSON,
|
||||
// Note: XSS check is done below after string is trimmed
|
||||
rquickExpr = /^([^<]*)(<[\w\W]+>)([^>]*)$/;
|
||||
|
||||
// $(html) "looks like html" rule change
|
||||
jQuery.fn.init = function( selector, context, rootjQuery ) {
|
||||
var match;
|
||||
|
||||
if ( selector && typeof selector === "string" && !jQuery.isPlainObject( context ) &&
|
||||
(match = rquickExpr.exec( jQuery.trim( selector ) )) && match[ 0 ] ) {
|
||||
// This is an HTML string according to the "old" rules; is it still?
|
||||
if ( selector.charAt( 0 ) !== "<" ) {
|
||||
migrateWarn("$(html) HTML strings must start with '<' character");
|
||||
}
|
||||
if ( match[ 3 ] ) {
|
||||
migrateWarn("$(html) HTML text after last tag is ignored");
|
||||
}
|
||||
// Consistently reject any HTML-like string starting with a hash (#9521)
|
||||
// Note that this may break jQuery 1.6.x code that otherwise would work.
|
||||
if ( match[ 0 ].charAt( 0 ) === "#" ) {
|
||||
migrateWarn("HTML string cannot start with a '#' character");
|
||||
jQuery.error("JQMIGRATE: Invalid selector string (XSS)");
|
||||
}
|
||||
// Now process using loose rules; let pre-1.8 play too
|
||||
if ( context && context.context ) {
|
||||
// jQuery object as context; parseHTML expects a DOM object
|
||||
context = context.context;
|
||||
}
|
||||
if ( jQuery.parseHTML ) {
|
||||
return oldInit.call( this, jQuery.parseHTML( match[ 2 ], context, true ),
|
||||
context, rootjQuery );
|
||||
}
|
||||
}
|
||||
return oldInit.apply( this, arguments );
|
||||
};
|
||||
jQuery.fn.init.prototype = jQuery.fn;
|
||||
|
||||
// Let $.parseJSON(falsy_value) return null
|
||||
jQuery.parseJSON = function( json ) {
|
||||
if ( !json && json !== null ) {
|
||||
migrateWarn("jQuery.parseJSON requires a valid JSON string");
|
||||
return null;
|
||||
}
|
||||
return oldParseJSON.apply( this, arguments );
|
||||
};
|
||||
|
||||
jQuery.uaMatch = function( ua ) {
|
||||
ua = ua.toLowerCase();
|
||||
|
||||
var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
|
||||
/(webkit)[ \/]([\w.]+)/.exec( ua ) ||
|
||||
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
|
||||
/(msie) ([\w.]+)/.exec( ua ) ||
|
||||
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
|
||||
[];
|
||||
|
||||
return {
|
||||
browser: match[ 1 ] || "",
|
||||
version: match[ 2 ] || "0"
|
||||
};
|
||||
};
|
||||
|
||||
// Don't clobber any existing jQuery.browser in case it's different
|
||||
if ( !jQuery.browser ) {
|
||||
matched = jQuery.uaMatch( navigator.userAgent );
|
||||
browser = {};
|
||||
|
||||
if ( matched.browser ) {
|
||||
browser[ matched.browser ] = true;
|
||||
browser.version = matched.version;
|
||||
}
|
||||
|
||||
// Chrome is Webkit, but Webkit is also Safari.
|
||||
if ( browser.chrome ) {
|
||||
browser.webkit = true;
|
||||
} else if ( browser.webkit ) {
|
||||
browser.safari = true;
|
||||
}
|
||||
|
||||
jQuery.browser = browser;
|
||||
}
|
||||
|
||||
// Warn if the code tries to get jQuery.browser
|
||||
migrateWarnProp( jQuery, "browser", jQuery.browser, "jQuery.browser is deprecated" );
|
||||
|
||||
jQuery.sub = function() {
|
||||
function jQuerySub( selector, context ) {
|
||||
return new jQuerySub.fn.init( selector, context );
|
||||
}
|
||||
jQuery.extend( true, jQuerySub, this );
|
||||
jQuerySub.superclass = this;
|
||||
jQuerySub.fn = jQuerySub.prototype = this();
|
||||
jQuerySub.fn.constructor = jQuerySub;
|
||||
jQuerySub.sub = this.sub;
|
||||
jQuerySub.fn.init = function init( selector, context ) {
|
||||
if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
|
||||
context = jQuerySub( context );
|
||||
}
|
||||
|
||||
return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
|
||||
};
|
||||
jQuerySub.fn.init.prototype = jQuerySub.fn;
|
||||
var rootjQuerySub = jQuerySub(document);
|
||||
migrateWarn( "jQuery.sub() is deprecated" );
|
||||
return jQuerySub;
|
||||
};
|
||||
|
||||
|
||||
// Ensure that $.ajax gets the new parseJSON defined in core.js
|
||||
jQuery.ajaxSetup({
|
||||
converters: {
|
||||
"text json": jQuery.parseJSON
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
var oldFnData = jQuery.fn.data;
|
||||
|
||||
jQuery.fn.data = function( name ) {
|
||||
var ret, evt,
|
||||
elem = this[0];
|
||||
|
||||
// Handles 1.7 which has this behavior and 1.8 which doesn't
|
||||
if ( elem && name === "events" && arguments.length === 1 ) {
|
||||
ret = jQuery.data( elem, name );
|
||||
evt = jQuery._data( elem, name );
|
||||
if ( ( ret === undefined || ret === evt ) && evt !== undefined ) {
|
||||
migrateWarn("Use of jQuery.fn.data('events') is deprecated");
|
||||
return evt;
|
||||
}
|
||||
}
|
||||
return oldFnData.apply( this, arguments );
|
||||
};
|
||||
|
||||
|
||||
var rscriptType = /\/(java|ecma)script/i,
|
||||
oldSelf = jQuery.fn.andSelf || jQuery.fn.addBack;
|
||||
|
||||
jQuery.fn.andSelf = function() {
|
||||
migrateWarn("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()");
|
||||
return oldSelf.apply( this, arguments );
|
||||
};
|
||||
|
||||
// Since jQuery.clean is used internally on older versions, we only shim if it's missing
|
||||
if ( !jQuery.clean ) {
|
||||
jQuery.clean = function( elems, context, fragment, scripts ) {
|
||||
// Set context per 1.8 logic
|
||||
context = context || document;
|
||||
context = !context.nodeType && context[0] || context;
|
||||
context = context.ownerDocument || context;
|
||||
|
||||
migrateWarn("jQuery.clean() is deprecated");
|
||||
|
||||
var i, elem, handleScript, jsTags,
|
||||
ret = [];
|
||||
|
||||
jQuery.merge( ret, jQuery.buildFragment( elems, context ).childNodes );
|
||||
|
||||
// Complex logic lifted directly from jQuery 1.8
|
||||
if ( fragment ) {
|
||||
// Special handling of each script element
|
||||
handleScript = function( elem ) {
|
||||
// Check if we consider it executable
|
||||
if ( !elem.type || rscriptType.test( elem.type ) ) {
|
||||
// Detach the script and store it in the scripts array (if provided) or the fragment
|
||||
// Return truthy to indicate that it has been handled
|
||||
return scripts ?
|
||||
scripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) :
|
||||
fragment.appendChild( elem );
|
||||
}
|
||||
};
|
||||
|
||||
for ( i = 0; (elem = ret[i]) != null; i++ ) {
|
||||
// Check if we're done after handling an executable script
|
||||
if ( !( jQuery.nodeName( elem, "script" ) && handleScript( elem ) ) ) {
|
||||
// Append to fragment and handle embedded scripts
|
||||
fragment.appendChild( elem );
|
||||
if ( typeof elem.getElementsByTagName !== "undefined" ) {
|
||||
// handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration
|
||||
jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript );
|
||||
|
||||
// Splice the scripts into ret after their former ancestor and advance our index beyond them
|
||||
ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
|
||||
i += jsTags.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
};
|
||||
}
|
||||
|
||||
var eventAdd = jQuery.event.add,
|
||||
eventRemove = jQuery.event.remove,
|
||||
eventTrigger = jQuery.event.trigger,
|
||||
oldToggle = jQuery.fn.toggle,
|
||||
oldLive = jQuery.fn.live,
|
||||
oldDie = jQuery.fn.die,
|
||||
ajaxEvents = "ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess",
|
||||
rajaxEvent = new RegExp( "\\b(?:" + ajaxEvents + ")\\b" ),
|
||||
rhoverHack = /(?:^|\s)hover(\.\S+|)\b/,
|
||||
hoverHack = function( events ) {
|
||||
if ( typeof( events ) !== "string" || jQuery.event.special.hover ) {
|
||||
return events;
|
||||
}
|
||||
if ( rhoverHack.test( events ) ) {
|
||||
migrateWarn("'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'");
|
||||
}
|
||||
return events && events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );
|
||||
};
|
||||
|
||||
// Event props removed in 1.9, put them back if needed; no practical way to warn them
|
||||
if ( jQuery.event.props && jQuery.event.props[ 0 ] !== "attrChange" ) {
|
||||
jQuery.event.props.unshift( "attrChange", "attrName", "relatedNode", "srcElement" );
|
||||
}
|
||||
|
||||
// Undocumented jQuery.event.handle was "deprecated" in jQuery 1.7
|
||||
if ( jQuery.event.dispatch ) {
|
||||
migrateWarnProp( jQuery.event, "handle", jQuery.event.dispatch, "jQuery.event.handle is undocumented and deprecated" );
|
||||
}
|
||||
|
||||
// Support for 'hover' pseudo-event and ajax event warnings
|
||||
jQuery.event.add = function( elem, types, handler, data, selector ){
|
||||
if ( elem !== document && rajaxEvent.test( types ) ) {
|
||||
migrateWarn( "AJAX events should be attached to document: " + types );
|
||||
}
|
||||
eventAdd.call( this, elem, hoverHack( types || "" ), handler, data, selector );
|
||||
};
|
||||
jQuery.event.remove = function( elem, types, handler, selector, mappedTypes ){
|
||||
eventRemove.call( this, elem, hoverHack( types ) || "", handler, selector, mappedTypes );
|
||||
};
|
||||
|
||||
jQuery.fn.error = function() {
|
||||
var args = Array.prototype.slice.call( arguments, 0);
|
||||
migrateWarn("jQuery.fn.error() is deprecated");
|
||||
args.splice( 0, 0, "error" );
|
||||
if ( arguments.length ) {
|
||||
return this.bind.apply( this, args );
|
||||
}
|
||||
// error event should not bubble to window, although it does pre-1.7
|
||||
this.triggerHandler.apply( this, args );
|
||||
return this;
|
||||
};
|
||||
|
||||
jQuery.fn.toggle = function( fn, fn2 ) {
|
||||
|
||||
// Don't mess with animation or css toggles
|
||||
if ( !jQuery.isFunction( fn ) || !jQuery.isFunction( fn2 ) ) {
|
||||
return oldToggle.apply( this, arguments );
|
||||
}
|
||||
migrateWarn("jQuery.fn.toggle(handler, handler...) is deprecated");
|
||||
|
||||
// Save reference to arguments for access in closure
|
||||
var args = arguments,
|
||||
guid = fn.guid || jQuery.guid++,
|
||||
i = 0,
|
||||
toggler = function( event ) {
|
||||
// Figure out which function to execute
|
||||
var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
|
||||
jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
|
||||
|
||||
// Make sure that clicks stop
|
||||
event.preventDefault();
|
||||
|
||||
// and execute the function
|
||||
return args[ lastToggle ].apply( this, arguments ) || false;
|
||||
};
|
||||
|
||||
// link all the functions, so any of them can unbind this click handler
|
||||
toggler.guid = guid;
|
||||
while ( i < args.length ) {
|
||||
args[ i++ ].guid = guid;
|
||||
}
|
||||
|
||||
return this.click( toggler );
|
||||
};
|
||||
|
||||
jQuery.fn.live = function( types, data, fn ) {
|
||||
migrateWarn("jQuery.fn.live() is deprecated");
|
||||
if ( oldLive ) {
|
||||
return oldLive.apply( this, arguments );
|
||||
}
|
||||
jQuery( this.context ).on( types, this.selector, data, fn );
|
||||
return this;
|
||||
};
|
||||
|
||||
jQuery.fn.die = function( types, fn ) {
|
||||
migrateWarn("jQuery.fn.die() is deprecated");
|
||||
if ( oldDie ) {
|
||||
return oldDie.apply( this, arguments );
|
||||
}
|
||||
jQuery( this.context ).off( types, this.selector || "**", fn );
|
||||
return this;
|
||||
};
|
||||
|
||||
// Turn global events into document-triggered events
|
||||
jQuery.event.trigger = function( event, data, elem, onlyHandlers ){
|
||||
if ( !elem && !rajaxEvent.test( event ) ) {
|
||||
migrateWarn( "Global events are undocumented and deprecated" );
|
||||
}
|
||||
return eventTrigger.call( this, event, data, elem || document, onlyHandlers );
|
||||
};
|
||||
jQuery.each( ajaxEvents.split("|"),
|
||||
function( _, name ) {
|
||||
jQuery.event.special[ name ] = {
|
||||
setup: function() {
|
||||
var elem = this;
|
||||
|
||||
// The document needs no shimming; must be !== for oldIE
|
||||
if ( elem !== document ) {
|
||||
jQuery.event.add( document, name + "." + jQuery.guid, function() {
|
||||
jQuery.event.trigger( name, null, elem, true );
|
||||
});
|
||||
jQuery._data( this, name, jQuery.guid++ );
|
||||
}
|
||||
return false;
|
||||
},
|
||||
teardown: function() {
|
||||
if ( this !== document ) {
|
||||
jQuery.event.remove( document, name + "." + jQuery._data( this, name ) );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
})( jQuery, window );
|
||||
+38
@@ -294,6 +294,44 @@ function removeQuotes(value)
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a MessageBox
|
||||
* @param {string} msg
|
||||
* @param {string} title (optional)
|
||||
*/
|
||||
function fancyMsgBox(msg, title)
|
||||
{
|
||||
if (title) msg = "<h2>" + title + "</h2><p>" + msg + "</p>";
|
||||
msg += "<br/><p class=\"submit\" style=\"text-align:right; padding-bottom: 0\"><input class=\"button\" type=\"button\" value=\"OK\" onclick=\"$.fancybox.close();\" /></p>";
|
||||
$.fancybox( msg, {'autoDimensions': false, 'width': 500, 'height': 'auto', 'transitionIn': 'none', 'transitionOut': 'none'} );
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a messageDialog with different buttons including a callback for each one
|
||||
* @param {string} question
|
||||
* @param {mixed} title Optional title for the dialog box. Send false if you don't want any title
|
||||
* @param {object} buttons Associative array containg a list of {buttonCaption: callbackFunctionName, ...}. Use an empty space instead of function name for no callback
|
||||
* @param {mixed} otherParams Optional data sent to the callback function
|
||||
*/
|
||||
function fancyChooseBox(question, title, buttons, otherParams)
|
||||
{
|
||||
var msg, funcName, action;
|
||||
if (title) msg = "<h2>" + title + "</h2><p>" + question + "</p>";
|
||||
msg += "<br/><p class=\"submit\" style=\"text-align:right; padding-bottom: 0\">";
|
||||
var i = 0;
|
||||
for (var caption in buttons) {
|
||||
if (!buttons.hasOwnProperty(caption)) continue;
|
||||
funcName = buttons[caption];
|
||||
if (typeof otherParams == 'undefined') otherParams = 0;
|
||||
otherParams = escape(JSON.stringify(otherParams));
|
||||
action = funcName ? "$.fancybox.close();window['" + funcName + "'](JSON.parse(unescape('" + otherParams + "')), " + i + ")" : "$.fancybox.close()";
|
||||
msg += '<input class="button" style="margin-right: 5px" type="button" value="' + caption + '" onclick="' + action + '" />';
|
||||
i++;
|
||||
}
|
||||
msg += "</p>";
|
||||
$.fancybox( msg, {'autoDimensions': false, 'width': 500, 'height': 'auto', 'transitionIn': 'none', 'transitionOut': 'none'} );
|
||||
}
|
||||
|
||||
//On dom ready
|
||||
$().ready(function()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user