compress.ftl 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <link href="css/zTreeStyle.css" rel="stylesheet" type="text/css">
  5. <style type="text/css">
  6. html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {
  7. margin: 0;padding: 0;border: 0;outline: 0;font-weight: inherit;font-style: inherit;font-size: 100%;font-family: inherit;vertical-align: baseline;}
  8. body {color: #2f332a;font: 15px/21px Arial, Helvetica, simsun, sans-serif;background: #f0f6e4 \9;}
  9. body{
  10. margin:0 auto;
  11. width: 600px;
  12. background-color: #333333;
  13. font-size: 4em;
  14. }
  15. h1, h2, h3, h4, h5, h6 {color: #2f332a;font-weight: bold;font-family: Helvetica, Arial, sans-serif;padding-bottom: 5px;}
  16. h1 {font-size: 24px;line-height: 34px;text-align: center;}
  17. h2 {font-size: 14px;line-height: 24px;padding-top: 5px;}
  18. h6 {font-weight: normal;font-size: 12px;letter-spacing: 1px;line-height: 24px;text-align: center;}
  19. a {color:#3C6E31;text-decoration: underline;}
  20. a:hover {background-color:#3C6E31;color:white;}
  21. input.radio {margin: 0 2px 0 8px;}
  22. input.radio.first {margin-left:0;}
  23. input.empty {color: lightgray;}
  24. code {color: #2f332a;}
  25. div.zTreeDemoBackground {width:600px;text-align:center;background-color: #ffffff;}
  26. </style>
  27. </head>
  28. <body>
  29. <div class="zTreeDemoBackground left">
  30. <ul id="treeDemo" class="ztree"></ul>
  31. </div>
  32. </body>
  33. <script type="text/javascript" src="js/jquery-3.0.0.min.js"></script>
  34. <script type="text/javascript" src="js/jquery.ztree.core.js"></script>
  35. <script type="text/javascript">
  36. var data = JSON.parse('${fileTree}');
  37. var setting = {
  38. view: {
  39. fontCss : {"color":"blue"},
  40. showLine: true
  41. },
  42. data: {
  43. key: {
  44. children: 'childList',
  45. name: 'originName'
  46. }
  47. },
  48. callback:{
  49. beforeClick:function (treeId, treeNode, clickFlag) {
  50. console.log("节点参数:treeId-" + treeId + "treeNode-"
  51. + JSON.stringify(treeNode) + "clickFlag-" + clickFlag);
  52. },
  53. onClick:function (event, treeId, treeNode) {
  54. if (!treeNode.directory) {
  55. /**实现窗口最大化**/
  56. var fulls = "left=0,screenX=0,top=0,screenY=0,scrollbars=1"; //定义弹出窗口的参数
  57. if (window.screen) {
  58. var ah = screen.availHeight - 30;
  59. var aw = (screen.availWidth - 10) / 2;
  60. fulls += ",height=" + ah;
  61. fulls += ",innerHeight=" + ah;
  62. fulls += ",width=" + aw;
  63. fulls += ",innerWidth=" + aw;
  64. fulls += ",resizable"
  65. } else {
  66. fulls += ",resizable"; // 对于不支持screen属性的浏览器,可以手工进行最大化。 manually
  67. }
  68. window.open("onlinePreview?url="
  69. + encodeURIComponent("${baseUrl}" + treeNode.fileName+"&fileKey="+treeNode.fileKey), "_blank",fulls);
  70. }
  71. }
  72. }
  73. };
  74. var height = 0;
  75. $(document).ready(function(){
  76. var treeObj = $.fn.zTree.init($("#treeDemo"), setting, data);
  77. treeObj.expandAll(true);
  78. height = getZtreeDomHeight();
  79. $(".zTreeDemoBackground").css("height", height);
  80. });
  81. /**
  82. * 计算ztreedom的高度
  83. */
  84. function getZtreeDomHeight() {
  85. return $("#treeDemo").height() > window.document.documentElement.clientHeight - 1
  86. ? $("#treeDemo").height() : window.document.documentElement.clientHeight - 1;
  87. }
  88. /**
  89. * 页面变化调整高度
  90. */
  91. window.onresize = function(){
  92. height = getZtreeDomHeight();
  93. $(".zTreeDemoBackground").css("height", height);
  94. }
  95. /**
  96. * 滚动时调整高度
  97. */
  98. window.onscroll = function(){
  99. height = getZtreeDomHeight();
  100. $(".zTreeDemoBackground").css("height", height);
  101. }
  102. </script>
  103. </html>