From 254d89ad2b20640e8a4fb1a606d31d75bd783d78 Mon Sep 17 00:00:00 2001 From: bohlski Date: Fri, 11 Nov 2022 14:19:31 +0100 Subject: [PATCH 01/12] Clean js dashboard_components files --- .../dashboard_components/ColorMapper.js | 26 +- .../dashboard_components/collectionSizePie.js | 69 ++- .../dashboard_components/collectionStatus.js | 250 ++++++----- .../dashboard_components/dataSizeGraph.js | 396 +++++++++--------- .../dataSizeGraphController.js | 39 +- .../dashboard_components/legsSizePie.js | 67 ++- .../procedure_for_control_text.jsp | 28 -- 7 files changed, 415 insertions(+), 460 deletions(-) delete mode 100644 bitrepository-webclient/src/main/webapp/dashboard_components/procedure_for_control_text.jsp diff --git a/bitrepository-webclient/src/main/webapp/dashboard_components/ColorMapper.js b/bitrepository-webclient/src/main/webapp/dashboard_components/ColorMapper.js index 349749c7c..446a94cd4 100644 --- a/bitrepository-webclient/src/main/webapp/dashboard_components/ColorMapper.js +++ b/bitrepository-webclient/src/main/webapp/dashboard_components/ColorMapper.js @@ -1,19 +1,15 @@ - - - function ColorMapper(collections) { - - var colorList = new Array("#8cacc6", "#ee1c1c", "#4da74d", "#9440ed", "#ffe84c", "#afd8f8", "#a23c3c", - "#3d853d", "#7633bd", "#edc240", "#d2ffff", "#f35a5a", "#5cc85c", "#b14cff", - "#ffe84c", "#698194", "#792d2d", "#2e642e", "#58268e", "#8e7426", "#9ce1e1", - "#ff6969", "#6be96b", "#cf59ff", "#ffff59", "#455663", "#511d1d", "#5e4d19"); - - var colorMap = new Object(); - - for(i=0; i' + label + '
' + Math.round(series.percent) + '%'; - }, - background: { + let options = { series: { + pie: { + show: true, + radius: 1, + label: { + radius: 3/5, + formatter: function (label, series) { + return '
' + label + '
' + Math.round(series.percent) + '%
'; + }, + background: { opacity: 0.6, color: '#000' - } - } } - }, - legend: {show: false} - }; - $.plot($("#collection #flotcontainer_collection"), collection_size_data, options); + } + } + }, + legend: {show: false} + }; + $.plot($("#collection #flotcontainer_collection"), collectionSizeData, options); - // Make legend - var legendHtml = ""; - for(i=0; i" + collection_size_table_data[i].collection + ""; - } - legendHtml += "
" + collection_size_table_data[i].size + "
"; - $("#collectionLegendDiv").html(legendHtml); + // Make legend + let legendHtml = ""; + for(let i = 0; i < collectionSizeTableData.length; i++) { + legendHtml += ""; + } + legendHtml += "
" + collectionSizeTableData[i].collection + "" + collectionSizeTableData[i].size + "
"; + $("#collectionLegendDiv").html(legendHtml); }); - } +} diff --git a/bitrepository-webclient/src/main/webapp/dashboard_components/collectionStatus.js b/bitrepository-webclient/src/main/webapp/dashboard_components/collectionStatus.js index 4a7a06940..ee1224b60 100644 --- a/bitrepository-webclient/src/main/webapp/dashboard_components/collectionStatus.js +++ b/bitrepository-webclient/src/main/webapp/dashboard_components/collectionStatus.js @@ -1,108 +1,104 @@ - - - var collections = new Object(); - var readyForRefresh = false; - var integrityServiceUrl; - var myNameMapper; - var update_page; - var updateLock; - - function setIntegrityServiceUrl(url) { +let collections = {}; +let readyForRefresh = false; +let integrityServiceUrl; +let myNameMapper; +let updatePage; +let updateLock; + +function setIntegrityServiceUrl(url) { integrityServiceUrl = url; - } +} - function setNameMapper(nameMapper) { +function setNameMapper(nameMapper) { myNameMapper = nameMapper; - } +} - function initiateCollectionStatus(collectionIDs, tableBody, updateInterval) { - for(var i = 0; i < collectionIDs.length; i++) { +function initiateCollectionStatus(collectionIDs, tableBody, updateInterval) { + for (let i = 0; i < collectionIDs.length; i++) { collections[collectionIDs[i].collectionID] = {collectionID: collectionIDs[i].collectionID, - collectionName: collectionIDs[i].collectionName, - numFiles: '-', - latestIngest: "Fetching", - collectionSize: '-', - pillars: '-', - lastCheck: "Fetching", - numChecksumErrors: '-', - numMissingFiles: '-', - nextCheck: "Fetching"}; + collectionName: collectionIDs[i].collectionName, + numFiles: '-', + latestIngest: "Fetching", + collectionSize: '-', + pillars: '-', + lastCheck: "Fetching", + numChecksumErrors: '-', + numMissingFiles: '-', + nextCheck: "Fetching"}; $(tableBody).append(makeCollectionRow(collections[collectionIDs[i].collectionID])); - } - readyForRefresh = true; - initStatusUpdate(updateInterval); - } - - function updateWorkflowStatus(collection) { - if(scheduleUpdate(collection, "status")) { - url = integrityServiceUrl + "/integrity/IntegrityService/getWorkflowSetup/?collectionID=" + collection; - var c = collection; - $.getJSON(url, {}, function(j) { - collections[c].lastCheck = j[0].lastRun; - collections[c].nextCheck = j[0].nextRun; - }).done(function(){updateCollectionRow(collections[c]);}).always(function() {finishUpdate(c, "status");}); } - } + readyForRefresh = true; + initStatusUpdate(updateInterval); +} + +function updateWorkflowStatus(collection) { + if (scheduleUpdate(collection, "status")) { + let url = integrityServiceUrl + "/integrity/IntegrityService/getWorkflowSetup/?collectionID=" + collection; + let c = collection; + $.getJSON(url, {}, function(j) { + collections[c].lastCheck = j[0].lastRun; + collections[c].nextCheck = j[0].nextRun; + }).done(function(){updateCollectionRow(collections[c]);}).always(function() {finishUpdate(c, "status");}); + } +} - function updateWorkflowStatuses() { - if(readyForRefresh) { - for(c in collections) { - updateWorkflowStatus(c); - } +function updateWorkflowStatuses() { + if (readyForRefresh) { + for (let c in collections) { + updateWorkflowStatus(c); + } } - } - - function updateCollectionInfo(collection) { - if(scheduleUpdate(collection, "info")) { - url = integrityServiceUrl + "/integrity/IntegrityService/getCollectionInformation/?collectionID=" + collection; - var c = collection; - $.getJSON(url, {}, function(j) { - collections[c].numFiles = j.numberOfFiles; - collections[c].collectionSize = j.collectionSize; - collections[c].latestIngest = j.lastIngest; - }).done(function(){updateCollectionRow(collections[c]);}).always(function() {finishUpdate(c, "info");}); +} + +function updateCollectionInfo(collection) { + if (scheduleUpdate(collection, "info")) { + let url = integrityServiceUrl + "/integrity/IntegrityService/getCollectionInformation/?collectionID=" + collection; + $.getJSON(url, {}, function(j) { + collections[collection].numFiles = j.numberOfFiles; + collections[collection].collectionSize = j.collectionSize; + collections[collection].latestIngest = j.lastIngest; + }).done(function(){updateCollectionRow(collections[c]);}).always(function() {finishUpdate(c, "info");}); } - } +} - function updateInfo() { - if(readyForRefresh) { - for(c in collections) { - updateCollectionInfo(c); - } - } - } - - function updateCollectionStatistic(collection) { - if(scheduleUpdate(collection, "stats")) { - url = integrityServiceUrl + "/integrity/IntegrityService/getIntegrityStatus/?collectionID=" + collection; - var c = collection; - $.getJSON(url, {}, function(j) { - var checksumErrors = 0; - var missingFiles = 0; - var pillarCount = 0; - for(stat in j) { - pillarCount += 1; - checksumErrors += j[stat].checksumErrorCount; - missingFiles += j[stat].missingFilesCount; +function updateInfo() { + if (readyForRefresh) { + for (let c in collections) { + updateCollectionInfo(c); } - collections[c].pillars = pillarCount; - collections[c].numChecksumErrors = checksumErrors; - collections[c].numMissingFiles = missingFiles; - }).done(function(){updateCollectionRow(collections[c])}).always(function() {finishUpdate(c, "stats");}); } - } +} + +function updateCollectionStatistic(collection) { + if (scheduleUpdate(collection, "stats")) { + let url = integrityServiceUrl + "/integrity/IntegrityService/getIntegrityStatus/?collectionID=" + collection; + $.getJSON(url, {}, function(j) { + let checksumErrors = 0; + let missingFiles = 0; + let pillarCount = 0; + for (let stat in j) { + pillarCount += 1; + checksumErrors += j[stat].checksumErrorCount; + missingFiles += j[stat].missingFilesCount; + } + collections[collection].pillars = pillarCount; + collections[collection].numChecksumErrors = checksumErrors; + collections[collection].numMissingFiles = missingFiles; + }).done(function(){updateCollectionRow(collections[c])}).always(function() {finishUpdate(c, "stats");}); + } +} - function updateStatistics() { - if(readyForRefresh) { - for(c in collections) { - updateCollectionStatistic(c); - } +function updateStatistics() { + if (readyForRefresh) { + for (let c in collections) { + updateCollectionStatistic(c); + } } - } +} - function makeCollectionRow(collection) { - var id = collection.collectionID; - var html = ""; +function makeCollectionRow(collection) { + let id = collection.collectionID; + let html = ""; html += ""; html += "" + id + ""; html += ""; @@ -114,63 +110,65 @@ html += " "; html += ""; return html; - } +} - function updateCollectionRow(collection) { - var id = collection.collectionID; +function updateCollectionRow(collection) { + let id = collection.collectionID; $("#" + id + "-name").html(`${collection.collectionName}`); $("#" + id + "-numFiles").html(numeral(collection.numFiles).format('0,0')); $("#" + id + "-latestIngest").html(collection.latestIngest); $("#" + id + "-collectionSize").html(collection.collectionSize); $("#" + id + "-pillars").html(collection.pillars); $("#" + id + "-latestCheck").html(collection.lastCheck); - $("#" + id + "-numChecksumErrors").html(numeral(collection.numChecksumErrors).format('0,0')); - if(collection.numChecksumErrors > 0) { - $("#" + id + "-numChecksumErrors").addClass("badge badge-important pull-right"); + let checksumErrorsNumberElement = $("#" + id + "-numChecksumErrors"); + checksumErrorsNumberElement.html(numeral(collection.numChecksumErrors).format('0,0')); + if (collection.numChecksumErrors > 0) { + checksumErrorsNumberElement.addClass("badge badge-important pull-right"); } else { - $("#" + id + "-numChecksumErrors").removeClass("badge badge-important pull-right"); + checksumErrorsNumberElement.removeClass("badge badge-important pull-right"); } - $("#" + id + "-numMissingFiles").html(numeral(collection.numMissingFiles).format('0,0')); - if(collection.numMissingFiles > 0) { - $("#" + id + "-numMissingFiles").addClass("badge badge-important pull-right"); + let missingFilesNumberElement = $("#" + id + "-numMissingFiles"); + missingFilesNumberElement.html(numeral(collection.numMissingFiles).format('0,0')); + if (collection.numMissingFiles > 0) { + missingFilesNumberElement.addClass("badge badge-important pull-right"); } else { - $("#" + id + "-numMissingFiles").removeClass("badge badge-important pull-right"); + missingFilesNumberElement.removeClass("badge badge-important pull-right"); } $("#" + id + "-nextCheck").html(collection.nextCheck); - } - - function refreshContent() { - updateWorkflowStatuses(); - updateInfo(); - updateStatistics(); - } - - function scheduleUpdate(collection, type) { - if(updateLock[collection][type]) { - updateLock[collection][type] = false; - return true; +} + +function refreshContent() { + updateWorkflowStatuses(); + updateInfo(); + updateStatistics(); +} + +function scheduleUpdate(collection, type) { + if (updateLock[collection][type]) { + updateLock[collection][type] = false; + return true; } else { - return false; + return false; } - } +} - function finishUpdate(collection, type) { +function finishUpdate(collection, type) { return updateLock[collection][type] = true; - } +} - function initStatusUpdate(updateInterval) { +function initStatusUpdate(updateInterval) { // Init update locks - updateLock = new Array(); - for(c in collections) { - var row = new Array(); - row["status"] = true; - row["info"] = true; - row["stats"] = true; - updateLock[c] = row; + updateLock = []; + for (let c in collections) { + let row = []; + row["status"] = true; + row["info"] = true; + row["stats"] = true; + updateLock[c] = row; } refreshContent(); - update_page = setInterval(function() { refreshContent(); }, updateInterval); - } + updatePage = setInterval(function() { refreshContent(); }, updateInterval); +} diff --git a/bitrepository-webclient/src/main/webapp/dashboard_components/dataSizeGraph.js b/bitrepository-webclient/src/main/webapp/dashboard_components/dataSizeGraph.js index 89cd8cce2..6c36089aa 100644 --- a/bitrepository-webclient/src/main/webapp/dashboard_components/dataSizeGraph.js +++ b/bitrepository-webclient/src/main/webapp/dashboard_components/dataSizeGraph.js @@ -1,36 +1,34 @@ - - - function dataSizeGraph(collections, colorMapper, fileSizeUtils, dataUrl, graphTypeSelector, graphPlaceholder) { - - var collectionIDs = new Object(); - var colorMap = colorMapper; - var sizeUtils = fileSizeUtils; - var graphType = graphTypeSelector; - var placeholder = graphPlaceholder; - var graphDataPool = new Object(); - var url = dataUrl; - var yAxisText = "y-axis text"; - var tooltipText; - var isFloatData = true; - var mySelf = this; - var msPerDay = 86400 * 1000; - - for(var i=0; i" + formattedValue + " " + tooltipText + ""); + } } else { - formattedValue = numeral(y).format('0,0'); + $("#tooltip").remove(); + previousPoint = null; } - showTooltip(item.pageX, - item.pageY, - formated_date + "
" + formattedValue + " " + tooltipText + ""); - } - } else { - $("#tooltip").remove(); - previousPoint = null; - } - $('
zoom out
').appendTo(element).click(function (e) { - e.preventDefault(); - plot.setupGrid(); - plot.draw(); - plot = $.plot(placeholder, dataObj, options); + $('
zoom out
').appendTo(element).click(function (e) { + e.preventDefault(); + plot.setupGrid(); + plot.draw(); + plot = $.plot(placeholder, dataObj, options); + }); }); - }); } function scaleAndCopyData(data, factor) { - scaledData = new Array(); - for(i=0; i dMax) { - dMax = graphDataPool[collectionID][dMaxField]; - } + let dataObj = []; + let dMax = 0; + let dataField = "data"; + let dMaxField = "dataMax"; + if ($(graphType).val() === "data") { + dataField = "data"; + dMaxField = "dataMax"; + isFloatData = true; + } else if ($(graphType).val() === "datadelta") { + dataField = "deltaData"; + dMaxField = "deltaMax"; + isFloatData = true; + } else if ($(graphType).val() === "filecount") { + dataField = "fileCount"; + dMaxField = "fileCountMax"; + isFloatData = false; + } else if ($(graphType).val() === "filedelta") { + dataField = "deltaCount"; + dMaxField = "deltaCountMax"; + isFloatData = true; + } + + for (let collectionID in collectionIDs) { + if (collectionIDs[collectionID].state === "active" && graphDataPool[collectionID] != null) { + if (graphDataPool[collectionID][dMaxField] > dMax) { + dMax = graphDataPool[collectionID][dMaxField]; + } + } } - } - - var unitSuffix = sizeUtils.toHumanUnit(dMax); - var scale = sizeUtils.getByteSize(unitSuffix); - - for(i in collectionIDs) { - var collectionID = i; - if(collectionIDs[i].state == "active" && graphDataPool[collectionID] != null) { - var dataArray; - //Avoid scaling y-axis data when working with filecount. - if($(graphType).val() == "filecount" || $(graphType).val() == "filedelta") { - dataArray = graphDataPool[collectionID][dataField]; - } else { - dataArray = scaleAndCopyData(graphDataPool[collectionID][dataField], scale); - } - var collectionObj = {data: dataArray, color: colorMap.getCollectionColor(collectionID)}; - dataObj.push(collectionObj); + let unitSuffix = sizeUtils.toHumanUnit(dMax); + let scale = sizeUtils.getByteSize(unitSuffix); + + for (let collectionID in collectionIDs) { + if (collectionIDs[collectionID].state === "active" && graphDataPool[collectionID] != null) { + let dataArray; + //Avoid scaling y-axis data when working with filecount. + if ($(graphType).val() === "filecount" || $(graphType).val() === "filedelta") { + dataArray = graphDataPool[collectionID][dataField]; + } else { + dataArray = scaleAndCopyData(graphDataPool[collectionID][dataField], scale); + } + + let collectionObj = {data: dataArray, color: colorMap.getCollectionColor(collectionID)}; + dataObj.push(collectionObj); + } } - } - if($(graphType).val() == "data") { - yAxisText = unitSuffix; - tooltipText = unitSuffix; - } else if($(graphType).val() == "datadelta") { - yAxisText = unitSuffix + " per day"; - tooltipText = unitSuffix + " per day"; - } else if($(graphType).val() == "filecount") { - yAxisText = "Number of files"; - tooltipText = "files"; - } else if($(graphType).val() == "filedelta") { - yAxisText = "Files per day"; - tooltipText = "files per day"; - } + if ($(graphType).val() === "data") { + yAxisText = unitSuffix; + tooltipText = unitSuffix; + } else if ($(graphType).val() === "datadelta") { + yAxisText = unitSuffix + " per day"; + tooltipText = unitSuffix + " per day"; + } else if ($(graphType).val() === "filecount") { + yAxisText = "Number of files"; + tooltipText = "files"; + } else if ($(graphType).val() === "filedelta") { + yAxisText = "Files per day"; + tooltipText = "files per day"; + } - var options = { - hoverable: true, - grid: { + let options = { hoverable: true, - borderColor: "#cccccc" - }, - xaxis: { mode: "time", localTimezone: true , zoomRange: [0.1, 10] , timeformat: "%y/%0m/%0d %0H:%0M"}, - yaxis: { axisLabel: yAxisText}, - selection:{ mode: "xy" } , - points: { show: true , radius: 1} , - lines: { show: true}, - zoom: { interactive: true} - }; - - var plot = $.plot(placeholder, dataObj, options); - useRange(placeholder, plot, dataObj, options); - handleHover(placeholder, plot, dataObj, options); - }; - - this.getGraphData = function() { - return graphDataPool; + grid: { + hoverable: true, + borderColor: "#cccccc" + }, + xaxis: {mode: "time", localTimezone: true , zoomRange: [0.1, 10] , timeformat: "%y/%0m/%0d %0H:%0M"}, + yaxis: {axisLabel: yAxisText}, + selection: {mode: "xy"} , + points: {show: true, radius: 1}, + lines: {show: true}, + zoom: {interactive: true} + }; + + let plot = $.plot(placeholder, dataObj, options); + useRange(placeholder, plot, dataObj, options); + handleHover(placeholder, plot, dataObj, options); }; function updateCollectionData(collection) { - var c = collection; - $.getJSON(url + c, {}, function(data) { - var collectionData = new Array(); - var deltaCollectionData = new Array(); - var dMax = 0; - var deltaDataMax = 0; - var fileCountData = new Array(); - var deltaCountData = new Array(); - var fileCountDataMax = 0; - var fileCountDeltaMax = 0; - // Get the timezone offset in milliseconds - var timeOffset = moment().tz("Europe/Copenhagen")._offset * 1000 * 60; - for(i=0; i dMax) { - dMax = data[i].dataSize; - } - collectionData.push(a); - - var fc = new Array(data[i].dateMillis - timeOffset, data[i].fileCount); - if(data[i].fileCount > fileCountDataMax) { - fileCountDataMax = data[i].fileCount; + let c = collection; + $.getJSON(url + c, {}, function(data) { + let collectionData = []; + let deltaCollectionData = []; + let dMax = 0; + let deltaDataMax = 0; + let fileCountData = []; + let deltaCountData = []; + let fileCountDataMax = 0; + let fileCountDeltaMax = 0; + // Get the timezone offset in milliseconds + let timeOffset = moment().tz("Europe/Copenhagen")._offset * 1000 * 60; + for (i=0; i dMax) { + dMax = data[i].dataSize; + } + collectionData.push(a); + + let fc = [data[i].dateMillis - timeOffset, data[i].fileCount]; + if (data[i].fileCount > fileCountDataMax) { + fileCountDataMax = data[i].fileCount; + } + fileCountData.push(fc); + + //Build delta data + if (i === 0) { + deltaCollectionData.push([data[i].dateMillis - timeOffset, 0]); + deltaCountData.push([data[i].dateMillis - timeOffset, 0]); + } else { + let deltaBytes = data[i].dataSize - data[i-1].dataSize; + let deltaCount = data[i].fileCount - data[i-1].fileCount; + let deltaMs = data[i].dateMillis - data[i-1].dateMillis; + let growthPerDay = (msPerDay * deltaBytes) / deltaMs; + if (growthPerDay > deltaDataMax) { + deltaDataMax = growthPerDay; + } + deltaCollectionData.push([data[i].dateMillis - timeOffset, growthPerDay]); + let fileGrowthPerDay = (msPerDay * deltaCount) / deltaMs; + if (fileGrowthPerDay > fileCountDeltaMax) { + fileCountDeltaMax = fileGrowthPerDay; + } + deltaCountData.push([data[i].dateMillis - timeOffset, fileGrowthPerDay]); + } } - fileCountData.push(fc); - - //Build delta data - if(i == 0) { - deltaCollectionData.push([data[i].dateMillis - timeOffset, 0]); - deltaCountData.push([data[i].dateMillis - timeOffset, 0]); - } else { - var deltaBytes = data[i].dataSize - data[i-1].dataSize; - var deltaCount = data[i].fileCount - data[i-1].fileCount; - var deltaMs = data[i].dateMillis - data[i-1].dateMillis; - var growthPerDay = (msPerDay * deltaBytes) / deltaMs; - if(growthPerDay > deltaDataMax) { - deltaDataMax = growthPerDay; - } - deltaCollectionData.push([data[i].dateMillis - timeOffset, growthPerDay]); - var fileGrowthPerDay = (msPerDay * deltaCount) / deltaMs; - if(fileGrowthPerDay > fileCountDeltaMax) { - fileCountDeltaMax = fileGrowthPerDay; - } - deltaCountData.push([data[i].dateMillis - timeOffset, fileGrowthPerDay]); - } - } - graphDataPool[c] = {data: collectionData, dataMax: dMax, - deltaData: deltaCollectionData, deltaMax: deltaDataMax, - fileCount: fileCountData, fileCountMax: fileCountDataMax, - deltaCount: deltaCountData, deltaCountMax: fileCountDeltaMax}; + graphDataPool[c] = {data: collectionData, dataMax: dMax, + deltaData: deltaCollectionData, deltaMax: deltaDataMax, + fileCount: fileCountData, fileCountMax: fileCountDataMax, + deltaCount: deltaCountData, deltaCountMax: fileCountDeltaMax}; }).done(function() {mySelf.renderGraph();}); } this.updateData = function() { - var keys = Object.keys(collectionIDs); - for(i in keys) { - updateCollectionData(keys[i]); - } + let keys = Object.keys(collectionIDs); + for (i in keys) { + updateCollectionData(keys[i]); + } }; this.getCollectionIDs = function() { - return Object.keys(collectionIDs); - }; - } + return Object.keys(collectionIDs); + }; +} diff --git a/bitrepository-webclient/src/main/webapp/dashboard_components/dataSizeGraphController.js b/bitrepository-webclient/src/main/webapp/dashboard_components/dataSizeGraphController.js index 04529910d..b5ed80269 100644 --- a/bitrepository-webclient/src/main/webapp/dashboard_components/dataSizeGraphController.js +++ b/bitrepository-webclient/src/main/webapp/dashboard_components/dataSizeGraphController.js @@ -1,32 +1,31 @@ - - function makeCollectionSelectionCheckboxes(collectionSelector, dsGraph, colorMapper, nameMapper) { - var graph = dsGraph; +function makeCollectionSelectionCheckboxes(collectionSelector, dsGraph, colorMapper, nameMapper) { + let graph = dsGraph; $(collectionSelector).empty(); - var collections = graph.getCollectionIDs(); - for(i in collections) { - var elementID = collections[i] + "-selector"; - var color = colorMapper.getCollectionColor(collections[i]); - var name = nameMapper.getName(collections[i]); - checkbox = makeCollectionSelectionCheckbox(collections[i], elementID, color, name); - $(collectionSelector).append(checkbox); - $("#" + elementID).change(function(event) {event.preventDefault(); collectionChanged(event.target.value, event.target.checked, graph);}); + let collections = graph.getCollectionIDs(); + for (let i in collections) { + let elementID = collections[i] + "-selector"; + let color = colorMapper.getCollectionColor(collections[i]); + let name = nameMapper.getName(collections[i]); + let checkbox = makeCollectionSelectionCheckbox(collections[i], elementID, color, name); + $(collectionSelector).append(checkbox); + $("#" + elementID).on("change", function(event) {event.preventDefault(); collectionChanged(event.target.value, event.target.checked, graph);}); } - } +} - function collectionChanged(collectionID, selected, graph) { - if(selected) { - graph.enableCollection(collectionID); +function collectionChanged(collectionID, selected, graph) { + if (selected) { + graph.enableCollection(collectionID); } else { - graph.disableCollection(collectionID); + graph.disableCollection(collectionID); } - } +} - function makeCollectionSelectionCheckbox(collectionID, elementID, color, name) { - var html = "
"; +function makeCollectionSelectionCheckbox(collectionID, elementID, color, name) { + let html = "
"; html += ""; html += "
"; html += "
"; html += "
" + name + "
"; return html; - } +} diff --git a/bitrepository-webclient/src/main/webapp/dashboard_components/legsSizePie.js b/bitrepository-webclient/src/main/webapp/dashboard_components/legsSizePie.js index 5dd19aef3..cb930eae7 100644 --- a/bitrepository-webclient/src/main/webapp/dashboard_components/legsSizePie.js +++ b/bitrepository-webclient/src/main/webapp/dashboard_components/legsSizePie.js @@ -1,43 +1,42 @@ +let pillar_size_data; +let pillar_size_table_data; - var pillar_size_data; - var pillar_size_table_data; - - function drawPillarDataSizePieChart(url) { +function drawPillarDataSizePieChart(url) { //Load data, when done, draw chart. $.getJSON(url, {}, function(j) { - pillar_size_data = new Array(); - pillar_size_table_data = new Array(); - for(i=0; i' + label + '
' + Math.round(series.percent) + '%
'; - }, - background: { + let options = { series: { + pie: { + show: true, + radius: 1, + label: { + radius: 3/5, + formatter: function (label, series) { + return '
' + label + '
' + Math.round(series.percent) + '%
'; + }, + background: { opacity: 0.6, color: '#000' - } - } } - }, - legend: {show: false} - }; - $.plot($("#data_pillar #flotcontainer_data_pillar"), pillar_size_data, options); + } + } + }, + legend: {show: false} + }; + $.plot($("#data_pillar #flotcontainer_data_pillar"), pillar_size_data, options); - // Make legend - var legendHtml = ""; - for(i=0; i" + pillar_size_table_data[i].pillar + ""; - } - legendHtml += "
" + pillar_size_table_data[i].size + "
"; - $("#pillarLegendDiv").html(legendHtml); + // Make legend + let legendHtml = ""; + for(let i = 0; i < pillar_size_table_data.length; i++) { + legendHtml += ""; + } + legendHtml += "
" + pillar_size_table_data[i].pillar + "" + pillar_size_table_data[i].size + "
"; + $("#pillarLegendDiv").html(legendHtml); }); - } +} diff --git a/bitrepository-webclient/src/main/webapp/dashboard_components/procedure_for_control_text.jsp b/bitrepository-webclient/src/main/webapp/dashboard_components/procedure_for_control_text.jsp deleted file mode 100644 index 4325c02d2..000000000 --- a/bitrepository-webclient/src/main/webapp/dashboard_components/procedure_for_control_text.jsp +++ /dev/null @@ -1,28 +0,0 @@ -<%-- - #%L - Bitrepository Webclient - %% - Copyright (C) 2010 - 2013 The State and University Library, The Royal Library and The State Archives, Denmark - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as - published by the Free Software Foundation, either version 2.1 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Lesser Public License for more details. - - You should have received a copy of the GNU General Lesser Public - License along with this program. If not, see - . - #L% - --%> -Eu eos soluta persequeris. Ubique eligendi per no, ut per civibus incorrupte, id pri viderer appareat. Ad vim timeam graecis, cu sumo diam oblique pro, ius brute partem incorrupte ea. Cu soleat ceteros mel. Wisi salutatus at vis, iusto consequat interpretaris te nam. Quo wisi neglegentur ea, ea utinam facete volumus ius, qui appetere laboramus eu. -
-Nam liber tractatos an. Ex mel diam sint nulla, animal appetere pri te, iuvaret discere adversarium in sit. Quis maluisset ne nam, vix dicam nonumes explicari ex. Cum ea appareat deserunt facilisis, elit disputando at duo, vel at mutat consetetur. Minim perpetua no nec, nam quot consetetur in, nec atqui exerci an. -
-Duo soluta expetenda ei. Sea elit invenire expetenda no, ut feugiat phaedrum scribentur sed. Et verterem iracundia vel, illud efficiendi sea eu, decore forensibus cu eos. In nullam iriure est, homero dicunt graecis qui eu. -
- Jens finder på noget fornuftigt tekst her... \ No newline at end of file From d7dc9cab85be6f02fb62f87b3a8ddaa29cba67d8 Mon Sep 17 00:00:00 2001 From: bohlski Date: Fri, 11 Nov 2022 14:20:24 +0100 Subject: [PATCH 02/12] Rename dataSizeGraph with PascalCase because class --- .../dashboard_components/{dataSizeGraph.js => DataSizeGraph.js} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename bitrepository-webclient/src/main/webapp/dashboard_components/{dataSizeGraph.js => DataSizeGraph.js} (100%) diff --git a/bitrepository-webclient/src/main/webapp/dashboard_components/dataSizeGraph.js b/bitrepository-webclient/src/main/webapp/dashboard_components/DataSizeGraph.js similarity index 100% rename from bitrepository-webclient/src/main/webapp/dashboard_components/dataSizeGraph.js rename to bitrepository-webclient/src/main/webapp/dashboard_components/DataSizeGraph.js From d93df748616b22951a864f1df7ec0fa0ceaa90a9 Mon Sep 17 00:00:00 2001 From: bohlski Date: Mon, 14 Nov 2022 15:27:44 +0100 Subject: [PATCH 03/12] Fix missing changes from last commit + some jq-migration --- .../dashboard_components/DataSizeGraph.js | 6 ++--- .../dashboard_components/collectionStatus.js | 23 ++++++++++++++----- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/bitrepository-webclient/src/main/webapp/dashboard_components/DataSizeGraph.js b/bitrepository-webclient/src/main/webapp/dashboard_components/DataSizeGraph.js index 6c36089aa..a9f462817 100644 --- a/bitrepository-webclient/src/main/webapp/dashboard_components/DataSizeGraph.js +++ b/bitrepository-webclient/src/main/webapp/dashboard_components/DataSizeGraph.js @@ -47,7 +47,7 @@ function DataSizeGraph(collections, colorMapper, fileSizeUtils, dataUrl, graphTy } function useRange(element, plot, dataObj, options) { - $(element).bind("plotselected", function (event,ranges) { + $(element).on("plotselected", function (event,ranges) { // do the zooming plot = $.plot($(element), dataObj, @@ -64,7 +64,7 @@ function DataSizeGraph(collections, colorMapper, fileSizeUtils, dataUrl, graphTy } function handleHover(element, plot, dataObj, options) { - $(element).bind("plothover", function (event, pos, item) { + $(element).on("plothover", function (event, pos, item) { if (item) { if (previousPoint !== item.dataIndex) { previousPoint = item.dataIndex; @@ -86,7 +86,7 @@ function DataSizeGraph(collections, colorMapper, fileSizeUtils, dataUrl, graphTy $("#tooltip").remove(); previousPoint = null; } - $('
zoom out
').appendTo(element).click(function (e) { + $('
zoom out
').appendTo(element).on("click", function (e) { e.preventDefault(); plot.setupGrid(); plot.draw(); diff --git a/bitrepository-webclient/src/main/webapp/dashboard_components/collectionStatus.js b/bitrepository-webclient/src/main/webapp/dashboard_components/collectionStatus.js index ee1224b60..ea7e52144 100644 --- a/bitrepository-webclient/src/main/webapp/dashboard_components/collectionStatus.js +++ b/bitrepository-webclient/src/main/webapp/dashboard_components/collectionStatus.js @@ -34,11 +34,14 @@ function initiateCollectionStatus(collectionIDs, tableBody, updateInterval) { function updateWorkflowStatus(collection) { if (scheduleUpdate(collection, "status")) { let url = integrityServiceUrl + "/integrity/IntegrityService/getWorkflowSetup/?collectionID=" + collection; - let c = collection; $.getJSON(url, {}, function(j) { - collections[c].lastCheck = j[0].lastRun; - collections[c].nextCheck = j[0].nextRun; - }).done(function(){updateCollectionRow(collections[c]);}).always(function() {finishUpdate(c, "status");}); + collections[collection].lastCheck = j[0].lastRun; + collections[collection].nextCheck = j[0].nextRun; + }).done(function() { + updateCollectionRow(collections[collection]); + }).always(function() { + finishUpdate(collection, "status"); + }); } } @@ -57,7 +60,11 @@ function updateCollectionInfo(collection) { collections[collection].numFiles = j.numberOfFiles; collections[collection].collectionSize = j.collectionSize; collections[collection].latestIngest = j.lastIngest; - }).done(function(){updateCollectionRow(collections[c]);}).always(function() {finishUpdate(c, "info");}); + }).done(function() { + updateCollectionRow(collections[collection]); + }).always(function() { + finishUpdate(collection, "info"); + }); } } @@ -84,7 +91,11 @@ function updateCollectionStatistic(collection) { collections[collection].pillars = pillarCount; collections[collection].numChecksumErrors = checksumErrors; collections[collection].numMissingFiles = missingFiles; - }).done(function(){updateCollectionRow(collections[c])}).always(function() {finishUpdate(c, "stats");}); + }).done(function() { + updateCollectionRow(collections[collection]) + }).always(function() { + finishUpdate(collection, "stats"); + }); } } From 9d6bd5b5e83a6f80bf37012dadaccd80b0ffd59f Mon Sep 17 00:00:00 2001 From: bohlski Date: Mon, 14 Nov 2022 15:39:12 +0100 Subject: [PATCH 04/12] jQuery migration to 3.6.1 NOTE: The plotting library "flot" has been tweaked to comply with the new jQuery-version, but has itself not been updated. An attempt was made at upgrading it, but this was shelved because of trouble with making the usage work as before (its repository is poorly maintained and errors are difficult to troubleshoot). Either way this would have little payoff. --- .../src/main/webapp/alarm-service.html | 10 ++++----- .../src/main/webapp/audit-trail-service.html | 22 +++++++++---------- .../main/webapp/bitrepository-frontpage.html | 2 +- .../src/main/webapp/configuration.html | 2 +- .../src/main/webapp/dashboard.html | 8 +++---- .../src/main/webapp/download-modal.js | 2 +- .../src/main/webapp/flot/jquery.flot.min.js | 2 +- .../src/main/webapp/flot/jquery.flot.pie.js | 11 +++++----- .../main/webapp/flot/jquery.flot.resize.js | 6 ++--- .../webapp/flot/jquery.flot.selection.min.js | 2 +- .../src/main/webapp/integrity-service.html | 10 ++++----- .../main/webapp/jquery/jquery-1.9.0.min.js | 4 ---- .../main/webapp/jquery/jquery-3.6.1.min.js | 2 ++ .../src/main/webapp/status-service.html | 4 ++-- 14 files changed, 43 insertions(+), 44 deletions(-) delete mode 100644 bitrepository-webclient/src/main/webapp/jquery/jquery-1.9.0.min.js create mode 100644 bitrepository-webclient/src/main/webapp/jquery/jquery-3.6.1.min.js diff --git a/bitrepository-webclient/src/main/webapp/alarm-service.html b/bitrepository-webclient/src/main/webapp/alarm-service.html index b723b77fa..24b673eb7 100644 --- a/bitrepository-webclient/src/main/webapp/alarm-service.html +++ b/bitrepository-webclient/src/main/webapp/alarm-service.html @@ -126,7 +126,7 @@

Alarm service

- + @@ -247,19 +247,19 @@

Alarm service

init(); $("#fromDate").datepicker({format: "yyyy/mm/dd"}); $("#toDate").datepicker({format: "yyyy/mm/dd"}); - $("#toDateClearButton").click(function (event) { + $("#toDateClearButton").on("click", function (event) { event.preventDefault(); clearElement("#toDate") }); - $("#fromDateClearButton").click(function (event) { + $("#fromDateClearButton").on("click", function (event) { event.preventDefault(); clearElement("#fromDate") }); - $("#fileIDClearButton").click(function (event) { + $("#fileIDClearButton").on("click", function (event) { event.preventDefault(); clearElement("#fileIDFilter") }); - $("#componentIDClearButton").click(function (event) { + $("#componentIDClearButton").on("click", function (event) { event.preventDefault(); clearElement("#componentFilter") }); diff --git a/bitrepository-webclient/src/main/webapp/audit-trail-service.html b/bitrepository-webclient/src/main/webapp/audit-trail-service.html index 33901a461..75af4a37f 100644 --- a/bitrepository-webclient/src/main/webapp/audit-trail-service.html +++ b/bitrepository-webclient/src/main/webapp/audit-trail-service.html @@ -196,7 +196,7 @@

- + @@ -374,10 +374,10 @@

auditTrailServiceUrl = url; let collectAuditTrailsButton = $("#collectAuditTrails"); let queryAuditTrailsButton = $("#queryAuditTrails"); - collectAuditTrailsButton.click(function(event) { event.preventDefault(); startAuditTrailsCollection(); }); - collectAuditTrailsButton.removeAttr("disabled"); - queryAuditTrailsButton.click(function(event) {event.preventDefault(); getAuditTrails()}); - queryAuditTrailsButton.removeAttr("disabled"); + collectAuditTrailsButton.on("click", function(event) { event.preventDefault(); startAuditTrailsCollection(); }); + collectAuditTrailsButton.prop("disabled", false); + queryAuditTrailsButton.on("click", function(event) {event.preventDefault(); getAuditTrails()}); + queryAuditTrailsButton.prop("disabled", false); loadCollectionSchedule(); loadPreservationSchedule(); getContributorIDs(); @@ -390,12 +390,12 @@

getCollectionIDs(); $("#fromDate").datepicker({format: "yyyy/mm/dd"}); $("#toDate").datepicker({format: "yyyy/mm/dd"}); - $("#toDateClearButton").click(function(event) {event.preventDefault(); clearElement("#toDate")}); - $("#fromDateClearButton").click(function(event) {event.preventDefault(); clearElement("#fromDate")}); - $("#fileIDClearButton").click(function(event) {event.preventDefault(); clearElement("#fileIDFilter")}); - $("#actorClearButton").click(function(event) {event.preventDefault(); clearElement("#actorFilter")}); - $("#fingerprintClearButton").click(function(event) {event.preventDefault(); clearElement("#fingerprintFilter")}); - $("#operationIDClearButton").click(function(event) {event.preventDefault(); clearElement("#operationIDFilter")}); + $("#toDateClearButton").on("click", function(event) {event.preventDefault(); clearElement("#toDate")}); + $("#fromDateClearButton").on("click", function(event) {event.preventDefault(); clearElement("#fromDate")}); + $("#fileIDClearButton").on("click", function(event) {event.preventDefault(); clearElement("#fileIDFilter")}); + $("#actorClearButton").on("click", function(event) {event.preventDefault(); clearElement("#actorFilter")}); + $("#fingerprintClearButton").on("click", function(event) {event.preventDefault(); clearElement("#fingerprintFilter")}); + $("#operationIDClearButton").on("click", function(event) {event.preventDefault(); clearElement("#operationIDFilter")}); }); diff --git a/bitrepository-webclient/src/main/webapp/bitrepository-frontpage.html b/bitrepository-webclient/src/main/webapp/bitrepository-frontpage.html index 35daa1110..593a4cf4a 100644 --- a/bitrepository-webclient/src/main/webapp/bitrepository-frontpage.html +++ b/bitrepository-webclient/src/main/webapp/bitrepository-frontpage.html @@ -50,7 +50,7 @@ - + diff --git a/bitrepository-webclient/src/main/webapp/configuration.html b/bitrepository-webclient/src/main/webapp/configuration.html index 3f094b144..d7a0363ad 100644 --- a/bitrepository-webclient/src/main/webapp/configuration.html +++ b/bitrepository-webclient/src/main/webapp/configuration.html @@ -43,7 +43,7 @@ - + diff --git a/bitrepository-webclient/src/main/webapp/dashboard.html b/bitrepository-webclient/src/main/webapp/dashboard.html index 0aced946d..29c998d54 100644 --- a/bitrepository-webclient/src/main/webapp/dashboard.html +++ b/bitrepository-webclient/src/main/webapp/dashboard.html @@ -88,7 +88,7 @@

Data distributed on pillars

- + @@ -108,7 +108,7 @@

Data distributed on pillars

- + + @@ -376,7 +376,7 @@

Modal header

let innerElement = context.element + "-a"; let html = `${formatInt(cellValue)}`; $("#" + context.element).html(html); - $("#" + innerElement).click(showModal(type, context.propertyName, context.title, context.url, pillarID)); + $("#" + innerElement).on("click", showModal(type, context.propertyName, context.title, context.url, pillarID)); } } @@ -421,7 +421,7 @@

Modal header

} function setCollection(collectionID) { - $("#collectionChooser").val(collectionID).change(); + $("#collectionChooser").val(collectionID).on("change", ); } function getIntegrityStatus() { @@ -482,11 +482,11 @@

Modal header

initializePage(); // Setup event / click handling - $("#workflowStarter").click(function (event) { + $("#workflowStarter").on("click", function (event) { event.preventDefault(); startWorkflow(); }); - $("#collectionChooser").change(function (event) { + $("#collectionChooser").on("change", function (event) { event.preventDefault(); collectionChanged(getCollectionID()); }); diff --git a/bitrepository-webclient/src/main/webapp/jquery/jquery-1.9.0.min.js b/bitrepository-webclient/src/main/webapp/jquery/jquery-1.9.0.min.js deleted file mode 100644 index d94aba19a..000000000 --- a/bitrepository-webclient/src/main/webapp/jquery/jquery-1.9.0.min.js +++ /dev/null @@ -1,4 +0,0 @@ -/*! jQuery v1.9.0 | (c) 2005, 2012 jQuery Foundation, Inc. | jquery.org/license */(function(e,t){"use strict";function n(e){var t=e.length,n=st.type(e);return st.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}function r(e){var t=Tt[e]={};return st.each(e.match(lt)||[],function(e,n){t[n]=!0}),t}function i(e,n,r,i){if(st.acceptData(e)){var o,a,s=st.expando,u="string"==typeof n,l=e.nodeType,c=l?st.cache:e,f=l?e[s]:e[s]&&s;if(f&&c[f]&&(i||c[f].data)||!u||r!==t)return f||(l?e[s]=f=K.pop()||st.guid++:f=s),c[f]||(c[f]={},l||(c[f].toJSON=st.noop)),("object"==typeof n||"function"==typeof n)&&(i?c[f]=st.extend(c[f],n):c[f].data=st.extend(c[f].data,n)),o=c[f],i||(o.data||(o.data={}),o=o.data),r!==t&&(o[st.camelCase(n)]=r),u?(a=o[n],null==a&&(a=o[st.camelCase(n)])):a=o,a}}function o(e,t,n){if(st.acceptData(e)){var r,i,o,a=e.nodeType,u=a?st.cache:e,l=a?e[st.expando]:st.expando;if(u[l]){if(t&&(r=n?u[l]:u[l].data)){st.isArray(t)?t=t.concat(st.map(t,st.camelCase)):t in r?t=[t]:(t=st.camelCase(t),t=t in r?[t]:t.split(" "));for(i=0,o=t.length;o>i;i++)delete r[t[i]];if(!(n?s:st.isEmptyObject)(r))return}(n||(delete u[l].data,s(u[l])))&&(a?st.cleanData([e],!0):st.support.deleteExpando||u!=u.window?delete u[l]:u[l]=null)}}}function a(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(Nt,"-$1").toLowerCase();if(r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:wt.test(r)?st.parseJSON(r):r}catch(o){}st.data(e,n,r)}else r=t}return r}function s(e){var t;for(t in e)if(("data"!==t||!st.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}function u(){return!0}function l(){return!1}function c(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}function f(e,t,n){if(t=t||0,st.isFunction(t))return st.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return st.grep(e,function(e){return e===t===n});if("string"==typeof t){var r=st.grep(e,function(e){return 1===e.nodeType});if(Wt.test(t))return st.filter(t,r,!n);t=st.filter(t,r)}return st.grep(e,function(e){return st.inArray(e,t)>=0===n})}function p(e){var t=zt.split("|"),n=e.createDocumentFragment();if(n.createElement)for(;t.length;)n.createElement(t.pop());return n}function d(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function h(e){var t=e.getAttributeNode("type");return e.type=(t&&t.specified)+"/"+e.type,e}function g(e){var t=nn.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function m(e,t){for(var n,r=0;null!=(n=e[r]);r++)st._data(n,"globalEval",!t||st._data(t[r],"globalEval"))}function y(e,t){if(1===t.nodeType&&st.hasData(e)){var n,r,i,o=st._data(e),a=st._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)st.event.add(t,n,s[n][r])}a.data&&(a.data=st.extend({},a.data))}}function v(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!st.support.noCloneEvent&&t[st.expando]){r=st._data(t);for(i in r.events)st.removeEvent(t,i,r.handle);t.removeAttribute(st.expando)}"script"===n&&t.text!==e.text?(h(t).text=e.text,g(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),st.support.html5Clone&&e.innerHTML&&!st.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Zt.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}function b(e,n){var r,i,o=0,a=e.getElementsByTagName!==t?e.getElementsByTagName(n||"*"):e.querySelectorAll!==t?e.querySelectorAll(n||"*"):t;if(!a)for(a=[],r=e.childNodes||e;null!=(i=r[o]);o++)!n||st.nodeName(i,n)?a.push(i):st.merge(a,b(i,n));return n===t||n&&st.nodeName(e,n)?st.merge([e],a):a}function x(e){Zt.test(e.type)&&(e.defaultChecked=e.checked)}function T(e,t){if(t in e)return t;for(var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=Nn.length;i--;)if(t=Nn[i]+n,t in e)return t;return r}function w(e,t){return e=t||e,"none"===st.css(e,"display")||!st.contains(e.ownerDocument,e)}function N(e,t){for(var n,r=[],i=0,o=e.length;o>i;i++)n=e[i],n.style&&(r[i]=st._data(n,"olddisplay"),t?(r[i]||"none"!==n.style.display||(n.style.display=""),""===n.style.display&&w(n)&&(r[i]=st._data(n,"olddisplay",S(n.nodeName)))):r[i]||w(n)||st._data(n,"olddisplay",st.css(n,"display")));for(i=0;o>i;i++)n=e[i],n.style&&(t&&"none"!==n.style.display&&""!==n.style.display||(n.style.display=t?r[i]||"":"none"));return e}function C(e,t,n){var r=mn.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function k(e,t,n,r,i){for(var o=n===(r?"border":"content")?4:"width"===t?1:0,a=0;4>o;o+=2)"margin"===n&&(a+=st.css(e,n+wn[o],!0,i)),r?("content"===n&&(a-=st.css(e,"padding"+wn[o],!0,i)),"margin"!==n&&(a-=st.css(e,"border"+wn[o]+"Width",!0,i))):(a+=st.css(e,"padding"+wn[o],!0,i),"padding"!==n&&(a+=st.css(e,"border"+wn[o]+"Width",!0,i)));return a}function E(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=ln(e),a=st.support.boxSizing&&"border-box"===st.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=un(e,t,o),(0>i||null==i)&&(i=e.style[t]),yn.test(i))return i;r=a&&(st.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+k(e,t,n||(a?"border":"content"),r,o)+"px"}function S(e){var t=V,n=bn[e];return n||(n=A(e,t),"none"!==n&&n||(cn=(cn||st("