Opera Add-ons

Extensions and themes for the Opera desktop browser

Subscribe to RSS feed

Posts tagged with "apis"

We've got some new extension APIs for you

, , , ...

We've just released Opera 12.1 beta, which is better, faster, and more secure than ever. However, apart from all that goodness, we've got some new goodies for all you extension developers too. Opera 12.1 beta features some additional APIs that you can use to make new extensions with, or add power to your existing ones. Lets take a a brief look at them.

Context Menu API

For a long while, you've asked us to have a way to integrate extensions in the conext menu (the menu you get when you right-click on an element in a web page). With the Context Menu API, you can do exactly that. You have the ability to create sub-menus if you want. You can also specify when exactly should the menu item be visible (when you right-click on an image, a link, a form element, the page in general or all of the above). Head over to the documentation to read on how to use the API. In the meantime, try some extension which already utilize this API, like the 'Tineye Context Search' and the 'Goto IMDB 2' extensions.

Screenshot API

The name is pretty self-explanatory. You can now use the opera.extension.getScreenshot() function to capture the screenshot of the visible portion of the page, without any other part of the browser like the toolbars etc. You can call it either from the background script or the injected script. Take a look at the 'Screenshoter' extension which already uses it! You can read the documentation to find out more about it.

Resouce Loader API

Till now, you could not load resources from other parts of the extension. The Resource Loader API makes it possible for you to do that in a very simple manner. All you need to do is call opera.extension.getFile() to access the file and use the W3C File API to actually read the file. This makes it easy to access some other parts of the extension which might prove handy, like accessing the extension's logo or the config.xml file. Opera user BS-Harou also created a very cool 'Require.JS' function for injected scripts using this API, which you should check out. As always, more info on how to use it is there on the documentation page.

We hope you'll like the new APIs for extensions in Opera 12.1, and we look forward to what you can create with them!

Developers: enjoy our new URL Filter API

,

Opera launched a new snapshot of Opera (experimental build) for the more courageous of you to play with.

It includes a small gem for extension developers: a brand new API that makes the world of content blocking a whole lot easier. Here's how it works (non-developers, look away):

First, add this to you config.xml:
<feature name="opera:urlfilter"/>

Then knock yourself out in the background script:
var sites = ['*://twitter.com/*',  '*://*.twitter.com'];  
var filter = opera.extension.urlfilter;

for (var i = 0; len = sites.length; i < len; i++) {
    filter.block.add(sites[i]);
}

On dev.opera.com you can find more developer information on how to use the URL Filter API. For general information on how to develop Opera extensions take a look at this overview.

Not a developer? Here's a photo of a cat.