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 441FD10A15 for ; Mon, 28 Apr 2014 21:28:14 +0000 (UTC) Received: (qmail 34338 invoked by uid 500); 28 Apr 2014 21:28:04 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 33819 invoked by uid 500); 28 Apr 2014 21:27:51 -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 33600 invoked by uid 99); 28 Apr 2014 21:27:46 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 Apr 2014 21:27:46 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 753099940DD; Mon, 28 Apr 2014 21:27:45 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: naika@apache.org To: commits@cordova.apache.org Date: Mon, 28 Apr 2014 21:27:58 -0000 Message-Id: <9be0f0c391324f0393cc09ded4f039fd@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [14/34] git commit: fixing index + prompt response fixing index + prompt response Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/commit/85f37ff2 Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/tree/85f37ff2 Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/diff/85f37ff2 Branch: refs/heads/dev Commit: 85f37ff2b63dd951c8e9cc55ab70be77f62a7391 Parents: 3516df4 Author: Piotr Zalewa Authored: Mon Jan 27 14:36:51 2014 +0100 Committer: Archana Naik Committed: Thu Mar 20 16:28:55 2014 -0700 ---------------------------------------------------------------------- src/firefoxos/notification.js | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/blob/85f37ff2/src/firefoxos/notification.js ---------------------------------------------------------------------- diff --git a/src/firefoxos/notification.js b/src/firefoxos/notification.js index 7362934..5c14829 100644 --- a/src/firefoxos/notification.js +++ b/src/firefoxos/notification.js @@ -45,7 +45,7 @@ function modal(message, callback, title, buttonLabels, domObjects) { function addButton(label, index, recommended) { var button = document.createElement('button'); button.appendChild(document.createTextNode(label)); - button.labelIndex = index; + button.labelIndex = index + 1; button.addEventListener('click', callbackButton, false); if (recommended) { // TODO: default one listens to Enter key @@ -56,7 +56,17 @@ function modal(message, callback, title, buttonLabels, domObjects) { // call callback and destroy modal function callbackButton() { - callback(this.labelIndex); + var promptInput = document.getElementById('prompt-input'); + var promptValue; + var response; + if (promptInput) { + response = { + input1: promptInput.value, + buttonIndex: this.labelIndex + } + } + response = response || this.labelIndex; + callback(response); box.parentNode.removeChild(box); } } @@ -80,16 +90,15 @@ var Notification = { modal(message, _callback, title, buttonLabels); }, prompt: function(successCallback, errorCallback, args) { - console.log(args); var message = args[0]; var title = args[1]; var buttonLabels = args[2]; var defaultText = args[3]; - var _tempcallback = (successCallback || _empty); - function _callback(labelIndex) { - var content = document.getElementById('prompt-input').value; - successCallback(labelIndex, content); - } + var _callback = (successCallback || _empty); + // function _callback(labelIndex) { + // console.log(content); + // successCallback(labelIndex, content); + // } var inputParagraph = document.createElement('p'); inputParagraph.classList.add('input'); var inputElement = document.createElement('input');