Skip to content

Commit c149baa

Browse files
DianeDiane
authored andcommitted
added index.html file
1 parent 524e29b commit c149baa

3 files changed

Lines changed: 80 additions & 2 deletions

File tree

assets/index.html

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"/>
6+
7+
<!-- <link rel="stylesheet" type="text/css" href="css/timelines.css"/> -->
8+
9+
<script type="text/javascript" src="zepto.min.js"></script>
10+
11+
</head>
12+
<body>
13+
14+
<form>
15+
<div class="instruction">Choose a key</div><br/>
16+
<input type="text" id="key" value="myKey"><br/>
17+
18+
<div class="instruction">Set an item</div><br/>
19+
<input type="text" id="value" value="myValue"><br/>
20+
<a href="javascript:;" id="setItem" class="button">setItem</a><br/>
21+
22+
<div class="instruction">Get this item</div><br/>
23+
<a href="javascript:;" id="getItem" class="button">getItem</a><br/>
24+
</form>
25+
26+
<div class="result">Value is : <span id="result"> </span><div>
27+
28+
<div class="instruction">Remove this item</div><br/>
29+
<a href="javascript:;" id="removeItem" class="button">removeItem</a><br/>
30+
<div class="instruction">Clear all items</div><br/>
31+
<a href="javascript:;" id="clearAll" class="button">clear</a><br/>
32+
33+
34+
35+
36+
<script>
37+
38+
Zepto(function($){
39+
try{
40+
//we replace default localStorage with our Android Database one
41+
window.localStorage=LocalStorage;
42+
}catch(e){
43+
//LocalStorage class was not found. be sure to add it to the webview
44+
alert("LocalStorage ERROR : can't find android class LocalStorage. switching to raw localStorage")
45+
}
46+
47+
$('#getItem').on('tap click',function(){
48+
49+
var item = localStorage.getItem($('#key').val());
50+
$('#result').html(item);
51+
return false;
52+
});
53+
54+
$('#setItem').on('tap click',function(){
55+
alert("ok");
56+
localStorage.setItem($('#key').val(),$('#value').val());
57+
alert("ok");
58+
return false;
59+
});
60+
61+
$('#removeItem').on('tap click',function(){
62+
localStorage.removeItem($('#key').val(),$('#value').val());
63+
return false;
64+
});
65+
66+
$('#clearAll').on('tap click',function(){
67+
localStorage.clear();
68+
return false;
69+
});
70+
71+
});
72+
73+
</script>
74+
75+
</body>
76+
</html>

0 commit comments

Comments
 (0)