diff options
author | Florian Merz <me@fiji-flo.de> | 2021-02-11 13:12:08 +0100 |
---|---|---|
committer | Florian Merz <me@fiji-flo.de> | 2021-02-11 13:12:08 +0100 |
commit | 43a5cac2eff22c21071800e13bef12af9d3a37d0 (patch) | |
tree | f6e91f8aa958f15bd0b0aabf7b8dfc09063eceda /files/zh-tw/webapi | |
parent | 8260a606c143e6b55a467edf017a56bdcd6cba7e (diff) | |
download | translated-content-43a5cac2eff22c21071800e13bef12af9d3a37d0.tar.gz translated-content-43a5cac2eff22c21071800e13bef12af9d3a37d0.tar.bz2 translated-content-43a5cac2eff22c21071800e13bef12af9d3a37d0.zip |
unslug zh-tw: move
Diffstat (limited to 'files/zh-tw/webapi')
-rw-r--r-- | files/zh-tw/webapi/index.html | 127 | ||||
-rw-r--r-- | files/zh-tw/webapi/permissions/index.html | 85 |
2 files changed, 0 insertions, 212 deletions
diff --git a/files/zh-tw/webapi/index.html b/files/zh-tw/webapi/index.html deleted file mode 100644 index c606a94846..0000000000 --- a/files/zh-tw/webapi/index.html +++ /dev/null @@ -1,127 +0,0 @@ ---- -title: WebAPI -slug: WebAPI -translation_of: Web/API -translation_of_original: WebAPI ---- -<p><strong>WebAPI</strong> 是指一系列的存取與裝置相容性 API,讓 Web App 及其內容能夠存取裝置的硬體 (例如電池狀態或裝置的振動硬體),亦可存取裝置所儲存的資料 (例如行事曆或聯絡人清單)。在添加這些 API 之後,我們希望 Web 能跳脫目前的功能,並打破專利平台的限制。</p> - -<div class="note"> -<p><strong>注意:</strong>我們實際撰寫的內容,其實比本頁所列出的 API 還多,而且仍有許多連結尚未補齊。我們將持續補完相關內容,以提供更完整的資訊。可參閱 <a href="https://developer.mozilla.org/en-US/docs/WebAPI/Doc_status" title="WebAPI/Doc_status">WebAPI 文件狀態頁面</a>,隨時追蹤目前的 WebAPI 說明文件。</p> -</div> - -<div class="note"> -<p><strong>注意:</strong>若要了解小標圖的意義,可先參閱<a href="https://developer.mozilla.org/zh-TW/docs/%E6%87%89%E7%94%A8%E7%A8%8B%E5%BC%8F-840092-dup/Packaged_apps?redirectlocale=en-US&redirectslug=Apps%2FPackaged_apps" title="Web/Apps/Packaged_apps#Types_of_packaged_apps">《封裝式 (Packaged) App》</a>一文。</p> -</div> - -<div class="row topicpage-table"> -<div class="section"> -<h2 class="Documentation" id="Communication_APIs" name="Communication_APIs">通訊 API</h2> - -<dl> - <dt><a href="https://developer.mozilla.org/zh-TW/docs/WebAPI/Network_Information" title="WebAPI/Network_Information">Network Information API</a></dt> - <dd>提供目前網路連線的基本資訊,如連線速度。</dd> - <dt><a href="/en-US/docs/WebAPI/WebBluetooth" title="WebAPI/WebBluetooth">Bluetooth</a></dt> - <dd>The WebBluetooth API provides low-level access to the device's Bluetooth hardware.</dd> - <dt><a href="/en-US/docs/WebAPI/Mobile_Connection" title="WebAPI/Mobile_Connection">Mobile Connection API</a> {{NonStandardBadge}}</dt> - <dd>Exposes information about the device's cellular connectivity, such as signal strength, operator information, and so forth.</dd> - <dt><a href="https://developer.mozilla.org/zh-TW/docs/WebAPI/Network_Stats" title="WebAPI/Network_Stats">Network Stats API</a> {{NonStandardBadge}}</dt> - <dd>監控資料使用情形,並將此資料提供給 Privileged App。</dd> - <dt><a href="https://developer.mozilla.org/zh-TW/docs/WebAPI/TCP_Socket" title="WebAPI/TCP_Socket">TCP Socket API</a> {{NonStandardBadge}}</dt> - <dd>提供初階的 Socket 與 SSL 支援功能。</dd> - <dt><a href="https://developer.mozilla.org/zh-TW/docs/Web/Guide/Telephony" title="WebAPI/WebTelephony">Telephony</a> {{NonStandardBadge}}</dt> - <dd>讓 App 可撥/接電話,並使用內建電話的使用者介面。</dd> - <dt><a href="https://developer.mozilla.org/zh-TW/docs/WebAPI/WebSMS" title="WebAPI/WebSMS">WebSMS </a>{{NonStandardBadge}}</dt> - <dd>讓 App 能收/發 SMS 文字簡訊,並能存取/管理裝置所儲存的訊息。</dd> - <dt><a href="/en-US/docs/WebAPI/WiFi_Information" title="WebAPI/WiFi_Information">WiFi Information API</a> {{NonStandardBadge}}</dt> - <dd>A privileged API which provides information about signal strength, the name of the current network, available WiFi networks, and so forth.</dd> -</dl> - -<h2 class="Documentation" id="Hardware_access_APIs" name="Hardware_access_APIs">硬體存取 API</h2> - -<dl> - <dt><a href="https://developer.mozilla.org/zh-TW/docs/WebAPI/Using_Light_Events">Ambient Light Sensor API</a></dt> - <dd>可存取環境光線感測器,讓 App 可偵測裝置四周的環境光線強度。</dd> - <dt><a href="https://developer.mozilla.org/zh-TW/docs/WebAPI/Battery_Status" title="WebAPI/Battery_Status">Battery Status API</a></dt> - <dd>不論是否插電進行充電,均將提供電池充電容量的相關資訊。</dd> - <dt><a href="https://developer.mozilla.org/zh-TW/docs/Using_geolocation" title="Using_geolocation">Geolocation API</a></dt> - <dd>提供裝置實際位置的相關資訊。</dd> - <dt><a href="/zh-TW/docs/WebAPI/Pointer_Lock" title="API/Pointer_Lock_API">Pointer Lock API</a></dt> - <dd>讓 App 能鎖定存取滑鼠,並取得「隨著時間推移的滑鼠位移 (即 deltas)」,而不只是絕對座標而已。特別適用遊戲類 App。</dd> - <dt><a href="https://developer.mozilla.org/zh-TW/docs/WebAPI/Proximity" title="WebAPI/Proximity">Proximity API</a></dt> - <dd>測得裝置與物體 (如使用者的臉部) 之間的距離。</dd> - <dt><a href="https://developer.mozilla.org/zh-TW/docs/WebAPI/Detecting_device_orientation" title="Detecting_device_orientation">Device Orientation API</a></dt> - <dd>當裝置的方向改變時,送出通知。</dd> - <dt><a href="https://developer.mozilla.org/zh-TW/docs/WebAPI/Managing_screen_orientation" title="Detecting_device_orientation">Screen Orientation API</a></dt> - <dd>在畫面方向改變時發出通知。另透過此 API,可讓 App 呈現其所偏好的方向。</dd> - <dt><a href="https://developer.mozilla.org/zh-TW/docs/WebAPI/Vibration" title="WebAPI/WebBluetooth">Vibration API</a></dt> - <dd>可讓 App 控制裝置上的振動硬體,用於如遊戲中的觸控回饋。此 API <strong>並非</strong>用於如「通知」的振動事件。若需要通知的振動事件,請參閱 <a href="https://developer.mozilla.org/zh-TW/docs/WebAPI/Alarm" title="WebAPI/Alarm">Alarm API</a>。</dd> - <dt><a href="https://developer.mozilla.org/zh-TW/docs/WebAPI/Camera" title="WebAPI/Camera">Camera API</a> {{NonStandardBadge}}</dt> - <dd>讓 App 透過裝置內建的相機,即可拍照或錄製影片。</dd> - <dt><a href="https://developer.mozilla.org/zh-TW/docs/WebAPI/Power_Management" title="WebAPI/Power_Management">Power Management API</a> {{NonStandardBadge}}</dt> - <dd>讓 App 能開/關 CPU、螢幕、裝置電力,與類似資源。另可進一步監聽或檢視資源鎖定事件。</dd> -</dl> - -<p><span class="alllinks"><a href="/en-US/docs/tag/WebAPI" title="tag/CSS">View All...</a></span></p> -</div> - -<div class="section"> -<h2 class="Documentation" id="Data_management_APIs" name="Data_management_APIs">資料管理 API</h2> - -<dl> - <dt><a href="https://developer.mozilla.org/zh-TW/docs/WebAPI/FileHandle" title="WebAPI/FileHandle_API">FileHandle API</a></dt> - <dd>支援可寫入的檔案,並搭配鎖存功能。</dd> - <dt><a href="https://developer.mozilla.org/zh-TW/docs/IndexedDB" title="IndexedDB">IndexedDB</a></dt> - <dd>於用戶端儲存結構性的資料,並支援高效率的搜尋功能。</dd> - <dt><a href="https://developer.mozilla.org/zh-TW/docs/WebAPI/Settings" title="WebAPI/Settings">Settings API</a> {{NonStandardBadge}}</dt> - <dd>App 可檢查並更改系統的相關設定;而這些設定選項均屬於永久儲存性質。</dd> -</dl> - -<h2 class="Documentation" id="Other_APIs" name="Other_APIs">其他 API</h2> - -<dl> - <dt><a href="https://developer.mozilla.org/zh-TW/docs/WebAPI/Alarm" title="WebAPI/Alarm">Alarm API</a></dt> - <dd>App 可排定通知,亦可於特定時間自行啟動 App。</dd> - <dt><a href="https://developer.mozilla.org/zh-TW/docs/WebAPI/Simple_Push" title="WebAPI/Push_Notifications">Simple Push API</a></dt> - <dd>讓平台傳送通知訊息至特定 App。</dd> - <dt><a href="https://developer.mozilla.org/zh-TW/docs/WebAPI/Using_Web_Notifications" title="/en-US/docs/WebAPI/Using_Web_Notifications">Web Notifications</a></dt> - <dd>讓 App 傳送通知並於系統層級顯示。</dd> - <dt><a href="https://developer.mozilla.org/zh-TW/docs/%E6%87%89%E7%94%A8%E7%A8%8B%E5%BC%8F-840092-dup" title="Apps">Apps API</a> {{NonStandardBadge}}</dt> - <dd>Open WebApps API 可安裝並管理 Web App。此外,亦可讓 App 決定付款資訊。</dd> - <dt><a href="https://developer.mozilla.org/zh-TW/docs/WebAPI/Web_Activities" title="WebAPI/Web_Activities">Web Activities</a> {{NonStandardBadge}}</dt> - <dd>讓 App 可委派某個 Activity 給其他 App。舉例來說,XX App 可能要求 YY App 選擇並回傳相片。使用者一般均可設定 Activity 所應搭配使用的 App。</dd> - <dt><a href="https://developer.mozilla.org/zh-TW/docs/WebAPI/Browser" title="DOM/Using_the_Browser_API"><strong>Browser API</strong></a> {{NonStandardBadge}}</dt> - <dd>完全透過 Web 技術,支援建構 Web 瀏覽器 (可說是瀏覽器中再建構出瀏覽器)。</dd> -</dl> - -<dl> - <dt><a href="https://developer.mozilla.org/zh-TW/docs/WebAPI/Idle" title="WebAPI/Device_Storage_API">Idle API</a></dt> - <dd>使用者並未使用裝置時,讓 App 接收通知。</dd> - <dt><a href="https://developer.mozilla.org/zh-TW/docs/WebAPI/Permissions" title="WebAPI/Permissions">Permissions API</a> {{NonStandardBadge}}</dt> - <dd>集中管理 App 的權限 (Permission)。由設定類 (Settings) 的 App 所使用。</dd> - <dt><a href="https://developer.mozilla.org/zh-TW/docs/WebAPI/Time_and_Clock" title="WebAPI/Time_and_Clock">Time/Clock API</a> {{NonStandardBadge}}</dt> - <dd>可設定目前時間。另透過 <a href="https://developer.mozilla.org/zh-TW/docs/WebAPI/Settings" title="WebAPI/Settings">Settings API</a> 設定時區。</dd> -</dl> - -<h2 class="Community" id="Community" name="Community">WebAPI 社群</h2> - -<p>如果需要這些 API 的相關協助,則有許多方法可諮詢其他開發人員。</p> - -<ul> - <li>在 WebAPI 討論區中提出問題: {{DiscussionList("dev-webapi", "mozilla.dev.webapi")}}</li> - <li>到 WebAPI IRC channel 逛逛:<a href="irc://irc.mozilla.org/webapi" title="irc://irc.mozilla.org/webapi">#webapi</a></li> -</ul> - -<p><span class="alllinks"><a href="http://www.catb.org/~esr/faqs/smart-questions.html" title="http://www.catb.org/~esr/faqs/smart-questions.html">Don't forget about the <em>netiquette</em>...</a></span></p> - -<h2 class="Related_Topics" id="Related_Topics" name="Related_Topics">相關主題</h2> - -<ul> - <li>The <a href="/en-US/docs/Document_Object_Model_(DOM)" title="Document Object Model (DOM)">Document Object Model (DOM)</a> is the representation of an HTML document as a tree.</li> - <li><a href="/en-US/docs/JavaScript" title="JavaScript">JavaScript</a> - Scripting language for the Web.</li> - <li><a href="/en-US/docs/WebAPI/Doc_status" title="WebAPI/Doc_status">Doc status</a>: A list of WebAPI topics and their documentation status.</li> -</ul> -</div> -</div> - -<p> </p> diff --git a/files/zh-tw/webapi/permissions/index.html b/files/zh-tw/webapi/permissions/index.html deleted file mode 100644 index d58d8466be..0000000000 --- a/files/zh-tw/webapi/permissions/index.html +++ /dev/null @@ -1,85 +0,0 @@ ---- -title: 權限 (Permissions) -slug: WebAPI/Permissions -translation_of: Web/API/Permissions_API ---- -<p>{{ draft() }}</p> -<p>{{ non-standard_header }}</p> -<p>{{ B2GOnlyHeader2('certified') }}</p> -<h2 id="摘要">摘要</h2> -<p>Permissions API 可顯示 Apps 所要求的所有權限,以利使用者管理。Apps 可透過此 API 而讀取其他 Apps 的權限並進一步變更。</p> -<p>透過 <a href="https://developer.mozilla.org/en-US/docs/DOM/PermissionSettings" title="/en-US/docs/DOM/PermissionSettings"><code>PermissionSettings</code></a> 介面的 <a href="https://developer.mozilla.org/en-US/docs/DOM/window.navigator.mozPermissionSettings" title="/en-US/docs/DOM/window.navigator.mozPermissionSettings"><code>navigator.mozPermissionSettings</code></a> 屬性,即可存取 Permission Manager。</p> -<h2 id="已安裝_Apps_的權限">已安裝 Apps 的權限</h2> -<p>所有 Apps 均需透過自己的 manifest 檔案而要求權限。Apps 每次所使用的 API,均以「請求顯性權限 (Explicit Permission)」的 API 為主,並提示使用者是否通過權限。如果使用者選擇「不要再提示」,大概也就不太可能改變決定了。API 則能提供介面,以利使用者管理已發出的權限。</p> -<p>透過 <a href="https://developer.mozilla.org/en-US/docs/DOM/PermissionSettings.get" title="/en-US/docs/DOM/PermissionSettings.get"><code>PermissionSettings.get()</code></a>、<a href="https://developer.mozilla.org/en-US/docs/DOM/PermissionSettings.set" title="/en-US/docs/DOM/PermissionSettings.set"><code>set()</code></a>、<a href="https://developer.mozilla.org/en-US/docs/DOM/PermissionSettings.isExplicit" title="/en-US/docs/DOM/PermissionSettings.isExplicit"><code>isExplicit()</code></a> 函式即可達到上述作業。</p> -<h3 id="讀取權限">讀取權限</h3> -<p>若要知道已發出權限的目前狀態,可使用 <a href="https://developer.mozilla.org/en-US/docs/DOM/PermissionSettings.get" title="/en-US/docs/DOM/PermissionSettings.get"><code>PermissionSettings.get()</code></a> 函式。此函式可回傳字串,以顯示特定 Apps 權限的目前狀態。可能的數值有:</p> -<dl> - <dt> - <code>allow</code></dt> - <dd> - 已通過該權限,且不需使用者的進一步互動。</dd> - <dt> - <code>denied</code></dt> - <dd> - 已否決該權限;可能是系統或使用者所否決。</dd> - <dt> - <code>prompt</code></dt> - <dd> - 代表該權限將以明顯的提示方法,詢問使用者是否給予權限。</dd> - <dt> - <code>unknown</code></dt> - <dd> - 代表該 Apps 並未詢問此權限,也不會提示使用者是否給予權限。</dd> -</dl> -<pre class="brush: js">// Let's check all installed apps -var apps = navigator.mozApps.mgmt.getAll(); - -apps.onsuccess = function () { - var permission = navigator.mozPermissionSettings; - - // Let's check the permission of each app - apps.result.forEach(function (app) { - var request, appName = app.manifest.name; - - for (request in app.manifest.permission) { - // Let's get the current permission for each permission request by the application - var p = permission.get(request, app.manifestUrl, app.origine, false); - - console.log(appName + ' asked for "' + request + '" permission, which is "' + p + '"') - } - }); -} - -</pre> -<h3 id="設定權限">設定權限</h3> -<p>只要使用 <a href="https://developer.mozilla.org/en-US/docs/DOM/PermissionSettings.set" title="/en-US/docs/DOM/PermissionSettings.set"><code>PermissionSettings.set()</code></a> 函式即可設定權限。可能的數值均與 <a href="https://developer.mozilla.org/en-US/docs/DOM/PermissionSettings.get" title="/en-US/docs/DOM/PermissionSettings.get"><code>get</code></a> 函式所存取的相同。</p> -<div class="note"> - <p><strong>注意:</strong>根據 Apps 權限的不同,某些可能為隱性 (Implicit) 權限。若因為某種理由,Apps 嘗試將權限變更為隱性權限,就會產生錯誤。為了避免這種錯誤,可透過 <a href="https://developer.mozilla.org/en-US/docs/DOM/PermissionSettings.isExplicit" title="/en-US/docs/DOM/PermissionSettings.isExplicit"><code>PermissionSettings.isExplicit()</code></a> 函式而檢查是否為顯性權限。</p> -</div> -<pre class="brush: js">// Let's check all installed apps -var apps = navigator.mozApps.mgmt.getAll(); - -apps.onsuccess = function () { - var permission = navigator.mozPermissionSettings; - - // Let's grant the permission of each app - apps.result.forEach(function (app) { - var request, appName = app.manifest.name; - - for (request in app.manifest.permission) { - // If the permission is not explicit - if (!permission.isExplicit(request, app.manifestUrl, app.origine, false) { - // Let's ask the user for all permissions requested by the application - permission.set(request, app.manifestUrl, app.origine, false); - } - } - }); -}</pre> -<h2 id="規格">規格</h2> -<p>不屬於任何規格。</p> -<h2 id="另可參閱">另可參閱</h2> -<ul> - <li>{{domxref("window.navigator.mozPermissionSettings","navigator.mozPermissionSettings")}}</li> - <li>{{domxref("PermissionSettings")}}</li> -</ul> |