From 618505c0c72b42f25aad952a6b3c827a6b527cff Mon Sep 17 00:00:00 2001 From: kovacsv Date: Sun, 18 Nov 2018 12:47:01 +0100 Subject: [PATCH] Progress bar with jquery. --- website/include/importerapp.js | 19 +++++++------------ website/include/importermenu.js | 17 ++++------------- 2 files changed, 11 insertions(+), 25 deletions(-) diff --git a/website/include/importerapp.js b/website/include/importerapp.js index b901aba..6a9a88e 100644 --- a/website/include/importerapp.js +++ b/website/include/importerapp.js @@ -318,10 +318,8 @@ ImporterApp.prototype.GenerateMenu = function () ImporterApp.prototype.GenerateError = function (errorMessage) { this.viewer.RemoveMeshes (); - var menu = document.getElementById ('menu'); - while (menu.lastChild) { - menu.removeChild (menu.lastChild); - } + var menu = $('#menu'); + menu.empty (); this.dialog.Open ({ title : 'Error', @@ -446,14 +444,12 @@ ImporterApp.prototype.ProcessFiles = function (fileList, isUrl) processorFunc = JSM.ConvertURLListToJsonData; } - var menu = document.getElementById ('menu'); - while (menu.lastChild) { - menu.removeChild (menu.lastChild); - } + var menu = $('#menu'); + menu.empty (); if (isUrl) { - menu.innerHTML = 'Downloading files...'; + menu.html ('Downloading files...'); } else { - menu.innerHTML = 'Loading files...'; + menu.html ('Loading files...'); } processorFunc (userFiles, { @@ -464,8 +460,7 @@ ImporterApp.prototype.ProcessFiles = function (fileList, isUrl) onReady : function (fileNames, jsonData) { myThis.fileNames = fileNames; myThis.viewer.SetJsonData (jsonData); - - var menu = document.getElementById ('menu'); + menu.empty (); var progressBar = new ImporterProgressBar (menu); myThis.JsonLoaded (progressBar); } diff --git a/website/include/importermenu.js b/website/include/importermenu.js index 9cdb3b5..24e4978 100644 --- a/website/include/importermenu.js +++ b/website/include/importermenu.js @@ -143,9 +143,6 @@ ExtensionButtons.prototype.GetButtonsDiv = function () ImporterProgressBar = function (parent) { this.parent = parent; - while (this.parent.lastChild) { - this.parent.removeChild (this.parent.lastChild); - } this.borderDiv = null; this.contentDiv = null; this.maxCount = null; @@ -154,17 +151,11 @@ ImporterProgressBar = function (parent) ImporterProgressBar.prototype.Init = function (maxCount) { - this.borderDiv = document.createElement ('div'); - this.borderDiv.className = 'progressbarborder'; + this.borderDiv = $('
').addClass ('progressbarborder').appendTo (this.parent); + this.contentDiv = $('
').addClass ('progressbarcontent').appendTo (this.borderDiv); - this.contentDiv = document.createElement ('div'); - this.contentDiv.className = 'progressbarcontent'; - - this.borderDiv.appendChild (this.contentDiv); - this.parent.appendChild (this.borderDiv); - this.maxCount = maxCount; - this.maxWidth = this.borderDiv.offsetWidth; + this.maxWidth = this.borderDiv.width (); this.Step (0); }; @@ -175,5 +166,5 @@ ImporterProgressBar.prototype.Step = function (count) if (count == this.maxCount) { width = this.maxWidth - 2; } - this.contentDiv.style.width = width + 'px'; + this.contentDiv.width (width); };