Skip to content
This repository was archived by the owner on Nov 15, 2017. It is now read-only.

Commit b323c45

Browse files
committed
internationalization and fix for #55
1 parent a40b1f3 commit b323c45

File tree

14 files changed

+808
-458
lines changed

14 files changed

+808
-458
lines changed

_locales/en/messages.json

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,12 @@
8484

8585

8686
"matrixRemoveScope" : {
87-
"message": "Remove all rules specific to {{what}}",
88-
"description": "hovering over the button to remove page scope"
87+
"message": "Remove all rules specific to <b>$1</b>",
88+
"description": "hovering over the button to remove page scope (identified by $1)"
8989
},
9090
"matrixCreateScope" : {
91-
"message": "Create rules specific to web pages which URL starts exactly with {{what}}",
92-
"description": "hovering over the button to add page scope"
91+
"message": "Create rules specific to web pages which URL starts exactly with <b>$1</b>",
92+
"description": "hovering over the button to add page scope (identified by $1)"
9393
},
9494
"matrixRevert" : {
9595
"message": "Clear all temporary rules &mdash; those which are not padlocked",
@@ -149,7 +149,7 @@
149149
"description": "when user hover over green unlocked padlock"
150150
},
151151
"matrixUnpersistBlock" : {
152-
"message": "'Cancel the permanent <span class=\"rdt\">blacklist</span> status of this cell'",
152+
"message": "Cancel the permanent <span class=\"rdt\">blacklist</span> status of this cell",
153153
"description": "when user hover over red locked padlock"
154154
},
155155
"matrixUnpersistAllow" : {
@@ -158,6 +158,44 @@
158158
},
159159

160160

