Skip to content

Commit 1737e2c

Browse files
committed
unifying both versions
1 parent a34cde7 commit 1737e2c

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

demo/index.htm

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,8 @@ <h2>a simple client side profanity filter</h2>
136136
customSwears: ['ass'],
137137
filter: false,
138138
externalSwears: 'swearWords.json',
139-
profaneText: function(ret) {
139+
profaneText: function(data) {
140140
$('#five').css('color', 'blue');
141-
alert(ret);
142141
}
143142
})
144143
</script>

demo/jquery.profanityfilter.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
x,
130130
inputs = $(this).find(':input'),
131131
profane = false,
132-
returnVal = [];
132+
data = [];
133133

134134
if (options.externalSwears !== null) {
135135
if (localStorageIsEnabled) {
@@ -170,8 +170,7 @@
170170
for (x = 0; x < nodes.length; x += 1) {
171171
if (re.test(nodes[x].nodeValue)) {
172172
profane = true;
173-
console.log(badWords[1]);
174-
returnVal.push(badWords[i]);
173+
data.push(badWords[i]);
175174
if (options.filter) {
176175
nodes[x].nodeValue = nodes[x].nodeValue.replace(re, rep);
177176
}
@@ -182,8 +181,7 @@
182181
for (var x = 0; x < inputs.length; x++) {
183182
if (re.test(inputs[x].value)) {
184183
profane = true;
185-
console.log(badWords[1]);
186-
returnVal.push(badWords[i]);
184+
data.push(badWords[i]);
187185
if (options.filter) {
188186
$(inputs[x]).val(inputs[x].value.replace(re, rep));
189187
}
@@ -192,7 +190,7 @@
192190
}
193191

194192
if (profane) {
195-
options.profaneText(returnVal.unique());
193+
options.profaneText(data.unique());
196194
};
197195
});
198196
};

jquery.profanityfilter.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
x,
130130
inputs = $(this).find(':input'),
131131
profane = false,
132-
returnVal = [];
132+
data = [];
133133

134134
if (options.externalSwears !== null) {
135135
if (localStorageIsEnabled) {
@@ -170,7 +170,7 @@
170170
for (x = 0; x < nodes.length; x += 1) {
171171
if (re.test(nodes[x].nodeValue)) {
172172
profane = true;
173-
returnVal.push(badWords[i]);
173+
data.push(badWords[i]);
174174
if (options.filter) {
175175
nodes[x].nodeValue = nodes[x].nodeValue.replace(re, rep);
176176
}
@@ -181,7 +181,7 @@
181181
for (var x = 0; x < inputs.length; x++) {
182182
if (re.test(inputs[x].value)) {
183183
profane = true;
184-
returnVal.push(badWords[i]);
184+
data.push(badWords[i]);
185185
if (options.filter) {
186186
$(inputs[x]).val(inputs[x].value.replace(re, rep));
187187
}
@@ -190,8 +190,8 @@
190190
}
191191

192192
if (profane) {
193-
options.profaneText(returnVal.unique());
194-
}
193+
options.profaneText(data.unique());
194+
};
195195
});
196196
};
197197
})(jQuery);

0 commit comments

Comments
 (0)