|
|
|
@ -4,37 +4,39 @@
|
|
|
|
|
<meta charset="utf-8"/> |
|
|
|
|
<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1.0"> |
|
|
|
|
<title>${file.name}普通文本预览</title> |
|
|
|
|
<#include "*/commonHeader.ftl"> |
|
|
|
|
<script src="js/jquery-3.6.1.min.js" type="text/javascript"></script> |
|
|
|
|
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css"/> |
|
|
|
|
<script src="bootstrap/js/bootstrap.min.js" type="text/javascript"></script> |
|
|
|
|
<#include "*/commonHeader.ftl"> |
|
|
|
|
<script src="js/base64.min.js" type="text/javascript"></script> |
|
|
|
|
</head> |
|
|
|
|
<body> |
|
|
|
|
<input hidden id="textData" value="${textData}"/> |
|
|
|
|
<#if "${file.suffix?html}" == "txt" || "${file.suffix?html}" == "log" || "${file.suffix?html}" == "TXT" || "${file.suffix?html}" == "LOG"> |
|
|
|
|
<style type="text/css"> |
|
|
|
|
DIV.black { |
|
|
|
|
DIV.black { |
|
|
|
|
line-height:25px; |
|
|
|
|
PADDING-RIGHT: 1px; PADDING-LEFT: 1px; FONT-SIZE: 100%; |
|
|
|
|
MARGIN: 1px; COLOR: #fff; |
|
|
|
|
MARGIN: 1px; COLOR: #fff; |
|
|
|
|
BACKGROUND-COLOR: #000; TEXT-ALIGN: left ; |
|
|
|
|
} |
|
|
|
|
DIV.black A { |
|
|
|
|
BORDER-RIGHT: #909090 1px solid; PADDING-RIGHT: 5px; |
|
|
|
|
} |
|
|
|
|
DIV.black A { |
|
|
|
|
BORDER-RIGHT: #909090 1px solid; PADDING-RIGHT: 5px; |
|
|
|
|
BACKGROUND-POSITION: 50% bottom; BORDER-TOP: #909090 1px solid; |
|
|
|
|
PADDING-LEFT: 5px; BACKGROUND-IMAGE: url(); PADDING-BOTTOM: 2px; |
|
|
|
|
BORDER-LEFT: #909090 1px solid; COLOR: #fff; MARGIN-RIGHT: 3px; |
|
|
|
|
PADDING-TOP: 2px; BORDER-BOTTOM: #909090 1px solid; TEXT-DECORATION: none |
|
|
|
|
} |
|
|
|
|
DIV.black A:hover { |
|
|
|
|
PADDING-TOP: 2px; BORDER-BOTTOM: #909090 1px solid; TEXT-DECORATION: none |
|
|
|
|
} |
|
|
|
|
DIV.black A:hover { |
|
|
|
|
BORDER-RIGHT: #f0f0f0 1px solid; BORDER-TOP: #f0f0f0 1px solid; |
|
|
|
|
BACKGROUND-IMAGE: BORDER-LEFT: #f0f0f0 1px solid; |
|
|
|
|
COLOR: #ffffff; BORDER-BOTTOM: #f0f0f0 1px solid; BACKGROUND-COLOR: #404040 |
|
|
|
|
} |
|
|
|
|
DIV.black A:active { |
|
|
|
|
BORDER-RIGHT: #f0f0f0 1px solid; BORDER-TOP: #f0f0f0 1px solid; |
|
|
|
|
BACKGROUND-IMAGE: BORDER-LEFT: #f0f0f0 1px solid; |
|
|
|
|
COLOR: #ffffff; BORDER-BOTTOM: #f0f0f0 1px solid; BACKGROUND-COLOR: #404040 |
|
|
|
|
} |
|
|
|
|
COLOR: #ffffff; BORDER-BOTTOM: #f0f0f0 1px solid; BACKGROUND-COLOR: #404040 |
|
|
|
|
} |
|
|
|
|
DIV.black A:active { |
|
|
|
|
BORDER-RIGHT: #f0f0f0 1px solid; BORDER-TOP: #f0f0f0 1px solid; |
|
|
|
|
BACKGROUND-IMAGE: BORDER-LEFT: #f0f0f0 1px solid; |
|
|
|
|
COLOR: #ffffff; BORDER-BOTTOM: #f0f0f0 1px solid; BACKGROUND-COLOR: #404040 |
|
|
|
|
} |
|
|
|
|
.divContent |
|
|
|
|
{ |
|
|
|
|
color:#fff; |
|
|
|
@ -51,7 +53,7 @@ line-height:30px;
|
|
|
|
|
background-color: #000; |
|
|
|
|
} |
|
|
|
|
</style> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="container"> |
|
|
|
|
<div class="panel panel-default"> |
|
|
|
@ -64,7 +66,7 @@ line-height:30px;
|
|
|
|
|
</div> |
|
|
|
|
<div class="panel-body"> |
|
|
|
|
<div id="divPagenation" class="black" > |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
|
<div id="divContent" class="panel-body"> |
|
|
|
|
</div> |
|
|
|
@ -72,7 +74,7 @@ line-height:30px;
|
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript"> |
|
|
|
|
var base64data = $("#textData").val() |
|
|
|
|
var s = Base64.decode(base64data); |
|
|
|
@ -87,7 +89,7 @@ line-height:30px;
|
|
|
|
|
//将img标签替换为❈
|
|
|
|
|
imgContent = s.replace(imgReg,"❈"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 封装DHTMLpagenation
|
|
|
|
|
function DHTMLpagenation(content) |
|
|
|
|
{ |
|
|
|
@ -146,7 +148,7 @@ line-height:30px;
|
|
|
|
|
{ |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
//创建每页显示内容的消息的DIV
|
|
|
|
|
//创建每页显示内容的消息的DIV
|
|
|
|
|
divDisplayContent=document.createElement("DIV"); |
|
|
|
|
divDisplayContent.id="divContent"; |
|
|
|
|
document.body.appendChild(divDisplayContent); |
|
|
|
@ -164,11 +166,11 @@ line-height:30px;
|
|
|
|
|
|
|
|
|
|
//初始化分页;
|
|
|
|
|
//包括把加入CSS,检查是否需要分页
|
|
|
|
|
DHTMLpagenation.initialize=function() |
|
|
|
|
{ |
|
|
|
|
DHTMLpagenation.initialize=function() |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
divDisplayContent.className= contentStyle != null ? contentStyle : "divContent"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(contentLength<=perpageLength) |
|
|
|
|
{ |
|
|
|
|
strDisplayContent=content; |
|
|
|
@ -179,14 +181,14 @@ line-height:30px;
|
|
|
|
|
pageSizeCount=Math.ceil((contentLength/perpageLength)); |
|
|
|
|
|
|
|
|
|
DHTMLpagenation.goto(currentPage); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DHTMLpagenation.displayContent(); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
//显示分页栏
|
|
|
|
|
DHTMLpagenation.displayPage=function() |
|
|
|
|
DHTMLpagenation.displayPage=function() |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
strDisplayPagenation=""; |
|
|
|
|
|
|
|
|
|
if(currentPage && currentPage !=1) |
|
|
|
@ -197,7 +199,7 @@ line-height:30px;
|
|
|
|
|
{ |
|
|
|
|
strDisplayPagenation+="上一页 "; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for(var i=1;i<=pageSizeCount;i++) |
|
|
|
|
{ |
|
|
|
|
if(i!=currentPage) |
|
|
|
@ -218,27 +220,27 @@ line-height:30px;
|
|
|
|
|
{ |
|
|
|
|
strDisplayPagenation+="下一页 "; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
strDisplayPagenation+="共 " + pageSizeCount + " 页。<br>每页" + perpageLength + " 字符,调整字符数:<input type='text' value='"+perpageLength+"' id='ctlPerpageLength' /><input type='button' value='确定' onclick='DHTMLpagenation.change()' />"; |
|
|
|
|
|
|
|
|
|
divDisplayPagenation.innerHTML=strDisplayPagenation; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//上一页
|
|
|
|
|
DHTMLpagenation.previous=function() |
|
|
|
|
{ |
|
|
|
|
DHTMLpagenation.goto(currentPage-1); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//下一页
|
|
|
|
|
DHTMLpagenation.next=function() |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DHTMLpagenation.goto(currentPage+1); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//跳转至某一页
|
|
|
|
|
DHTMLpagenation.goto=function(iCurrentPage) |
|
|
|
|
{ |
|
|
|
@ -246,35 +248,35 @@ line-height:30px;
|
|
|
|
|
if(regularExp.test(iCurrentPage)) |
|
|
|
|
{ |
|
|
|
|
currentPage=iCurrentPage; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var tempContent = ""; |
|
|
|
|
|
|
|
|
|
//获取当前的内容 里面包含 ❈
|
|
|
|
|
|
|
|
|
|
//获取当前的内容 里面包含 ❈
|
|
|
|
|
var currentContent = imgContent.substr((currentPage-1)*perpageLength,perpageLength); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tempContent = currentContent; |
|
|
|
|
|
|
|
|
|
//当前页是否有 ❈ 获取最后一个 ❈ 的位置
|
|
|
|
|
|
|
|
|
|
//当前页是否有 ❈ 获取最后一个 ❈ 的位置
|
|
|
|
|
var indexOf = currentContent.indexOf("❈"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(indexOf >= 0) |
|
|
|
|
{ |
|
|
|
|
//获取从开始位置到当前页位置的内容
|
|
|
|
|
var beginToEndContent = imgContent.substr(0,currentPage*perpageLength); |
|
|
|
|
|
|
|
|
|
//获取开始到当前页位置的内容 中的 * 的最后的下标
|
|
|
|
|
|
|
|
|
|
//获取开始到当前页位置的内容 中的 * 的最后的下标
|
|
|
|
|
var reCount = beginToEndContent.split("❈").length - 1; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var contentArray = currentContent.split("❈"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tempContent = replaceStr(contentArray,reCount,matchContent); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// tempContent=imgContent.substr((currentPage-1)*perpageLength,perpageLength);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
strDisplayContent=tempContent; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
@ -289,11 +291,11 @@ line-height:30px;
|
|
|
|
|
{ |
|
|
|
|
divDisplayContent.innerHTML=strDisplayContent; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//改变每页的字节数
|
|
|
|
|
DHTMLpagenation.change=function() |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var iPerpageLength = document.getElementById("ctlPerpageLength").value; |
|
|
|
|
if(regularExp.test(iPerpageLength)) |
|
|
|
|
{ |
|
|
|
@ -301,7 +303,7 @@ line-height:30px;
|
|
|
|
|
// DHTMLpagenation.perpageLength=iPerpageLength;
|
|
|
|
|
// DHTMLpagenation.currentPage=1;
|
|
|
|
|
// DHTMLpagenation.initialize();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DHTMLpagenation(s,iPerpageLength); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
@ -309,41 +311,41 @@ line-height:30px;
|
|
|
|
|
alert("请输入数字"); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* currentArray:当前页以 * 分割后的数组 |
|
|
|
|
replaceCount:从开始内容到当前页的内容 * 的个数 |
|
|
|
|
matchArray : img标签的匹配的内容 |
|
|
|
|
*/ |
|
|
|
|
function replaceStr(currentArray,replaceCount,matchArray) |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var result = ""; |
|
|
|
|
for(var i=currentArray.length -1,j = replaceCount-1 ;i>=1; i--) |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
var temp = (matchArray[j] + currentArray[i]); |
|
|
|
|
|
|
|
|
|
result = temp + result; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
j--; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result = currentArray[0] + result ; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DHTMLpagenation(s,20000); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 初始化 |
|
|
|
|
*/ |
|
|
|
|
window.onload = function () { |
|
|
|
|
initWaterMark(); |
|
|
|
|
} |
|
|
|
|
</script> |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<#else/> |
|
|
|
|