Adding the Apache Headers

This commit is contained in:
Joe Bowser 2011-10-27 14:04:39 -07:00
parent 5a40613ccc
commit a35a33c05e
19 changed files with 363 additions and 152 deletions

View File

@ -1,9 +1,20 @@
/* /*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the * Licensed to the Apache Software Foundation (ASF) under one
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text. * 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
* *
* Copyright (c) 2005-2010, Nitobi Software Inc. * http://www.apache.org/licenses/LICENSE-2.0
* Copyright (c) 2010-2011, IBM Corporation *
* 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.
*/ */
if (!PhoneGap.hasResource("accelerometer")) { if (!PhoneGap.hasResource("accelerometer")) {

View File

@ -1,9 +1,20 @@
/* /*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the * Licensed to the Apache Software Foundation (ASF) under one
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text. * 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
* *
* Copyright (c) 2005-2010, Nitobi Software Inc. * http://www.apache.org/licenses/LICENSE-2.0
* Copyright (c) 2010-2011, IBM Corporation *
* 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.
*/ */
if (!PhoneGap.hasResource("app")) { if (!PhoneGap.hasResource("app")) {

View File

@ -1,9 +1,20 @@
/* /*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the * Licensed to the Apache Software Foundation (ASF) under one
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text. * 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
* *
* Copyright (c) 2005-2010, Nitobi Software Inc. * http://www.apache.org/licenses/LICENSE-2.0
* Copyright (c) 2010-2011, IBM Corporation *
* 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.
*/ */
if (!PhoneGap.hasResource("battery")) { if (!PhoneGap.hasResource("battery")) {

View File

@ -1,9 +1,20 @@
/* /*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the * Licensed to the Apache Software Foundation (ASF) under one
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text. * 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
* *
* Copyright (c) 2005-2010, Nitobi Software Inc. * http://www.apache.org/licenses/LICENSE-2.0
* Copyright (c) 2010-2011, IBM Corporation *
* 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.
*/ */
if (!PhoneGap.hasResource("camera")) { if (!PhoneGap.hasResource("camera")) {

View File

@ -1,9 +1,20 @@
/* /*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the * Licensed to the Apache Software Foundation (ASF) under one
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text. * 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
* *
* Copyright (c) 2005-2010, Nitobi Software Inc. * http://www.apache.org/licenses/LICENSE-2.0
* Copyright (c) 2010-2011, IBM Corporation *
* 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.
*/ */
if (!PhoneGap.hasResource("capture")) { if (!PhoneGap.hasResource("capture")) {
@ -188,4 +199,4 @@ PhoneGap.addConstructor(function(){
navigator.device.capture = window.device.capture = new Capture(); navigator.device.capture = window.device.capture = new Capture();
} }
}); });
} }

View File

@ -1,9 +1,20 @@
/* /*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the * Licensed to the Apache Software Foundation (ASF) under one
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text. * 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
* *
* Copyright (c) 2005-2010, Nitobi Software Inc. * http://www.apache.org/licenses/LICENSE-2.0
* Copyright (c) 2010-2011, IBM Corporation *
* 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.
*/ */
if (!PhoneGap.hasResource("compass")) { if (!PhoneGap.hasResource("compass")) {

View File

@ -1,9 +1,20 @@
/* /*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the * Licensed to the Apache Software Foundation (ASF) under one
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text. * 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
* *
* Copyright (c) 2005-2010, Nitobi Software Inc. * http://www.apache.org/licenses/LICENSE-2.0
* Copyright (c) 2010-2011, IBM Corporation *
* 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.
*/ */
if (!PhoneGap.hasResource("contact")) { if (!PhoneGap.hasResource("contact")) {

View File

@ -1,9 +1,20 @@
/* /*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the * Licensed to the Apache Software Foundation (ASF) under one
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text. * 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
* *
* Copyright (c) 2005-2010, Nitobi Software Inc. * http://www.apache.org/licenses/LICENSE-2.0
* Copyright (c) 2010-2011, IBM Corporation *
* 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.
*/ */
// TODO: Needs to be commented // TODO: Needs to be commented

View File

@ -1,9 +1,20 @@
/* /*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the * Licensed to the Apache Software Foundation (ASF) under one
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text. * 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
* *
* Copyright (c) 2005-2010, Nitobi Software Inc. * http://www.apache.org/licenses/LICENSE-2.0
* Copyright (c) 2010-2011, IBM Corporation *
* 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.
*/ */
if (!PhoneGap.hasResource("device")) { if (!PhoneGap.hasResource("device")) {

View File

@ -1,9 +1,20 @@
/* /*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the * Licensed to the Apache Software Foundation (ASF) under one
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text. * 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
* *
* Copyright (c) 2005-2010, Nitobi Software Inc. * http://www.apache.org/licenses/LICENSE-2.0
* Copyright (c) 2010-2011, IBM Corporation *
* 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.
*/ */
if (!PhoneGap.hasResource("file")) { if (!PhoneGap.hasResource("file")) {
@ -986,4 +997,4 @@ PhoneGap.addConstructor(function() {
if(typeof window.requestFileSystem == "undefined") window.requestFileSystem = pgLocalFileSystem.requestFileSystem; if(typeof window.requestFileSystem == "undefined") window.requestFileSystem = pgLocalFileSystem.requestFileSystem;
if(typeof window.resolveLocalFileSystemURI == "undefined") window.resolveLocalFileSystemURI = pgLocalFileSystem.resolveLocalFileSystemURI; if(typeof window.resolveLocalFileSystemURI == "undefined") window.resolveLocalFileSystemURI = pgLocalFileSystem.resolveLocalFileSystemURI;
}); });
} }

View File

@ -1,9 +1,20 @@
/* /*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the * Licensed to the Apache Software Foundation (ASF) under one
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text. * 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
* *
* Copyright (c) 2005-2010, Nitobi Software Inc. * http://www.apache.org/licenses/LICENSE-2.0
* Copyright (c) 2010-2011, IBM Corporation *
* 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.
*/ */
if (!PhoneGap.hasResource("filetransfer")) { if (!PhoneGap.hasResource("filetransfer")) {

View File

@ -1,9 +1,20 @@
/* /*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the * Licensed to the Apache Software Foundation (ASF) under one
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text. * 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
* *
* Copyright (c) 2005-2010, Nitobi Software Inc. * http://www.apache.org/licenses/LICENSE-2.0
* Copyright (c) 2010-2011, IBM Corporation *
* 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.
*/ */
if (!PhoneGap.hasResource("geolocation")) { if (!PhoneGap.hasResource("geolocation")) {

View File

@ -1,7 +1,19 @@
/* /*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the * Licensed to the Apache Software Foundation (ASF) under one
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text. * 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
* *
* Copyright (c) 2005-2010, Nitobi Software Inc. * http://www.apache.org/licenses/LICENSE-2.0
* Copyright (c) 2010, IBM Corporation *
* 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.
*/ */

View File

@ -1,9 +1,20 @@
/* /*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the * Licensed to the Apache Software Foundation (ASF) under one
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text. * 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
* *
* Copyright (c) 2005-2010, Nitobi Software Inc. * http://www.apache.org/licenses/LICENSE-2.0
* Copyright (c) 2010-2011, IBM Corporation *
* 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.
*/ */
if (!PhoneGap.hasResource("media")) { if (!PhoneGap.hasResource("media")) {

View File

@ -1,11 +1,23 @@
/* /*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the * Licensed to the Apache Software Foundation (ASF) under one
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text. * 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
* *
* Copyright (c) 2005-2010, Nitobi Software Inc. * http://www.apache.org/licenses/LICENSE-2.0
* Copyright (c) 2010-2011, IBM Corporation *
* 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.
*/ */
if (!PhoneGap.hasResource("network")) { if (!PhoneGap.hasResource("network")) {
PhoneGap.addResource("network"); PhoneGap.addResource("network");

View File

@ -1,9 +1,20 @@
/* /*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the * Licensed to the Apache Software Foundation (ASF) under one
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text. * 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
* *
* Copyright (c) 2005-2010, Nitobi Software Inc. * http://www.apache.org/licenses/LICENSE-2.0
* Copyright (c) 2010-2011, IBM Corporation *
* 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.
*/ */
if (!PhoneGap.hasResource("notification")) { if (!PhoneGap.hasResource("notification")) {

View File

@ -1,9 +1,20 @@
/* /*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the * Licensed to the Apache Software Foundation (ASF) under one
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text. * 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
* *
* Copyright (c) 2005-2010, Nitobi Software Inc. * http://www.apache.org/licenses/LICENSE-2.0
* Copyright (c) 2010-2011, IBM Corporation *
* 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.
*/ */
if (typeof PhoneGap === "undefined") { if (typeof PhoneGap === "undefined") {

View File

@ -1,9 +1,20 @@
/* /*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the * Licensed to the Apache Software Foundation (ASF) under one
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text. * 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
* *
* Copyright (c) 2005-2010, Nitobi Software Inc. * http://www.apache.org/licenses/LICENSE-2.0
* Copyright (c) 2010-2011, IBM Corporation *
* 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.
*/ */
if (!PhoneGap.hasResource("position")) { if (!PhoneGap.hasResource("position")) {

View File

@ -1,9 +1,20 @@
/* /*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the * Licensed to the Apache Software Foundation (ASF) under one
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text. * 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
* *
* Copyright (c) 2005-2010, Nitobi Software Inc. * http://www.apache.org/licenses/LICENSE-2.0
* Copyright (c) 2010-2011, IBM Corporation *
* 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.
*/ */
/* /*
@ -311,83 +322,83 @@ var DroidDB_openDatabase = function(name, version, display_name, size) {
* @constructor * @constructor
*/ */
var CupcakeLocalStorage = function() { var CupcakeLocalStorage = function() {
try { try {
this.db = openDatabase('localStorage', '1.0', 'localStorage', 2621440); this.db = openDatabase('localStorage', '1.0', 'localStorage', 2621440);
var storage = {}; var storage = {};
this.length = 0; this.length = 0;
function setLength (length) { function setLength (length) {
this.length = length; this.length = length;
localStorage.length = length; localStorage.length = length;
} }
this.db.transaction( this.db.transaction(
function (transaction) { function (transaction) {
var i; var i;
transaction.executeSql('CREATE TABLE IF NOT EXISTS storage (id NVARCHAR(40) PRIMARY KEY, body NVARCHAR(255))'); transaction.executeSql('CREATE TABLE IF NOT EXISTS storage (id NVARCHAR(40) PRIMARY KEY, body NVARCHAR(255))');
transaction.executeSql('SELECT * FROM storage', [], function(tx, result) { transaction.executeSql('SELECT * FROM storage', [], function(tx, result) {
for(var i = 0; i < result.rows.length; i++) { for(var i = 0; i < result.rows.length; i++) {
storage[result.rows.item(i)['id']] = result.rows.item(i)['body']; storage[result.rows.item(i)['id']] = result.rows.item(i)['body'];
} }
setLength(result.rows.length); setLength(result.rows.length);
PhoneGap.initializationComplete("cupcakeStorage"); PhoneGap.initializationComplete("cupcakeStorage");
}); });
}, },
function (err) { function (err) {
alert(err.message); alert(err.message);
} }
); );
this.setItem = function(key, val) { this.setItem = function(key, val) {
if (typeof(storage[key])=='undefined') { if (typeof(storage[key])=='undefined') {
this.length++; this.length++;
} }
storage[key] = val; storage[key] = val;
this.db.transaction( this.db.transaction(
function (transaction) { function (transaction) {
transaction.executeSql('CREATE TABLE IF NOT EXISTS storage (id NVARCHAR(40) PRIMARY KEY, body NVARCHAR(255))'); transaction.executeSql('CREATE TABLE IF NOT EXISTS storage (id NVARCHAR(40) PRIMARY KEY, body NVARCHAR(255))');
transaction.executeSql('REPLACE INTO storage (id, body) values(?,?)', [key,val]); transaction.executeSql('REPLACE INTO storage (id, body) values(?,?)', [key,val]);
} }
); );
}; };
this.getItem = function(key) { this.getItem = function(key) {
return storage[key]; return storage[key];
}; };
this.removeItem = function(key) { this.removeItem = function(key) {
delete storage[key]; delete storage[key];
this.length--; this.length--;
this.db.transaction( this.db.transaction(
function (transaction) { function (transaction) {
transaction.executeSql('CREATE TABLE IF NOT EXISTS storage (id NVARCHAR(40) PRIMARY KEY, body NVARCHAR(255))'); transaction.executeSql('CREATE TABLE IF NOT EXISTS storage (id NVARCHAR(40) PRIMARY KEY, body NVARCHAR(255))');
transaction.executeSql('DELETE FROM storage where id=?', [key]); transaction.executeSql('DELETE FROM storage where id=?', [key]);
} }
); );
}; };
this.clear = function() { this.clear = function() {
storage = {}; storage = {};
this.length = 0; this.length = 0;
this.db.transaction( this.db.transaction(
function (transaction) { function (transaction) {
transaction.executeSql('CREATE TABLE IF NOT EXISTS storage (id NVARCHAR(40) PRIMARY KEY, body NVARCHAR(255))'); transaction.executeSql('CREATE TABLE IF NOT EXISTS storage (id NVARCHAR(40) PRIMARY KEY, body NVARCHAR(255))');
transaction.executeSql('DELETE FROM storage', []); transaction.executeSql('DELETE FROM storage', []);
} }
); );
}; };
this.key = function(index) { this.key = function(index) {
var i = 0; var i = 0;
for (var j in storage) { for (var j in storage) {
if (i==index) { if (i==index) {
return j; return j;
} else { } else {
i++; i++;
} }
} }
return null; return null;
}; };
} catch(e) { } catch(e) {
alert("Database error "+e+"."); alert("Database error "+e+".");
return; return;
} }
}; };
PhoneGap.addConstructor(function() { PhoneGap.addConstructor(function() {