commit c8ec00b34557c7e3ccbb3ed6bfd46ee8915d1b5a
parent 027d09347229c20e15bb36649af8e72758013fc1
Author: RobinLinus <robinlinus@users.noreply.github.com>
Date: Thu, 14 Mar 2019 21:37:44 +0100
Cleanup
Diffstat:
1 file changed, 17 insertions(+), 19 deletions(-)
diff --git a/client/scripts/ui.js b/client/scripts/ui.js
@@ -281,8 +281,8 @@ class SendTextDialog extends Dialog {
this.$text.setSelectionRange(0, this.$text.value.length)
}
- _handleShareTargetText(){
- if(!window.shareTargetText) return;
+ _handleShareTargetText() {
+ if (!window.shareTargetText) return;
this.$text.value = window.shareTargetText;
window.shareTargetText = '';
}
@@ -456,9 +456,9 @@ class WebShareTargetUI {
let shareTargetText = title ? title : '';
shareTargetText += text ? shareTargetText ? ' ' + text : text : '';
shareTargetText += url ? shareTargetText ? ' ' + url : url : '';
- if(!shareTargetText) return;
+ if (!shareTargetText) return;
window.shareTargetText = shareTargetText;
- history.pushState({},'URL Rewrite','/');
+ history.pushState({}, 'URL Rewrite', '/');
console.log('Shared Target Text:', '"' + shareTargetText + '"');
}
}
@@ -516,27 +516,25 @@ document.copy = text => {
if ('serviceWorker' in navigator) {
- navigator.serviceWorker
- .register('/service-worker.js')
+ navigator.serviceWorker.register('/service-worker.js')
.then(serviceWorker => {
console.log('Service Worker registered');
window.serviceWorker = serviceWorker
});
-
- // don't display install banner when installed
- window.addEventListener('beforeinstallprompt', e => {
- if (window.matchMedia('(display-mode: standalone)').matches) {
- return e.preventDefault();
- } else {
- const deferredPrompt = e;
- const btn = document.querySelector('#install')
- btn.hidden = false;
- btn.onclick = _ => deferredPrompt.prompt();
- return e.preventDefault();
- }
- });
}
+window.addEventListener('beforeinstallprompt', e => {
+ if (window.matchMedia('(display-mode: standalone)').matches) {
+ // don't display install banner when installed
+ return e.preventDefault();
+ } else {
+ const btn = document.querySelector('#install')
+ btn.hidden = false;
+ btn.onclick = _ => e.prompt();
+ return e.preventDefault();
+ }
+});
+
// Background Animation
Events.on('load', () => {
var requestAnimFrame = (function() {