Circular dependencies json-stringify and wrapper nullcheck

This commit is contained in:
Kasper Rynning-Tønnesen
2018-07-01 21:31:59 +02:00
parent 3058e678a8
commit 69f29c6157
2 changed files with 21 additions and 1 deletions

View File

@@ -268,6 +268,7 @@ var List = {
},
dynamicContentPageJumpTo: function(page) {
if(document.querySelector("#wrapper") == null) return
page = page * List.can_fit;
var wrapperChildren = [].slice.call(document.querySelector("#wrapper").children);
if(page > List.page || page < List.page){
@@ -293,6 +294,7 @@ var List = {
},
dynamicContentPage: function(way) {
if(document.querySelector("#wrapper") == null) return
var wrapperChildren = [].slice.call(document.querySelector("#wrapper").children);
if(way == 1 || way == 10) {
Helper.css(wrapperChildren.slice(List.page, List.page + List.can_fit), "display", "none");

View File

@@ -170,7 +170,25 @@ if(!Helper.mobilecheck() && (window.location.host != "localhost" && window.locat
</div>');
M.Modal.init(document.getElementById("contact"));
M.Modal.getInstance(document.getElementById("contact")).open();
Helper.setHtml("#error-report-code", JSON.stringify(Helper.logs, undefined, 4));
var cache = [];
Helper.setHtml("#error-report-code", JSON.stringify(Helper.logs, function(key, value) {
if (typeof value === 'object' && value !== null) {
if (cache.indexOf(value) !== -1) {
// Duplicate reference found
try {
// If this value does not reference a parent it can be deduped
return JSON.parse(JSON.stringify(value));
} catch (error) {
// discard key if value cannot be deduped
return;
}
}
// Store value in our collection
cache.push(value);
}
return value;
}, 4));
cache = null;
//console.error(e.originalEvent.error);
return true;
};