Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: button.js

Issue 8560083: adblockplusopera: Port UI code from Chrome (Closed)
Patch Set: Created Oct. 16, 2012, 2:16 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: button.js
===================================================================
deleted file mode 100644
--- a/button.js
+++ /dev/null
@@ -1,50 +0,0 @@
-const button = {
- update: function(url) {
- var url = opera.extension.tabs.getSelected().url;
- if(url) {
- if(whitelist.check(url))
- buttonElement.icon = '/images/icon18.png';
- else
- buttonElement.icon = '/images/icon_green18.png';
- }
- else
- buttonElement.icon = '/images/icon_yellow18.png';
- },
- click: function() {
- this.update();
- },
- enable: function() {
- preferences.bool('button', true);
- this.display();
- },
- disable: function() {
- preferences.bool('button', false);
- opera.contexts.toolbar.removeItem(buttonElement);
-
- opera.extension.windows.removeEventListener('focus', button.update, false);
- opera.extension.tabs.removeEventListener('focus', button.update, false);
- window.clearInterval(button.update, 1000);
- },
- status: function() {
- return preferences.bool('button');
- },
- display: function() {
- if(this.status()) {
- this.update();
- opera.contexts.toolbar.addItem(buttonElement);
-
- opera.extension.windows.addEventListener('focus', button.update, false);
- opera.extension.tabs.addEventListener('focus', button.update, false);
- window.setInterval(button.update, 1000);
- }
- }
-};
-var properties = {
- disabled: true,
- icon: '/images/icon18.png',
- title: translate.get('ext_name')
-};
-var buttonElement = opera.contexts.toolbar.createItem(properties);
-buttonElement.addEventListener('click', button.click(), false);
-
-button.display();

Powered by Google App Engine
This is Rietveld