cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmue...@apache.org
Subject weinre commit: [CB-604] starting to add some bits for use strict
Date Wed, 31 Oct 2012 16:41:59 GMT
Updated Branches:
  refs/heads/master d1d8cb1d1 -> 588b2e90c


[CB-604] starting to add some bits for use strict

Right now, all I have is a new test case that
runs the demo in strict mode.  It "fails" if
you trying hitting the "start" button in the
demo, perhaps needing to set on Timeline
monitoring first.


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/commit/588b2e90
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/tree/588b2e90
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/diff/588b2e90

Branch: refs/heads/master
Commit: 588b2e90ca1e3c56599f587a1f71911f99877dfc
Parents: d1d8cb1
Author: Patrick Mueller <pmuellr@apache.org>
Authored: Wed Oct 31 12:38:57 2012 -0400
Committer: Patrick Mueller <pmuellr@apache.org>
Committed: Wed Oct 31 12:38:57 2012 -0400

----------------------------------------------------------------------
 weinre.web/demo/weinre-demo-min.html    |    2 +-
 weinre.web/demo/weinre-demo-strict.html |   43 ++++++
 weinre.web/demo/weinre-demo-strict.js   |  185 ++++++++++++++++++++++++++
 weinre.web/demo/weinre-demo.html        |    2 +-
 weinre.web/demo/weinre-demo.js          |    2 +
 weinre.web/index.html                   |   19 +++-
 6 files changed, 249 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/588b2e90/weinre.web/demo/weinre-demo-min.html
----------------------------------------------------------------------
diff --git a/weinre.web/demo/weinre-demo-min.html b/weinre.web/demo/weinre-demo-min.html
index 4ba3058..0da5e04 100644
--- a/weinre.web/demo/weinre-demo-min.html
+++ b/weinre.web/demo/weinre-demo-min.html
@@ -20,7 +20,7 @@
 <html>
 <head>
 <meta name="viewport" content="user-scalable=no, width=device-width, height=device-height">
