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

Unified Diff: stats.js

Issue 5088751004942336: Issue 370 - Right-clicked element is removed independent of created filter (Closed)
Patch Set: Rebase to rev 3c9cea80c481 Created July 18, 2014, 8:54 a.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
« no previous file with comments | « skin/popup.css ('k') | webrequest.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: stats.js
===================================================================
--- a/stats.js
+++ b/stats.js
@@ -1,6 +1,6 @@
/*
* This file is part of Adblock Plus <http://adblockplus.org/>,
- * Copyright (C) 2006-2013 Eyeo GmbH
+ * Copyright (C) 2006-2014 Eyeo GmbH
*
* Adblock Plus is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
@@ -23,7 +23,7 @@
var FilterNotifier = require("filterNotifier").FilterNotifier;
var Prefs = require("prefs").Prefs;
- var currentTab;
+ var currentPage;
var shareURL = "https://adblockplus.org/";
var messageMark = {};
@@ -76,17 +76,14 @@
document.querySelector("label[for='show-iconnumber']").addEventListener("click", toggleIconNumber, false);
// Update stats
- ext.windows.getLastFocused(function(win)
+ ext.pages.query({active: true, lastFocusedWindow: true}, function(pages)
{
- win.getActiveTab(function(tab)
- {
- currentTab = tab;
- updateStats();
+ currentPage = pages[0];
+ updateStats();
- FilterNotifier.addListener(onNotify);
+ FilterNotifier.addListener(onNotify);
- document.getElementById("stats-container").removeAttribute("hidden");
- });
+ document.getElementById("stats-container").removeAttribute("hidden");
});
}
@@ -104,7 +101,7 @@
function updateStats()
{
var statsPage = document.getElementById("stats-page");
- var blockedPage = getStats("blocked", currentTab).toLocaleString();
+ var blockedPage = getStats("blocked", currentPage).toLocaleString();
i18n.setElementText(statsPage, "stats_label_page", [blockedPage]);
var statsTotal = document.getElementById("stats-total");
@@ -121,8 +118,7 @@
else
blocked = i18n.getMessage("stats_over", (9000).toLocaleString());
- var url = createShareLink(ev.target.dataset.social, blocked);
- ext.windows.getLastFocused(function(win) { win.openTab(url); });
+ ext.pages.open(createShareLink(ev.target.dataset.social, blocked));
}
function toggleIconNumber()
« no previous file with comments | « skin/popup.css ('k') | webrequest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld