Remove unevenly supported lookbehind from link preview regular expression
- Simplify link preview condition
This commit is contained in:
parent
ce7ec11d1d
commit
3670e7f9c8
1 changed files with 11 additions and 13 deletions
|
@ -52,7 +52,7 @@
|
||||||
<div class="clear"></div>\
|
<div class="clear"></div>\
|
||||||
<hr class="previewseparator">';
|
<hr class="previewseparator">';
|
||||||
var text;
|
var text;
|
||||||
var urlRegex = /(?<!=)(https?\:\/\/|\s)[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})(\/+[a-z0-9_.\:\;-]*)*(\?[\&\%\|\+a-z0-9_=,\.\:\;-]*)?([\&\%\|\+&a-z0-9_=,\:\;\.-]*)([\!\#\/\&\%\|\+a-z0-9_=,\:\;\.-]*)}*/i;
|
var urlRegex = /^(?:https?\:\/\/|\s)[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})(?:\/+[a-z0-9_.\:\;-]*)*(?:\?[\&\%\|\+a-z0-9_=,\.\:\;-]*)?(?:[\&\%\|\+&a-z0-9_=,\:\;\.-]*)(?:[\!\#\/\&\%\|\+a-z0-9_=,\:\;\.-]*)}*$/i;
|
||||||
var binurl;
|
var binurl;
|
||||||
var block = false;
|
var block = false;
|
||||||
var blockTitle = false;
|
var blockTitle = false;
|
||||||
|
@ -133,20 +133,18 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trim(text) !== "") {
|
if (trim(text) !== "" && block === false && urlRegex.test(text)) {
|
||||||
if (block === false && urlRegex.test(text)) {
|
binurl = bin2hex(text);
|
||||||
binurl = bin2hex(text);
|
block = true;
|
||||||
block = true;
|
|
||||||
|
|
||||||
isCrawling = true;
|
isCrawling = true;
|
||||||
$('#profile-rotator').show();
|
$('#profile-rotator').show();
|
||||||
|
|
||||||
if (binurl in cache) {
|
if (binurl in cache) {
|
||||||
isCrawling = false;
|
isCrawling = false;
|
||||||
processContentData(cache[binurl]);
|
processContentData(cache[binurl]);
|
||||||
} else {
|
} else {
|
||||||
getContentData(binurl, processContentData);
|
getContentData(binurl, processContentData);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue