aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--auto_detect_link.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/auto_detect_link.js b/auto_detect_link.js
index d273a3b..136878e 100644
--- a/auto_detect_link.js
+++ b/auto_detect_link.js
@@ -391,15 +391,16 @@
let links = getAllLinks(window.content);
// rel="prev|next"
- if (1) {
- let relValue = next ? /next/ : /prev/;
- let link = find(links, function (link) ((typeof link.rel == 'string') && link.rel.match(relValue)));
+ {
+ let relValue = next ? /(?:^|[ \t\r\n])next(?:[ \t\n\r]|$)/
+ : /(?:^|[ \t\r\n])prev(?:[ \t\n\r]|$)/;
+ let link = find(links, function (link) ((typeof link.rel == 'string') && relValue.test(link.rel.toLowerCase())));
if (link)
return link;
}
// keywords
- if (1) {
+ {
let link;
if (patterns.some(function (pattern) {
link = find(links, function (link) match(pattern, link));