-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex-backup.html
More file actions
159 lines (144 loc) · 5.07 KB
/
index-backup.html
File metadata and controls
159 lines (144 loc) · 5.07 KB
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
154
155
156
157
158
159
<!DOCTYPE html>
<html lang="ko-KR">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="manifest" href="manifest.json" />
<script src="https://cdn.flarelane.com/WebSDK-staging.js"></script>
<script>
FlareLane.setIsSubscribedChangeHandler((s) => {
console.log(s);
});
FlareLane.initialize({ projectId: '3e640bca-39af-46c3-857e-0e8e1cfa2554' });
// FlareLane.initialize({ projectId: '081bea61-7901-447f-959d-6741c8833c2e' });
</script>
<!-- <script src="https://cdn.onesignal.com/sdks/OneSignalSDK.js" async=""></script>
<script>
window.OneSignal = window.OneSignal || [];
OneSignal.push(function () {
OneSignal.init({
appId: '3e056ceb-bf3c-4ca1-b0a6-f12b2b8319bc',
});
});
</script> -->
<style>
.disabled {
background-color: #222;
}
.wrap {
position: fixed;
width: 1vw;
height: 1vh;
z-index: 99999;
}
</style>
<!-- <link rel="manifest" href="https://junyeongchoi.github.io/manifest.json" /> -->
</head>
<body>
<h1>Hello, Web Push</h1>
<button type="button" onclick="sendFlareLaneDemoNotification(this)">Send Demo Notification</button>
<div id="logs"></div>
<script>
function sendFlareLaneDemoNotification(e) {
const i = () => {
(e.disabled = !1), e.classList.remove('disabled');
},
t = {
API_URL: 'https://staging-service-api.flarelane.com/send-demo-notification',
DRAFT_STORE_ID: 'flarelane_dndly',
delayTime: 3e3,
isIOS: /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream,
fetch: { method: 'POST', headers: { 'Content-Type': 'application/json' } },
class: { disabled: 'disabled' },
},
a = 'iOS 웹 푸시는 지원 예정입니다. 안드로이드 폰이나 PC 환경에서 다시 시도해보세요.',
d = '잠시 후 구독 팝업이 노출됩니다. 조금만 기다려주세요!',
n = '왼쪽 아래 종 모양 버튼을 클릭하여 알림 구독을 먼저 진행하세요.';
try {
if (t.isIOS) return void alert(a);
if (!FlareLane.initialized) return void alert(d);
(e.disabled = !0),
e.classList.add('disabled'),
FlareLane.getIsSubscribed((e) => {
e
? FlareLane.getDeviceId(function (e) {
if (fetch)
return e
? void fetch(t.API_URL, { method: t.fetch.method, headers: t.fetch.headers, body: JSON.stringify({ deviceId: e }) })
.then(function () {
setTimeout(() => {
i();
}, t.delayTime);
})
.catch(function () {
i();
})
: (alert(n), void i());
i();
})
: (alert(n), i());
});
} catch {
i();
}
}
</script>
<!-- <div class="wrap" id="wrap"></div> -->
<!-- <script>
const wb = document.getElementById('wrap');
wb.onclick = () => {
FlareLane.setIsSubscribed(true, () => {});
wb.remove();
};
</script> -->
<br /><br /><br />
<input id="link-input" />
<button id="add-link-button">add link</button>
<div id="links"></div>
<script>
const linkInput = document.getElementById('link-input');
const linkButton = document.getElementById('add-link-button');
const links = document.getElementById('links');
linkButton.addEventListener('click', () => {
const v = linkInput.value;
const a = document.createElement('a');
const b = document.createElement('br');
a.href = v;
a.innerText = a.href;
a.style.margin = '8px 0';
links.append(a);
links.append(b);
linkInput.value = '';
});
</script>
<br /><br /><br />
<button id="go-settings">go settings</button>
<script>
const goButton = document.getElementById('go-settings');
goButton.addEventListener('click', () => {
try {
// window.open('App-Prefs://prefs:root');
// window.location.href = 'App-Prefs://prefs:root';
const a = document.createElement('a');
a.href = 'App-Prefs://prefs:root';
a.click();
} catch(e) {console.log(e);}
});
</script>
<script>
const manifestLink = document.querySelector('link[rel="manifest"]');
if (manifestLink) {
const manifestURL = manifestLink.href;
fetch(manifestURL)
.then(response => response.json())
.then(data => {
console.log(data);
})
.catch(error => {
console.error("Error fetching the manifest: ", error);
});
} else {
console.error("Manifest link not found");
}
</script>
</body>
</html>