window.addEventListener('load', function () { // var button = opera.contexts.toolbar.createItem({ disabled: false, title: "Bexf Button Example", icon: "icon.png", popup: { href: "popup_1.html" }, badge: {} }); // button.popup.href = "popup.html"; button.popup.width = 400; button.popup.height = 150; // button.title = 'Bexf Button Example\nTitle Updated via attr' + widget.preferences.getItem('some_option'); // "" button.addEventListener('click', function () { // var tab = opera.extension.tabs.create({url: 'https://www.google.com/', focused: true}); // button.badge.textContent = ~~(Math.random() * 10); // // tab.close(); }, false); // " " button.addEventListener('remove', function () { // opera.extension.tabs.create({url: 'http://www.ya.ru/', focused: true}); }, false); // opera.contexts.toolbar.addItem(button); window.setTimeout(function () { // 10 opera.contexts.toolbar.removeItem(button); }, 10000); }, false);
$.ready(function () { // var button = $.createButton({ disabled: false, title: "Bexf Button Example", icon: "icon.png", popup: { href: "popup_1.html" } }) // .attr({ href: "popup.html", width: 400, height: 150 }) // .attr('title', 'Bexf Button Example\nTitle Updated via attr' + $.opt('some_option')) // "" .click(function () { // var tab = $.createTab({url: 'https://www.google.com/', focused: true}); // button.text(~~(Math.random() * 10)); // // tab.close(); }) // " " .remove(function () { // $.createTab({url: 'http://www.ya.ru/', focused: true}); }) // .addToPanel(); window.setTimeout(function () { // 10 button.removeFromPanel(); }, 10000); });
Quite another thing, right?Source: https://habr.com/ru/post/111461/
All Articles