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

Side by Side Diff: lib/ui.js

Issue 6719238685327360: Issue 384 - Wrong image shows up briefly for Adblock Plus icon (Closed)
Patch Set: Created May 23, 2014, 11:05 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
« no previous file with comments | « lib/appSupport.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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-2014 Eyeo GmbH 3 * Copyright (C) 2006-2014 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 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 { 405 {
406 try 406 try
407 { 407 {
408 ({CustomizableUI}) = Cu.import("resource:///modules/CustomizableUI.jsm", null); 408 ({CustomizableUI}) = Cu.import("resource:///modules/CustomizableUI.jsm", null);
409 } 409 }
410 catch (e) 410 catch (e)
411 { 411 {
412 // No built-in CustomizableUI API, use our own implementation. 412 // No built-in CustomizableUI API, use our own implementation.
413 ({CustomizableUI}) = require("customizableUI"); 413 ({CustomizableUI}) = require("customizableUI");
414 } 414 }
415 415
416 CustomizableUI.createWidget({ 416 CustomizableUI.createWidget({
417 id: "abp-toolbarbutton", 417 id: "abp-toolbarbutton",
418 type: "custom", 418 type: "custom",
419 positionAttribute: "abp-iconposition", // For emulation only 419 positionAttribute: "abp-iconposition", // For emulation only
420 defaultArea: defaultToolbarPosition.parent, 420 defaultArea: defaultToolbarPosition.parent,
421 defaultBefore: defaultToolbarPosition.before, // For emulation only 421 defaultBefore: defaultToolbarPosition.before, // For emulation only
422 defaultAfter: defaultToolbarPosition.after, // For emulation only 422 defaultAfter: defaultToolbarPosition.after, // For emulation only
423 removable: true, 423 removable: true,
424 onBuild: function(document) 424 onBuild: function(document)
425 { 425 {
426 let node = document.importNode(this.overlay["abp-toolbarbutton"], true ); 426 let node = document.importNode(this.overlay["abp-toolbarbutton"], true );
427 node.addEventListener("click", this.onIconClick, false); 427 node.addEventListener("click", this.onIconClick, false);
428 node.addEventListener("command", this.onIconClick, false); 428 node.addEventListener("command", this.onIconClick, false);
429 if ("addClass" in defaultToolbarPosition)
430 node.classList.add(defaultToolbarPosition.addClass);
429 this.updateIconState(document.defaultView, node); 431 this.updateIconState(document.defaultView, node);
430 return node; 432 return node;
431 }.bind(this), 433 }.bind(this),
432 onAdded: function(node) 434 onAdded: function(node)
433 { 435 {
434 // For emulation only, this callback isn't part of the official 436 // For emulation only, this callback isn't part of the official
435 // CustomizableUI API. 437 // CustomizableUI API.
436 this.updateIconState(node.ownerDocument.defaultView, node); 438 this.updateIconState(node.ownerDocument.defaultView, node);
437 }.bind(this), 439 }.bind(this),
438 }); 440 });
(...skipping 1481 matching lines...) Expand 10 before | Expand all | Expand 10 after
1920 ["abp-command-contribute", "command", UI.openContributePage.bind(UI)], 1922 ["abp-command-contribute", "command", UI.openContributePage.bind(UI)],
1921 ["abp-command-contribute-hide", "command", UI.hideContributeButton.bind(UI)] 1923 ["abp-command-contribute-hide", "command", UI.hideContributeButton.bind(UI)]
1922 ]; 1924 ];
1923 1925
1924 onShutdown.add(function() 1926 onShutdown.add(function()
1925 { 1927 {
1926 for (let window in UI.applicationWindows) 1928 for (let window in UI.applicationWindows)
1927 if (UI.isBottombarOpen(window)) 1929 if (UI.isBottombarOpen(window))
1928 UI.toggleBottombar(window); 1930 UI.toggleBottombar(window);
1929 }); 1931 });
OLDNEW
« no previous file with comments | « lib/appSupport.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld