<div id="progress" class="batch-processed"> <div class="progress" aria-live="polite" id="updateprogress"> <div class="bar"> <div class="filled" style="width: 0%;"></div> </div> <div class="percentage">0%</div> <div class="message">ETA: N/A<br>初期化中。<br> </div> </div> </div>
<div class="progress-wrapper" aria-live="polite"> <div id="updateprogress" class="progress"> <div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0" style="width: 0%;"> <div class="percentage sr-only">0%</div> </div> </div> <div class="percentage pull-right">0%</div> <div class="message">ETA: N/A<br>初期化中。<br> </div> </div>
.progress { font-weight: bold; } .progress .bar { background: #ccc; border-color: #666; margin: 0 0.2em; border-radius: 3px; } .progress .filled { background: #0072b9 url(../../../../../misc/progress.gif); }
// オリジナルソースコード(Drupalのプログレスバー) this.element = $('<div class="progress" aria-live="polite"></div>').attr('id', id); this.element.html('<div class="bar"><div class="filled"></div></div>' + '<div class="percentage"></div>' + '<div class="message"> </div>'); // 以下のソースで書き換える // Bootstrapのプログレスバー this.element = $('<div class="progress-wrapper" aria-live="polite"></div>'); this.element.html('<div id ="' + id + '" class="progress">' + '<div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0">' + '<div class="percentage sr-only"></div>' + '</div></div>' + '</div><div class="percentage pull-right"></div>' + '<div class="message"> </div>');
// オリジナルのプログレス情報更新ロジック Drupal.progressBar.prototype.setProgress = function (percentage, message) { if (percentage >= 0 && percentage <= 100) { $('div.filled', this.element).css('width', percentage + '%'); $('div.percentage', this.element).html(percentage + '%'); } $('div.message', this.element).html(message); if (this.updateCallback) { this.updateCallback(percentage, message, this); } }; // 以下のロジックで書き換え // Bootstrapのプログレス情報更新ロジック Drupal.progressBar.prototype.setProgress = function (percentage, message) { if (percentage >= 0 && percentage <= 100) { $('div.progress-bar', this.element).css('width', percentage + '%'); $('div.progress-bar', this.element).attr('aria-valuenow', percentage); $('div.percentage', this.element).html(percentage + '%'); } $('div.message', this.element).html(message); if (this.updateCallback) { this.updateCallback(percentage, message, this); } };