Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Commits
f6528ec8
Commit
f6528ec8
authored
15 years ago
by
Angie Byron
Browse files
Options
Downloads
Patches
Plain Diff
#572872
by cwgordon7: Fixed coding style problems in collapse.js.
parent
53b9e820
No related branches found
No related tags found
2 merge requests
!7452
Issue #1797438. HTML5 validation is preventing form submit and not fully...
,
!789
Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
misc/collapse.js
+8
-7
8 additions, 7 deletions
misc/collapse.js
with
8 additions
and
7 deletions
misc/collapse.js
+
8
−
7
View file @
f6528ec8
...
...
@@ -2,7 +2,7 @@
(
function
(
$
)
{
/**
* Toggle the visibility of a fieldset using smooth animations
* Toggle the visibility of a fieldset using smooth animations
.
*/
Drupal
.
toggleFieldset
=
function
(
fieldset
)
{
if
(
$
(
fieldset
).
is
(
'
.collapsed
'
))
{
...
...
@@ -20,7 +20,7 @@ Drupal.toggleFieldset = function (fieldset) {
$
(
'
div.action
'
,
fieldset
).
show
();
},
step
:
function
()
{
// Scroll the fieldset into view
// Scroll the fieldset into view
.
Drupal
.
collapseScrollIntoView
(
this
.
parentNode
);
}
});
...
...
@@ -45,7 +45,8 @@ Drupal.collapseScrollIntoView = function (node) {
if
(
posY
+
node
.
offsetHeight
+
fudge
>
h
+
offset
)
{
if
(
node
.
offsetHeight
>
h
)
{
window
.
scrollTo
(
0
,
posY
);
}
else
{
}
else
{
window
.
scrollTo
(
0
,
posY
+
node
.
offsetHeight
-
h
+
fudge
);
}
}
...
...
@@ -55,7 +56,7 @@ Drupal.behaviors.collapse = {
attach
:
function
(
context
,
settings
)
{
$
(
'
fieldset.collapsible > legend
'
,
context
).
once
(
'
collapse
'
,
function
()
{
var
fieldset
=
$
(
this
.
parentNode
);
// Expand if there are errors inside
// Expand if there are errors inside
.
if
(
$
(
'
input.error, textarea.error, select.error
'
,
fieldset
).
size
()
>
0
)
{
fieldset
.
removeClass
(
'
collapsed
'
);
}
...
...
@@ -68,12 +69,12 @@ Drupal.behaviors.collapse = {
})
.
trigger
(
'
summaryUpdated
'
);
// Turn the legend into a clickable link and wrap the contents of the
fieldset
// in a div for easier animation
// Turn the legend into a clickable link and wrap the contents of the
//
fieldset
in a div for easier animation
.
var
text
=
this
.
innerHTML
;
$
(
this
).
empty
().
append
(
$
(
'
<a href="#">
'
+
text
+
'
</a>
'
).
click
(
function
()
{
var
fieldset
=
$
(
this
).
parents
(
'
fieldset:first
'
)[
0
];
// Don't animate multiple times
// Don't animate multiple times
.
if
(
!
fieldset
.
animating
)
{
fieldset
.
animating
=
true
;
Drupal
.
toggleFieldset
(
fieldset
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment