xmind.ftl 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <title>${file.name}文件预览</title>
  5. <meta charset="utf-8" />
  6. <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
  7. <#include "*/commonHeader.ftl">
  8. <script src="js/base64.min.js" type="text/javascript"></script>
  9. <#if currentUrl?contains("http://") || currentUrl?contains("https://")>
  10. <#assign finalUrl="${currentUrl}">
  11. <#elseif currentUrl?contains("ftp://") >
  12. <#assign finalUrl="${currentUrl}">
  13. <#else>
  14. <#assign finalUrl="${baseUrl}${currentUrl}">
  15. </#if>
  16. </head>
  17. <body>
  18. <div id="mount">
  19. </div>
  20. <script src="xmind/xmind.js"></script>
  21. <script type="text/javascript">
  22. var url = '${finalUrl}';
  23. var baseUrl = '${baseUrl}'.endsWith('/') ? '${baseUrl}' : '${baseUrl}' + '/';
  24. if (!url.startsWith(baseUrl)) {
  25. url = baseUrl + 'getCorsFile?urlPath=' + encodeURIComponent(Base64.encode(url));
  26. }
  27. const init = async () => {
  28. var windowWidth = document.documentElement.clientWidth || document.body.clientWidth;
  29. var windowHeight = document.documentElement.clientHeight || document.body.clientHeight;
  30. windowWidth = windowWidth-30;
  31. windowHeight = windowHeight-30;
  32. windowWidth =windowWidth+"px";
  33. windowHeight =windowHeight+"px";
  34. const res = await fetch(url)
  35. const viewer = new XMindEmbedViewer({
  36. el: '#mount',
  37. file: await res.arrayBuffer(),
  38. styles: {
  39. 'height': windowHeight,
  40. 'width': windowWidth
  41. }
  42. })
  43. }
  44. init()
  45. /*初始化水印*/
  46. if (!!window.ActiveXObject || "ActiveXObject" in window)
  47. {
  48. }else{
  49. initWaterMark();
  50. }
  51. </script>
  52. </body>
  53. </html>