lorraine 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/lorraine/version.rb +1 -1
- data/web/index.html +1 -2
- data/web/lorraine.js +10 -3
- metadata +1 -1
data/lib/lorraine/version.rb
CHANGED
data/web/index.html
CHANGED
@@ -9,7 +9,6 @@
|
|
9
9
|
<script src="vendor/jscolor/jscolor.js" type="text/javascript"></script>
|
10
10
|
</head>
|
11
11
|
<body>
|
12
|
-
<
|
13
|
-
Color: <input class="color {onImmediateChange:'colorChanged(this);'}" value="66ff00">
|
12
|
+
Input this color into the internets: <input class="color {onImmediateChange:'colorChanged(this);'}" value="66ff00">
|
14
13
|
</body>
|
15
14
|
</html>
|
data/web/lorraine.js
CHANGED
@@ -2,11 +2,13 @@ $(function(){
|
|
2
2
|
|
3
3
|
// Find the host
|
4
4
|
//var pathArray = window.location.pathname.split( '/' );
|
5
|
-
var host = getBaseURL() //pathArray[0]; // + "/";
|
5
|
+
var host = getBaseURL() + "faye"; //pathArray[0]; // + "/";
|
6
|
+
host = host.replace("/admin", "");
|
6
7
|
|
7
8
|
// alert(host);
|
8
9
|
|
9
|
-
window.faye_client = new Faye.Client(host
|
10
|
+
window.faye_client = new Faye.Client(host);
|
11
|
+
console.log("client: "+ host)
|
10
12
|
|
11
13
|
window.faye_client.subscribe('/messages', function(message) {
|
12
14
|
alert('Got a message: ' + message.text);
|
@@ -18,6 +20,10 @@ function illuminatePixel(pixel, r, g, b) {
|
|
18
20
|
window.faye_client.publish('/illuminate', [1, pixel, r * 4095, g * 4095, b * 4095]);
|
19
21
|
}
|
20
22
|
|
23
|
+
function refresh() {
|
24
|
+
window.faye_client.publish('/illuminate', [2]);
|
25
|
+
}
|
26
|
+
|
21
27
|
function illuminateAll(r, g, b) {
|
22
28
|
illuminatePixel(0, r, g, b);
|
23
29
|
illuminatePixel(1, r, g, b);
|
@@ -28,7 +34,8 @@ function illuminateAll(r, g, b) {
|
|
28
34
|
|
29
35
|
|
30
36
|
function colorChanged(color) {
|
31
|
-
illuminateAll(color.rgb[0], color.rgb[1], color.rgb[2])
|
37
|
+
illuminateAll(color.rgb[0], color.rgb[1], color.rgb[2]);
|
38
|
+
refresh();
|
32
39
|
}
|
33
40
|
|
34
41
|
|