This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<!-- View this at https://rawgit.com/johnmellor/460bdac0c5b30832df898e67b4b7cedf/raw/ --> | |
<meta name=viewport content="initial-scale=1"> | |
<a href="https://gist.github.com/johnmellor/460bdac0c5b30832df898e67b4b7cedf">View code</a><br> | |
<a href="https://rawgit.com/johnmellor/d792819c4faa24a190bb7ea0138fba3e/raw/">cURL variant</a> | |
<p id="loading">Loading...</p> | |
<div id="loaded" style="display: none"> | |
<p><strong>Endpoint:</strong> <output id="registration-id"></output> | |
<p><button id="send-button">Send push</button><br> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<!-- View this at https://rawgit.com/johnmellor/d792819c4faa24a190bb7ea0138fba3e/raw/ --> | |
<meta name=viewport content="initial-scale=1"> | |
<a href="https://gist.github.com/johnmellor/d792819c4faa24a190bb7ea0138fba3e">View code</a><br> | |
<a href="https://rawgit.com/johnmellor/460bdac0c5b30832df898e67b4b7cedf/raw/">XHR variant</a><br><br> | |
<code id="code">Loading...</code> | |
<script> | |
navigator.serviceWorker.register('sw.js'); | |
navigator.serviceWorker.ready.then(swr => { | |
swr.pushManager.subscribe({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<!-- View this at https://rawgit.com/johnmellor/4d9d1d32d8c7915b63a48f462cceaf74/raw/ --> | |
<meta name=viewport content="initial-scale=1"> | |
<a href="https://gist.github.com/johnmellor/4d9d1d32d8c7915b63a48f462cceaf74">View code</a><br><br> | |
<button id="show">Show notification</button> | |
<script> | |
navigator.serviceWorker.register('sw.js'); | |
document.getElementById('show').addEventListener('click', event => { | |
navigator.serviceWorker.ready.then(swr => { | |
Notification.requestPermission(permission => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<!-- View this at https://rawgit.com/johnmellor/50624d8908af69e8f7aca40f5fbc7ba2/raw/ --> | |
<meta name="viewport" content="initial-scale=1"> | |
<style> | |
form { display: table; } | |
form > label { display: table-row; } | |
form > label > * { display: table-cell; } | |
</style> | |
<h1>GCM/FCM server key tester</h1> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript: | |
/* Toggle dark theme. Tested in Chrome 108. */ | |
(()=>{ | |
var id = 'toggle-dark-theme-bookmarklet'; | |
var el = document.getElementById(id); | |
if (el) { el.remove(); return; } | |
document.head.insertAdjacentHTML('beforeend', ` | |
<style id="${id}"> | |
html { | |
filter: invert(100%) hue-rotate(180deg); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript: | |
/* Hide fixed elements and unlock scrolling. */ | |
(()=>{ | |
/* Unlock scrolling. */ | |
for (let el of [document.documentElement, document.body]) { | |
let cs = getComputedStyle(el); | |
if (['hidden', 'clip'].includes(cs.overflowY)) el.style.setProperty('overflow', 'visible', 'important'); | |
if (cs.position === 'fixed') el.style.setProperty('position', 'static', 'important'); | |
} | |
/* Hide fixed position elements. */ |