mirror of
https://gitee.com/kekingcn/file-online-preview.git
synced 2026-04-28 11:06:43 +00:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
27ae58a0f4 | ||
|
|
4d83674806 | ||
|
|
12c85c60c7 | ||
|
|
4747ee93b2 | ||
|
|
5ec53c4b33 | ||
|
|
ee7f7f50cc | ||
|
|
92869e8d6c | ||
|
|
c66dda239f | ||
|
|
e927760c40 | ||
|
|
8783f9059a | ||
|
|
12e1239267 |
@@ -56,12 +56,6 @@
|
|||||||
<groupId>cn.keking</groupId>
|
<groupId>cn.keking</groupId>
|
||||||
<artifactId>office-plugin</artifactId>
|
<artifactId>office-plugin</artifactId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<artifactId>commons-io</artifactId>
|
|
||||||
<groupId>commons-io</groupId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
@@ -105,11 +99,6 @@
|
|||||||
<artifactId>fr.opensagres.xdocreport.document</artifactId>
|
<artifactId>fr.opensagres.xdocreport.document</artifactId>
|
||||||
<version>1.0.5</version>
|
<version>1.0.5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>commons-io</groupId>
|
|
||||||
<artifactId>commons-io</artifactId>
|
|
||||||
<version>2.4</version>
|
|
||||||
</dependency>
|
|
||||||
<!-- 解压(apache) -->
|
<!-- 解压(apache) -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public enum FileType {
|
|||||||
cad("cadFilePreviewImpl");
|
cad("cadFilePreviewImpl");
|
||||||
|
|
||||||
private static final String[] OFFICE_TYPES = {"docx", "doc", "xls", "xlsx", "ppt", "pptx"};
|
private static final String[] OFFICE_TYPES = {"docx", "doc", "xls", "xlsx", "ppt", "pptx"};
|
||||||
private static final String[] PICTURE_TYPES = {"jpg", "jpeg", "png", "gif", "bmp", "ico", "RAW"};
|
private static final String[] PICTURE_TYPES = {"jpg", "jpeg", "png", "gif", "bmp", "ico", "raw"};
|
||||||
private static final String[] ARCHIVE_TYPES = {"rar", "zip", "jar", "7-zip", "tar", "gzip", "7z"};
|
private static final String[] ARCHIVE_TYPES = {"rar", "zip", "jar", "7-zip", "tar", "gzip", "7z"};
|
||||||
private static final String[] SSIM_TEXT_TYPES = ConfigConstants.getSimText();
|
private static final String[] SSIM_TEXT_TYPES = ConfigConstants.getSimText();
|
||||||
private static final String[] MEDIA_TYPES = ConfigConstants.getMedia();
|
private static final String[] MEDIA_TYPES = ConfigConstants.getMedia();
|
||||||
@@ -71,7 +71,8 @@ public enum FileType {
|
|||||||
|
|
||||||
public static FileType typeFromFileName(String fileName) {
|
public static FileType typeFromFileName(String fileName) {
|
||||||
String fileType = fileName.substring(fileName.lastIndexOf(".") + 1);
|
String fileType = fileName.substring(fileName.lastIndexOf(".") + 1);
|
||||||
return FileType.to(fileType);
|
String lowerCaseFileType = fileType.toLowerCase();
|
||||||
|
return FileType.to(lowerCaseFileType);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final String instanceName;
|
private final String instanceName;
|
||||||
|
|||||||
@@ -275,7 +275,7 @@ public class FileHandlerService {
|
|||||||
attribute.setUrl(url);
|
attribute.setUrl(url);
|
||||||
if (req != null) {
|
if (req != null) {
|
||||||
String officePreviewType = req.getParameter("officePreviewType");
|
String officePreviewType = req.getParameter("officePreviewType");
|
||||||
String fileKey = req.getParameter("fileKey");
|
String fileKey = WebUtils.getUrlParameterReg(url,"fileKey");
|
||||||
if (StringUtils.hasText(officePreviewType)) {
|
if (StringUtils.hasText(officePreviewType)) {
|
||||||
attribute.setOfficePreviewType(officePreviewType);
|
attribute.setOfficePreviewType(officePreviewType);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ import cn.keking.model.ReturnResponse;
|
|||||||
import cn.keking.service.FilePreview;
|
import cn.keking.service.FilePreview;
|
||||||
import cn.keking.utils.DownloadUtils;
|
import cn.keking.utils.DownloadUtils;
|
||||||
import cn.keking.utils.KkFileUtils;
|
import cn.keking.utils.KkFileUtils;
|
||||||
import org.apache.commons.io.FileUtils;
|
import jodd.io.FileUtil;
|
||||||
|
import org.apache.commons.codec.binary.Base64;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.util.Base64Utils;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -36,8 +36,8 @@ public class SimTextFilePreviewImpl implements FilePreview {
|
|||||||
try {
|
try {
|
||||||
File originFile = new File(response.getContent());
|
File originFile = new File(response.getContent());
|
||||||
String charset = KkFileUtils.getFileEncode(originFile);
|
String charset = KkFileUtils.getFileEncode(originFile);
|
||||||
String xmlString = FileUtils.readFileToString(originFile, charset);
|
String fileData = FileUtil.readString(originFile, charset);
|
||||||
model.addAttribute("textData", Base64Utils.encodeToString(xmlString.getBytes(charset)));
|
model.addAttribute("textData", Base64.encodeBase64String(fileData.getBytes()));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
return otherFilePreview.notSupportedFile(model, fileAttribute, e.getLocalizedMessage());
|
return otherFilePreview.notSupportedFile(model, fileAttribute, e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ import cn.keking.config.ConfigConstants;
|
|||||||
import cn.keking.model.FileAttribute;
|
import cn.keking.model.FileAttribute;
|
||||||
import cn.keking.model.ReturnResponse;
|
import cn.keking.model.ReturnResponse;
|
||||||
import io.mola.galimatias.GalimatiasParseException;
|
import io.mola.galimatias.GalimatiasParseException;
|
||||||
import org.apache.commons.io.FileUtils;
|
import jodd.io.FileUtil;
|
||||||
|
import jodd.io.NetUtil;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@@ -39,7 +40,7 @@ public class DownloadUtils {
|
|||||||
URL url = WebUtils.normalizedURL(urlStr);
|
URL url = WebUtils.normalizedURL(urlStr);
|
||||||
if (isHttpUrl(url)) {
|
if (isHttpUrl(url)) {
|
||||||
File realFile = new File(realPath);
|
File realFile = new File(realPath);
|
||||||
FileUtils.copyURLToFile(url, realFile);
|
NetUtil.downloadFile(url.toString(),realFile);
|
||||||
} else if (isFtpUrl(url)) {
|
} else if (isFtpUrl(url)) {
|
||||||
String ftpUsername = WebUtils.getUrlParameterReg(fileAttribute.getUrl(), URL_PARAM_FTP_USERNAME);
|
String ftpUsername = WebUtils.getUrlParameterReg(fileAttribute.getUrl(), URL_PARAM_FTP_USERNAME);
|
||||||
String ftpPassword = WebUtils.getUrlParameterReg(fileAttribute.getUrl(), URL_PARAM_FTP_PASSWORD);
|
String ftpPassword = WebUtils.getUrlParameterReg(fileAttribute.getUrl(), URL_PARAM_FTP_PASSWORD);
|
||||||
|
|||||||
@@ -8,13 +8,14 @@ import cn.keking.service.cache.CacheService;
|
|||||||
import cn.keking.service.impl.OtherFilePreviewImpl;
|
import cn.keking.service.impl.OtherFilePreviewImpl;
|
||||||
import cn.keking.service.FileHandlerService;
|
import cn.keking.service.FileHandlerService;
|
||||||
import cn.keking.utils.WebUtils;
|
import cn.keking.utils.WebUtils;
|
||||||
|
import fr.opensagres.xdocreport.core.io.IOUtils;
|
||||||
import io.mola.galimatias.GalimatiasParseException;
|
import io.mola.galimatias.GalimatiasParseException;
|
||||||
import org.apache.commons.io.IOUtils;
|
import jodd.io.NetUtil;
|
||||||
|
import org.apache.commons.codec.binary.Base64;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.util.Base64Utils;
|
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
@@ -54,7 +55,7 @@ public class OnlinePreviewController {
|
|||||||
public String onlinePreview(String url, Model model, HttpServletRequest req) {
|
public String onlinePreview(String url, Model model, HttpServletRequest req) {
|
||||||
String fileUrl;
|
String fileUrl;
|
||||||
try {
|
try {
|
||||||
fileUrl = new String(Base64Utils.decodeFromString(url));
|
fileUrl = new String(Base64.decodeBase64(url));
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
String errorMsg = String.format(BASE64_DECODE_ERROR_MSG, "url");
|
String errorMsg = String.format(BASE64_DECODE_ERROR_MSG, "url");
|
||||||
return otherFilePreview.notSupportedFile(model, errorMsg);
|
return otherFilePreview.notSupportedFile(model, errorMsg);
|
||||||
@@ -70,7 +71,7 @@ public class OnlinePreviewController {
|
|||||||
public String picturesPreview(String urls, Model model, HttpServletRequest req) throws UnsupportedEncodingException {
|
public String picturesPreview(String urls, Model model, HttpServletRequest req) throws UnsupportedEncodingException {
|
||||||
String fileUrls;
|
String fileUrls;
|
||||||
try {
|
try {
|
||||||
fileUrls = new String(Base64Utils.decodeFromString(urls));
|
fileUrls = new String(Base64.decodeBase64(urls));
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
String errorMsg = String.format(BASE64_DECODE_ERROR_MSG, "urls");
|
String errorMsg = String.format(BASE64_DECODE_ERROR_MSG, "urls");
|
||||||
return otherFilePreview.notSupportedFile(model, errorMsg);
|
return otherFilePreview.notSupportedFile(model, errorMsg);
|
||||||
@@ -83,7 +84,7 @@ public class OnlinePreviewController {
|
|||||||
|
|
||||||
String currentUrl = req.getParameter("currentUrl");
|
String currentUrl = req.getParameter("currentUrl");
|
||||||
if (StringUtils.hasText(currentUrl)) {
|
if (StringUtils.hasText(currentUrl)) {
|
||||||
String decodedCurrentUrl = new String(Base64Utils.decodeFromString(currentUrl));
|
String decodedCurrentUrl = new String(Base64.decodeBase64(currentUrl));
|
||||||
model.addAttribute("currentUrl", decodedCurrentUrl);
|
model.addAttribute("currentUrl", decodedCurrentUrl);
|
||||||
} else {
|
} else {
|
||||||
model.addAttribute("currentUrl", imgUrls.get(0));
|
model.addAttribute("currentUrl", imgUrls.get(0));
|
||||||
@@ -103,7 +104,7 @@ public class OnlinePreviewController {
|
|||||||
logger.info("下载跨域pdf文件url:{}", urlPath);
|
logger.info("下载跨域pdf文件url:{}", urlPath);
|
||||||
try {
|
try {
|
||||||
URL url = WebUtils.normalizedURL(urlPath);
|
URL url = WebUtils.normalizedURL(urlPath);
|
||||||
byte[] bytes = IOUtils.toByteArray(url);
|
byte[] bytes = NetUtil.downloadBytes(url.toString());
|
||||||
IOUtils.write(bytes, response.getOutputStream());
|
IOUtils.write(bytes, response.getOutputStream());
|
||||||
} catch (IOException | GalimatiasParseException e) {
|
} catch (IOException | GalimatiasParseException e) {
|
||||||
logger.error("下载跨域pdf文件异常,url:{}", urlPath, e);
|
logger.error("下载跨域pdf文件异常,url:{}", urlPath, e);
|
||||||
|
|||||||
49
server/src/main/resources/web/commonHeader.ftl
Normal file
49
server/src/main/resources/web/commonHeader.ftl
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css"/>
|
||||||
|
<script src="js/jquery-3.0.0.min.js" type="text/javascript"></script>
|
||||||
|
<script src="js/jquery.form.min.js" type="text/javascript"></script>
|
||||||
|
<script src="bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
|
||||||
|
<script src="js/watermark.js" type="text/javascript"></script>
|
||||||
|
<script src="js/base64.min.js" type="text/javascript"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
/**
|
||||||
|
* 初始化水印
|
||||||
|
*/
|
||||||
|
function initWaterMark() {
|
||||||
|
let watermarkTxt = '${watermarkTxt}';
|
||||||
|
if (watermarkTxt !== '') {
|
||||||
|
watermark.init({
|
||||||
|
watermark_txt: '${watermarkTxt}',
|
||||||
|
watermark_x: 0,
|
||||||
|
watermark_y: 0,
|
||||||
|
watermark_rows: 0,
|
||||||
|
watermark_cols: 0,
|
||||||
|
watermark_x_space: ${watermarkXSpace},
|
||||||
|
watermark_y_space: ${watermarkYSpace},
|
||||||
|
watermark_font: '${watermarkFont}',
|
||||||
|
watermark_fontsize: '${watermarkFontsize}',
|
||||||
|
watermark_color: '${watermarkColor}',
|
||||||
|
watermark_alpha: ${watermarkAlpha},
|
||||||
|
watermark_width: ${watermarkWidth},
|
||||||
|
watermark_height: ${watermarkHeight},
|
||||||
|
watermark_angle: ${watermarkAngle},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
<style>
|
||||||
|
* {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
html, body {
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
@@ -5,15 +5,8 @@
|
|||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1.0">
|
||||||
<link href="css/zTreeStyle.css" rel="stylesheet" type="text/css">
|
<link href="css/zTreeStyle.css" rel="stylesheet" type="text/css">
|
||||||
|
<#include "*/commonHeader.ftl">
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
* {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
html, body {
|
|
||||||
height: 100%;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
body {
|
body {
|
||||||
background-color: #404040;
|
background-color: #404040;
|
||||||
}
|
}
|
||||||
@@ -32,10 +25,7 @@
|
|||||||
<div class="zTreeDemoBackground left">
|
<div class="zTreeDemoBackground left">
|
||||||
<ul id="treeDemo" class="ztree"></ul>
|
<ul id="treeDemo" class="ztree"></ul>
|
||||||
</div>
|
</div>
|
||||||
<script src="js/watermark.js" type="text/javascript"></script>
|
|
||||||
<script type="text/javascript" src="js/jquery-3.0.0.min.js"></script>
|
|
||||||
<script type="text/javascript" src="js/jquery.ztree.core.js"></script>
|
<script type="text/javascript" src="js/jquery.ztree.core.js"></script>
|
||||||
<script type="text/javascript" src="js/base64.min.js" ></script>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
const data = JSON.parse('${fileTree}');
|
const data = JSON.parse('${fileTree}');
|
||||||
@@ -87,25 +77,7 @@
|
|||||||
|
|
||||||
/*初始化水印*/
|
/*初始化水印*/
|
||||||
window.onload = function() {
|
window.onload = function() {
|
||||||
var watermarkTxt = '${watermarkTxt}';
|
initWaterMark();
|
||||||
if (watermarkTxt !== '') {
|
|
||||||
watermark.init({
|
|
||||||
watermark_txt: '${watermarkTxt}',
|
|
||||||
watermark_x: 0,
|
|
||||||
watermark_y: 0,
|
|
||||||
watermark_rows: 0,
|
|
||||||
watermark_cols: 0,
|
|
||||||
watermark_x_space: ${watermarkXSpace},
|
|
||||||
watermark_y_space: ${watermarkYSpace},
|
|
||||||
watermark_font: '${watermarkFont}',
|
|
||||||
watermark_fontsize: '${watermarkFontsize}',
|
|
||||||
watermark_color:'${watermarkColor}',
|
|
||||||
watermark_alpha: ${watermarkAlpha},
|
|
||||||
watermark_width: ${watermarkWidth},
|
|
||||||
watermark_height: ${watermarkHeight},
|
|
||||||
watermark_angle: ${watermarkAngle},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
<img src="images/sorry.jpg" />
|
<img src="images/sorry.jpg" />
|
||||||
<span>
|
<span>
|
||||||
该文件类型(${fileType})系统暂时不支持在线预览,<b>说明</b>:
|
该文件类型(${file.suffix})系统暂时不支持在线预览,<b>说明</b>:
|
||||||
<p style="color: red;">${msg}</p>
|
<p style="color: red;">${msg}</p>
|
||||||
有任何疑问,请加 <a href="https://jq.qq.com/?_wv=1027&k=5c0UAtu">官方QQ群:613025121</a> 咨询
|
有任何疑问,请加 <a href="https://jq.qq.com/?_wv=1027&k=5c0UAtu">官方QQ群:613025121</a> 咨询
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -4,17 +4,9 @@
|
|||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<title>多媒体文件预览</title>
|
<title>多媒体文件预览</title>
|
||||||
<script src="js/flv.min.js" type="text/javascript"></script>
|
<script src="js/flv.min.js" type="text/javascript"></script>
|
||||||
<script src="js/watermark.js" type="text/javascript"></script>
|
<#include "*/commonHeader.ftl">
|
||||||
</head>
|
</head>
|
||||||
<style>
|
<style>
|
||||||
* {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
html, body {
|
|
||||||
height: 100%;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
body {
|
body {
|
||||||
background-color: #404040;
|
background-color: #404040;
|
||||||
}
|
}
|
||||||
@@ -40,25 +32,7 @@
|
|||||||
}
|
}
|
||||||
/*初始化水印*/
|
/*初始化水印*/
|
||||||
window.onload = function() {
|
window.onload = function() {
|
||||||
var watermarkTxt = '${watermarkTxt}';
|
initWaterMark();
|
||||||
if (watermarkTxt !== '') {
|
|
||||||
watermark.init({
|
|
||||||
watermark_txt: '${watermarkTxt}',
|
|
||||||
watermark_x: 0,
|
|
||||||
watermark_y: 0,
|
|
||||||
watermark_rows: 0,
|
|
||||||
watermark_cols: 0,
|
|
||||||
watermark_x_space: ${watermarkXSpace},
|
|
||||||
watermark_y_space: ${watermarkYSpace},
|
|
||||||
watermark_font: '${watermarkFont}',
|
|
||||||
watermark_fontsize: '${watermarkFontsize}',
|
|
||||||
watermark_color:'${watermarkColor}',
|
|
||||||
watermark_alpha: ${watermarkAlpha},
|
|
||||||
watermark_width: ${watermarkWidth},
|
|
||||||
watermark_height: ${watermarkHeight},
|
|
||||||
watermark_angle: ${watermarkAngle},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -4,21 +4,11 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1.0">
|
||||||
<style type="text/css">
|
<#include "*/commonHeader.ftl">
|
||||||
* {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
html, body {
|
|
||||||
height: 100%;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<iframe src="${pdfUrl}" width="100%" frameborder="0"></iframe>
|
<iframe src="${pdfUrl}" width="100%" frameborder="0"></iframe>
|
||||||
</body>
|
</body>
|
||||||
<script src="js/watermark.js" type="text/javascript"></script>
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
document.getElementsByTagName('iframe')[0].height = document.documentElement.clientHeight-10;
|
document.getElementsByTagName('iframe')[0].height = document.documentElement.clientHeight-10;
|
||||||
/**
|
/**
|
||||||
@@ -30,25 +20,7 @@
|
|||||||
}
|
}
|
||||||
/*初始化水印*/
|
/*初始化水印*/
|
||||||
window.onload = function() {
|
window.onload = function() {
|
||||||
var watermarkTxt = '${watermarkTxt}';
|
initWaterMark();
|
||||||
if (watermarkTxt !== '') {
|
|
||||||
watermark.init({
|
|
||||||
watermark_txt: '${watermarkTxt}',
|
|
||||||
watermark_x: 0,
|
|
||||||
watermark_y: 0,
|
|
||||||
watermark_rows: 0,
|
|
||||||
watermark_cols: 0,
|
|
||||||
watermark_x_space: ${watermarkXSpace},
|
|
||||||
watermark_y_space: ${watermarkYSpace},
|
|
||||||
watermark_font: '${watermarkFont}',
|
|
||||||
watermark_fontsize: '${watermarkFontsize}',
|
|
||||||
watermark_color:'${watermarkColor}',
|
|
||||||
watermark_alpha: ${watermarkAlpha},
|
|
||||||
watermark_width: ${watermarkWidth},
|
|
||||||
watermark_height: ${watermarkHeight},
|
|
||||||
watermark_angle: ${watermarkAngle},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</html>
|
</html>
|
||||||
@@ -3,7 +3,9 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8"/>
|
<meta charset="utf-8"/>
|
||||||
<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1.0">
|
||||||
<title>普通文本预览</title>
|
<title>markdown文本预览</title>
|
||||||
|
<script src="js/marked.min.js" type="text/javascript"></script>
|
||||||
|
<#include "*/commonHeader.ftl">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<input hidden id="textData" value="${textData}"/>
|
<input hidden id="textData" value="${textData}"/>
|
||||||
@@ -30,15 +32,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css"/>
|
|
||||||
|
|
||||||
<script src="js/jquery-3.0.0.min.js" type="text/javascript"></script>
|
|
||||||
<script src="js/jquery.form.min.js" type="text/javascript"></script>
|
|
||||||
<script src="bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
|
|
||||||
<script src="js/watermark.js" type="text/javascript"></script>
|
|
||||||
<script src="js/marked.min.js" type="text/javascript"></script>
|
|
||||||
<script src="js/base64.min.js" type="text/javascript"></script>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
/**
|
/**
|
||||||
* 初始化
|
* 初始化
|
||||||
@@ -49,32 +42,6 @@
|
|||||||
loadMarkdown();
|
loadMarkdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 初始化水印
|
|
||||||
*/
|
|
||||||
function initWaterMark() {
|
|
||||||
let watermarkTxt = '${watermarkTxt}';
|
|
||||||
if (watermarkTxt !== '') {
|
|
||||||
watermark.init({
|
|
||||||
watermark_txt: '${watermarkTxt}',
|
|
||||||
watermark_x: 0,
|
|
||||||
watermark_y: 0,
|
|
||||||
watermark_rows: 0,
|
|
||||||
watermark_cols: 0,
|
|
||||||
watermark_x_space: ${watermarkXSpace},
|
|
||||||
watermark_y_space: ${watermarkYSpace},
|
|
||||||
watermark_font: '${watermarkFont}',
|
|
||||||
watermark_fontsize: '${watermarkFontsize}',
|
|
||||||
watermark_color: '${watermarkColor}',
|
|
||||||
watermark_alpha: ${watermarkAlpha},
|
|
||||||
watermark_width: ${watermarkWidth},
|
|
||||||
watermark_height: ${watermarkHeight},
|
|
||||||
watermark_angle: ${watermarkAngle},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 加载markdown
|
* 加载markdown
|
||||||
*/
|
*/
|
||||||
@@ -101,18 +68,6 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<style>
|
|
||||||
* {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
html, body {
|
|
||||||
height: 100%;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -5,19 +5,12 @@
|
|||||||
<title>多媒体文件预览</title>
|
<title>多媒体文件预览</title>
|
||||||
<link rel="stylesheet" href="plyr/plyr.css"/>
|
<link rel="stylesheet" href="plyr/plyr.css"/>
|
||||||
<script type="text/javascript" src="plyr/plyr.js"></script>
|
<script type="text/javascript" src="plyr/plyr.js"></script>
|
||||||
<script type="text/javascript" src="js/watermark.js"></script>
|
<#include "*/commonHeader.ftl">
|
||||||
<style>
|
<style>
|
||||||
* {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
html, body {
|
|
||||||
height: 100%;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
body {
|
body {
|
||||||
background-color: #404040;
|
background-color: #404040;
|
||||||
}
|
}
|
||||||
|
|
||||||
.m {
|
.m {
|
||||||
width: 1024px;
|
width: 1024px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
@@ -33,25 +26,7 @@
|
|||||||
<script>
|
<script>
|
||||||
plyr.setup();
|
plyr.setup();
|
||||||
window.onload = function () {
|
window.onload = function () {
|
||||||
var watermarkTxt = '${watermarkTxt}';
|
initWaterMark();
|
||||||
if (watermarkTxt !== '') {
|
|
||||||
watermark.init({
|
|
||||||
watermark_txt: '${watermarkTxt}',
|
|
||||||
watermark_x: 0,
|
|
||||||
watermark_y: 0,
|
|
||||||
watermark_rows: 0,
|
|
||||||
watermark_cols: 0,
|
|
||||||
watermark_x_space: ${watermarkXSpace},
|
|
||||||
watermark_y_space: ${watermarkYSpace},
|
|
||||||
watermark_font: '${watermarkFont}',
|
|
||||||
watermark_fontsize: '${watermarkFontsize}',
|
|
||||||
watermark_color:'${watermarkColor}',
|
|
||||||
watermark_alpha: ${watermarkAlpha},
|
|
||||||
watermark_width: ${watermarkWidth},
|
|
||||||
watermark_height: ${watermarkHeight},
|
|
||||||
watermark_angle: ${watermarkAngle},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -4,15 +4,8 @@
|
|||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<title>PDF图片预览</title>
|
<title>PDF图片预览</title>
|
||||||
<script src="js/lazyload.js"></script>
|
<script src="js/lazyload.js"></script>
|
||||||
|
<#include "*/commonHeader.ftl">
|
||||||
<style>
|
<style>
|
||||||
* {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
html, body {
|
|
||||||
height: 100%;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
body {
|
body {
|
||||||
background-color: #404040;
|
background-color: #404040;
|
||||||
}
|
}
|
||||||
@@ -37,29 +30,10 @@
|
|||||||
<#if "false" == switchDisabled>
|
<#if "false" == switchDisabled>
|
||||||
<img src="images/pdf.svg" width="63" height="63" style="position: fixed; cursor: pointer; top: 40%; right: 48px; z-index: 999;" alt="使用PDF预览" title="使用PDF预览" onclick="changePreviewType('pdf')"/>
|
<img src="images/pdf.svg" width="63" height="63" style="position: fixed; cursor: pointer; top: 40%; right: 48px; z-index: 999;" alt="使用PDF预览" title="使用PDF预览" onclick="changePreviewType('pdf')"/>
|
||||||
</#if>
|
</#if>
|
||||||
<script src="js/watermark.js" type="text/javascript"></script>
|
|
||||||
<script>
|
<script>
|
||||||
window.onload = function () {
|
window.onload = function () {
|
||||||
/*初始化水印*/
|
/*初始化水印*/
|
||||||
var watermarkTxt = '${watermarkTxt}';
|
initWaterMark();
|
||||||
if (watermarkTxt !== '') {
|
|
||||||
watermark.init({
|
|
||||||
watermark_txt: '${watermarkTxt}',
|
|
||||||
watermark_x: 0,
|
|
||||||
watermark_y: 0,
|
|
||||||
watermark_rows: 0,
|
|
||||||
watermark_cols: 0,
|
|
||||||
watermark_x_space: ${watermarkXSpace},
|
|
||||||
watermark_y_space: ${watermarkYSpace},
|
|
||||||
watermark_font: '${watermarkFont}',
|
|
||||||
watermark_fontsize: '${watermarkFontsize}',
|
|
||||||
watermark_color:'${watermarkColor}',
|
|
||||||
watermark_alpha: ${watermarkAlpha},
|
|
||||||
watermark_width: ${watermarkWidth},
|
|
||||||
watermark_height: ${watermarkHeight},
|
|
||||||
watermark_angle: ${watermarkAngle},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
checkImgs();
|
checkImgs();
|
||||||
};
|
};
|
||||||
window.onscroll = throttle(checkImgs);
|
window.onscroll = throttle(checkImgs);
|
||||||
|
|||||||
@@ -5,16 +5,7 @@
|
|||||||
<meta charset="utf-8"/>
|
<meta charset="utf-8"/>
|
||||||
<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1.0">
|
||||||
<title>PDF预览</title>
|
<title>PDF预览</title>
|
||||||
<style type="text/css">
|
<#include "*/commonHeader.ftl">
|
||||||
* {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
html, body {
|
|
||||||
height: 100%;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<#if pdfUrl?contains("http://") || pdfUrl?contains("https://")>
|
<#if pdfUrl?contains("http://") || pdfUrl?contains("https://")>
|
||||||
@@ -24,10 +15,11 @@
|
|||||||
</#if>
|
</#if>
|
||||||
<iframe src="" width="100%" frameborder="0"></iframe>
|
<iframe src="" width="100%" frameborder="0"></iframe>
|
||||||
<#if "false" == switchDisabled>
|
<#if "false" == switchDisabled>
|
||||||
<img src="images/jpg.svg" width="63" height="63" style="position: fixed; cursor: pointer; top: 40%; right: 48px; z-index: 999;" alt="使用图片预览" title="使用图片预览" onclick="goForImage()"/>
|
<img src="images/jpg.svg" width="63" height="63"
|
||||||
|
style="position: fixed; cursor: pointer; top: 40%; right: 48px; z-index: 999;" alt="使用图片预览" title="使用图片预览"
|
||||||
|
onclick="goForImage()"/>
|
||||||
</#if>
|
</#if>
|
||||||
</body>
|
</body>
|
||||||
<script src="js/watermark.js" type="text/javascript"></script>
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
document.getElementsByTagName('iframe')[0].src = "${baseUrl}pdfjs/web/viewer.html?base=${baseUrl}&file=" + encodeURIComponent('${finalUrl}') + "&disabledownload=${pdfDownloadDisable}";
|
document.getElementsByTagName('iframe')[0].src = "${baseUrl}pdfjs/web/viewer.html?base=${baseUrl}&file=" + encodeURIComponent('${finalUrl}') + "&disabledownload=${pdfDownloadDisable}";
|
||||||
document.getElementsByTagName('iframe')[0].height = document.documentElement.clientHeight - 10;
|
document.getElementsByTagName('iframe')[0].height = document.documentElement.clientHeight - 10;
|
||||||
@@ -48,27 +40,10 @@
|
|||||||
}
|
}
|
||||||
window.location.href = url;
|
window.location.href = url;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*初始化水印*/
|
/*初始化水印*/
|
||||||
window.onload = function () {
|
window.onload = function () {
|
||||||
var watermarkTxt = '${watermarkTxt}';
|
initWaterMark();
|
||||||
if (watermarkTxt !== '') {
|
|
||||||
watermark.init({
|
|
||||||
watermark_txt: '${watermarkTxt}',
|
|
||||||
watermark_x: 0,
|
|
||||||
watermark_y: 0,
|
|
||||||
watermark_rows: 0,
|
|
||||||
watermark_cols: 0,
|
|
||||||
watermark_x_space: ${watermarkXSpace},
|
|
||||||
watermark_y_space: ${watermarkYSpace},
|
|
||||||
watermark_font: '${watermarkFont}',
|
|
||||||
watermark_fontsize: '${watermarkFontsize}',
|
|
||||||
watermark_color:'${watermarkColor}',
|
|
||||||
watermark_alpha: ${watermarkAlpha},
|
|
||||||
watermark_width: ${watermarkWidth},
|
|
||||||
watermark_height: ${watermarkHeight},
|
|
||||||
watermark_angle: ${watermarkAngle},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</html>
|
</html>
|
||||||
@@ -4,25 +4,20 @@
|
|||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<title>图片预览</title>
|
<title>图片预览</title>
|
||||||
<link rel="stylesheet" href="css/viewer.min.css">
|
<link rel="stylesheet" href="css/viewer.min.css">
|
||||||
|
<script src="js/viewer.min.js"></script>
|
||||||
|
<#include "*/commonHeader.ftl">
|
||||||
<style>
|
<style>
|
||||||
* {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
html, body {
|
|
||||||
height: 100%;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
body {
|
body {
|
||||||
background-color: #404040;
|
background-color: #404040;
|
||||||
}
|
}
|
||||||
#dowebok { width: 800px; margin: 0 auto; font-size: 0;}
|
#image { width: 800px; margin: 0 auto; font-size: 0;}
|
||||||
#dowebok li { display: inline-block;width: 50px;height: 50px; margin-left: 1%; padding-top: 1%;}
|
#image li { display: inline-block;width: 50px;height: 50px; margin-left: 1%; padding-top: 1%;}
|
||||||
/*#dowebok li img { width: 200%;}*/
|
/*#dowebok li img { width: 200%;}*/
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<ul id="dowebok">
|
|
||||||
|
<ul id="image">
|
||||||
<#list imgUrls as img>
|
<#list imgUrls as img>
|
||||||
<#if img?contains("http://") || img?contains("https://")>
|
<#if img?contains("http://") || img?contains("https://")>
|
||||||
<#assign img="${img}">
|
<#assign img="${img}">
|
||||||
@@ -32,11 +27,9 @@
|
|||||||
<li><img id="${img}" url="${img}" src="${img}" width="1px" height="1px"></li>
|
<li><img id="${img}" url="${img}" src="${img}" width="1px" height="1px"></li>
|
||||||
</#list>
|
</#list>
|
||||||
</ul>
|
</ul>
|
||||||
<script src="js/jquery-3.0.0.min.js"></script>
|
|
||||||
<script src="js/viewer.min.js"></script>
|
|
||||||
<script src="js/watermark.js" type="text/javascript"></script>
|
|
||||||
<script>
|
<script>
|
||||||
var viewer = new Viewer(document.getElementById('dowebok'), {
|
var viewer = new Viewer(document.getElementById('image'), {
|
||||||
url: 'src',
|
url: 'src',
|
||||||
navbar: false,
|
navbar: false,
|
||||||
button: false,
|
button: false,
|
||||||
@@ -44,61 +37,10 @@
|
|||||||
loop : true
|
loop : true
|
||||||
});
|
});
|
||||||
document.getElementById("${currentUrl}").click();
|
document.getElementById("${currentUrl}").click();
|
||||||
// 修改下一页按钮的样式和位置
|
|
||||||
$(function () {
|
|
||||||
var outHandler = function(){
|
|
||||||
$(this).css('background-color','rgba(0, 0, 0, 0)');
|
|
||||||
};
|
|
||||||
var overHandler = function(){
|
|
||||||
$(this).css('background-color','rgba(0, 0, 0, .5)');
|
|
||||||
};
|
|
||||||
var next = $("li[data-action=next]");
|
|
||||||
var prev = $("li[data-action=prev]");
|
|
||||||
var viewerToolBar = $(".viewer-footer");
|
|
||||||
// 覆盖按钮父类原始样式
|
|
||||||
viewerToolBar.css("overflow", "visible");
|
|
||||||
// 获取文档高度、宽度
|
|
||||||
var clientHeight = window.innerHeight;
|
|
||||||
var clientWidth = window.innerWidth;
|
|
||||||
// 调整样式
|
|
||||||
var styleCss = {},nextCss={},prevCss={};
|
|
||||||
styleCss.position = "absolute";
|
|
||||||
styleCss.top = -clientHeight;
|
|
||||||
styleCss.width = clientWidth*0.1;
|
|
||||||
styleCss.height = clientHeight + 52;
|
|
||||||
// 覆盖原始样式
|
|
||||||
styleCss.backgroundColor='rgba(0, 0, 0, 0)';
|
|
||||||
styleCss.borderRadius='inherit';
|
|
||||||
nextCss.right = "0";
|
|
||||||
prevCss.left = "0";
|
|
||||||
next.css($.extend(nextCss, styleCss));
|
|
||||||
prev.css($.extend(prevCss, styleCss));
|
|
||||||
next.on('mouseout',outHandler);
|
|
||||||
next.on('mouseover',overHandler);
|
|
||||||
prev.on('mouseout',outHandler);
|
|
||||||
prev.on('mouseover',overHandler);
|
|
||||||
});
|
|
||||||
/*初始化水印*/
|
/*初始化水印*/
|
||||||
window.onload = function() {
|
window.onload = function() {
|
||||||
var watermarkTxt = '${watermarkTxt}';
|
initWaterMark();
|
||||||
if (watermarkTxt !== '') {
|
|
||||||
watermark.init({
|
|
||||||
watermark_txt: '${watermarkTxt}',
|
|
||||||
watermark_x: 0,
|
|
||||||
watermark_y: 0,
|
|
||||||
watermark_rows: 0,
|
|
||||||
watermark_cols: 0,
|
|
||||||
watermark_x_space: ${watermarkXSpace},
|
|
||||||
watermark_y_space: ${watermarkYSpace},
|
|
||||||
watermark_font: '${watermarkFont}',
|
|
||||||
watermark_fontsize: '${watermarkFontsize}',
|
|
||||||
watermark_color:'${watermarkColor}',
|
|
||||||
watermark_alpha: ${watermarkAlpha},
|
|
||||||
watermark_width: ${watermarkWidth},
|
|
||||||
watermark_height: ${watermarkHeight},
|
|
||||||
watermark_angle: ${watermarkAngle},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -4,8 +4,10 @@
|
|||||||
<meta charset="utf-8"/>
|
<meta charset="utf-8"/>
|
||||||
<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1.0">
|
||||||
<title>普通文本预览</title>
|
<title>普通文本预览</title>
|
||||||
|
<#include "*/commonHeader.ftl">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<input hidden id="textData" value="${textData}"/>
|
<input hidden id="textData" value="${textData}"/>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
@@ -23,13 +25,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css"/>
|
|
||||||
|
|
||||||
<script src="js/jquery-3.0.0.min.js" type="text/javascript"></script>
|
|
||||||
<script src="js/jquery.form.min.js" type="text/javascript"></script>
|
|
||||||
<script src="bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
|
|
||||||
<script src="js/watermark.js" type="text/javascript"></script>
|
|
||||||
<script src="js/base64.min.js" type="text/javascript"></script>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
/**
|
/**
|
||||||
@@ -40,54 +35,18 @@
|
|||||||
loadText();
|
loadText();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 初始化水印
|
|
||||||
*/
|
|
||||||
function initWaterMark() {
|
|
||||||
let watermarkTxt = '${watermarkTxt}';
|
|
||||||
if (watermarkTxt !== '') {
|
|
||||||
watermark.init({
|
|
||||||
watermark_txt: '${watermarkTxt}',
|
|
||||||
watermark_x: 0,
|
|
||||||
watermark_y: 0,
|
|
||||||
watermark_rows: 0,
|
|
||||||
watermark_cols: 0,
|
|
||||||
watermark_x_space: ${watermarkXSpace},
|
|
||||||
watermark_y_space: ${watermarkYSpace},
|
|
||||||
watermark_font: '${watermarkFont}',
|
|
||||||
watermark_fontsize: '${watermarkFontsize}',
|
|
||||||
watermark_color: '${watermarkColor}',
|
|
||||||
watermark_alpha: ${watermarkAlpha},
|
|
||||||
watermark_width: ${watermarkWidth},
|
|
||||||
watermark_height: ${watermarkHeight},
|
|
||||||
watermark_angle: ${watermarkAngle},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*加载普通文本
|
*加载普通文本
|
||||||
*/
|
*/
|
||||||
function loadText() {
|
function loadText() {
|
||||||
var textData = Base64.decode($("#textData").val())
|
var base64data = $("#textData").val()
|
||||||
var textPreData = "<pre style='background-color: #FFFFFF;border:none'>" + textData + "</pre>";
|
var textData = Base64.decode(base64data);
|
||||||
|
var textPreData = "<xmp style='background-color: #FFFFFF;overflow-y: scroll;border:none'>" + textData + "</xmp>";
|
||||||
$("#text").html(textPreData);
|
$("#text").append(textPreData);
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<style>
|
|
||||||
* {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
html, body {
|
|
||||||
height: 100%;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -3,13 +3,24 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8"/>
|
<meta charset="utf-8"/>
|
||||||
<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1.0">
|
||||||
<title>普通文本预览</title>
|
<title>xml文本预览</title>
|
||||||
|
<#include "*/commonHeader.ftl">
|
||||||
|
<link rel="stylesheet" href="css/xmlTreeViewer.css"/>
|
||||||
|
<script src="js/xmlTreeViewer.js" type="text/javascript"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<input hidden id="textData" value="${textData}"/>
|
<input hidden id="textData" value="${textData}"/>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading">
|
<div id="xml_btn" class="panel-heading">
|
||||||
|
<h4 class="panel-title">
|
||||||
|
<a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">
|
||||||
|
${file.name}
|
||||||
|
</a>
|
||||||
|
</h4>
|
||||||
|
</div>
|
||||||
|
<div id="text_btn" class="panel-heading">
|
||||||
<h4 class="panel-title">
|
<h4 class="panel-title">
|
||||||
<a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">
|
<a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">
|
||||||
${file.name}
|
${file.name}
|
||||||
@@ -22,76 +33,41 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<link rel="stylesheet" href="css/xmlTreeViewer.css"/>
|
|
||||||
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css"/>
|
|
||||||
|
|
||||||
<script src="js/jquery-3.0.0.min.js" type="text/javascript"></script>
|
|
||||||
<script src="js/jquery.form.min.js" type="text/javascript"></script>
|
|
||||||
<script src="bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
|
|
||||||
<script src="js/watermark.js" type="text/javascript"></script>
|
|
||||||
<script src="js/marked.min.js" type="text/javascript"></script>
|
|
||||||
<script src="js/xmlTreeViewer.js" type="text/javascript"></script>
|
|
||||||
<script src="js/base64.min.js" type="text/javascript"></script>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
/**
|
/**
|
||||||
* 初始化
|
* 初始化
|
||||||
*/
|
*/
|
||||||
window.onload = function () {
|
window.onload = function () {
|
||||||
|
$("#xml_btn").hide()
|
||||||
initWaterMark();
|
initWaterMark();
|
||||||
loadXmlData()
|
loadXmlData()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 初始化水印
|
|
||||||
*/
|
|
||||||
function initWaterMark() {
|
|
||||||
let watermarkTxt = '${watermarkTxt}';
|
|
||||||
if (watermarkTxt !== '') {
|
|
||||||
watermark.init({
|
|
||||||
watermark_txt: '${watermarkTxt}',
|
|
||||||
watermark_x: 0,
|
|
||||||
watermark_y: 0,
|
|
||||||
watermark_rows: 0,
|
|
||||||
watermark_cols: 0,
|
|
||||||
watermark_x_space: ${watermarkXSpace},
|
|
||||||
watermark_y_space: ${watermarkYSpace},
|
|
||||||
watermark_font: '${watermarkFont}',
|
|
||||||
watermark_fontsize: '${watermarkFontsize}',
|
|
||||||
watermark_color: '${watermarkColor}',
|
|
||||||
watermark_alpha: ${watermarkAlpha},
|
|
||||||
watermark_width: ${watermarkWidth},
|
|
||||||
watermark_height: ${watermarkHeight},
|
|
||||||
watermark_angle: ${watermarkAngle},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 加载xml数据
|
* 加载xml数据
|
||||||
*/
|
*/
|
||||||
function loadXmlData() {
|
function loadXmlData() {
|
||||||
var textData = Base64.decode($("#textData").val())
|
var textData = Base64.decode($("#textData").val())
|
||||||
|
window.textPreData = "<xmp style='background-color: #FFFFFF;overflow-y: scroll;border:none'>" + textData + "</xmp>";
|
||||||
var xmlNode = xmlTreeViewer.parseXML(textData);
|
var xmlNode = xmlTreeViewer.parseXML(textData);
|
||||||
var retNode = xmlTreeViewer.getXMLViewerNode(xmlNode.xml);
|
window.retNode = xmlTreeViewer.getXMLViewerNode(xmlNode.xml);
|
||||||
$("#xml").html(retNode);
|
$("#xml").html(window.retNode);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$(function () {
|
||||||
|
$("#xml_btn").click(function () {
|
||||||
|
$("#xml").html(window.retNode);
|
||||||
|
$("#text_btn").show()
|
||||||
|
$("#xml_btn").hide()
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#text_btn").click(function () {
|
||||||
|
$("#xml_btn").show()
|
||||||
|
$("#text_btn").hide();
|
||||||
|
$("#xml").html(window.textPreData);
|
||||||
|
});
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
<style>
|
|
||||||
* {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
html, body {
|
|
||||||
height: 100%;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user