http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/3.1.0/cordova/media/media.stop.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.1.0/cordova/media/media.stop.md b/www/docs/zh-cn/3.1.0/cordova/media/media.stop.md new file mode 100644 index 0000000..3f3165e --- /dev/null +++ b/www/docs/zh-cn/3.1.0/cordova/media/media.stop.md @@ -0,0 +1,171 @@ +--- +license: > + 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. + +title: media.stop +--- + +# media.stop + +åæ¢ææ¾é³è¨æªã + + media.stop() ï¼ + + +## 說æ + +`media.stop`æ¹æ³åæ¥å·è¡åæ¢ææ¾é³è¨æªã + +## æ¯æ´çå¹³èº + +* Android 系統 +* é»èææ© WebWorks ï¼OS 5.0 åæ´é«ï¼ +* iOS +* Windows Phone 7 å 8 +* Tizen +* Windows 8 + +## å¿«éçç¤ºä¾ + + // Play audio + // + function playAudio(url) { + // Play the audio file at url + var my_media = new Media(url, + // success callback + function() { + console.log("playAudio():Audio Success"); + }, + // error callback + function(err) { + console.log("playAudio():Audio Error: "+err); + } + ); + + // Play audio + my_media.play(); + + // Pause after 10 seconds + setTimeout(function() { + my_media.stop(); + }, 10000); + } + + +## å®æ´çç¤ºä¾ + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" + "http://www.w3.org/TR/html4/strict.dtd"> + <html> + <head> + <title>Media Example</title> + + <script type="text/javascript" charset="utf-8" src="cordova.js"></script> + <script type="text/javascript" charset="utf-8"> + + // Wait for device API libraries to load + // + document.addEventListener("deviceready", onDeviceReady, false); + + // device APIs are available + // + function onDeviceReady() { + playAudio("http://audio.ibeat.org/content/p1rj1s/p1rj1s_-_rockGuitar.mp3"); + } + + // Audio player + // + var my_media = null; + var mediaTimer = null; + + // Play audio + // + function playAudio(src) { + // Create Media object from src + my_media = new Media(src, onSuccess, onError); + + // Play audio + my_media.play(); + + // Update my_media position every second + if (mediaTimer == null) { + mediaTimer = setInterval(function() { + // get my_media position + my_media.getCurrentPosition( + // success callback + function(position) { + if (position > -1) { + setAudioPosition((position) + " sec"); + } + }, + // error callback + function(e) { + console.log("Error getting pos=" + e); + setAudioPosition("Error: " + e); + } + ); + }, 1000); + } + } + + // Pause audio + // + function pauseAudio() { + if (my_media) { + my_media.pause(); + } + } + + // Stop audio + // + function stopAudio() { + if (my_media) { + my_media.stop(); + } + clearInterval(mediaTimer); + mediaTimer = null; + } + + // onSuccess Callback + // + function onSuccess() { + console.log("playAudio():Audio Success"); + } + + // onError Callback + // + function onError(error) { + alert('code: ' + error.code + '\n' + + 'message: ' + error.message + '\n'); + } + + // Set audio position + // + function setAudioPosition(position) { + document.getElementById('audio_position').innerHTML = position; + } + + </script> + </head> + <body> + <a href="#" class="btn large" onclick="playAudio('http://audio.ibeat.org/content/p1rj1s/p1rj1s_-_rockGuitar.mp3');">Play Audio</a> + <a href="#" class="btn large" onclick="pauseAudio();">Pause Playing Audio</a> + <a href="#" class="btn large" onclick="stopAudio();">Stop Playing Audio</a> + <p id="audio_position"></p> + </body> + </html> \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/3.1.0/cordova/media/media.stopRecord.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.1.0/cordova/media/media.stopRecord.md b/www/docs/zh-cn/3.1.0/cordova/media/media.stopRecord.md new file mode 100644 index 0000000..c9203e2 --- /dev/null +++ b/www/docs/zh-cn/3.1.0/cordova/media/media.stopRecord.md @@ -0,0 +1,141 @@ +--- +license: > + 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. + +title: media.stopRecord +--- + +# media.stopRecord + +åæ¢é製é³è¨æªã + + media.stopRecord() ï¼ + + +## 說æ + +`media.stopRecord`æ¹æ³å·è¡åæ¥ï¼åæ¢é製çé³è¨æªã + +## æ¯æ´çå¹³èº + +* Android 系統 +* é»èææ© WebWorks ï¼OS 5.0 åæ´é«ï¼ +* iOS +* Windows Phone 7 å 8 +* Windows 8 + +## å¿«éçç¤ºä¾ + + // Record audio + // + function recordAudio() { + var src = "myrecording.mp3"; + var mediaRec = new Media(src, + // success callback + function() { + console.log("recordAudio():Audio Success"); + }, + + // error callback + function(err) { + console.log("recordAudio():Audio Error: "+ err.code); + } + ); + + // Record audio + mediaRec.startRecord(); + + // Stop recording after 10 seconds + setTimeout(function() { + mediaRec.stopRecord(); + }, 10000); + } + + +## å®æ´çç¤ºä¾ + + <!DOCTYPE html> + <html> + <head> + <title>Device Properties Example</title> + + <script type="text/javascript" charset="utf-8" src="cordova.js"></script> + <script type="text/javascript" charset="utf-8"> + + // Wait for device API libraries to load + // + document.addEventListener("deviceready", onDeviceReady, false); + + // Record audio + // + function recordAudio() { + var src = "myrecording.mp3"; + var mediaRec = new Media(src, onSuccess, onError); + + // Record audio + mediaRec.startRecord(); + + // Stop recording after 10 sec + var recTime = 0; + var recInterval = setInterval(function() { + recTime = recTime + 1; + setAudioPosition(recTime + " sec"); + if (recTime >= 10) { + clearInterval(recInterval); + mediaRec.stopRecord(); + } + }, 1000); + } + + // device APIs are available + // + function onDeviceReady() { + recordAudio(); + } + + // onSuccess Callback + // + function onSuccess() { + console.log("recordAudio():Audio Success"); + } + + // onError Callback + // + function onError(error) { + alert('code: ' + error.code + '\n' + + 'message: ' + error.message + '\n'); + } + + // Set audio position + // + function setAudioPosition(position) { + document.getElementById('audio_position').innerHTML = position; + } + + </script> + </head> + <body> + <p id="media">Recording audio...</p> + <p id="audio_position"></p> + </body> + </html> + + +## Tizen æªç + +* Tizen è¨åä¸ä¸æ¯æ´ã \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/3.1.0/cordova/notification/notification.alert.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.1.0/cordova/notification/notification.alert.md b/www/docs/zh-cn/3.1.0/cordova/notification/notification.alert.md new file mode 100644 index 0000000..2abb4ee --- /dev/null +++ b/www/docs/zh-cn/3.1.0/cordova/notification/notification.alert.md @@ -0,0 +1,118 @@ +--- +license: > + 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. + +title: notification.alert +--- + +# notification.alert + +顯示ä¸åèªè¨çè¦å ±æå°è©±æ¹å¡æ¡ã + + navigator.notification.alert(message, alertCallback, [title], [buttonName]) + + +* **æ¶æ¯**ï¼ æ¶æ¯å°è©±æ¹å¡ã*ï¼å串ï¼* + +* **alertCallback**ï¼ ç¶è¦å ±å°è©±æ¹å¡ç被解éæè¦èª¿ç¨çåæªã*ï¼å½æ¸ï¼* + +* **æ¨é¡**ï¼ æ¨é¡å°è©±æ¹å¡ã*ï¼å串ï¼*ï¼å¯é¸ï¼é è¨å¼çº`Alert`) + +* **buttonName**ï¼ æéå稱ã*ï¼å串ï¼*ï¼å¯é¸ï¼é è¨å¼çº`OK`) + +## 說æ + +大å¤æ¸ç§ç¾å¤ç¦å¯¦ç¾ä½¿ç¨æ¬æ©å°è©±æ¹å¡ä¸çæ¤é åè½ï¼ä½ä¸äºå¹³èºä½¿ç¨ç覽å¨ç `alert` å½æ¸ï¼éæ¯é常ä¸é£éº¼å¯èªè¨ã + +## æ¯æ´çå¹³èº + +* Android 系統 +* é»èææ© WebWorks ï¼OS 5.0 åæ´é«ï¼ +* iOS +* Tizen +* Windows Phone 7 å 8 +* Windows 8 + +## å¿«éçç¤ºä¾ + + // Android / BlackBerry WebWorks (OS 5.0 and higher) / iOS / Tizen + // + function alertDismissed() { + // do something + } + + navigator.notification.alert( + 'You are the winner!', // message + alertDismissed, // callback + 'Game Over', // title + 'Done' // buttonName + ); + + +## å®æ´çç¤ºä¾ + + <!DOCTYPE html> + <html> + <head> + <title>Notification Example</title> + + <script type="text/javascript" charset="utf-8" src="cordova.js"></script> + <script type="text/javascript" charset="utf-8"> + + // Wait for device API libraries to load + // + document.addEventListener("deviceready", onDeviceReady, false); + + // device APIs are available + // + function onDeviceReady() { + // Empty + } + + // alert dialog dismissed + function alertDismissed() { + // do something + } + + // Show a custom alertDismissed + // + function showAlert() { + navigator.notification.alert( + 'You are the winner!', // message + alertDismissed, // callback + 'Game Over', // title + 'Done' // buttonName + ); + } + + </script> + </head> + <body> + <p><a href="#" onclick="showAlert(); return false;">Show Alert</a></p> + </body> + </html> + + +## Windows Phone 7 å 8 æªç + +* ææ²æå §ç½®ç覽å¨è¦å ±ï¼ä½ä½ å¯ä»¥ç¶å®ä¸åï¼å¦ä¸æç¤ºèª¿ç¨ `alert()` å¨å ¨çç¯åå §ï¼ + + window.alert = navigator.notification.alert; + + +* å ©å `alert` å `confirm` çéé»å¡ç調ç¨ï¼å ¶ä¸ççµæææ¯å¯ç¨çéåæ¥ã \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/3.1.0/cordova/notification/notification.beep.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.1.0/cordova/notification/notification.beep.md b/www/docs/zh-cn/3.1.0/cordova/notification/notification.beep.md new file mode 100644 index 0000000..148b69c --- /dev/null +++ b/www/docs/zh-cn/3.1.0/cordova/notification/notification.beep.md @@ -0,0 +1,110 @@ +--- +license: > + 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. + +title: notification.beep +--- + +# notification.beep + +該è¨åææ¾æ示é³è²é³ã + + navigator.notification.beep(times); + + +* **æé**ï¼ ç次æ¸éè¤ç¼åºèé³´é³ã*ï¼äººæ¸ï¼* + +## æ¯æ´çå¹³èº + +* Android 系統 +* é»èææ© WebWorks ï¼OS 5.0 åæ´é«ï¼ +* iOS +* Tizen +* Windows Phone 7 å 8 + +## å¿«éçç¤ºä¾ + + // Beep twice! + navigator.notification.beep(2); + + +## å®æ´çç¤ºä¾ + + <!DOCTYPE html> + <html> + <head> + <title>Notification Example</title> + + <script type="text/javascript" charset="utf-8" src="cordova.js"></script> + <script type="text/javascript" charset="utf-8"> + + // Wait for device API libraries to load + // + document.addEventListener("deviceready", onDeviceReady, false); + + // device APIs are available + // + function onDeviceReady() { + // Empty + } + + // Show a custom alert + // + function showAlert() { + navigator.notification.alert( + 'You are the winner!', // message + 'Game Over', // title + 'Done' // buttonName + ); + } + + // Beep three times + // + function playBeep() { + navigator.notification.beep(3); + } + + // Vibrate for 2 seconds + // + function vibrate() { + navigator.notification.vibrate(2000); + } + + </script> + </head> + <body> + <p><a href="#" onclick="showAlert(); return false;">Show Alert</a></p> + <p><a href="#" onclick="playBeep(); return false;">Play Beep</a></p> + <p><a href="#" onclick="vibrate(); return false;">Vibrate</a></p> + </body> + </html> + + +## Android çæªç + +* Android 系統ææ¾çé è¨**éç¥é´è²****è¨ç½®/è²é³å顯示**é¢æ¿ä¸æå®ã + +## Windows Phone 7 å 8 æªç + +* ä¾è³´æ³åèé³´é³æªå¾ç§ç¾å¤ç¦åä½ã + +## Tizen æªç + +* Tizen ééææ¾é³è¨æªééåªé« API 實ç¾æç¼åºèé³´è²ã + +* èé³´é³æªå¿ é å¾çï¼å¿ é è¨å¨ `sounds` åç®éä¸çæç¨ç¨å¼çæ ¹ç®éä¸ï¼ä¸¦ä¸å¿ é å½å`beep.wav`. \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/3.1.0/cordova/notification/notification.confirm.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.1.0/cordova/notification/notification.confirm.md b/www/docs/zh-cn/3.1.0/cordova/notification/notification.confirm.md new file mode 100644 index 0000000..95d20d2 --- /dev/null +++ b/www/docs/zh-cn/3.1.0/cordova/notification/notification.confirm.md @@ -0,0 +1,127 @@ +--- +license: > + 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. + +title: notification.confirm +--- + +# notification.confirm + +顯示ä¸åå¯èªè¨ç確èªå°è©±æ¹å¡ã + + navigator.notification.confirm(message, confirmCallback, [title], [buttonLabels]) + + +* **æ¶æ¯**ï¼ æ¶æ¯å°è©±æ¹å¡ã*ï¼å串ï¼* + +* **confirmCallback**: è¦ç¨ç´¢å¼ ï¼1ã 2 æ 3ï¼ æä¸çæéï¼æè å¨æ²ææä¸æé (0) é§åäºå°è©±æ¹å¡ä¸æ調ç¨çåæªã*ï¼å½æ¸ï¼* + +* **æ¨é¡**ï¼ æ¨é¡å°è©±æ¹å¡ã*ï¼å串ï¼*ï¼å¯é¸ï¼é è¨å¼çº`Confirm`) + +* **buttonLabels**ï¼ æå®æéæ¨ç±¤çå串é£åã*ï¼é£åï¼*ï¼å¯é¸ï¼é è¨å¼çº [ `OK,Cancel` ]) + +## 說æ + +`notification.confirm`æ¹æ³é¡¯ç¤ºä¸åæ¬æ©çå°è©±æ¹å¡ï¼æ´å¯èªè¨çç覽å¨æ¯ `confirm` å½æ¸ã + +## confirmCallback + +`confirmCallback`ç¶ä½¿ç¨è æä¸ç¢ºèªå°è©±æ¹å¡ä¸çæéä¹ä¸çæåå·è¡ã + +åæªå°åæ¸ `buttonIndex` *ï¼ç·¨èï¼*ï¼å®æ¯æä¸çæéçç´¢å¼ã è«æ³¨æç´¢å¼ä½¿ç¨åºæ¼ 1 çç´¢å¼ï¼æ以å¼æ¯ `1` ï¼ `2` ï¼ `3` ï¼ççã + +## æ¯æ´çå¹³èº + +* Android 系統 +* é»èææ© WebWorks ï¼OS 5.0 åæ´é«ï¼ +* iOS +* Tizen +* Windows Phone 7 å 8 +* Windows 8 + +## å¿«éçç¤ºä¾ + + // process the confirmation dialog result + function onConfirm(buttonIndex) { + alert('You selected button ' + buttonIndex); + } + + // Show a custom confirmation dialog + // + function showConfirm() { + navigator.notification.confirm( + 'You are the winner!', // message + onConfirm, // callback to invoke with index of button pressed + 'Game Over', // title + ['Restart','Exit'] // buttonLabels + ); + } + + +## å®æ´çç¤ºä¾ + + <!DOCTYPE html> + <html> + <head> + <title>Notification Example</title> + + <script type="text/javascript" charset="utf-8" src="cordova.js"></script> + <script type="text/javascript" charset="utf-8"> + + // Wait for device API libraries to load + // + document.addEventListener("deviceready", onDeviceReady, false); + + // device APIs are available + // + function onDeviceReady() { + // Empty + } + + // process the confirmation dialog result + function onConfirm(buttonIndex) { + alert('You selected button ' + buttonIndex); + } + + // Show a custom confirmation dialog + // + function showConfirm() { + navigator.notification.confirm( + 'You are the winner!', // message + onConfirm, // callback to invoke with index of button pressed + 'Game Over', // title + ['Restart','Exit'] // buttonLabels + ); + } + + </script> + </head> + <body> + <p><a href="#" onclick="showConfirm(); return false;">Show Confirm</a></p> + </body> + </html> + + +## Windows Phone 7 å 8 æªç + +* ææ²æå §ç½®çç覽å¨åè½ç `window.confirm` ï¼ä½ä½ å¯ä»¥å°å®ç¶å®ééåé ï¼ + + window.confirm = navigator.notification.confirm; + + +* 調ç¨å° `alert` å `confirm` çéé»å¡ï¼æ以çµæå°±æ¯åªå¯ç¨ä»¥éåæ¥æ¹å¼ã \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/3.1.0/cordova/notification/notification.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.1.0/cordova/notification/notification.md b/www/docs/zh-cn/3.1.0/cordova/notification/notification.md new file mode 100644 index 0000000..13561a0 --- /dev/null +++ b/www/docs/zh-cn/3.1.0/cordova/notification/notification.md @@ -0,0 +1,79 @@ +--- +license: > + 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. + +title: éç¥ +--- + +# éç¥ + +> å¯è¦ã å¯è½ï¼å觸覺è¨åéç¥ã + +## æ¹æ³ + +* `[notification.alert](notification.alert.html)` +* `[notification.confirm](notification.confirm.html)` +* `[notification.prompt](notification.prompt.html)` +* `[notification.beep](notification.beep.html)` +* `[notification.vibrate](notification.vibrate.html)` + +## 訪ååè½ + +å¾ 3.0 çï¼ç§ç¾å¤ç¦ä½çº*å¤æç¨å¼*實ç¾äºè¨åç´ Apiã ä½¿ç¨ CLI ç `plugin` å½ä»¤ï¼æè¿°å¨å½ä»¤åä»é¢ï¼å¯ä»¥æ·»å æåªé¤ä¸åå°æ¡ï¼çºæ¤åè½ï¼ + + $ cordova plugin add org.apache.cordova.dialogs + $ cordova plugin add org.apache.cordova.vibration + $ cordova plugin ls + [ 'org.apache.cordova.dialogs', + 'org.apache.cordova.vibration' ] + $ cordova plugin rm org.apache.cordova.dialogs + $ cordova plugin rm org.apache.cordova.vibration + + +éäºå½ä»¤é©ç¨äºæææéå°æ§çå¹³èºï¼ä½ä¿®æ¹å¦ä¸æè¿°çç¹å®äºå¹³èºçé ç½®è¨ç½®ï¼ + +* Android 系統 + + (in app/res/xml/config.xml) + <feature name="Notification"> + <param name="android-package" value="org.apache.cordova.Notification" /> + </feature> + + (in app/AndroidManifest.xml) + <uses-permission android:name="android.permission.VIBRATE" /> + + +* é»èææ© WebWorks + + (in www/plugins.xml) + <feature name="Notification"> + <param name="blackberry-package" value="org.apache.cordova.notification.Notification" /> + </feature> + + (in www/config.xml) + <feature id="blackberry.ui.dialog" /> + + +* ï¼å¨ iOS`config.xml`) + + <feature name="Notification"> + <param name="ios-package" value="CDVNotification" /> + </feature> + + +ä¸äºå¹³èºå¯è½æ¯æ´æ¤åè½ï¼èç¡éä»»ä½ç¹æ®çé ç½®ãè«åè¦å¨æ¦è¿°é¨åä¸*çå¹³èºæ¯æ´*ã \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/3.1.0/cordova/notification/notification.prompt.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.1.0/cordova/notification/notification.prompt.md b/www/docs/zh-cn/3.1.0/cordova/notification/notification.prompt.md new file mode 100644 index 0000000..fb6a5aa --- /dev/null +++ b/www/docs/zh-cn/3.1.0/cordova/notification/notification.prompt.md @@ -0,0 +1,126 @@ +--- +license: > + 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. + +title: notification.prompt +--- + +# notification.prompt + +顯示ä¸åå¯èªè¨çæ示å°è©±æ¹å¡ã + + navigator.notification.prompt(message, promptCallback, [title], [buttonLabels], [defaultText]) + + +* **æ¶æ¯**ï¼ æ¶æ¯å°è©±æ¹å¡ã*ï¼å串ï¼* + +* **promptCallback**ï¼ ç¶æä¸æéæè¦èª¿ç¨çåæªã*ï¼å½æ¸ï¼* + +* **æ¨é¡**ï¼ å°è©±æ¹å¡çæ¨é¡*ï¼å串ï¼* ï¼å¯é¸ï¼é è¨å¼çº`Prompt`) + +* **buttonLabels**ï¼ é£åï¼éäºå串æå®æéæ¨ç±¤*ï¼é£åï¼* ï¼å¯é¸ï¼é è¨å¼çº`["OK","Cancel"]`) + +* **defaultText**: é è¨æåæ¹å¡ä¸è¼¸å ¥å¼ ï¼ `String` ï¼ ï¼å¯é¸ï¼é è¨å¼: 空åä¸²ï¼ + +## 說æ + +`notification.prompt`æ¹æ³é¡¯ç¤ºä¸åæ¬æ©çå°è©±æ¹å¡ï¼æ´å¯èªè¨çç覽å¨æ¯ `prompt` å½æ¸ã + +## promptCallback + +`promptCallback`ç¶ä½¿ç¨è æä¸ä¸åæ示å°è©±æ¹å¡ä¸çæéæå·è¡ã`results`ç©ä»¶å³é給åæªçå å«ä»¥ä¸å±¬æ§ï¼ + +* **buttonIndex**ï¼ æä¸çæéçç´¢å¼ã*ï¼äººæ¸ï¼*è«æ³¨æç´¢å¼ä½¿ç¨åºæ¼ 1 çç´¢å¼ï¼æ以å¼æ¯ `1` ï¼ `2` ï¼ `3` ï¼ççã + +* **è¼¸å ¥ 1**ï¼ å¨æ示å°è©±æ¹å¡ä¸è¼¸å ¥çææ¬ã*ï¼å串ï¼* + +## æ¯æ´çå¹³èº + +* Android 系統 +* iOS + +## å¿«éçç¤ºä¾ + + // process the promp dialog results + function onPrompt(results) { + alert("You selected button number " + results.buttonIndex + " and entered " + results.input1); + } + + // Show a custom prompt dialog + // + function showPrompt() { + navigator.notification.prompt( + 'Please enter your name', // message + onPrompt, // callback to invoke + 'Registration', // title + ['Ok','Exit'], // buttonLabels + 'Jane Doe' // defaultText + ); + } + + +## å®æ´çç¤ºä¾ + + <!DOCTYPE html> + <html> + <head> + <title>Notification Prompt Dialog Example</title> + + <script type="text/javascript" charset="utf-8" src="cordova.js"></script> + <script type="text/javascript" charset="utf-8"> + + // Wait for device API libraries to load + // + document.addEventListener("deviceready", onDeviceReady, false); + + // device APIs are available + // + function onDeviceReady() { + // Empty + } + + // process the promptation dialog result + function onPrompt(results) { + alert("You selected button number " + results.buttonIndex + " and entered " + results.input1); + } + + // Show a custom prompt dialog + // + function showPrompt() { + navigator.notification.prompt( + 'Please enter your name', // message + onPrompt, // callback to invoke + 'Registration', // title + ['Ok','Exit'], // buttonLabels + 'Jane Doe' // defaultText + ); + } + + </script> + </head> + <body> + <p><a href="#" onclick="showPrompt(); return false;">Show Prompt</a></p> + </body> + </html> + + +## Android çæªç + +* Android æ¯æ´æå¤çä¸åæéï¼ä¸¦å¿½ç¥ä»»ä½æ´å¤ã + +* éæ¼ Android 3.0 åæ´é«çæ¬ï¼ä½¿ç¨å ¨æ¯ä¸»é¡çè¨åæç¸åçé åºé¡¯ç¤ºæéã \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/3.1.0/cordova/notification/notification.vibrate.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.1.0/cordova/notification/notification.vibrate.md b/www/docs/zh-cn/3.1.0/cordova/notification/notification.vibrate.md new file mode 100644 index 0000000..10a0751 --- /dev/null +++ b/www/docs/zh-cn/3.1.0/cordova/notification/notification.vibrate.md @@ -0,0 +1,110 @@ +--- +license: > + 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. + +title: notification.vibrate +--- + +# notification.vibrate + +çºæå®çæééæ¯åè¨åã + + navigator.notification.vibrate(milliseconds) + + +* **æé**ï¼ æ¯«ç§çºå®ä½ï¼ å¨éåçè¨åï¼å ¶ä¸ 1000年毫ç§çæ¼ 1 ç§ã*ï¼äººæ¸ï¼* + +## æ¯æ´çå¹³èº + +* Android 系統 +* é»èææ© WebWorks ï¼OS 5.0 åæ´é«ï¼ +* iOS +* Windows Phone 7 å 8 + +## å¿«éçç¤ºä¾ + + // Vibrate for 2.5 seconds + // + navigator.notification.vibrate(2500); + + +## å®æ´çç¤ºä¾ + + <!DOCTYPE html> + <html> + <head> + <title>Notification Example</title> + + <script type="text/javascript" charset="utf-8" src="cordova.js"></script> + <script type="text/javascript" charset="utf-8"> + + // Wait for device API libraries to load + // + document.addEventListener("deviceready", onDeviceReady, false); + + // device APIs are available + // + function onDeviceReady() { + // Empty + } + + // Show a custom alert + // + function showAlert() { + navigator.notification.alert( + 'You are the winner!', // message + 'Game Over', // title + 'Done' // buttonName + ); + } + + // Beep three times + // + function playBeep() { + navigator.notification.beep(3); + } + + // Vibrate for 2 seconds + // + function vibrate() { + navigator.notification.vibrate(2000); + } + + </script> + </head> + <body> + <p><a href="#" onclick="showAlert(); return false;">Show Alert</a></p> + <p><a href="#" onclick="playBeep(); return false;">Play Beep</a></p> + <p><a href="#" onclick="vibrate(); return false;">Vibrate</a></p> + </body> + </html> + + +## iOS çæªç + +* **æé**ï¼ å¿½ç¥æå®çæéåéåçé è¨ç½®çæééã + + navigator.notification.vibrate(); + navigator.notification.vibrate(2500); // 2500 is ignored + + +## BB10 çæªç + +éååè½å°èªå¨ç©ä»¶æææç + + navigator.vibrate(1000); // vibrate for 1 second \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/3.1.0/cordova/splashscreen/splashscreen.hide.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.1.0/cordova/splashscreen/splashscreen.hide.md b/www/docs/zh-cn/3.1.0/cordova/splashscreen/splashscreen.hide.md new file mode 100644 index 0000000..122e372 --- /dev/null +++ b/www/docs/zh-cn/3.1.0/cordova/splashscreen/splashscreen.hide.md @@ -0,0 +1,81 @@ +--- +license: > + 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. + +title: splashscreen.hide +--- + +# splashscreen.hide + +解éçåå§è¢å¹ã + + navigator.splashscreen.hide(); + + +## 說æ + +æ¤æ¹æ³éé該æç¨ç¨å¼çåå§è¢å¹ã + +## æ¯æ´çå¹³èº + +* Android 系統 +* é»è 10 +* iOS +* Windows Phone 7 å 8 +* Windows 8 + +## å¿«éçç¤ºä¾ + + navigator.splashscreen.hide(); + + +## å®æ´çç¤ºä¾ + + <!DOCTYPE html> + <html> + <head> + <title>Splashscreen Example</title> + + <script type="text/javascript" charset="utf-8" src="cordova.js"></script> + <script type="text/javascript" charset="utf-8"> + + // Wait for device API libraries to load + // + document.addEventListener("deviceready", onDeviceReady, false); + + // device APIs are available + // + function onDeviceReady() { + navigator.splashscreen.hide(); + } + + </script> + </head> + <body> + <h1>Example</h1> + </body> + </html> + + +## iOS æªç + +`config.xml`æªç `AutoHideSplashScreen` è¨ç½®å¿ é çº `false` ã è¥è¦å»¶é²å ©ç§éé±èçéå±ï¼æ·»å å¦ä¸æ示å¨è¨æå¨ `[deviceready](../events/events.deviceready.html)` äºä»¶èç常å¼ï¼ + + setTimeout(function() { + navigator.splashscreen.hide(); + }, 2000); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/3.1.0/cordova/splashscreen/splashscreen.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.1.0/cordova/splashscreen/splashscreen.md b/www/docs/zh-cn/3.1.0/cordova/splashscreen/splashscreen.md new file mode 100644 index 0000000..2fe69b8 --- /dev/null +++ b/www/docs/zh-cn/3.1.0/cordova/splashscreen/splashscreen.md @@ -0,0 +1,60 @@ +--- +license: > + 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. + +title: éå± +--- + +# éå± + +> 顯示åé±èæç¨ç¨å¼çåå§è¢å¹ã + +## æ¹æ³ + +* [splashscreen.show](splashscreen.show.html) +* [splashscreen.hide](splashscreen.hide.html) + +## 訪ååè½ + +å¾ 3.0 çï¼ç§ç¾å¤ç¦ä½çº*å¤æç¨å¼*實ç¾äºè¨åç´ Apiã ä½¿ç¨ CLI ç `plugin` å½ä»¤ï¼æè¿°å¨å½ä»¤åä»é¢ï¼å¯ä»¥æ·»å æåªé¤ä¸åå°æ¡ï¼çºæ¤åè½ï¼ + + $ cordova plugin add org.apache.cordova.splashscreen + $ cordova plugin ls + [ 'org.apache.cordova.splashscreen' ] + $ cordova plugin rm org.apache.cordova.splashscreen + + +éäºå½ä»¤é©ç¨äºæææéå°æ§çå¹³èºï¼ä½ä¿®æ¹å¦ä¸æè¿°çç¹å®äºå¹³èºçé ç½®è¨ç½®ï¼ + +* ï¼å¨ android`app/res/xml/config.xml`) + + <feature name="SplashScreen"> + <param name="android-package" value="org.apache.cordova.SplashScreen" /> + </feature> + + +* ï¼å¨ iOS`config.xml`) + + <feature name="SplashScreen"> + <param name="ios-package" value="CDVSplashScreen" /> + </feature> + + +ä¸äºå¹³èºå¯è½æ¯æ´æ¤åè½ï¼èç¡éä»»ä½ç¹æ®çé ç½®ãè«åè¦å¨æ¦è¿°é¨åä¸*çå¹³èºæ¯æ´*ã + +æéå¦ä½é ç½®éäºååçè³è¨ï¼è«åé±å示åéå±ã \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/3.1.0/cordova/splashscreen/splashscreen.show.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.1.0/cordova/splashscreen/splashscreen.show.md b/www/docs/zh-cn/3.1.0/cordova/splashscreen/splashscreen.show.md new file mode 100644 index 0000000..466d078 --- /dev/null +++ b/www/docs/zh-cn/3.1.0/cordova/splashscreen/splashscreen.show.md @@ -0,0 +1,71 @@ +--- +license: > + 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. + +title: splashscreen.show +--- + +# splashscreen.show + +顯示åå§è¢å¹ã + + navigator.splashscreen.show(); + + +## 說æ + +æ¤æ¹æ³é¡¯ç¤ºæç¨ç¨å¼çåå§è¢å¹ã + +## æ¯æ´çå¹³èº + +* Android 系統 +* iOS +* Windows Phone 7 å 8 +* Windows 8 + +## å¿«éçç¤ºä¾ + + navigator.splashscreen.show(); + + +## å®æ´çç¤ºä¾ + + <!DOCTYPE html> + <html> + <head> + <title>Splashscreen Example</title> + + <script type="text/javascript" charset="utf-8" src="cordova.js"></script> + <script type="text/javascript" charset="utf-8"> + + // Wait for device API libraries to load + // + document.addEventListener("deviceready", onDeviceReady, false); + + // device APIs are available + // + function onDeviceReady() { + navigator.splashscreen.show(); + } + + </script> + </head> + <body> + <h1>Example</h1> + </body> + </html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/3.1.0/cordova/storage/database/database.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.1.0/cordova/storage/database/database.md b/www/docs/zh-cn/3.1.0/cordova/storage/database/database.md new file mode 100644 index 0000000..8dfb054 --- /dev/null +++ b/www/docs/zh-cn/3.1.0/cordova/storage/database/database.md @@ -0,0 +1,119 @@ +--- +license: > + 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. + +title: è³æ庫 +--- + +# è³æ庫 + +æä¾å° SQL è³æ庫ç訪åã + +## æ¹æ³ + +* **交æè¨é**ï¼ éè¡è³æ庫äºåã + +* **changeVersion**: å è¨±è ³æ¬èªåé©èççæ¬èåæ´æ°æ¶æ§ææ´æ¹å®ã + +## 詳細è³è¨ + +`window.openDatabase()`æ¹æ³è¿å `Database` çç©ä»¶ã + +## æ¯æ´çå¹³èº + +* Android 系統 +* é»èææ© WebWorks ï¼OS 6.0 åæ´é«ï¼ +* iOS +* Tizen + +## 交æå¿«éç¤ºä¾ + + function populateDB(tx) { + tx.executeSql('DROP TABLE IF EXISTS DEMO'); + tx.executeSql('CREATE TABLE IF NOT EXISTS DEMO (id unique, data)'); + tx.executeSql('INSERT INTO DEMO (id, data) VALUES (1, "First row")'); + tx.executeSql('INSERT INTO DEMO (id, data) VALUES (2, "Second row")'); + } + + function errorCB(err) { + alert("Error processing SQL: "+err.code); + } + + function successCB() { + alert("success!"); + } + + var db = window.openDatabase("Database", "1.0", "Cordova Demo", 200000); + db.transaction(populateDB, errorCB, successCB); + + +## æ´æ¹çæ¬å¿«éç¤ºä¾ + + var db = window.openDatabase("Database", "1.0", "Cordova Demo", 200000); + db.changeVersion("1.0", "1.1"); + + +## å®æ´çç¤ºä¾ + + <!DOCTYPE html> + <html> + <head> + <title>Storage Example</title> + + <script type="text/javascript" charset="utf-8" src="cordova.js"></script> + <script type="text/javascript" charset="utf-8"> + + // Wait for device API libraries to load + // + document.addEventListener("deviceready", onDeviceReady, false); + + // device APIs are available + // + function onDeviceReady() { + var db = window.openDatabase("Database", "1.0", "Cordova Demo", 200000); + db.transaction(populateDB, errorCB, successCB); + } + + // Populate the database + // + function populateDB(tx) { + tx.executeSql('DROP TABLE IF EXISTS DEMO'); + tx.executeSql('CREATE TABLE IF NOT EXISTS DEMO (id unique, data)'); + tx.executeSql('INSERT INTO DEMO (id, data) VALUES (1, "First row")'); + tx.executeSql('INSERT INTO DEMO (id, data) VALUES (2, "Second row")'); + } + + // Transaction error callback + // + function errorCB(tx, err) { + alert("Error processing SQL: "+err); + } + + // Transaction success callback + // + function successCB() { + alert("success!"); + } + + </script> + </head> + <body> + <h1>Example</h1> + <p>Database</p> + </body> + </html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/3.1.0/cordova/storage/localstorage/localstorage.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.1.0/cordova/storage/localstorage/localstorage.md b/www/docs/zh-cn/3.1.0/cordova/storage/localstorage/localstorage.md new file mode 100644 index 0000000..f6d5dc7 --- /dev/null +++ b/www/docs/zh-cn/3.1.0/cordova/storage/localstorage/localstorage.md @@ -0,0 +1,124 @@ +--- +license: > + 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. + +title: localStorage +--- + +# localStorage + +æä¾å° W3C [Web åå²ä»é¢][1]ç訪å + + [1]: http://dev.w3.org/html5/webstorage/#the-localstorage-attribute + + var permanentStorage = window.localStorage; + var tempStorage = window.sessionStorage; + + +## æ¹æ³ + +* **éµ**ï¼ è¿åå¨æå®çä½ç½®çéµçå稱ã + +* **getItem**ï¼ è¿åç±æå®çéµæ¨èçé ã + +* **setItem**ï¼ åé ä¸åéµæ§çé å¼ã + +* **removeItem**: åªé¤æ¨èç±æå®éµçé ã + +* **æ¸ é¤**ï¼ ä¸ç§»é¤ææéµ/å¼å°ã + +## 詳細è³è¨ + +`window.localStorage`ä»é¢å¯¦ç¾ï¼W3C [Web åå²ä»é¢][2]ã æç¨ç¨å¼å¯ä»¥ä½¿ç¨å®ä¾ä¿åæ°¸ä¹ è³æ使ç¨éµ-å¼å°ã `window.sessionStorage`ä»é¢å¨æ¯åæ¹é¢ï¼é¤äºï¼ææè³æé½è¢«é½æ¸ é¤æç¨ç¨å¼ééæ¯æ¬¡çå·¥ä½æ¹å¼ç¸åã æ¯åè³æ庫æä¾äºå®ç¨çå½å空éã + + [2]: http://dev.w3.org/html5/webstorage/ + +## æ¯æ´çå¹³èº + +* Android 系統 +* é»èææ© WebWorks ï¼OS 6.0 åæ´é«ï¼ +* iOS +* Tizen +* Windows Phone 7 å 8 + +## éµå¿«éç¤ºä¾ + + var keyName = window.localStorage.key(0); + + +## è¨ç½®çå°æ¡çå¿«éç¤ºä¾ + + window.localStorage.setItem("key", "value"); + + +## ç²åå°æ¡çå¿«éç¤ºä¾ + + var value = window.localStorage.getItem("key"); + // value is now equal to "value" + + +## åªé¤å°æ¡å¿«éç¤ºä¾ + + window.localStorage.removeItem("key"); + + +## æ¸ é¤å¿«éç¤ºä¾ + + window.localStorage.clear(); + + +## å®æ´çç¤ºä¾ + + <!DOCTYPE html> + <html> + <head> + <title>Storage Example</title> + + <script type="text/javascript" charset="utf-8" src="cordova.js"></script> + <script type="text/javascript" charset="utf-8"> + + // Wait for device API libraries to load + // + document.addEventListener("deviceready", onDeviceReady, false); + + // device APIs are available + // + function onDeviceReady() { + window.localStorage.setItem("key", "value"); + var keyname = window.localStorage.key(i); + // keyname is now equal to "key" + var value = window.localStorage.getItem("key"); + // value is now equal to "value" + window.localStorage.removeItem("key"); + window.localStorage.setItem("key2", "value2"); + window.localStorage.clear(); + // localStorage is now empty + } + + </script> + </head> + <body> + <h1>Example</h1> + <p>localStorage</p> + </body> + </html> + + +## Windows Phone 7 çæªç + +é»æ¨è¨æ³æ¯*æ²æ*å¯ç¨ç Windows Phone 7ã ä¸å®è¦ä½¿ç¨ `setItem` æ `getItem` ï¼èä¸æ¯ç´æ¥å¾åå²ç©ä»¶ï¼å¦ä¾¿æ·éµ`window.localStorage.someKey`. \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/3.1.0/cordova/storage/parameters/display_name.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.1.0/cordova/storage/parameters/display_name.md b/www/docs/zh-cn/3.1.0/cordova/storage/parameters/display_name.md new file mode 100644 index 0000000..2087956 --- /dev/null +++ b/www/docs/zh-cn/3.1.0/cordova/storage/parameters/display_name.md @@ -0,0 +1,25 @@ +--- +license: > + 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. + +title: database_displayname +--- + +# database_displayname + +顯示è³æ庫çå稱ã \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/3.1.0/cordova/storage/parameters/name.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.1.0/cordova/storage/parameters/name.md b/www/docs/zh-cn/3.1.0/cordova/storage/parameters/name.md new file mode 100644 index 0000000..c72d2f3 --- /dev/null +++ b/www/docs/zh-cn/3.1.0/cordova/storage/parameters/name.md @@ -0,0 +1,25 @@ +--- +license: > + 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. + +title: database_name +--- + +# database_name + +è³æ庫çå稱ã \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/3.1.0/cordova/storage/parameters/size.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.1.0/cordova/storage/parameters/size.md b/www/docs/zh-cn/3.1.0/cordova/storage/parameters/size.md new file mode 100644 index 0000000..0df07db --- /dev/null +++ b/www/docs/zh-cn/3.1.0/cordova/storage/parameters/size.md @@ -0,0 +1,25 @@ +--- +license: > + 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. + +title: database_size +--- + +# database_size + +以ä½å çµçºå®ä½çè³æ庫ç大å°ã \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/3.1.0/cordova/storage/parameters/version.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.1.0/cordova/storage/parameters/version.md b/www/docs/zh-cn/3.1.0/cordova/storage/parameters/version.md new file mode 100644 index 0000000..e0a8a3b --- /dev/null +++ b/www/docs/zh-cn/3.1.0/cordova/storage/parameters/version.md @@ -0,0 +1,25 @@ +--- +license: > + 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. + +title: database_version +--- + +# database_version + +è³æ庫ççæ¬ã \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/3.1.0/cordova/storage/sqlerror/sqlerror.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.1.0/cordova/storage/sqlerror/sqlerror.md b/www/docs/zh-cn/3.1.0/cordova/storage/sqlerror/sqlerror.md new file mode 100644 index 0000000..67e2199 --- /dev/null +++ b/www/docs/zh-cn/3.1.0/cordova/storage/sqlerror/sqlerror.md @@ -0,0 +1,46 @@ +--- +license: > + 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. + +title: SQLError +--- + +# SQLError + +A `SQLError` ç©ä»¶ç¶ç¼çé¯èª¤æå¼ç¼ã + +## å±¬æ§ + +* **代碼**ï¼ ä¸é¢ååºçé å®ç¾©çé¯èª¤ä»£ç¢¼ä¹ä¸ã + +* **æ¶æ¯**ï¼ é¯èª¤ç說æã + +## 常é + +* `SQLError.UNKNOWN_ERR` +* `SQLError.DATABASE_ERR` +* `SQLError.VERSION_ERR` +* `SQLError.TOO_LARGE_ERR` +* `SQLError.QUOTA_ERR` +* `SQLError.SYNTAX_ERR` +* `SQLError.CONSTRAINT_ERR` +* `SQLError.TIMEOUT_ERR` + +## 說æ + +`SQLError`ç©ä»¶éç®å æ庫æåºç¾é¯èª¤æå¼ç¼ã \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/3.1.0/cordova/storage/sqlresultset/sqlresultset.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.1.0/cordova/storage/sqlresultset/sqlresultset.md b/www/docs/zh-cn/3.1.0/cordova/storage/sqlresultset/sqlresultset.md new file mode 100644 index 0000000..b8efb5c --- /dev/null +++ b/www/docs/zh-cn/3.1.0/cordova/storage/sqlresultset/sqlresultset.md @@ -0,0 +1,59 @@ +--- +license: > + 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. + +title: SQLResultSet +--- + +# SQLResultSet + +ç¶ `[SQLTransaction](../sqltransaction/sqltransaction.html)` ç©ä»¶ç `executeSql` æ¹æ³æï¼å·è¡æå®çåæª `SQLResultSet` åæ¸ã + +## å±¬æ§ + +* **insertId**ï¼ è¡çè¡ç IDï¼ `SQLResultSet` ç©ä»¶ç SQL èªå¥æå ¥å°è³æ庫ä¸ã + +* **rowsAffected**ï¼ ç±é¶å¦æ該èªå¥ä¸æå½±é¿ä»»ä½è¡ç SQL èªå¥æ´æ¹çè¡æ¸ã + +* **è¡**ï¼ `[SQLResultSetRowList](../sqlresultsetrowlist/sqlresultsetrowlist.html)` 表示è¿åçè¡ï¼å¦ææªè¿åè¡ï¼åçºç©ºã + +## 詳細è³è¨ + +ç¶ `[SQLTransaction](../sqltransaction/sqltransaction.html)` ç©ä»¶ç `executeSql` æ¹æ³æï¼å·è¡æå®çåæª `SQLResultSet` åæ¸ï¼å ¶ä¸å å«ä¸å屬æ§ï¼ + +* `insertId`è¿åçµè£æåç SQL æå ¥èªå¥çè¡èãå¦æ SQL ä¸ææå ¥ä»»ä½è¡ï¼ `insertId` æªè¨ç½®ã + +* `rowsAffected`å§çµæ¯ `` çºä¸å SQL `select` èªå¥ãçº `insert` æ `update` å®è¿åçæ¸çèªå¥ä¿®æ¹çè¡ã + +* 決賽 `SQLResultSetList` å å«å¾ä¸å SQL select èªå¥è¿åçè³æã + +## æ¯æ´çå¹³èº + +* Android 系統 +* é»èææ© WebWorks ï¼OS 6.0 åæ´é«ï¼ +* iOS +* Tizen + +## å·è¡ SQL å¿«éç¤ºä¾ + + å½æ¸ queryDB(tx) {tx.executeSql (' é¸æ * å¾æ¼ç¤º 'ã []ã querySuccessã errorCB);}å½æ¸ querySuccess ï¼å¾·å è©æ¯å·ï¼çµæï¼ {console.log ("è¿åè¡ ="+ results.rows.lengthï¼ ï¼/ / éå°æ¯ç實çå çºéæ¯ä¸æ¢ select èªå¥ï¼æ以 rowsAffected æ¯ 0ï¼å¦æ (! results.rowsAffected) {console.log ('æ²æè¡åå½±é¿!') ï¼è¿å false ï¼} / / ç insert èªå¥ï¼æ¤å±¬æ§å°è¿åçæå¾æå ¥çè¡ console.log ç ID ï¼"æå¾æå ¥çè¡ ID ="+ results.insertId);}å½æ¸ errorCB(err) {è¦å ± ï¼"èç SQL æåºé¯:"+ err.code);}var db = window.openDatabase ("è³æ庫"ã"1.0"ï¼"ç§ç¾å¤ç¦æ¼ç¤º"ï¼200000) ï¼db.transaction errorCB queryDBï¼ ï¼ + + +## å®æ´çç¤ºä¾ + + <!DOCTYPE html >< html >< é >< æ¨é¡ > åå²ç¤ºä¾ < / æ¨é¡ >< è ³æ¬é¡å ="ææ¬/javascript"charset ="utf 8"src="cordova.js">< / è ³æ¬ >< è ³æ¬é¡å ="ææ¬/javascript"charset ="utf 8"> / / çå¾ è¨å API 庫è¼å ¥ / / document.addEventListener ("deviceready"ï¼onDeviceReadyï¼false);/ / å¡«å è³æ庫 / / å½æ¸ populateDB(tx) {tx.executeSql ('ä¸æ表å¦æåå¨æ¼ç¤º') ï¼tx.executeSql (' åµå»ºè¡¨å¦æä¸åå¨æ¼ç¤º ï¼id å¯ä¸çè³æï¼ ') ï¼tx.executeSql (' çå¼æå ¥å°æ¼ç¤º ï¼idã è³æï¼ ï¼1ï¼"第ä¸è¡"ï¼ ') ï¼tx.executeSql ï¼æå ¥å°æ¼ç¤º ï¼idã è³æï¼ å¼ ï¼2ï¼"第äºè¡")) ï¼} / / æ¥è©¢è³æ庫 / / å½æ¸ queryDB(tx) {tx.executeSql (' é¸æ * å¾æ¼ç¤º 'ã []ã querySuccessã errorCBï¼ ï¼} / / æ¥è©¢æååæª / / å½æ¸ querySuccess ï¼å¾·å è©æ¯å·ï¼çµæï¼ {console.log ("è¿åè¡ ="+ results.rows.lengthï¼ ï¼/ / éå°æ¯ç實çå çºéæ¯ä¸æ¢ select èªå¥ï¼æ以 rowsAffected æ¯ 0ï¼å¦æ ( ! results.rowsAffected) {console.log ('æ²æè¡åå½±é¿!') ï¼è¿å false ï¼} / / ç insert èªå¥ï¼æ¤å±¬æ§å°è¿åçæå¾æå ¥çè¡ console.log ç ID ï¼"æå¾æå ¥çè¡ ID ="+ results.insertIdï¼ ï¼} / / 交æé¯èª¤åæª / / å½æ¸ errorCB(err) {console.log ("èç SQL æåºé¯:"+ err.codeï¼ ï¼} / / 交ææååæª / / å½æ¸ successCB() {var db = window.openDatabase ("è³æ庫"ã"1.0"ï¼"ç§ç¾å¤ç¦æ¼ç¤º"ï¼200000) ï¼db.transaction errorCB queryDBï¼ ï¼} / / è¨åç Api å¯ / / å½æ¸ onDeviceReady() {var db = window.openDatabase ("è³æ庫"ã"1.0"ï¼"ç§ç¾å¤ç¦æ¼ç¤º"ï¼200000) ï¼db.transaction ï¼populateDBã errorCBã successCBï¼ ï¼} < / è ³æ¬ >< / é >< èº«é« >< h1 > ç¤ºä¾ < / h1 >< p > è³æ庫 </p >< / èº«é« >< / html > \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/3.1.0/cordova/storage/sqlresultsetrowlist/sqlresultsetrowlist.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.1.0/cordova/storage/sqlresultsetrowlist/sqlresultsetrowlist.md b/www/docs/zh-cn/3.1.0/cordova/storage/sqlresultsetrowlist/sqlresultsetrowlist.md new file mode 100644 index 0000000..dea416d --- /dev/null +++ b/www/docs/zh-cn/3.1.0/cordova/storage/sqlresultsetrowlist/sqlresultsetrowlist.md @@ -0,0 +1,53 @@ +--- +license: > + 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. + +title: SQLResultSetRowList +--- + +# SQLResultSetRowList + +屬æ§ä¹ä¸ç `[SQLResultSet](../sqlresultset/sqlresultset.html)` å¾ SQL æ¥è©¢ä¸å å«çè¡è¿åã + +## å±¬æ§ + +* **é·åº¦**ï¼ SQL æ¥è©¢æè¿åçè¡æ¸ã + +## æ¹æ³ + +* **å°æ¡**ï¼ è¿å JavaScript ç©ä»¶æ表示çæå®ç´¢å¼èçè¡ã + +## 詳細è³è¨ + +`SQLResultSetRowList`å å«å¾ SQL è¿åçè³æ `select` èªå¥ã 該ç©ä»¶å å« `length` 屬æ§ï¼è©²å¼å¤å°è¡ `select` èªå¥è¿åã è¥è¦ç²åçè³æè¡ï¼èª¿ç¨ `item` æ¹æ³ï¼ä»¥æå®ä¸åç´¢å¼ã å®è¿å JavaScript `Object` å ¶å±¬æ§æ¯çè³æ庫å `select` åå°å·è¡èªå¥ã + +## æ¯æ´çå¹³èº + +* Android 系統 +* é»èææ© WebWorks ï¼OS 6.0 åæ´é«ï¼ +* iOS +* Tizen + +## å·è¡ SQL å¿«éç¤ºä¾ + + å½æ¸ queryDB(tx) {tx.executeSql (' é¸æ * å¾æ¼ç¤º 'ã []ã querySuccessã errorCB);}å½æ¸ querySuccess ï¼å¾·å è©æ¯å·ï¼çµæï¼ {var len = results.rows.length ï¼console.log ("æ¼ç¤ºè¡¨ï¼"+ len +"è¡ç¼ç¾") ï¼çº (var æ = 0 ï¼ æ < len ï¼ i + +) {console.log ("è¡ ="+ i +"ID ="+ results.rows.item (i).id +"çè³æ ="+ results.rows.item(i).data) ï¼}} å½æ¸ errorCB(err) {è¦å ± ï¼"èç SQL æåºé¯:"+ err.codeï¼ ï¼} var db = window.openDatabase ("è³æ庫"ã"1.0"ï¼"ç§ç¾å¤ç¦æ¼ç¤º"ï¼200000) ï¼db.transaction errorCB queryDBï¼ ï¼ + + +## å®æ´çç¤ºä¾ + + <!DOCTYPE html >< html >< é >< æ¨é¡ > åå²ç¤ºä¾ < / æ¨é¡ >< è ³æ¬é¡å ="ææ¬/javascript"charset ="utf 8"src="cordova.js">< / è ³æ¬ >< è ³æ¬é¡å ="ææ¬/javascript"charset ="utf 8"> / / çå¾ è¨å API 庫è¼å ¥ / / document.addEventListener ("deviceready"ï¼onDeviceReadyï¼false);/ / å¡«å è³æ庫 / / å½æ¸ populateDB(tx) {tx.executeSql ('ä¸æ表å¦æåå¨æ¼ç¤º') ï¼tx.executeSql (' åµå»ºè¡¨å¦æä¸åå¨æ¼ç¤º ï¼id å¯ä¸çè³æï¼ ') ï¼tx.executeSql (' çå¼æå ¥å°æ¼ç¤º ï¼idã è³æï¼ ï¼1ï¼"第ä¸è¡"ï¼ ') ï¼tx.executeSql ï¼æå ¥å°æ¼ç¤º ï¼idã è³æï¼ å¼ ï¼2ï¼"第äºè¡")) ï¼} / / æ¥è©¢è³æ庫 / / å½æ¸ queryDB(tx) {tx.executeSql (' é¸æ * å¾æ¼ç¤º 'ã []ã querySuccessã errorCBï¼ ï¼} / / æ¥è©¢æååæª / / å½æ¸ querySuccess ï¼å¾·å è©æ¯å·ï¼çµæï¼ {var len = results.rows.length ï¼console.log ("æ¼ç¤ºè¡¨ï¼"+ len +"è¡ç¼ç¾") ï¼çº (var æ = 0 ï¼ æ < len ï¼ i + +) {console.log ("è¡ ="+ i +"ID ="+ results.rows.item (i).id +"çè³æ ="+ results.rows.item(i).data) ï¼}} / / 交æé¯èª¤åæª / / å½æ¸ errorCB(err) {console.log ("èç SQL æåºé¯:"+ err.codeï¼ ï¼} / / 交ææååæª / / å½æ¸ successCB() {var db = window.openDatabase ("è³æ庫"ã"1.0"ï¼"ç§ç¾å¤ç¦æ¼ç¤º"ï¼200000) ï¼db.transaction errorCB queryDBï¼ ï¼} / / è¨åç Api å¯ / / å½æ¸ onDeviceReady() {var db = window.openDatabase ("è³æ庫"ã"1.0"ï¼"ç§ç¾å¤ç¦æ¼ç¤º"ï¼200000) ï¼db.transaction ï¼populateDBã errorCBã successCBï¼ ï¼} < / è ³æ¬ >< / é >< èº«é« >< h1 > ç¤ºä¾ < / h1 >< p > è³æ庫 </p >< / èº«é« >< / html > \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/3.1.0/cordova/storage/sqltransaction/sqltransaction.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.1.0/cordova/storage/sqltransaction/sqltransaction.md b/www/docs/zh-cn/3.1.0/cordova/storage/sqltransaction/sqltransaction.md new file mode 100644 index 0000000..ab577ba --- /dev/null +++ b/www/docs/zh-cn/3.1.0/cordova/storage/sqltransaction/sqltransaction.md @@ -0,0 +1,111 @@ +--- +license: > + 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. + +title: SQLTransaction +--- + +# SQLTransaction + +å 許å°è³æ庫ç SQL èªå¥çå·è¡ã + +## æ¹æ³ + +* **executeSql**: å·è¡ä¸å SQL èªå¥ã + +## 詳細è³è¨ + +èª¿ç¨ `Database` ç©ä»¶ç交ææ¹æ³ï¼åè·¯ `SQLTransaction` æå®çåæªæ¹æ³çç©ä»¶ã + +## æ¯æ´çå¹³èº + +* Android 系統 +* é»èææ© WebWorks ï¼OS 6.0 åæ´é«ï¼ +* iOS +* Tizen + +## å·è¡ SQL å¿«éç¤ºä¾ + + function populateDB(tx) { + tx.executeSql('DROP TABLE IF EXISTS DEMO'); + tx.executeSql('CREATE TABLE IF NOT EXISTS DEMO (id unique, data)'); + tx.executeSql('INSERT INTO DEMO (id, data) VALUES (1, "First row")'); + tx.executeSql('INSERT INTO DEMO (id, data) VALUES (2, "Second row")'); + } + + function errorCB(err) { + alert("Error processing SQL: "+err); + } + + function successCB() { + alert("success!"); + } + + var db = window.openDatabase("Database", "1.0", "Cordova Demo", 200000); + db.transaction(populateDB, errorCB, successCB); + + +## å®æ´çç¤ºä¾ + + <!DOCTYPE html> + <html> + <head> + <title>Storage Example</title> + + <script type="text/javascript" charset="utf-8" src="cordova.js"></script> + <script type="text/javascript" charset="utf-8"> + + // Wait for device API libraries to load + // + document.addEventListener("deviceready", onDeviceReady, false); + + // device APIs are available + // + function onDeviceReady() { + var db = window.openDatabase("Database", "1.0", "Cordova Demo", 200000); + db.transaction(populateDB, errorCB, successCB); + } + + // Populate the database + // + function populateDB(tx) { + tx.executeSql('DROP TABLE IF EXISTS DEMO'); + tx.executeSql('CREATE TABLE IF NOT EXISTS DEMO (id unique, data)'); + tx.executeSql('INSERT INTO DEMO (id, data) VALUES (1, "First row")'); + tx.executeSql('INSERT INTO DEMO (id, data) VALUES (2, "Second row")'); + } + + // Transaction error callback + // + function errorCB(err) { + alert("Error processing SQL: "+err); + } + + // Transaction success callback + // + function successCB() { + alert("success!"); + } + + </script> + </head> + <body> + <h1>Example</h1> + <p>SQLTransaction</p> + </body> + </html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/3.1.0/cordova/storage/storage.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.1.0/cordova/storage/storage.md b/www/docs/zh-cn/3.1.0/cordova/storage/storage.md new file mode 100644 index 0000000..640fc9c --- /dev/null +++ b/www/docs/zh-cn/3.1.0/cordova/storage/storage.md @@ -0,0 +1,73 @@ +--- +license: > + 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. + +title: åå² +--- + +# åå² + +> æä¾å°è¨åçåå²é¸é ç訪åã + +æ¤ API æä¾äºåºæ¼å ©åä¸åç W3C è¦ç¯çåå²é¸é ï¼ + +* [Web åå² API è¦ç¯][1]å 許æ¨è¦è¨ªåçè³æééç°¡å®çéµ/å¼å°ã ä¸èªçºå¨æ¤ä»é¢ä¸çå®æ´è©³ç´°è³è¨ï¼è«åé±ç¯ã + +* [Web SQL è³æ庫è¦ç¯][2]æä¾æ´å¤çåè½å ¨é¢çè³æ庫表訪åéé SQL æ¥è©¢ã æ¤ä»é¢çæè¦å°ç«å³åºç¾ä¸é¢ã + + [1]: http://dev.w3.org/html5/webstorage/ + [2]: http://dev.w3.org/html5/webdatabase/ + +ç§ç¾å¤ç¦æä¾å ©åä»é¢é½å°å°æ¸å·²ç¶ä¸æ¯æ´ä»åçè¨åç訪åãå¦åå §ç½®å¯¦ç¾æç¨ã + +## æ¹æ³ + +* [大æ¦](storage.opendatabase.html) + +## åæ¸ + +* [database_name](parameters/name.html) +* [database_version](parameters/version.html) +* [database_displayname](parameters/display_name.html) +* [database_size](parameters/size.html) + +## ç©ä»¶ + +* [è³æ庫](database/database.html) +* [SQLTransaction](sqltransaction/sqltransaction.html) +* [SQLResultSet](sqlresultset/sqlresultset.html) +* [SQLResultSetRowList](sqlresultsetrowlist/sqlresultsetrowlist.html) +* [SQLError](sqlerror/sqlerror.html) + +## 訪ååè½ + +çæ¬çº 3.0ï¼å°åå² Api ç訪åå §ç½®æ¼ç§ç¾å¤ç¦ï¼ï¼ä¸éè¦ä½¿ç¨ CLI è¦æ·»å çå¤æç¨å¼ï¼å¦æè¿°çå½ä»¤åä»é¢ã + +å¦ææ¨ä½¿ç¨è¼èçåé¢ï¼CLI çç§ç¾å¤ç¦å·¥å ·éï¼ï¼ä»ç¶éè¦ä»¥ä¸çå¹³èºç¹å®çé ç½®è¨ç½®ï¼ + +* ï¼å¨ android`app/res/xml/config.xml`) + + < åè½å稱 ="åå²">< åæ¸å稱 ="android å "value="org.apache.cordova.Storage"/ >< / åè½ > + + +* é»èææ© WebWorks ï¼ä¸`www/config.xml`) + + < åè½ id="blackberry.widgetcache"æé ="true"çæ¬ ="1.0.0.0"/ > + + +ä¸äºå¹³èºå¯è½æ¯æ´æ¤åè½ï¼èç¡éä»»ä½ç¹æ®çé ç½®ãè«åè¦å¨æ¦è¿°é¨åä¸*çå¹³èºæ¯æ´*ã \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/3.1.0/cordova/storage/storage.opendatabase.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.1.0/cordova/storage/storage.opendatabase.md b/www/docs/zh-cn/3.1.0/cordova/storage/storage.opendatabase.md new file mode 100644 index 0000000..13dad8a --- /dev/null +++ b/www/docs/zh-cn/3.1.0/cordova/storage/storage.opendatabase.md @@ -0,0 +1,72 @@ +--- +license: > + 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. + +title: å¤§æ¦ +--- + +# å¤§æ¦ + +è¿åä¸åæ°ç `Database` ç©ä»¶ã + + var dbShell = window.openDatabase(database_name, database_version, database_displayname, database_size); + + +## 說æ + +æ¹æ³åµå»ºä¸åæ°ç SQL Lite è³æ庫並è¿å `Database` å 許å°è³æé²è¡æä½çç©ä»¶ã + +## æ¯æ´çå¹³èº + +* Android 系統 +* é»èææ© WebWorks ï¼OS 6.0 åæ´é«ï¼ +* iOS +* Tizen + +## å¿«éçç¤ºä¾ + + var db = window.openDatabase("test", "1.0", "Test DB", 1000000); + + +## å®æ´çç¤ºä¾ + + <!DOCTYPE html> + <html> + <head> + <title>Storage Example</title> + + <script type="text/javascript" charset="utf-8" src="cordova.js"></script> + <script type="text/javascript" charset="utf-8"> + + // Wait for device API libraries to load + // + document.addEventListener("deviceready", onDeviceReady, false); + + // device APIs are available + // + function onDeviceReady() { + var db = window.openDatabase("test", "1.0", "Test DB", 1000000); + } + + </script> + </head> + <body> + <h1>Example</h1> + <p>Open Database</p> + </body> + </html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/a890e4de/www/docs/zh-cn/3.1.0/guide/appdev/privacy/index.md ---------------------------------------------------------------------- diff --git a/www/docs/zh-cn/3.1.0/guide/appdev/privacy/index.md b/www/docs/zh-cn/3.1.0/guide/appdev/privacy/index.md new file mode 100644 index 0000000..efe912e --- /dev/null +++ b/www/docs/zh-cn/3.1.0/guide/appdev/privacy/index.md @@ -0,0 +1,60 @@ +--- +license: > + 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. + +title: é±ç§æå +--- + +# é±ç§æå + +ææ©é±ç§æ¯æ¯åæç¨ç¨å¼éç¼è å¿ é 解決çééµåé¡ã æ¨ç使ç¨è ææå°æéä»åçç§äººè³è¨ï¼ä¸¦ç±æ¨çæç¨ç¨å¼å¾å°é©ç¶çèçãæ¤å¤ï¼æè¶ä¾è¶å¤çç¾å¨æéäºææ©é±ç§æ £ä¾çæ³å¾è¦æ±å¸æ³ç®¡è½åã + +æ¬æåä¸ç移åæç¨ç¨å¼çé±ç§æ被è¦çºä¸*åºæ¼*èçä¸äºæéè¦çåé¡ã å®æ¦è¿°äºäººå廣æ³æ¥åçä¸äºæä½³åæ³ï¼ä¸¦æä¾å°å ¶ä»æ´è©³ç´°çæåååèåèã + +* **ç§é±æ¿ç**ï¼ æ¨çæç¨ç¨å¼æå æ¬ç§é±æ¿çï¼è§£æ±ºä»éº¼æ¨£çè³è¨æ¨çæç¨ç¨å¼æ¶éä¾èªæéæ¼æ¨ç使ç¨è ã å¦ä½ä½¿ç¨éäºè³è¨ï¼è誰å®å ±ç¨çåå¦ä½ä½¿ç¨è å¯ä»¥å¨æç¨ç¨å¼å §ç§é±æéçé¸æç主é¡ã以説æç解ï¼ä½ æ該使ç¨æ®éèªè¨åé¿å æè¡è¡èªã ä½ æ該使æ¨çé±ç§æ¬ååå¯ä¾ä½¿ç¨è ä¹åä¸è¼ï¼å¦å¯©æ¥ç app æè¿°ä¸çæç¨å¸å ´ã æ¤å¤ï¼æ使æ¨çé±ç§æ¬ååå¯ç¨å¨è©²æç¨ç¨å¼æ¬èº«çç¯åå §ã æéçè¡åè£ç½®ç顯示大å°åµå»ºç¨æ¼å使ç¨è 顯示ç§é±æ¿ççææ°ã èæ ®ç¼å±ä¸ç¨®*縮寫形å¼*çæ¿çï¼å ¶ä¸å æ¬æéè¦çè³è¨ï¼ï¼ç¶å¾å¨æ´å¤çç´°ç¯æè趣ç人æä¾ä¸åé£çµå°"é·è¡¨"æ¿çã å¹¾åå°çµæ£è©¦åéç¼åºæ¼å示éä¿¡é±ç§æ £ä¾ï¼ä½ å¯è½æ³è¦èæ ®ä¸æ¦éäºæ¨æºæççæ¨æºã + +* **ææè³è¨çæ¶é**ï¼ ææçå人è³è¨çæç¨ç¨å¼çéåå°å¼ç¼éè¦é±ç§åé¡ã ææçå人è³è¨çä¾åå æ¬ææç財åè³è¨ï¼å¥åº·çè³è¨ï¼ä¸¦å¾æå ç«¥çè³è¨ã å®éå æ¬å¾æäºææå¨åé常ç¼ç¾è¡åè£ç½®åå¹³æ¿é»è ¦ã å°çå®ä½è³è¨ã é£çµ¡äºº/é»è©±ç°¿ã 麥å 風/ç¸æ©ååå²çåçè¦é »ççè³æ庫æ¶éçè³è¨ã è«åè¦ä»¥ä¸ææªé ç詳細è³è¨ï¼[ç¸æ©][1]ã[æç²][2]ã[é£çµ¡äºº][3]å[å°çå®ä½][4]ã ä¸è¬æ æ³ä¸ï¼æ¨æ該ç²å¾ä½¿ç¨è çæ確許å¯ä¹åæ¶éææè³è¨ï¼å¦æå¯è½ç話ï¼æä¾ä¸ç¨®æ§å¶æ©å¶ï¼ä½¿ä½¿ç¨è å¯ä»¥è¼é¬å°æ´æ¹è¨±å¯æ¬ã æç¨ç¨å¼çä½æ¥ç³»çµ±å¯ä»¥èª¬æå¨æäºæ æ³ä¸æåºåªæ¯æéçå°è©±æ¹å¡ï¼è¦æ±ä½¿ç¨è ç許å¯æ¬åéåã å¨éäºæ æ³ä¸ï¼ä¸å®è¦å©ç¨ä»»ä½æ©æï¼è¥è¦èªè¨å°è©±æ¹å¡çæ¡ææ¬ï¼ä»¥æ¾æ¸ å¦ä½æç¨ç¨å¼ä½¿ç¨ï¼ä¸¦ä¸ï¼å¦æé©ç¨ï¼å°å ±ç¨æ¤é¡è³ è¨ã + +* **é¿å 使ç¨è é©å**ï¼ å¦ææ¨çæç¨ç¨å¼æ¶éæ使ç¨ä¸å¯è½å使ç¨è æ ¹ææ¨çæç¨ç¨å¼ ï¼ä¾å¦ï¼è¨ªååå²çåççé³æ¨ææ¾æ©ï¼ ç主è¦ç®ç令人é©è¨çæ¹å¼çè³è¨ï¼ä½ æ該帶é¡ä¼¼çæ¥é©ä½çºææå人è³è¨çæ¶éã éå°±æ¯ï¼ä½ å¼·çæèæ ®åªæ¯æéå°è©±æ¹å¡éç¥ä½¿ç¨è æééåæ該è³è¨ç使ç¨ï¼ä¸¦æä¾ä¸åç¸æçé±ç§æ§å¶é ï¼å¦æåé©ç話ï¼ç使ç¨ã + +* **ååå» åè³ææ¶éæå享**ï¼ å¦æä½ çæç¨ç¨å¼æ¶éå°å¦ä¸å®¶å ¬å¸ â â æä¾çè³è¨ï¼å¦ä¸å社交網路平èºæ廣å網路 ï¼ä¾å¦ï¼å¦ææ¨çæç¨ç¨å¼æ顯示廣å) â â ä½ æ該åç¥è©²éåç使ç¨è åå ±ç¨ã è³å°ï¼æ¨çé±ç§æ¬ååæ該æè¿°è³è¨æ¶éåå ±ç¨åï¼å¦æåé©ç話ï¼çºæ¨ç使ç¨è æä¾æ§å¶è½åæéåºé種éåæå ±ç¨ã + +* **éåéå¶åå®å ¨**ï¼ æ¨ç使ç¨è å§è¨ä»åçè³è¨èæ¨çæç¨ç¨å¼ï¼ä»åææä½ å°ææ¡åé©ç¶çå®å ¨é²ç¯æªæ½ä¾ä¿è·å®ã é¿å å人è³è¨çå®å ¨å¦¥åçæä½³æ¹æ³ä¹ä¸ä½µä¸æ¯å¨ç¬¬ä¸æ¬¡çå°æ¹æ¶éçè³è¨ï¼é¤éæ¨çæç¨ç¨å¼å ·æéåçä¸åå ·é«ååæ³çåæ¥åå ã ä¸æéè¦æ¶éçè³è¨ï¼ç¢ºä¿ä½ æä¾é©ç¶çå®å ¨æ§å¶ï¼ä»¥ä¿è·è©²è³è¨ï¼ç¡è«å®åå²å¨è¨åä¸æå¨æ¨çå¾ç«¯ä¼ºæå¨ä¸ã æ¨éæéç¼é款æç¨åå¾ç«¯ä¼ºæå¨ä¸å¯¦æ½é©ç¶çè³æä¿çååã + + [1]: cordova_camera_camera.md.html + [2]: cordova_media_capture_capture.md.html + [3]: cordova_contacts_contacts.md.html + [4]: cordova_geolocation_geolocation.md.html + +以ä¸æ¯ä¸äºå ¶ä»æç¨ææ©é±ç§æåï¼éç¼äººå¡ï¼ + +* å å·ç¸½æª¢å¯é·[ç§é±å»ï¼ 移åçæ 系統ç建è°][5] + +* æ°ä¸»èæè¡ï¼é±ç§è«å£ï¼[çºææ©æç¨ç¨å¼éç¼äººå¡çæä½³åæ³][6]çæªä¾ä¸å¿ + +* CTIA ç¡ç·åæã[æä½³åæ³åæºåçä½ç½®åºæ¼æå][7] + +* è¯é¦è²¿æå§å¡æï¼[ææ©é±ç§æ«é²ï¼ 建ç«ä¿¡ä»»éééæ度][8] + +* [æç¨é±ç§][9]網ç«é±ç§è«å£çæªä¾ + + [5]: http://oag.ca.gov/sites/all/files/pdfs/privacy/privacy_on_the_go.pdf + [6]: http://www.futureofprivacy.org/wp-content/uploads/Best-Practices-for-Mobile-App-Developers_Final.pdf + [7]: http://www.ctia.org/business_resources/wic/index.cfm/AID/11300 + [8]: http://www.ftc.gov/os/2013/02/130201mobileprivacyreport.pdf + [9]: http://www.applicationprivacy.org \ No newline at end of file --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cordova.apache.org For additional commands, e-mail: commits-h...@cordova.apache.org