161+
"statsPageTitle" : {
162+
"message": "HTTP Switchboard &ndash; Statistics",
163+
"description": "header for the whole stats page"
164+
},
165+
"statsPageWhitelistsBlacklists" : {
166+
"message": "Whitelists/blacklists",
167+
"description": "header for 'whitelists/blacklists' section"
168+
},
169+
"statsPageGeekyStats" : {
170+
"message": "Geeky stats",
171+
"description": "header for 'geeky stats' section"
172+
},
173+
"statsPageOverview" : {
174+
"message": "Overview",
175+
"description": "header for 'overview' section"
176+
},
177+
"statsPageRequests" : {
178+
"message": "Requests",
179+
"description": "in geeky stats section, header for the type of request"
180+
},
181+
"statsPageAllowed" : {
182+
"message": "Allowed",
183+
"description": "capitalized"
184+
},
185+
"statsPageBlocked" : {
186+
"message": "Blocked",
187+
"description": "capitalized"
188+
},
189+
"statsPageDetailed" : {
190+
"message": "Detailed",
191+
"description": "header for 'detailed' section"
192+
},
193+
"statsPageRefresh" : {
194+
"message": "Refresh",
195+
"description": "text for refresh button"
196+
},
197+
198+
161199
"dummy": {
162200
"message": "This entry must be the last one",
163201
"description": "so we dont need to deal with comma for last entry"

assets/httpsb-blacklist.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ bounceexchange.com
1818

1919
crosspixel.net # (cookies, localStorage) "leading provider of high performance audience data and information for the real-time advertising industry"
2020
crsspxl.com # Related to crosspixel.net
21+
displaymarketplace.com
2122
erovinmo.com # No info whatsoever from site itself can be found = naughty corner. Ironically spotted at "http://www.technologyreview.com/news/519336/bruce-schneier-nsa-spying-is-making-us-less-safe/" (also: http://www.mywot.com/en/scorecard/erovinmo.com)
2223
exelator.com # "domain used by eXelate Media which is an advertising company that is part of a network of sites, cookies, and other technologies used to track you" (Ref.: http://www.donottrackplus.com/trackers/exelator.com.php)
2324
eyereturn.com # "eyeReturn Marketing is the only end-to-end digital advertising platform in the market"

img/domain-collapse.png

202 Bytes
Loading

img/domain-expand.png

218 Bytes
Loading

info.html

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
</head>
6161

6262
<body>
63-
<h1>HTTP Switchboard &mdash; Info</h1>
63+
<h1 data-i18n="statsPageTitle"></h1>
6464
<div>
6565
<ul>
6666
<li>Version: <span id="version"></span> (<a href="https://github.com/gorhill/httpswitchboard/wiki/Change-log">change log</a>)
@@ -73,7 +73,7 @@ <h1>HTTP Switchboard &mdash; Info</h1>
7373

7474

7575

76-
<h2>Whitelists/blacklists</h2>
76+
<h2 data-i18n="statsPageWhitelistsBlacklists"></h2>
7777
<div id="lists">
7878
<div style="white-space:nowrap;"> <!-- begin template 'stats' -->
7979
<div>
@@ -94,19 +94,19 @@ <h2>Whitelists/blacklists</h2>
9494
</div>
9595

9696

97-
<h2>Geeky stats</h2>
98-
<!-- start of geek stats --><div>For
97+
<h2 data-i18n="statsPageGeekyStats"></h2>
98+
<div>For
9999
<select id="selectPageUrls">
100100
<option value="All">All</option>
101101
<option id="selectPageUrlTemplate" value="http://chromium.behind.the.scene">Chromium: Behind the scene</option>
102102
</select>
103103

104-
<h3>Overview</h3>
104+
<h3 data-i18n="statsPageOverview"></h3>
105105
<div id="stats">
106-
<div style="white-space:nowrap;"> <!-- begin template 'stats' -->
106+
<div style="white-space:nowrap;">
107107

108108
<div>
109-
Requests<br>
109+
<span data-i18n="statsPageRequests"></span><br>
110110
All:<br>
111111
Pages:<br>
112112
<a href="http://en.wikipedia.org/wiki/Http_cookie">Cookies</a>:<br>
@@ -118,7 +118,7 @@ <h3>Overview</h3>
118118
<a title="i.e. HTML5 audio, HTML5 video, HTML5 canvas, fonts, etc." href="https://github.com/gorhill/httpswitchboard/wiki/FAQ#in-the-top-left-of-the-matrix-what-is-other">Others</a>:<br>
119119
</div>
120120
<div style="color:#c00">
121-
Blocked<br>
121+
<span data-i18n="statsPageBlocked"></span><br>
122122
<span id="blockedAllCount"></span><br>
123123
<span id="blockedMainFrameCount"></span><br>
124124
<span id="blockedCookieCount"></span><br>
@@ -130,7 +130,7 @@ <h3>Overview</h3>
130130
<span id="blockedOtherCount"></span><br>
131131
</div>
132132
<div style="color:#070">
133-
Allowed<br>
133+
<span data-i18n="statsPageAllowed"></span><br>
134134
<span id="allowedAllCount"></span><br>
135135
<span id="allowedMainFrameCount"></span><br>
136136
<span id="allowedCookieCount"></span><br>
@@ -142,17 +142,17 @@ <h3>Overview</h3>
142142
<span id="allowedOtherCount"></span><br>
143143
</div>
144144

145-
</div> <!-- end template 'stats' -->
145+
</div>
146146
</div>
147147

148148

149-
<h3>Detailed</h3>
149+
<h3 data-i18n="statsPageDetailed"></h3>
150150
<div id="requests">
151-
<p><button id="refresh-requests">Refresh</button></p>
151+
<p><button id="refresh-requests" data-i18n="statsPageRefresh"></button></p>
152152
<p>
153153
Show: <input id="show-main_frame" type="checkbox" checked value="1">Pages&emsp;
154-
<input id="show-blocked" type="checkbox" checked value="1"><span style="color:#c00">Blocked</span>&emsp;
155-
<input id="show-allowed" type="checkbox" checked value="1"><span style="color:#070">Allowed</span>&emsp;
154+
<input id="show-blocked" type="checkbox" checked value="1"><span style="color:#c00" data-i18n="statsPageBlocked">Blocked</span>&emsp;
155+
<input id="show-allowed" type="checkbox" checked value="1"><span style="color:#070" data-i18n="statsPageAllowed">Allowed</span>&emsp;
156156
<input id="show-cookie" type="checkbox" checked value="1">Cookies&emsp;
157157
<input id="show-image" type="checkbox" checked value="1">Images&emsp;
158158
<input id="show-object" type="checkbox" checked value="1">Objects&emsp;
@@ -171,6 +171,7 @@ <h3>Detailed</h3>
171171
</div> <!-- end of geek stats -->
172172

173173
<script src="lib/jquery-2.min.js"></script>
174+
<script src="js/i18n.js"></script>
174175
<script src="js/info.js"></script>
175176
</body>
176177
</html>

js/background.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ var HTTPSB = {
2929
deleteLocalStorage: false,
3030
processBehindTheSceneRequests: false,
3131
strictBlocking: false,
32+
displayTextSize: '13px',
3233
popupHideBlacklisted: false,
33-
displayTextSize: '13px'
34+
popupCollapseDomains: false
3435
},
3536

3637
runtimeId: 1,

js/cookies.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,11 @@ var cookieHunter = {
199199
pageStats.recordRequest('cookie', rootUrl + '/{cookie:' + encodeURIComponent(cookie.name.toLowerCase()) + '}', block);
200200
httpsb.requestStats.record('cookie', block);
201201
}
202-
if ( block && deleteCookies ) {
202+
// rhill 2013-11-21:
203+
// https://github.com/gorhill/httpswitchboard/issues/65
204+
// Leave alone cookies from behind-the-scene requests if
205+
// behind-the-scene processing is disabled.
206+
if ( block && deleteCookies && (pageUrl !== httpsb.behindTheSceneURL || httpsb.userSettings.processBehindTheSceneRequests) ) {
203207
this.remove({
204208
url: rootUrl + cookie.path,
205209
domain: cookie.domain,
@@ -245,7 +249,10 @@ asyncJobQueue.add('cookieHunterRemove', null, cookieHunterRemoveCallback, 5 * 60
245249
function cookieHunterCleanCallback() {
246250
cookieHunter.processClean();
247251
}
248-
asyncJobQueue.add('cookieHunterClean', null, cookieHunterCleanCallback, 15 * 60 * 1000, true);
252+
// rhill 2013-11-21:
253+
// https://github.com/gorhill/httpswitchboard/issues/65
254+
// TODO: Remove the unused code.
255+
// asyncJobQueue.add('cookieHunterClean', null, cookieHunterCleanCallback, 15 * 60 * 1000, true);
249256

250257
/******************************************************************************/
251258

js/i18n.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*******************************************************************************
2+
3+
httpswitchboard - a Chromium browser extension to black/white list requests.
4+
Copyright (C) 2013 Raymond Hill
5+
6+
This program is free software: you can redistribute it and/or modify
7+
it under the terms of the GNU General Public License as published by
8+
the Free Software Foundation, either version 3 of the License, or
9+
(at your option) any later version.
10+
11+
This program is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
GNU General Public License for more details.
15+
16+
You should have received a copy of the GNU General Public License
17+
along with this program. If not, see {http://www.gnu.org/licenses/}.
18+
19+
Home: https://github.com/gorhill/httpswitchboard
20+
*/
21+
22+
// Helper to deal with the i18n'ing of HTML files.
23+
// jQuery must be present at this point.
24+
25+
$(function() {
26+
$('[data-i18n]').each(function() {
27+
var me = $(this);
28+
var key = me.data('i18n');
29+
me.html(chrome.i18n.getMessage(key));
30+
});
31+
// copy text of <h1> if any to document title
32+
document.title = $('h1').first().text();
33+
});

0 commit comments

Comments
 (0)