Skip to content

Commit 0c07e2e

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents bcc4df2 + f18f49d commit 0c07e2e

25 files changed

+311
-145
lines changed

VERSIONS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Version 1.6.8 (09 Jan 2024)
2+
* Added option for custom style (CSS) for blocking/delaying page.
3+
* Bug fixes.
4+
15
# Version 1.6.7 (22 Dec 2024)
26
* Added support for keyboard shortcuts.
37
* Bug fixes and under-the-hood improvements.

background.js

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -855,14 +855,19 @@ function clockPageTime(id, open, focus) {
855855

856856
// Update time data if necessary
857857
if (secsOpen > 0 || secsFocus > 0) {
858-
updateTimeData(gTabs[id].url, gTabs[id].referrer, gTabs[id].audible, secsOpen, secsFocus);
858+
updateTimeData(id, secsOpen, secsFocus);
859859
}
860860
}
861861

862862
// Update time data for specified page
863863
//
864-
function updateTimeData(url, referrer, audible, secsOpen, secsFocus) {
865-
//log("updateTimeData: " + url + " " + secsOpen + " " + secsFocus);
864+
function updateTimeData(id, secsOpen, secsFocus) {
865+
//log("updateTimeData: " + id + " " + secsOpen + " " + secsFocus);
866+
867+
let referrer = gTabs[id].referrer;
868+
let url = gTabs[id].url;
869+
let incog = gTabs[id].incog;
870+
let audible = gTabs[id].audible;
866871

867872
// Get parsed URL for this page
868873
let parsedURL = getParsedURL(url);
@@ -881,6 +886,10 @@ function updateTimeData(url, referrer, audible, secsOpen, secsFocus) {
881886
let referRE = gRegExps[set].refer;
882887
if (!blockRE && !referRE) continue; // no block for this set
883888

889+
// Check incognito mode
890+
let incogMode = gOptions[`incogMode${set}`];
891+
if ((incogMode == 1 && incog) || (incogMode == 2 && !incog)) continue;
892+
884893
// Get option for counting time only when tab is playing audio
885894
let countAudio = gOptions[`countAudio${set}`];
886895
if (countAudio && !audible) continue; // no audio playing
@@ -1041,13 +1050,16 @@ function createBlockInfo(id, url) {
10411050
// Get theme
10421051
let theme = gOptions["theme"];
10431052

1053+
// Get custom style
1054+
let customStyle = gOptions["customStyle"];
1055+
10441056
// Get parsed URL
10451057
let parsedURL = getParsedURL(url);
10461058
let pageURL = parsedURL.page;
10471059

10481060
if (parsedURL.args == null || parsedURL.args.length < 2) {
10491061
warn("Cannot create block info: not enough arguments in URL.");
1050-
return { theme: theme };
1062+
return { theme: theme, customStyle: customStyle };
10511063
}
10521064

10531065
// Get block set and URL (including hash part) of blocked page
@@ -1099,6 +1111,7 @@ function createBlockInfo(id, url) {
10991111

11001112
return {
11011113
theme: theme,
1114+
customStyle: customStyle,
11021115
blockedSet: blockedSet,
11031116
blockedSetName: blockedSetName,
11041117
blockedURL: blockedURL,
@@ -1724,6 +1737,9 @@ function handleTabUpdated(tabId, changeInfo, tab) {
17241737

17251738
let focus = tab.active && (gAllFocused || !gFocusWindowId || tab.windowId == gFocusWindowId);
17261739

1740+
gTabs[tab.id].incog = tab.incognito;
1741+
gTabs[tab.id].audible = tab.audible;
1742+
17271743
if (changeInfo.url) {
17281744
gTabs[tabId].url = getCleanURL(changeInfo.url);
17291745
}
@@ -1850,7 +1866,9 @@ if (browser.contextMenus) {
18501866
browser.contextMenus.onClicked.addListener(handleMenuClick);
18511867
}
18521868

1853-
browser.commands.onCommand.addListener(handleCommand);
1869+
if (browser.commands) {
1870+
browser.commands.onCommand.addListener(handleCommand);
1871+
}
18541872

18551873
browser.runtime.onMessage.addListener(handleMessage);
18561874

blocked.html

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,36 +12,37 @@
1212
<link rel="stylesheet" href="/fonts.css" type="text/css">
1313
<link rel="stylesheet" href="/style.css" type="text/css">
1414
<link id="themeLink" rel="stylesheet">
15+
<style id="customStyle"></style>
1516
</head>
1617

1718
<body>
1819

1920
<!-- logo -->
20-
<div>
21-
<img src="/images/leechblock_logo.svg" class="logo" alt="LeechBlock logo" title="LeechBlock">
21+
<div id="lbLogoDiv">
22+
<a href="https://www.proginosko.com/leechblock/"><img id="lbLogoImg" src="/images/leechblock_logo.svg" class="logo" alt="LeechBlock logo" title="LeechBlock"></a>
2223
</div>
2324

2425
<!-- warning message -->
25-
<div>
26+
<div id="lbWarningMsgDiv">
2627
<h1>The page you're trying to access has been blocked by <a href="https://www.proginosko.com/leechblock/">LeechBlock</a>.</h1>
2728
</div>
2829

2930
<!-- blocked site info -->
30-
<div>
31+
<div id="lbBlockedDiv">
3132
<a id="lbBlockedURLLink" target="_self"><span id="lbBlockedURL"></span></a>
3233
(<span id="lbBlockedSet">Block Set</span>)
33-
<p id="lbKeywordMatched">Keyword matched: <strong><span id="lbKeywordMatch"></span></strong></p>
34-
<p>The page will be unblocked at: <strong><span id="lbUnblockTime">the end of time</span></strong></p>
34+
<p id="lbKeywordMatched">Keyword matched: <span id="lbKeywordMatch" class="keyword"></span></p>
35+
<p id="lbUnblockText">The page will be unblocked at: <span id="lbUnblockTime" class="time">the end of time</span></p>
3536
</div>
3637

3738
<!-- custom message (optional) -->
3839
<div id="lbCustomMsgDiv">
3940
<p>A message from yourself:</p>
40-
<strong><blockquote id="lbCustomMsg"></blockquote></strong>
41+
<blockquote id="lbCustomMsg"></blockquote>
4142
</div>
4243

4344
<!-- support info -->
44-
<div class="support">
45+
<div id="lbSupportDiv" class="support">
4546
LeechBlock will always be free to use, but if it has improved your life,<br>
4647
please consider supporting its continued development by<br>
4748
<a href="https://www.paypal.me/JamesNAnderson">making a contribution</a> or

blocked.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,15 @@ function processBlockInfo(info) {
1414
gBlockedURL = info.blockedURL;
1515

1616
// Set theme
17-
let link = document.getElementById("themeLink");
18-
if (link) {
19-
link.href = "/themes/" + (info.theme ? `${info.theme}.css` : "default.css");
17+
let themeLink = document.getElementById("themeLink");
18+
if (themeLink) {
19+
themeLink.href = "/themes/" + (info.theme ? `${info.theme}.css` : "default.css");
20+
}
21+
22+
// Set custom style
23+
let customStyle = document.getElementById("customStyle");
24+
if (customStyle) {
25+
customStyle.innerText = info.customStyle;
2026
}
2127

2228
let blockedURL = document.getElementById("lbBlockedURL");

common.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ const GENERAL_OPTIONS = {
7979
numSets: { type: "string", def: "6", id: "numSets" }, // default: 6 block sets
8080
sync: { type: "boolean", def: false, id: "syncStorage" }, // default: use local storage
8181
theme: { type: "string", def: "", id: "theme" }, // default: light theme
82+
customStyle: { type: "string", def: "", id: "customStyle" }, // default: no custom style
8283
oa: { type: "string", def: "0", id: "optionsAccess" }, // default: no password or code
8384
password: { type: "string", def: "", id: "accessPassword" }, // default: blank
8485
hpp: { type: "boolean", def: true, id: "hidePassword" }, // default: hidden

de/blocked.html

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,37 @@
1212
<link rel="stylesheet" href="/fonts.css" type="text/css">
1313
<link rel="stylesheet" href="/style.css" type="text/css">
1414
<link id="themeLink" rel="stylesheet">
15+
<style id="customStyle"></style>
1516
</head>
1617

1718
<body>
1819

1920
<!-- logo -->
20-
<div>
21-
<img src="/images/leechblock_logo.svg" class="logo" alt="LeechBlock logo" title="LeechBlock">
21+
<div id="lbLogoDiv">
22+
<a href="https://www.proginosko.com/leechblock/"><img id="lbLogoImg" src="/images/leechblock_logo.svg" class="logo" alt="LeechBlock logo" title="LeechBlock"></a>
2223
</div>
2324

2425
<!-- warning message -->
25-
<div>
26+
<div id="lbWarningMsgDiv">
2627
<h1>Die Seite, die du aufrufen willst, wurde von <a href="https://www.proginosko.com/leechblock/">LeechBlock</a> gesperrt.</h1>
2728
</div>
2829

2930
<!-- blocked site info -->
30-
<div>
31+
<div id="lbBlockedDiv">
3132
<a id="lbBlockedURLLink" target="_self"><span id="lbBlockedURL"></span></a>
3233
(<span id="lbBlockedSet">Blocksatz</span>)
33-
<p id="lbKeywordMatched">Schlüsselwort gefunden: <strong><span id="lbKeywordMatch"></span></strong></p>
34-
<p>Die Seite wird entsperrt ab: <strong><span id="lbUnblockTime">das Ende der Zeit</span></strong></p>
34+
<p id="lbKeywordMatched">Schlüsselwort gefunden: <span id="lbKeywordMatch" class="keyword"></span></p>
35+
<p id="lbUnblockText">Die Seite wird entsperrt ab: <span id="lbUnblockTime" class="time">das Ende der Zeit</span></p>
36+
</div>
37+
38+
<!-- custom message (optional) -->
39+
<div id="lbCustomMsgDiv">
40+
<p>Eine Nachricht von dir selbst:</p>
41+
<blockquote id="lbCustomMsg"></blockquote>
3542
</div>
3643

3744
<!-- support info -->
38-
<div class="support">
45+
<div id="lbSupportDiv" class="support">
3946
Die Nutzung von LeechBlock wird immer kostenlos sein, aber wenn es dein Leben verbessert<br>
4047
hat, solltest du in Erwägung ziehen, die Weiterentwicklung zu unterstützen indem du einen<br>
4148
<a href="https://www.paypal.me/JamesNAnderson">Spendenbeitrag leistest</a> oder

de/delayed.html

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,37 @@
1212
<link rel="stylesheet" href="/fonts.css" type="text/css">
1313
<link rel="stylesheet" href="/style.css" type="text/css">
1414
<link id="themeLink" rel="stylesheet">
15+
<style id="customStyle"></style>
1516
</head>
1617

1718
<body>
1819

1920
<!-- logo -->
20-
<div>
21-
<img src="/images/leechblock_logo.svg" class="logo" alt="LeechBlock logo" title="LeechBlock">
21+
<div id="lbLogoDiv">
22+
<a href="https://www.proginosko.com/leechblock/"><img id="lbLogoImg" src="/images/leechblock_logo.svg" class="logo" alt="LeechBlock logo" title="LeechBlock"></a>
2223
</div>
2324

2425
<!-- warning message -->
25-
<div>
26+
<div id="lbWarningMsgDiv">
2627
<h1>Die Seite, die du aufrufen willst, wurde vorübergehend von <a href="https://www.proginosko.com/leechblock/">LeechBlock</a> gesperrt.</h1>
2728
</div>
2829

2930
<!-- blocked site info -->
30-
<div>
31+
<div id="lbBlockedDiv">
3132
<a id="lbBlockedURLLink" target="_self"><span id="lbBlockedURL"></span></a>
3233
(<span id="lbBlockedSet">Blocksatz</span>)
33-
<p id="lbKeywordMatched">Schlüsselwort gefunden: <strong><span id="lbKeywordMatch"></span></strong></p>
34-
<p id="lbCountdownText">Die Seite wird in <strong><span id="lbDelaySeconds">0</span></strong> Sekunde(n) freigeschaltet.</p>
34+
<p id="lbKeywordMatched">Schlüsselwort gefunden: <span id="lbKeywordMatch" class="keyword"></span></p>
35+
<p id="lbCountdownText">Die Seite wird in <span id="lbDelaySeconds" class="delay">0</span> Sekunde(n) freigeschaltet.</p>
36+
</div>
37+
38+
<!-- custom message (optional) -->
39+
<div id="lbCustomMsgDiv">
40+
<p>Eine Nachricht von dir selbst:</p>
41+
<blockquote id="lbCustomMsg"></blockquote>
3542
</div>
3643

3744
<!-- support info -->
38-
<div class="support">
45+
<div id="lbSupportDiv" class="support">
3946
Die Nutzung von LeechBlock wird immer kostenlos sein, aber wenn es dein Leben verbessert<br>
4047
hat, solltest du in Erwägung ziehen, die Weiterentwicklung zu unterstützen indem du einen<br>
4148
<a href="https://www.paypal.me/JamesNAnderson">Spendenbeitrag leistest</a> oder

delayed.html

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,36 +12,37 @@
1212
<link rel="stylesheet" href="/fonts.css" type="text/css">
1313
<link rel="stylesheet" href="/style.css" type="text/css">
1414
<link id="themeLink" rel="stylesheet">
15+
<style id="customStyle"></style>
1516
</head>
1617

1718
<body>
1819

1920
<!-- logo -->
20-
<div>
21-
<img src="/images/leechblock_logo.svg" class="logo" alt="LeechBlock logo" title="LeechBlock">
21+
<div id="lbLogoDiv">
22+
<a href="https://www.proginosko.com/leechblock/"><img id="lbLogoImg" src="/images/leechblock_logo.svg" class="logo" alt="LeechBlock logo" title="LeechBlock"></a>
2223
</div>
2324

2425
<!-- warning message -->
25-
<div>
26+
<div id="lbWarningMsgDiv">
2627
<h1>The page you're trying to access has been temporarily blocked by <a href="https://www.proginosko.com/leechblock/">LeechBlock</a>.</h1>
2728
</div>
2829

2930
<!-- blocked site info -->
30-
<div>
31+
<div id="lbBlockedDiv">
3132
<a id="lbBlockedURLLink" target="_self"><span id="lbBlockedURL"></span></a>
3233
(<span id="lbBlockedSet">Block Set</span>)
33-
<p id="lbKeywordMatched">Keyword matched: <strong><span id="lbKeywordMatch"></span></strong></p>
34-
<p id="lbCountdownText">The page will be unblocked in <strong><span id="lbDelaySeconds">0</span></strong> second(s).</p>
34+
<p id="lbKeywordMatched">Keyword matched: <span id="lbKeywordMatch" class="keyword"></span></p>
35+
<p id="lbCountdownText">The page will be unblocked in <span id="lbDelaySeconds" class="delay">0</span> second(s).</p>
3536
</div>
3637

3738
<!-- custom message (optional) -->
3839
<div id="lbCustomMsgDiv">
3940
<p>A message from yourself:</p>
40-
<strong><blockquote id="lbCustomMsg"></blockquote></strong>
41+
<blockquote id="lbCustomMsg"></blockquote>
4142
</div>
4243

4344
<!-- support info -->
44-
<div class="support">
45+
<div id="lbSupportDiv" class="support">
4546
LeechBlock will always be free to use, but if it has improved your life,<br>
4647
please consider supporting its continued development by<br>
4748
<a href="https://www.paypal.me/JamesNAnderson">making a contribution</a> or

es/blocked.html

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,37 @@
1212
<link rel="stylesheet" href="/fonts.css" type="text/css">
1313
<link rel="stylesheet" href="/style.css" type="text/css">
1414
<link id="themeLink" rel="stylesheet">
15+
<style id="customStyle"></style>
1516
</head>
1617

1718
<body>
1819

1920
<!-- logo -->
20-
<div>
21-
<img src="/images/leechblock_logo.svg" class="logo" alt="LeechBlock logo" title="LeechBlock">
21+
<div id="lbLogoDiv">
22+
<a href="https://www.proginosko.com/leechblock/"><img id="lbLogoImg" src="/images/leechblock_logo.svg" class="logo" alt="LeechBlock logo" title="LeechBlock"></a>
2223
</div>
2324

2425
<!-- warning message -->
25-
<div>
26+
<div id="lbWarningMsgDiv">
2627
<h1>La página a la que intenta acceder ha sido bloqueada por <a href="https://www.proginosko.com/leechblock/">LeechBlock</a>.</h1>
2728
</div>
2829

2930
<!-- blocked site info -->
30-
<div>
31+
<div id="lbBlockedDiv">
3132
<a id="lbBlockedURLLink" target="_self"><span id="lbBlockedURL"></span></a>
3233
(<span id="lbBlockedSet">Set de Bloqueo</span>)
33-
<p id="lbKeywordMatched">Palabra clave que coincidió: <strong><span id="lbKeywordMatch"></span></strong></p>
34-
<p>La página se desbloqueará en: <strong><span id="lbUnblockTime">el fin de los tiempos</span></strong></p>
34+
<p id="lbKeywordMatched">Palabra clave que coincidió: <span id="lbKeywordMatch" class="keyword"></span></p>
35+
<p id="lbUnblockText">La página se desbloqueará en: <span id="lbUnblockTime" class="time">el fin de los tiempos</span></p>
36+
</div>
37+
38+
<!-- custom message (optional) -->
39+
<div id="lbCustomMsgDiv">
40+
<p>Un mensaje tuyo:</p>
41+
<blockquote id="lbCustomMsg"></blockquote>
3542
</div>
3643

3744
<!-- support info -->
38-
<div class="support">
45+
<div id="lbSupportDiv" class="support">
3946
LeechBlock siempre será de uso gratuito, pero si ha mejorado su vida,<br>
4047
por favor considere apoyar su desarrollo continuo<br>
4148
<a href="https://www.paypal.me/JamesNAnderson">haciendo una contribución</a> o

es/delayed.html

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,37 @@
1212
<link rel="stylesheet" href="/fonts.css" type="text/css">
1313
<link rel="stylesheet" href="/style.css" type="text/css">
1414
<link id="themeLink" rel="stylesheet">
15+
<style id="customStyle"></style>
1516
</head>
1617

1718
<body>
1819

1920
<!-- logo -->
20-
<div>
21-
<img src="/images/leechblock_logo.svg" class="logo" alt="LeechBlock logo" title="LeechBlock">
21+
<div id="lbLogoDiv">
22+
<a href="https://www.proginosko.com/leechblock/"><img id="lbLogoImg" src="/images/leechblock_logo.svg" class="logo" alt="LeechBlock logo" title="LeechBlock"></a>
2223
</div>
2324

2425
<!-- warning message -->
25-
<div>
26+
<div id="lbWarningMsgDiv">
2627
<h1>La página a la que intenta acceder ha sido bloqueada temporalmente por <a href="https://www.proginosko.com/leechblock/">LeechBlock</a>.</h1>
2728
</div>
2829

2930
<!-- blocked site info -->
30-
<div>
31+
<div id="lbBlockedDiv">
3132
<a id="lbBlockedURLLink" target="_self"><span id="lbBlockedURL"></span></a>
3233
(<span id="lbBlockedSet">Set de Bloqueo</span>)
33-
<p id="lbKeywordMatched">Palabra clave que coincidió: <strong><span id="lbKeywordMatch"></span></strong></p>
34-
<p id="lbCountdownText">La página se desbloqueará en <strong><span id="lbDelaySeconds">0</span></strong> segundo(s).</p>
34+
<p id="lbKeywordMatched">Palabra clave que coincidió: <span id="lbKeywordMatch" class="keyword"></span></p>
35+
<p id="lbCountdownText">La página se desbloqueará en <span id="lbDelaySeconds" class="delay">0</span> segundo(s).</p>
36+
</div>
37+
38+
<!-- custom message (optional) -->
39+
<div id="lbCustomMsgDiv">
40+
<p>Un mensaje tuyo:</p>
41+
<blockquote id="lbCustomMsg"></blockquote>
3542
</div>
3643

3744
<!-- support info -->
38-
<div class="support">
45+
<div id="lbSupportDiv" class="support">
3946
LeechBlock siempre será de uso gratuito, pero si ha mejorado su vida,<br>
4047
por favor considere apoyar su desarrollo continuo<br>
4148
<a href="https://www.paypal.me/JamesNAnderson">haciendo una contribución</a> o

0 commit comments

Comments
 (0)