Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal-3338541
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
Issue forks
drupal-3338541
Commits
e6cfbba9
Commit
e6cfbba9
authored
12 years ago
by
Angie Byron
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#1574490
by frega, nod_: Clean-up: batch.js.
parent
be8126ff
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/misc/batch.js
+25
-23
25 additions, 23 deletions
core/misc/batch.js
with
25 additions
and
23 deletions
core/misc/batch.js
+
25
−
23
View file @
e6cfbba9
(
function
(
$
)
{
(
function
(
$
,
Drupal
)
{
"
use strict
"
;
...
...
@@ -7,31 +7,33 @@
*/
Drupal
.
behaviors
.
batch
=
{
attach
:
function
(
context
,
settings
)
{
$
(
context
).
find
(
'
#progress
'
).
once
(
'
batch
'
,
function
()
{
var
holder
=
$
(
this
);
// Remove HTML from no-js progress bar. The JS progress bar is created
// later on.
holder
.
empty
();
var
batch
=
settings
.
batch
;
var
$progress
=
$
(
'
#progress
'
).
once
(
'
batch
'
);
var
progressBar
;
// Success: redirect to the summary.
var
updateCallback
=
function
(
progress
,
status
,
pb
)
{
if
(
progress
===
'
100
'
)
{
pb
.
stopMonitoring
();
window
.
location
=
settings
.
batch
.
uri
+
'
&op=finished
'
;
}
};
// Success: redirect to the summary.
function
updateCallback
(
progress
,
status
,
pb
)
{
if
(
progress
===
'
100
'
)
{
pb
.
stopMonitoring
();
window
.
location
=
batch
.
uri
+
'
&op=finished
'
;
}
}
var
errorCallback
=
function
(
pb
)
{
holder
.
prepend
(
$
(
'
<p class="error"></p>
'
).
html
(
settings
.
batch
.
errorMessage
));
$
(
'
#wait
'
).
hide
();
};
function
errorCallback
(
pb
)
{
$progress
.
prepend
(
$
(
'
<p class="error"></p>
'
).
html
(
batch
.
errorMessage
));
$
(
'
#wait
'
).
hide
();
}
var
progress
=
new
Drupal
.
ProgressBar
(
'
updateprogress
'
,
updateCallback
,
'
POST
'
,
errorCallback
);
progress
.
setProgress
(
-
1
,
settings
.
batch
.
initMessage
);
holder
.
append
(
progress
.
element
);
progress
.
startMonitoring
(
settings
.
batch
.
uri
+
'
&op=do
'
,
10
);
});
if
(
$progress
.
length
)
{
progressBar
=
new
Drupal
.
ProgressBar
(
'
updateprogress
'
,
updateCallback
,
'
POST
'
,
errorCallback
);
progressBar
.
setProgress
(
-
1
,
batch
.
initMessage
);
progressBar
.
startMonitoring
(
batch
.
uri
+
'
&op=do
'
,
10
);
// Remove HTML from no-js progress bar.
$progress
.
empty
();
// Append the JS progressbar element.
$progress
.
append
(
progressBar
.
element
);
}
}
};
})(
jQuery
);
})(
jQuery
,
Drupal
);
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