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

Side by Side Diff: safari/background.js

Issue 29317001: Relocated icon and redesigned icon popup (Closed)
Patch Set: Merged setBadgeNumber and setBadgeBackgroundColor Created Dec. 13, 2013, 10:36 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2013 Eyeo GmbH 3 * Copyright (C) 2006-2013 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 }, 70 },
71 close: function() 71 close: function()
72 { 72 {
73 this._tab.close(); 73 this._tab.close();
74 }, 74 },
75 activate: function() 75 activate: function()
76 { 76 {
77 this._tab.activate(); 77 this._tab.activate();
78 }, 78 },
79 sendMessage: sendMessage, 79 sendMessage: sendMessage,
80 pageAction: { 80 browserAction: {
81 // there are no page actions in safari, so we use toolbar items instead
82 setIcon: function(path) 81 setIcon: function(path)
83 { 82 {
84 safari.extension.toolbarItems[0].image = safari.extension.baseURI + path ; 83 safari.extension.toolbarItems[0].image = safari.extension.baseURI + path ;
85 }, 84 },
86 setTitle: function(title) 85 setTitle: function(title)
87 { 86 {
88 safari.extension.toolbarItems[0].toolTip = title; 87 safari.extension.toolbarItems[0].toolTip = title;
89 }, 88 },
89 setBadge: function(badge)
90 {
91 if (!badge)
92 safari.extension.toolbarItems[0].badge = 0;
93 else if ("number" in badge)
94 safari.extension.toolbarItems[0].badge = badge.number;
95 },
90 96
91 // toolbar items in safari can"t get hidden 97 // The following features aren't supported by Safari
92 hide: function() {}, 98 hide: function() {},
93 show: function() {} 99 show: function() {}
94 } 100 }
95 }; 101 };
96 102
97 TabMap = function() 103 TabMap = function()
98 { 104 {
99 this._tabs = []; 105 this._tabs = [];
100 this._values = []; 106 this._values = [];
101 107
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 // clicked. While Chrome loads it everytime you click the icon. So in order to 532 // clicked. While Chrome loads it everytime you click the icon. So in order to
527 // force the same behavior in Safari, we are going to reload the page of the 533 // force the same behavior in Safari, we are going to reload the page of the
528 // bubble everytime it is shown. 534 // bubble everytime it is shown.
529 if (safari.extension.globalPage.contentWindow != window) 535 if (safari.extension.globalPage.contentWindow != window)
530 safari.application.addEventListener("popover", function() 536 safari.application.addEventListener("popover", function()
531 { 537 {
532 document.documentElement.style.display = "none"; 538 document.documentElement.style.display = "none";
533 document.location.reload(); 539 document.location.reload();
534 }, true); 540 }, true);
535 })(); 541 })();
OLDNEW

Powered by Google App Engine
This is Rietveld