Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/master' into legacy…
Browse files Browse the repository at this point in the history
…permissions
  • Loading branch information
andryou committed Jun 9, 2016
2 parents 6750a4c + 754cf0f commit 3d8219e
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 13 deletions.
2 changes: 2 additions & 0 deletions html/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@
<tr><td class="rowtitle"><label for="syncfromnotify">Show Import Sync Notification</label>:</td><td><input type="checkbox" id="syncfromnotify" class="save" /> <i>(Default: enabled; show popup when settings synced <b>from</b> your Google Account)</i></td></tr>
<tr><td class="rowtitle"><label for="updatemessagenotify">Show Update Notification</label>:</td><td><input type="checkbox" id="updatemessagenotify" class="save" /> <i>(Default: enabled; show update notification when an update for ScriptSafe is available)</i></td></tr>
<tr><td class="rowtitle"><label for="updatenotify">Show Changelog on Update</label>:</td><td><input type="checkbox" id="updatenotify" class="save" /> <i>(Default: enabled; show changelog page when ScriptSafe is updated)</i></td></tr>
<tr><td class="rowtitle">Hotkeys:</td><td> <a href="javascript:;" id="hotkeyspage">Configure the ScriptSafe hotkeys</a> (click on "Keyboard Shortcuts")</td></tr>
<tr><td colspan="2" class="section">Privacy Settings</td></tr>
<tr><td class="rowtitle"><label for="paranoia">Paranoia Mode</label>:</td><td><input type="checkbox" id="paranoia" class="save" /> <i>(Default: disabled; block allowed domains on unknown tabs)</i></td></tr>
<tr><td class="rowtitle"><label for="annoyances">Block Unwanted Content</label>:</td><td><input type="checkbox" id="annoyances" class="save" /><br /><i>(Default: enabled; remove unwanted content from known ad / malware domains; domains gathered from <a href="http://winhelp2002.mvps.org/hosts.htm" target="_blank">MVPS HOSTS</a>, <a href="http://hosts-file.net" target="_blank">hpHOSTS (ad / tracking servers)</a>, <a href="http://pgl.yoyo.org/as/policy.php" target="_blank">Peter Lowe's HOSTS Project</a>, <a href="http://www.malwaredomainlist.com/" target="_blank">MalwareDomainList.com</a>)</i></td></tr>
<tr><td class="rowtitle"><label for="cookies">Block Unwanted Cookies</label>:</td><td><input type="checkbox" id="cookies" class="save" /><br /><i>(Default: enabled; blocks cookies from known ad / malware domains; below mode applies to this as well)</i></td></tr>
<tr id="annoyancesmoderow"><td class="rowtitle"><label for="annoyancesmode">Unwanted Content Mode</label>:</td><td><select id="annoyancesmode" class="savechange">
Expand Down
12 changes: 8 additions & 4 deletions html/updated.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,25 @@
<body>
<div id="message"></div>
<div id="main">
<h1>Updated to v<span id="versionno"></span>! (__, __ __, 2016)</h1>
<h1>Updated to v<span id="versionno"></span>! (Thursday, June 9, 2016)</h1>
<br />
<hr>
<div style="text-align: left; line-height: 18px; font-size: 13px;"><br />
In this version you will find the following updates:
<ul>
<li><b>v1.0.7.9-DEV:</b><ul>
<li><b>v1.0.7.9:</b><ul>
<li><strong>Announcement: <a href="https://github.com/andryou/scriptsafe/issues/29" target="_blank">changes to ScriptSafe updates</a></strong></li>
<li>Significant performance increase, due to improved list checking (how significant? <a href="https://github.com/andryou/scriptsafe/issues/15#issuecomment-224732853" target="_blank">Check it out!</a>)</li>
<li>Better handling of third-party/whitelisted domains on an unknown domain</li>
<li>Added new option: <b>Paranoia Mode</b> - block allowed domains on unknown tabs <i>(default: disabled)</i><ul>
<li>Feel free to enable this option for added security, and uncheck if you prefer to browse without it</li>
<li>This is disabled by default as it changes how ScriptSafe behaves up until now</li>
<li>I personally recommend enabling it</li>
</ul></li>
<li>Smart grouping of domains in the panel based on parent domain</li>
<li>Added support for recognizing and filtering new tab pages</li>
<li>Minor fixes to hotkey function, options page, and panel</li>
<li>Better distinction between webbugs and images</li>
<li>Updated unwanted content providers list</li>
<li>Minor fix in panel behaviour</li>
</ul></li>
</ul>
I have put together <a href="https://github.com/andryou/scriptsafe/wiki" target="_blank">some documentation for ScriptSafe</a>, including "Getting Started" instructions.<br />
Expand Down
13 changes: 10 additions & 3 deletions js/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ document.addEventListener('DOMContentLoaded', function () {
$(".close").click(closeOptions);
$("#syncimport").click(forceSyncImport);
$("#syncexport").click(forceSyncExport);
$("#hotkeyspage").click(function() {
chrome.tabs.create({url: 'chrome://extensions/?id=footer-section'});
});
syncstatus = localStorage['syncenable'];
});
function forceSyncExport() {
Expand Down Expand Up @@ -126,6 +129,7 @@ function loadOptions() {
loadCheckbox("antisocial");
loadCheckbox("webbugs");
loadCheckbox("preservesamedomain");
loadCheckbox("paranoia");
loadCheckbox("classicoptions");
loadCheckbox("referrer");
loadCheckbox("rating");
Expand Down Expand Up @@ -169,6 +173,7 @@ function saveOptions() {
saveCheckbox("antisocial");
saveCheckbox("webbugs");
saveCheckbox("preservesamedomain");
saveCheckbox("paranoia");
saveCheckbox("classicoptions");
saveCheckbox("referrer");
saveCheckbox("rating");
Expand Down Expand Up @@ -264,7 +269,9 @@ function notification(msg) {
function addList(type) {
var domain = $('#url').val().toLowerCase().replace("http://", "").replace("https://", "");
if (!domain.match(/^(?:[\-\w\*\?]+(\.[\-\w\*\?]+)*|((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})|\[[A-Fa-f0-9:.]+\])?$/g)) {
notification('Invalid domain');
notification('Invalid domain/address');
} else if (!domain.match(/[a-z0-9]/g)) {
notification('The domain or address must contain some letters/numbers');
} else {
if ((localStorage['annoyances'] == 'true' && (localStorage['annoyancesmode'] == 'strict' || (localStorage['annoyancesmode'] == 'relaxed' && bkg.domainCheck(domain, 1) != '0')) && bkg.baddies(bkg.getDomain(domain), localStorage['annoyancesmode'], localStorage['antisocial']) == 1) || (localStorage['antisocial'] == 'true' && bkg.baddies(bkg.getDomain(domain), localStorage['annoyancesmode'], localStorage['antisocial']) == '2')) {
notification('Domain cannot be added as it is a provider of unwanted content (see "Block Unwanted Content" and/or "Antisocial Mode")');
Expand Down Expand Up @@ -376,7 +383,7 @@ function listUpdate() {
if (localStorage['domainsort'] == 'true') whiteList = bkg.domainSort(whiteList);
else whiteList.sort();
for (var i in whiteList) {
if ((whiteList[i][0] == '*' && whiteList[i][1] == '*' && whiteList[i][2] == '.') || whiteList[i].match(/^(?:(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})$/g) || whiteList[i].match(/^(?:\[[A-Fa-f0-9:.]+\])(:[0-9]+)?$/g)) whitelistCompiled += '<div class="listentry"><div class="entryoptions"><a href="javascript:;" style="color:#f00;" class="domainRemover" rel=\''+whiteList[i]+'\'>X</a></div>'+whiteList[i]+'</div>';
if (whiteList[i][0] == '*' || whiteList[i].match(/^(?:(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})$/g) || whiteList[i].match(/^(?:\[[A-Fa-f0-9:.]+\])(:[0-9]+)?$/g)) whitelistCompiled += '<div class="listentry"><div class="entryoptions"><a href="javascript:;" style="color:#f00;" class="domainRemover" rel=\''+whiteList[i]+'\'>X</a></div>'+whiteList[i]+'</div>';
else whitelistCompiled += '<div class="listentry"><div class="entryoptions"><a href="javascript:;" style="color:green;" class="topDomainAdd" title=\''+whiteList[i]+'\' rel="0">Trust Domain</a> | <a href="javascript:;" style="color:#f00;" class="domainRemover" rel=\''+whiteList[i]+'\'>X</a></div>'+whiteList[i]+'</div>';
}
}
Expand All @@ -386,7 +393,7 @@ function listUpdate() {
if (localStorage['domainsort'] == 'true') blackList = bkg.domainSort(blackList);
else blackList.sort();
for (var i in blackList) {
if ((blackList[i][0] == '*' && blackList[i][1] == '*' && blackList[i][2] == '.') || blackList[i].match(/^(?:(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})$/g) || blackList[i].match(/^(?:\[[A-Fa-f0-9:.]+\])(:[0-9]+)?$/g)) blacklistCompiled += '<div class="listentry"><div class="entryoptions"><a href="javascript:;" style="color:#f00;" class="domainRemover" rel=\''+blackList[i]+'\'>X</a></div>'+blackList[i]+'</div>';
if (blackList[i][0] == '*' || blackList[i].match(/^(?:(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})$/g) || blackList[i].match(/^(?:\[[A-Fa-f0-9:.]+\])(:[0-9]+)?$/g)) blacklistCompiled += '<div class="listentry"><div class="entryoptions"><a href="javascript:;" style="color:#f00;" class="domainRemover" rel=\''+blackList[i]+'\'>X</a></div>'+blackList[i]+'</div>';
else blacklistCompiled += '<div class="listentry"><div class="entryoptions"><a href="javascript:;" style="color:green;" class="topDomainAdd" title=\''+blackList[i]+'\' rel="1">Distrust Domain</a> | <a href="javascript:;" style="color:#f00;" class="domainRemover" rel=\''+blackList[i]+'\'>X</a></div>'+blackList[i]+'</div>';
}
}
Expand Down
4 changes: 2 additions & 2 deletions js/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ function init() {
undesirablecount++;
} else if ((parentstatus == '1' || parentstatus == '-1') && domainCheckStatus == '0') {
$("#blocked [rel='x_"+itemdomainfriendly+"'] .box1, #blocked [rel='x_"+itemdomainfriendly+"'] .x_trust, #blocked [rel='x_"+itemdomainfriendly+"'] .box3, #blocked [rel='x_"+itemdomainfriendly+"'] .box4").hide();
$("#blocked [rel='x_"+itemdomainfriendly+"'] .x_blacklist").attr("title","Ignored whitelisted domain due to unknown tab domain").html("Ignored Whitelist").addClass("selected");
$("#blocked [rel='x_"+itemdomainfriendly+"'] .x_blacklist").attr("title","Ignored allowed domain due to unknown tab domain").html("Ignored Allow").addClass("selected");
} else if (response.annoyances == 'true' && domainCheckStatus == '-1' && baddiesstatus == '1') {
$("#blocked [rel='x_"+itemdomainfriendly+"'] .x_"+itemdomainfriendly).hide();
$("#blocked [rel='x_"+itemdomainfriendly+"'] .x_blacklist").attr("title","Unwanted Content Provider").html("Unwanted").addClass("selected");
Expand All @@ -171,7 +171,7 @@ function init() {
}
}
}
$("#blocked").append($('.thirditem:has([title="Ignored whitelisted domain due to unknown tab domain"])'));
$("#blocked").append($('.thirditem:has([title="Ignored allowed domain due to unknown tab domain"])'));
$("#blocked").append($('.thirditem:has([title="Unwanted Content Provider"])'));
$("#blocked").append($('.thirditem:has([title="Antisocial"])'));
$("#blocked").append($('.thirditem:not(*>:has(.choices))'));
Expand Down
9 changes: 5 additions & 4 deletions js/scriptsafe.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,13 @@ function ScriptSafe(req) {
var extractedReqDomain = extractDomainFromURL(req.url);
var domainCheckStatus = domainCheck(req.url, 1);
var tabDomainCheckStatus = domainCheck(extractedDomain, 1);
if (tabDomainCheckStatus == '1' || (tabDomainCheckStatus == '-1' && localStorage['mode'] == 'block' && localStorage['preservesamedomain'] == 'false')) {
if (tabDomainCheckStatus == '1' || (tabDomainCheckStatus == '-1' && localStorage['mode'] == 'block' && localStorage['paranoia'] == 'true' && localStorage['preservesamedomain'] == 'false')) {
elementStatusCheck = true;
thirdPartyCheck = true;
} else {
if (domainCheckStatus == '0' && !(tabDomainCheckStatus == '-1' && localStorage['mode'] == 'block')) thirdPartyCheck = false;
if (domainCheckStatus == '0' && !(tabDomainCheckStatus == '-1' && localStorage['mode'] == 'block' && localStorage['paranoia'] == 'true')) thirdPartyCheck = false;
else thirdPartyCheck = thirdParty(req.url, extractedDomain);
if ((tabDomainCheckStatus == '-1' && localStorage['mode'] == 'block') || (domainCheckStatus != '0' && (domainCheckStatus == '1' || (domainCheckStatus == '-1' && localStorage['mode'] == 'block'))) || ((localStorage['annoyances'] == 'true' && (localStorage['annoyancesmode'] == 'strict' || (localStorage['annoyancesmode'] == 'relaxed' && domainCheckStatus != '0'))) && baddiesCheck == '1') || (localStorage['antisocial'] == 'true' && baddiesCheck == '2'))
if ((tabDomainCheckStatus == '-1' && localStorage['mode'] == 'block' && localStorage['paranoia'] == 'true') || (domainCheckStatus != '0' && (domainCheckStatus == '1' || (domainCheckStatus == '-1' && localStorage['mode'] == 'block'))) || ((localStorage['annoyances'] == 'true' && (localStorage['annoyancesmode'] == 'strict' || (localStorage['annoyancesmode'] == 'relaxed' && domainCheckStatus != '0'))) && baddiesCheck == '1') || (localStorage['antisocial'] == 'true' && baddiesCheck == '2'))
elementStatusCheck = true;
else elementStatusCheck = false;
}
Expand Down Expand Up @@ -414,6 +414,7 @@ function setDefaultOptions() {
defaultOptionValue("useragentspoof_os", "off");
defaultOptionValue("referrerspoof", "off");
defaultOptionValue("cookies", "true");
defaultOptionValue("paranoia", "false");
if (!optionExists("blackList")) localStorage['blackList'] = JSON.stringify([]);
if (!optionExists("whiteList")) localStorage['whiteList'] = JSON.stringify(["*.googlevideo.com"]);
if (typeof sessionStorage['blackList'] === "undefined") sessionStorage['blackList'] = JSON.stringify([]);
Expand Down Expand Up @@ -451,7 +452,7 @@ function statuschanger() {
chrome.browserAction.setIcon({path: "../img/IconDisabled.png"});
} else {
localStorage['enable'] = 'true';
chrome.browserAction.setIcon({path: "../img/Forbidden.png"});
chrome.browserAction.setIcon({path: "../img/IconForbidden.png"});
}
}
function tempHandler(request) {
Expand Down

0 comments on commit 3d8219e

Please sign in to comment.