-<title>weinre demo</title>
+<title>weinre minified demo</title>
 <link rel="stylesheet" href="weinre-demo.css">
 <script>try {window.WeinreServerId = location.hash.split("#")[1]} catch(e) {window.WeinreServerId
= "anonymous"}</script>
 <script src="/target/target-script-min.js"></script>

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/588b2e90/weinre.web/demo/weinre-demo-strict.html
----------------------------------------------------------------------
diff --git a/weinre.web/demo/weinre-demo-strict.html b/weinre.web/demo/weinre-demo-strict.html
new file mode 100644
index 0000000..58e13c8
--- /dev/null
+++ b/weinre.web/demo/weinre-demo-strict.html
@@ -0,0 +1,43 @@
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<html>
+<head>
+<meta name="viewport" content="user-scalable=no, width=device-width, height=device-height">
+<title>weinre non-minified strict demo</title>
+<link rel="stylesheet" href="weinre-demo.css">
+<script>try {window.WeinreServerId = location.hash.split("#")[1]} catch(e) {window.WeinreServerId
= "anonymous"}</script>
+<script src="/target/target-script.js"></script>
+<script src="weinre-demo-strict.js"></script>
+</head>
+
+<body onload="onLoad()">
+<input id="button-start-stuff" type="button" value="start stuff">
+
+<h1>this is a green h1</h1>
+<h1 class="blue">this is a blue h1</h1>
+<h1 style="color:red">this is a red h1</h1>
+<p>Some text, <i>some italic text</i>, and <b>some bold text</b>.
+
+<hr>
+<p><input id="button-clear-output" type="button" value="clear output">
+<div id="output"></div>
+</body>
+
+</html>

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/588b2e90/weinre.web/demo/weinre-demo-strict.js
----------------------------------------------------------------------
diff --git a/weinre.web/demo/weinre-demo-strict.js b/weinre.web/demo/weinre-demo-strict.js
new file mode 100644
index 0000000..d7101d2
--- /dev/null
+++ b/weinre.web/demo/weinre-demo-strict.js
@@ -0,0 +1,185 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+"use strict"
+
+//------------------------------------------------------------------------------
+var started = false
+
+var buttonStartStuff
+var buttonClearOutput
+var outputElement
+var storageIndex = 0
+var db
+var otherDB
+
+// set the id based on the hash
+var hash = location.href.split("#")[1]
+if (!hash) hash = "anonymous"
+window.WeinreServerId = hash
+
+//------------------------------------------------------------------------------
+function onLoad() {
+    if (!buttonStartStuff)       buttonStartStuff       = document.getElementById("button-start-stuff")
+    if (!buttonClearOutput)      buttonClearOutput      = document.getElementById("button-clear-output")
+    if (!outputElement)          outputElement          = document.getElementById("output")
+
+    buttonStartStuff.addEventListener("click", function() {
+        lastClickTime = new Date().toString()
+        if (db) db.transaction(addClick)
+
+        openTheOtherDatabase()
+
+        if (!started) {
+            buttonStartStuff.value = "stop stuff"
+            startStuff()
+        }
+        else {
+            buttonStartStuff.value = "start stuff"
+            stopStuff()
+        }
+        started = !started
+    })
+
+    buttonClearOutput.addEventListener("click", function() {
+        outputElement.innerHTML = ""
+    })
+
+    openTheDatabase()
+}
+
+//------------------------------------------------------------------------------
+var interval
+
+function startStuff() {
+    if (window.localStorage)   window.localStorage.clear()
+    if (window.sessionStorage) window.sessionStorage.clear()
+
+    storageIndex = 0
+
+    interval = setInterval(intervalStuff, 1000)
+}
+
+function stopStuff() {
+    clearInterval(interval)
+}
+
+//------------------------------------------------------------------------------
+function intervalStuff() {
+
+    var message = "doing interval stuff at " + new Date()
+
+    // add a timeout
+    setTimeout(function() { console.log(message)}, 333)
+
+    // add a timeline marker
+    console.markTimeline(message)
+
+    // write to local- and sessionStorage
+    if (window.localStorage) {
+        var smessage = message + " (local)"
+        window.localStorage.setItem(  "item-" + storageIndex, smessage)
+    }
+
+    if (window.sessionStorage) {
+        var smessage = message + " (session)"
+        window.sessionStorage.setItem("item-" + storageIndex, smessage)
+    }
+    storageIndex++
+
+    // write the message to the page
+    output(message)
+
+    // do an XHR
+    var xhr = new XMLHttpRequest()
+    // xhr.addEventListener("readystatechange", function() {logXhr(this)})
+    xhr.open("GET", "../target/target-script.js", true)
+    xhr.send()
+}
+
+//------------------------------------------------------------------------------
+function sqlSuccess(tx, resultSet) {
+    console.log("SQL Success!")
+}
+
+//------------------------------------------------------------------------------
+function sqlError(tx, error) {
+    console.log("SQL Error " + error.code + ": " + error.message)
+}
+
+//------------------------------------------------------------------------------
+var lastClickTime
+
+function addClick(tx) {
+    var sql = "insert into clicks (date) values (?)"
+    tx.executeSql(sql, [lastClickTime], null, sqlError)
+}
+
+//------------------------------------------------------------------------------
+function clearDatabase(tx, resultSet) {
+    var sql = "delete from clicks"
+    tx.executeSql(sql, null, null, sqlError);
+}
+
+//------------------------------------------------------------------------------
+function createDatabase(tx) {
+    var schema = "clicks (id integer primary key, date text)"
+    var sql = "create table if not exists " + schema
+
+    tx.executeSql(sql, null, clearDatabase, sqlError);
+}
+
+//------------------------------------------------------------------------------
+function createDatabase_other(tx) {
+    var schema = "clicks_other (id integer primary key, other text)"
+    var sql = "create table if not exists " + schema
+
+    tx.executeSql(sql, null, null, sqlError);
+}
+
+//------------------------------------------------------------------------------
+function openTheDatabase() {
+    if (window.openDatabase) {
+        db = window.openDatabase("clicks_db", "1.0", "clicks_db", 8192)
+        db.transaction(createDatabase)
+    }
+}
+
+//------------------------------------------------------------------------------
+function openTheOtherDatabase() {
+    if (otherDB) return
+
+    if (window.openDatabase) {
+        otherDB = window.openDatabase("clicks_other_db", "1.0", "clicks_other_db", 8192)
+        otherDB.transaction(createDatabase_other)
+    }
+}
+
+//------------------------------------------------------------------------------
+function output(string) {
+    var element = document.createElement("div")
+    element.innerHTML = string
+    outputElement.appendChild(element)
+}
+
+//------------------------------------------------------------------------------
+function logXhr(xhr) {
+    console.log("xhr: readyState: " + xhr.readyState)
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/588b2e90/weinre.web/demo/weinre-demo.html
----------------------------------------------------------------------
diff --git a/weinre.web/demo/weinre-demo.html b/weinre.web/demo/weinre-demo.html
index ba3330a..8f571fd 100644
--- a/weinre.web/demo/weinre-demo.html
+++ b/weinre.web/demo/weinre-demo.html
@@ -20,7 +20,7 @@
 <html>
 <head>
 <meta name="viewport" content="user-scalable=no, width=device-width, height=device-height">
-<title>weinre demo</title>
+<title>weinre non-minified demo</title>
 <link rel="stylesheet" href="weinre-demo.css">
 <script>try {window.WeinreServerId = location.hash.split("#")[1]} catch(e) {window.WeinreServerId
= "anonymous"}</script>
 <script src="/target/target-script.js"></script>

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/588b2e90/weinre.web/demo/weinre-demo.js
----------------------------------------------------------------------
diff --git a/weinre.web/demo/weinre-demo.js b/weinre.web/demo/weinre-demo.js
index 06de5f9..124e298 100644
--- a/weinre.web/demo/weinre-demo.js
+++ b/weinre.web/demo/weinre-demo.js
@@ -17,6 +17,8 @@
  * under the License.
  */
 
+// "use liberal"
+
 //------------------------------------------------------------------------------
 var started = false
 

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/588b2e90/weinre.web/index.html
----------------------------------------------------------------------
diff --git a/weinre.web/index.html b/weinre.web/index.html
index fd835b6..aafa583 100644
--- a/weinre.web/index.html
+++ b/weinre.web/index.html
@@ -59,9 +59,24 @@ pre, .indent {
 <table>
 <tr><td>debug client user interface: <td> <span id="url-client-ui">???</span>
 <tr><td>documentation:               <td> <span id="url-target-documentation">???</span>
-<tr><td>target demo:                 <td> <span id="url-target-demo-min">???</span>
<br><span id="url-target-demo"></span>
 </table>
 
+<h2>Target Demos</h2>
+
+<p>The following links point to an already instrumented sample application,
+run in a couple of different environmental conditions.
+
+<p>First open a new browser window for the debug client user interface, as
+specified above.  Then open another new browser window for one of the demos
+below.  They should auto-connect and result in an active debug connection
+between the client and the target demo.
+
+<ul>
+<li><a href="demo/weinre-demo.html">        the non-minified demo</a>
+<li><a href="demo/weinre-demo-min.html">    the minified demo</a>
+<li><a href="demo/weinre-demo-strict.html"> the non-minified strict demo</a>
+</ul>
+
 <h2>Target Script</h2>
 
 <p>You can use this script to inject the weinre target code into your web page.
@@ -100,7 +115,7 @@ web page you are viewing.
 <h2>Versions</h2>
 
 <table>
-<tr><td>weinre: <td> <span id="version-weinre">???</span> 
+<tr><td>weinre: <td> <span id="version-weinre">???</span>
 <tr><td>build:  <td> <span id="version-build">???</span>
 </table>
 


Mime
View raw message