From f5217473530909ff633952ae84b0e7a58fc453e2 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Tue, 15 Nov 2016 11:30:57 +0500 Subject: Workaround for kitkat --- web/app/DeviceImages.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'web') diff --git a/web/app/DeviceImages.js b/web/app/DeviceImages.js index d976a2b3..502d412e 100644 --- a/web/app/DeviceImages.js +++ b/web/app/DeviceImages.js @@ -24,6 +24,9 @@ Ext.define('Traccar.DeviceImages', { info = Ext.getStore('DeviceImages').findRecord('key', category || 'default', 0, false, false, true); svg = Ext.clone(info.get('svg')); + if (!svg) { + svg = this.cloneDocument(info.get('svg')); + } width = parseFloat(svg.documentElement.getAttribute('width')); height = parseFloat(svg.documentElement.getAttribute('height')); @@ -67,6 +70,14 @@ Ext.define('Traccar.DeviceImages', { encodeURIComponent(new XMLSerializer().serializeToString(svg.documentElement)); }, + cloneDocument: function (document) { + var newDocument, newNode; + newDocument = document.implementation.createDocument(document.namespaceURI, null, null); + newNode = newDocument.importNode(document.documentElement, true); + newDocument.appendChild(newNode); + return newDocument; + }, + getImageIcon: function (color, zoom, angle, category) { var image, svg, width, height; -- cgit v1.2.3 From 4f520750a2438e1d5229ef539024b4f3b57d9e32 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Tue, 15 Nov 2016 11:58:37 +0500 Subject: Rename variable --- web/app/DeviceImages.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'web') diff --git a/web/app/DeviceImages.js b/web/app/DeviceImages.js index 502d412e..a05a8153 100644 --- a/web/app/DeviceImages.js +++ b/web/app/DeviceImages.js @@ -70,10 +70,10 @@ Ext.define('Traccar.DeviceImages', { encodeURIComponent(new XMLSerializer().serializeToString(svg.documentElement)); }, - cloneDocument: function (document) { + cloneDocument: function (svgDocument) { var newDocument, newNode; - newDocument = document.implementation.createDocument(document.namespaceURI, null, null); - newNode = newDocument.importNode(document.documentElement, true); + newDocument = svgDocument.implementation.createDocument(svgDocument.namespaceURI, null, null); + newNode = newDocument.importNode(svgDocument.documentElement, true); newDocument.appendChild(newNode); return newDocument; }, -- cgit v1.2.3