Fixes/workarounds for IE

This commit is contained in:
Ruben 2017-03-11 22:04:12 +01:00
parent e5a66000fd
commit 355bc28db0
2 changed files with 19 additions and 8 deletions

View file

@ -121,7 +121,8 @@ def getSvgFromDbImages(images, elId = ""):
# for c in loadColoursFromDbImages(images): # for c in loadColoursFromDbImages(images):
# allColours += c # allColours += c
# box 160, because center or circle = 100 => +/- 50 => + r of colour circle (max: 10) => 160 # box 160, because center or circle = 100 => +/- 50 => + r of colour circle (max: 10) => 160
svg = '<svg viewBox="-160 -160 320 320" xmlns="http://www.w3.org/2000/svg" id="%s">' % (elId, ) # svg = '<svg viewBox="-160 -160 320 320" xmlns="http://www.w3.org/2000/svg" id="%s">' % (elId, )
svg = '<svg viewBox="-160 -160 320 320" xmlns="http://www.w3.org/2000/svg" style="width:100%;height:95%" id="colourImage">' # because of IE this is fully defined here
radius = 100 radius = 100

View file

@ -249,7 +249,7 @@
</svg> </svg>
<svg id="spinner" version="1.1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 1000 1000" style="width:5%;height:5%;top:45%;left:47.5%;"> <svg id="spinner" version="1.1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 1000 1000" style="width:5%;height:5%;top:45%;left:47.5%;">
<g><path d="M500,964.2c-130.9,0-253.9-51-346.5-143.5C61,728.1,10,605.1,10,474.2c0-92.7,26-182.9,75.2-261C133.1,137.3,200.7,76,280.8,35.8l41.2,82.1c-65.1,32.6-120.1,82.5-159,144.2c-40,63.4-61.1,136.6-61.1,212c0,219.5,178.6,398.1,398.1,398.1c219.5,0,398.1-178.6,398.1-398.1c0-75.3-21.1-148.6-61.1-212c-38.9-61.7-93.9-111.6-159-144.2l41.2-82.1C799.3,76,866.9,137.3,914.8,213.2c49.2,78.1,75.2,168.3,75.2,261c0,130.9-51,253.9-143.5,346.5C753.9,913.2,630.9,964.2,500,964.2z"/></g> <g><path d="M500,964.2c-130.9,0-253.9-51-346.5-143.5C61,728.1,10,605.1,10,474.2c0-92.7,26-182.9,75.2-261C133.1,137.3,200.7,76,280.8,35.8l41.2,82.1c-65.1,32.6-120.1,82.5-159,144.2c-40,63.4-61.1,136.6-61.1,212c0,219.5,178.6,398.1,398.1,398.1c219.5,0,398.1-178.6,398.1-398.1c0-75.3-21.1-148.6-61.1-212c-38.9-61.7-93.9-111.6-159-144.2l41.2-82.1C799.3,76,866.9,137.3,914.8,213.2c49.2,78.1,75.2,168.3,75.2,261c0,130.9-51,253.9-143.5,346.5C753.9,913.2,630.9,964.2,500,964.2z"></path></g>
</svg> </svg>
<svg viewBox="-160 -160 320 320" xmlns="http://www.w3.org/2000/svg" style="width:100%;height:95%" id="colourImage"> <svg viewBox="-160 -160 320 320" xmlns="http://www.w3.org/2000/svg" style="width:100%;height:95%" id="colourImage">
@ -271,24 +271,29 @@
<script type="text/javascript"> <script type="text/javascript">
function updateProgress(evt) function updateProgress(evt)
{ {
console.log(evt); // console.log(evt);
} }
function transferComplete(evt, r) function transferComplete(evt, r)
{ {
var div = document.createElement('div'); var div = document.createElement('div');
div.innerHTML = evt.target.response; div.innerHTML = evt.target.response;
document.getElementById('colourImage').innerHTML = div.children[0].innerHTML; // document.getElementById('colourImage').innerHTML = div.children[0].innerHTML;
document.getElementById('works').innerHTML = div.children[1].innerHTML; document.getElementById('works').innerHTML = div.children[1].innerHTML;
document.getElementById('stats').innerHTML = div.children[2].innerHTML; document.getElementById('stats').innerHTML = div.children[2].innerHTML;
let svgEl = document.getElementById('colourImage');
svgEl.parentNode.replaceChild(div.children[0], svgEl);
// console.log(div.children[0]);
document.body.classList.remove('loading'); document.body.classList.remove('loading');
} }
function transferFailed(evt) function transferFailed(evt)
{ {
console.log(evt); // console.log(evt);
} }
function transferCanceled(evt) function transferCanceled(evt)
{ {
console.log(evt); // console.log(evt);
} }
var links = document.getElementById('selects').getElementsByTagName("li"); var links = document.getElementById('selects').getElementsByTagName("li");
@ -305,7 +310,9 @@
oReq.open("GET", "/colours?"+type+"="+value); oReq.open("GET", "/colours?"+type+"="+value);
oReq.send(); oReq.send();
for(let unsetLink of links) { // for(let unsetLink of links) {
for (let i = links.length - 1; i >= 0; i--) {
let unsetLink = links[i];
if(unsetLink.dataset.param == type && unsetLink.dataset.id == value) { if(unsetLink.dataset.param == type && unsetLink.dataset.id == value) {
unsetLink.classList.add('selected'); unsetLink.classList.add('selected');
} else { } else {
@ -314,8 +321,10 @@
} }
} }
for(let link of links) // for(let link of links)
for (let i = links.length - 1; i >= 0; i--)
{ {
let link = links[i];
link.onclick = function() { link.onclick = function() {
loadResults(this.dataset.param, this.dataset.id); loadResults(this.dataset.param, this.dataset.id);
}.bind(link) }.bind(link)
@ -350,6 +359,7 @@
} }
var infoEl = document.getElementById('info'); var infoEl = document.getElementById('info');
function toggleInfo() function toggleInfo()
{ {
infoEl.classList.toggle('show'); infoEl.classList.toggle('show');