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

View file

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

View file

@ -1,29 +1,29 @@
const port = chrome.runtime.connect({
name: "popup"
name: "popup"
});
port.onMessage.addListener((m) => {
const active = m.active;
const div = document.getElementById('active');
const img = div.querySelector('img');
const enabled = m.enabled
img.src = `icons/status-${enabled ? "on" : "off"}.png`;
const ps = div.querySelectorAll('p');
const clients = active ? 1 : 0;
const enabledText = document.getElementById('toggle');
if (enabled) {
document.getElementById('enabled').checked = true;
enabledText.innerText = 'Turn Off';
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.`;
} else {
ps[0].innerText = "Snowflake is off";
ps[1].innerText = "";
document.getElementById('enabled').checked = false;
enabledText.innerText = 'Turn On';
}
const active = m.active;
const div = document.getElementById('active');
const img = div.querySelector('img');
const enabled = m.enabled
img.src = `icons/status-${enabled ? "on" : "off"}.png`;
const ps = div.querySelectorAll('p');
const clients = active ? 1 : 0;
const enabledText = document.getElementById('toggle');
if (enabled) {
document.getElementById('enabled').checked = true;
enabledText.innerText = 'Turn Off';
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.`;
} else {
ps[0].innerText = "Snowflake is off";
ps[1].innerText = "";
document.getElementById('enabled').checked = false;
enabledText.innerText = 'Turn On';
}
});
document.addEventListener('change', (event) => {
port.postMessage({enabled: event.target.checked});
port.postMessage({enabled: event.target.checked});
})