forked from purplecabbage/livetiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathliveTilesExample.html
121 lines (92 loc) · 4.09 KB
/
liveTilesExample.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<!DOCTYPE html>
<html>
<head>
<!-- meta name="viewport" content="width=device-width, height=device-height, user-scalable=yes, initial-scale=2.0, maximum-scale=4.0, minimum-scale=1.0" / -->
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no;" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/> <!-- ISO-8859-1 -->
<title>Live Tiles</title>
<style>
button {
width:300px;
height:36px;
margin:4px 0px;
}
</style>
<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
<script type="text/javascript" charset="utf-8">
var secondaryTile = 'www/liveTiles.html';
function updateAppTile() {
console.log('Update app tile');
var success = function (res) {
console.log('tile was updated');
document.getElementById('res').innerHTML = res;
};
var fail = function (e) {
console.log("Error occurred: " + e);
document.getElementById('res').innerHTML = "Error occurred: " + e;
};
LiveTiles.updateAppTile(success,fail,{title:document.getElementById('title').value, image:'Images/appbar.next.rest.png', count: document.getElementById('count').value, backTitle: 'Back title', backContent:'Back side', backImage : 'Images/appbar.close.rest.png'});
};
function createSecondaryTile() {
console.log('Create secondary tile');
var success = function (res) {
console.log('secondary tile was created');
document.getElementById('res').innerHTML = res;
};
var fail = function (e) {
console.log("Error occurred: " + e);
document.getElementById('res').innerHTML = "Error occurred: " + e;
};
LiveTiles.createSecondaryTile(success, fail, { title: document.getElementById('title').value, image: 'Images/appbar.save.rest.png', count: document.getElementById('count').value, secondaryTileUri: secondaryTile,backTitle:'back'});
};
function updateSecondaryTile() {
console.log('Update secondary tile');
var success = function (res) {
console.log('tile was updated');
document.getElementById('res').innerHTML = res;
};
var fail = function (e) {
console.log("Error occurred: " + e);
document.getElementById('res').innerHTML = "Error occurred: " + e;
};
LiveTiles.updateSecondaryTile(success, fail, { title: document.getElementById('title').value, count: document.getElementById('count').value, secondaryTileUri: secondaryTile });
};
function deleteSecondaryTile() {
console.log('Delete secondary tile');
var success = function (res) {
console.log('tile was deleted');
document.getElementById('res').innerHTML = res;
};
var fail = function (e) {
console.log("Error occurred: " + e);
document.getElementById('res').innerHTML = "Error occurred: " + e;
};
LiveTiles.deleteSecondaryTile(success, fail, { secondaryTileUri: secondaryTile });
};
</script>
</head>
<body>
<h1>Live Tile</h1>
<div id="info">
<div>
<strong>New title:</strong>
<div id="Span1"></div>
</div>
<input type="text" id="title" value="new title" style="width:250px;height:20px;"/>
<div>
<strong>New count:</strong>
<div id="Span2"></div>
</div>
<input type="text" id="count" value="10" style="width:250px;height:20px;"/>
<div>
<strong>Result:</strong>
<div id="res"></div>
</div>
</div>
<h2>Action</h2>
<button onclick="updateAppTile();">Update application tile</button>
<button onclick="createSecondaryTile();">Create secondary tile (will open this page)</button>
<button onclick="updateSecondaryTile();">Update secondary tile</button>
<button onclick="deleteSecondaryTile();">Delete secondary tile</button>
</body>
</html>