Browse Source
Revive formerly removed <noscript> tag spoofing code
Revive formerly removed <noscript> tag spoofing code
Also: - a new per-scope switch has been added to control <noscript> spoofing on a per site basis - a global setting to be used as the default state of the <noscript> spoofing switch - Privacy pane has been merged into Setting panepull/2/head
gorhill
7 years ago
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
11 changed files with 196 additions and 336 deletions
-
8src/_locales/en/messages.json
-
3src/css/common.css
-
1src/dashboard.html
-
25src/js/contentscript.js
-
3src/js/matrix.js
-
105src/js/messaging.js
-
142src/js/privacy.js
-
94src/js/settings.js
-
1src/popup.html
-
88src/privacy.html
-
62src/settings.html
@ -1,142 +0,0 @@ |
|||
/******************************************************************************* |
|||
|
|||
uMatrix - a Chromium browser extension to black/white list requests. |
|||
Copyright (C) 2014-2017 Raymond Hill |
|||
|
|||
This program is free software: you can redistribute it and/or modify |
|||
it under the terms of the GNU General Public License as published by |
|||
the Free Software Foundation, either version 3 of the License, or |
|||
(at your option) any later version. |
|||
|
|||
This program is distributed in the hope that it will be useful, |
|||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
GNU General Public License for more details. |
|||
|
|||
You should have received a copy of the GNU General Public License |
|||
along with this program. If not, see {http://www.gnu.org/licenses/}.
|
|||
|
|||
Home: https://github.com/gorhill/uMatrix
|
|||
*/ |
|||
|
|||
/* global vAPI, uDom */ |
|||
|
|||
'use strict'; |
|||
|
|||
/******************************************************************************/ |
|||
|
|||
(function() { |
|||
|
|||
/******************************************************************************/ |
|||
|
|||
var messager = vAPI.messaging.channel('privacy.js'); |
|||
|
|||
var cachedPrivacySettings = {}; |
|||
|
|||
/******************************************************************************/ |
|||
|
|||
function changeUserSettings(name, value) { |
|||
messager.send({ |
|||
what: 'userSettings', |
|||
name: name, |
|||
value: value |
|||
}); |
|||
} |
|||
|
|||
/******************************************************************************/ |
|||
|
|||
function changeMatrixSwitch(name, state) { |
|||
messager.send({ |
|||
what: 'setMatrixSwitch', |
|||
switchName: name, |
|||
state: state |
|||
}); |
|||
} |
|||
|
|||
/******************************************************************************/ |
|||
|
|||
function onChangeValueHandler(uelem, setting, min, max) { |
|||
var oldVal = cachedPrivacySettings.userSettings[setting]; |
|||
var newVal = Math.round(parseFloat(uelem.val())); |
|||
if ( typeof newVal !== 'number' ) { |
|||
newVal = oldVal; |
|||
} else { |
|||
newVal = Math.max(newVal, min); |
|||
newVal = Math.min(newVal, max); |
|||
} |
|||
uelem.val(newVal); |
|||
if ( newVal !== oldVal ) { |
|||
changeUserSettings(setting, newVal); |
|||
} |
|||
} |
|||
|
|||
/******************************************************************************/ |
|||
|
|||
function prepareToDie() { |
|||
onChangeValueHandler(uDom('#delete-unused-session-cookies-after'), 'deleteUnusedSessionCookiesAfter', 15, 1440); |
|||
onChangeValueHandler(uDom('#clear-browser-cache-after'), 'clearBrowserCacheAfter', 15, 1440); |
|||
} |
|||
|
|||
/******************************************************************************/ |
|||
|
|||
var installEventHandlers = function() { |
|||
uDom('[data-setting-bool]').on('change', function(){ |
|||
var settingName = this.getAttribute('data-setting-bool'); |
|||
if ( typeof settingName === 'string' && settingName !== '' ) { |
|||
changeUserSettings(settingName, this.checked); |
|||
} |
|||
}); |
|||
|
|||
uDom('[data-matrix-switch]').on('change', function(){ |
|||
var switchName = this.getAttribute('data-matrix-switch'); |
|||
if ( typeof switchName === 'string' && switchName !== '' ) { |
|||
changeMatrixSwitch(switchName, this.checked); |
|||
} |
|||
}); |
|||
|
|||
uDom('#delete-unused-session-cookies-after').on('change', function(){ |
|||
onChangeValueHandler(uDom(this), 'deleteUnusedSessionCookiesAfter', 15, 1440); |
|||
}); |
|||
uDom('#clear-browser-cache-after').on('change', function(){ |
|||
onChangeValueHandler(uDom(this), 'clearBrowserCacheAfter', 15, 1440); |
|||
}); |
|||
|
|||
// https://github.com/gorhill/httpswitchboard/issues/197
|
|||
uDom(window).on('beforeunload', prepareToDie); |
|||
}; |
|||
|
|||
/******************************************************************************/ |
|||
|
|||
uDom.onLoad(function() { |
|||
var onSettingsReceived = function(privacySettings) { |
|||
// Cache copy
|
|||
cachedPrivacySettings = privacySettings; |
|||
|
|||
var userSettings = privacySettings.userSettings; |
|||
var matrixSwitches = privacySettings.matrixSwitches; |
|||
|
|||
uDom('[data-setting-bool]').forEach(function(elem){ |
|||
var settingName = elem.attr('data-setting-bool'); |
|||
if ( typeof settingName === 'string' && settingName !== '' ) { |
|||
elem.prop('checked', userSettings[settingName] === true); |
|||
} |
|||
}); |
|||
|
|||
uDom('[data-matrix-switch]').forEach(function(elem){ |
|||
var switchName = elem.attr('data-matrix-switch'); |
|||
if ( typeof switchName === 'string' && switchName !== '' ) { |
|||
elem.prop('checked', matrixSwitches[switchName] === true); |
|||
} |
|||
}); |
|||
|
|||
uDom('#delete-unused-session-cookies-after').val(userSettings.deleteUnusedSessionCookiesAfter); |
|||
uDom('#clear-browser-cache-after').val(userSettings.clearBrowserCacheAfter); |
|||
|
|||
installEventHandlers(); |
|||
}; |
|||
messager.send({ what: 'getPrivacySettings' }, onSettingsReceived); |
|||
}); |
|||
|
|||
/******************************************************************************/ |
|||
|
|||
})(); |
@ -1,88 +0,0 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
|||
<title>uMatrix — Privacy</title> |
|||
<link rel="stylesheet" type="text/css" href="css/common.css"> |
|||
<link rel="stylesheet" type="text/css" href="css/dashboard-common.css"> |
|||
<style> |
|||
div > p:first-child { |
|||
margin-top: 0; |
|||
} |
|||
div > p:last-child { |
|||
margin-bottom: 0; |
|||
} |
|||
ul { |
|||
padding: 0; |
|||
list-style-type: none; |
|||
} |
|||
ul > li { |
|||
margin: 0.5em 0; |
|||
} |
|||
.dim { |
|||
font-weight: 100; |
|||
color: #888; |
|||
} |
|||
</style> |
|||
</head> |
|||
|
|||
<body> |
|||
|
|||
<ul> |
|||
<li> |
|||
<input id="delete-blacklisted-cookies" type="checkbox" data-setting-bool="deleteCookies"><label data-i18n="privacyDeleteBlockedCookiesPrompt" for="delete-blacklisted-cookies"></label> |
|||
<span class="whatisthis"></span> |
|||
<div class="whatisthis-expandable para" data-i18n="privacyDeleteBlockedCookiesHelp"></div> |
|||
<li> |
|||
<input id="delete-unused-session-cookies" type="checkbox" data-setting-bool="deleteUnusedSessionCookies"><label data-i18n="privacyDeleteNonBlockedSessionCookiesPrompt1" for="delete-unused-session-cookies"></label> |
|||
<input id="delete-unused-session-cookies-after" type="text" value="60" size="3"><span data-i18n="privacyDeleteNonBlockedSessionCookiesPrompt2"></span> |
|||
<span class="whatisthis"></span> |
|||
<div class="whatisthis-expandable para" data-i18n="privacyDeleteNonBlockedSessionCookiesHelp"></div> |
|||
<!-- |
|||
Delete non-blocked session cookies x minutes after the last time they have been used. |
|||
|
|||
Allow generically blocked cookies but deleted them x minutes after they have been first created. |
|||
|
|||
A "generically blocked" cookie is a cookie which inherits its block status in |
|||
the matrix from the `cookie` cell or the `all` cell in the top row of the |
|||
matrix. |
|||
|
|||
When a cookie inherits its block status from a cell in the top row of the |
|||
matrix (the "header" row), this means it is not specifically distrusted, but |
|||
rather that the default stance is to distrust cookies in general. |
|||
|
|||
However some sites do require cookies to minimally work properly. This options |
|||
allow to "unbreak" these sites by allowing not specifically distrusted cookies |
|||
to travel back and forth between you and the server, but to limit the lifetime |
|||
of these cookies so that they cannot be used to track you. |
|||
--> |
|||
<li> |
|||
<input id="delete-blacklisted-localstorage" type="checkbox" data-setting-bool="deleteLocalStorage"><label data-i18n="privacyDeleteBlockedLocalStoragePrompt" for="delete-blacklisted-localstorage"></label> |
|||
<li> |
|||
<input id="clear-browser-cache" type="checkbox" data-setting-bool="clearBrowserCache"><label data-i18n="privacyClearCachePrompt1" for="clear-browser-cache"></label> |
|||
<input id="clear-browser-cache-after" type="text" value="60" size="3"> <label data-i18n="privacyClearCachePrompt2" for="clear-browser-cache-after"></label> |
|||
<span class="whatisthis"></span> |
|||
<div class="whatisthis-expandable para" data-i18n="privacyClearCacheHelp"></div> |
|||
<li> |
|||
<input id="process-referer" type="checkbox" data-matrix-switch="referrer-spoof"><label data-i18n="privacyProcessRefererPrompt" for="process-referer"></label> |
|||
<span class="whatisthis"></span> |
|||
<div class="whatisthis-expandable para" data-i18n="privacyProcessRefererHelp"></div> |
|||
<li> |
|||
<input id="no-mixed-content" type="checkbox" data-matrix-switch="https-strict"><label data-i18n="privacyNoMixedContentPrompt" for="no-mixed-content"></label> |
|||
<span class="whatisthis"></span> |
|||
<div class="whatisthis-expandable para" data-i18n="privacyNoMixedContentHelp"></div> |
|||
<li> |
|||
<input id="process-hyperlink-auditing" type="checkbox" data-setting-bool="processHyperlinkAuditing"><label data-i18n="privacyProcessHyperlinkAuditingPrompt" for="process-hyperlink-auditing"></label> |
|||
<span class="whatisthis"></span> |
|||
<div class="whatisthis-expandable para" data-i18n="privacyProcessHyperlinkAuditingHelp"></div> |
|||
</ul> |
|||
|
|||
<script src="js/vapi-common.js"></script> |
|||
<script src="js/vapi-client.js"></script> |
|||
<script src="js/udom.js"></script> |
|||
<script src="js/i18n.js"></script> |
|||
<script src="js/dashboard-common.js"></script> |
|||
<script src="js/privacy.js"></script> |
|||
</body> |
|||
|
|||
</html> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue