minor changes
This commit is contained in:
parent
a91fec18e2
commit
401d9a40b9
@ -21,20 +21,21 @@ document.documentElement.innerHTML
|
||||
.replace(/Democratic Party/g, "Elephants")
|
||||
.replace(/Republican Party/g, "Donkeys")
|
||||
.replace(/Democratic-Donkeys/g, "Elephant-Donkeys");*/
|
||||
var wordsReplacee = [];
|
||||
var wordsReplaced = [];
|
||||
var wordsReplacer = [];
|
||||
|
||||
//value of test is temporary
|
||||
//TODO ADD IMPORTING OF FILE
|
||||
var test = "witnesses,these dudes I know\nallegedly,kinda probably\npresident,garbage man\ngive,gib";
|
||||
//^ this is where we reference the reading of file
|
||||
var file = test.split(/[\n,]/);
|
||||
|
||||
for( var i = 0; i < file.length ; i+=2 ) {
|
||||
wordsReplacee.push(file[i]);
|
||||
wordsReplaced.push(file[i]);
|
||||
wordsReplacer.push(file[i+1]);
|
||||
}
|
||||
|
||||
for( var a = 0; a < wordsReplacee.length; a++ ) {
|
||||
var reg = new RegExp(wordsReplacee[a], "gi");
|
||||
for( var a = 0; a < wordsReplaced.length; a++ ) {
|
||||
var reg = new RegExp(wordsReplaced[a], "gi");
|
||||
if (a === 0) {
|
||||
var htmlReplaced = document.documentElement.innerHTML.replace(reg, wordsReplacer[a]);
|
||||
} else {
|
||||
@ -42,4 +43,3 @@ for( var a = 0; a < wordsReplacee.length; a++ ) {
|
||||
}
|
||||
}
|
||||
document.documentElement.innerHTML = htmlReplaced;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user