|
现在要做一个简单的应用真的太简单了,好多在线生成的框架。最近在用的是Rexsee的模板,反应挺快,翻页的效果不错,目录和索引也只是需要一些简单的html代码修改就可以实现了。相对于其他的框架,可以支持在线修改代码。
做了一个电子书,上传一个txt然后在线编译就可以生成apk了。。具体的应用不放出来了,毕竟只是简单测试,截了张图,下面是首页的html代码。可以去网站上自己体验,在线编译的:http://apk.rexsee.com/
<HTML>
<HEAD>
<META http-equiv=Content-Type content=text/html charset=GB2312>
<META http-equiv=Expires content=0>
<META http-equiv=Cache-Control content=no-cache>
<META http-equiv=Pragma content=no-cache>
<SCRIPT type=text/javascript src="config.js"></SCRIPT>
<SCRIPT type=text/javascript src="list.js"></SCRIPT>
<SCRIPT type=text/javascript>
var id="book";
function onFliped(id, index, total){
}
function onFlipFirstPage(id){
}
function onFlipLastPage(id){
}
var jsUrl = "http://www.rexsee.com/ebook/ajax/init.js.php";
window.onRexseeReady = function(){
rexseeScreen.setScreenAlwaysOn(true);
rexseeSpecialKey.setBackKeyListener('javascript:back();');
rexseeLayoutStyle.setStyle("background-color:#FAF7E4;");
rexseeBrowserStyle.setStyle("background-color:#FAF7E4;");
setTabBars();
rexseeMenu.create("mainOptionsMenu","label:mainOptionsMenu");
rexseeMenu.addItem("mainOptionsMenu","rexsee:about","label:关于;");
rexseeMenu.addItem("mainOptionsMenu","rexsee:quit","label:退出;");
rexseeMenu.setOptionsMenuId("mainOptionsMenu");
var packageName = rexseeApplication.getName();
rexseeAjax.submitWithCallback(jsUrl,"package="+packageName+"&version="+versionCode,"GB2312");
}
function back(){
if ( rexseeJavaBar.size()>0){
cancel();
} else {
rexseeApplication.confirmExit();
}
}
window.onAjaxReturned = function(ajaxUrl,response){
response = unescape(response);
eval(response);
}
function showIndexes(){
var indexes = eval("("+rexseeJavaView.search(id,'')+")");
if ( indexes.length==0 ) { alert("对不起,本电子书没有目录。"); return; }
var html = "";
for ( var i=0; i<indexes.length; i++ ){
html += "<tr height=36px><td><a href='rexsee:' onclick=\"rexseeParent.load('javascript:goto("+indexes.page+");');rexseeBrowser.dismiss();\">"+indexes.title+"</a></td><td align=right nowrap style='padding-left:20px;font-weight:bold;'>"+indexes.page+"</td><td></tr>";
}
html = "<tr><td style='font-size:24px;font-weight:bold;padding:20 0 20 0;'>目录</td><td align=right><a href='rexsee:' onclick='rexseeBrowser.dismiss();'>返回</a></td></tr>"+html;
html = html+"<tr><td></td><td align=right style='padding:20 0 20 0;'><a href='rexsee:' onclick='rexseeBrowser.dismiss();'>返回</a></td></tr>";
html = "<html><head><title>:</title><style>a:link { color: #222222; } a:visited { color:#222222; }</style></head><body style=\"margin:20px;background:url('file:///android_asset/pageBg.jpg');\"><table style='font-size:18px;' width=100%>"+html+"</table></body></html>";
rexseePopupWindow.show('tableOfContents',html,'','');
}
function showPages(){
var total = eval('('+rexseeJavaView.getValue(id)+')').total;
if ( total <= 0 ) { alert("对不起,电子书尚未载入完毕,请稍后再试。"); return; }
var html = "";
for ( var i=1; i<=total; i++ ){
html += "<tr height=36px><td><a href='rexsee:' onclick=\"rexseeParent.load('javascript:goto("+i+");');rexseeBrowser.dismiss();\">第"+i+"页</a></td><td></td></tr>";
}
html = "<tr><td style='font-size:24px;font-weight:bold;padding:20 0 20 0;'>目录</td><td align=right><a href='rexsee:' onclick='rexseeBrowser.dismiss();'>返回</a></td></tr>"+html;
html = html+"<tr><td></td><td align=right style='padding:20 0 20 0;'><a href='rexsee:' onclick='rexseeBrowser.dismiss();'>返回</a></td></tr>";
html = "<html><head><title>:</title><style>a:link { color: #222222; } a:visited { color:#222222; }</style></head><body style=\"margin:20px;background:url('file:///android_asset/pageBg.jpg');\"><table style='font-size:18px;' width=100%>"+html+"</table></body></html>";
rexseePopupWindow.show('tableOfContents',html,'','');
}
function goto(index){
rexseeJavaView.setValue(id,index-1);
}
function gofirst(){
rexseeJavaView.scrollHome(id);
}
function golast(){
rexseeJavaView.scrollEnd(id);
}
var query = "";
function search(){
query = window.prompt("prompt","title=请输入要搜索的关键字;defaultValue="+query+";cancel=true;");
if ( query==null||query=="") return;
var result = eval('('+rexseeJavaView.search(id,query)+')');
var html = "";
if ( result.length == 0 ){
html += "<tr height=36px><td>没有找到搜索内容。</td><td></td></tr>";
} else {
for ( var i=0; i<result.length; i++ ){
var title = (result.inheriteTitle=="") ? "第"+result.page+"页" : result.inheriteTitle;
html += "<tr height=36px><td><a href='rexsee:' onclick=\"rexseeParent.load('javascript:goto("+result.page+");');rexseeBrowser.dismiss();\">"+title+"</a></td><td align=right nowrap style='padding-left:20px;font-weight:bold;'>"+result.page+"</td></tr>";
}
}
html = "<tr><td style='font-size:24px;font-weight:bold;padding:20 0 20 0;'>“"+query+"”的搜索结果</td><td align=right><a href='rexsee:' onclick='rexseeBrowser.dismiss();'>返回</a></td></tr>"+html;
html = html+"<tr><td></td><td align=right style='padding:20 0 20 0;'><a href='rexsee:' onclick='rexseeBrowser.dismiss();'>返回</a></td></tr>";
html = "<html><head><title>:</title><style>a:link { color: #222222; } a:visited { color:#222222; }</style></head><body style=\"margin:20px;background:url('file:///android_asset/pageBg.jpg');\"><table style='font-size:18px;' width=100%>"+html+"</table></body></html>";
rexseePopupWindow.show('search',html,'','');
}
function setTabBars(){
var h = Math.round(document.body.clientWidth/3.4);
rexseeMenu.create("title", "bar-position:top;height:"+h+";width:fillparent;background-color:file:///android_asset/banner.jpg;border-width:0;");
rexseeTabBars.create("title");
}
function cancel(){
rexseeJavaView.destroyAll();
rexseeJavaBar.removeAll();
rexseePopupWindow.dismissAll();
rexseeTabBars.remove();
setTabBars();
rexseeBrowserStyle.setStyle("visibility:visible;");
}
function start(file){
var assetPath = "file:///android_asset/data/"+file;
if ( !rexseeAsset.exists(assetPath) ){ alert("没有找到要浏览的文件!"); return; }
var data = rexseeAsset.getContent(assetPath,"GBK");
rexseeBrowserStyle.setStyle("visibility:hidden;");
rexseeTabBars.remove();
var normalStyle = "background-color:#910000;border-color:#910000;margin:3px;margin-background:#910000;width:fillparent;height:fillparent;weight:1;white-space:normal;border-width:1;padding:2 10 3 10;font-size:14;color:#FFFFFF;icon-visibility:visible;icon-width:32px;icon-height:2px; icon-url:#910000+#aaaaaa+#FFFFFF+#aaaaaa+#910000/2;";
var pressedStyle = "background-color:#444444;border-color:#222222 #DDDDDD #DDDDDD #222222;";
var selectedStyle = "";
rexseeMenu.create("bookbar", "bar-position:bottom;height:60;width:fillparent;background-color:#910000;border-width:0;border-top-width:8;border-top-color:#333333+#910000/0;padding:0 3 5 3;");
rexseeMenu.addItem("bookbar","javascript:showIndexes();","label:目录;"+normalStyle,pressedStyle,selectedStyle);
rexseeMenu.addItem("bookbar","javascript:gofirst();","label:首页;"+normalStyle,pressedStyle,selectedStyle);
rexseeMenu.addItem("bookbar","javascript:golast();","label:末页;"+normalStyle,pressedStyle,selectedStyle);
rexseeMenu.addItem("bookbar","javascript:showPages();","label:页码;"+normalStyle,pressedStyle,selectedStyle);
rexseeMenu.addItem("bookbar","javascript:search();","label:搜索;"+normalStyle,pressedStyle,selectedStyle);
rexseeTabBars.create("bookbar");
rexseeJavaView.destroyAll();
rexseeJavaBar.removeAll();
var bg = "file:///android_asset/pageBg.jpg";
var style = "background-color:"+bg+";label-background-color:"+bg+";color:#000000;";
rexseeJavaView.create(id,'PageView',style);
rexseeJavaBar.add(id,'bar-position:middle;');
rexseeJavaView.setChilds(id,data);
}
</SCRIPT>
<STYLE>
body { margin:0px; background-color:#FAF7E4;}
.section {background-color:#FAF7E4; color:#BB0000; border:1px solid;border-color:#7f9db5;padding:15px;}
.sectionItem {background-color:#F3ECCB; color:#910000; padding:5px; border:1px solid #7f9db5;margin:5px; }
.sectionItem:hover { background-color:#F1E9BA; }
.sectionTitle { font-weight:bold; }
.sectionSubTitle { font-size:12px;padding:5 10 5 20; }
.sectionAuthor { font-size:12px;padding:5 10 5 20; }
#copyright {background-color:#444444;padding:5px;color:white;font-size:10px;}
#mainDiv { }
</STYLE>
<HEAD>
<BODY>
<table cellspacing=0 cellpadding=0 width=100% height=100%>
<tr><td valign=top>
<DIV id=mainDiv>
<SCRIPT type=text/javascript>
var detail = eval("("+json+")");
for ( var i=0; i<detail.length; i++ ) {
document.write("<div class=sectionItem onclick=\"start('"+detail.file+"');\"><div class=sectionTitle>"+detail.title+"</div><div class=sectionSubTitle>"+detail.subtitle+"</div><div class=sectionAuthor>"+detail.author+"</div></div>");
}
</SCRIPT>
</DIV>
</td></tr><tr><td valign=bottom>
</td></tr></table>
</BODY>
</HTML> |
|