Implement tab title and favicon change if a file transfer has been requested or a file or a message has been received (#7)

Co-authored-by: schlagmichdoch <schlagmichdoch@users.noreply.github.com>
This commit is contained in:
schlagmichdoch 2023-01-20 01:36:15 +01:00 committed by GitHub
parent 9b868786df
commit f97bd6df9e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 4 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 7 KiB

View file

@ -25,7 +25,7 @@
<meta name="twitter:description" content="Instantly share images, videos, PDFs, and links with people nearby. Peer2Peer and Open Source. No Setup, No Signup."> <meta name="twitter:description" content="Instantly share images, videos, PDFs, and links with people nearby. Peer2Peer and Open Source. No Setup, No Signup.">
<meta name="og:description" content="Instantly share images, videos, PDFs, and links with people nearby. Peer2Peer and Open Source. No Setup, No Signup."> <meta name="og:description" content="Instantly share images, videos, PDFs, and links with people nearby. Peer2Peer and Open Source. No Setup, No Signup.">
<!-- Icons --> <!-- Icons -->
<link rel="icon" sizes="96x96" href="images/favicon-96x96.png"> <link rel="icon" id="favicon" sizes="96x96" href="images/favicon-96x96.png">
<link rel="shortcut icon" href="images/favicon-96x96.png"> <link rel="shortcut icon" href="images/favicon-96x96.png">
<link rel="apple-touch-icon" href="images/apple-touch-icon.png"> <link rel="apple-touch-icon" href="images/apple-touch-icon.png">
<meta name="msapplication-TileImage" content="images/mstile-150x150.png"> <meta name="msapplication-TileImage" content="images/mstile-150x150.png">

View file

@ -403,7 +403,6 @@ class PeerUI {
} }
} }
class Dialog { class Dialog {
constructor(id, hideOnDisconnect = true) { constructor(id, hideOnDisconnect = true) {
this.$el = $(id); this.$el = $(id);
@ -423,6 +422,8 @@ class Dialog {
document.activeElement.blur(); document.activeElement.blur();
window.blur(); window.blur();
} }
document.title = 'PairDrop';
document.getElementById('favicon').href = "images/favicon-96x96.png";
} }
} }
@ -572,7 +573,9 @@ class ReceiveFileDialog extends ReceiveDialog {
} }
this.createPreviewElement(files[0]).then(_ => { this.createPreviewElement(files[0]).then(_ => {
this.show() document.title = `PairDrop - ${files.length} Files received`;
document.getElementById('favicon').href = "images/favicon-96x96-notification.png";
this.show();
Events.fire('set-progress', { Events.fire('set-progress', {
peerId: peerId, peerId: peerId,
progress: 1, progress: 1,
@ -594,7 +597,7 @@ class ReceiveFileDialog extends ReceiveDialog {
class ReceiveRequestDialog extends ReceiveDialog { class ReceiveRequestDialog extends ReceiveDialog {
constructor() { constructor() {
super('receiveRequestDialog', true); super('receiveRequestDialog');
this.$acceptRequestBtn = this.$el.querySelector('#acceptRequest'); this.$acceptRequestBtn = this.$el.querySelector('#acceptRequest');
this.$declineRequestBtn = this.$el.querySelector('#declineRequest'); this.$declineRequestBtn = this.$el.querySelector('#declineRequest');
@ -644,6 +647,8 @@ class ReceiveRequestDialog extends ReceiveDialog {
this.$previewBox.appendChild(element) this.$previewBox.appendChild(element)
} }
document.title = 'PairDrop - File Transfer Requested';
document.getElementById('favicon').href = "images/favicon-96x96-notification.png";
this.show() this.show()
} }
@ -980,6 +985,8 @@ class ReceiveTextDialog extends Dialog {
} else { } else {
this.$text.textContent = text; this.$text.textContent = text;
} }
document.title = 'PairDrop - Message Received';
document.getElementById('favicon').href = "images/favicon-96x96-notification.png";
this.show(); this.show();
window.blop.play(); window.blop.play();
} }