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

Side by Side Diff: popup.js

Issue 29338764: Issue 3842 - Split up the logic updating the icon and context menu (Closed)
Patch Set: Rebased Created March 22, 2016, 8:26 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/whitelisting.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 <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 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 18 matching lines...) Expand all
29 function onLoad() 29 function onLoad()
30 { 30 {
31 ext.pages.query({active: true, lastFocusedWindow: true}, function(pages) 31 ext.pages.query({active: true, lastFocusedWindow: true}, function(pages)
32 { 32 {
33 page = pages[0]; 33 page = pages[0];
34 34
35 // Mark page as 'local' or 'nohtml' to hide non-relevant elements 35 // Mark page as 'local' or 'nohtml' to hide non-relevant elements
36 if (!page || (page.url.protocol != "http:" && 36 if (!page || (page.url.protocol != "http:" &&
37 page.url.protocol != "https:")) 37 page.url.protocol != "https:"))
38 document.body.classList.add("local"); 38 document.body.classList.add("local");
39 else if (!backgroundPage.htmlPages.has(page)) 39 else if (!require("filterComposer").isPageReady(page))
40 { 40 {
41 document.body.classList.add("nohtml"); 41 document.body.classList.add("nohtml");
42 require("messaging").getPort(window).on( 42 require("messaging").getPort(window).on(
43 "composer.ready", function(message, sender) 43 "composer.ready", function(message, sender)
44 { 44 {
45 if (sender.page.id == page.id) 45 if (sender.page.id == page.id)
46 document.body.classList.remove("nohtml"); 46 document.body.classList.remove("nohtml");
47 } 47 }
48 ); 48 );
49 } 49 }
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 } 134 }
135 135
136 function toggleCollapse(event) 136 function toggleCollapse(event)
137 { 137 {
138 var collapser = event.currentTarget; 138 var collapser = event.currentTarget;
139 Prefs[collapser.dataset.option] = !Prefs[collapser.dataset.option]; 139 Prefs[collapser.dataset.option] = !Prefs[collapser.dataset.option];
140 collapser.parentNode.classList.toggle("collapsed"); 140 collapser.parentNode.classList.toggle("collapsed");
141 } 141 }
142 142
143 document.addEventListener("DOMContentLoaded", onLoad, false); 143 document.addEventListener("DOMContentLoaded", onLoad, false);
OLDNEW
« no previous file with comments | « lib/whitelisting.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld