index.html 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="apple-mobile-web-app-capable" content="yes" />
  6. <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1"/>
  7. <meta name="theme-color" content="#4b75ff">
  8. <link rel="stylesheet" href="../script/semantic/semantic.min.css">
  9. <script src="../script/jquery.min.js"></script>
  10. <script src="../script/ao_module.js"></script>
  11. <script src="../script/semantic/semantic.min.js"></script>
  12. <script src="message.js"></script>
  13. <link rel="icon" type="image/png" href="img/module_icon.png">
  14. <link rel="manifest" crossorigin="use-credentials" href="manifest.json">
  15. <title>OfficeViewer</title>
  16. <style>
  17. body{
  18. border-top: 5px solid #445b80;
  19. background-color: white;
  20. }
  21. </style>
  22. </head>
  23. <body>
  24. <br>
  25. <div class="ui container">
  26. <button class="ui basic fluid button" onclick="openFileSelector();">Open File</button>
  27. <div class="ui divider"></div>
  28. ArozOS Office Viewer
  29. </div>
  30. <script>
  31. $(document).ready(function(){
  32. openFileSelector();
  33. });
  34. function openFileSelector(){
  35. ao_module_openFileSelector(fileSelected, "user:/Document", "file",false, {
  36. filter: ["docx", "pptx", "xlsx"]
  37. });
  38. }
  39. function fileSelected(filedata){
  40. if (filedata.length == 0){
  41. alert("No file selected")
  42. }else{
  43. console.log(encodeURIComponent(JSON.stringify(filedata)));
  44. ao_module_setWindowSize(1060, 680);
  45. let redirectionURL = "embedded.html#" + encodeURIComponent(JSON.stringify(filedata));
  46. if (window.location.href.substr(window.location.href.length - 1) != "/"){
  47. redirectionURL = "/" + redirectionURL;
  48. }
  49. window.location.href= window.location.href + redirectionURL;
  50. }
  51. }
  52. </script>
  53. </body>
  54. </html>