index.html 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <script src="../../../script/jquery.min.js"></script>
  5. <script src="../../../script/ao_module.js"></script>
  6. <title>NotepadA Test Window</title>
  7. <style>
  8. body{
  9. font-family: Arial !important;
  10. background-color:#ebebeb;
  11. }
  12. .menu{
  13. position:fixed;
  14. top:0;
  15. left:0;
  16. width:100%;
  17. height:18px;
  18. background-color:#3d3d3d;
  19. padding:5px;
  20. color:white;
  21. font-size:80%;
  22. }
  23. .urlinput{
  24. display:inline;
  25. }
  26. .toRight{
  27. position:absolute;
  28. right:15px;
  29. top:3px;
  30. }
  31. .previewArea{
  32. width:100%;
  33. position:fixed;
  34. top:27px;
  35. left:0px;
  36. }
  37. #previewWindow{
  38. position:absolute;
  39. left:0px;
  40. top:0px;
  41. }
  42. </style>
  43. </head>
  44. <body>
  45. <div id="toolbar" class="menu">
  46. Window Size:   <div id="windowsize" style="display:inline;">loading...</div><button class="toRight" onClick="document.getElementById('previewWindow').contentWindow.location.reload();">Refresh</button>
  47. </div>
  48. <div class="previewArea">
  49. <iframe id="previewWindow" frameBorder="0" width="100%" src="nothing.html"></iframe>
  50. </div>
  51. </body>
  52. <script>
  53. var bottomPadding = 8; //In pixel
  54. adjustIframeSize();
  55. function adjustIframeSize(){
  56. var w = window.innerWidth;
  57. var h = window.innerHeight;
  58. $("#windowsize").html(w + "px x " + (h - parseInt($("#toolbar").height()) - bottomPadding) + "px");
  59. $("#previewWindow").attr("width",w + "px");
  60. $("#previewWindow").attr("height",(h - parseInt($("#toolbar").height()) - bottomPadding) + "px")
  61. }
  62. $( window ).resize(function() {
  63. adjustIframeSize();
  64. });
  65. //Check if anyfile are passed in
  66. var inputFile = ao_module_loadInputFiles();
  67. if (inputFile != null){
  68. inputFile = inputFile[0];
  69. //Contains input file. Check if it can be opened (.html / .htm)
  70. var ext = inputFile.filename.split(".");
  71. ext = ext.pop();
  72. if (ext == "html" || ext == "htm"){
  73. //Open it
  74. $("#previewWindow").attr('src', "../../../media?file=" + inputFile.filepath)
  75. }else{
  76. $("#previewWindow").attr('src', "./notviewable.html");
  77. }
  78. }
  79. </script>
  80. </html>