source: trunk/plugins/InsertPicture/viewpicture.html @ 631

Last change on this file since 631 was 419, checked in by mokhet, 14 years ago

more ; fixed (a few were missing, a lot were used with no reason) for ticket #385

File size: 1.3 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html>
3<head>
4        <title>Preview</title>
5<script language="JavaScript" type="text/javascript">
6<!--
7function imgWait() {
8        waiting = window.setInterval("imgIsLoaded()", 1000);
9}
10function imgIsLoaded() {
11        if(document.getElementById("myImg").width > 0) {
12          window.clearInterval(waiting);
13          imgShowWidth();
14        }
15}
16function imgShowWidth() {
17        var width    = document.getElementById("myImg").width;
18        var height   = document.getElementById("myImg").height;
19        if(width > 120) {
20          var dx = (120 / width);
21          var dy = (120 / height);
22          ratio  = dx < dy ? dx : dy;
23          // keep aspect ratio
24          width  = width * ratio;
25          height = height * ratio;
26          document.getElementById("myImg").width  = width;
27          document.getElementById("myImg").height = height;
28        }
29        document.getElementById("myImg").style.visibility = 'visible';
30}
31function showPreview() {
32        img = document.location.toString().split("?");
33    document.getElementById("myImg").src = img[1];
34        img.onLoad = imgWait();
35}
36//-->
37</script>
38</head>
39<body  marginwidth="5px" marginheight="5px" topmargin="5px" leftmargin="5px" rightmargin="5px">
40<img id="myImg" src="" Style="visibility:hidden">
41<script language="JavaScript" type="text/javascript">
42  showPreview();
43</script>
44
45</body>
46</html>
Note: See TracBrowser for help on using the repository browser.