Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions patches/pref-pane/librewolf.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,18 @@
.neonwolf-pwmgr-list > .neonwolf-pwmgr-link {
margin-block: 4px;
}
.neonwolf-settings-heading {
font-weight: 600;
margin-block: 12px 4px;
}
.neonwolf-settings-heading:first-child {
margin-top: 0;
}
.neonwolf-settings-row {
margin-top: 6px;
gap: 10px;
}
.neonwolf-settings-dim {
opacity: 0.7;
font-size: 0.9em;
}
23 changes: 23 additions & 0 deletions patches/pref-pane/librewolf.inc.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,29 @@
<html:setting-group groupid="librewolfPrivacy" style="padding-top: 25px;" data-category="paneLibrewolf" hidden="true"/>
<html:setting-group groupid="librewolfFingerprinting" style="padding-top: 25px;" data-category="paneLibrewolf" hidden="true"/>

<hbox class="subcategory" hidden="true" data-category="paneLibrewolf" style="margin-top: 25px">
<html:h1>Shields &amp; updates</html:h1>
</hbox>

<groupbox data-category="paneLibrewolf" hidden="true">
<label class="neonwolf-settings-heading">Ad &amp; tracker blocking</label>
<checkbox id="neonwolf-pref-ads"
label="Block ads and trackers with the native uBlock Origin engine"/>

<label class="neonwolf-settings-heading">Filter lists</label>
<checkbox id="neonwolf-pref-autorefresh"
label="Automatically refresh filter lists in the background"/>
<hbox align="center" class="neonwolf-settings-row">
<button id="neonwolf-pref-refresh-now" label="Refresh lists now"/>
<label id="neonwolf-pref-lastrefresh" class="neonwolf-settings-dim"/>
</hbox>

<label class="neonwolf-settings-heading">Updates</label>
<checkbox id="neonwolf-pref-updatecheck"
label="Check for new Neonwolf versions"/>
<description class="neonwolf-settings-dim">Neonwolf only notifies you of new versions and links to the download; it never updates itself automatically.</description>
</groupbox>

<hbox class="subcategory" hidden="true" data-category="paneLibrewolf" style="margin-top: 25px">
<html:h1 data-l10n-id="neonwolf-pwmgr-header"/>
</hbox>
Expand Down
93 changes: 93 additions & 0 deletions patches/pref-pane/librewolf.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,100 @@ var gLibrewolfPane = {
// Set event listener on open about:config button
setEventListener("librewolf-config-link", "click", openAboutConfig);

this._initNeonwolfSettings();

// Notify observers that the UI is now ready
Services.obs.notifyObservers(window, "librewolf-pane-loaded");
},

// Neonwolf-specific controls (Shields ad-block engine, list refresh, update
// check). Wired directly to the real enforcement prefs rather than through
// setting-groups, since the "ads" toggle flips several prefs at once (mirrors
// the Shields panel's _categoryPrefs) and the refresh button is a one-shot.
_initNeonwolfSettings() {
let bindCheckbox = (id, get, set) => {
let el = document.getElementById(id);
if (!el) {
return;
}
el.checked = get();
el.addEventListener("command", () => set(el.checked));
};

bindCheckbox(
"neonwolf-pref-ads",
() =>
Services.prefs.getBoolPref(
"privacy.trackingprotection.ubo.network.enabled",
true
),
value => {
Services.prefs.setBoolPref(
"privacy.trackingprotection.ubo.network.enabled",
value
);
Services.prefs.setBoolPref(
"privacy.trackingprotection.ubo.cosmetic.enabled",
value
);
Services.prefs.setBoolPref(
"privacy.trackingprotection.content.protection.enabled",
value
);
}
);

bindCheckbox(
"neonwolf-pref-autorefresh",
() =>
Services.prefs.getBoolPref("neonwolf.shields.lists.autoRefresh", true),
value =>
Services.prefs.setBoolPref("neonwolf.shields.lists.autoRefresh", value)
);

bindCheckbox(
"neonwolf-pref-updatecheck",
() => Services.prefs.getBoolPref("neonwolf.update.checkEnabled", true),
value =>
Services.prefs.setBoolPref("neonwolf.update.checkEnabled", value)
);

let refreshBtn = document.getElementById("neonwolf-pref-refresh-now");
if (refreshBtn) {
refreshBtn.addEventListener("command", () =>
Services.prefs.setBoolPref("neonwolf.shields.lists.refreshNow", true)
);
}

this._updateNeonwolfLastRefresh();
this._neonwolfRefreshObserver = () => this._updateNeonwolfLastRefresh();
Services.prefs.addObserver(
"neonwolf.shields.lists.lastRefresh",
this._neonwolfRefreshObserver
);
window.addEventListener(
"unload",
() =>
Services.prefs.removeObserver(
"neonwolf.shields.lists.lastRefresh",
this._neonwolfRefreshObserver
),
{ once: true }
);
},

_updateNeonwolfLastRefresh() {
let el = document.getElementById("neonwolf-pref-lastrefresh");
if (!el) {
return;
}
// lastRefresh is epoch SECONDS (getIntPref is 32-bit; ms would overflow).
let seconds = Services.prefs.getIntPref(
"neonwolf.shields.lists.lastRefresh",
0
);
el.value = seconds
? "Last refreshed: " + new Date(seconds * 1000).toLocaleString()
: "Using bundled lists";
},
};
Loading