From d3489406c2e7344ad19ffdb70ab3ae4478131674 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Taro?= Date: Fri, 20 Jan 2017 15:51:30 +0100 Subject: [PATCH 01/34] Initial work on "Resource page" design update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tomáš Taro --- filtering/filteroptions.js | 4 ++ js/background.js | 14 ++++- pages/resourceblock.css | 62 +++++++++++++++++--- pages/resourceblock.html | 8 +++ pages/resourceblock.js | 117 ++++++++++++++++++++++++++----------- 5 files changed, 163 insertions(+), 42 deletions(-) diff --git a/filtering/filteroptions.js b/filtering/filteroptions.js index 304cae7a..003cbd17 100644 --- a/filtering/filteroptions.js +++ b/filtering/filteroptions.js @@ -32,6 +32,10 @@ ElementTypes.fromOnBeforeRequestType = function(type) { // See http://src.chromium.org/viewvc/chrome/trunk/src/webkit/glue/resource_type.h?view=markup // for what 'other' includes case "other": return ElementTypes.other; + // Retype "font" request to "other" + case "font": return ElementTypes.other; + // Retype "ping" request to "xmlhttprequest" + case "ping": return ElementTypes.xmlhttprequest; default: return ElementTypes[type]; } }; diff --git a/js/background.js b/js/background.js index 4cfc6102..96209a2a 100644 --- a/js/background.js +++ b/js/background.js @@ -1164,8 +1164,20 @@ function launch_resourceblocker(query) { } // Get the frameData for the "Report an Ad" & "Resource" page +// If tabId is null, return all tabIDs +// If tabId is defined, return only the requested tab function get_frameData(tabId) { - return frameData.get(tabId); + if (!tabId) { + let tabs = {}; + for (let tabId in frameData) { + if (!isNaN(tabId)) { + tabs[tabId] = frameData[tabId]; + } + } + return tabs; + } else { + return frameData.get(tabId); + } } // Process requests from "Resource" page diff --git a/pages/resourceblock.css b/pages/resourceblock.css index c58065e7..d12bc1de 100644 --- a/pages/resourceblock.css +++ b/pages/resourceblock.css @@ -1,3 +1,17 @@ +td { + border: 1px solid #ccc; + min-width: 0.5em; + padding: 3px; + vertical-align: top; + word-break: break-all; + word-wrap: break-word; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} +th { + border: 1px solid #ccc; +} body { background-color: white; font-size: 12px; @@ -20,7 +34,7 @@ th { } #legend { min-width: 1195px; - margin: 118px auto 20px auto; + margin: 80px auto 15px auto; text-align: center; display: none; } @@ -28,9 +42,9 @@ th { padding: 11px 24px; } .resourceslist { - position: relative; margin: 0 auto 20px auto; - min-width: 1195px; + max-width: 1195px; + width: 100%; } .loader { display: block; @@ -49,19 +63,39 @@ th[data-column="url"] { cursor: pointer; } th[data-column="type"] { - width: 100px; cursor: pointer; } +td[data-column="type"] { + text-align: left; + width: 100px; +} th[data-column="filter"] { - width: 290px; cursor: pointer; } th[data-column="thirdparty"] { - width: 100px; cursor: pointer; } +td[data-column="thirdparty"] { + text-align: center; + width: 60px; +} + td[data-column="url"] { - padding-left: 25px; + /* padding-left: 25px; */ + /* overflow: hidden; */ + /* text-overflow: ellipsis; */ + /* overflow: hidden; */ + /* text-overflow: ellipsis; */ + /* white-space: nowrap; */ + /* word-wrap: normal; */ + /* word-break: normal; */ + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + max-width: 350px; +} +td[data-column="filter"] { + width: 200px; } .blocked { color: red; @@ -72,3 +106,17 @@ td[data-column="url"] { .hiding { color: blue; } +tbody { + width:100%; +} +#tabselect, #frameselect { + margin: 0 auto; + max-width: 1195px; +} +#frameselect { + margin-top: 10px; + margin-bottom: 20px; +} +#tab, #frame { + max-width: 400px; +} \ No newline at end of file diff --git a/pages/resourceblock.html b/pages/resourceblock.html index 96d3201b..19303882 100644 --- a/pages/resourceblock.html +++ b/pages/resourceblock.html @@ -32,6 +32,14 @@ , +
+ Select a tab: + +
+
+ Select a frame: + +
diff --git a/pages/resourceblock.js b/pages/resourceblock.js index 18d20e23..7ef57b94 100644 --- a/pages/resourceblock.js +++ b/pages/resourceblock.js @@ -27,6 +27,59 @@ function reqTypeForElement(elType) { } } +function prepopulateTabSelect() { + BGcall("get_frameData", null, function(fdTabs) { + chrome.tabs.query({}, function(tabs) { + for (let tab of tabs) { + for (let id in fdTabs) { + if (fdTabs[id][0].url === tab.url) { + $("#tab").append($("