aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2013-03-23 09:23:59 +0000
committerrvelices <rv-github@modusoptimus.com>2013-03-23 09:23:59 +0000
commit0804d945651cba6dddae1150499cfe075c44c9ea (patch)
tree8e362bd818db33508231e253b1c8a2a2ec7bbbba
parentdb1903ed5f6ca68fae48036e45a4e88aeb881994 (diff)
fix compatibility with jquery 1.9
git-svn-id: http://piwigo.org/svn/trunk@21798 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r--themes/default/js/datepicker.js33
1 files changed, 15 insertions, 18 deletions
diff --git a/themes/default/js/datepicker.js b/themes/default/js/datepicker.js
index 93e712e02..ff2c2d4d2 100644
--- a/themes/default/js/datepicker.js
+++ b/themes/default/js/datepicker.js
@@ -16,13 +16,13 @@ function pwg_common_initialization_datepicker(buttonImageName, day, month, year,
// return if linked_date is valid date
function is_valid_linked_value(linked_date_name)
{
- array_date = $(linked_date_name).val().split('-');
- return (
- (array_date.length == 3) &&
- (array_date[0] != "") &&
- (array_date[1] != "") && (array_date[1] != "0") &&
- (array_date[2] != "") && (array_date[2] != "0")
- )
+ var array_date = $(linked_date_name).val().split('-');
+ return (
+ (array_date.length == 3) &&
+ (array_date[0].length) &&
+ (array_date[1].length) && (array_date[1] != "0") &&
+ (array_date[2].length) && (array_date[2] != "0")
+ )
}
// Action on change date value
@@ -31,16 +31,16 @@ function pwg_common_initialization_datepicker(buttonImageName, day, month, year,
pwg_check_date();
if (checked_on_change != null)
{
- $(checked_on_change).attr("checked", "true");
+ $(checked_on_change).prop("checked", true);
}
}
// In order to desable element of list
function pwg_disabled_selection()
{
- array_date = $(linked_date).val().split('-');
- y = array_date[0];
- m = array_date[1];
+ var array_date = $(linked_date).val().split('-')
+ , y = array_date[0]
+ , m = array_date[1];
// Init list
$(day + " option").removeAttr("disabled");
@@ -95,7 +95,8 @@ function pwg_common_initialization_datepicker(buttonImageName, day, month, year,
// Prevent selection of invalid dates through the select controls
function pwg_check_date()
{
- last_date = $(linked_date).val();
+ var last_date = $(linked_date).val()
+ , cancel=false;
$(linked_date).val(pwg_get_fmt_from_ctrls());
@@ -107,14 +108,10 @@ function pwg_common_initialization_datepicker(buttonImageName, day, month, year,
{
cancel = ($(max_linked_date).datepicker("getDate") < $(linked_date).datepicker("getDate"));
}
- else
- {
- cancel = false;
- }
if (cancel)
{
- array_date = last_date.split('-');
+ var array_date = last_date.split('-');
$(year).val(array_date[0]);
$(month).val(array_date[1]);
$(day).val(array_date[2]);
@@ -157,7 +154,7 @@ function pwg_common_initialization_datepicker(buttonImageName, day, month, year,
}
else
{
- array_date = date.split('-');
+ var array_date = date.split('-');
$(year).val(array_date[0]);
$(month).val(array_date[1]);
$(day).val(array_date[2]);