This documentation relates to Opera's now deprecated .oex Extension API framework for Opera versions <= 12.15 and also provided by our OEX2NEX shim library.
For the latest Opera Extensions API documentation for Opera versions > 12.15 please consult the latest Opera Extensions API documentation online.
This property represents the Popup
for the Button
. Calling Button.popup
will return the popup object. You can also get and set the popup properties directly through the Button
object (e.g. to set the popup width you can do 'button.popup.width = 300
')
The below example shows a popup when the button is clicked. The content of the popup changes between one of three websites each time the popup is diplayed.
//
// The background process (e.g. index.html)
//
// Set the button's properties
var properties = {
disabled: false,
title: "My Extension",
icon: "icon.18x18.png",
popup: {
href: 'popup.html',
width: 300
}
};
// Create the button and add it to the browser UI
var button = opera.contexts.toolbar.createItem(properties);
opera.contexts.toolbar.addItem(button);
// Get the popup object to set the height property
var popup = button.popup;
popup.height = 400;
// Open a site randomly in the popup when the button is clicked
var randomSites = ['http://touch.facebook.com', 'http://mobile.twitter.com', 'http://m.opera.com/'];
var i = 1;
button.addEventListener('click', handleClick, false);
function handleClick(){
// Circle through the sites on each click
button.popup.href = randomSites[i % 3];
i++;
}