Fix whitespace to match conventions

This commit is contained in:
Cecylia Bocovich 2019-07-02 09:56:47 -04:00
parent f890739a38
commit 58d07788c7
3 changed files with 56 additions and 56 deletions

View file

@ -1,13 +1,13 @@
body { body {
margin: 10px; margin: 10px;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
width: 300px; width: 300px;
font-size:12px; font-size:12px;
} }
#active { #active {
margin: 20px 0; margin: 20px 0;
text-align: center; text-align: center;
} }
.b { .b {
@ -18,8 +18,8 @@ body {
.b a { .b a {
color: black; color: black;
display: inline-block; display: inline-block;
text-decoration: none; text-decoration: none;
} }
.learn:before { .learn:before {
@ -40,11 +40,11 @@ body {
/* Snowflake Status */ /* Snowflake Status */
.transfering { .transfering {
-webkit-animation:spin 8s linear infinite; -webkit-animation:spin 8s linear infinite;
-moz-animation:spin 8s linear infinite; -moz-animation:spin 8s linear infinite;
animation:spin 8s linear infinite; animation:spin 8s linear infinite;
fill: BlueViolet; fill: BlueViolet;
} }
@-moz-keyframes spin { 100% { -moz-transform: rotate(360deg); } } @-moz-keyframes spin { 100% { -moz-transform: rotate(360deg); } }
@-webkit-keyframes spin { 100% { -webkit-transform: rotate(360deg); } } @-webkit-keyframes spin { 100% { -webkit-transform: rotate(360deg); } }
@ -67,7 +67,7 @@ body {
height: 0; height: 0;
} }
.slider { .slider {
position: absolute; position: absolute;
cursor: pointer; cursor: pointer;
top: 0; top: 0;

View file

@ -1,25 +1,25 @@
<!doctype html> <!doctype html>
<html> <html>
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<link rel="stylesheet" href="popup.css" /> <link rel="stylesheet" href="popup.css" />
<script src="popup.js"></script> <script src="popup.js"></script>
</head> </head>
<body> <body>
<div id="active"> <div id="active">
<img src="icons/status-off.png" /> <img src="icons/status-off.png" />
<p></p> <p></p>
<p></p> <p></p>
</div> </div>
<div class="b toggle"> <div class="b toggle">
<label id=toggle>Turn On</label> <label id=toggle>Turn On</label>
<label class="switch"> <label class="switch">
<input id="enabled" type="checkbox"/> <input id="enabled" type="checkbox"/>
<span class="slider round"></span> <span class="slider round"></span>
</label> </label>
</div> </div>
<div class="b learn"> <div class="b learn">
<a target="_blank" href="https://snowflake.torproject.org/">Learn more</a> <a target="_blank" href="https://snowflake.torproject.org/">Learn more</a>
</div> </div>
</body> </body>
</html> </html>

View file

@ -1,29 +1,29 @@
const port = chrome.runtime.connect({ const port = chrome.runtime.connect({
name: "popup" name: "popup"
}); });
port.onMessage.addListener((m) => { port.onMessage.addListener((m) => {
const active = m.active; const active = m.active;
const div = document.getElementById('active'); const div = document.getElementById('active');
const img = div.querySelector('img'); const img = div.querySelector('img');
const enabled = m.enabled const enabled = m.enabled
img.src = `icons/status-${enabled ? "on" : "off"}.png`; img.src = `icons/status-${enabled ? "on" : "off"}.png`;
const ps = div.querySelectorAll('p'); const ps = div.querySelectorAll('p');
const clients = active ? 1 : 0; const clients = active ? 1 : 0;
const enabledText = document.getElementById('toggle'); const enabledText = document.getElementById('toggle');
if (enabled) { if (enabled) {
document.getElementById('enabled').checked = true; document.getElementById('enabled').checked = true;
enabledText.innerText = 'Turn Off'; enabledText.innerText = 'Turn Off';
ps[0].innerText = `${clients} client${(clients !== 1) ? 's' : ''} connected.`; ps[0].innerText = `${clients} client${(clients !== 1) ? 's' : ''} connected.`;
ps[1].innerText = `Your snowflake has helped ${m.total} user${(m.total !== 1) ? 's' : ''} circumvent censorship in the last 24 hours.`; ps[1].innerText = `Your snowflake has helped ${m.total} user${(m.total !== 1) ? 's' : ''} circumvent censorship in the last 24 hours.`;
} else { } else {
ps[0].innerText = "Snowflake is off"; ps[0].innerText = "Snowflake is off";
ps[1].innerText = ""; ps[1].innerText = "";
document.getElementById('enabled').checked = false; document.getElementById('enabled').checked = false;
enabledText.innerText = 'Turn On'; enabledText.innerText = 'Turn On';
} }
}); });
document.addEventListener('change', (event) => { document.addEventListener('change', (event) => {
port.postMessage({enabled: event.target.checked}); port.postMessage({enabled: event.target.checked});
}) })