From 87deeaa36022601caed6c1849b4bcad8e9ca1c09 Mon Sep 17 00:00:00 2001 From: fjenett Date: Sat, 18 Jun 2011 19:37:00 +0000 Subject: [PATCH] js mode example cleanups --- .../colorFinder/colorFinder.pde | 13 +++--- .../colorFinder/jsinterface.js | 23 +++++++---- .../DocumentObjectModel/nodeTree/forrest.js | 6 +-- .../DocumentObjectModel/nodeTree/nodeTree.pde | 6 ++- .../selectionFlower/selectionFlower.pde | 6 ++- .../selectionFlower/selectionmonitor.js | 21 +++++----- .../Environment/FileReader/FileReader.pde | 26 ------------ .../examples/Environment/FileReader/reader.js | 35 ---------------- .../Environment/Input/lockedIn/lockedIn.pde | 9 +++-- .../Environment/Input/lockedIn/promt.js | 9 +++-- .../examples/HTML5/Audio/blobb/blobb.pde | 35 ++++++++-------- javascript/examples/HTML5/Audio/blobb/snd.js | 5 ++- .../HTML5/DragDrop/wordDroppings/drag_drop.js | 9 +++-- .../DragDrop/wordDroppings/wordDroppings.pde | 5 ++- .../HTML5/Video/atTheStation/atTheStation.pde | 40 ++++++++++--------- .../examples/HTML5/Video/atTheStation/mov.js | 25 +++++++++--- 16 files changed, 129 insertions(+), 144 deletions(-) delete mode 100644 javascript/examples/Environment/FileReader/FileReader.pde delete mode 100644 javascript/examples/Environment/FileReader/reader.js diff --git a/javascript/examples/Environment/DocumentObjectModel/colorFinder/colorFinder.pde b/javascript/examples/Environment/DocumentObjectModel/colorFinder/colorFinder.pde index bf0a77107..09bc9498d 100644 --- a/javascript/examples/Environment/DocumentObjectModel/colorFinder/colorFinder.pde +++ b/javascript/examples/Environment/DocumentObjectModel/colorFinder/colorFinder.pde @@ -1,9 +1,6 @@ /** *

This example shows you how to manipulate the DOM of a - * HTML page that this sketch is placed in.

- * - *

Click and drag inside the sketch area to change the - * text color of the page

+ * HTML page from a sketch.

*/ color mColor = 255; @@ -16,6 +13,9 @@ void setup () void draw () { background( mColor ); + + textAlign(CENTER); fill(0); + text("<< click and drag here >>", width/2, height/2); } void mouseDragged () @@ -26,15 +26,16 @@ void mouseDragged () if ( js ) { + // call JavaScript function, see "jsinterface.js" js.setColor(red(mColor), green(mColor), blue(mColor)); } } /** * Define an interface that will act as glue between this sketch - * and "real" JavaScript running in the HTML page. The name does not matter. + * and "real" JavaScript running in the HTML page. * - * The interface must define any functions that one intends to call + * The interface must define all functions that you intend to call * from inside the sketch. */ interface JavaScriptInterface diff --git a/javascript/examples/Environment/DocumentObjectModel/colorFinder/jsinterface.js b/javascript/examples/Environment/DocumentObjectModel/colorFinder/jsinterface.js index b44711305..4803a894c 100644 --- a/javascript/examples/Environment/DocumentObjectModel/colorFinder/jsinterface.js +++ b/javascript/examples/Environment/DocumentObjectModel/colorFinder/jsinterface.js @@ -1,6 +1,6 @@ /** * This code will be embedded into the HTML page as "normal" - * JavaScript code with a