JS/loader: add icon cache prototype
Just playing around, I'm still unsure whether this really helps. The motivation behind this patch are icons loaded again after not being displayed for a little while. Remains disabled unless we know whether and for which scenarios (cache disabled, HTTPS...) this really helps.
This commit is contained in:
parent
06a8803242
commit
a79f786546
|
@ -28,6 +28,8 @@
|
||||||
*/
|
*/
|
||||||
this.requests = {};
|
this.requests = {};
|
||||||
|
|
||||||
|
this.iconCache = {};
|
||||||
|
|
||||||
this.autorefreshEnabled = true;
|
this.autorefreshEnabled = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -243,6 +245,22 @@
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
cacheLoadedIcons: function($container) {
|
||||||
|
// TODO: this is just a prototype, disabled for now
|
||||||
|
return;
|
||||||
|
|
||||||
|
var self = this;
|
||||||
|
$('img.icon', $container).each(function(idx, img) {
|
||||||
|
var src = $(img).attr('src');
|
||||||
|
if (typeof self.iconCache[src] !== 'undefined') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var cache = new Image();
|
||||||
|
cache.src = src
|
||||||
|
self.iconCache[src] = cache;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle successful XHR response
|
* Handle successful XHR response
|
||||||
*/
|
*/
|
||||||
|
@ -434,6 +452,7 @@
|
||||||
if (newBody) {
|
if (newBody) {
|
||||||
this.icinga.ui.fixDebugVisibility().triggerWindowResize();
|
this.icinga.ui.fixDebugVisibility().triggerWindowResize();
|
||||||
}
|
}
|
||||||
|
self.cacheLoadedIcons(req.$target);
|
||||||
|
|
||||||
if (active) {
|
if (active) {
|
||||||
var focusedUrl = this.icinga.ui.getFocusedContainerDataUrl();
|
var focusedUrl = this.icinga.ui.getFocusedContainerDataUrl();
|
||||||
|
|
Loading…
Reference in New Issue