<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # Page Actions ## Contents 1. [Manifest](pageAction.html#manifest) 2. [UI的組成部分](pageAction.html#ui) 3. [提示](pageAction.html#tips) 4. [示例](pageAction.html#examples) 5. [API reference: chrome.pageAction](pageAction.html#apiReference) 1. [Methods](pageAction.html#global-methods) 1. [hide](pageAction.html#method-hide) 2. [setIcon](pageAction.html#method-setIcon) 3. [setPopup](pageAction.html#method-setPopup) 4. [setTitle](pageAction.html#method-setTitle) 5. [show](pageAction.html#method-show) 2. [Events](pageAction.html#global-events) 1. [onClicked](pageAction.html#event-onClicked) 使用page actions把圖標放置到地址欄里。page actions定義需要處理的頁面的事件,但是它們不是適用于所有頁面的。下面是一些page actions的示例: * 訂閱該頁面的RSS feed * 為頁面的圖片做一個幻燈片 在下面的屏幕截圖中的RSS圖標,提供了一個可以讓用戶訂閱當前頁面RSS Feed的page action。 ![](https://box.kancloud.cn/2015-12-28_5680aafebce23.png) 想讓擴展圖標總是可見,則使用[browser action](browserAction.html)。 **注意:** 打包的應用程序不能使用page actions。 ## Manifest 在 [extension manifest](manifest.html) 中用下面的方式注冊你的page action: ``` { "name": "My extension", ... **"page_action": { "default_icon": "icons/foo.png", _// optional_ "default_title": "Do action", _// optional; shown in tooltip_ "default_popup": "popup.html" _// optional_ }**, ... } ``` ## UI的組成部分 同browser actions一樣,page actions 可以有圖標、提示信息、 彈出窗口。但沒有badge,也因此,作為輔助,page actions可以有顯示和消失兩種狀態。閱讀[browser action UI](browserAction.html#ui). 可以找到圖標、提示信息、 彈出窗口相關信息。 使用方法 [show()](#method-show) 和 [hide()](#method-hide) 可以顯示和隱藏page action。缺省情況下page action是隱藏的。當要顯示時,需要指定圖標所在的標簽頁,圖標顯示后會一直可見,直到該標簽頁關閉或開始顯示不同的URL (如:用戶點擊了一個連接) ## 提示 為了獲得最佳的視覺效果,請遵循下列指導方針: * **要**只對少數頁面使用page action; * **不要**對大多數頁面使用它,如果功能需要,使用 [browser actions](browserAction.html)代替。 * **沒事別總讓圖標出現動畫,那會讓人很煩。** ## 示例 你可以在[examples/api/pageAction](http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/pageAction/) 找到使用page action的簡單示例,其它例子和源代碼幫助查看[Samples](sample.html)。 ## API reference: chrome.pageAction ### Properties <a></a> #### getLastError chrome.extensionlastError ### Methods #### hide void chrome.pageAction.hide(, integer `tabId`) Undocumented. 隱藏page action. #### Parameters `tabId`_( optional enumerated Type array of integer )_ Undocumented. 要執行這個動作的標簽ID。 This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version. #### Returns #### Callback function The callback _parameter_ should specify a function that looks like this: If you specify the _callback_ parameter, it should specify a function that looks like this: ``` function(Type param1, Type param2) {...}; ``` This function was added in version . If you require this function, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version. #### setIcon void chrome.pageAction.setIcon(, object `details`) Undocumented. 為page aciton設置圖標。圖標可以是一個圖片的路徑或者是從一個canvas元素提取的像素信息.。無論是**圖標路徑**還是canvas的 **imageData**,這個屬性必須被指定。 #### Parameters `details`_( optional enumerated Type array of object )_ Undocumented. Description of this parameter from the json schema. This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version. `tabId`_( optional enumerated Type array of integer )_ Undocumented. 要執行這個動作的標簽ID。 This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version. `imageData`_( optional enumerated Type array of ImageData )_ Undocumented. 圖片的像素信息。必須是一個ImageData 對象(例如:一個canvas元素)。 This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version. `path`_( optional enumerated Type array of string )_ Undocumented. 圖片在擴展中的的相對路徑。 This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version. `iconIndex`_( optional enumerated Type array of integer )_ Undocumented. **不建議。**manifest中定義的,0開始的圖標數組下標。 This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version. #### Returns #### Callback function The callback _parameter_ should specify a function that looks like this: If you specify the _callback_ parameter, it should specify a function that looks like this: ``` function(Type param1, Type param2) {...}; ``` This function was added in version . If you require this function, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version. #### setPopup void chrome.pageAction.setPopup(, object `details`) Undocumented. 設置一個點擊page actions時顯示在popup中的HTML。 #### Parameters `details`_( optional enumerated Type array of object )_ Undocumented. Description of this parameter from the json schema. This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version. `tabId`_( optional enumerated Type array of integer )_ Undocumented. 要設置popup的標簽ID。 This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version. `popup`_( optional enumerated Type array of string )_ Undocumented. popup中顯示的html文件。如果設置為空字符(''),將不顯示popup。 This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version. #### Returns #### Callback function The callback _parameter_ should specify a function that looks like this: If you specify the _callback_ parameter, it should specify a function that looks like this: ``` function(Type param1, Type param2) {...}; ``` 這個功能已經在**chromium 5.0.316.0版本**添加。如果你需要這個功能,可以通過manifest的[minimum_chrome_version](manifest.html#minimum_chrome_version)鍵值來確認你的擴展不會運行在早期的瀏覽器版本。 #### setTitle void chrome.pageAction.setTitle(, object `details`) Undocumented. 設置page action的標題,這將顯示在tooltip中。 #### Parameters `details`_( optional enumerated Type array of object )_ Undocumented. Description of this parameter from the json schema. This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version. `tabId`_( optional enumerated Type array of integer )_ Undocumented. 要設置標題的標簽ID。 `title`_( optional enumerated Type array of string )_ Undocumented. 提示信息字符串。 This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version. #### Returns #### Callback function The callback _parameter_ should specify a function that looks like this: If you specify the _callback_ parameter, it should specify a function that looks like this: ``` function(Type param1, Type param2) {...}; ``` This function was added in version . If you require this function, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version. #### show void chrome.pageAction.show(, integer `tabId`) Undocumented. 顯示page action,無論標簽是否被選中。 #### Parameters `tabId`_( optional enumerated Type array of integer )_ Undocumented. 要執行這個動作的標簽ID。 This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version. #### Returns #### Callback function The callback _parameter_ should specify a function that looks like this: If you specify the _callback_ parameter, it should specify a function that looks like this: ``` function(Type param1, Type param2) {...}; ``` This function was added in version . If you require this function, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version. ### Events #### onClicked chrome.pageAction.onClicked.addListener(function(Tab tab) {...}); Undocumented. 當page action圖標被點擊的時候調用,如果page action是一個popup,這個事件將不會觸發。Fi #### Parameters `tab`_( optional enumerated [Tab](tabs.html#type-Tab) array of paramType )_ Undocumented. Description of this parameter from the json schema. This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version. ### Types <a></a> #### type name
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看