Skip to content

Commit

Permalink
LOOOOOOADS of changes.
Browse files Browse the repository at this point in the history
* It looks better.
* Preparing for Heroku.
* Tests run.
* It is now based on mobsters.
  • Loading branch information
stomlinson committed Jan 1, 2012
1 parent dcb1d8d commit 9c61c18
Show file tree
Hide file tree
Showing 20 changed files with 827 additions and 84 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -0,0 +1,2 @@
node_modules/

2 changes: 2 additions & 0 deletions Procfile
@@ -0,0 +1,2 @@
web: node server/start.js

148 changes: 144 additions & 4 deletions client/static/css/style.css
@@ -1,22 +1,54 @@
* {
html, body {
margin: 0;
padding: 0;
line-height: 1;
font: 13px/1.5 Helvetica,Arial,"Liberation Sans",FreeSans,sans-serif;
}

body {
background-color: #C6B9AC;
color: #333;
}

header, footer {
display: block;
}

header {
border-bottom: 1px solid #ddd;
margin-bottom: 20px;
padding-bottom: 20px;
}

footer {
border-top: 1px solid #ddd;
margin-top: 20px;
padding-top: 20px;
}

h1, h2, h3 {
margin: 0;
padding: 0;
display: inline;
}

h1 {
font-size: 1.5em;
}

h1 > a {
text-decoration: none;
color: #ff8200;
font-size: 2.2em
}

h2 {
font-size: 1.2em;
margin: 10px 0;
}

ul, li, ol {
list-style-type: none;
font-size: small;
margin: 0;
padding: 0;
Expand All @@ -30,8 +62,112 @@ input[type=text] {
border: 1px solid #aaa;
}

button {
padding: .5em;
button,
.button {
font-size: 14px;
height: 28px;
padding: 0 10px;
float: right;
vertical-align: middle;
border: 1px solid #37A6FF;
font-family: 'Droid Serif', Georgia, serif;
color: #fff;
text-shadow: -1px -1px 0 #37A6FF;
text-transform: lowercase;
cursor: pointer;

-webkit-box-shadow: 0 0 0 1px #76C2FF inset;
-moz-box-shadow: 0 0 0 1px #76C2FF inset;
-o-box-shadow: 0 0 0 1px #76C2FF inset;
box-shadow: 0 0 0 1px #76C2FF inset;

-webkit-border-radius: 5px;
-moz-border-radius: 5px;
-o-border-radius: 5px;
border-radius: 5px;

background-color: #37A6FF;
background-image: -moz-linear-gradient(center top , #76C2FF 0pt, #37A6FF 100%);
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #76C2FF), color-stop(100%, #37A6FF));
}

button:hover,
button:focus,
.button:hover,
.button:focus{
background-color: #76c2ff;
background-image: -moz-linear-gradient(center top , #76C2FF 50%, #37A6FF 100%);
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(50%, #76C2FF), color-stop(100%, #37A6FF));

}

button:active,
.button:active {
background-color: #006EC6;
border: 1px solid #003E70;
color: #EEEEEE;
text-shadow: -1px -1px 0 #006EC6;

-webkit-box-shadow: 0 0 5px #003763 inset;
-moz-box-shadow: 0 0 5px #003763 inset;
-o-box-shadow: 0 0 5px #003763 inset;
box-shadow: 0 0 5px #003763 inset;

background-image: -moz-linear-gradient(center top , #3AA7FF 0%, #006EC6 100%);
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #3AA7FF), color-stop(100%, #006EC6));
}

button::-moz-focus-inner, .button::-moz-focus-inner {
padding: 0;
border: 0
}

button[disabled] {
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
opacity: .5;
}



.right {
float: right;
}

.left {
float: left;
}

#wrapper {
width: 840px;
margin: 0 auto;
background: #fff;
margin-top: 50px;
padding: 50px;
box-shadow: 0pt 0pt 15px 5px rgba(0, 0, 0, 0.3);
}

#signin {
width: 79px;
height: 22px;
text-indent: -9999px;
background-image: url("/img/sign_in_blue.png");
}

#client_type_menu {
text-align: center;
margin-top: 20px;
}

#client_type_menu > li {
display: inline-block;
}

#client_type_menu > li > a {
height: auto;
padding: 25px;
font-size: 2em;
text-decoration: none;
border-radius: 10px;
}

#results > li {
Expand Down Expand Up @@ -68,8 +204,12 @@ button {

#results > li > ul {
opacity: 0;
-webkit-transition-property: opacity, height;
-webkit-transition-duration: 1s, 1s;
-moz-transition-property: opacity, height;
-moz-transition-duration: 1s, 1s;
-ms-transition-property: opacity, height;
-ms-transition-duration: 1s, 1s;
background: #ccc;
border-radius: 5px;
border: 1px solid #ccc;
Expand All @@ -82,7 +222,7 @@ button {
#results > li:target > ul {
padding: 1em;
opacity: 1;
height: 4em;
height: 5.5em;
}

#results > li > ul > li {
Expand Down
Binary file added client/static/img/sign_in_blue.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions client/static/lib/winchan.js
Expand Up @@ -80,7 +80,7 @@
open: function(url, relay_url, winopts, arg, cb) {
if (!cb) throw "missing required callback argument";

// sanity check, are url and relay_url the same origin?
// sanity check, are url and relay_url the same origin?
var origin = extractOrigin(url);
if (origin !== extractOrigin(relay_url)) {
setTimeout(function() {
Expand All @@ -99,7 +99,7 @@
iframe.setAttribute('name', IFRAME_NAME);
document.body.appendChild(iframe);

var w = window.open(url, null, winopts);
var w = window.open(url, null, winopts);
var req = JSON.stringify({a: 'request', d: arg});

// cleanup on unload
Expand Down Expand Up @@ -181,7 +181,7 @@
open: function(url, relay_url, winopts, arg, cb) {
if (!cb) throw "missing required callback argument";

// sanity check, are url and relay_url the same origin?
// sanity check, are url and relay_url the same origin?
var origin = extractOrigin(url);
if (origin !== extractOrigin(relay_url)) {
setTimeout(function() {
Expand Down
41 changes: 41 additions & 0 deletions client/static/scripts/authentication.js
@@ -0,0 +1,41 @@
$(function() {
"use strict";

$("#signin").click(function(event) {
event.preventDefault();

navigator.id.getVerifiedEmail(function(assertion) {
$.ajax({
type: "POST",
url: "/wsapi/login",
data: {
assertion: assertion
},
success: function(resp) {
window.location.reload();
},
error: function(resp) {
console.log(resp);
}
});
});
});

$("#signout").click(function(event) {
event.preventDefault();

$.ajax({
type: "POST",
url: "/wsapi/logout",
success: function(resp) {
window.location.reload();
},
error: function(resp) {

}
});
});


});

57 changes: 32 additions & 25 deletions client/static/scripts/index.js
@@ -1,33 +1,40 @@
$(function() {
"use strict";
"use strict";

var socket;
socket = io.connect('http://192.168.1.88:3000');
var socket;
socket = io.connect('http://192.168.1.88:3000');

document.location.hash="";
document.location.hash="";

$("form").bind("submit", function(event) {
event.preventDefault();
$("#url").val(localStorage.url || "");

var url = $("#url").val().trim();
$("form").bind("submit", function(event) {
event.preventDefault();

var url = $("#url").val().trim();
if(url) {
localStorage.url = url;
socket.emit('request_start_test', { url: url });
});

var resultTemplate = new EJS({ url: "/templates/results.ejs" });
var result = 1;
socket.on("test_start", function(data) {
data.id = "runner" + data.runner_id;
data.complete = false;
var html = resultTemplate.render(data);
$(html).appendTo("#results");
});

socket.on("test_complete", function(data) {
data.id = "runner" + data.runner_id;
data.complete = true;
var html = resultTemplate.render(data);
$("#" + data.id).replaceWith(html);
result++;
});
}
});

var resultTemplate = new EJS({ url: "/templates/results.ejs" });
var result = 1;

socket.on("test_start", function(data) {
data.id = "runner" + data.runner_id;
data.complete = false;
data.email = data.email || "";
var html = resultTemplate.render(data);
$(html).appendTo("#results");
});

socket.on("test_complete", function(data) {
data.id = "runner" + data.runner_id;
data.complete = true;
data.email = data.email || "";
var html = resultTemplate.render(data);
$("#" + data.id).replaceWith(html);
result++;
});
});
16 changes: 16 additions & 0 deletions client/static/scripts/loader.js
@@ -0,0 +1,16 @@
TestSwarm.Loader = (function() {
"use strict";

function load(data, callback) {
var testWindow = WinChan.open(data.url, "http://192.168.1.88:10002/relay", "", {}, function(err, data) {
testWindow.close();
callback(err, data);
});
}

return {
load: load
};


}());

0 comments on commit 9c61c18

Please sign in to comment.