From 230da0b6e83aafdf215a5c0ef3692ace6fa24da2 Mon Sep 17 00:00:00 2001 From: "gears.daemon" Date: Tue, 19 Feb 2008 20:00:30 +0000 Subject: [PATCH] [Author: steveblock] Fixes sample apps to work with WinMo devices. Adds status message to the managed store demo. Adds warning about unresponsive script popup. R=andreip,aa CC=gears-internal APPROVED=aa DELTA=20 (13 added, 0 deleted, 7 changed) OCL=6397915 SCL=6476794 git-svn-id: https://google-gears.googlecode.com/svn/trunk@980 fe895e04-df30-0410-9975-d76d301b4276 --- .../hello_world_managedstore/managed_store.js | 1 + .../hello_world_managedstore/managed_store_v1.js | 1 + .../hello_world_managedstore/managed_store_v2.js | 1 + gears/sdk/samples/hello_world_workerpool.html | 3 ++- gears/sdk/samples/sample.js | 21 +++++++++++++++------ 5 files changed, 20 insertions(+), 7 deletions(-) diff --git a/gears/sdk/samples/hello_world_managedstore/managed_store.js b/gears/sdk/samples/hello_world_managedstore/managed_store.js index f72ddfd..3f98290 100644 --- a/gears/sdk/samples/hello_world_managedstore/managed_store.js +++ b/gears/sdk/samples/hello_world_managedstore/managed_store.js @@ -25,6 +25,7 @@ // The online version function createManagedStore() { + textOut('Creating the store ...'); try { var localServer = google.gears.factory.create('beta.localserver'); } catch (ex) { diff --git a/gears/sdk/samples/hello_world_managedstore/managed_store_v1.js b/gears/sdk/samples/hello_world_managedstore/managed_store_v1.js index 1e1deba..2f347a1 100644 --- a/gears/sdk/samples/hello_world_managedstore/managed_store_v1.js +++ b/gears/sdk/samples/hello_world_managedstore/managed_store_v1.js @@ -25,6 +25,7 @@ // The offline version 1 function updateManagedStore() { + textOut('Updating the store ...'); try { var localServer = google.gears.factory.create('beta.localserver'); } catch (ex) { diff --git a/gears/sdk/samples/hello_world_managedstore/managed_store_v2.js b/gears/sdk/samples/hello_world_managedstore/managed_store_v2.js index 6526d47..88b69f4 100644 --- a/gears/sdk/samples/hello_world_managedstore/managed_store_v2.js +++ b/gears/sdk/samples/hello_world_managedstore/managed_store_v2.js @@ -25,6 +25,7 @@ // The offline version 2 function removeManagedStore() { + textOut('Removing the store ...'); try { var localServer = google.gears.factory.create('beta.localserver'); } catch (ex) { diff --git a/gears/sdk/samples/hello_world_workerpool.html b/gears/sdk/samples/hello_world_workerpool.html index eacd2c5..32f5588 100644 --- a/gears/sdk/samples/hello_world_workerpool.html +++ b/gears/sdk/samples/hello_world_workerpool.html @@ -60,7 +60,8 @@ p.results { -Note the synchronous computation blocks UI interaction. +Note the synchronous computation blocks UI interaction + (and may even cause an 'unresponsive script' warning). diff --git a/gears/sdk/samples/sample.js b/gears/sdk/samples/sample.js index 5e04414..2ba12fa 100644 --- a/gears/sdk/samples/sample.js +++ b/gears/sdk/samples/sample.js @@ -23,24 +23,33 @@ // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// Some WinCE devices use 'unknown' rather than 'undefined'. If an element has +// type 'unknown', we can not pass it to a function, so we must pass its type +// instead. +function isDefined(type) { + return (type != 'undefined' && type != 'unknown'); +} + function childNodes(element) { - if (element.childNodes) + if (isDefined(typeof element.childNodes)) { return element.childNodes; - else + } else if (isDefined(typeof element.children)) { return element.children; + } } function getElementById(element_name) { - if (document.getElementById) + if (isDefined(typeof document.getElementById)) { return document.getElementById(element_name); - else + } else if(typeof isDefined(document.all)) { return document.all[element_name]; + } } function setTextContent(elem, content) { - if (typeof elem.innerText != 'undefined') { + if (isDefined(typeof elem.innerText)) { elem.innerText = content; - } else { + } else if (isDefined(typeof elem.textContent)) { elem.textContent = content; } } -- 2.11.4.GIT