-
Notifications
You must be signed in to change notification settings - Fork 1
/
js_test.html
56 lines (53 loc) · 1.79 KB
/
js_test.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
<!DOCTYPE html>
<html>
<head>
<title>JS API Test</title>
<meta name='viewport' content='initial-scale=1, viewport-fit=cover'>
<script type="text/javascript">
function changeHref() {
var url = "yellowskin://?background_color=%23ff2400&buttons_color=%23ffffff&omnibox_color=%23ff4f00&status_bar_theme=dark&text_color=%23ffffff&url=" + escape(document.URL);
document.getElementById("samePageYS").href = url;
}
window.onload = changeHref;
</script>
</head>
<body>
<script type="text/javascript">
function onAuthDialogFinished(success) {
document.getElementById("authState").innerText = success ? "authorized" : "not authorized";
}
function openAuthDialog(style, source) {
document.getElementById("authState").innerText = "none";
window.YandexApplicationsAPIBackend.on('EVENT_AUTH_FINISHED', 'onAuthDialogFinished');
window.YandexApplicationsAPIBackend.openAuthDialog(style, source);
}
function addOverrideHostEntries() {
window.yandex.publicFeature.addOverrideHostEntries([
{
keyUrl: document.URL,
displayUrl: 'https://yaturbo.ru/123',
displayHost: 'lenta.ru'
}
]);
}
</script>
<a href = "#" id="samePageYS">Open this page as YellowSkin</a>
<br>
<br>
AuthDialog API:
<br>
<button type="button" onclick="openAuthDialog('dark')">openAuthDialog('dark')</button>
<br>
<button type="button" onclick="openAuthDialog('light')">openAuthDialog('light')</button>
<br>
<button type="button" onclick="openAuthDialog('light', 'customSource')">openAuthDialog('dark','customSource')</button>
<br>
auth state:
<span id="authState">none</span>
<br>
<br>
Overrides API:
<br>
<button type="button" onclick="addOverrideHostEntries()">addOverrideHostEntries</button>
</body>
</html>