Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Blink1Control webapp: added secret button to delete all triggers; imp…

…roved language on trigger sources; removed confusing and nonfunctional radio buttons
  • Loading branch information...
commit 517048242071d33fad4de1bf1ff8ec7fab70d6e6 1 parent dd18e18
Tod E. Kurt authored
42 libraries/html/blink_1/index.html
View
@@ -20,8 +20,8 @@
<body>
<div id="container">
<div id="header">
- <h1>blink(1)</h1>
- <a href="http://thingm.com">by ThingM</a>
+ <a href="."><h1>blink(1)</h1></a>
+ <a href=".">by ThingM</a>
</div> <!-- #header -->
<div id="main-content">
<div id="tabs">
@@ -88,7 +88,7 @@
</div> <!-- #tabs -->
</div> <!-- #main-content -->
- <a id="thingm-logo" href="http://thingm.com"></a>
+ <a id="thingm-logo" href="#"></a>
<div id="gray-out">&nbsp;</div>
<div id="configuration-popup" class="popup-window">
<div class="popup-header">
@@ -125,45 +125,66 @@ <h2 id="popup-title"><input type="text" placeholder="Enter New Trigger Name" /><
<p class="description">
Add rule name and IFTTT Key<br />
<span style="font-weight:bold; color:#666; font-size: 16px; line-height: 20px;" id="ifttt-uid">DEADBEEF12341234</span><br />
- to your IFTTT.com recipe!
+ to your IFTTT.com recipe! </p>
+ <p class="description">
+IFTTT checked every 15 secs.
</p>
</div>
<div id="url-options-selector" class="url">
<h4>URL</h4>
<input id="web-page-url" type="text" class="arg1" placeholder="enter url here" />
- <p>
- <input type="radio" name="url-color-options" value="user-specified" id="url-color-options-user-specified"/ checked="checked" ><label for="url-color-options-user-specified">Specify color pattern</label> <br />
+<!--
+ <p>
+ <input type="radio" name="url-color-options" value="user-specified" id="url-color-options-user-specified"/ checked="checked" ><label for="url-color-options-user-specified">Use color pattern</label> <br />
<input type="radio" name="url-color-options" value="url-specified" id="url-color-options-url-specified"/><label for="url-color-options-url-specified">Use value from URL</label>
</p>
+-->
<p>
<label for="value-retrieved-text-box">Value Retrieved</label>
<input id="value-retrieved-text-box" type="text" value="color value retrieved…"/>
</p>
+ <p class="description">
+URL response is searched for hex color code. First one found is played on blink(1). <br/>
+URLs checked every 15 secs.
+ </p>
</div>
<div id="file-options-selector" class="file">
<h4>FILE</h4>
<input type="text" id="file-path" class="arg1" placeholder="enter file path here" />
+<!--
<p>
- <input type="radio" name="file-color-options" value="user-specified" id="file-color-options-user-specified"/ checked="checked" ><label for="file-color-options-user-specified">Specify color pattern</label><br />
- <input type="radio" name="file-color-options" value="file-specified" id="file-color-options-file-specified"/><label for="file-color-options-file-specified">Use color pattern in file</label>
+ <input type="radio" name="file-color-options" value="user-specified" id="file-color-options-user-specified"/ checked="checked" ><label for="file-color-options-user-specified">Use color pattern</label><br />
+ <input type="radio" name="file-color-options" value="file-specified" id="file-color-options-file-specified"/><label for="file-color-options-file-specified">Use color in file</label>
</p>
+-->
<p>
<label for="value-retrieved-text-box">Value Retrieved</label>
<input id="value-retrieved-text-box" type="text" value="color value retrieved…"/>
</p>
+ <p class="description">
+File content is inspected for hex color code. First one found is played on blink(1). <br/>
+Files checked every 15 secs.
+ </p>
</div>
<div id="script-options-selector" class="script">
<h4>SCRIPT</h4>
<input type="text" id="script-path" class="arg1" placeholder="enter script path here" />
+<!--
<p>
<input type="radio" name="script-color-options" value="user-specified" id="script-color-options-user-specified"/ checked="checked" ><label for="script-color-options-user-specified">Specify color pattern</label><br />
<input type="radio" name="script-color-options" value="file-specified" id="script-color-options-file-specified"/><label for="script-color-options-file-specified">Use color pattern in file</label>
</p>
+-->
<p>
<label for="value-retrieved-text-box">Value Retrieved</label>
<input id="value-retrieved-text-box" type="text" value="color value retrieved…"/>
- </p>
+ </p>
+ <p class="description">
+Script is executed and inspected for hex color code to play on blink(1). </p>
+ <p class="description">
+Scripts must live in ~/Documents/blink1-scripts <br/>
+Scripts executed every 5 secs. </p>
</div>
</div> <!-- .column-2 -->
<div class="column column-3">
@@ -247,10 +268,11 @@ <h2 id="popup-title"><input type="text" placeholder="Enter New Trigger Name" /><
<p class="about-info">IFTTT Key: <span id="about-ifttt-uid">CAFEBABE56785678</span><p>
<h3>LICENSE AND SOURCE CODE</h3>
- <p>blink(1) is an Open Source Hardware product licensed under the [TBD TBD] license.</p>
+ <p>blink(1) is an Open Source Hardware product licensed under the LGPL license.</p>
<p>You may obtain the source code to all the software used in it and digital files for the hardware components on github.</p>
<p>We are totally not responsible for anything you do with it.</p>
<p>blink(1) is a registered trademark of ThingM Corporation.</p>
+ <p><br/><a id="delete-all-triggers">[delete all triggers]</a></p>
</div><!-- .popup-content -->
</div> <!-- #settings-popup -->
<div id="picker">
33 libraries/html/blink_1/js/blink_1.js
View
@@ -107,7 +107,7 @@ $("#tabs #navbar a").removeData("cache.tabs");
var $triggerObject = $(this).parents('.trigger-options');
var index = $(this).closest('.trigger-options').index();
- backendDeleteInput( triggerObjects[index] );
+ backendDeleteTrigger( triggerObjects[index] );
// hide the deleted trigger from the view
$triggerObject.slideUp('normal', function() {
@@ -271,7 +271,7 @@ $("#tabs #navbar a").removeData("cache.tabs");
}
//console.log(triggerObjects);
- backendUpdateInputsAndPatterns(triggerObjects);
+ backendUpdateTriggers(triggerObjects);
});
@@ -435,7 +435,11 @@ $("#tabs #navbar a").removeData("cache.tabs");
$('#container').addClass($('.active').attr('id').split('-')[0]);
});
-
+ $('#delete-all-triggers').live('click', function(e) {
+ console.log('delete all triggers');
+ backendDeleteAllTriggers();
+ window.location.reload();
+ });
@@ -553,9 +557,6 @@ $("#tabs #navbar a").removeData("cache.tabs");
/*-------------------------
SAVE/CLOSE FUNCTIONS
--------------------------*/
-
-
-
@@ -571,13 +572,13 @@ $("#tabs #navbar a").removeData("cache.tabs");
}
//
- // ---------------------------------------------------------------------------
+ // ------------------------------------------------------------------------
//
/*------------------------------
BLINK1 BACK-END FUNCTIONS
(note: if they are declared outside of document.ready they can be used
- in other .js files. This also means they can't use any of the 'globals' above)
+ in other .js files. This also means they can't use any 'globals' above)
--------------------------------*/
//
@@ -621,6 +622,8 @@ $("#tabs #navbar a").removeData("cache.tabs");
$('.url #value-retrieved-text-box').val( result.input.lastVal );
} else if( type == 'file' ) {
$('.file #value-retrieved-text-box').val( result.input.lastVal );
+ } else if( type == 'script' ) {
+ $('.script #value-retrieved-text-box').val( result.input.lastVal );
} else if( type == 'ifttt' ) {
//console.log("ifttt result");
//console.log(result);
@@ -629,7 +632,7 @@ $("#tabs #navbar a").removeData("cache.tabs");
console.log("lastVal: "+ lastVal);
console.log(possibleVals);
var minsago = ((new Date().getTime()/1000 - result.input.lastTime )/60).toFixed(1);
- minsago = (isNaN(minsago)) ? '-never-' : minsago;
+ minsago = (isNaN(minsago)) ? 'n/a' : minsago;
possibleVals = (possibleVals.length) ? possibleVals.toString() : '-none-';
$('.ifttt #value-retrieved-timestamp').text( "last seen " + minsago + " minutes ago" );
@@ -898,7 +901,7 @@ function compileSettings() {
// success: fuction()
// });
//
-function backendDeleteInput(triggerObject) {
+function backendDeleteTrigger(triggerObject) {
var parms = {};
parms.iname = triggerObject.title;
parms.pname = triggerObject.title;
@@ -922,7 +925,7 @@ function backendDeleteInput(triggerObject) {
}
//
-function backendDeleteAllInputs() {
+function backendDeleteAllTriggers() {
var iurl = '../blink1/input/delall';
var purl = '../blink1/pattern/delall';
$.getJSON( iurl );
@@ -933,10 +936,10 @@ function backendDeleteAllInputs() {
// by traversing the 'triggerObects' array and constructing
// appropriate Ajax commands for the back-end
//
-function backendUpdateInputsAndPatterns(triggerObjects) {
- console.log("updateBlink1InputsAndPatterns");
+function backendUpdateTriggers(triggerObjects) {
+ console.log("backendUpdateTriggers");
console.log(triggerObjects);
- backendDeleteAllInputs();
+ backendDeleteAllTriggers();
for( var i=0; i<triggerObjects.length; i++ ) {
var trigObj = triggerObjects[i];
var source = trigObj.source;
@@ -961,7 +964,7 @@ function backendUpdateInputsAndPatterns(triggerObjects) {
//console.log(result);
} )
.error( function() {
- console.log("error on input upate!");
+ console.log("error on input update!");
});
}
Please sign in to comment.
Something went wrong with that request. Please try again.