Skip to content

Commit

Permalink
query: fix query for IE11, don't use ES6 syntax, add URL polyfill (#514)
Browse files Browse the repository at this point in the history
  • Loading branch information
ikreymer authored Nov 1, 2019
1 parent 8baa8cb commit 02cc703
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 17 deletions.
47 changes: 30 additions & 17 deletions pywb/static/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,9 @@ RenderCalendar.prototype.makeCDXRequest = function() {
var spinner = document.getElementById(
renderCal.domStructureIds.updatesSpinner
);
if (spinner) spinner.remove();
if (spinner && spinner.parentNode) {
spinner.parentNode.removeChild(spinner);
}
}
};
queryWorker.postMessage({
Expand Down Expand Up @@ -330,7 +332,9 @@ RenderCalendar.prototype.makeCDXRequest = function() {
var spinner = document.getElementById(
renderCal.domStructureIds.updatesSpinner
);
if (spinner) spinner.remove();
if (spinner && spinner.parentNode) {
spinner.parentNode.removeChild(spinner);
}
}
});
};
Expand Down Expand Up @@ -545,24 +549,32 @@ RenderCalendar.prototype.renderDateCalPart = function(
if (memoizedYMDT[timeInfo.year] == null) {
// we have not seen this year month day before
// create the year month day structure (occurs once per result year)
memoizedYMDT[timeInfo.year] = {
[timeInfo.month]: {
[timeInfo.day]: {
[timeInfo.time]: 1
}
}
};

var timeVal = {};
timeVal[timeInfo.time] = 1;

var dayVal = {};
dayVal[timeInfo.day] = timeVal;

var monthVal = {};
monthVal[timeInfo.month] = dayVal;

memoizedYMDT[timeInfo.year] = monthVal;

this.addRegYearListItem(timeInfo, active);
this.addRegYearMonthListItem(timeInfo, active);
return this.addRegYearMonthDayListItem(cdxObj, timeInfo, 1, active);
} else if (memoizedYMDT[timeInfo.year][timeInfo.month] == null) {
// we have seen the year before but not the month and day
// create the month day structure (occurs for every new month encountered for an existing year)
memoizedYMDT[timeInfo.year][timeInfo.month] = {
[timeInfo.day]: {
[timeInfo.time]: 1
}
};
var timeVal = {};
timeVal[timeInfo.time] = 1;

var dayVal = {};
dayVal[timeInfo.day] = timeVal;

memoizedYMDT[timeInfo.year][timeInfo.month] = dayVal;

this.addRegYearMonthListItem(timeInfo, active);
return this.addRegYearMonthDayListItem(cdxObj, timeInfo, 1, active);
}
Expand All @@ -571,9 +583,10 @@ RenderCalendar.prototype.renderDateCalPart = function(
var month = memoizedYMDT[timeInfo.year][timeInfo.month];
if (month[timeInfo.day] == null) {
// never seen this day (case 1)
month[timeInfo.day] = {
[timeInfo.time]: count
};
var timeVal = {};
timeVal[timeInfo.time] = count;

month[timeInfo.day] = timeVal;
} else if (month[timeInfo.day][timeInfo.time] == null) {
// we have seen this day before but not at this time (case 2)
month[timeInfo.day][timeInfo.time] = count;
Expand Down
1 change: 1 addition & 0 deletions pywb/templates/query.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
{% block head %}
{{ super() }}
<link rel="stylesheet" href="{{ static_prefix }}/css/query.css">
<script src="{{ static_prefix }}/url-polyfill.min.js"></script>
<script src="{{ static_prefix }}/query.js"></script>
{% endblock %}

Expand Down
2 changes: 2 additions & 0 deletions static/url-polyfill.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 02cc703

Please sign in to comment.