mirror of
https://github.com/pdf2htmlEX/pdf2htmlEX.git
synced 2024-12-22 13:00:08 +00:00
Only add loading indicator if not already present
If for some reason the xhr request failed, the loading indicator cloned again upon new request. This pull request makes sure that the loading indicator should only be cloned into page container if not already present.
This commit is contained in:
parent
8b166129d3
commit
9326378bbf
@ -361,10 +361,13 @@ Viewer.prototype = {
|
|||||||
if (url) {
|
if (url) {
|
||||||
this.pages_loading[idx] = true; // set semaphore
|
this.pages_loading[idx] = true; // set semaphore
|
||||||
|
|
||||||
// add a copy of the loading indicator
|
// add a copy of the loading indicator if not already present
|
||||||
var new_loading_indicator = this.loading_indicator.cloneNode();
|
var new_loading_indicator = cur_page_ele.getElementsByClassName(this.config['loading_indicator_cls'])[0];
|
||||||
new_loading_indicator.classList.add('active');
|
if (typeof new_loading_indicator === 'undefined'){
|
||||||
cur_page_ele.appendChild(new_loading_indicator);
|
new_loading_indicator = this.loading_indicator.cloneNode(true);
|
||||||
|
new_loading_indicator.classList.add('active');
|
||||||
|
cur_page_ele.appendChild(new_loading_indicator);
|
||||||
|
}
|
||||||
|
|
||||||
// load data
|
// load data
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user