Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4BB5910BE7 for ; Fri, 28 Jun 2013 00:33:22 +0000 (UTC) Received: (qmail 76306 invoked by uid 500); 28 Jun 2013 00:33:22 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 76289 invoked by uid 500); 28 Jun 2013 00:33:22 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 76282 invoked by uid 99); 28 Jun 2013 00:33:22 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Jun 2013 00:33:22 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id F13EA38E9E; Fri, 28 Jun 2013 00:33:21 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: purplecabbage@apache.org To: commits@cordova.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: js commit: [WP7] DOMStorage is now added/polyfilled via native code Date: Fri, 28 Jun 2013 00:33:21 +0000 (UTC) Updated Branches: refs/heads/master d422f84c5 -> f96eefcd3 [WP7] DOMStorage is now added/polyfilled via native code Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/f96eefcd Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/f96eefcd Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/f96eefcd Branch: refs/heads/master Commit: f96eefcd37a67e1fb1128676c4e18a26413fed81 Parents: d422f84 Author: Jesse MacFadyen Authored: Thu Jun 27 17:33:04 2013 -0700 Committer: Jesse MacFadyen Committed: Thu Jun 27 17:33:04 2013 -0700 ---------------------------------------------------------------------- .../windowsphone/DOMStorage/plugininit.js | 146 ------------------- 1 file changed, 146 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-js/blob/f96eefcd/lib/windowsphone/plugin/windowsphone/DOMStorage/plugininit.js ---------------------------------------------------------------------- diff --git a/lib/windowsphone/plugin/windowsphone/DOMStorage/plugininit.js b/lib/windowsphone/plugin/windowsphone/DOMStorage/plugininit.js deleted file mode 100644 index c8bd777..0000000 --- a/lib/windowsphone/plugin/windowsphone/DOMStorage/plugininit.js +++ /dev/null @@ -1,146 +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. - * -*/ - -(function(win, doc) { -var docDomain = null; -try { - docDomain = doc.domain; -} catch (err) {} -var isIE10 = navigator.userAgent.toUpperCase().indexOf('MSIE 10') > -1; -if (!isIE10 && (!docDomain || docDomain.length === 0) ) { - var DOMStorage = function(type) { - if (type == "sessionStorage") { - this._type = type; - } - Object.defineProperty(this, "length", { - configurable: true, - get: function() { - return this.getLength(); - } - }); - }; - DOMStorage.prototype = { - _type: "localStorage", - _result: null, - keys: null, - onResult: function(key, valueStr) { - if (!this.keys) { - this.keys = []; - } - this._result = valueStr; - }, - onKeysChanged: function(jsonKeys) { - this.keys = JSON.parse(jsonKeys); - var key; - for (var n = 0, len = this.keys.length; n < len; n++) { - key = this.keys[n]; - if (!this.hasOwnProperty(key)) { - Object.defineProperty(this, key, { - configurable: true, - get: function() { - return this.getItem(key); - }, - set: function(val) { - return this.setItem(key, val); - } - }); - } - } - }, - initialize: function() { - window.external.Notify("DOMStorage/" + this._type + "/load/keys"); - }, - getLength: function() { - if (!this.keys) { - this.initialize(); - } - return this.keys.length; - }, - key: function(n) { - if (!this.keys) { - this.initialize(); - } - if (n >= this.keys.length) { - return null; - } else { - return this.keys[n]; - } - }, - getItem: function(key) { - if (!this.keys) { - this.initialize(); - } - var retVal = null; - if (this.keys.indexOf(key) > -1) { - window.external.Notify("DOMStorage/" + this._type + "/get/" + key); - retVal = window.unescape(decodeURIComponent(this._result)); - this._result = null; - } - return retVal; - }, - setItem: function(key, value) { - if (!this.keys) { - this.initialize(); - } - window.external.Notify("DOMStorage/" + this._type + "/set/" + key + "/" + encodeURIComponent(window.escape(value))); - }, - removeItem: function(key) { - if (!this.keys) { - this.initialize(); - } - var index = this.keys.indexOf(key); - if (index > -1) { - this.keys.splice(index, 1); - window.external.Notify("DOMStorage/" + this._type + "/remove/" + key); - delete this[key]; - } - }, - clear: function() { - if (!this.keys) { - this.initialize(); - } - for (var n = 0, len = this.keys.length; n < len; n++) { - delete this[this.keys[n]]; - } - this.keys = []; - window.external.Notify("DOMStorage/" + this._type + "/clear/"); - } - }; - if (typeof window.localStorage === "undefined") { - Object.defineProperty(window, "localStorage", { - writable: false, - configurable: false, - value: new DOMStorage("localStorage") - }); - window.localStorage.initialize(); - } - if (typeof window.sessionStorage === "undefined") { - Object.defineProperty(window, "sessionStorage", { - writable: false, - configurable: false, - value: new DOMStorage("sessionStorage") - }); - window.sessionStorage.initialize(); - } -} -})(window, document); - -module.exports = null; \ No newline at end of file