Skip to content

Commit 9819f71

Browse files
committedFeb 29, 2016
Take string out of function. clean up code a bit
1 parent 08cbcc6 commit 9819f71

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed
 

‎jquery.linkify.js

+6-13
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,14 @@ function linkify(string, buildHashtagUrl, includeW3, target, noFollow) {
44
relNoFollow = " rel=\"nofollow\"";
55
}
66

7-
string = function() {
8-
var uri;
9-
if (string.toLowerCase().indexOf("www.") === 0) {
10-
if (!includeW3) {
11-
return string;
12-
}
13-
uri = "http://" + string;
14-
} else {
15-
uri = string;
16-
}
17-
return "<a href=\"" + uri+ "\" target=\"" + target + "\"" + relNoFollow + ">" + string + "</a>";
18-
}();
7+
if (string.toLowerCase().indexOf("www.") === 0 && includeW3) {
8+
string = '<a href="http://' + string + '" target="' + target + '"' + relNoFollow + '>' + string + '</a>';
9+
} else {
10+
string = '<a href="' + string + '" target="' + target + '"' + relNoFollow + '>' + string + '</a>';
11+
}
1912

2013
if (buildHashtagUrl) {
21-
string = string.replace(/\B#(\w+)/g, "<a href=" + buildHashtagUrl("$1") +" target=\"" + target + "\"" + relNoFollow + ">#$1</a>");
14+
string = string.replace(/\B#(\w+)/g, '<a href=' + buildHashtagUrl("$1") + ' target="' + target + '"' + relNoFollow + '>#$1</a>');
2215
}
2316
return string;
2417
}

‎jquery.linkify.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
Please sign in to comment.