超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!超级UP!!
<html>
<head>
<title> emu's text reader</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="emu">
<META NAME="Keywords" CONTENT="javascript">
<META NAME="Description" CONTENT="emu's reader for text and hyper text file">
<SCRIPT LANGUAGE="JavaScript">
<!--
var st="";
var win,t;
var fileName="";
var errTimes=0;
var timer,interval=4;
var intervals=[640,320,160,80,40,20,10,5,3];
var fontsize=6;
var scrollingDirection = 0;
var lastRightClick = 0;
var viewWidth = 95;
var statusTimer = setInterval("showStatus()",500);
function read(fName){
fileName = fName;
errTimes=0;
if (/\.txt$|\.html?$/i.test(fileName)){
status = "opening...";
win = window.open(fileName,"tmp","left=2000,top=2000");
t = setInterval("try{st =win.document.body.innerHTML;clearInterval(t);showFile();}catch(e){status = 'error';if (errTimes++>10){clearInterval(t);win.close();alert('此文件无法用本程序阅读');}};",100);
}else {
alert("无法打开此类型的文件");
}
}
function showFile(){
if (/\.txt$/i.test(fileName)){
st = st.substring(5,st.length-6).replace(/ /g," ").replace(/\r\n/g,"\n").replace(/\r/g,"\n")
while (/ \n/.test(st)) st = st.replace(/ \n/g,"\n");
st = st.replace(/\n/g,"<br>").replace(/\s/g," ").replace(/ /g," ")
}
output.innerHTML= st;
fileElm.style.display="none";
win.close();
document.title = fileName;
document.body.scrollTop=0;
}
function showStatus(){
status = fileName.substr(fileName.lastIndexOf("\\")+1)+" 当前位置:"+parseInt(getReadingPosition()*1000+.5)/10+"% 滚屏速度:"+((scrollingDirection>0)?interval-(-1):(scrollingDirection<0)?(-1-interval):"停止")+ " 字体:"+fontsize+ " 显示宽度:"+viewWidth+"% 双击滚屏 点击右键显示菜单";
if (document.body.scrollTop>output.scrollHeight) location.reload();
}
function startscroll(i,dir){
if (i>=0 && i<=9) interval=i;
if (!dir) dir=1;
scrollingDirection = dir;
if (scrollingDirection>0) {
timer = setInterval("if (document.body.scrollTop++ >= output.scrollHeight-document.body.clientHeight) undoScroll()",intervals[interval]);
}else{
timer = setInterval("if (document.body.scrollTop-- <= 0) undoScroll()",intervals[interval]);
}
}
function undoScroll(){
clearInterval(timer);
scrollingDirection=0;
}function showMenu(){
if (new Date()-lastRightClick<500){
startscroll(interval,-1)
hideMenu();
}else{
var body = document.body;
with (myMenu){
style.top = event.y+body.scrollTop-((event.y+offsetHeight>body.offsetHeight)?offsetHeight:0);
style.left = event.x+body.scrollLeft-((event.x+offsetWidth>body.offsetWidth)?offsetWidth:0);
style.visibility="";
}
}
status = "";
lastRightClick = new Date();
}
function hideMenu(){
myMenu.style.visibility="hidden";
}
function changeFontSize(fs){
if (fs>=1 && fs<= 9) fontsize = fs;
var pos = getReadingPosition();
output.style.fontSize=fontsize-(-12);
setReadingPosition(pos);
}
function setViewWidth(n){
if (n>69 && n<101) viewWidth = n;
var pos = getReadingPosition();
output.parentElement.parentElement.parentElement.width=viewWidth+"%"
setReadingPosition(pos);
}
function getReadingPosition(){
var pos = document.body.scrollTop/(output.scrollHeight-document.body.clientHeight);
if (pos>1) pos = 1;
return pos;
}
function setReadingPosition(pos){
document.body.scrollTop=(output.scrollHeight-document.body.clientHeight)*pos;
}
function saveData(){
if (fileName && fileName.length>0) setCookie("fileName",fileName);
if (fontsize)setCookie("fontSize",fontsize);
setCookie("readingPosition",getReadingPosition());
setCookie("viewWidth",viewWidth);
}
function loadData(){
fileName = getCookie("fileName");
if (!fileName) return;
read(fileName);
fontsize = getCookie("fontSize");
if (!fontsize||isNaN(fontsize)) fontsize=6;
changeFontSize();
var pos = getCookie("readingPosition");
if(!pos||isNaN(pos)||pos<0) pos=0;
if (pos>1) pos=1;
setTimeout("setReadingPosition("+pos+")",100);
viewWidth = getCookie("viewWidth");;
if (!viewWidth||isNaN(viewWidth)) viewWidth=97;
setViewWidth();}
function String.prototype.reverse(){
return this.split("").reverse().join("");
}
function setCookie(name,value,Days){
if (!Days) Days = 30;
var exp = new Date();
exp.setTime(exp.getTime() + Days*24*60*60*1000);
document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
}
function getCookie(name){
var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
if(arr=document.cookie.match(reg)) return unescape(arr[2]);
else return null;
}
function delCookie(name){
var exp = new Date();
exp.setTime(exp.getTime() - 1);
var cval=getCookie(name);
if(cval!=null) document.cookie= name + "="+cval+";expires="+exp.toGMTString();
}
//-->
</SCRIPT>
</head><body oncontextmenu="showMenu();return false" onclick="hideMenu()" ondblclick="startscroll()" onmouseup="undoScroll()" onbeforeunload="saveData()" onload="loadData()">
<input type=file onchange="read(value)" id=fileElm oncontextmenu="event.cancelBubble=true">
<table id="myMenu" style="position:absolute;font-size:12;z-index=1;visibility:hidden;" bgcolor=red>
<tbody bgcolor=#FFCCCC align=center>
<tr>
<td onclick="fileElm.click()" style="cursor:hand">打 开 文 档</td>
</tr>
<tr>
<td>
<nobr>
<span style="cursor:hand" onclick="changeFontSize(fontsize-1);">-</span>
<span onmouseover="firstChild.style.display='none';lastChild.style.display='';lastChild.value=fontsize;" onmouseout="firstChild.style.display='';lastChild.style.display='none';"><span>字 体</span><select style="display:none;margin-top:-3;margin-bottom:-3;font-size:12;background-color:#FFCCCC;width:30" onchange="document.body.focus();changeFontSize(value);">
<SCRIPT>for (var i=1;i<10;i++) document.write("<option value="+i+">"+i)</SCRIPT>
</select></span>
<span style="cursor:hand" onclick="changeFontSize(++fontsize);">+</span>
</nobr>
</td>
</tr>
<tr><td onclick="startscroll()" style="cursor:hand">自 动 滚 动</td></tr>
<tr>
<td>
<nobr>
<span style="cursor:hand" onclick="startscroll(interval-1)">-</span>
<span onmouseover="firstChild.style.display='none';lastChild.style.display='';lastChild.value=interval" onmouseout="firstChild.style.display='';lastChild.style.display='none';"><span>速 度</span><select style="display:none;margin-top:-3;margin-bottom:-3;font-size:12;background-color:#FFCCCC;width:30" onchange="document.body.focus();startscroll(value);">
<SCRIPT>for (var i=0;i<intervals.length;i++) document.write("<option value="+i+">"+(i+1));</SCRIPT>
</select></span>
<span style="cursor:hand" onclick="startscroll(++interval)">+</span>
</nobr>
</td>
</tr>
<tr>
<td>
<nobr>
<span style="cursor:hand" onclick="setViewWidth(viewWidth-1)">-</span><span onmouseover="firstChild.style.display='none';lastChild.style.display='';lastChild.value=viewWidth" onmouseout="firstChild.style.display='';lastChild.style.display='none';"><span>显示宽度</span><select style="display:none;margin-top:-3;margin-bottom:-3;font-size:12;background-color:#FFCCCC;width:48" onchange="document.body.focus();setViewWidth(value);">
<SCRIPT>for (var i=100;i>69;i--) document.write("<option value="+i+">"+i);</SCRIPT>
</select></span><span style="cursor:hand" onclick="setViewWidth(++viewWidth)">+</span>
</nobr>
</td>
</tr>
<tbody>
</table>
<!-- <div id=output></div> -->
<table align=center width=95%><tr><td id=output style="word-break:break-all"></td></tr></table>
</body>
</html>