incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [2/3] updating cordova.js
Date Thu, 13 Sep 2012 00:14:55 GMT
http://git-wip-us.apache.org/repos/asf/incubator-cordova-tizen/blob/410d533b/framework/cordova.tizen-debug.js
----------------------------------------------------------------------
diff --git a/framework/cordova.tizen-debug.js b/framework/cordova.tizen-debug.js
index bcb3e4f..0c819da 100644
--- a/framework/cordova.tizen-debug.js
+++ b/framework/cordova.tizen-debug.js
@@ -1,6 +1,6 @@
-// commit dc26996057d667e1a8ac6d524918cce0e7078e21
+// commit 143f5221a6251c9cbccdedc57005c61551b97f12
 
-// File generated at :: Tue Sep 11 2012 18:04:25 GMT-0700 (PDT)
+// File generated at :: Wed Sep 12 2012 17:09:27 GMT-0700 (PDT)
 
 /*
  Licensed to the Apache Software Foundation (ASF) under one
@@ -27,7 +27,7 @@ try {eval("var require,\n    define;\n\n(function () {\n    var modules = {};\n\
 try {eval("define(\"cordova\", function(require, exports, module) {\nvar channel = require('cordova/channel');\n\n/**\n * Listen for DOMContentLoaded and notify our channel subscribers.\n */\ndocument.addEventListener('DOMContentLoaded', function() {\n    channel.onDOMContentLoaded.fire();\n}, false);\nif (document.readyState == 'complete' || document.readyState == 'interactive') {\n    channel.onDOMContentLoaded.fire();\n}\n\n/**\n * Intercept calls to addEventListener + removeEventListener and handle deviceready,\n * resume, and pause events.\n */\nvar m_document_addEventListener = document.addEventListener;\nvar m_document_removeEventListener = document.removeEventListener;\nvar m_window_addEventListener = window.addEventListener;\nvar m_window_removeEventListener = window.removeEventListener;\n\n/**\n * Houses custom event handlers to intercept on document + window event listeners.\n */\nvar documentEventHandlers = {},\n    windowEventHandlers = {};\n\ndocument.addEventListener 
 = function(evt, handler, capture) {\n    var e = evt.toLowerCase();\n    if (typeof documentEventHandlers[e] != 'undefined') {\n        if (evt === 'deviceready') {\n            documentEventHandlers[e].subscribeOnce(handler);\n        } else {\n            documentEventHandlers[e].subscribe(handler);\n        }\n    } else {\n        m_document_addEventListener.call(document, evt, handler, capture);\n    }\n};\n\nwindow.addEventListener = function(evt, handler, capture) {\n    var e = evt.toLowerCase();\n    if (typeof windowEventHandlers[e] != 'undefined') {\n        windowEventHandlers[e].subscribe(handler);\n    } else {\n        m_window_addEventListener.call(window, evt, handler, capture);\n    }\n};\n\ndocument.removeEventListener = function(evt, handler, capture) {\n    var e = evt.toLowerCase();\n    // If unsubcribing from an event that is handled by a plugin\n    if (typeof documentEventHandlers[e] != \"undefined\") {\n        documentEventHandlers[e].unsubscribe(handler)
 ;\n    } else {\n        m_document_removeEventListener.call(document, evt, handler, capture);\n    }\n};\n\nwindow.removeEventListener = function(evt, handler, capture) {\n    var e = evt.toLowerCase();\n    // If unsubcribing from an event that is handled by a plugin\n    if (typeof windowEventHandlers[e] != \"undefined\") {\n        windowEventHandlers[e].unsubscribe(handler);\n    } else {\n        m_window_removeEventListener.call(window, evt, handler, capture);\n    }\n};\n\nfunction createEvent(type, data) {\n    var event = document.createEvent('Events');\n    event.initEvent(type, false, false);\n    if (data) {\n        for (var i in data) {\n            if (data.hasOwnProperty(i)) {\n                event[i] = data[i];\n            }\n        }\n    }\n    return event;\n}\n\nif(typeof window.console === \"undefined\") {\n    window.console = {\n        log:function(){}\n    };\n}\n\nvar cordova = {\n    define:define,\n    require:require,\n    /**\n     * Methods to add
 /remove your own addEventListener hijacking on document + window.\n     */\n    addWindowEventHandler:function(event, opts) {\n        return (windowEventHandlers[event] = channel.create(event, opts));\n    },\n    addDocumentEventHandler:function(event, opts) {\n        return (documentEventHandlers[event] = channel.create(event, opts));\n    },\n    removeWindowEventHandler:function(event) {\n        delete windowEventHandlers[event];\n    },\n    removeDocumentEventHandler:function(event) {\n        delete documentEventHandlers[event];\n    },\n    /**\n     * Retreive original event handlers that were replaced by Cordova\n     *\n     * @return object\n     */\n    getOriginalHandlers: function() {\n        return {'document': {'addEventListener': m_document_addEventListener, 'removeEventListener': m_document_removeEventListener},\n        'window': {'addEventListener': m_window_addEventListener, 'removeEventListener': m_window_removeEventListener}};\n    },\n    /**\n     * Met
 hod to fire event from native code\n     * bNoDetach is required for events which cause an exception which needs to be caught in native code     \n     */\n    fireDocumentEvent: function(type, data, bNoDetach) {\n        var evt = createEvent(type, data);\n        if (typeof documentEventHandlers[type] != 'undefined') {\n            if( bNoDetach ) {\n              documentEventHandlers[type].fire(evt);\n            }\n            else {\n              setTimeout(function() {\n                  documentEventHandlers[type].fire(evt);\n              }, 0);\n            }\n        } else {\n            document.dispatchEvent(evt);\n        }\n    },\n    fireWindowEvent: function(type, data) {\n        var evt = createEvent(type,data);\n        if (typeof windowEventHandlers[type] != 'undefined') {\n            setTimeout(function() {\n                windowEventHandlers[type].fire(evt);\n            }, 0);\n        } else {\n            window.dispatchEvent(evt);\n        }\n    },\n
 \n    // TODO: iOS only\n    // This queue holds the currently executing command and all pending\n    // commands executed with cordova.exec().\n    commandQueue:[],\n    // Indicates if we're currently in the middle of flushing the command\n    // queue on the native side.\n    commandQueueFlushing:false,\n    // END TODO\n    /**\n     * Plugin callback mechanism.\n     */\n    callbackId: 0,\n    callbacks:  {},\n    callbackStatus: {\n        NO_RESULT: 0,\n        OK: 1,\n        CLASS_NOT_FOUND_EXCEPTION: 2,\n        ILLEGAL_ACCESS_EXCEPTION: 3,\n        INSTANTIATION_EXCEPTION: 4,\n        MALFORMED_URL_EXCEPTION: 5,\n        IO_EXCEPTION: 6,\n        INVALID_ACTION: 7,\n        JSON_EXCEPTION: 8,\n        ERROR: 9\n    },\n\n    /**\n     * Called by native code when returning successful result from an action.\n     *\n     * @param callbackId\n     * @param args\n     */\n    callbackSuccess: function(callbackId, args) {\n        if (cordova.callbacks[callbackId]) {\n\n    
         // If result is to be sent to callback\n            if (args.status == cordova.callbackStatus.OK) {\n                try {\n                    if (cordova.callbacks[callbackId].success) {\n                        cordova.callbacks[callbackId].success(args.message);\n                    }\n                }\n                catch (e) {\n                    console.log(\"Error in success callback: \"+callbackId+\" = \"+e);\n                }\n            }\n\n            // Clear callback if not expecting any more results\n            if (!args.keepCallback) {\n                delete cordova.callbacks[callbackId];\n            }\n        }\n    },\n\n    /**\n     * Called by native code when returning error result from an action.\n     *\n     * @param callbackId\n     * @param args\n     */\n    callbackError: function(callbackId, args) {\n        if (cordova.callbacks[callbackId]) {\n            try {\n                if (cordova.callbacks[callbackId].fail) {\n            
         cordova.callbacks[callbackId].fail(args.message);\n                }\n            }\n            catch (e) {\n                console.log(\"Error in error callback: \"+callbackId+\" = \"+e);\n            }\n\n            // Clear callback if not expecting any more results\n            if (!args.keepCallback) {\n                delete cordova.callbacks[callbackId];\n            }\n        }\n    },\n    addConstructor: function(func) {\n        channel.onCordovaReady.subscribeOnce(function() {\n            try {\n                func();\n            } catch(e) {\n                console.log(\"Failed to run constructor: \" + e);\n            }\n        });\n    }\n};\n\n// Register pause, resume and deviceready channels as events on document.\nchannel.onPause = cordova.addDocumentEventHandler('pause');\nchannel.onResume = cordova.addDocumentEventHandler('resume');\nchannel.onDeviceReady = cordova.addDocumentEventHandler('deviceready');\n\nmodule.exports = cordova;\n\n});\n\n//
 @ sourceURL=lib/cordova.js")} catch(e) {console.log("exception: in lib/cordova.js: " + e);console.log(e.stack);}
 try {eval("define(\"cordova/builder\", function(require, exports, module) {\nvar utils = require('cordova/utils');\n\nfunction each(objects, func, context) {\n    for (var prop in objects) {\n        if (objects.hasOwnProperty(prop)) {\n            func.apply(context, [objects[prop], prop]);\n        }\n    }\n}\n\nfunction include(parent, objects, clobber, merge) {\n    each(objects, function (obj, key) {\n        try {\n          var result = obj.path ? require(obj.path) : {};\n\n          if (clobber) {\n              // Clobber if it doesn't exist.\n              if (typeof parent[key] === 'undefined') {\n                  parent[key] = result;\n              } else if (typeof obj.path !== 'undefined') {\n                  // If merging, merge properties onto parent, otherwise, clobber.\n                  if (merge) {\n                      recursiveMerge(parent[key], result);\n                  } else {\n                      parent[key] = result;\n                  }\n        
       }\n              result = parent[key];\n          } else {\n            // Overwrite if not currently defined.\n            if (typeof parent[key] == 'undefined') {\n              parent[key] = result;\n            } else if (merge && typeof obj.path !== 'undefined') {\n              // If merging, merge parent onto result\n              recursiveMerge(result, parent[key]);\n              parent[key] = result;\n            } else {\n              // Set result to what already exists, so we can build children into it if they exist.\n              result = parent[key];\n            }\n          }\n\n          if (obj.children) {\n            include(result, obj.children, clobber, merge);\n          }\n        } catch(e) {\n          utils.alert('Exception building cordova JS globals: ' + e + ' for key \"' + key + '\"');\n        }\n    });\n}\n\n/**\n * Merge properties from one object onto another recursively.  Properties from\n * the src object will overwrite existing target p
 roperty.\n *\n * @param target Object to merge properties into.\n * @param src Object to merge properties from.\n */\nfunction recursiveMerge(target, src) {\n    for (var prop in src) {\n        if (src.hasOwnProperty(prop)) {\n            if (typeof target.prototype !== 'undefined' && target.prototype.constructor === target) {\n                // If the target object is a constructor override off prototype.\n                target.prototype[prop] = src[prop];\n            } else {\n                target[prop] = typeof src[prop] === 'object' ? recursiveMerge(\n                        target[prop], src[prop]) : src[prop];\n            }\n        }\n    }\n    return target;\n}\n\nmodule.exports = {\n    build: function (objects) {\n        return {\n            intoButDontClobber: function (target) {\n                include(target, objects, false, false);\n            },\n            intoAndClobber: function(target) {\n                include(target, objects, true, false);\n       
      },\n            intoAndMerge: function(target) {\n                include(target, objects, true, true);\n            }\n        };\n    }\n};\n\n});\n\n//@ sourceURL=lib/common/builder.js")} catch(e) {console.log("exception: in lib/common/builder.js: " + e);console.log(e.stack);}
 try {eval("define(\"cordova/channel\", function(require, exports, module) {\nvar utils = require('cordova/utils'),\n    nextGuid = 1;\n\n/**\n * Custom pub-sub \"channel\" that can have functions subscribed to it\n * This object is used to define and control firing of events for\n * cordova initialization.\n *\n * The order of events during page load and Cordova startup is as follows:\n *\n * onDOMContentLoaded         Internal event that is received when the web page is loaded and parsed.\n * onNativeReady              Internal event that indicates the Cordova native side is ready.\n * onCordovaReady             Internal event fired when all Cordova JavaScript objects have been created.\n * onCordovaInfoReady         Internal event fired when device properties are available.\n * onCordovaConnectionReady   Internal event fired when the connection property has been set.\n * onDeviceReady              User event fired to indicate that Cordova is ready\n * onResume                   Us
 er event fired to indicate a start/resume lifecycle event\n * onPause                    User event fired to indicate a pause lifecycle event\n * onDestroy                  Internal event fired when app is being destroyed (User should use window.onunload event, not this one).\n *\n * The only Cordova events that user code should register for are:\n *      deviceready           Cordova native code is initialized and Cordova APIs can be called from JavaScript\n *      pause                 App has moved to background\n *      resume                App has returned to foreground\n *\n * Listeners can be registered as:\n *      document.addEventListener(\"deviceready\", myDeviceReadyListener, false);\n *      document.addEventListener(\"resume\", myResumeListener, false);\n *      document.addEventListener(\"pause\", myPauseListener, false);\n *\n * The DOM lifecycle events should be used for saving and restoring state\n *      window.onload\n *      window.onunload\n *\n */\n\n/**\n * 
 Channel\n * @constructor\n * @param type  String the channel name\n * @param opts  Object options to pass into the channel, currently\n *                     supports:\n *                     onSubscribe: callback that fires when\n *                       something subscribes to the Channel. Sets\n *                       context to the Channel.\n *                     onUnsubscribe: callback that fires when\n *                       something unsubscribes to the Channel. Sets\n *                       context to the Channel.\n */\nvar Channel = function(type, opts) {\n    this.type = type;\n    this.handlers = {};\n    this.numHandlers = 0;\n    this.fired = false;\n    this.enabled = true;\n    this.events = {\n        onSubscribe:null,\n        onUnsubscribe:null\n    };\n    if (opts) {\n        if (opts.onSubscribe) this.events.onSubscribe = opts.onSubscribe;\n        if (opts.onUnsubscribe) this.events.onUnsubscribe = opts.onUnsubscribe;\n    }\n},\n    channel = {\n        /*
 *\n         * Calls the provided function only after all of the channels specified\n         * have been fired.\n         */\n        join: function (h, c) {\n            var i = c.length;\n            var len = i;\n            var f = function() {\n                if (!(--i)) h();\n            };\n            for (var j=0; j<len; j++) {\n                !c[j].fired?c[j].subscribeOnce(f):i--;\n            }\n            if (!i) h();\n        },\n        create: function (type, opts) {\n            channel[type] = new Channel(type, opts);\n            return channel[type];\n        },\n\n        /**\n         * cordova Channels that must fire before \"deviceready\" is fired.\n         */\n        deviceReadyChannelsArray: [],\n        deviceReadyChannelsMap: {},\n\n        /**\n         * Indicate that a feature needs to be initialized before it is ready to be used.\n         * This holds up Cordova's \"deviceready\" event until the feature has been initialized\n         * and Cordov
 a.initComplete(feature) is called.\n         *\n         * @param feature {String}     The unique feature name\n         */\n        waitForInitialization: function(feature) {\n            if (feature) {\n                var c = null;\n                if (this[feature]) {\n                    c = this[feature];\n                }\n                else {\n                    c = this.create(feature);\n                }\n                this.deviceReadyChannelsMap[feature] = c;\n                this.deviceReadyChannelsArray.push(c);\n            }\n        },\n\n        /**\n         * Indicate that initialization code has completed and the feature is ready to be used.\n         *\n         * @param feature {String}     The unique feature name\n         */\n        initializationComplete: function(feature) {\n            var c = this.deviceReadyChannelsMap[feature];\n            if (c) {\n                c.fire();\n            }\n        }\n    };\n\nfunction forceFunction(f) {\n    i
 f (f === null || f === undefined || typeof f != 'function') throw \"Function required as first argument!\";\n}\n\n/**\n * Subscribes the given function to the channel. Any time that\n * Channel.fire is called so too will the function.\n * Optionally specify an execution context for the function\n * and a guid that can be used to stop subscribing to the channel.\n * Returns the guid.\n */\nChannel.prototype.subscribe = function(f, c, g) {\n    // need a function to call\n    forceFunction(f);\n\n    var func = f;\n    if (typeof c == \"object\") { func = utils.close(c, f); }\n\n    g = g || func.observer_guid || f.observer_guid;\n    if (!g) {\n        // first time any channel has seen this subscriber\n        g = nextGuid++;\n    }\n    func.observer_guid = g;\n    f.observer_guid = g;\n\n    // Don't add the same handler more than once.\n    if (!this.handlers[g]) {\n        this.handlers[g] = func;\n        this.numHandlers++;\n        if (this.events.onSubscribe) this.events.onS
 ubscribe.call(this);\n        if (this.fired) func.apply(this, this.fireArgs);\n    }\n    return g;\n};\n\n/**\n * Like subscribe but the function is only called once and then it\n * auto-unsubscribes itself.\n */\nChannel.prototype.subscribeOnce = function(f, c) {\n    // need a function to call\n    forceFunction(f);\n\n    var g = null;\n    var _this = this;\n    if (this.fired) {\n        f.apply(c || null, this.fireArgs);\n    } else {\n        g = this.subscribe(function() {\n            _this.unsubscribe(g);\n            f.apply(c || null, arguments);\n        });\n        f.observer_guid = g;\n    }\n    return g;\n};\n\n/**\n * Unsubscribes the function with the given guid from the channel.\n */\nChannel.prototype.unsubscribe = function(g) {\n    // need a function to unsubscribe\n    if (g === null || g === undefined) { throw \"You must pass _something_ into Channel.unsubscribe\"; }\n\n    if (typeof g == 'function') { g = g.observer_guid; }\n    var handler = this.handl
 ers[g];\n    if (handler) {\n        if (handler.observer_guid) handler.observer_guid=null;\n        delete this.handlers[g];\n        this.numHandlers--;\n        if (this.events.onUnsubscribe) this.events.onUnsubscribe.call(this);\n    }\n};\n\n/**\n * Calls all functions subscribed to this channel.\n */\nChannel.prototype.fire = function(e) {\n    if (this.enabled) {\n        var fail = false;\n        this.fired = true;\n        this.fireArgs = arguments;\n        // Copy the values first so that it is safe to modify it from within\n        // callbacks.\n        var toCall = [];\n        for (var item in this.handlers) {\n            toCall.push(this.handlers[item]);\n        }\n        for (var i = 0; i < toCall.length; ++i) {\n            var rv = (toCall[i].apply(this, arguments)===false);\n            fail = fail || rv;\n        }\n        return !fail;\n    }\n    return true;\n};\n\n// defining them here so they are ready super fast!\n// DOM event that is received when th
 e web page is loaded and parsed.\nchannel.create('onDOMContentLoaded');\n\n// Event to indicate the Cordova native side is ready.\nchannel.create('onNativeReady');\n\n// Event to indicate that all Cordova JavaScript objects have been created\n// and it's time to run plugin constructors.\nchannel.create('onCordovaReady');\n\n// Event to indicate that device properties are available\nchannel.create('onCordovaInfoReady');\n\n// Event to indicate that the connection property has been set.\nchannel.create('onCordovaConnectionReady');\n\n// Event to indicate that Cordova is ready\nchannel.create('onDeviceReady');\n\n// Event to indicate a resume lifecycle event\nchannel.create('onResume');\n\n// Event to indicate a pause lifecycle event\nchannel.create('onPause');\n\n// Event to indicate a destroy lifecycle event\nchannel.create('onDestroy');\n\n// Channels that must fire before \"deviceready\" is fired.\nchannel.waitForInitialization('onCordovaReady');\nchannel.waitForInitialization('onC
 ordovaConnectionReady');\n\nmodule.exports = channel;\n\n});\n\n//@ sourceURL=lib/common/channel.js")} catch(e) {console.log("exception: in lib/common/channel.js: " + e);console.log(e.stack);}
-try {eval("define(\"cordova/common\", function(require, exports, module) {\nmodule.exports = {\n    objects: {\n        cordova: {\n            path: 'cordova',\n            children: {\n                exec: {\n                    path: 'cordova/exec'\n                },\n                logger: {\n                    path: 'cordova/plugin/logger'\n                }\n            }\n        },\n        Cordova: {\n            children: {\n                exec: {\n                    path: 'cordova/exec'\n                }\n            }\n        },\n        PhoneGap:{\n            children: {\n                exec: {\n                    path: 'cordova/exec'\n                }\n            }\n        },\n        navigator: {\n            children: {\n                notification: {\n                    path: 'cordova/plugin/notification'\n                },\n                accelerometer: {\n                    path: 'cordova/plugin/accelerometer'\n                },\n              
   battery: {\n                    path: 'cordova/plugin/battery'\n                },\n                camera:{\n                    path: 'cordova/plugin/Camera'\n                },\n                compass:{\n                    path: 'cordova/plugin/compass'\n                },\n                contacts: {\n                    path: 'cordova/plugin/contacts'\n                },\n                device:{\n                    children:{\n                        capture: {\n                            path: 'cordova/plugin/capture'\n                        }\n                    }\n                },\n                geolocation: {\n                    path: 'cordova/plugin/geolocation'\n                },\n                network: {\n                    children: {\n                        connection: {\n                            path: 'cordova/plugin/network'\n                        }\n                    }\n                },\n                splashscreen: {\n                  
   path: 'cordova/plugin/splashscreen'\n                }\n            }\n        },\n        Acceleration: {\n            path: 'cordova/plugin/Acceleration'\n        },\n        Camera:{\n            path: 'cordova/plugin/CameraConstants'\n        },\n        CameraPopoverOptions: {\n            path: 'cordova/plugin/CameraPopoverOptions'\n        },\n        CaptureError: {\n            path: 'cordova/plugin/CaptureError'\n        },\n        CaptureAudioOptions:{\n            path: 'cordova/plugin/CaptureAudioOptions'\n        },\n        CaptureImageOptions: {\n            path: 'cordova/plugin/CaptureImageOptions'\n        },\n        CaptureVideoOptions: {\n            path: 'cordova/plugin/CaptureVideoOptions'\n        },\n        CompassHeading:{\n            path: 'cordova/plugin/CompassHeading'\n        },\n        CompassError:{\n            path: 'cordova/plugin/CompassError'\n        },\n        ConfigurationData: {\n            path: 'cordova/plugin/ConfigurationData'\
 n        },\n        Connection: {\n            path: 'cordova/plugin/Connection'\n        },\n        Contact: {\n            path: 'cordova/plugin/Contact'\n        },\n        ContactAddress: {\n            path: 'cordova/plugin/ContactAddress'\n        },\n        ContactError: {\n            path: 'cordova/plugin/ContactError'\n        },\n        ContactField: {\n            path: 'cordova/plugin/ContactField'\n        },\n        ContactFindOptions: {\n            path: 'cordova/plugin/ContactFindOptions'\n        },\n        ContactName: {\n            path: 'cordova/plugin/ContactName'\n        },\n        ContactOrganization: {\n            path: 'cordova/plugin/ContactOrganization'\n        },\n        Coordinates: {\n            path: 'cordova/plugin/Coordinates'\n        },\n        device: {\n            path: 'cordova/plugin/device'\n        },\n        DirectoryEntry: {\n            path: 'cordova/plugin/DirectoryEntry'\n        },\n        DirectoryReader: {\n      
       path: 'cordova/plugin/DirectoryReader'\n        },\n        Entry: {\n            path: 'cordova/plugin/Entry'\n        },\n        File: {\n            path: 'cordova/plugin/File'\n        },\n        FileEntry: {\n            path: 'cordova/plugin/FileEntry'\n        },\n        FileError: {\n            path: 'cordova/plugin/FileError'\n        },\n        FileReader: {\n            path: 'cordova/plugin/FileReader'\n        },\n        FileSystem: {\n            path: 'cordova/plugin/FileSystem'\n        },\n        FileTransfer: {\n            path: 'cordova/plugin/FileTransfer'\n        },\n        FileTransferError: {\n            path: 'cordova/plugin/FileTransferError'\n        },\n        FileUploadOptions: {\n            path: 'cordova/plugin/FileUploadOptions'\n        },\n        FileUploadResult: {\n            path: 'cordova/plugin/FileUploadResult'\n        },\n        FileWriter: {\n            path: 'cordova/plugin/FileWriter'\n        },\n        Flags: {\n 
            path: 'cordova/plugin/Flags'\n        },\n        LocalFileSystem: {\n            path: 'cordova/plugin/LocalFileSystem'\n        },\n        Media: {\n            path: 'cordova/plugin/Media'\n        },\n        MediaError: {\n            path: 'cordova/plugin/MediaError'\n        },\n        MediaFile: {\n            path: 'cordova/plugin/MediaFile'\n        },\n        MediaFileData:{\n            path: 'cordova/plugin/MediaFileData'\n        },\n        Metadata:{\n            path: 'cordova/plugin/Metadata'\n        },\n        Position: {\n            path: 'cordova/plugin/Position'\n        },\n        PositionError: {\n            path: 'cordova/plugin/PositionError'\n        },\n        ProgressEvent: {\n            path: 'cordova/plugin/ProgressEvent'\n        },\n        requestFileSystem:{\n            path: 'cordova/plugin/requestFileSystem'\n        },\n        resolveLocalFileSystemURI:{\n            path: 'cordova/plugin/resolveLocalFileSystemURI'\n      
   }\n    }\n};\n\n});\n\n//@ sourceURL=lib/common/common.js")} catch(e) {console.log("exception: in lib/common/common.js: " + e);console.log(e.stack);}
+try {eval("define(\"cordova/common\", function(require, exports, module) {\nmodule.exports = {\n    objects: {\n        cordova: {\n            path: 'cordova',\n            children: {\n                exec: {\n                    path: 'cordova/exec'\n                },\n                logger: {\n                    path: 'cordova/plugin/logger'\n                }\n            }\n        },\n        Cordova: {\n            children: {\n                exec: {\n                    path: 'cordova/exec'\n                }\n            }\n        },\n        navigator: {\n            children: {\n                notification: {\n                    path: 'cordova/plugin/notification'\n                },\n                accelerometer: {\n                    path: 'cordova/plugin/accelerometer'\n                },\n                battery: {\n                    path: 'cordova/plugin/battery'\n                },\n                camera:{\n                    path: 'cordova/plugin/Came
 ra'\n                },\n                compass:{\n                    path: 'cordova/plugin/compass'\n                },\n                contacts: {\n                    path: 'cordova/plugin/contacts'\n                },\n                device:{\n                    children:{\n                        capture: {\n                            path: 'cordova/plugin/capture'\n                        }\n                    }\n                },\n                geolocation: {\n                    path: 'cordova/plugin/geolocation'\n                },\n                network: {\n                    children: {\n                        connection: {\n                            path: 'cordova/plugin/network'\n                        }\n                    }\n                },\n                splashscreen: {\n                    path: 'cordova/plugin/splashscreen'\n                }\n            }\n        },\n        Acceleration: {\n            path: 'cordova/plugin/Acceleration'\
 n        },\n        Camera:{\n            path: 'cordova/plugin/CameraConstants'\n        },\n        CameraPopoverOptions: {\n            path: 'cordova/plugin/CameraPopoverOptions'\n        },\n        CaptureError: {\n            path: 'cordova/plugin/CaptureError'\n        },\n        CaptureAudioOptions:{\n            path: 'cordova/plugin/CaptureAudioOptions'\n        },\n        CaptureImageOptions: {\n            path: 'cordova/plugin/CaptureImageOptions'\n        },\n        CaptureVideoOptions: {\n            path: 'cordova/plugin/CaptureVideoOptions'\n        },\n        CompassHeading:{\n            path: 'cordova/plugin/CompassHeading'\n        },\n        CompassError:{\n            path: 'cordova/plugin/CompassError'\n        },\n        ConfigurationData: {\n            path: 'cordova/plugin/ConfigurationData'\n        },\n        Connection: {\n            path: 'cordova/plugin/Connection'\n        },\n        Contact: {\n            path: 'cordova/plugin/Contact'\
 n        },\n        ContactAddress: {\n            path: 'cordova/plugin/ContactAddress'\n        },\n        ContactError: {\n            path: 'cordova/plugin/ContactError'\n        },\n        ContactField: {\n            path: 'cordova/plugin/ContactField'\n        },\n        ContactFindOptions: {\n            path: 'cordova/plugin/ContactFindOptions'\n        },\n        ContactName: {\n            path: 'cordova/plugin/ContactName'\n        },\n        ContactOrganization: {\n            path: 'cordova/plugin/ContactOrganization'\n        },\n        Coordinates: {\n            path: 'cordova/plugin/Coordinates'\n        },\n        device: {\n            path: 'cordova/plugin/device'\n        },\n        DirectoryEntry: {\n            path: 'cordova/plugin/DirectoryEntry'\n        },\n        DirectoryReader: {\n            path: 'cordova/plugin/DirectoryReader'\n        },\n        Entry: {\n            path: 'cordova/plugin/Entry'\n        },\n        File: {\n           
  path: 'cordova/plugin/File'\n        },\n        FileEntry: {\n            path: 'cordova/plugin/FileEntry'\n        },\n        FileError: {\n            path: 'cordova/plugin/FileError'\n        },\n        FileReader: {\n            path: 'cordova/plugin/FileReader'\n        },\n        FileSystem: {\n            path: 'cordova/plugin/FileSystem'\n        },\n        FileTransfer: {\n            path: 'cordova/plugin/FileTransfer'\n        },\n        FileTransferError: {\n            path: 'cordova/plugin/FileTransferError'\n        },\n        FileUploadOptions: {\n            path: 'cordova/plugin/FileUploadOptions'\n        },\n        FileUploadResult: {\n            path: 'cordova/plugin/FileUploadResult'\n        },\n        FileWriter: {\n            path: 'cordova/plugin/FileWriter'\n        },\n        Flags: {\n            path: 'cordova/plugin/Flags'\n        },\n        LocalFileSystem: {\n            path: 'cordova/plugin/LocalFileSystem'\n        },\n        Media
 : {\n            path: 'cordova/plugin/Media'\n        },\n        MediaError: {\n            path: 'cordova/plugin/MediaError'\n        },\n        MediaFile: {\n            path: 'cordova/plugin/MediaFile'\n        },\n        MediaFileData:{\n            path: 'cordova/plugin/MediaFileData'\n        },\n        Metadata:{\n            path: 'cordova/plugin/Metadata'\n        },\n        Position: {\n            path: 'cordova/plugin/Position'\n        },\n        PositionError: {\n            path: 'cordova/plugin/PositionError'\n        },\n        ProgressEvent: {\n            path: 'cordova/plugin/ProgressEvent'\n        },\n        requestFileSystem:{\n            path: 'cordova/plugin/requestFileSystem'\n        },\n        resolveLocalFileSystemURI:{\n            path: 'cordova/plugin/resolveLocalFileSystemURI'\n        }\n    }\n};\n\n});\n\n//@ sourceURL=lib/common/common.js")} catch(e) {console.log("exception: in lib/common/common.js: " + e);console.log(e.stack);}
 try {eval("define(\"cordova/exec\", function(require, exports, module) {\n/**\n * Execute a cordova command.  It is up to the native side whether this action\n * is synchronous or asynchronous.  The native side can return:\n *      Synchronous: PluginResult object as a JSON string\n *      Asynchronous: Empty string \"\"\n * If async, the native side will cordova.callbackSuccess or cordova.callbackError,\n * depending upon the result of the action.\n *\n * @param {Function} successCB  The success callback\n * @param {Function} failCB     The fail callback\n * @param {String} service      The name of the service to use\n * @param {String} action       Action to be run in cordova\n * @param {String[]} [args]     Zero or more arguments to pass to the method\n */\n\nvar tizen = require('cordova/plugin/tizen/manager'),\n    cordova = require('cordova'),\n    utils = require('cordova/utils');\n\nmodule.exports = function(successCB, failCB, service, action, args) {\n\n    try {\n        va
 r v = tizen.exec(successCB, failCB, service, action, args);\n\n        // If status is OK, then return value back to caller\n        if (v.status == cordova.callbackStatus.OK) {\n\n            // If there is a success callback, then call it now with returned value\n            if (successCB) {\n                try {\n                    successCB(v.message);\n                }\n                catch (e) {\n                    console.log(\"Error in success callback: \"+ service + \".\" + action + \" = \" + e);\n                }\n\n            }\n            return v.message;\n        } else if (v.status == cordova.callbackStatus.NO_RESULT) {\n            // Nothing to do here\n        } else {\n            // If error, then display error\n            console.log(\"Error: \" + service + \".\" + action + \" Status=\" + v.status + \" Message=\" + v.message);\n\n            // If there is a fail callback, then call it now with returned value\n            if (failCB) {\n                
 try {\n                    failCB(v.message);\n                }\n                catch (e) {\n                    console.log(\"Error in error callback: \" + service + \".\" + action + \" = \"+e);\n                }\n            }\n            return null;\n        }\n    } catch (e) {\n        utils.alert(\"Error: \" + e);\n    }\n};\n\n});\n\n//@ sourceURL=lib/tizen/exec.js")} catch(e) {console.log("exception: in lib/tizen/exec.js: " + e);console.log(e.stack);}
 try {eval("define(\"cordova/platform\", function(require, exports, module) {\nmodule.exports = {\n    id: \"tizen\",\n    initialize: function() {},\n    objects: {\n        device: {\n            path: \"cordova/plugin/tizen/Device\"\n        },\n        File: { // exists natively, override\n            path: \"cordova/plugin/File\"\n        },\n        FileReader: { // exists natively, override\n            path: \"cordova/plugin/FileReader\"\n        },\n        FileError: { //exists natively, override\n            path: \"cordova/plugin/FileError\"\n        }\n    },\n    merges: {\n        MediaError: { // exists natively\n            path: \"cordova/plugin/tizen/MediaError\"\n        },\n        navigator: {\n            children: {\n                device: {\n                    path: \"cordova/plugin/tizen/Device\"\n                },\n                contacts: {\n                    path: \"cordova/plugin/tizen/contacts\"\n                },\n               notification: {\
 n                   path: \"cordova/plugin/tizen/Notification\"\n               }\n            }\n        },\n        Contact: {\n            path: \"cordova/plugin/tizen/Contact\"\n        }\n    }\n};\n\n});\n\n//@ sourceURL=lib/tizen/platform.js")} catch(e) {console.log("exception: in lib/tizen/platform.js: " + e);console.log(e.stack);}
 try {eval("define(\"cordova/plugin/Acceleration\", function(require, exports, module) {\nvar Acceleration = function(x, y, z, timestamp) {\n    this.x = x;\n    this.y = y;\n    this.z = z;\n    this.timestamp = timestamp || (new Date()).getTime();\n};\n\nmodule.exports = Acceleration;\n\n});\n\n//@ sourceURL=lib/common/plugin/Acceleration.js")} catch(e) {console.log("exception: in lib/common/plugin/Acceleration.js: " + e);console.log(e.stack);}
@@ -95,7 +95,7 @@ try {eval("define(\"cordova/plugin/tizen/Camera\", function(require, exports, mo
 try {eval("define(\"cordova/plugin/tizen/Compass\", function(require, exports, module) {\nvar CompassError = require('cordova/plugin/CompassError'),\n    callback = null, ready = false;\n\nmodule.exports = {\n    getHeading: function(successCallback, errorCallback) {\n        if (window.DeviceOrientationEvent !== undefined) {\n            callback = function (orientation) {\n                var heading = 360 - orientation.alpha;\n                if (ready) {\n                    successCallback({\n                        magneticHeading: heading,\n                        trueHeading: heading,\n                        headingAccuracy: 0,\n                        timestamp: orientation.timeStamp\n                    });\n                    window.removeEventListener(\"deviceorientation\", callback);\n                }\n                ready = true;\n            };\n            ready = false; // workaround invalid first event value returned by WRT\n            window.addEventListener(
 \"deviceorientation\", callback);\n        }\n        else {\n            errorCallback(CompassError.COMPASS_NOT_SUPPORTED);\n        }\n    }\n};\n\n});\n\n//@ sourceURL=lib/tizen/plugin/tizen/Compass.js")} catch(e) {console.log("exception: in lib/tizen/plugin/tizen/Compass.js: " + e);console.log(e.stack);}
 try {eval("define(\"cordova/plugin/tizen/Contact\", function(require, exports, module) {\n/*global tizen:false */\nvar ContactError = require('cordova/plugin/ContactError'),\n    ContactUtils = require('cordova/plugin/tizen/ContactUtils'),\n    utils = require('cordova/utils'),\n    exec = require('cordova/exec');\n\n// ------------------\n// Utility functions\n// ------------------\n\n\n/**\n * Retrieves a Tizen Contact object from the device by its unique id.\n *\n * @param uid\n *            Unique id of the contact on the device\n * @return {tizen.Contact} Tizen Contact object or null if contact with\n *         specified id is not found\n */\nvar findByUniqueId = function(id) {\n\n    if (!id) {\n        return null;\n    }\n\n    var tizenContact = null;\n\n    tizen.contact.getDefaultAddressBook().find(\n        function _successCallback(contacts){\n            tizenContact = contacts[0];\n        },\n        function _errorCallback(error){\n            console.log(\"tizen fi
 nd error \" + error);\n        },\n        new tizen.AttributeFilter('id', 'CONTAINS', id),\n        new tizen.SortMode('id', 'ASC'));\n\n    return tizenContact || null;\n};\n\n\nvar traceTizenContact = function (tizenContact) {\n    console.log(\"cordova/plugin/tizen/Contact/  tizenContact.id \" + tizenContact.id);\n    console.log(\"cordova/plugin/tizen/Contact/  tizenContact.lastUpdated \" + tizenContact.lastUpdated);\n    console.log(\"cordova/plugin/tizen/Contact/  tizenContact.name \" + tizenContact.name);\n    console.log(\"cordova/plugin/tizen/Contact/  tizenContact.account \" + tizenContact.account);\n    console.log(\"cordova/plugin/tizen/Contact/  tizenContact.addresses \" + tizenContact.addresses);\n    console.log(\"cordova/plugin/tizen/Contact/  tizenContact.photoURI \" + tizenContact.photoURI);\n    console.log(\"cordova/plugin/tizen/Contact/  tizenContact.phoneNumbers \" + tizenContact.phoneNumbers);\n    console.log(\"cordova/plugin/tizen/Contact/  tizenContact.ema
 ils \" + tizenContact.emails);\n    console.log(\"cordova/plugin/tizen/Contact/  tizenContact.birthday \" + tizenContact.birthday);\n    console.log(\"cordova/plugin/tizen/Contact/  tizenContact.organization \" + tizenContact.organization);\n    console.log(\"cordova/plugin/tizen/Contact/  tizenContact.notes \" + tizenContact.notes);\n    console.log(\"cordova/plugin/tizen/Contact/  tizenContact.urls \" + tizenContact.isFavorite);\n    console.log(\"cordova/plugin/tizen/Contact/  tizenContact.isFavorite \" + tizenContact.isFavorite);\n    console.log(\"cordova/plugin/tizen/Contact/  tizenContact.ringtonesURI \" + tizenContact.ringtonesURI);\n    console.log(\"cordova/plugin/tizen/Contact/  tizenContact.categories \" + tizenContact.categories);\n};\n\n\n/**\n * Creates a Tizen contact object from the W3C Contact object and persists\n * it to device storage.\n *\n * @param {Contact}\n *            contact The contact to save\n * @return a new contact object with all properties set\n *
 /\nvar saveToDevice = function(contact) {\n\n    if (!contact) {\n        return;\n    }\n\n    var tizenContact = null;\n    var update = false;\n    var i = 0;\n\n    // if the underlying Tizen Contact object already exists, retrieve it for\n    // update\n    if (contact.id) {\n        // we must attempt to retrieve the BlackBerry contact from the device\n        // because this may be an update operation\n        tizenContact = findByUniqueId(contact.id);\n    }\n\n    // contact not found on device, create a new one\n    if (!tizenContact) {\n        tizenContact = new tizen.Contact();\n    }\n    // update the existing contact\n    else {\n        update = true;\n    }\n\n    // NOTE: The user may be working with a partial Contact object, because only\n    // user-specified Contact fields are returned from a find operation (blame\n    // the W3C spec). If this is an update to an existing Contact, we don't\n    // want to clear an attribute from the contact database simply beca
 use the\n    // Contact object that the user passed in contains a null value for that\n    // attribute. So we only copy the non-null Contact attributes to the\n    // Tizen Contact object before saving.\n    //\n    // This means that a user must explicitly set a Contact attribute to a\n    // non-null value in order to update it in the contact database.\n    //\n    traceTizenContact (tizenContact);\n\n    // display name\n    if (contact.displayName !== null) {\n        if (tizenContact.name === null) {\n            tizenContact.name = new tizen.ContactName();\n        }\n        if (tizenContact.name !== null) {\n            tizenContact.name.displayName = contact.displayName;\n        }\n    }\n\n    // name\n    if (contact.name !== null) {\n        if (contact.name.givenName) {\n            if (tizenContact.name === null) {\n                tizenContact.name = new tizen.ContactName();\n            }\n            if (tizenContact.name !== null) {\n                tizenContact.
 name.firstName = contact.name.givenName;\n            }\n        }\n\n        if  (contact.name.middleName) {\n            if (tizenContact.name === null) {\n                tizenContact.name = new tizen.ContactName();\n            }\n            if (tizenContact.name !== null) {\n                tizenContact.name.middleName = contact.name.middleName;\n            }\n        }\n\n        if (contact.name.familyName) {\n            if (tizenContact.name === null) {\n                tizenContact.name = new tizen.ContactName();\n            }\n            if (tizenContact.name !== null) {\n                tizenContact.name.lastName = contact.name.familyName;\n            }\n        }\n\n        if (contact.name.honorificPrefix) {\n            if (tizenContact.name === null) {\n                tizenContact.name = new tizen.ContactName();\n            }\n            if (tizenContact.name !== null) {\n                tizenContact.name.prefix = contact.name.honorificPrefix;\n            }\
 n        }\n    }\n\n    // nickname\n    if (contact.nickname !== null) {\n        if (tizenContact.name === null) {\n            tizenContact.name = new tizen.ContactName();\n        }\n        if (tizenContact.name !== null) {\n            if (!utils.isArray(tizenContact.name.nicknames))\n            {\n                tizenContact.name.nicknames = [];\n            }\n            tizenContact.name.nicknames[0] = contact.nickname;\n        }\n    }\n    else {\n        tizenContact.name.nicknames = [];\n    }\n\n    // note\n    if (contact.note !== null) {\n        if (tizenContact.note === null) {\n            tizenContact.note = [];\n        }\n        if (tizenContact.note !== null) {\n            tizenContact.note[0] = contact.note;\n        }\n    }\n\n    // photos\n    if (contact.photos && utils.isArray(contact.emails) && contact.emails.length > 0) {\n        tizenContact.photoURI = contact.photos[0];\n    }\n\n    if (utils.isDate(contact.birthday)) {\n        if (!utils
 .isDate(tizenContact.birthday)) {\n            tizenContact.birthday = new Date();\n        }\n        if (utils.isDate(tizenContact.birthday)) {\n            tizenContact.birthday.setDate(contact.birthday.getDate());\n        }\n    }\n\n    // Tizen supports many addresses\n    if (utils.isArray(contact.emails)) {\n\n        // if this is an update, re initialize email addresses\n        if (update) {\n            // doit on effacer sur un update??????\n        }\n\n        // copy the first three email addresses found\n        var emails = [];\n        for (i = 0; i < contact.emails.length; i += 1) {\n            var emailTypes = [];\n\n            emailTypes.push (contact.emails[i].type);\n\n            if (contact.emails[i].pref) {\n                emailTypes.push (\"PREF\");\n            }\n\n            emails.push(\n                new tizen.ContactEmailAddress(\n                    contact.emails[i].value,\n                    emailTypes)\n            );\n        }\n       
  tizenContact.emails = emails.length > 0 ? emails : [];\n    }\n    else {\n        tizenContact.emails = [];\n    }\n\n    // Tizen supports many phone numbers\n    // copy into appropriate fields based on type\n    if (utils.isArray(contact.phoneNumbers)) {\n        // if this is an update, re-initialize phone numbers\n        if (update) {\n        }\n\n        var phoneNumbers = [];\n\n        for (i = 0; i < contact.phoneNumbers.length; i += 1) {\n\n            if (!contact.phoneNumbers[i] || !contact.phoneNumbers[i].value) {\n                continue;\n            }\n\n             var phoneTypes = [];\n             phoneTypes.push (contact.phoneNumbers[i].type);\n\n             if (contact.phoneNumbers[i].pref) {\n                 phoneTypes.push (\"PREF\");\n             }\n\n            phoneNumbers.push(\n                new tizen.ContactPhoneNumber(\n                    contact.phoneNumbers[i].value,\n                    phoneTypes)\n            );\n        }\n\n        t
 izenContact.phoneNumbers = phoneNumbers.length > 0 ? phoneNumbers : [];\n    } else {\n        tizenContact.phoneNumbers = [];\n    }\n\n    if (utils.isArray(contact.addresses)) {\n        // if this is an update, re-initialize addresses\n        if (update) {\n        }\n\n        var addresses = [],\n            address = null;\n\n        for ( i = 0; i < contact.addresses.length; i += 1) {\n            address = contact.addresses[i];\n\n            if (!address || address.id === undefined || address.pref === undefined || address.type === undefined || address.formatted === undefined) {\n                continue;\n            }\n\n            var addressTypes = [];\n            addressTypes.push (address.type);\n\n            if (address.pref) {\n                addressTypes.push (\"PREF\");\n            }\n\n            addresses.push(\n                new tizen.ContactAddress({\n                         country:                   address.country,\n                         region
  :                   address.region,\n                         city:                      address.locality,\n                         streetAddress:             address.streetAddress,\n                         additionalInformation:     \"\",\n                         postalCode:                address.postalCode,\n                         types :                    addressTypes\n                }));\n\n        }\n        tizenContact.addresses = addresses.length > 0 ? addresses : [];\n\n    } else{\n        tizenContact.addresses = [];\n    }\n\n    // copy first url found to BlackBerry 'webpage' field\n    if (utils.isArray(contact.urls)) {\n        // if this is an update, re-initialize web page\n        if (update) {\n        }\n\n        var url = null,\n            urls = [];\n\n        for ( i = 0; i< contact.urls.length; i+= 1) {\n            url = contact.urls[i];\n\n            if (!url || !url.value) {\n                continue;\n            }\n\n            urls.push( ne
 w tizen.ContactWebSite(url.value, url.type));\n        }\n        tizenContact.urls = urls.length > 0 ? urls : [];\n    } else{\n        tizenContact.urls = [];\n    }\n\n    if (utils.isArray(contact.organizations && contact.organizations.length > 0) ) {\n        // if this is an update, re-initialize org attributes\n        var organization = contact.organizations[0];\n\n         tizenContact.organization = new tizen.ContacOrganization({\n             name:          organization.name,\n             department:    organization.department,\n             office:        \"\",\n             title:         organization.title,\n             role:          \"\",\n             logoURI:       \"\"\n         });\n    }\n\n    // categories\n    if (utils.isArray(contact.categories)) {\n        tizenContact.categories = [];\n\n        var category = null;\n\n        for (i = 0; i < contact.categories.length; i += 1) {\n            category = contact.categories[i];\n\n            if (typeof ca
 tegory === \"string\") {\n                tizenContact.categories.push(category);\n            }\n        }\n    }\n    else {\n        tizenContact.categories = [];\n    }\n\n    // save to device\n    // in tizen contact mean update or add\n    // later we might use addBatch and updateBatch\n    if (update){\n        tizen.contact.getDefaultAddressBook().update(tizenContact);\n    }\n    else {\n        tizen.contact.getDefaultAddressBook().add(tizenContact);\n    }\n\n    // Use the fully populated Tizen contact object to create a\n    // corresponding W3C contact object.\n    return ContactUtils.createContact(tizenContact, [ \"*\" ]);\n};\n\n\n/**\n * Creates a Tizen ContactAddress object from a W3C ContactAddress.\n *\n * @return {tizen.ContactAddress} a Tizen ContactAddress object\n */\nvar createTizenAddress = function(address) {\n\n    var type = null,\n        pref = null,\n        typesAr = [];\n\n    if (address === null) {\n        return null;\n    }\n\n\n    var tizenA
 ddress = new tizen.ContactAddress();\n\n    if (tizenAddress === null) {\n        return null;\n    }\n\n    typesAr.push(address.type);\n\n    if (address.pref) {\n        typesAr.push(\"PREF\");\n    }\n\n    tizenAddress.country = address.country || \"\";\n    tizenAddress.region = address.region || \"\";\n    tizenAddress.city = address.locality || \"\";\n    tizenAddress.streetAddress = address.streetAddress || \"\";\n    tizenAddress.postalCode = address.postalCode || \"\";\n    tizenAddress.types = typesAr || \"\";\n\n    return tizenAddress;\n};\n\nmodule.exports = {\n    /**\n     * Persists contact to device storage.\n     */\n\n    save : function(successCB, failCB) {\n\n        try {\n            // save the contact and store it's unique id\n            var fullContact = saveToDevice(this);\n\n            this.id = fullContact.id;\n\n            // This contact object may only have a subset of properties\n            // if the save was an update of an existing contact. T
 his is\n            // because the existing contact was likely retrieved using a\n            // subset of properties, so only those properties were set in the\n            // object. For this reason, invoke success with the contact object\n            // returned by saveToDevice since it is fully populated.\n\n            if (typeof successCB === 'function') {\n                successCB(fullContact);\n            }\n        }\n        catch (error) {\n            console.log('Error saving contact: ' +  error);\n\n            if (typeof failCB === 'function') {\n                failCB (new ContactError(ContactError.UNKNOWN_ERROR));\n            }\n        }\n    },\n\n    /**\n     * Removes contact from device storage.\n     *\n     * @param successCB\n     *            successCB callback\n     * @param failCB\n     *            error callback\n     */\n    remove : function (successCB, failCB) {\n\n        try {\n            // retrieve contact from device by id\n            var t
 izenContact = null;\n\n            if (this.id) {\n                tizenContact = findByUniqueId(this.id);\n            }\n\n\n            // if contact was found, remove it\n            if (tizenContact) {\n\n                tizen.contact.getDefaultAddressBook().remove(tizenContact.id);\n\n                if (typeof success === 'function') {\n                    successCB(this);\n                }\n            }\n            // attempting to remove a contact that hasn't been saved\n            else if (typeof failCB === 'function') {\n                failCB(new ContactError(ContactError.UNKNOWN_ERROR));\n            }\n        }\n        catch (error) {\n            console.log('Error removing contact ' + this.id + \": \" + error);\n            if (typeof failCB === 'function') {\n                failCB(new ContactError(ContactError.UNKNOWN_ERROR));\n            }\n        }\n    }\n};\n\n});\n\n//@ sourceURL=lib/tizen/plugin/tizen/Contact.js")} catch(e) {console.log("exception: in
  lib/tizen/plugin/tizen/Contact.js: " + e);console.log(e.stack);}
 try {eval("define(\"cordova/plugin/tizen/ContactUtils\", function(require, exports, module) {\n/*global tizen:false */\nvar ContactAddress = require('cordova/plugin/ContactAddress'),\n    ContactName = require('cordova/plugin/ContactName'),\n    ContactField = require('cordova/plugin/ContactField'),\n    ContactOrganization = require('cordova/plugin/ContactOrganization'),\n    utils = require('cordova/utils'),\n    Contact = require('cordova/plugin/Contact');\n\n/**\n * Mappings for each Contact field that may be used in a find operation. Maps\n * W3C Contact fields to one or more fields in a Tizen contact object.\n *\n * Example: user searches with a filter on the Contact 'name' field:\n *\n * <code>Contacts.find(['name'], onSuccess, onFail, {filter:'Bob'});</code>\n *\n * The 'name' field does not exist in a Tizen contact. Instead, a filter\n * expression will be built to search the Tizen contacts using the\n * Tizen 'title', 'firstName' and 'lastName' fields.\n */\nvar fieldMappi
 ngs = {\n    \"id\" : [\"id\"],\n    \"displayName\" : [\"name.displayName\"],\n    \"nickname\": [\"name.nicknames\"],\n    \"name\" : [ \"name.prefix\", \"name.firstName\", \"name.lastName\" ],\n    \"phoneNumbers\" : [\"phoneNumbers.number\",\"phoneNumbers.types\"],\n    \"emails\" : [\"emails.types\", \"emails.email\"],\n    \"addresses\" : [\"addresses.country\",\"addresses.region\",\"addresses.city\",\"addresses.streetAddress\",\"addresses.postalCode\",\"addresses.country\",\"addresses.types\"],\n    \"organizations\" : [\"organization.name\",\"organization.department\",\"organization.office\", \"organization.title\"],\n    \"birthday\" : [\"birthday\"],\n    \"note\" : [\"notes\"],\n    \"photos\" : [\"photoURI\"],\n    \"categories\" : [\"categories\"],\n    \"urls\" : [\"urls.url\", \"urls.type\"]\n};\n\n/*\n * Build an array of all of the valid W3C Contact fields. This is used to\n * substitute all the fields when [\"*\"] is specified.\n */\nvar allFields = [];\n\n(functio
 n initializeAllFieldsMapping() {\n\n    for ( var key in fieldMappings) {\n        allFields.push(key);\n    }\n    // as we want it to be executed once\n    function initializeAllFieldsMapping() {\n    }\n\n})();\n\n/**\n * Create a W3C ContactAddress object from a Tizen Address object\n *\n * @param {String}\n *            type the type of address (e.g. work, home)\n * @param {tizen.ContactAddress}\n *            tizenAddress a Tizen Address object\n * @return {ContactAddress} a contact address object or null if the specified\n *         address is null\n */\nvar createContactAddress = function(type, tizenAddress) {\n    if (!tizenAddress) {\n        return null;\n    }\n\n    var streetAddress = tizenAddress.streetAddress;\n    var locality = tizenAddress.city || \"\";\n    var region = tizenAddress.region || \"\";\n    var postalCode = tizenAddress.postalCode || \"\";\n    var country = tizenAddress.country || \"\";\n    var formatted = streetAddress + \", \" + locality + \", \"
  + region + \", \" + postalCode + \", \" + country;\n\n    var contact = new ContactAddress(null, type, formatted, streetAddress, locality, region, postalCode, country);\n\n    return contact;\n};\n\nmodule.exports = {\n    /**\n     * Builds Tizen filter expressions for contact search using the\n     * contact fields and search filter provided.\n     *\n     * @param {String[]}\n     *            fields Array of Contact fields to search\n     * @param {String}\n     *            filter Filter, or search string\n     * @param {Boolean}\n     *                 multiple, one contacts or more wanted as result\n     * @return filter expression or null if fields is empty or filter is null or\n     *         empty\n     */\n\n    buildFilterExpression: function(fields, filter) {\n        // ensure filter exists\n        if (!filter || filter === \"\") {\n            return null;\n        }\n\n        if ((fields.length === 1) && (fields[0] === \"*\")) {\n            // Cordova enhancement
  to allow fields value of [\"*\"] to indicate\n            // all supported fields.\n            fields = allFields;\n        }\n\n        // build a filter expression using all Contact fields provided\n        var compositeFilter = null,\n            attributeFilter = null,\n            filterExpression = null,\n            matchFlag = \"CONTAINS\",\n            matchValue = filter,\n            attributesArray = [];\n\n        if (fields && utils.isArray(fields)) {\n\n            for ( var field in fields) {\n\n                if (!fields[field]) {\n                    continue;\n                }\n\n                // retrieve Tizen contact fields that map Cordova fields specified\n                // (tizenFields is a string or an array of strings)\n                var tizenFields = fieldMappings[fields[field]];\n\n                if (!tizenFields) {\n                    // does something maps\n                    continue;\n                }\n\n                // construct the f
 ilter expression using the Tizen fields\n                for ( var index in tizenFields) {\n                    attributeFilter = new tizen.AttributeFilter(tizenFields[index], matchFlag, matchValue);\n                    if (attributeFilter !== null) {\n                        attributesArray.push(attributeFilter);\n                    }\n                }\n            }\n        }\n\n        // fullfil tizen find attribute as a single or a composite attribute\n        if (attributesArray.length == 1 ) {\n            filterExpression = attributeFilter[0];\n        } else if (attributesArray.length > 1) {\n            // combine the filters as a Union\n            filterExpression = new tizen.CompositeFilter(\"UNION\", attributesArray);\n        } else {\n            filterExpression = null;\n        }\n\n        return filterExpression;\n    },\n\n\n\n    /**\n     * Creates a Contact object from a Tizen Contact object, copying only\n     * the fields specified.\n     *\n     * This
  is intended as a privately used function but it is made globally\n     * available so that a Contact.save can convert a BlackBerry contact object\n     * into its W3C equivalent.\n     *\n     * @param {tizen.Contact}\n     *            tizenContact Tizen Contact object\n     * @param {String[]}\n     *            fields array of contact fields that should be copied\n     * @return {Contact} a contact object containing the specified fields or\n     *         null if the specified contact is null\n     */\n    createContact: function(tizenContact, fields) {\n\n        if (!tizenContact) {\n            return null;\n        }\n\n        // construct a new contact object\n        // always copy the contact id and displayName fields\n        var contact = new Contact(tizenContact.id, tizenContact.name.displayName);\n\n\n        // nothing to do\n        if (!fields || !(utils.isArray(fields)) || fields.length === 0) {\n            return contact;\n        } else if (fields.length === 1
  && fields[0] === \"*\") {\n            // Cordova enhancement to allow fields value of [\"*\"] to indicate\n            // all supported fields.\n            fields = allFields;\n        }\n\n        // add the fields specified\n        for ( var key in fields) {\n\n            var field = fields[key],\n                index = 0;\n\n            if (!field) {\n                continue;\n            }\n\n            // name\n            if (field.indexOf('name') === 0) {\n\n                var formattedName = (tizenContact.name.prefix || \"\");\n\n                if (tizenContact.name.firstName) {\n                    formattedName += ' ';\n                    formattedName += (tizenContact.name.firstName || \"\");\n                }\n\n                if (tizenContact.name.middleName) {\n                    formattedName += ' ';\n                    formattedName += (tizenContact.name.middleName || \"\");\n                }\n\n                if (tizenContact.name.lastName) {\n     
                formattedName += ' ';\n                    formattedName += (tizenContact.name.lastName || \"\");\n                }\n\n                contact.name = new ContactName(\n                        formattedName,\n                        tizenContact.name.lastName,\n                        tizenContact.name.firstName,\n                        tizenContact.name.middleName,\n                        tizenContact.name.prefix,\n                        null);\n            }\n\n            // phoneNumbers\n            else if (field.indexOf('phoneNumbers') === 0) {\n\n                var phoneNumbers = [];\n\n                for (index = 0 ; index < tizenContact.phoneNumbers.length ; ++index) {\n\n                    phoneNumbers.push(\n                            new ContactField(\n                                    'PHONE',\n                                    tizenContact.phoneNumbers[index].number,\n                                    ((tizenContact.phoneNumbers[index].types
 [1]) &&  (tizenContact.emails[index].types[1] === \"PREF\") ) ? true : false));\n                }\n\n\n                contact.phoneNumbers = phoneNumbers.length > 0 ? phoneNumbers : null;\n            }\n\n            // emails\n            else if (field.indexOf('emails') === 0) {\n\n                var emails = [];\n\n                for (index = 0 ; index < tizenContact.emails.length ; ++index) {\n\n                    emails.push(\n                        new ContactField(\n                            'EMAILS',\n                            tizenContact.emails[index].email,\n                            ((tizenContact.emails[index].types[1]) &&  (tizenContact.emails[index].types[1] === \"PREF\") ) ? true : false));\n                }\n                contact.emails = emails.length > 0 ? emails : null;\n            }\n\n            // addresses\n            else if (field.indexOf('addresses') === 0) {\n\n                var addresses = [];\n                for (index = 0 ; index 
 < tizenContact.addresses.length ; ++index) {\n\n                    addresses.push(\n                            new ContactAddress(\n                                    ((tizenContact.addresses[index].types[1] &&  tizenContact.addresses[index].types[1] === \"PREF\") ? true : false),\n                                    tizenContact.addresses[index].types[0] ? tizenContact.addresses[index].types[0] : \"HOME\",\n                                    null,\n                                    tizenContact.addresses[index].streetAddress,\n                                    tizenContact.addresses[index].city,\n                                    tizenContact.addresses[index].region,\n                                    tizenContact.addresses[index].postalCode,\n                                    tizenContact.addresses[index].country ));\n                }\n\n                contact.addresses = addresses.length > 0 ? addresses : null;\n            }\n\n            // birthday\n          
   else if (field.indexOf('birthday') === 0) {\n                if (utils.isDate(tizenContact.birthday)) {\n                    contact.birthday = tizenContact.birthday;\n                }\n            }\n\n            // note only one in Tizen Contact\n            else if (field.indexOf('note') === 0) {\n                if (tizenContact.note) {\n                    contact.note = tizenContact.note[0];\n                }\n            }\n\n            // organizations\n            else if (field.indexOf('organizations') === 0) {\n\n                var organizations = [];\n\n                // there's only one organization in a Tizen Address\n\n                if (tizenContact.organization) {\n                    organizations.push(\n                            new ContactOrganization(\n                                    true,\n                                    'WORK',\n                                    tizenContact.organization.name,\n                                    tizenCont
 act.organization.department,\n                                    tizenContact.organization.jobTitle));\n                }\n\n                contact.organizations = organizations.length > 0 ? organizations : null;\n            }\n\n            // categories\n            else if (field.indexOf('categories') === 0) {\n\n                var categories = [];\n\n                if (tizenContact.categories) {\n\n                    for (index = 0 ; index < tizenContact.categories.length ; ++index) {\n                        categories.push(\n                                new ContactField(\n                                        'MAIN',\n                                        tizenContact.categories,\n                                        (index === 0) ));\n                    }\n\n                    contact.categories = categories.length > 0 ? categories : null;\n                }\n            }\n\n            // urls\n            else if (field.indexOf('urls') === 0) {\n         
        var urls = [];\n\n                if (tizenContact.urls) {\n                    for (index = 0 ; index <tizenContact.urls.length ; ++index) {\n                        urls.push(\n                                new ContactField(\n                                        tizenContact.urls[index].type,\n                                        tizenContact.urls[index].url,\n                                        (index === 0)));\n                    }\n                }\n\n                contact.urls = urls.length > 0 ? urls : null;\n            }\n\n            // photos\n            else if (field.indexOf('photos') === 0) {\n                var photos = [];\n\n                if (tizenContact.photoURI) {\n                    photos.push(new ContactField('URI', tizenContact.photoURI, true));\n                }\n\n                contact.photos = photos.length > 0 ? photos : null;\n            }\n        }\n\n        return contact;\n    }\n};\n\n});\n\n//@ sourceURL=lib/tizen/
 plugin/tizen/ContactUtils.js")} catch(e) {console.log("exception: in lib/tizen/plugin/tizen/ContactUtils.js: " + e);console.log(e.stack);}
-try {eval("define(\"cordova/plugin/tizen/Device\", function(require, exports, module) {\n/*global tizen:false */\nvar channel = require('cordova/channel');\n\n// Tell cordova channel to wait on the CordovaInfoReady event\nchannel.waitForInitialization('onCordovaInfoReady');\n\nfunction Device() {\n    this.version = null;\n    this.uuid = null;\n    this.name = null;\n    this.cordova = \"2.1.0rc2\";\n    this.platform = \"Tizen\";\n\n    var me = this;\n\n    function onSuccessCallback(sysInfoProp) {\n        me.name = sysInfoProp.model;\n        me.uuid = sysInfoProp.imei;\n        me.version = sysInfoProp.version;\n        channel.onCordovaInfoReady.fire();\n    }\n\n    function onErrorCallback(error) {\n        console.log(\"error initializing cordova: \" + error);\n    }\n\n    channel.onCordovaReady.subscribeOnce(function() {\n        me.getDeviceInfo(onSuccessCallback, onErrorCallback);\n    });\n}\n\nDevice.prototype.getDeviceInfo = function(success, fail, args) {\n    tize
 n.systeminfo.getPropertyValue(\"Device\", success, fail);\n};\n\nmodule.exports = new Device();\n\n});\n\n//@ sourceURL=lib/tizen/plugin/tizen/Device.js")} catch(e) {console.log("exception: in lib/tizen/plugin/tizen/Device.js: " + e);console.log(e.stack);}
+try {eval("define(\"cordova/plugin/tizen/Device\", function(require, exports, module) {\n/*global tizen:false */\nvar channel = require('cordova/channel');\n\n// Tell cordova channel to wait on the CordovaInfoReady event\nchannel.waitForInitialization('onCordovaInfoReady');\n\nfunction Device() {\n    this.version = null;\n    this.uuid = null;\n    this.name = null;\n    this.cordova = \"2.1.0\";\n    this.platform = \"Tizen\";\n\n    var me = this;\n\n    function onSuccessCallback(sysInfoProp) {\n        me.name = sysInfoProp.model;\n        me.uuid = sysInfoProp.imei;\n        me.version = sysInfoProp.version;\n        channel.onCordovaInfoReady.fire();\n    }\n\n    function onErrorCallback(error) {\n        console.log(\"error initializing cordova: \" + error);\n    }\n\n    channel.onCordovaReady.subscribeOnce(function() {\n        me.getDeviceInfo(onSuccessCallback, onErrorCallback);\n    });\n}\n\nDevice.prototype.getDeviceInfo = function(success, fail, args) {\n    tizen.s
 ysteminfo.getPropertyValue(\"Device\", success, fail);\n};\n\nmodule.exports = new Device();\n\n});\n\n//@ sourceURL=lib/tizen/plugin/tizen/Device.js")} catch(e) {console.log("exception: in lib/tizen/plugin/tizen/Device.js: " + e);console.log(e.stack);}
 try {eval("define(\"cordova/plugin/tizen/File\", function(require, exports, module) {\n/*global WebKitBlobBuilder:false */\nvar FileError = require('cordova/plugin/FileError'),\n    DirectoryEntry = require('cordova/plugin/DirectoryEntry'),\n    FileEntry = require('cordova/plugin/FileEntry'),\n    File = require('cordova/plugin/File'),\n    FileSystem = require('cordova/plugin/FileSystem');\n\nvar nativeRequestFileSystem = window.webkitRequestFileSystem,\n    nativeResolveLocalFileSystemURI = window.webkitResolveLocalFileSystemURL,\n    NativeFileReader = window.FileReader;\n\nfunction getFileSystemName(nativeFs) {\n    return (nativeFs.name.indexOf(\"Persistent\") != -1) ? \"persistent\" : \"temporary\";\n}\n\nfunction makeEntry(entry) {\n    if (entry.isDirectory) {\n        return new DirectoryEntry(entry.name, decodeURI(entry.toURL()));\n    }\n    else {\n        return new FileEntry(entry.name, decodeURI(entry.toURL()));\n    }\n}\n\nmodule.exports = {\n    /* requestFileSyst
 em */\n    requestFileSystem: function(successCallback, errorCallback, args) {\n        var type = args[0],\n            size = args[1];\n\n        nativeRequestFileSystem(type, size, function(nativeFs) {\n            successCallback(new FileSystem(getFileSystemName(nativeFs), makeEntry(nativeFs.root)));\n        }, function(error) {\n            errorCallback(error.code);\n        });\n    },\n\n    /* resolveLocalFileSystemURI */\n    resolveLocalFileSystemURI: function(successCallback, errorCallback, args) {\n        var uri = args[0];\n\n        nativeResolveLocalFileSystemURI(uri, function(entry) {\n            successCallback(makeEntry(entry));\n        }, function(error) {\n            errorCallback(error.code);\n        });\n    },\n\n    /* DirectoryReader */\n    readEntries: function(successCallback, errorCallback, args) {\n        var uri = args[0];\n\n        nativeResolveLocalFileSystemURI(uri, function(dirEntry) {\n            var reader = dirEntry.createReader();\n  
           reader.readEntries(function(entries) {\n                var retVal = [];\n                for (var i = 0; i < entries.length; i++) {\n                    retVal.push(makeEntry(entries[i]));\n                }\n                successCallback(retVal);\n            }, function(error) {\n                errorCallback(error.code);\n            });\n        }, function(error) {\n            errorCallback(error.code);\n        });\n    },\n\n    /* Entry */\n    getMetadata: function(successCallback, errorCallback, args) {\n        var uri = args[0];\n\n        nativeResolveLocalFileSystemURI(uri, function(entry) {\n            entry.getMetadata(function(metaData) {\n                successCallback(metaData.modificationTime);\n            }, function(error) {\n                errorCallback(error.code);\n            });\n        }, function(error) {\n            errorCallback(error.code);\n        });\n    },\n\n    moveTo: function(successCallback, errorCallback, args) {\n      
   var srcUri = args[0],\n            parentUri = args[1],\n            name = args[2];\n\n        nativeResolveLocalFileSystemURI(srcUri, function(source) {\n            nativeResolveLocalFileSystemURI(parentUri, function(parent) {\n                source.moveTo(parent, name, function(entry) {\n                    successCallback(makeEntry(entry));\n                }, function(error) {\n                    errorCallback(error.code);\n                });\n            }, function(error) {\n                errorCallback(error.code);\n            });\n        }, function(error) {\n            errorCallback(error.code);\n        });\n    },\n\n    copyTo: function(successCallback, errorCallback, args) {\n        var srcUri = args[0],\n            parentUri = args[1],\n            name = args[2];\n\n        nativeResolveLocalFileSystemURI(srcUri, function(source) {\n            nativeResolveLocalFileSystemURI(parentUri, function(parent) {\n                source.copyTo(parent, name, funct
 ion(entry) {\n                    successCallback(makeEntry(entry));\n                }, function(error) {\n                    errorCallback(error.code);\n                });\n            }, function(error) {\n                errorCallback(error.code);\n            });\n        }, function(error) {\n            errorCallback(error.code);\n        });\n    },\n\n    remove: function(successCallback, errorCallback, args) {\n        var uri = args[0];\n\n        nativeResolveLocalFileSystemURI(uri, function(entry) {\n            if (entry.fullPath === \"/\") {\n                errorCallback(FileError.NO_MODIFICATION_ALLOWED_ERR);\n            } else {\n                entry.remove(successCallback, function(error) {\n                    errorCallback(error.code);\n                });\n            }\n        }, function(error) {\n            errorCallback(error.code);\n        });\n    },\n\n    getParent: function(successCallback, errorCallback, args) {\n        var uri = args[0];\n\n 
        nativeResolveLocalFileSystemURI(uri, function(entry) {\n            entry.getParent(function(entry) {\n                successCallback(makeEntry(entry));\n            }, function(error) {\n                errorCallback(error.code);\n            });\n        }, function(error) {\n            errorCallback(error.code);\n        });\n    },\n\n    /* FileEntry */\n    getFileMetadata: function(successCallback, errorCallback, args) {\n        var uri = args[0];\n\n        nativeResolveLocalFileSystemURI(uri, function(entry) {\n            entry.file(function(file) {\n                var retVal = new File(file.name, decodeURI(entry.toURL()), file.type, file.lastModifiedDate, file.size);\n                successCallback(retVal);\n            }, function(error) {\n                errorCallback(error.code);\n            });\n        }, function(error) {\n            errorCallback(error.code);\n        });\n    },\n\n    /* DirectoryEntry */\n    getDirectory: function(successCallback
 , errorCallback, args) {\n        var uri = args[0],\n            path = args[1],\n            options = args[2];\n\n        nativeResolveLocalFileSystemURI(uri, function(entry) {\n            entry.getDirectory(path, options, function(entry) {\n                successCallback(makeEntry(entry));\n            }, function(error) {\n                if (error.code === FileError.INVALID_MODIFICATION_ERR) {\n                    if (options.create) {\n                        errorCallback(FileError.PATH_EXISTS_ERR);\n                    } else {\n                        errorCallback(FileError.ENCODING_ERR);\n                    }\n                } else {\n                    errorCallback(error.code);\n                }\n            });\n        }, function(error) {\n            errorCallback(error.code);\n        });\n    },\n\n    removeRecursively: function(successCallback, errorCallback, args) {\n        var uri = args[0];\n\n        nativeResolveLocalFileSystemURI(uri, function(entr
 y) {\n            if (entry.fullPath === \"/\") {\n                errorCallback(FileError.NO_MODIFICATION_ALLOWED_ERR);\n            } else {\n                entry.removeRecursively(successCallback, function(error) {\n                    errorCallback(error.code);\n                });\n            }\n        }, function(error) {\n            errorCallback(error.code);\n        });\n    },\n\n    getFile: function(successCallback, errorCallback, args) {\n        var uri = args[0],\n            path = args[1],\n            options = args[2];\n\n        nativeResolveLocalFileSystemURI(uri, function(entry) {\n            entry.getFile(path, options, function(entry) {\n                successCallback(makeEntry(entry));\n            }, function(error) {\n                if (error.code === FileError.INVALID_MODIFICATION_ERR) {\n                    if (options.create) {\n                        errorCallback(FileError.PATH_EXISTS_ERR);\n                    } else {\n                      
   errorCallback(FileError.ENCODING_ERR);\n                    }\n                } else {\n                    errorCallback(error.code);\n                }\n            });\n        }, function(error) {\n            errorCallback(error.code);\n        });\n    },\n\n    /* FileReader */\n    readAsText: function(successCallback, errorCallback, args) {\n        var uri = args[0],\n            encoding = args[1];\n\n        nativeResolveLocalFileSystemURI(uri, function(entry) {\n            var onLoadEnd = function(evt) {\n                    if (!evt.target.error) {\n                        successCallback(evt.target.result);\n                    }\n            },\n                onError = function(evt) {\n                    errorCallback(evt.target.error.code);\n            };\n\n            var reader = new NativeFileReader();\n\n            reader.onloadend = onLoadEnd;\n            reader.onerror = onError;\n            entry.file(function(file) {\n                reader.readA
 sText(file, encoding);\n            }, function(error) {\n                errorCallback(error.code);\n            });\n        }, function(error) {\n            errorCallback(error.code);\n        });\n    },\n\n    readAsDataURL: function(successCallback, errorCallback, args) {\n        var uri = args[0];\n\n        nativeResolveLocalFileSystemURI(uri, function(entry) {\n            var onLoadEnd = function(evt) {\n                    if (!evt.target.error) {\n                        successCallback(evt.target.result);\n                    }\n            },\n                onError = function(evt) {\n                    errorCallback(evt.target.error.code);\n            };\n\n            var reader = new NativeFileReader();\n\n            reader.onloadend = onLoadEnd;\n            reader.onerror = onError;\n            entry.file(function(file) {\n                reader.readAsDataURL(file);\n            }, function(error) {\n                errorCallback(error.code);\n            }
 );\n        }, function(error) {\n            errorCallback(error.code);\n        });\n    },\n\n    /* FileWriter */\n    write: function(successCallback, errorCallback, args) {\n        var uri = args[0],\n            text = args[1],\n            position = args[2];\n\n        nativeResolveLocalFileSystemURI(uri, function(entry) {\n            var onWriteEnd = function(evt) {\n                    if(!evt.target.error) {\n                        successCallback(evt.target.position - position);\n                    } else {\n                        errorCallback(evt.target.error.code);\n                    }\n            },\n                onError = function(evt) {\n                    errorCallback(evt.target.error.code);\n            };\n\n            entry.createWriter(function(writer) {\n                var blob = new WebKitBlobBuilder();\n                blob.append(text);\n\n                writer.onwriteend = onWriteEnd;\n                writer.onerror = onError;\n\n        
         writer.seek(position);\n                writer.write(blob.getBlob('text/plain'));\n            }, function(error) {\n                errorCallback(error.code);\n            });\n        }, function(error) {\n            errorCallback(error.code);\n        });\n    },\n\n    truncate: function(successCallback, errorCallback, args) {\n        var uri = args[0],\n            size = args[1];\n\n        nativeResolveLocalFileSystemURI(uri, function(entry) {\n            var onWriteEnd = function(evt) {\n                    if(!evt.target.error) {\n                        successCallback(evt.target.length);\n                    } else {\n                        errorCallback(evt.target.error.code);\n                    }\n            },\n                onError = function(evt) {\n                    errorCallback(evt.target.error.code);\n            };\n\n            entry.createWriter(function(writer) {\n                writer.onwriteend = onWriteEnd;\n                writer.oner
 ror = onError;\n\n                writer.truncate(size);\n            }, function(error) {\n                errorCallback(error.code);\n            });\n        }, function(error) {\n            errorCallback(error.code);\n        });\n    }\n};\n\n});\n\n//@ sourceURL=lib/tizen/plugin/tizen/File.js")} catch(e) {console.log("exception: in lib/tizen/plugin/tizen/File.js: " + e);console.log(e.stack);}
 try {eval("define(\"cordova/plugin/tizen/FileTransfer\", function(require, exports, module) {\n/*global WebKitBlobBuilder:false */\nvar FileEntry = require('cordova/plugin/FileEntry'),\n    FileTransferError = require('cordova/plugin/FileTransferError'),\n    FileUploadResult = require('cordova/plugin/FileUploadResult');\n\nvar nativeResolveLocalFileSystemURI = window.webkitResolveLocalFileSystemURL;\n\nfunction getParentPath(filePath) {\n    var pos = filePath.lastIndexOf('/');\n    return filePath.substring(0, pos + 1);\n}\n\nfunction getFileName(filePath) {\n    var pos = filePath.lastIndexOf('/');\n    return filePath.substring(pos + 1);\n}\n\nmodule.exports = {\n    upload: function(successCallback, errorCallback, args) {\n        var filePath = args[0],\n            server = args[1],\n            fileKey = args[2],\n            fileName = args[3],\n            mimeType = args[4],\n            params = args[5],\n            /*trustAllHosts = args[6],*/\n            chunkedMode 
 = args[7];\n\n        nativeResolveLocalFileSystemURI(filePath, function(entry) {\n            entry.file(function(file) {\n                function uploadFile(blobFile) {\n                    var fd = new FormData();\n\n                    fd.append(fileKey, blobFile, fileName);\n                    for (var prop in params) {\n                        if(params.hasOwnProperty(prop)) {\n                            fd.append(prop, params[prop]);\n                        }\n                    }\n\n                    var xhr = new XMLHttpRequest();\n                    xhr.open(\"POST\", server);\n                    xhr.onload = function(evt) {\n                        if (xhr.status == 200) {\n                            var result = new FileUploadResult();\n                            result.bytesSent = file.size;\n                            result.responseCode = xhr.status;\n                            result.response = xhr.response;\n                            successCallback(r
 esult);\n                        } else if (xhr.status == 404) {\n                            errorCallback(new FileTransferError(FileTransferError.INVALID_URL_ERR));\n                        } else {\n                            errorCallback(new FileTransferError(FileTransferError.CONNECTION_ERR));\n                        }\n                    };\n                    xhr.ontimeout = function(evt) {\n                        errorCallback(new FileTransferError(FileTransferError.CONNECTION_ERR));\n                    };\n\n                    xhr.send(fd);\n                }\n\n                var bytesPerChunk;\n                if (chunkedMode === true) {\n                    bytesPerChunk = 1024 * 1024; // 1MB chunk sizes.\n                } else {\n                    bytesPerChunk = file.size;\n                }\n                var start = 0;\n                var end = bytesPerChunk;\n                while (start < file.size) {\n                    var chunk = file.webkitSlice
 (start, end, mimeType);\n                    uploadFile(chunk);\n                    start = end;\n                    end = start + bytesPerChunk;\n                }\n            },\n            function(error) {\n                errorCallback(new FileTransferError(FileTransferError.FILE_NOT_FOUND_ERR));\n            }\n            );\n        },\n        function(error) {\n            errorCallback(new FileTransferError(FileTransferError.FILE_NOT_FOUND_ERR));\n        }\n        );\n    },\n\n    download: function(successCallback, errorCallback, args) {\n        var url = args[0],\n            filePath = args[1];\n\n        var xhr = new XMLHttpRequest();\n\n        function writeFile(fileEntry) {\n            fileEntry.createWriter(function(writer) {\n                writer.onwriteend = function(evt) {\n                    if (!evt.target.error) {\n                        successCallback(new FileEntry(fileEntry.name, fileEntry.toURL()));\n                    } else {\n          
               errorCallback(new FileTransferError(FileTransferError.FILE_NOT_FOUND_ERR));\n                    }\n                };\n\n                writer.onerror = function(evt) {\n                    errorCallback(new FileTransferError(FileTransferError.FILE_NOT_FOUND_ERR));\n                };\n\n                var builder = new WebKitBlobBuilder();\n                builder.append(xhr.response);\n                var blob = builder.getBlob();\n                writer.write(blob);\n            },\n            function(error) {\n                errorCallback(new FileTransferError(FileTransferError.FILE_NOT_FOUND_ERR));\n            });\n        }\n\n        xhr.onreadystatechange = function () {\n            if (xhr.readyState == xhr.DONE) {\n                if (xhr.status == 200 && xhr.response) {\n                    nativeResolveLocalFileSystemURI(getParentPath(filePath), function(dir) {\n                        dir.getFile(getFileName(filePath), {create: true}, writeFile, fu
 nction(error) {\n                            errorCallback(new FileTransferError(FileTransferError.FILE_NOT_FOUND_ERR));\n                        });\n                    }, function(error) {\n                        errorCallback(new FileTransferError(FileTransferError.FILE_NOT_FOUND_ERR));\n                    });\n                } else if (xhr.status == 404) {\n                    errorCallback(new FileTra

<TRUNCATED>

Mime
View raw message