Commit cd6acff8 authored by gijs's avatar gijs

Changed reload approach in interface to not break api. Clear old svg's and eps...

Changed reload approach in interface to not break api. Clear old svg's and eps when reloading from pad
parent 604664e1
......@@ -4,6 +4,10 @@
for (( ; ; ));
do
mkdir -p svg eps
rm -f svg/*.svg
rm -f eps/*.eps
echo 'prologues := 3; outputtemplate := "%c.eps";' > eps/metahoguet.eps.mp
echo 'outputtemplate := "%c.svg";' > svg/metahoguet.svg.mp
......@@ -17,4 +21,3 @@ do
cd ..
sleep 3
done
\ No newline at end of file
......@@ -52,11 +52,13 @@
startImg = startImg.substring(2);
elt = startImg.split("-");
}
splitHash();
if(elt.length > 0){
for(i=0; i < elt.length; i++){
console.log(elt[i]);
$( "body" ).append('<img id="letter_'+i+'" title="cliquez pour imprimer" src="svg/'+elt[i]+'.svg" />');
$( "body" ).append('<img id="letter_'+i+'" title="cliquez pour imprimer" src="svg/'+elt[i]+'.svg?'+ (new Date()).getTime() + '" />');
}
}
......@@ -67,7 +69,7 @@
}else if (valZ == 'down'){
imgW = imgW - 50;
}
$('img').css("height", imgW);
$('img').css("height", imgH);
}
function Compare(){
......@@ -81,20 +83,20 @@
var newUrl = startImg.lastIndexOf('-');
window.location.hash = startImg.substring(0, newUrl);
$('img').last().remove();
}
})
$( "body" ).keypress(function(event) {
var savehash = window.location.hash;
savehash = savehash.substring(1);
$( "body" ).append('<img src="svg/'+event.keyCode+'.svg" />');
$( "body" ).append('<img src="svg/'+event.keyCode+'.svg?'+ (new Date()).getTime() + '" />');
console.log(event.keyCode);
savehash += '-'+event.keyCode;
window.location.hash = savehash;
Zoom();
});
}
$("body").on("click", "img", function(){
var result = window.confirm('voulez-vous imprimer ce glyph ?');
......@@ -104,14 +106,16 @@
$.get('/api/ploteps/', { epsfile : path });
}
});
setTimeout(function(){
window.location.reload(1);
setInterval(function(){
stamp = (new Date).getTime();
$("img").each(function () {
var src = $(this).attr('src').split('?')[0];
$(this).attr('src', src + '?' + stamp);
});
}, 5000);
testing();
</script>
</body>
</html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment