Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
f3aa73ae
Commit
f3aa73ae
authored
Feb 18, 2012
by
Dries Buytaert
Browse files
- Patch
#1444160
by Niklas Fiekas: Drupal.behaviors.dateTime needs a clean-up.
parent
c6d3a24e
Changes
1
Hide whitespace changes
Inline
Side-by-side
core/modules/system/system.js
View file @
f3aa73ae
...
...
@@ -96,19 +96,22 @@ Drupal.behaviors.copyFieldValue = {
*/
Drupal
.
behaviors
.
dateTime
=
{
attach
:
function
(
context
,
settings
)
{
for
(
var
value
in
settings
.
dateTime
)
{
var
settings
=
settings
.
dateTime
[
value
];
var
source
=
'
#edit-
'
+
value
;
var
suffix
=
source
+
'
-suffix
'
;
for
(
var
fieldName
in
settings
.
dateTime
)
{
if
(
settings
.
dateTime
.
hasOwnProperty
(
fieldName
))
{
(
function
(
fieldSettings
,
fieldName
)
{
var
source
=
'
#edit-
'
+
fieldName
;
var
suffix
=
source
+
'
-suffix
'
;
// Attach keyup handler to custom format inputs.
$
(
'
input
'
+
source
,
context
).
once
(
'
date-time
'
).
keyup
(
function
()
{
var
input
=
$
(
this
);
var
url
=
settings
.
lookup
+
(
settings
.
lookup
.
match
(
/
\?
q=/
)
?
'
&format=
'
:
'
?format=
'
)
+
encodeURIComponent
(
input
.
val
());
$
.
getJSON
(
url
,
function
(
data
)
{
$
(
suffix
).
empty
().
append
(
'
'
+
settings
.
text
+
'
: <em>
'
+
data
+
'
</em>
'
);
});
});
// Attach keyup handler to custom format inputs.
$
(
'
input
'
+
source
,
context
).
once
(
'
date-time
'
).
keyup
(
function
()
{
var
input
=
$
(
this
);
var
url
=
fieldSettings
.
lookup
+
(
fieldSettings
.
lookup
.
match
(
/
\?
q=/
)
?
'
&format=
'
:
'
?format=
'
)
+
encodeURIComponent
(
input
.
val
());
$
.
getJSON
(
url
,
function
(
data
)
{
$
(
suffix
).
empty
().
append
(
'
'
+
fieldSettings
.
text
+
'
: <em>
'
+
data
+
'
</em>
'
);
});
});
})(
settings
.
dateTime
[
fieldName
],
fieldName
);
}
}
}
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment