use notification polyfill

This commit is contained in:
creeper123123321 2021-08-13 17:29:02 -03:00
parent b8eb214a9d
commit 4866f0e595
2 changed files with 5 additions and 6 deletions

View File

@ -35,6 +35,7 @@ script-src 'self' https://*.cloudflare.com/ https://alcdn.msauth.net/ https://*.
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/js-polyfills/0.1.43/polyfill.min.js" <script defer src="https://cdnjs.cloudflare.com/ajax/libs/js-polyfills/0.1.43/polyfill.min.js"
integrity="sha512-lvWiOP+aMKHllm4THsjzNleVuGOh0WGniJ3lgu/nvCbex1LlaQSxySUjAu/LTJw9FhnSL/PVYoQcckg1Q03+fQ==" integrity="sha512-lvWiOP+aMKHllm4THsjzNleVuGOh0WGniJ3lgu/nvCbex1LlaQSxySUjAu/LTJw9FhnSL/PVYoQcckg1Q03+fQ=="
crossorigin="anonymous"></script> crossorigin="anonymous"></script>
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/HTML5Notification/3.0.0/Notification.min.js" integrity="sha512-gx0m7Qoum1Bb0KrP6AEZSt0e+o2xMEyStAz2TNGXGqR4HSVgPveWFQdtE06FRvJmmp8HdkJklOLYiV3aZN6tQg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.slim.min.js" <script defer src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.slim.min.js"
integrity="sha512-6ORWJX/LrnSjBzwefdNUyLCMTIsGoNP6NftMy2UAm1JBm6PRZCO1d7OHBStWpVFZLO+RerTvqX/Z9mBFfCJZ4A==" integrity="sha512-6ORWJX/LrnSjBzwefdNUyLCMTIsGoNP6NftMy2UAm1JBm6PRZCO1d7OHBStWpVFZLO+RerTvqX/Z9mBFfCJZ4A=="
crossorigin="anonymous"></script> crossorigin="anonymous"></script>

View File

@ -132,12 +132,10 @@ function refreshAccountList() {
function renderActions() { function renderActions() {
actions.innerHTML = ""; actions.innerHTML = "";
try { if (Notification.permission === "default") {
if (Notification.permission === "default") { actions.innerHTML += '<p><a href="javascript:" id="notificate">Enable notifications</a></p>';
actions.innerHTML += '<p><a href="javascript:" id="notificate">Enable notifications</a></p>'; $("#notificate").on("click", () => Notification.requestPermission().then(renderActions)); // i'm lazy
$("#notificate").on("click", () => Notification.requestPermission().then(renderActions)); // i'm lazy }
}
} catch (ignored) { } // Why apple??? Why you don't support notifications???
if (listenVisible) { if (listenVisible) {
if (mcIdUsername != null && mcauth_code != null) { if (mcIdUsername != null && mcauth_code != null) {
addAction("Listen to " + mcIdUsername, () => { addAction("Listen to " + mcIdUsername, () => {