[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [snowflake/master] Update favicon with badge state on embed.html



commit faf02d86a15c795e69f176d952bbe1f3f531da28
Author: Arlo Breault <arlolra@xxxxxxxxx>
Date:   Tue Oct 1 16:45:04 2019 -0400

    Update favicon with badge state on embed.html
    
    .ico files were created with,
    convert -density 256x256 -background transparent toolbar-on.svg -define icon:auto-resize -colors 256 toolbar-on.ico
    
    Trac: 31537
---
 proxy/init-badge.js                     |   8 ++++++++
 proxy/static/assets/toolbar-off.ico     | Bin 0 -> 387723 bytes
 proxy/static/assets/toolbar-on.ico      | Bin 0 -> 385740 bytes
 proxy/static/assets/toolbar-running.ico | Bin 0 -> 386345 bytes
 proxy/static/embed.html                 |   2 ++
 5 files changed, 10 insertions(+)

diff --git a/proxy/init-badge.js b/proxy/init-badge.js
index 7684e68..fe8cc91 100644
--- a/proxy/init-badge.js
+++ b/proxy/init-badge.js
@@ -31,6 +31,7 @@ class BadgeUI extends UI {
     this.popup.setEnabled(false);
     this.popup.setActive(false);
     this.popup.setStatusText(messages.getMessage('popupStatusOff'));
+    this.setIcon('off');
     this.popup.setStatusDesc(missing, true);
     this.popup.hideButton();
   }
@@ -40,8 +41,10 @@ class BadgeUI extends UI {
     this.popup.setChecked(true);
     if (clients > 0) {
       this.popup.setStatusText(messages.getMessage('popupStatusOn', String(clients)));
+      this.setIcon('running');
     } else {
       this.popup.setStatusText(messages.getMessage('popupStatusReady'));
+      this.setIcon('on');
     }
     // FIXME: Share stats from webext
     this.popup.setStatusDesc('');
@@ -52,6 +55,7 @@ class BadgeUI extends UI {
   turnOff() {
     this.popup.setChecked(false);
     this.popup.setStatusText(messages.getMessage('popupStatusOff'));
+    this.setIcon('off');
     this.popup.setStatusDesc('');
     this.popup.setEnabled(false);
     this.popup.setActive(false);
@@ -62,6 +66,10 @@ class BadgeUI extends UI {
     this.turnOn();
   }
 
+  setIcon(status) {
+    document.getElementById('icon').href = `assets/toolbar-${status}.ico`;
+  }
+
 }
 
 BadgeUI.prototype.popup = null;
diff --git a/proxy/static/assets/toolbar-off.ico b/proxy/static/assets/toolbar-off.ico
new file mode 100644
index 0000000..9483fc9
Binary files /dev/null and b/proxy/static/assets/toolbar-off.ico differ
diff --git a/proxy/static/assets/toolbar-on.ico b/proxy/static/assets/toolbar-on.ico
new file mode 100644
index 0000000..01203d5
Binary files /dev/null and b/proxy/static/assets/toolbar-on.ico differ
diff --git a/proxy/static/assets/toolbar-running.ico b/proxy/static/assets/toolbar-running.ico
new file mode 100644
index 0000000..1abf83e
Binary files /dev/null and b/proxy/static/assets/toolbar-running.ico differ
diff --git a/proxy/static/embed.html b/proxy/static/embed.html
index 96bf90c..b3ca800 100644
--- a/proxy/static/embed.html
+++ b/proxy/static/embed.html
@@ -4,6 +4,8 @@
     <meta charset="utf-8" />
     <!-- This should be essentially be a no-opt in the popup -->
     <meta http-equiv="refresh" content="86400" />
+    <title>Snowflake</title>
+    <link rel="icon" id="icon" href="assets/toolbar-off.ico" />
     <link rel="stylesheet" href="embed.css" />
     <script src="popup.js"></script>
     <script src="embed.js"></script>



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits