1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/Touchgui/plugins/org.apache.cordova.dialogs/doc/zh/index.md Thu Jun 04 14:50:33 2015 +0200 1.3 @@ -0,0 +1,247 @@ 1.4 +<!--- 1.5 + Licensed to the Apache Software Foundation (ASF) under one 1.6 + or more contributor license agreements. See the NOTICE file 1.7 + distributed with this work for additional information 1.8 + regarding copyright ownership. The ASF licenses this file 1.9 + to you under the Apache License, Version 2.0 (the 1.10 + "License"); you may not use this file except in compliance 1.11 + with the License. You may obtain a copy of the License at 1.12 + 1.13 + http://www.apache.org/licenses/LICENSE-2.0 1.14 + 1.15 + Unless required by applicable law or agreed to in writing, 1.16 + software distributed under the License is distributed on an 1.17 + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 1.18 + KIND, either express or implied. See the License for the 1.19 + specific language governing permissions and limitations 1.20 + under the License. 1.21 +--> 1.22 + 1.23 +# org.apache.cordova.dialogs 1.24 + 1.25 +這個外掛程式提供了對一些本機對話方塊的使用者介面元素的訪問。 1.26 + 1.27 +## 安裝 1.28 + 1.29 + cordova plugin add org.apache.cordova.dialogs 1.30 + 1.31 + 1.32 +## 方法 1.33 + 1.34 +* `navigator.notification.alert` 1.35 +* `navigator.notification.confirm` 1.36 +* `navigator.notification.prompt` 1.37 +* `navigator.notification.beep` 1.38 + 1.39 +## navigator.notification.alert 1.40 + 1.41 +顯示一個自訂的警報或對話方塊框。 大多數科爾多瓦實現使用本機對話方塊中的此項功能,但一些平臺使用瀏覽器的 `alert` 函數,這是通常不那麼可自訂。 1.42 + 1.43 + navigator.notification.alert(message, alertCallback, [title], [buttonName]) 1.44 + 1.45 + 1.46 +* **消息**: 消息對話方塊。*(字串)* 1.47 + 1.48 +* **alertCallback**: 當警報對話方塊的被解雇時要調用的回檔。*(函數)* 1.49 + 1.50 +* **標題**: 標題對話方塊。*(字串)*(可選,預設值為`Alert`) 1.51 + 1.52 +* **buttonName**: 按鈕名稱。*(字串)*(可選,預設值為`OK`) 1.53 + 1.54 +### 示例 1.55 + 1.56 + function alertDismissed() { 1.57 + // do something 1.58 + } 1.59 + 1.60 + navigator.notification.alert( 1.61 + 'You are the winner!', // message 1.62 + alertDismissed, // callback 1.63 + 'Game Over', // title 1.64 + 'Done' // buttonName 1.65 + ); 1.66 + 1.67 + 1.68 +### 支援的平臺 1.69 + 1.70 +* 亞馬遜火 OS 1.71 +* Android 系統 1.72 +* 黑莓 10 1.73 +* 火狐瀏覽器作業系統 1.74 +* iOS 1.75 +* Tizen 1.76 +* Windows Phone 7 和 8 1.77 +* Windows 8 1.78 + 1.79 +### Windows Phone 7 和 8 怪癖 1.80 + 1.81 +* 有沒有內置瀏覽器警報,但你可以綁定一個,如下所示調用 `alert()` 在全球範圍內: 1.82 + 1.83 + window.alert = navigator.notification.alert; 1.84 + 1.85 + 1.86 +* 兩個 `alert` 和 `confirm` 的非阻塞的調用,其中的結果才是可用的非同步。 1.87 + 1.88 +### 火狐瀏覽器作業系統怪癖: 1.89 + 1.90 +這兩個本機阻止 `window.alert()` 和非阻塞 `navigator.notification.alert()` 可用。 1.91 + 1.92 +## navigator.notification.confirm 1.93 + 1.94 +顯示一個可自訂的確認對話方塊。 1.95 + 1.96 + navigator.notification.confirm(message, confirmCallback, [title], [buttonLabels]) 1.97 + 1.98 + 1.99 +* **消息**: 消息對話方塊。*(字串)* 1.100 + 1.101 +* **confirmCallback**: 要用索引 (1、 2 或 3) 按下的按鈕,或者在沒有按下按鈕 (0) 駁回了對話方塊中時調用的回檔。*(函數)* 1.102 + 1.103 +* **標題**: 標題對話方塊。*(字串)*(可選,預設值為`Confirm`) 1.104 + 1.105 +* **buttonLabels**: 指定按鈕標籤的字串陣列。*(陣列)*(可選,預設值為 [ `OK,Cancel` ]) 1.106 + 1.107 +### confirmCallback 1.108 + 1.109 +`confirmCallback`當使用者按下確認對話方塊中的按鈕之一的時候執行。 1.110 + 1.111 +回檔將參數 `buttonIndex` *(編號)*,它是按下的按鈕的索引。 請注意索引使用基於 1 的索引,所以值是 `1` , `2` , `3` ,等等。 1.112 + 1.113 +### 示例 1.114 + 1.115 + function onConfirm(buttonIndex) { 1.116 + alert('You selected button ' + buttonIndex); 1.117 + } 1.118 + 1.119 + navigator.notification.confirm( 1.120 + 'You are the winner!', // message 1.121 + onConfirm, // callback to invoke with index of button pressed 1.122 + 'Game Over', // title 1.123 + ['Restart','Exit'] // buttonLabels 1.124 + ); 1.125 + 1.126 + 1.127 +### 支援的平臺 1.128 + 1.129 +* 亞馬遜火 OS 1.130 +* Android 系統 1.131 +* 黑莓 10 1.132 +* 火狐瀏覽器作業系統 1.133 +* iOS 1.134 +* Tizen 1.135 +* Windows Phone 7 和 8 1.136 +* Windows 8 1.137 + 1.138 +### Windows Phone 7 和 8 怪癖 1.139 + 1.140 +* 有沒有內置的瀏覽器功能的 `window.confirm` ,但你可以將它綁定通過分配: 1.141 + 1.142 + window.confirm = navigator.notification.confirm; 1.143 + 1.144 + 1.145 +* 調用到 `alert` 和 `confirm` 的非阻塞,所以結果就是只可用以非同步方式。 1.146 + 1.147 +### 火狐瀏覽器作業系統怪癖: 1.148 + 1.149 +這兩個本機阻止 `window.confirm()` 和非阻塞 `navigator.notification.confirm()` 可用。 1.150 + 1.151 +## navigator.notification.prompt 1.152 + 1.153 +顯示本機的對話方塊,更可自訂的瀏覽器比 `prompt` 函數。 1.154 + 1.155 + navigator.notification.prompt(message, promptCallback, [title], [buttonLabels], [defaultText]) 1.156 + 1.157 + 1.158 +* **消息**: 消息對話方塊。*(字串)* 1.159 + 1.160 +* **promptCallback**: 要用索引 (1、 2 或 3) 按下的按鈕,或者在沒有按下按鈕 (0) 駁回了對話方塊中時調用的回檔。*(函數)* 1.161 + 1.162 +* **標題**: 對話方塊的標題*(字串)* (可選,預設值為`Prompt`) 1.163 + 1.164 +* **buttonLabels**: 陣列,這些字串指定按鈕標籤*(陣列)* (可選,預設值為`["OK","Cancel"]`) 1.165 + 1.166 +* **defaultText**: 預設文字方塊中輸入值 ( `String` ) (可選,預設值: 空字串) 1.167 + 1.168 +### promptCallback 1.169 + 1.170 +`promptCallback`當使用者按下一個提示對話方塊中的按鈕時執行。`results`物件傳遞給回檔的包含以下屬性: 1.171 + 1.172 +* **buttonIndex**: 按下的按鈕的索引。*(人數)*請注意索引使用基於 1 的索引,所以值是 `1` , `2` , `3` ,等等。 1.173 + 1.174 +* **輸入 1**: 在提示對話方塊中輸入的文本。*(字串)* 1.175 + 1.176 +### 示例 1.177 + 1.178 + function onPrompt(results) { 1.179 + alert("You selected button number " + results.buttonIndex + " and entered " + results.input1); 1.180 + } 1.181 + 1.182 + navigator.notification.prompt( 1.183 + 'Please enter your name', // message 1.184 + onPrompt, // callback to invoke 1.185 + 'Registration', // title 1.186 + ['Ok','Exit'], // buttonLabels 1.187 + 'Jane Doe' // defaultText 1.188 + ); 1.189 + 1.190 + 1.191 +### 支援的平臺 1.192 + 1.193 +* 亞馬遜火 OS 1.194 +* Android 系統 1.195 +* 火狐瀏覽器作業系統 1.196 +* iOS 1.197 +* Windows Phone 7 和 8 1.198 + 1.199 +### Android 的怪癖 1.200 + 1.201 +* Android 支援最多的三個按鈕,並忽略任何更多。 1.202 + 1.203 +* 關於 Android 3.0 及更高版本,使用全息主題的設備按相反的順序顯示按鈕。 1.204 + 1.205 +### 火狐瀏覽器作業系統怪癖: 1.206 + 1.207 +這兩個本機阻止 `window.prompt()` 和非阻塞 `navigator.notification.prompt()` 可用。 1.208 + 1.209 +## navigator.notification.beep 1.210 + 1.211 +該設備播放提示音聲音。 1.212 + 1.213 + navigator.notification.beep(times); 1.214 + 1.215 + 1.216 +* **時間**: 的次數重複發出蜂鳴音。*(人數)* 1.217 + 1.218 +### 示例 1.219 + 1.220 + // Beep twice! 1.221 + navigator.notification.beep(2); 1.222 + 1.223 + 1.224 +### 支援的平臺 1.225 + 1.226 +* 亞馬遜火 OS 1.227 +* Android 系統 1.228 +* 黑莓 10 1.229 +* iOS 1.230 +* Tizen 1.231 +* Windows Phone 7 和 8 1.232 +* Windows 8 1.233 + 1.234 +### 亞馬遜火 OS 怪癖 1.235 + 1.236 +* 亞馬遜火 OS 播放預設**設置/顯示 & 聲音**面板下指定的**通知聲音**。 1.237 + 1.238 +### Android 的怪癖 1.239 + 1.240 +* Android 系統播放的預設**通知鈴聲****設置/聲音和顯示**面板下指定。 1.241 + 1.242 +### Windows Phone 7 和 8 怪癖 1.243 + 1.244 +* 依賴泛型蜂鳴音檔從科爾多瓦分佈。 1.245 + 1.246 +### Tizen 怪癖 1.247 + 1.248 +* Tizen 通過播放音訊檔通過媒體 API 實現會發出蜂鳴聲。 1.249 + 1.250 +* 蜂鳴音檔必須很短,必須設在 `sounds` 子目錄中的應用程式的根目錄中,並且必須命名`beep.wav`. 1.251 \ No newline at end of file