From 8b5bbc7a899205a40e1d246862f54ecb4b939682 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Tue, 8 Nov 2016 11:49:00 +0500 Subject: Load SVGs to html --- web/load.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'web/load.js') diff --git a/web/load.js b/web/load.js index f4987ac..7f0caf9 100644 --- a/web/load.js +++ b/web/load.js @@ -14,6 +14,15 @@ script.async = false document.head.appendChild(script); } + + function addSvgFile(file, id) { + var svg = document.createElement('object'); + svg.setAttribute('id', id); + svg.setAttribute('data', file); + svg.setAttribute('type', 'image/svg+xml'); + svg.setAttribute('style','visibility:hidden') + document.body.appendChild(svg); + } var debugMode = document.getElementById('loadScript').getAttribute('mode') === 'debug'; var touchMode = 'ontouchstart' in window || navigator.maxTouchPoints; @@ -119,6 +128,11 @@ addScriptFile('//cdnjs.cloudflare.com/ajax/libs/ol3/' + olVersion + '/ol-debug.js'); addStyleFile('app.css'); - addScriptFile('arrow.js'); + //addScriptFile('arrow.js'); + + addSvgFile('images/arrow.svg', 'arrowSvg'); + addSvgFile('images/car.svg', 'carSvg'); + addSvgFile('images/bus.svg', 'busSvg'); + addSvgFile('images/truck.svg', 'truckSvg'); })(); -- cgit v1.2.3