metahoguet
clone your own copy | download snapshot

Snapshots | iceberg

Inside this repository

index.html
text/html

Download raw (2.9 KB)

<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">
	    img {
	       height: 200px;;
	       width: auto;
		 			overflow: visible;
	    }
	    footer{
	       bottom: 0px;
	       width: 100%;
	       position: fixed;
	       font-family: courier;
	       border-top: 1px solid blue;
	       color: blue;
	       text-transform: uppercase;
	       background: white;
	    }
	    .cadra{
	       width: auto;
	       height: 80px
	       padding: 0px;
	       float: left;
	       overflow: visible;
	       outline: red solid 1px;
	    }
	    .compare{
	       position: absolute;
	       opacity: 0.1;
	    }
	    .cadra span{
	       font-family: courier;
	       font-size: 7pt;
		  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?'+ (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 Compare(){
				$('img').toggleClass('compare');
			}

			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();
						}
				})

				$( "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();
				});
			}

			$("body").on("click", "img", function(){
				var result = window.confirm('voulez-vous imprimer ce glyph ?');

				if(result){
					var path = $(this).attr('src').split('?')[0].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);
			//	});
			// }, 7000);

			testing();
		</script>
	</body>
</html>