sidebar_action.json (9986B)
1 [ 2 { 3 "namespace": "manifest", 4 "types": [ 5 { 6 "$extend": "WebExtensionManifest", 7 "properties": { 8 "sidebar_action": { 9 "type": "object", 10 "additionalProperties": { "$ref": "UnrecognizedProperty" }, 11 "properties": { 12 "default_title": { 13 "type": "string", 14 "optional": true, 15 "preprocess": "localize" 16 }, 17 "default_icon": { 18 "$ref": "IconPath", 19 "optional": true 20 }, 21 "browser_style": { 22 "type": "boolean", 23 "optional": true, 24 "description": "Defaults to true in Manifest V2; Deprecated in Manifest V3." 25 }, 26 "default_panel": { 27 "type": "string", 28 "format": "strictRelativeUrl", 29 "preprocess": "localize" 30 }, 31 "open_at_install": { 32 "type": "boolean", 33 "optional": true, 34 "default": true, 35 "description": "Whether or not the sidebar is opened at install. Default is <code>true</code>." 36 } 37 }, 38 "optional": true 39 } 40 } 41 } 42 ] 43 }, 44 { 45 "namespace": "sidebarAction", 46 "description": "Use sidebar actions to add a sidebar to Firefox.", 47 "permissions": ["manifest:sidebar_action"], 48 "types": [ 49 { 50 "id": "ImageDataType", 51 "type": "object", 52 "isInstanceOf": "ImageData", 53 "additionalProperties": { "type": "any" }, 54 "postprocess": "convertImageDataToURL", 55 "description": "Pixel data for an image. Must be an ImageData object (for example, from a <code>canvas</code> element)." 56 } 57 ], 58 "functions": [ 59 { 60 "name": "setTitle", 61 "type": "function", 62 "description": "Sets the title of the sidebar action. This shows up in the tooltip.", 63 "async": true, 64 "parameters": [ 65 { 66 "name": "details", 67 "type": "object", 68 "properties": { 69 "title": { 70 "choices": [{ "type": "string" }, { "type": "null" }], 71 "description": "The string the sidebar action should display when moused over." 72 }, 73 "tabId": { 74 "type": "integer", 75 "optional": true, 76 "description": "Sets the sidebar title for the tab specified by tabId. Automatically resets when the tab is closed." 77 }, 78 "windowId": { 79 "type": "integer", 80 "optional": true, 81 "minimum": -2, 82 "description": "Sets the sidebar title for the window specified by windowId." 83 } 84 } 85 } 86 ] 87 }, 88 { 89 "name": "getTitle", 90 "type": "function", 91 "description": "Gets the title of the sidebar action.", 92 "async": true, 93 "parameters": [ 94 { 95 "name": "details", 96 "type": "object", 97 "properties": { 98 "tabId": { 99 "type": "integer", 100 "optional": true, 101 "description": "Specify the tab to get the title from. If no tab nor window is specified, the global title is returned." 102 }, 103 "windowId": { 104 "type": "integer", 105 "optional": true, 106 "minimum": -2, 107 "description": "Specify the window to get the title from. If no tab nor window is specified, the global title is returned." 108 } 109 } 110 } 111 ] 112 }, 113 { 114 "name": "setIcon", 115 "type": "function", 116 "description": "Sets the icon for the sidebar action. The icon can be specified either as the path to an image file or as the pixel data from a canvas element, or as dictionary of either one of those. Either the <strong>path</strong> or the <strong>imageData</strong> property must be specified.", 117 "async": true, 118 "parameters": [ 119 { 120 "name": "details", 121 "type": "object", 122 "properties": { 123 "imageData": { 124 "choices": [ 125 { "$ref": "ImageDataType" }, 126 { 127 "type": "object", 128 "patternProperties": { 129 "^[1-9]\\d*$": { "$ref": "ImageDataType" } 130 }, 131 "additionalProperties": false 132 } 133 ], 134 "optional": true, 135 "description": "Either an ImageData object or a dictionary {size -> ImageData} representing icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals <code>scale</code>, then image with size <code>scale</code> * 19 will be selected. Initially only scales 1 and 2 will be supported. At least one image must be specified. Note that 'details.imageData = foo' is equivalent to 'details.imageData = {'19': foo}'" 136 }, 137 "path": { 138 "choices": [ 139 { "type": "string" }, 140 { 141 "type": "object", 142 "additionalProperties": { "type": "string" } 143 } 144 ], 145 "optional": true, 146 "description": "Either a relative image path or a dictionary {size -> relative image path} pointing to icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals <code>scale</code>, then image with size <code>scale</code> * 19 will be selected. Initially only scales 1 and 2 will be supported. At least one image must be specified. Note that 'details.path = foo' is equivalent to 'details.imageData = {'19': foo}'" 147 }, 148 "tabId": { 149 "type": "integer", 150 "optional": true, 151 "description": "Sets the sidebar icon for the tab specified by tabId. Automatically resets when the tab is closed." 152 }, 153 "windowId": { 154 "type": "integer", 155 "optional": true, 156 "minimum": -2, 157 "description": "Sets the sidebar icon for the window specified by windowId." 158 } 159 } 160 } 161 ] 162 }, 163 { 164 "name": "setPanel", 165 "type": "function", 166 "description": "Sets the url to the html document to be opened in the sidebar when the user clicks on the sidebar action's icon.", 167 "async": true, 168 "parameters": [ 169 { 170 "name": "details", 171 "type": "object", 172 "properties": { 173 "tabId": { 174 "type": "integer", 175 "optional": true, 176 "minimum": 0, 177 "description": "Sets the sidebar url for the tab specified by tabId. Automatically resets when the tab is closed." 178 }, 179 "windowId": { 180 "type": "integer", 181 "optional": true, 182 "minimum": -2, 183 "description": "Sets the sidebar url for the window specified by windowId." 184 }, 185 "panel": { 186 "choices": [{ "type": "string" }, { "type": "null" }], 187 "description": "The url to the html file to show in a sidebar. If set to the empty string (''), no sidebar is shown." 188 } 189 } 190 } 191 ] 192 }, 193 { 194 "name": "getPanel", 195 "type": "function", 196 "description": "Gets the url to the html document set as the panel for this sidebar action.", 197 "async": true, 198 "parameters": [ 199 { 200 "name": "details", 201 "type": "object", 202 "properties": { 203 "tabId": { 204 "type": "integer", 205 "optional": true, 206 "description": "Specify the tab to get the panel from. If no tab nor window is specified, the global panel is returned." 207 }, 208 "windowId": { 209 "type": "integer", 210 "optional": true, 211 "minimum": -2, 212 "description": "Specify the window to get the panel from. If no tab nor window is specified, the global panel is returned." 213 } 214 } 215 } 216 ] 217 }, 218 { 219 "name": "open", 220 "type": "function", 221 "requireUserInput": true, 222 "description": "Opens the extension sidebar in the active window.", 223 "async": true, 224 "parameters": [] 225 }, 226 { 227 "name": "close", 228 "type": "function", 229 "requireUserInput": true, 230 "description": "Closes the extension sidebar in the active window if the sidebar belongs to the extension.", 231 "async": true, 232 "parameters": [] 233 }, 234 { 235 "name": "toggle", 236 "type": "function", 237 "requireUserInput": true, 238 "description": "Toggles the extension sidebar in the active window.", 239 "async": true, 240 "parameters": [] 241 }, 242 { 243 "name": "isOpen", 244 "type": "function", 245 "description": "Checks whether the sidebar action is open.", 246 "async": true, 247 "parameters": [ 248 { 249 "name": "details", 250 "type": "object", 251 "properties": { 252 "windowId": { 253 "type": "integer", 254 "minimum": -2, 255 "optional": true, 256 "description": "Specify the window to get the openness from." 257 } 258 } 259 } 260 ] 261 } 262 ] 263 } 264 ]