mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-01 14:30:32 +02:00
[ticket/14438] Allign progressbar text to center
PHPBB3-14438
This commit is contained in:
@@ -177,7 +177,7 @@
|
||||
* @param progressObject
|
||||
*/
|
||||
function setProgress(progressObject) {
|
||||
var $statusText, $progressBar, $progressText, $progressFiller;
|
||||
var $statusText, $progressBar, $progressText, $progressFiller, $progressFillerText;
|
||||
|
||||
if (progressObject.task_name.length) {
|
||||
if (!progressBarTriggered) {
|
||||
@@ -189,18 +189,23 @@
|
||||
$progressBar.attr('id', 'progress-bar');
|
||||
$progressText = $('<p />');
|
||||
$progressText.attr('id', 'progress-bar-text');
|
||||
$progressFiller = $('<span />');
|
||||
$progressFiller = $('<div />');
|
||||
$progressFiller.attr('id', 'progress-bar-filler');
|
||||
$progressFiller.html($progressText);
|
||||
$progressFillerText = $('<p />');
|
||||
$progressFillerText.attr('id', 'progress-bar-filler-text');
|
||||
|
||||
$statusText = $('<p />');
|
||||
$statusText.attr('id', 'progress-status-text');
|
||||
|
||||
$progressFiller.append($progressFillerText);
|
||||
$progressBar.append($progressText);
|
||||
$progressBar.append($progressFiller);
|
||||
|
||||
$progressBarWrapper.append($statusText);
|
||||
$progressBarWrapper.append($progressBar);
|
||||
|
||||
$progressFillerText.css('width', $progressBar.width());
|
||||
|
||||
progressBarTriggered = true;
|
||||
} else if (progressObject.hasOwnProperty('restart')) {
|
||||
clearInterval(progressTimer);
|
||||
@@ -210,6 +215,7 @@
|
||||
$statusText = $('#progress-status-text');
|
||||
|
||||
$progressText.text('0%');
|
||||
$progressFillerText.text('0%');
|
||||
$progressFiller.css('width', '0%');
|
||||
|
||||
currentProgress = 0;
|
||||
@@ -342,15 +348,20 @@
|
||||
*
|
||||
* @param $progressText
|
||||
* @param $progressFiller
|
||||
* @param $progressFillerText
|
||||
* @param progressLimit
|
||||
*/
|
||||
function incrementFiller($progressText, $progressFiller, progressLimit) {
|
||||
function incrementFiller($progressText, $progressFiller, $progressFillerText, progressLimit) {
|
||||
if (currentProgress >= progressLimit || currentProgress >= 100) {
|
||||
clearInterval(progressTimer);
|
||||
return;
|
||||
}
|
||||
|
||||
var $progressBar = $('#progress-bar');
|
||||
|
||||
currentProgress++;
|
||||
$progressFillerText.css('width', $progressBar.width());
|
||||
$progressFillerText.text(currentProgress + '%');
|
||||
$progressText.text(currentProgress + '%');
|
||||
$progressFiller.css('width', currentProgress + '%');
|
||||
}
|
||||
@@ -362,13 +373,14 @@
|
||||
*/
|
||||
function incrementProgressBar(progressLimit) {
|
||||
var $progressFiller = $('#progress-bar-filler');
|
||||
var $progressFillerText = $('#progress-bar-filler-text');
|
||||
var $progressText = $('#progress-bar-text');
|
||||
var progressStart = $progressFiller.width() / $progressFiller.offsetParent().width() * 100;
|
||||
currentProgress = Math.floor(progressStart);
|
||||
|
||||
clearInterval(progressTimer);
|
||||
progressTimer = setInterval(function() {
|
||||
incrementFiller($progressText, $progressFiller, progressLimit);
|
||||
incrementFiller($progressText, $progressFiller, $progressFillerText, progressLimit);
|
||||
}, 10);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user