commit c9783398370b81703230296a00bb4b6a900a005b Author: David Fifield david@bamsoftware.com Date: Mon Jul 9 13:43:25 2012 -0700
Change the size of the badge to 80×15.
That is a standard size according to https://en.wikipedia.org/wiki/Web_badge, unlike our mutant 70×23.
Remove counter from the badge. The counter turned out to be dumb because it is almost always 0. --- README | 2 +- badge.png | Bin 230 -> 254 bytes embed.html | 36 ++++++++++++++++-------------------- flashproxy.js | 29 +++++------------------------ 4 files changed, 22 insertions(+), 45 deletions(-)
diff --git a/README b/README index f81201b..e096a3f 100644 --- a/README +++ b/README @@ -126,7 +126,7 @@ Add this line to torrc to make the relay use the external proxy:
Paste in this HTML where you want the badge to appear:
-<iframe src="//crypto.stanford.edu/flashproxy/embed.html" width="70" height="23" frameBorder="0" scrolling="no"></iframe> +<iframe src="//crypto.stanford.edu/flashproxy/embed.html" width="80" height="15" frameBorder="0" scrolling="no"></iframe>
== For developers diff --git a/badge.png b/badge.png index 17d2c79..068cf78 100644 Binary files a/badge.png and b/badge.png differ diff --git a/embed.html b/embed.html index 325883c..aac0565 100644 --- a/embed.html +++ b/embed.html @@ -4,38 +4,34 @@ <meta charset="utf-8"> <meta http-equiv="refresh" content="86400"> <style type="text/css"> +html { + width: 100%; + height: 100%; +} body { margin: 0; padding: 0; + width: 100%; + height: 100%; } #flashproxy-badge { - position: relative; - margin: 0; - padding: 0; - width: 70px; - height: 23px; - color: white; - background-color: #d80; -} -#flashproxy-badge a img { - border: 0; -} -#flashproxy-badge table { - position: absolute; - top: 0px; - left: 0px; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; border-collapse: collapse; + line-height: 0; + background-color: #d80; } -#flashproxy-badge table tr td { - text-align: center; +#flashproxy-badge td { + margin: 0; + padding: 0; vertical-align: middle; - padding: 2px 2px 2px 47px; - font-size: 12px; + text-align: center; +} +#flashproxy-badge a img { + border: 0; } #flashproxy-badge.debug { position: absolute; @@ -56,7 +52,7 @@ body { flashproxy_badge_insert().start(); </script> <noscript> -<div id="flashproxy-badge"><a href="http://crypto.stanford.edu/flashproxy/" target="_parent"><img src="badge.png" alt="I support Internet freedom"></a></div> +<table id="flashproxy-badge"><tr><td><a href="http://crypto.stanford.edu/flashproxy/" target="_parent"><img src="badge.png" alt="Internet freedom"></a></td></tr></table> </noscript> </body> </html> diff --git a/flashproxy.js b/flashproxy.js index 28beb29..321a708 100644 --- a/flashproxy.js +++ b/flashproxy.js @@ -456,7 +456,6 @@ function FlashProxy() { while (this.proxy_pairs.length > 0) this.proxy_pairs.pop().close(); this.badge.set_color("#777"); - this.badge.refresh(); };
this.die = function() { @@ -677,49 +676,31 @@ function escape_html(s) { function Badge() { /* Number of proxy pairs currently connected. */ this.num_proxy_pairs = 0; - /* Number of proxy pairs ever connected. */ - this.total_proxy_pairs = 0;
- this.counter_text = document.createElement("td"); - - var div, img, table, tr, td; - - div = document.createElement("div"); - - img = document.createElement("img"); - img.setAttribute("src", "badge.png"); - div.appendChild(img); + var img, table, tr, td;
table = document.createElement("table"); - div.appendChild(table) tr = document.createElement("tr"); table.appendChild(tr); td = document.createElement("td"); tr.appendChild(td); + img = document.createElement("img"); + img.setAttribute("src", "badge.png"); + td.appendChild(img);
- this.counter_text = td; - this.elem = div; + this.elem = table;
this.proxy_begin = function() { this.num_proxy_pairs++; - this.total_proxy_pairs++; - this.refresh(); };
this.proxy_end = function() { this.num_proxy_pairs--; - this.refresh(); }
- this.refresh = function() { - this.counter_text.innerHTML = escape_html(String(this.total_proxy_pairs)); - }; - this.set_color = function(color) { this.elem.style.backgroundColor = color; }; - - this.refresh(); }
function quote(s) {
tor-commits@lists.torproject.org