Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

query: fix query for IE11, don't use ES6 syntax, add URL polyfill #514

Merged
merged 1 commit into from
Nov 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.