You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by fi...@apache.org on 2012/03/09 21:36:51 UTC
[2/5] removed old javascript files and removed unused target +
commented out lines in build.xml
http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/f3c96ce1/framework/assets/js/file.js
----------------------------------------------------------------------
diff --git a/framework/assets/js/file.js b/framework/assets/js/file.js
deleted file mode 100755
index 5d14b8e..0000000
--- a/framework/assets/js/file.js
+++ /dev/null
@@ -1,1082 +0,0 @@
-/*
- * 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.
- */
-
-if (!Cordova.hasResource("file")) {
-Cordova.addResource("file");
-
-/**
- * This class provides some useful information about a file.
- * @constructor
- */
-var FileProperties = function(filePath) {
- this.filePath = filePath;
- this.size = 0;
- this.lastModifiedDate = null;
-};
-
-/**
- * Represents a single file.
- *
- * @constructor
- * @param name {DOMString} name of the file, without path information
- * @param fullPath {DOMString} the full path of the file, including the name
- * @param type {DOMString} mime type
- * @param lastModifiedDate {Date} last modified date
- * @param size {Number} size of the file in bytes
- */
-var File = function(name, fullPath, type, lastModifiedDate, size) {
- this.name = name || null;
- this.fullPath = fullPath || null;
- this.type = type || null;
- this.lastModifiedDate = lastModifiedDate || null;
- this.size = size || 0;
-};
-
-/** @constructor */
-var FileError = function() {
- this.code = null;
-};
-
-// File error codes
-// Found in DOMException
-FileError.NOT_FOUND_ERR = 1;
-FileError.SECURITY_ERR = 2;
-FileError.ABORT_ERR = 3;
-
-// Added by this specification
-FileError.NOT_READABLE_ERR = 4;
-FileError.ENCODING_ERR = 5;
-FileError.NO_MODIFICATION_ALLOWED_ERR = 6;
-FileError.INVALID_STATE_ERR = 7;
-FileError.SYNTAX_ERR = 8;
-FileError.INVALID_MODIFICATION_ERR = 9;
-FileError.QUOTA_EXCEEDED_ERR = 10;
-FileError.TYPE_MISMATCH_ERR = 11;
-FileError.PATH_EXISTS_ERR = 12;
-
-//-----------------------------------------------------------------------------
-// File Reader
-//-----------------------------------------------------------------------------
-
-/**
- * This class reads the mobile device file system.
- *
- * For Android:
- * The root directory is the root of the file system.
- * To read from the SD card, the file name is "sdcard/my_file.txt"
- * @constructor
- */
-var FileReader = function() {
- this.fileName = "";
-
- this.readyState = 0;
-
- // File data
- this.result = null;
-
- // Error
- this.error = null;
-
- // Event handlers
- this.onloadstart = null; // When the read starts.
- this.onprogress = null; // While reading (and decoding) file or fileBlob data, and reporting partial file data (progess.loaded/progress.total)
- this.onload = null; // When the read has successfully completed.
- this.onerror = null; // When the read has failed (see errors).
- this.onloadend = null; // When the request has completed (either in success or failure).
- this.onabort = null; // When the read has been aborted. For instance, by invoking the abort() method.
-};
-
-// States
-FileReader.EMPTY = 0;
-FileReader.LOADING = 1;
-FileReader.DONE = 2;
-
-/**
- * Abort reading file.
- */
-FileReader.prototype.abort = function() {
- var evt;
- this.readyState = FileReader.DONE;
- this.result = null;
-
- // set error
- var error = new FileError();
- error.code = error.ABORT_ERR;
- this.error = error;
-
- // If error callback
- if (typeof this.onerror === "function") {
- this.onerror({"type":"error", "target":this});
- }
- // If abort callback
- if (typeof this.onabort === "function") {
- this.onabort({"type":"abort", "target":this});
- }
- // If load end callback
- if (typeof this.onloadend === "function") {
- this.onloadend({"type":"loadend", "target":this});
- }
-};
-
-/**
- * Read text file.
- *
- * @param file {File} File object containing file properties
- * @param encoding [Optional] (see http://www.iana.org/assignments/character-sets)
- */
-FileReader.prototype.readAsText = function(file, encoding) {
- this.fileName = "";
- if (typeof file.fullPath === "undefined") {
- this.fileName = file;
- } else {
- this.fileName = file.fullPath;
- }
-
- // LOADING state
- this.readyState = FileReader.LOADING;
-
- // If loadstart callback
- if (typeof this.onloadstart === "function") {
- this.onloadstart({"type":"loadstart", "target":this});
- }
-
- // Default encoding is UTF-8
- var enc = encoding ? encoding : "UTF-8";
-
- var me = this;
-
- // Read file
- Cordova.exec(
- // Success callback
- function(r) {
- var evt;
-
- // If DONE (cancelled), then don't do anything
- if (me.readyState === FileReader.DONE) {
- return;
- }
-
- // Save result
- me.result = r;
-
- // If onload callback
- if (typeof me.onload === "function") {
- me.onload({"type":"load", "target":me});
- }
-
- // DONE state
- me.readyState = FileReader.DONE;
-
- // If onloadend callback
- if (typeof me.onloadend === "function") {
- me.onloadend({"type":"loadend", "target":me});
- }
- },
- // Error callback
- function(e) {
- var evt;
- // If DONE (cancelled), then don't do anything
- if (me.readyState === FileReader.DONE) {
- return;
- }
-
- // Save error
- me.error = e;
-
- // If onerror callback
- if (typeof me.onerror === "function") {
- me.onerror({"type":"error", "target":me});
- }
-
- // DONE state
- me.readyState = FileReader.DONE;
-
- // If onloadend callback
- if (typeof me.onloadend === "function") {
- me.onloadend({"type":"loadend", "target":me});
- }
- }, "File", "readAsText", [this.fileName, enc]);
-};
-
-
-/**
- * Read file and return data as a base64 encoded data url.
- * A data url is of the form:
- * data:[<mediatype>][;base64],<data>
- *
- * @param file {File} File object containing file properties
- */
-FileReader.prototype.readAsDataURL = function(file) {
- this.fileName = "";
- if (typeof file.fullPath === "undefined") {
- this.fileName = file;
- } else {
- this.fileName = file.fullPath;
- }
-
- // LOADING state
- this.readyState = FileReader.LOADING;
-
- // If loadstart callback
- if (typeof this.onloadstart === "function") {
- this.onloadstart({"type":"loadstart", "target":this});
- }
-
- var me = this;
-
- // Read file
- Cordova.exec(
- // Success callback
- function(r) {
- var evt;
-
- // If DONE (cancelled), then don't do anything
- if (me.readyState === FileReader.DONE) {
- return;
- }
-
- // Save result
- me.result = r;
-
- // If onload callback
- if (typeof me.onload === "function") {
- me.onload({"type":"load", "target":me});
- }
-
- // DONE state
- me.readyState = FileReader.DONE;
-
- // If onloadend callback
- if (typeof me.onloadend === "function") {
- me.onloadend({"type":"loadend", "target":me});
- }
- },
- // Error callback
- function(e) {
- var evt;
- // If DONE (cancelled), then don't do anything
- if (me.readyState === FileReader.DONE) {
- return;
- }
-
- // Save error
- me.error = e;
-
- // If onerror callback
- if (typeof me.onerror === "function") {
- me.onerror({"type":"error", "target":me});
- }
-
- // DONE state
- me.readyState = FileReader.DONE;
-
- // If onloadend callback
- if (typeof me.onloadend === "function") {
- me.onloadend({"type":"loadend", "target":me});
- }
- }, "File", "readAsDataURL", [this.fileName]);
-};
-
-/**
- * Read file and return data as a binary data.
- *
- * @param file {File} File object containing file properties
- */
-FileReader.prototype.readAsBinaryString = function(file) {
- // TODO - Can't return binary data to browser.
- this.fileName = file;
-};
-
-/**
- * Read file and return data as a binary data.
- *
- * @param file {File} File object containing file properties
- */
-FileReader.prototype.readAsArrayBuffer = function(file) {
- // TODO - Can't return binary data to browser.
- this.fileName = file;
-};
-
-//-----------------------------------------------------------------------------
-// File Writer
-//-----------------------------------------------------------------------------
-
-/**
- * This class writes to the mobile device file system.
- *
- * For Android:
- * The root directory is the root of the file system.
- * To write to the SD card, the file name is "sdcard/my_file.txt"
- *
- * @constructor
- * @param file {File} File object containing file properties
- * @param append if true write to the end of the file, otherwise overwrite the file
- */
-var FileWriter = function(file) {
- this.fileName = "";
- this.length = 0;
- if (file) {
- this.fileName = file.fullPath || file;
- this.length = file.size || 0;
- }
- // default is to write at the beginning of the file
- this.position = 0;
-
- this.readyState = 0; // EMPTY
-
- this.result = null;
-
- // Error
- this.error = null;
-
- // Event handlers
- this.onwritestart = null; // When writing starts
- this.onprogress = null; // While writing the file, and reporting partial file data
- this.onwrite = null; // When the write has successfully completed.
- this.onwriteend = null; // When the request has completed (either in success or failure).
- this.onabort = null; // When the write has been aborted. For instance, by invoking the abort() method.
- this.onerror = null; // When the write has failed (see errors).
-};
-
-// States
-FileWriter.INIT = 0;
-FileWriter.WRITING = 1;
-FileWriter.DONE = 2;
-
-/**
- * Abort writing file.
- */
-FileWriter.prototype.abort = function() {
- // check for invalid state
- if (this.readyState === FileWriter.DONE || this.readyState === FileWriter.INIT) {
- throw FileError.INVALID_STATE_ERR;
- }
-
- // set error
- var error = new FileError(), evt;
- error.code = error.ABORT_ERR;
- this.error = error;
-
- // If error callback
- if (typeof this.onerror === "function") {
- this.onerror({"type":"error", "target":this});
- }
- // If abort callback
- if (typeof this.onabort === "function") {
- this.onabort({"type":"abort", "target":this});
- }
-
- this.readyState = FileWriter.DONE;
-
- // If write end callback
- if (typeof this.onwriteend === "function") {
- this.onwriteend({"type":"writeend", "target":this});
- }
-};
-
-/**
- * Writes data to the file
- *
- * @param text to be written
- */
-FileWriter.prototype.write = function(text) {
- // Throw an exception if we are already writing a file
- if (this.readyState === FileWriter.WRITING) {
- throw FileError.INVALID_STATE_ERR;
- }
-
- // WRITING state
- this.readyState = FileWriter.WRITING;
-
- var me = this;
-
- // If onwritestart callback
- if (typeof me.onwritestart === "function") {
- me.onwritestart({"type":"writestart", "target":me});
- }
-
- // Write file
- Cordova.exec(
- // Success callback
- function(r) {
- var evt;
- // If DONE (cancelled), then don't do anything
- if (me.readyState === FileWriter.DONE) {
- return;
- }
-
- // position always increases by bytes written because file would be extended
- me.position += r;
- // The length of the file is now where we are done writing.
- me.length = me.position;
-
- // If onwrite callback
- if (typeof me.onwrite === "function") {
- me.onwrite({"type":"write", "target":me});
- }
-
- // DONE state
- me.readyState = FileWriter.DONE;
-
- // If onwriteend callback
- if (typeof me.onwriteend === "function") {
- me.onwriteend({"type":"writeend", "target":me});
- }
- },
- // Error callback
- function(e) {
- var evt;
-
- // If DONE (cancelled), then don't do anything
- if (me.readyState === FileWriter.DONE) {
- return;
- }
-
- // Save error
- me.error = e;
-
- // If onerror callback
- if (typeof me.onerror === "function") {
- me.onerror({"type":"error", "target":me});
- }
-
- // DONE state
- me.readyState = FileWriter.DONE;
-
- // If onwriteend callback
- if (typeof me.onwriteend === "function") {
- me.onwriteend({"type":"writeend", "target":me});
- }
- }, "File", "write", [this.fileName, text, this.position]);
-};
-
-/**
- * Moves the file pointer to the location specified.
- *
- * If the offset is a negative number the position of the file
- * pointer is rewound. If the offset is greater than the file
- * size the position is set to the end of the file.
- *
- * @param offset is the location to move the file pointer to.
- */
-FileWriter.prototype.seek = function(offset) {
- // Throw an exception if we are already writing a file
- if (this.readyState === FileWriter.WRITING) {
- throw FileError.INVALID_STATE_ERR;
- }
-
- if (!offset) {
- return;
- }
-
- // See back from end of file.
- if (offset < 0) {
- this.position = Math.max(offset + this.length, 0);
- }
- // Offset is bigger then file size so set position
- // to the end of the file.
- else if (offset > this.length) {
- this.position = this.length;
- }
- // Offset is between 0 and file size so set the position
- // to start writing.
- else {
- this.position = offset;
- }
-};
-
-/**
- * Truncates the file to the size specified.
- *
- * @param size to chop the file at.
- */
-FileWriter.prototype.truncate = function(size) {
- // Throw an exception if we are already writing a file
- if (this.readyState === FileWriter.WRITING) {
- throw FileError.INVALID_STATE_ERR;
- }
-
- // WRITING state
- this.readyState = FileWriter.WRITING;
-
- var me = this;
-
- // If onwritestart callback
- if (typeof me.onwritestart === "function") {
- me.onwritestart({"type":"writestart", "target":this});
- }
-
- // Write file
- Cordova.exec(
- // Success callback
- function(r) {
- var evt;
- // If DONE (cancelled), then don't do anything
- if (me.readyState === FileWriter.DONE) {
- return;
- }
-
- // Update the length of the file
- me.length = r;
- me.position = Math.min(me.position, r);
-
- // If onwrite callback
- if (typeof me.onwrite === "function") {
- me.onwrite({"type":"write", "target":me});
- }
-
- // DONE state
- me.readyState = FileWriter.DONE;
-
- // If onwriteend callback
- if (typeof me.onwriteend === "function") {
- me.onwriteend({"type":"writeend", "target":me});
- }
- },
- // Error callback
- function(e) {
- var evt;
- // If DONE (cancelled), then don't do anything
- if (me.readyState === FileWriter.DONE) {
- return;
- }
-
- // Save error
- me.error = e;
-
- // If onerror callback
- if (typeof me.onerror === "function") {
- me.onerror({"type":"error", "target":me});
- }
-
- // DONE state
- me.readyState = FileWriter.DONE;
-
- // If onwriteend callback
- if (typeof me.onwriteend === "function") {
- me.onwriteend({"type":"writeend", "target":me});
- }
- }, "File", "truncate", [this.fileName, size]);
-};
-
-/**
- * Information about the state of the file or directory
- *
- * @constructor
- * {Date} modificationTime (readonly)
- */
-var Metadata = function() {
- this.modificationTime=null;
-};
-
-/**
- * Supplies arguments to methods that lookup or create files and directories
- *
- * @constructor
- * @param {boolean} create file or directory if it doesn't exist
- * @param {boolean} exclusive if true the command will fail if the file or directory exists
- */
-var Flags = function(create, exclusive) {
- this.create = create || false;
- this.exclusive = exclusive || false;
-};
-
-/**
- * An interface representing a file system
- *
- * @constructor
- * {DOMString} name the unique name of the file system (readonly)
- * {DirectoryEntry} root directory of the file system (readonly)
- */
-var FileSystem = function() {
- this.name = null;
- this.root = null;
-};
-
-/**
- * An interface that lists the files and directories in a directory.
- * @constructor
- */
-var DirectoryReader = function(fullPath){
- this.fullPath = fullPath || null;
-};
-
-/**
- * Returns a list of entries from a directory.
- *
- * @param {Function} successCallback is called with a list of entries
- * @param {Function} errorCallback is called with a FileError
- */
-DirectoryReader.prototype.readEntries = function(successCallback, errorCallback) {
- var win = function(result) {
- var retVal = [];
- for (var i=0; i<result.length; i++) {
- var entry = null;
- if (result[i].isDirectory) {
- entry = new DirectoryEntry();
- }
- else if (result[i].isFile) {
- entry = new FileEntry();
- }
- entry.isDirectory = result[i].isDirectory;
- entry.isFile = result[i].isFile;
- entry.name = result[i].name;
- entry.fullPath = result[i].fullPath;
- retVal.push(entry);
- }
- successCallback(retVal);
- };
- Cordova.exec(win, errorCallback, "File", "readEntries", [this.fullPath]);
-};
-
-/**
- * An interface representing a directory on the file system.
- *
- * @constructor
- * {boolean} isFile always false (readonly)
- * {boolean} isDirectory always true (readonly)
- * {DOMString} name of the directory, excluding the path leading to it (readonly)
- * {DOMString} fullPath the absolute full path to the directory (readonly)
- * {FileSystem} filesystem on which the directory resides (readonly)
- */
-var DirectoryEntry = function() {
- this.isFile = false;
- this.isDirectory = true;
- this.name = null;
- this.fullPath = null;
- this.filesystem = null;
-};
-
-/**
- * Copies a directory to a new location
- *
- * @param {DirectoryEntry} parent the directory to which to copy the entry
- * @param {DOMString} newName the new name of the entry, defaults to the current name
- * @param {Function} successCallback is called with the new entry
- * @param {Function} errorCallback is called with a FileError
- */
-DirectoryEntry.prototype.copyTo = function(parent, newName, successCallback, errorCallback) {
- var win = function(result) {
- var entry = null;
- if (result.isDirectory) {
- entry = new DirectoryEntry();
- }
- else if (result.isFile) {
- entry = new FileEntry();
- }
- entry.isDirectory = result.isDirectory;
- entry.isFile = result.isFile;
- entry.name = result.name;
- entry.fullPath = result.fullPath;
- successCallback(entry);
- };
- Cordova.exec(win, errorCallback, "File", "copyTo", [this.fullPath, parent, newName]);
-};
-
-/**
- * Looks up the metadata of the entry
- *
- * @param {Function} successCallback is called with a Metadata object
- * @param {Function} errorCallback is called with a FileError
- */
-DirectoryEntry.prototype.getMetadata = function(successCallback, errorCallback) {
- var win = function(result) {
- result.modificationTime = new Date(result.modificationTime);
- successCallback(result);
- };
- Cordova.exec(win, errorCallback, "File", "getMetadata", [this.fullPath]);
-};
-
-/**
- * Gets the parent of the entry
- *
- * @param {Function} successCallback is called with a parent entry
- * @param {Function} errorCallback is called with a FileError
- */
-DirectoryEntry.prototype.getParent = function(successCallback, errorCallback) {
- var win = function(result) {
- var entry = null;
- entry = new DirectoryEntry();
- entry.isDirectory = result.isDirectory;
- entry.isFile = result.isFile;
- entry.name = result.name;
- entry.fullPath = result.fullPath;
- successCallback(entry);
- };
- Cordova.exec(win, errorCallback, "File", "getParent", [this.fullPath]);
-};
-
-/**
- * Moves a directory to a new location
- *
- * @param {DirectoryEntry} parent the directory to which to move the entry
- * @param {DOMString} newName the new name of the entry, defaults to the current name
- * @param {Function} successCallback is called with the new entry
- * @param {Function} errorCallback is called with a FileError
- */
-DirectoryEntry.prototype.moveTo = function(parent, newName, successCallback, errorCallback) {
- var win = function(result) {
- var entry = null;
- if (result.isDirectory) {
- entry = new DirectoryEntry();
- }
- else if (result.isFile) {
- entry = new FileEntry();
- }
- entry.isDirectory = result.isDirectory;
- entry.isFile = result.isFile;
- entry.name = result.name;
- entry.fullPath = result.fullPath;
- successCallback(entry);
- };
- Cordova.exec(win, errorCallback, "File", "moveTo", [this.fullPath, parent, newName]);
-};
-
-/**
- * Removes the entry
- *
- * @param {Function} successCallback is called with no parameters
- * @param {Function} errorCallback is called with a FileError
- */
-DirectoryEntry.prototype.remove = function(successCallback, errorCallback) {
- Cordova.exec(successCallback, errorCallback, "File", "remove", [this.fullPath]);
-};
-
-/**
- * Returns a URI that can be used to identify this entry.
- *
- * @param {DOMString} mimeType for a FileEntry, the mime type to be used to interpret the file, when loaded through this URI.
- * @return uri
- */
-DirectoryEntry.prototype.toURI = function(mimeType) {
- return "file://" + this.fullPath;
-};
-
-/**
- * Creates a new DirectoryReader to read entries from this directory
- */
-DirectoryEntry.prototype.createReader = function(successCallback, errorCallback) {
- return new DirectoryReader(this.fullPath);
-};
-
-/**
- * Creates or looks up a directory
- *
- * @param {DOMString} path either a relative or absolute path from this directory in which to look up or create a directory
- * @param {Flags} options to create or excluively create the directory
- * @param {Function} successCallback is called with the new entry
- * @param {Function} errorCallback is called with a FileError
- */
-DirectoryEntry.prototype.getDirectory = function(path, options, successCallback, errorCallback) {
- var win = function(result) {
- var entry = null;
- entry = new DirectoryEntry();
- entry.isDirectory = result.isDirectory;
- entry.isFile = result.isFile;
- entry.name = result.name;
- entry.fullPath = result.fullPath;
- successCallback(entry);
- };
- Cordova.exec(win, errorCallback, "File", "getDirectory", [this.fullPath, path, options]);
-};
-
-/**
- * Creates or looks up a file
- *
- * @param {DOMString} path either a relative or absolute path from this directory in which to look up or create a file
- * @param {Flags} options to create or excluively create the file
- * @param {Function} successCallback is called with the new entry
- * @param {Function} errorCallback is called with a FileError
- */
-DirectoryEntry.prototype.getFile = function(path, options, successCallback, errorCallback) {
- var win = function(result) {
- var entry = null;
- entry = new FileEntry();
- entry.isDirectory = result.isDirectory;
- entry.isFile = result.isFile;
- entry.name = result.name;
- entry.fullPath = result.fullPath;
- successCallback(entry);
- };
- Cordova.exec(win, errorCallback, "File", "getFile", [this.fullPath, path, options]);
-};
-
-/**
- * Deletes a directory and all of it's contents
- *
- * @param {Function} successCallback is called with no parameters
- * @param {Function} errorCallback is called with a FileError
- */
-DirectoryEntry.prototype.removeRecursively = function(successCallback, errorCallback) {
- Cordova.exec(successCallback, errorCallback, "File", "removeRecursively", [this.fullPath]);
-};
-
-/**
- * An interface representing a directory on the file system.
- *
- * @constructor
- * {boolean} isFile always true (readonly)
- * {boolean} isDirectory always false (readonly)
- * {DOMString} name of the file, excluding the path leading to it (readonly)
- * {DOMString} fullPath the absolute full path to the file (readonly)
- * {FileSystem} filesystem on which the directory resides (readonly)
- */
-var FileEntry = function() {
- this.isFile = true;
- this.isDirectory = false;
- this.name = null;
- this.fullPath = null;
- this.filesystem = null;
-};
-
-/**
- * Copies a file to a new location
- *
- * @param {DirectoryEntry} parent the directory to which to copy the entry
- * @param {DOMString} newName the new name of the entry, defaults to the current name
- * @param {Function} successCallback is called with the new entry
- * @param {Function} errorCallback is called with a FileError
- */
-FileEntry.prototype.copyTo = function(parent, newName, successCallback, errorCallback) {
- var win = function(result) {
- var entry = null;
- if (result.isDirectory) {
- entry = new DirectoryEntry();
- }
- else if (result.isFile) {
- entry = new FileEntry();
- }
- entry.isDirectory = result.isDirectory;
- entry.isFile = result.isFile;
- entry.name = result.name;
- entry.fullPath = result.fullPath;
- successCallback(entry);
- };
- Cordova.exec(win, errorCallback, "File", "copyTo", [this.fullPath, parent, newName]);
-};
-
-/**
- * Looks up the metadata of the entry
- *
- * @param {Function} successCallback is called with a Metadata object
- * @param {Function} errorCallback is called with a FileError
- */
-FileEntry.prototype.getMetadata = function(successCallback, errorCallback) {
- var win = function(result) {
- result.modificationTime = new Date(result.modificationTime);
- successCallback(result);
- };
- Cordova.exec(win, errorCallback, "File", "getMetadata", [this.fullPath]);
-};
-
-/**
- * Gets the parent of the entry
- *
- * @param {Function} successCallback is called with a parent entry
- * @param {Function} errorCallback is called with a FileError
- */
-FileEntry.prototype.getParent = function(successCallback, errorCallback) {
- var win = function(result) {
- var entry = null;
- entry = new DirectoryEntry();
- entry.isDirectory = result.isDirectory;
- entry.isFile = result.isFile;
- entry.name = result.name;
- entry.fullPath = result.fullPath;
- successCallback(entry);
- };
- Cordova.exec(win, errorCallback, "File", "getParent", [this.fullPath]);
-};
-
-/**
- * Moves a directory to a new location
- *
- * @param {DirectoryEntry} parent the directory to which to move the entry
- * @param {DOMString} newName the new name of the entry, defaults to the current name
- * @param {Function} successCallback is called with the new entry
- * @param {Function} errorCallback is called with a FileError
- */
-FileEntry.prototype.moveTo = function(parent, newName, successCallback, errorCallback) {
- var win = function(result) {
- var entry = null;
- if (result.isDirectory) {
- entry = new DirectoryEntry();
- }
- else if (result.isFile) {
- entry = new FileEntry();
- }
- entry.isDirectory = result.isDirectory;
- entry.isFile = result.isFile;
- entry.name = result.name;
- entry.fullPath = result.fullPath;
- successCallback(entry);
- };
- Cordova.exec(win, errorCallback, "File", "moveTo", [this.fullPath, parent, newName]);
-};
-
-/**
- * Removes the entry
- *
- * @param {Function} successCallback is called with no parameters
- * @param {Function} errorCallback is called with a FileError
- */
-FileEntry.prototype.remove = function(successCallback, errorCallback) {
- Cordova.exec(successCallback, errorCallback, "File", "remove", [this.fullPath]);
-};
-
-/**
- * Returns a URI that can be used to identify this entry.
- *
- * @param {DOMString} mimeType for a FileEntry, the mime type to be used to interpret the file, when loaded through this URI.
- * @return uri
- */
-FileEntry.prototype.toURI = function(mimeType) {
- return "file://" + this.fullPath;
-};
-
-/**
- * Creates a new FileWriter associated with the file that this FileEntry represents.
- *
- * @param {Function} successCallback is called with the new FileWriter
- * @param {Function} errorCallback is called with a FileError
- */
-FileEntry.prototype.createWriter = function(successCallback, errorCallback) {
- this.file(function(filePointer) {
- var writer = new FileWriter(filePointer);
-
- if (writer.fileName === null || writer.fileName === "") {
- if (typeof errorCallback === "function") {
- errorCallback({
- "code": FileError.INVALID_STATE_ERR
- });
- }
- }
-
- if (typeof successCallback === "function") {
- successCallback(writer);
- }
- }, errorCallback);
-};
-
-/**
- * Returns a File that represents the current state of the file that this FileEntry represents.
- *
- * @param {Function} successCallback is called with the new File object
- * @param {Function} errorCallback is called with a FileError
- */
-FileEntry.prototype.file = function(successCallback, errorCallback) {
- var win = function(result) {
- var file = new File();
- file.size = result.size;
- file.type = result.type;
- file.name = result.name;
- file.fullPath = result.fullPath;
- file.lastModifiedDate = new Date(result.lastModifiedDate);
- successCallback(file);
- };
- Cordova.exec(win, errorCallback, "File", "getFileMetadata", [this.fullPath]);
-};
-
-/** @constructor */
-var LocalFileSystem = function() {
-};
-
-// File error codes
-LocalFileSystem.TEMPORARY = 0;
-LocalFileSystem.PERSISTENT = 1;
-LocalFileSystem.RESOURCE = 2;
-LocalFileSystem.APPLICATION = 3;
-
-/**
- * Requests a filesystem in which to store application data.
- *
- * @param {int} type of file system being requested
- * @param {Function} successCallback is called with the new FileSystem
- * @param {Function} errorCallback is called with a FileError
- */
-LocalFileSystem.prototype.requestFileSystem = function(type, size, successCallback, errorCallback) {
- if (type < 0 || type > 3) {
- if (typeof errorCallback === "function") {
- errorCallback({
- "code": FileError.SYNTAX_ERR
- });
- }
- }
- else {
- var win = function(result){
- console.log("in win of requestFileSystem");
- console.log("Result: " + JSON.stringify(result));
- var entry = null;
- entry = new DirectoryEntry();
- entry.isDirectory = result.root.isDirectory;
- entry.isFile = result.root.isFile;
- entry.name = result.root.name;
- entry.fullPath = result.root.fullPath;
- result.root = entry;
- successCallback(result);
- };
- console.log("about to call requestFileSystem");
- Cordova.exec(win, errorCallback, "File", "requestFileSystem", [type, size]);
- }
-};
-
-/**
- *
- * @param {DOMString} uri referring to a local file in a filesystem
- * @param {Function} successCallback is called with the new entry
- * @param {Function} errorCallback is called with a FileError
- */
-LocalFileSystem.prototype.resolveLocalFileSystemURI = function(uri, successCallback, errorCallback) {
- var win = function(result) {
- console.log("in win of resolveLocalFileSystemURI");
- console.log("Result: " + JSON.stringify(result));
- var entry = null;
- if (result.isDirectory) {
- entry = new DirectoryEntry();
- }
- else if (result.isFile) {
- entry = new FileEntry();
- }
- entry.isDirectory = result.isDirectory;
- entry.isFile = result.isFile;
- entry.name = result.name;
- entry.fullPath = result.fullPath;
- successCallback(entry);
- };
- console.log("about to call resolveLocalFileSystemURI");
- Cordova.exec(win, errorCallback, "File", "resolveLocalFileSystemURI", [uri]);
-};
-
-/**
- * Add the FileSystem interface into the browser.
- */
-Cordova.addConstructor(function() {
- var pgLocalFileSystem = new LocalFileSystem();
- // Needed for cast methods
- if (typeof window.localFileSystem === "undefined") {
- window.localFileSystem = pgLocalFileSystem;
- }
- if (typeof window.requestFileSystem === "undefined") {
- window.requestFileSystem = pgLocalFileSystem.requestFileSystem;
- }
- if (typeof window.resolveLocalFileSystemURI === "undefined") {
- window.resolveLocalFileSystemURI = pgLocalFileSystem.resolveLocalFileSystemURI;
- }
-});
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/f3c96ce1/framework/assets/js/filetransfer.js
----------------------------------------------------------------------
diff --git a/framework/assets/js/filetransfer.js b/framework/assets/js/filetransfer.js
deleted file mode 100644
index cee5a34..0000000
--- a/framework/assets/js/filetransfer.js
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * 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.
- */
-
-if (!Cordova.hasResource("filetransfer")) {
-Cordova.addResource("filetransfer");
-
-/**
- * FileTransfer uploads a file to a remote server.
- * @constructor
- */
-var FileTransfer = function() {};
-
-/**
- * FileUploadResult
- * @constructor
- */
-var FileUploadResult = function() {
- this.bytesSent = 0;
- this.responseCode = null;
- this.response = null;
-};
-
-/**
- * FileTransferError
- * @constructor
- */
-var FileTransferError = function() {
- this.code = null;
-};
-
-FileTransferError.FILE_NOT_FOUND_ERR = 1;
-FileTransferError.INVALID_URL_ERR = 2;
-FileTransferError.CONNECTION_ERR = 3;
-
-/**
-* Given an absolute file path, uploads a file on the device to a remote server
-* using a multipart HTTP request.
-* @param filePath {String} Full path of the file on the device
-* @param server {String} URL of the server to receive the file
-* @param successCallback (Function} Callback to be invoked when upload has completed
-* @param errorCallback {Function} Callback to be invoked upon error
-* @param options {FileUploadOptions} Optional parameters such as file name and mimetype
-*/
-FileTransfer.prototype.upload = function(filePath, server, successCallback, errorCallback, options, debug) {
-
- // check for options
- var fileKey = null;
- var fileName = null;
- var mimeType = null;
- var params = null;
- var chunkedMode = true;
- if (options) {
- fileKey = options.fileKey;
- fileName = options.fileName;
- mimeType = options.mimeType;
- if (options.chunkedMode !== null || typeof options.chunkedMode !== "undefined") {
- chunkedMode = options.chunkedMode;
- }
- if (options.params) {
- params = options.params;
- }
- else {
- params = {};
- }
- }
-
- Cordova.exec(successCallback, errorCallback, 'FileTransfer', 'upload', [filePath, server, fileKey, fileName, mimeType, params, debug, chunkedMode]);
-};
-
-/**
- * Downloads a file form a given URL and saves it to the specified directory.
- * @param source {String} URL of the server to receive the file
- * @param target {String} Full path of the file on the device
- * @param successCallback (Function} Callback to be invoked when upload has completed
- * @param errorCallback {Function} Callback to be invoked upon error
- */
-FileTransfer.prototype.download = function(source, target, successCallback, errorCallback) {
- var win = function(result) {
- var entry = null;
- if (result.isDirectory) {
- entry = new DirectoryEntry();
- }
- else if (result.isFile) {
- entry = new FileEntry();
- }
- entry.isDirectory = result.isDirectory;
- entry.isFile = result.isFile;
- entry.name = result.name;
- entry.fullPath = result.fullPath;
- successCallback(entry);
- };
- Cordova.exec(win, errorCallback, 'FileTransfer', 'download', [source, target]);
-};
-
-/**
- * Options to customize the HTTP request used to upload files.
- * @constructor
- * @param fileKey {String} Name of file request parameter.
- * @param fileName {String} Filename to be used by the server. Defaults to image.jpg.
- * @param mimeType {String} Mimetype of the uploaded file. Defaults to image/jpeg.
- * @param params {Object} Object with key: value params to send to the server.
- */
-var FileUploadOptions = function(fileKey, fileName, mimeType, params) {
- this.fileKey = fileKey || null;
- this.fileName = fileName || null;
- this.mimeType = mimeType || null;
- this.params = params || null;
-};
-}
http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/f3c96ce1/framework/assets/js/geolocation.js
----------------------------------------------------------------------
diff --git a/framework/assets/js/geolocation.js b/framework/assets/js/geolocation.js
deleted file mode 100755
index 29e742a..0000000
--- a/framework/assets/js/geolocation.js
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * 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.
- */
-
-if (!Cordova.hasResource("geolocation")) {
-Cordova.addResource("geolocation");
-
-/**
- * This class provides access to device GPS data.
- * @constructor
- */
-var Geolocation = function() {
-
- // The last known GPS position.
- this.lastPosition = null;
-
- // Geolocation listeners
- this.listeners = {};
-};
-
-/**
- * Position error object
- *
- * @constructor
- * @param code
- * @param message
- */
-var PositionError = function(code, message) {
- this.code = code;
- this.message = message;
-};
-
-PositionError.PERMISSION_DENIED = 1;
-PositionError.POSITION_UNAVAILABLE = 2;
-PositionError.TIMEOUT = 3;
-
-/**
- * Asynchronously aquires the current position.
- *
- * @param {Function} successCallback The function to call when the position data is available
- * @param {Function} errorCallback The function to call when there is an error getting the heading position. (OPTIONAL)
- * @param {PositionOptions} options The options for getting the position data. (OPTIONAL)
- */
-Geolocation.prototype.getCurrentPosition = function(successCallback, errorCallback, options) {
- if (navigator._geo.listeners.global) {
- console.log("Geolocation Error: Still waiting for previous getCurrentPosition() request.");
- try {
- errorCallback(new PositionError(PositionError.TIMEOUT, "Geolocation Error: Still waiting for previous getCurrentPosition() request."));
- } catch (e) {
- }
- return;
- }
- var maximumAge = 10000;
- var enableHighAccuracy = false;
- var timeout = 10000;
- if (typeof options !== "undefined") {
- if (typeof options.maximumAge !== "undefined") {
- maximumAge = options.maximumAge;
- }
- if (typeof options.enableHighAccuracy !== "undefined") {
- enableHighAccuracy = options.enableHighAccuracy;
- }
- if (typeof options.timeout !== "undefined") {
- timeout = options.timeout;
- }
- }
- navigator._geo.listeners.global = {"success" : successCallback, "fail" : errorCallback };
- Cordova.exec(null, null, "Geolocation", "getCurrentLocation", [enableHighAccuracy, timeout, maximumAge]);
-};
-
-/**
- * Asynchronously watches the geolocation for changes to geolocation. When a change occurs,
- * the successCallback is called with the new location.
- *
- * @param {Function} successCallback The function to call each time the location data is available
- * @param {Function} errorCallback The function to call when there is an error getting the location data. (OPTIONAL)
- * @param {PositionOptions} options The options for getting the location data such as frequency. (OPTIONAL)
- * @return String The watch id that must be passed to #clearWatch to stop watching.
- */
-Geolocation.prototype.watchPosition = function(successCallback, errorCallback, options) {
- var maximumAge = 10000;
- var enableHighAccuracy = false;
- var timeout = 10000;
- if (typeof options !== "undefined") {
- if (typeof options.frequency !== "undefined") {
- maximumAge = options.frequency;
- }
- if (typeof options.maximumAge !== "undefined") {
- maximumAge = options.maximumAge;
- }
- if (typeof options.enableHighAccuracy !== "undefined") {
- enableHighAccuracy = options.enableHighAccuracy;
- }
- if (typeof options.timeout !== "undefined") {
- timeout = options.timeout;
- }
- }
- var id = Cordova.createUUID();
- navigator._geo.listeners[id] = {"success" : successCallback, "fail" : errorCallback };
- Cordova.exec(null, null, "Geolocation", "start", [id, enableHighAccuracy, timeout, maximumAge]);
- return id;
-};
-
-/*
- * Native callback when watch position has a new position.
- * PRIVATE METHOD
- *
- * @param {String} id
- * @param {Number} lat
- * @param {Number} lng
- * @param {Number} alt
- * @param {Number} altacc
- * @param {Number} head
- * @param {Number} vel
- * @param {Number} stamp
- */
-Geolocation.prototype.success = function(id, lat, lng, alt, altacc, head, vel, stamp) {
- var coords = new Coordinates(lat, lng, alt, altacc, head, vel);
- var loc = new Position(coords, stamp);
- try {
- if (lat === "undefined" || lng === "undefined") {
- navigator._geo.listeners[id].fail(new PositionError(PositionError.POSITION_UNAVAILABLE, "Lat/Lng are undefined."));
- }
- else {
- navigator._geo.lastPosition = loc;
- navigator._geo.listeners[id].success(loc);
- }
- }
- catch (e) {
- console.log("Geolocation Error: Error calling success callback function.");
- }
-
- if (id === "global") {
- delete navigator._geo.listeners.global;
- }
-};
-
-/**
- * Native callback when watch position has an error.
- * PRIVATE METHOD
- *
- * @param {String} id The ID of the watch
- * @param {Number} code The error code
- * @param {String} msg The error message
- */
-Geolocation.prototype.fail = function(id, code, msg) {
- try {
- navigator._geo.listeners[id].fail(new PositionError(code, msg));
- }
- catch (e) {
- console.log("Geolocation Error: Error calling error callback function.");
- }
-};
-
-/**
- * Clears the specified heading watch.
- *
- * @param {String} id The ID of the watch returned from #watchPosition
- */
-Geolocation.prototype.clearWatch = function(id) {
- Cordova.exec(null, null, "Geolocation", "stop", [id]);
- delete navigator._geo.listeners[id];
-};
-
-/**
- * Force the Cordova geolocation to be used instead of built-in.
- */
-Geolocation.usingCordova = false;
-Geolocation.useCordova = function() {
- if (Geolocation.usingCordova) {
- return;
- }
- Geolocation.usingCordova = true;
-
- // Set built-in geolocation methods to our own implementations
- // (Cannot replace entire geolocation, but can replace individual methods)
- navigator.geolocation.setLocation = navigator._geo.setLocation;
- navigator.geolocation.getCurrentPosition = navigator._geo.getCurrentPosition;
- navigator.geolocation.watchPosition = navigator._geo.watchPosition;
- navigator.geolocation.clearWatch = navigator._geo.clearWatch;
- navigator.geolocation.start = navigator._geo.start;
- navigator.geolocation.stop = navigator._geo.stop;
-};
-
-Cordova.addConstructor(function() {
- navigator._geo = new Geolocation();
-
- // No native geolocation object for Android 1.x, so use Cordova geolocation
- if (typeof navigator.geolocation === 'undefined') {
- navigator.geolocation = navigator._geo;
- Geolocation.usingCordova = true;
- }
-});
-}
http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/f3c96ce1/framework/assets/js/header.txt
----------------------------------------------------------------------
diff --git a/framework/assets/js/header.txt b/framework/assets/js/header.txt
deleted file mode 100755
index 89899a5..0000000
--- a/framework/assets/js/header.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * 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.
- */
-
http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/f3c96ce1/framework/assets/js/media.js
----------------------------------------------------------------------
diff --git a/framework/assets/js/media.js b/framework/assets/js/media.js
deleted file mode 100755
index 15cecd9..0000000
--- a/framework/assets/js/media.js
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- * 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.
- */
-
-if (!Cordova.hasResource("media")) {
-Cordova.addResource("media");
-
-/**
- * This class provides access to the device media, interfaces to both sound and video
- *
- * @constructor
- * @param src The file name or url to play
- * @param successCallback The callback to be called when the file is done playing or recording.
- * successCallback() - OPTIONAL
- * @param errorCallback The callback to be called if there is an error.
- * errorCallback(int errorCode) - OPTIONAL
- * @param statusCallback The callback to be called when media status has changed.
- * statusCallback(int statusCode) - OPTIONAL
- * @param positionCallback The callback to be called when media position has changed.
- * positionCallback(long position) - OPTIONAL
- */
-var Media = function(src, successCallback, errorCallback, statusCallback, positionCallback) {
-
- // successCallback optional
- if (successCallback && (typeof successCallback !== "function")) {
- console.log("Media Error: successCallback is not a function");
- return;
- }
-
- // errorCallback optional
- if (errorCallback && (typeof errorCallback !== "function")) {
- console.log("Media Error: errorCallback is not a function");
- return;
- }
-
- // statusCallback optional
- if (statusCallback && (typeof statusCallback !== "function")) {
- console.log("Media Error: statusCallback is not a function");
- return;
- }
-
- // statusCallback optional
- if (positionCallback && (typeof positionCallback !== "function")) {
- console.log("Media Error: positionCallback is not a function");
- return;
- }
-
- this.id = Cordova.createUUID();
- Cordova.mediaObjects[this.id] = this;
- this.src = src;
- this.successCallback = successCallback;
- this.errorCallback = errorCallback;
- this.statusCallback = statusCallback;
- this.positionCallback = positionCallback;
- this._duration = -1;
- this._position = -1;
-};
-
-// Media messages
-Media.MEDIA_STATE = 1;
-Media.MEDIA_DURATION = 2;
-Media.MEDIA_POSITION = 3;
-Media.MEDIA_ERROR = 9;
-
-// Media states
-Media.MEDIA_NONE = 0;
-Media.MEDIA_STARTING = 1;
-Media.MEDIA_RUNNING = 2;
-Media.MEDIA_PAUSED = 3;
-Media.MEDIA_STOPPED = 4;
-Media.MEDIA_MSG = ["None", "Starting", "Running", "Paused", "Stopped"];
-
-// TODO: Will MediaError be used?
-/**
- * This class contains information about any Media errors.
- * @constructor
- */
-var MediaError = function() {
- this.code = null;
- this.message = "";
-};
-
-MediaError.MEDIA_ERR_NONE_ACTIVE = 0;
-MediaError.MEDIA_ERR_ABORTED = 1;
-MediaError.MEDIA_ERR_NETWORK = 2;
-MediaError.MEDIA_ERR_DECODE = 3;
-MediaError.MEDIA_ERR_NONE_SUPPORTED = 4;
-
-/**
- * Start or resume playing audio file.
- */
-Media.prototype.play = function() {
- Cordova.exec(null, null, "Media", "startPlayingAudio", [this.id, this.src]);
-};
-
-/**
- * Stop playing audio file.
- */
-Media.prototype.stop = function() {
- return Cordova.exec(null, null, "Media", "stopPlayingAudio", [this.id]);
-};
-
-/**
- * Seek or jump to a new time in the track..
- */
-Media.prototype.seekTo = function(milliseconds) {
- Cordova.exec(null, null, "Media", "seekToAudio", [this.id, milliseconds]);
-};
-
-/**
- * Pause playing audio file.
- */
-Media.prototype.pause = function() {
- Cordova.exec(null, null, "Media", "pausePlayingAudio", [this.id]);
-};
-
-/**
- * Get duration of an audio file.
- * The duration is only set for audio that is playing, paused or stopped.
- *
- * @return duration or -1 if not known.
- */
-Media.prototype.getDuration = function() {
- return this._duration;
-};
-
-/**
- * Get position of audio.
- */
-Media.prototype.getCurrentPosition = function(success, fail) {
- Cordova.exec(success, fail, "Media", "getCurrentPositionAudio", [this.id]);
-};
-
-/**
- * Start recording audio file.
- */
-Media.prototype.startRecord = function() {
- Cordova.exec(null, null, "Media", "startRecordingAudio", [this.id, this.src]);
-};
-
-/**
- * Stop recording audio file.
- */
-Media.prototype.stopRecord = function() {
- Cordova.exec(null, null, "Media", "stopRecordingAudio", [this.id]);
-};
-
-/**
- * Release the resources.
- */
-Media.prototype.release = function() {
- Cordova.exec(null, null, "Media", "release", [this.id]);
-};
-
-/**
- * Adjust the volume.
- */
-Media.prototype.setVolume = function(volume) {
- Cordova.exec(null, null, "Media", "setVolume", [this.id, volume]);
-};
-
-/**
- * List of media objects.
- * PRIVATE
- */
-Cordova.mediaObjects = {};
-
-/**
- * Object that receives native callbacks.
- * PRIVATE
- * @constructor
- */
-Cordova.Media = function() {};
-
-/**
- * Get the media object.
- * PRIVATE
- *
- * @param id The media object id (string)
- */
-Cordova.Media.getMediaObject = function(id) {
- return Cordova.mediaObjects[id];
-};
-
-/**
- * Audio has status update.
- * PRIVATE
- *
- * @param id The media object id (string)
- * @param status The status code (int)
- * @param msg The status message (string)
- */
-Cordova.Media.onStatus = function(id, msg, value) {
- var media = Cordova.mediaObjects[id];
- // If state update
- if (msg === Media.MEDIA_STATE) {
- if (value === Media.MEDIA_STOPPED) {
- if (media.successCallback) {
- media.successCallback();
- }
- }
- if (media.statusCallback) {
- media.statusCallback(value);
- }
- }
- else if (msg === Media.MEDIA_DURATION) {
- media._duration = value;
- }
- else if (msg === Media.MEDIA_ERROR) {
- if (media.errorCallback) {
- media.errorCallback({"code":value});
- }
- }
- else if (msg === Media.MEDIA_POSITION) {
- media._position = value;
- }
-};
-}
http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/f3c96ce1/framework/assets/js/network.js
----------------------------------------------------------------------
diff --git a/framework/assets/js/network.js b/framework/assets/js/network.js
deleted file mode 100755
index d190069..0000000
--- a/framework/assets/js/network.js
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * 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.
- */
-
-
-if (!Cordova.hasResource("network")) {
-Cordova.addResource("network");
-
-/**
- * This class contains information about the current network Connection.
- * @constructor
- */
-var Connection = function() {
- this.type = null;
- this._firstRun = true;
- this._timer = null;
- this.timeout = 500;
-
- var me = this;
- this.getInfo(
- function(type) {
- // Need to send events if we are on or offline
- if (type === "none") {
- // set a timer if still offline at the end of timer send the offline event
- me._timer = setTimeout(function(){
- me.type = type;
- Cordova.fireDocumentEvent('offline');
- me._timer = null;
- }, me.timeout);
- } else {
- // If there is a current offline event pending clear it
- if (me._timer !== null) {
- clearTimeout(me._timer);
- me._timer = null;
- }
- me.type = type;
- Cordova.fireDocumentEvent('online');
- }
-
- // should only fire this once
- if (me._firstRun) {
- me._firstRun = false;
- Cordova.onCordovaConnectionReady.fire();
- }
- },
- function(e) {
- // If we can't get the network info we should still tell Cordova
- // to fire the deviceready event.
- if (me._firstRun) {
- me._firstRun = false;
- Cordova.onCordovaConnectionReady.fire();
- }
- console.log("Error initializing Network Connection: " + e);
- });
-};
-
-Connection.UNKNOWN = "unknown";
-Connection.ETHERNET = "ethernet";
-Connection.WIFI = "wifi";
-Connection.CELL_2G = "2g";
-Connection.CELL_3G = "3g";
-Connection.CELL_4G = "4g";
-Connection.NONE = "none";
-
-/**
- * Get connection info
- *
- * @param {Function} successCallback The function to call when the Connection data is available
- * @param {Function} errorCallback The function to call when there is an error getting the Connection data. (OPTIONAL)
- */
-Connection.prototype.getInfo = function(successCallback, errorCallback) {
- // Get info
- Cordova.exec(successCallback, errorCallback, "Network Status", "getConnectionInfo", []);
-};
-
-
-Cordova.addConstructor(function() {
- if (typeof navigator.network === "undefined") {
- navigator.network = {};
- }
- if (typeof navigator.network.connection === "undefined") {
- navigator.network.connection = new Connection();
- }
-});
-}
http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/f3c96ce1/framework/assets/js/notification.js
----------------------------------------------------------------------
diff --git a/framework/assets/js/notification.js b/framework/assets/js/notification.js
deleted file mode 100755
index 2a7718b..0000000
--- a/framework/assets/js/notification.js
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * 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.
- */
-
-if (!Cordova.hasResource("notification")) {
-Cordova.addResource("notification");
-
-/**
- * This class provides access to notifications on the device.
- * @constructor
- */
-var Notification = function() {
-};
-
-/**
- * Open a native alert dialog, with a customizable title and button text.
- *
- * @param {String} message Message to print in the body of the alert
- * @param {Function} completeCallback The callback that is called when user clicks on a button.
- * @param {String} title Title of the alert dialog (default: Alert)
- * @param {String} buttonLabel Label of the close button (default: OK)
- */
-Notification.prototype.alert = function(message, completeCallback, title, buttonLabel) {
- var _title = (title || "Alert");
- var _buttonLabel = (buttonLabel || "OK");
- Cordova.exec(completeCallback, null, "Notification", "alert", [message,_title,_buttonLabel]);
-};
-
-/**
- * Open a native confirm dialog, with a customizable title and button text.
- * The result that the user selects is returned to the result callback.
- *
- * @param {String} message Message to print in the body of the alert
- * @param {Function} resultCallback The callback that is called when user clicks on a button.
- * @param {String} title Title of the alert dialog (default: Confirm)
- * @param {String} buttonLabels Comma separated list of the labels of the buttons (default: 'OK,Cancel')
- */
-Notification.prototype.confirm = function(message, resultCallback, title, buttonLabels) {
- var _title = (title || "Confirm");
- var _buttonLabels = (buttonLabels || "OK,Cancel");
- Cordova.exec(resultCallback, null, "Notification", "confirm", [message,_title,_buttonLabels]);
-};
-
-/**
- * Start spinning the activity indicator on the statusbar
- */
-Notification.prototype.activityStart = function() {
- Cordova.exec(null, null, "Notification", "activityStart", ["Busy","Please wait..."]);
-};
-
-/**
- * Stop spinning the activity indicator on the statusbar, if it's currently spinning
- */
-Notification.prototype.activityStop = function() {
- Cordova.exec(null, null, "Notification", "activityStop", []);
-};
-
-/**
- * Display a progress dialog with progress bar that goes from 0 to 100.
- *
- * @param {String} title Title of the progress dialog.
- * @param {String} message Message to display in the dialog.
- */
-Notification.prototype.progressStart = function(title, message) {
- Cordova.exec(null, null, "Notification", "progressStart", [title, message]);
-};
-
-/**
- * Set the progress dialog value.
- *
- * @param {Number} value 0-100
- */
-Notification.prototype.progressValue = function(value) {
- Cordova.exec(null, null, "Notification", "progressValue", [value]);
-};
-
-/**
- * Close the progress dialog.
- */
-Notification.prototype.progressStop = function() {
- Cordova.exec(null, null, "Notification", "progressStop", []);
-};
-
-/**
- * Causes the device to blink a status LED.
- *
- * @param {Integer} count The number of blinks.
- * @param {String} colour The colour of the light.
- */
-Notification.prototype.blink = function(count, colour) {
- // NOT IMPLEMENTED
-};
-
-/**
- * Causes the device to vibrate.
- *
- * @param {Integer} mills The number of milliseconds to vibrate for.
- */
-Notification.prototype.vibrate = function(mills) {
- Cordova.exec(null, null, "Notification", "vibrate", [mills]);
-};
-
-/**
- * Causes the device to beep.
- * On Android, the default notification ringtone is played "count" times.
- *
- * @param {Integer} count The number of beeps.
- */
-Notification.prototype.beep = function(count) {
- Cordova.exec(null, null, "Notification", "beep", [count]);
-};
-
-Cordova.addConstructor(function() {
- if (typeof navigator.notification === "undefined") {
- navigator.notification = new Notification();
- }
-});
-}
http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/f3c96ce1/framework/assets/js/position.js
----------------------------------------------------------------------
diff --git a/framework/assets/js/position.js b/framework/assets/js/position.js
deleted file mode 100755
index e6b0e8a..0000000
--- a/framework/assets/js/position.js
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * 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.
- */
-
-if (!Cordova.hasResource("position")) {
-Cordova.addResource("position");
-
-/**
- * This class contains position information.
- * @param {Object} lat
- * @param {Object} lng
- * @param {Object} acc
- * @param {Object} alt
- * @param {Object} altacc
- * @param {Object} head
- * @param {Object} vel
- * @constructor
- */
-var Position = function(coords, timestamp) {
- this.coords = coords;
- this.timestamp = (timestamp !== 'undefined') ? timestamp : new Date().getTime();
-};
-
-/** @constructor */
-var Coordinates = function(lat, lng, alt, acc, head, vel, altacc) {
- /**
- * The latitude of the position.
- */
- this.latitude = lat;
- /**
- * The longitude of the position,
- */
- this.longitude = lng;
- /**
- * The accuracy of the position.
- */
- this.accuracy = acc;
- /**
- * The altitude of the position.
- */
- this.altitude = alt;
- /**
- * The direction the device is moving at the position.
- */
- this.heading = head;
- /**
- * The velocity with which the device is moving at the position.
- */
- this.speed = vel;
- /**
- * The altitude accuracy of the position.
- */
- this.altitudeAccuracy = (altacc !== 'undefined') ? altacc : null;
-};
-
-/**
- * This class specifies the options for requesting position data.
- * @constructor
- */
-var PositionOptions = function() {
- /**
- * Specifies the desired position accuracy.
- */
- this.enableHighAccuracy = true;
- /**
- * The timeout after which if position data cannot be obtained the errorCallback
- * is called.
- */
- this.timeout = 10000;
-};
-
-/**
- * This class contains information about any GSP errors.
- * @constructor
- */
-var PositionError = function() {
- this.code = null;
- this.message = "";
-};
-
-PositionError.UNKNOWN_ERROR = 0;
-PositionError.PERMISSION_DENIED = 1;
-PositionError.POSITION_UNAVAILABLE = 2;
-PositionError.TIMEOUT = 3;
-}
http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/f3c96ce1/framework/assets/js/storage.js
----------------------------------------------------------------------
diff --git a/framework/assets/js/storage.js b/framework/assets/js/storage.js
deleted file mode 100755
index 7e6a75e..0000000
--- a/framework/assets/js/storage.js
+++ /dev/null
@@ -1,439 +0,0 @@
-/*
- * 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.
- */
-
-/*
- * This is purely for the Android 1.5/1.6 HTML 5 Storage
- * I was hoping that Android 2.0 would deprecate this, but given the fact that
- * most manufacturers ship with Android 1.5 and do not do OTA Updates, this is required
- */
-
-if (!Cordova.hasResource("storage")) {
-Cordova.addResource("storage");
-
-/**
- * SQL result set object
- * PRIVATE METHOD
- * @constructor
- */
-var DroidDB_Rows = function() {
- this.resultSet = []; // results array
- this.length = 0; // number of rows
-};
-
-/**
- * Get item from SQL result set
- *
- * @param row The row number to return
- * @return The row object
- */
-DroidDB_Rows.prototype.item = function(row) {
- return this.resultSet[row];
-};
-
-/**
- * SQL result set that is returned to user.
- * PRIVATE METHOD
- * @constructor
- */
-var DroidDB_Result = function() {
- this.rows = new DroidDB_Rows();
-};
-
-/**
- * Storage object that is called by native code when performing queries.
- * PRIVATE METHOD
- * @constructor
- */
-var DroidDB = function() {
- this.queryQueue = {};
-};
-
-/**
- * Callback from native code when query is complete.
- * PRIVATE METHOD
- *
- * @param id Query id
- */
-DroidDB.prototype.completeQuery = function(id, data) {
- var query = this.queryQueue[id];
- if (query) {
- try {
- delete this.queryQueue[id];
-
- // Get transaction
- var tx = query.tx;
-
- // If transaction hasn't failed
- // Note: We ignore all query results if previous query
- // in the same transaction failed.
- if (tx && tx.queryList[id]) {
-
- // Save query results
- var r = new DroidDB_Result();
- r.rows.resultSet = data;
- r.rows.length = data.length;
- try {
- if (typeof query.successCallback === 'function') {
- query.successCallback(query.tx, r);
- }
- } catch (ex) {
- console.log("executeSql error calling user success callback: "+ex);
- }
-
- tx.queryComplete(id);
- }
- } catch (e) {
- console.log("executeSql error: "+e);
- }
- }
-};
-
-/**
- * Callback from native code when query fails
- * PRIVATE METHOD
- *
- * @param reason Error message
- * @param id Query id
- */
-DroidDB.prototype.fail = function(reason, id) {
- var query = this.queryQueue[id];
- if (query) {
- try {
- delete this.queryQueue[id];
-
- // Get transaction
- var tx = query.tx;
-
- // If transaction hasn't failed
- // Note: We ignore all query results if previous query
- // in the same transaction failed.
- if (tx && tx.queryList[id]) {
- tx.queryList = {};
-
- try {
- if (typeof query.errorCallback === 'function') {
- query.errorCallback(query.tx, reason);
- }
- } catch (ex) {
- console.log("executeSql error calling user error callback: "+ex);
- }
-
- tx.queryFailed(id, reason);
- }
-
- } catch (e) {
- console.log("executeSql error: "+e);
- }
- }
-};
-
-/**
- * SQL query object
- * PRIVATE METHOD
- *
- * @constructor
- * @param tx The transaction object that this query belongs to
- */
-var DroidDB_Query = function(tx) {
-
- // Set the id of the query
- this.id = Cordova.createUUID();
-
- // Add this query to the queue
- droiddb.queryQueue[this.id] = this;
-
- // Init result
- this.resultSet = [];
-
- // Set transaction that this query belongs to
- this.tx = tx;
-
- // Add this query to transaction list
- this.tx.queryList[this.id] = this;
-
- // Callbacks
- this.successCallback = null;
- this.errorCallback = null;
-
-};
-
-/**
- * Transaction object
- * PRIVATE METHOD
- * @constructor
- */
-var DroidDB_Tx = function() {
-
- // Set the id of the transaction
- this.id = Cordova.createUUID();
-
- // Callbacks
- this.successCallback = null;
- this.errorCallback = null;
-
- // Query list
- this.queryList = {};
-};
-
-/**
- * Mark query in transaction as complete.
- * If all queries are complete, call the user's transaction success callback.
- *
- * @param id Query id
- */
-DroidDB_Tx.prototype.queryComplete = function(id) {
- delete this.queryList[id];
-
- // If no more outstanding queries, then fire transaction success
- if (this.successCallback) {
- var count = 0;
- var i;
- for (i in this.queryList) {
- if (this.queryList.hasOwnProperty(i)) {
- count++;
- }
- }
- if (count === 0) {
- try {
- this.successCallback();
- } catch(e) {
- console.log("Transaction error calling user success callback: " + e);
- }
- }
- }
-};
-
-/**
- * Mark query in transaction as failed.
- *
- * @param id Query id
- * @param reason Error message
- */
-DroidDB_Tx.prototype.queryFailed = function(id, reason) {
-
- // The sql queries in this transaction have already been run, since
- // we really don't have a real transaction implemented in native code.
- // However, the user callbacks for the remaining sql queries in transaction
- // will not be called.
- this.queryList = {};
-
- if (this.errorCallback) {
- try {
- this.errorCallback(reason);
- } catch(e) {
- console.log("Transaction error calling user error callback: " + e);
- }
- }
-};
-
-/**
- * Execute SQL statement
- *
- * @param sql SQL statement to execute
- * @param params Statement parameters
- * @param successCallback Success callback
- * @param errorCallback Error callback
- */
-DroidDB_Tx.prototype.executeSql = function(sql, params, successCallback, errorCallback) {
-
- // Init params array
- if (typeof params === 'undefined') {
- params = [];
- }
-
- // Create query and add to queue
- var query = new DroidDB_Query(this);
- droiddb.queryQueue[query.id] = query;
-
- // Save callbacks
- query.successCallback = successCallback;
- query.errorCallback = errorCallback;
-
- // Call native code
- Cordova.exec(null, null, "Storage", "executeSql", [sql, params, query.id]);
-};
-
-var DatabaseShell = function() {
-};
-
-/**
- * Start a transaction.
- * Does not support rollback in event of failure.
- *
- * @param process {Function} The transaction function
- * @param successCallback {Function}
- * @param errorCallback {Function}
- */
-DatabaseShell.prototype.transaction = function(process, errorCallback, successCallback) {
- var tx = new DroidDB_Tx();
- tx.successCallback = successCallback;
- tx.errorCallback = errorCallback;
- try {
- process(tx);
- } catch (e) {
- console.log("Transaction error: "+e);
- if (tx.errorCallback) {
- try {
- tx.errorCallback(e);
- } catch (ex) {
- console.log("Transaction error calling user error callback: "+e);
- }
- }
- }
-};
-
-/**
- * Open database
- *
- * @param name Database name
- * @param version Database version
- * @param display_name Database display name
- * @param size Database size in bytes
- * @return Database object
- */
-var DroidDB_openDatabase = function(name, version, display_name, size) {
- Cordova.exec(null, null, "Storage", "openDatabase", [name, version, display_name, size]);
- var db = new DatabaseShell();
- return db;
-};
-
-/**
- * For browsers with no localStorage we emulate it with SQLite. Follows the w3c api.
- * TODO: Do similar for sessionStorage.
- */
-
-/**
- * @constructor
- */
-var CupcakeLocalStorage = function() {
- try {
-
- this.db = openDatabase('localStorage', '1.0', 'localStorage', 2621440);
- var storage = {};
- this.length = 0;
- function setLength (length) {
- this.length = length;
- localStorage.length = length;
- }
- this.db.transaction(
- function (transaction) {
- var i;
- transaction.executeSql('CREATE TABLE IF NOT EXISTS storage (id NVARCHAR(40) PRIMARY KEY, body NVARCHAR(255))');
- transaction.executeSql('SELECT * FROM storage', [], function(tx, result) {
- for(var i = 0; i < result.rows.length; i++) {
- storage[result.rows.item(i)['id']] = result.rows.item(i)['body'];
- }
- setLength(result.rows.length);
- Cordova.initializationComplete("cupcakeStorage");
- });
-
- },
- function (err) {
- alert(err.message);
- }
- );
- this.setItem = function(key, val) {
- if (typeof(storage[key])=='undefined') {
- this.length++;
- }
- storage[key] = val;
- this.db.transaction(
- function (transaction) {
- 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]);
- }
- );
- };
- this.getItem = function(key) {
- return storage[key];
- };
- this.removeItem = function(key) {
- delete storage[key];
- this.length--;
- this.db.transaction(
- function (transaction) {
- transaction.executeSql('CREATE TABLE IF NOT EXISTS storage (id NVARCHAR(40) PRIMARY KEY, body NVARCHAR(255))');
- transaction.executeSql('DELETE FROM storage where id=?', [key]);
- }
- );
- };
- this.clear = function() {
- storage = {};
- this.length = 0;
- this.db.transaction(
- function (transaction) {
- transaction.executeSql('CREATE TABLE IF NOT EXISTS storage (id NVARCHAR(40) PRIMARY KEY, body NVARCHAR(255))');
- transaction.executeSql('DELETE FROM storage', []);
- }
- );
- };
- this.key = function(index) {
- var i = 0;
- for (var j in storage) {
- if (i==index) {
- return j;
- } else {
- i++;
- }
- }
- return null;
- };
-
- } catch(e) {
- alert("Database error "+e+".");
- return;
- }
-};
-
-Cordova.addConstructor(function() {
- var setupDroidDB = function() {
- navigator.openDatabase = window.openDatabase = DroidDB_openDatabase;
- window.droiddb = new DroidDB();
- }
- if (typeof window.openDatabase === "undefined") {
- setupDroidDB();
- } else {
- window.openDatabase_orig = window.openDatabase;
- window.openDatabase = function(name, version, desc, size){
- // Some versions of Android will throw a SECURITY_ERR so we need
- // to catch the exception and seutp our own DB handling.
- var db = null;
- try {
- db = window.openDatabase_orig(name, version, desc, size);
- }
- catch (ex) {
- db = null;
- }
-
- if (db == null) {
- setupDroidDB();
- return DroidDB_openDatabase(name, version, desc, size);
- }
- else {
- return db;
- }
- };
- }
-
- if ((typeof window.localStorage == "undefined") || (window.localStorage == null)) {
- navigator.localStorage = window.localStorage = new CupcakeLocalStorage();
- Cordova.waitForInitialization("cupcakeStorage");
- }
-});
-}
http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/f3c96ce1/framework/build.xml
----------------------------------------------------------------------
diff --git a/framework/build.xml b/framework/build.xml
index f49ebfd..723ac58 100644
--- a/framework/build.xml
+++ b/framework/build.xml
@@ -108,40 +108,6 @@
-->
<import file="${sdk.dir}/tools/ant/build.xml" />
-
- <target name="check-javascript" depends="build-javascript">
- <!--
- <delete dir="assets/lib"/>
- <mkdir dir="assets/lib"/>
- <echo file="assets/lib/lint.js">var alert=function(){},device={},Element={},debug={};</echo>
- <concat destfile="assets/lib/cordova-lint.js" append="true">
- <fileset dir="assets/lib">
- <include name="lint.js" />
- </fileset>
- <fileset dir="assets/www">
- <include name="cordova-${version}.js" />
- </fileset>
- </concat>
-
- <exec executable="cmd" os="Windows 7">
- <arg value="/c"/>
- <arg value="java"/>
- <arg value="-cp"/>
- <arg value="${basedir}/util/js.jar"/>
- <arg value="org.mozilla.javascript.tools.shell.Main"/>
- <arg value="${basedir}/util/jslint.js"/>
- <arg value="${basedir}/js/lib/cordova-lint.js"/>
- </exec>
- <exec executable="java" os="Mac OS X">
- <arg value="-cp"/>
- <arg value="../util/js.jar"/>
- <arg value="org.mozilla.javascript.tools.shell.Main"/>
- <arg value="../util/jslint.js"/>
- <arg value="assets/lib/cordova-lint.js"/>
- </exec>
- -->
- </target>
-
<!-- Combine JavaScript files into one cordova-uncompressed.js file. -->
<target name="build-javascript" depends="clean">
@@ -151,24 +117,17 @@
<!-- Create uncompressed JS file -->
<concat destfile="assets/www/cordova-${version}.js">
<filelist dir="assets/js" files="cordova.android.js"/>
- <!--
- <filelist dir="assets/js" files="cordova.js.base,device.js"/>
- <fileset dir="assets/js" includes="*.js" excludes="cordova.js.base,device.js"/>
- -->
</concat>
<!-- update project files to reference cordova-x.x.x.min.js -->
<replaceregexp match="cordova(.*)\.js" replace="cordova-${version}.js" byline="true">
<fileset file="assets/www/index.html" />
- <!-- <fileset file="../bin/templates/project/assets/www/index.html" /> -->
</replaceregexp>
+
<!-- This is sketchy, but it works, ${dblQuote} does not -->
<replaceregexp match="cordovaVersion = [\u0022].*[\u0022];" replace='cordovaVersion = ${dblQuote}${version}${dblQuote};' byline="true">
<fileset file="src/org/apache/cordova/Device.java" />
</replaceregexp>
-
- <!-- Delete temp file -->
- <!--<delete file="assets/www/cordova-tmp.js"/>-->
</target>
<!-- Build Cordova jar file that includes all native code, and Cordova JS file