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
......@@ -16,5 +20,4 @@ do
mpost -interaction=batchmode -s 'outputformat="eps"' eps/metahoguet.eps.mp
cd ..
sleep 3
done
done
\ No newline at end of file
<html>
<head>
<meta charset="UTF-8">
<title>- </title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<style type="text/css" media="screen">
<head>
<meta charset="UTF-8">
<title>- </title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<style type="text/css" media="screen">
img {
height: 200px;;
width: auto;
overflow: visible;
overflow: visible;
}
footer{
bottom: 0px;
......@@ -37,81 +37,85 @@
color: grey;
}
</style>
</head>
<body>
<footer>
<button onclick="Zoom('up')">+</button>
<button onclick="Zoom('down')">-</button>
<button onclick="Compare()">Compare</button>
<span id="type"></span>
</footer>
<script>
var elt = [];
function splitHash(){
var startImg = window.location.hash;
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" />');
}
}
function Zoom(valZ){
var imgH = $('img').height();
if(valZ == 'up'){
imgH = imgH + 50;
}else if (valZ == 'down'){
imgW = imgW - 50;
}
$('img').css("height", imgW);
}
</head>
<body>
<footer>
<button onclick="Zoom('up')">+</button>
<button onclick="Zoom('down')">-</button>
<button onclick="Compare()">Compare</button>
<span id="type"></span>
</footer>
<script>
var elt = [];
function splitHash(){
var startImg = window.location.hash;
startImg = startImg.substring(2);
elt = startImg.split("-");
}
splitHash();
function Compare(){
$('img').toggleClass('compare');
}
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?'+ (new Date()).getTime() + '" />');
}
}
function Zoom(valZ){
var imgH = $('img').height();
if(valZ == 'up'){
imgH = imgH + 50;
}else if (valZ == 'down'){
imgW = imgW - 50;
}
$('img').css("height", imgH);
}
function testing () {
$("body").keydown( function( event ) {
if (event.key == "Backspace" ) {
var startImg = window.location.hash;
var newUrl = startImg.lastIndexOf('-');
window.location.hash = startImg.substring(0, newUrl);
$('img').last().remove();
function Compare(){
$('img').toggleClass('compare');
}
}
})
$( "body" ).keypress(function(event) {
var savehash = window.location.hash;
savehash = savehash.substring(1);
$( "body" ).append('<img src="svg/'+event.keyCode+'.svg" />');
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 ?');
function testing () {
$("body").keydown( function( event ) {
if (event.key == "Backspace" ) {
var startImg = window.location.hash;
var newUrl = startImg.lastIndexOf('-');
window.location.hash = startImg.substring(0, newUrl);
$('img').last().remove();
}
})
if(result){
var path = $(this).attr('src').replace(/svg/g, 'eps');
$( "body" ).keypress(function(event) {
var savehash = window.location.hash;
savehash = savehash.substring(1);
$( "body" ).append('<img src="svg/'+event.keyCode+'.svg?'+ (new Date()).getTime() + '" />');
console.log(event.keyCode);
savehash += '-'+event.keyCode;
window.location.hash = savehash;
Zoom();
});
}
$.get('/api/ploteps/', { epsfile : path });
}
});
setTimeout(function(){
window.location.reload(1);
}, 5000);
testing();
</script>
</body>
$("body").on("click", "img", function(){
var result = window.confirm('voulez-vous imprimer ce glyph ?');
</html>
if(result){
var path = $(this).attr('src').replace(/svg/g, 'eps');
$.get('/api/ploteps/', { epsfile : path });
}
});
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