From f97bd6df9e955b56a959f10e2184349d5cabb55c Mon Sep 17 00:00:00 2001 From: schlagmichdoch <52242352+schlagmichdoch@users.noreply.github.com> Date: Fri, 20 Jan 2023 01:36:15 +0100 Subject: [PATCH] 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 --- public/images/favicon-96x96-notification.png | Bin 0 -> 7181 bytes public/index.html | 2 +- public/scripts/ui.js | 13 ++++++++++--- 3 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 public/images/favicon-96x96-notification.png diff --git a/public/images/favicon-96x96-notification.png b/public/images/favicon-96x96-notification.png new file mode 100644 index 0000000000000000000000000000000000000000..d3407c3395776406d6ae6ff99a4342122e139bf0 GIT binary patch literal 7181 zcmV+o9P;CdP)^%u!6h*exGYQEg+#5g!=hKg4Z;2*=ybGQy^;G?H;{WnI$s^+wUt{4Ph!1u+?Dh+B6wh*p( z3?m}{caMOlzO!@%I(P$wAd%xhB7!IZw{Zx8_LzC2@GVjJ8t8Pu3;@CvSn%Iv9LHti zk1yyT$i!csdhzwBVHEf=%``L1C)vZa~q;k zLr$^oRuV%Ja@_ZD-qu|q^0n?qpdE^W9dJ4X=;z(a&VjDw=UM{+L#TIsd2j%c^_IH2 zWDJ(cUV?W661iJtkuK)|1bC;lz+o&uZ8cuZH2^~44+LF7>*e@HwmJtq@wH`;2*jNjl077f_X3!s zij@nrVj%CVtjbN>cxu!9Jtb!k)GC?zv_j?@FrT?aY6pFTV?52Oj9V1}k8d>J0wLUv zfg07WMW4nGkhC!_FQ%)5w7%8rrywmFseVmkHswi^FD4hV6$CViJgd0el$Hf2}`nqAX zwkPOzAc^D{(baDkq;o zIiPWL_^;aZMs4W)kZ_X_l8MF6s! zS0V@pu#OPtb(H)f1*kIn_~$#`yemZ}+7D!vSGYrX!?f}e1;AZ1zX-PU(Y?fZ1%6r<01`Y6;kCYr~!Uj ziuoD@!B_~;?f6ZJ_#J)h0O>f4FYe9EQzZ;??)dh`$eD1hf`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hha_?dg4egeNh@8}-bvz5b#{cZO z`{zHKvul196LKh}BD5hEThouPr${hdKXvWHU9KDdANS5dq-+(*9xMS+d~(-IQ9raM z@bCH1IvP{`=XjjG0){9%>6cy$#m85^lKzc1=?|&Hl?7xc0tABqU30KBVY{@oQ#TlM z55CEfyaDyi*>gh!Dumq;2cB$dw6ny2p4Y@YUzPnzk1BcCyESR{T{zQ{mD1P!y|_Vq2oil6P*y6SH&ndKE69 z4qOrSSDJLbX|qn6vE?gEPJMOk_|j3+Z50>3bsuxcOs+a}ce2cLtOTw2Lqf;?bC*%D zR=nxAN&+{w%B(FXmfZ1l*=cW#M_S>KPsiM3Q@KTc#D~grDVE z+j766M3F!^jI5OC6WOVMm%)#0m{oah^S+!t?_@HbV+M8ITlJV?GT!0;cXk8n!V*{~0SL+Ibc5oD(GNHX#&GHc*snoF;Oqkw8`olE^2C zTZIDOsZ($27IR`lI84VA+FM%;MOi84bn+_%WPCc)`BMH zBrd5As7EA`MZBFUOPiXRqMD0iV<-ZusKwJ#$LC-AU(#a~wBmtFmjMFU1D{&@2z~t( z_j|&ZS<$!sq;np|3+~xr P00000NkvXXu0mjfq0F~> literal 0 HcmV?d00001 diff --git a/public/index.html b/public/index.html index bbb4308..9fc34e5 100644 --- a/public/index.html +++ b/public/index.html @@ -25,7 +25,7 @@ - + diff --git a/public/scripts/ui.js b/public/scripts/ui.js index ac5f72e..40b5845 100644 --- a/public/scripts/ui.js +++ b/public/scripts/ui.js @@ -403,7 +403,6 @@ class PeerUI { } } - class Dialog { constructor(id, hideOnDisconnect = true) { this.$el = $(id); @@ -423,6 +422,8 @@ class Dialog { document.activeElement.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.show() + document.title = `PairDrop - ${files.length} Files received`; + document.getElementById('favicon').href = "images/favicon-96x96-notification.png"; + this.show(); Events.fire('set-progress', { peerId: peerId, progress: 1, @@ -594,7 +597,7 @@ class ReceiveFileDialog extends ReceiveDialog { class ReceiveRequestDialog extends ReceiveDialog { constructor() { - super('receiveRequestDialog', true); + super('receiveRequestDialog'); this.$acceptRequestBtn = this.$el.querySelector('#acceptRequest'); this.$declineRequestBtn = this.$el.querySelector('#declineRequest'); @@ -644,6 +647,8 @@ class ReceiveRequestDialog extends ReceiveDialog { this.$previewBox.appendChild(element) } + document.title = 'PairDrop - File Transfer Requested'; + document.getElementById('favicon').href = "images/favicon-96x96-notification.png"; this.show() } @@ -980,6 +985,8 @@ class ReceiveTextDialog extends Dialog { } else { this.$text.textContent = text; } + document.title = 'PairDrop - Message Received'; + document.getElementById('favicon').href = "images/favicon-96x96-notification.png"; this.show(); window.blop.play(); }