Skip to content
This repository has been archived by the owner on Nov 6, 2023. It is now read-only.

Add Option UI to Enable MCB Rulesets Globally #15070

Merged
merged 2 commits into from
Apr 6, 2018
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
5 changes: 5 additions & 0 deletions chromium/background-scripts/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ chrome.storage.onChanged.addListener(async function(changes, areaName) {
isExtensionEnabled = changes.globalEnabled.newValue;
updateState();
}
if ('enableMixedRulesets' in changes) {
// Don't require users to restart the browsers
rules.settings.enableMixedRulesets = changes.enableMixedRulesets.newValue;
initializeAllRules();
}
if ('debugging_rulesets' in changes) {
initializeAllRules();
}
Expand Down
10 changes: 8 additions & 2 deletions chromium/pages/options/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,21 @@
</head>
<body>
<div class="section-header"><span class="section-header-span" data-i18n="options_generalSettings"></span></div>
<div id='counter-wrapper' class='general-settings-wrapper'>
<div id="counter-wrapper" class="general-settings-wrapper">
<input type="checkbox" id="showCounter">
<label for="showCounter" data-i18n="menu_showCounter"></label>
</div>
<div id='update-wrapper' class='general-settings-wrapper'>
<div id="update-wrapper" class="general-settings-wrapper">
<input type="checkbox" id="autoUpdateRulesets">
<label for="autoUpdateRulesets" data-i18n="options_autoUpdateRulesets"></label>
</div>

<div class="section-header"><span class="section-header-span" data-i18n="options_advancedSettings"></span></div>
<div id="mixed-rulesets-wrapper" class="general-settings-wrapper">
<input type="checkbox" id="enableMixedRulesets">
<label for="enableMixedRulesets" data-i18n="options_enableMixedRulesets"></label>
</div>

<div id="import-confirmed" data-i18n="options_imported"></div>

<form>
Expand Down
4 changes: 4 additions & 0 deletions chromium/pages/options/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
margin-bottom: 20px;
}

.general-settings-wrapper#mixed-rulesets-wrapper{
margin-bottom: 20px;
}

.section-header{
margin-bottom: 10px;
}
Expand Down
16 changes: 15 additions & 1 deletion chromium/pages/options/ux.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,30 @@ document.addEventListener("DOMContentLoaded", () => {

const showCounter = document.getElementById("showCounter");
const autoUpdateRulesets = document.getElementById("autoUpdateRulesets");
const enableMixedRulesets = document.getElementById("enableMixedRulesets");

sendMessage("get_option", { showCounter: true, autoUpdateRulesets: true }, item => {
const defaultOptions = {
showCounter: true,
autoUpdateRulesets: true,
enableMixedRulesets: false,
};

sendMessage("get_option", defaultOptions, item => {
showCounter.checked = item.showCounter;
autoUpdateRulesets.checked = item.autoUpdateRulesets;
enableMixedRulesets.checked = item.enableMixedRulesets;

showCounter.addEventListener("change", () => {
sendMessage("set_option", { showCounter: showCounter.checked });
});

autoUpdateRulesets.addEventListener("change", () => {
sendMessage("set_option", { autoUpdateRulesets: autoUpdateRulesets.checked });
});

enableMixedRulesets.addEventListener("change", () => {
sendMessage("set_option", { enableMixedRulesets: enableMixedRulesets.checked });
})
});

document.onkeydown = function(evt) {
Expand Down
2 changes: 2 additions & 0 deletions src/chrome/locale/en/https-everywhere.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
<!ENTITY https-everywhere.menu.viewAllRules "View All Rules">

<!ENTITY https-everywhere.options.generalSettings "General Settings">
<!ENTITY https-everywhere.options.advancedSettings "Advanced Settings">
<!ENTITY https-everywhere.options.importSettings "Import Settings">
<!ENTITY https-everywhere.options.import "Import">
<!ENTITY https-everywhere.options.enableMixedRulesets "Enable mixed content rulesets">
<!ENTITY https-everywhere.options.autoUpdateRulesets "Auto-update rulesets">
<!ENTITY https-everywhere.options.imported "Your settings have been imported.">

Expand Down