This repository has been archived by the owner on Jul 9, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
153 lines (139 loc) · 5.57 KB
/
index.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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style type="text/css">
.ex1 {
width: 600px;
background-color: #DDDDDD;
padding: 0px;
border: 2px solid black;
margin: 0px;
}
.ex2 {
width: 600px;
background-color: #AAAAAA;
padding: 0px;
border: 2px solid black;
margin: 0px;
}
.column {
float: left;
width: 100%;
font-family: 'Courier New', Courier, monospace;
}
/* Clear floats after the columns */
.row:after {
content: "";
display: table;
clear: both;
font-family: 'Courier New', Courier, monospace;
}
</style>
<title>Starter</title>
</head>
<body>
<h1>Hell0 world</h1>
<div class="row"><div class="column"></div>
<button id="createtile">Pin Secondary Tile</button>
<br><button id="update">Update</button>
<br><button id="unpin">Unpin</button>
<br><button id="checkpin">Check Pin</button>
<br><button id="CheckTheme">CheckTheme</button>
<br><button id="titleBarColor">Change Title Bar</button>
<br><button id="compactOverlay">Compact Overlay Toggle</button>
<br><button id="addTimeline">Timeline</button>
<br><button id="background">Change Background</button>
<br><br><div class="ex2">Console:</div>
<pre class="ex1" id="log" display="block" font-family="monospace" white-space="pre" margin="1em 0"></pre>
</div><br><br>
<script src="dist/pwa.js"></script>
<script>
/* =========================== /
/ In-App Console /
/ =========================== */
(function () {
var old = console.log;
var logger = document.getElementById('log');
console.log = function () {
for (var i = 0; i < arguments.length; i++) {
if (typeof arguments[i] == 'object') {
logger.innerHTML += (JSON && JSON.stringify ? JSON.stringify(arguments[i], undefined, 2) : arguments[i]) + '<br />';
} else {
logger.innerHTML += arguments[i] + '<br />';
}
}
}
})();
/* =========================== /
/ button controller /
/ =========================== */
let tileBtn = document.getElementById('createtile');
tileBtn.onclick = _ => pwa.createSecondaryTile('12345',
{
title: 'Title',
activationArguments: 'Args',
logoUri: 'ms-appx:///images/Square150x150Logo.png',
foregroundText: 'light',
backgroundColorWin: '', // accepts Windows.UI.Colors.[Color] Leave '' to use ARGB
backgroundColor: { // ARGB settings, all accept 0-255 decimal or 0x## hexadecimal
a: 255,
r: 255,
g: 222,
b: 111
}
});
let updateTileBtn = document.getElementById("update");
updateTileBtn.onclick = _ => pwa.updateSecondaryTile('12345',
{
displayName: 'Update', // accepts strings. Keep short to avoid truncation.
showNameOnSquare: 1, // accepts 0 or 1. 0 is to hide displayName, 1 is to show displayName foregroundText: (document.getElementById("updFTextInput") as any).value, // changes text color between 'dark' or 'light'
backgroundColorWin: '', // accepts Windows.UI.Colors.[Color] Leave '' to use ARGB
backgroundColor: { // ARGB settings, all accept 0-255 decimal or 0x## hexadecimal
a: 255,
r: 255,
g: 222,
b: 111
},
squareTinyUri: 'ms-appx:///images/Square150x150Logo.png', //Square30x30Logo squareSmallUri: (document.getElementById("updUri") as any).value, //Square70x70Logo
squareMedUri: 'ms-appx:///images/Square150x150Logo.png', //Square150x150Logo
squareWideUri: 'ms-appx:///images/Square150x150Logo.png', //Square310x150Logo
squareLargeUri: 'ms-appx:///images/Square150x150Logo.png', //Square310x310Logo
});
let checkPinBtn = document.getElementById("checkpin")
checkPinBtn.onclick = _ => {
var isPinned = Windows.UI.StartScreen.SecondaryTile.exists('12345');
console.log(isPinned);
};
let unpinBtn = document.getElementById("unpin")
unpinBtn.onclick = _ => pwa.removeSecondaryTile('12345');
let checkThemeBtn = document.getElementById("CheckTheme")
checkThemeBtn.onclick = _ => {
var theme = pwa.checkForDarkTheme();
console.log(theme);
};
let compactBtn = document.getElementById("compactOverlay")
compactBtn.onclick = _ => {
var forceCompactOverlay = false;
var Promise = pwa.toggleCompactOverlayMode(forceCompactOverlay);
};
let titleBtn = document.getElementById('titleBarColor');
titleBtn.onclick = _ => pwa.changeAppTitleBarColor({ // ARGB settings, all accept 0-255 decimal or 0x## hexadecimal
backgroundColor: {a: 255,r: 200,g: 200,b: 225},
foregroundColor: {a: 255,r: 125,g: 225,b: 250},
inactiveBackgroundColor: {a: 100,r: 205,g: 0,b: 0},
inactiveForegroundColor: {a: 100,r: 255,g: 30,b: 30}
});
let changebgBtn = document.getElementById("background")
changebgBtn.onclick = _ => pwa.changeDesktopBackgroundImage("images/Square150x150Logo.png");
let timelineBtn = document.getElementById("addTimeline")
timelineBtn.onclick = _ => pwa.addTimelineActivity({
id: 12345,
title: 'Timeline Title',
bodyText: 'Timeline Body',
imagePath: 'images/Square150x150Logo.png',
activationUri: 'https://www.microsoft.com/en-us/'
});
</script>
</body>
</html>