widget hello world

//config.xml
<widget id="2be1b89d-a25b-4c83-a7c6-e8d7df246eed" version="1.00.beta" height="450" width="320">
<name>Clock</name>
<description>Hello World, This is my first Widget.</description>
<author email="myname@host">myname</author>
<license href="http://www.apache.org/licenses/LICENSE-2.0.html">Apache v2</license>
<maximum_display_mode height="450" width="320"/>
<update href="http://www.jil.org/widgets/helloworld" period="2"/>
<icon src="Icon.png"/>
<content src="Clock.html"/>
<access network="true" localfs="true" remote_scripts="false"/>
<billing required="true"/>
<feature name="http://jil.org/jil/api/1.1/deviceInfo" required="false"/>
</widget>

 

//Clock.css

#front {
    position: absolute;
    top:80px;
    left: 20px;
    width: 290px;
    height: 320px;
}

 

//Clock.js

function showFront() {

}

function showBack() {

}

var NumSrc="images/c0.gif";
for(var i=0;i<=9;i++){
  eval("var c"+i+"=new Image();c"+i+".src=NumSrc.replace('c0.gif','c'+i+'.gif');");
}

document.write('<table border="0" cellspacing="0" bgcolor=black height=1><tr>');
document.write('<td><img src='+NumSrc+' id="lch1"></td>');
document.write('<td><img src='+NumSrc+' id="lch2"></td>');
document.write('<td><img src='+NumSrc.replace("c0.gif","colon.gif")+'></td>');
document.write('<td><img src='+NumSrc+' id="lcm1"></td>');
document.write('<td><img src='+NumSrc+' id="lcm2"></td>');
document.write('<td><img src='+NumSrc.replace("c0.gif","colon.gif")+'></td>');
document.write('<td><img src='+NumSrc+' id="lcs1"></td>');
document.write('<td><img src='+NumSrc+' id="lcs2"></td>');
document.write('<td><img src='+NumSrc.replace("c0.gif","cam.gif")+' id="lcapm"></td>');
document.write('</tr></table>');

function timerun(){

  now=new Date();
  myhour=now.getHours();
  myminute=now.getMinutes();
  mysecond=now.getSeconds();

  if(myhour<12) lcapm.src=NumSrc.replace("c0.gif","cam.gif");
  else lcapm.src=NumSrc.replace("c0.gif","cpm.gif");
  if(myhour>12) myhour-=12;

  lch1.src=eval("c"+Math.floor(myhour/10)+".src");
  lch2.src=eval("c"+myhour%10+".src");

  lcm1.src=eval("c"+Math.floor(myminute/10)+".src");
  lcm2.src=eval("c"+myminute%10+".src");

  lcs1.src=eval("c"+Math.floor(mysecond/10)+".src");
  lcs2.src=eval("c"+mysecond%10+".src");

  setTimeout("timerun()",500);
}

 

//Clock.html

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test</title>
<link href="Clock.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="Clock.js"></script>
</head>

<body>
<script>
timerun();
</script>
</body>

</html>

 

//+ Clock.png

 

打包,改后缀名为 .wgt

 

adb push /sdcard

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值