Fixed bug with blacklist and whitelist.
This commit is contained in:
@@ -71,20 +71,23 @@ var Options = React.createClass({
|
|||||||
var theme = React.findDOMNode(this.refs.theme).value.trim();
|
var theme = React.findDOMNode(this.refs.theme).value.trim();
|
||||||
var loggingType = React.findDOMNode(this.refs.loggingType).value.trim();
|
var loggingType = React.findDOMNode(this.refs.loggingType).value.trim();
|
||||||
var loggingStyle = React.findDOMNode(this.refs.loggingStyle).value.trim();
|
var loggingStyle = React.findDOMNode(this.refs.loggingStyle).value.trim();
|
||||||
|
// Trimming blacklist and whitelist removes blank lines and spaces.
|
||||||
|
var blacklist = that.state.blacklist.trim();
|
||||||
|
var whitelist = that.state.whitelist.trim();
|
||||||
|
|
||||||
// Sync options with google storage.
|
// Sync options with google storage.
|
||||||
chrome.storage.sync.set({
|
chrome.storage.sync.set({
|
||||||
theme: theme,
|
theme: theme,
|
||||||
blacklist: that.state.blacklist,
|
blacklist: blacklist,
|
||||||
whitelist: that.state.whitelist,
|
whitelist: whitelist,
|
||||||
loggingType: loggingType,
|
loggingType: loggingType,
|
||||||
loggingStyle: loggingStyle
|
loggingStyle: loggingStyle
|
||||||
}, function () {
|
}, function () {
|
||||||
// Set state to be newly entered values.
|
// Set state to be newly entered values.
|
||||||
that.setState({
|
that.setState({
|
||||||
theme: theme,
|
theme: theme,
|
||||||
blacklist: that.state.blacklist,
|
blacklist: blacklist,
|
||||||
whitelist: that.state.whitelist,
|
whitelist: whitelist,
|
||||||
loggingType: loggingType,
|
loggingType: loggingType,
|
||||||
loggingStyle: loggingStyle,
|
loggingStyle: loggingStyle,
|
||||||
displayAlert: true
|
displayAlert: true
|
||||||
|
|||||||
@@ -10,6 +10,12 @@ function contains(line, list) {
|
|||||||
var lines = list.split('\n');
|
var lines = list.split('\n');
|
||||||
|
|
||||||
for (var i = 0; i < lines.length; i ++) {
|
for (var i = 0; i < lines.length; i ++) {
|
||||||
|
|
||||||
|
// If by any chance one line in the list is empty or contains a blank space, ignore it
|
||||||
|
// It would probably be better to use regex here to detect blank space, but since
|
||||||
|
// this is not likely to be triggered anyway, there is no need for that yet.
|
||||||
|
if(lines[i] === '' || lines[i] === ' ') continue;
|
||||||
|
|
||||||
if (line.indexOf(lines[i]) > - 1) {
|
if (line.indexOf(lines[i]) > - 1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -959,6 +959,12 @@ function contains(line, list) {
|
|||||||
var lines = list.split('\n');
|
var lines = list.split('\n');
|
||||||
|
|
||||||
for (var i = 0; i < lines.length; i++) {
|
for (var i = 0; i < lines.length; i++) {
|
||||||
|
|
||||||
|
// If by any chance one line in the list is empty or contains a blank space, ignore it
|
||||||
|
// It would probably be better to use regex here to detect blank space, but since
|
||||||
|
// this is not likely to be triggered anyway, there is no need for that yet.
|
||||||
|
if (lines[i] === '' || lines[i] === ' ') continue;
|
||||||
|
|
||||||
if (line.indexOf(lines[i]) > -1) {
|
if (line.indexOf(lines[i]) > -1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -586,6 +586,12 @@ function contains(line, list) {
|
|||||||
var lines = list.split('\n');
|
var lines = list.split('\n');
|
||||||
|
|
||||||
for (var i = 0; i < lines.length; i++) {
|
for (var i = 0; i < lines.length; i++) {
|
||||||
|
|
||||||
|
// If by any chance one line in the list is empty or contains a blank space, ignore it
|
||||||
|
// It would probably be better to use regex here to detect blank space, but since
|
||||||
|
// this is not likely to be triggered anyway, there is no need for that yet.
|
||||||
|
if (lines[i] === '' || lines[i] === ' ') continue;
|
||||||
|
|
||||||
if (line.indexOf(lines[i]) > -1) {
|
if (line.indexOf(lines[i]) > -1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,20 +117,23 @@ var Options = React.createClass({
|
|||||||
var theme = React.findDOMNode(this.refs.theme).value.trim();
|
var theme = React.findDOMNode(this.refs.theme).value.trim();
|
||||||
var loggingType = React.findDOMNode(this.refs.loggingType).value.trim();
|
var loggingType = React.findDOMNode(this.refs.loggingType).value.trim();
|
||||||
var loggingStyle = React.findDOMNode(this.refs.loggingStyle).value.trim();
|
var loggingStyle = React.findDOMNode(this.refs.loggingStyle).value.trim();
|
||||||
|
// Trimming blacklist and whitelist removes blank lines and spaces.
|
||||||
|
var blacklist = that.state.blacklist.trim();
|
||||||
|
var whitelist = that.state.whitelist.trim();
|
||||||
|
|
||||||
// Sync options with google storage.
|
// Sync options with google storage.
|
||||||
chrome.storage.sync.set({
|
chrome.storage.sync.set({
|
||||||
theme: theme,
|
theme: theme,
|
||||||
blacklist: that.state.blacklist,
|
blacklist: blacklist,
|
||||||
whitelist: that.state.whitelist,
|
whitelist: whitelist,
|
||||||
loggingType: loggingType,
|
loggingType: loggingType,
|
||||||
loggingStyle: loggingStyle
|
loggingStyle: loggingStyle
|
||||||
}, function () {
|
}, function () {
|
||||||
// Set state to be newly entered values.
|
// Set state to be newly entered values.
|
||||||
that.setState({
|
that.setState({
|
||||||
theme: theme,
|
theme: theme,
|
||||||
blacklist: that.state.blacklist,
|
blacklist: blacklist,
|
||||||
whitelist: that.state.whitelist,
|
whitelist: whitelist,
|
||||||
loggingType: loggingType,
|
loggingType: loggingType,
|
||||||
loggingStyle: loggingStyle,
|
loggingStyle: loggingStyle,
|
||||||
displayAlert: true
|
displayAlert: true
|
||||||
|
|||||||
Reference in New Issue
Block a user