Skip to content

Commit 73b0787

Browse files
committed
Fixed Bugs on Form
1 parent 522df74 commit 73b0787

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

js/script.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,13 @@ function loadFile(event){
3232
// Suggest Author Functions
3333
function authorSuggest (value) {
3434
authorSet = false;
35+
newAuthorToast = false;
3536
authors = "Alex Mueller (Lollydrop), Anas Khan, Brian Medina, Christopher Bravata, Corbin Crutchley (crutchcorn), Daniel Ciao (plusCubed), Daniel Hickman, Eduardo Pratti (KMZ Icons), Gabriel Zegarra (Gaigzean), Greg Ives (Grives), Jahir Fiquitiva & Corbin Crutchley (crutchcorn), Jireh Mark Morilla, Micheal Cook (Cookicons), Niko Pennanen, Oscar E, Patryk Goworowski, Sky Konig, Vukasin Andelkovic, Wayne Kosimoto & Corbin Crutchley (crutchcorn), Wayne Kosimoto, Zachary Pierson (zangent), createme";
3637
valuear = value.split(" ");
3738
sug = [];
3839
for (var i = valuear.length - 1; i >= 0; i--) {
3940
authorregex = new RegExp(valuear[i].replace(/\(/, "\\(").replace(/\)/, "\\)"), "i");
40-
authorregexmatch = new RegExp("(.*)(, )?([\\s\\w\\(\\)]*" + valuear[i].replace(/\(/, "\\(").replace(/\)/, "\\)") + "[\\s\\w\\(\\)]*)(?!(?!,),)(.*)", "i");
41+
authorregexmatch = new RegExp("(.*)(, |^)([\\s\\w\\(\\)]*" + valuear[i].replace(/\(/, "\\(").replace(/\)/, "\\)") + "[\\s\\w\\(\\)]*)(?!(?!,),)(.*)", "i");
4142
if (authorregex.test(authors)) {
4243
sug.push(authors.replace(authorregexmatch, "$3"));
4344
}
@@ -53,11 +54,12 @@ function authorSuggest (value) {
5354
} else {
5455
// Matched
5556
matched = true;
56-
Materialize.toast('<span onclick="setAuthor(\'' + sug[i] + '\');">Do you mean: ' + sug[i] + '</span>', 10000,'',function(){if (authorSet == false) {Materialize.toast('<span>You are creating a new author</span>', 10000);};});
57+
Materialize.toast('<span onclick="setAuthor(\'' + sug[i] + '\');">Do you mean: ' + sug[i] + '</span>', 10000,'',function(){if (authorSet == false && newAuthorToast == false) {Materialize.toast('<span>You are creating a new author</span>', 10000);newAuthorToast = true;};});
5758
};
5859
};
5960
if (matched == false) {
6061
Materialize.toast('<span>You are creating a new author</span>', 10000);
62+
newAuthorToast = true;
6163
};
6264
}
6365
function setAuthor (author) {

0 commit comments

Comments
 (0)