diff --git a/fixtures/browsers.yml b/fixtures/browsers.yml index 78aab07..fbfce3e 100644 --- a/fixtures/browsers.yml +++ b/fixtures/browsers.yml @@ -346,6 +346,8 @@ Motorola Internet: - MOT-VE240/00.72 UP.Browser/7.2.7.5.548 (GUI) MMP/2.0 Novarra-Vision/8.0 Mozilla Android Components: - MozacFetch/49.0.20200702190156 +Naver Whale: + - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.57 Whale/3.14.133.23 Safari/537.36 NCSA Mosaic: - NCSA_Mosaic/2.7b5 (X11;Linux 2.6.7 i686) libwww/2.12 modified NetFront: diff --git a/fixtures/crawlers.yml b/fixtures/crawlers.yml index c57f414..74d8cd2 100644 --- a/fixtures/crawlers.yml +++ b/fixtures/crawlers.yml @@ -440,10 +440,9 @@ Nagios check_http: - check_http/v1.5 (nagios-plugins 1.5) NalezenCzBot: - NalezenCzBot/1.0 (http://www.nalezen.cz/about-crawler) -Naver: - - Mozilla/5.0 (compatible; Yeti/1.1; +http://naver.me/spd) +Naver Search: + - Mozilla/5.0 (Linux; Android 12; SM-G975N Build/SP1A.210812.016; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/90.0.4430.232 Whale/1.0.0.0 Crosswalk/26.90.3.21 Mobile Safari/537.36 NAVER(inapp; search; 1010; 11.11.3) - Mozilla/5.0 (Linux; Android 8.0.0; SM-N950N Build/R16NW; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/79.0.3945.88 Mobile Safari/537.36 NAVER(inapp; search; 1000; 11.8.4; 11) - - Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.0 Safari/537.36 (compatible; Yeti/1.1; +http://naver.me/spd) nbertaupete95: - Mozilla/5.0/Firefox/42.0 - nbertaupete95(at)gmail.com Netcraft Survey Bot: @@ -800,9 +799,9 @@ Yandex: - Mozilla/5.0 (compatible; YandexBot/3.0; +http://yandex.com/bots) Yandex Bot: - Mozilla/5.0 (compatible; YandexVerticals/1.0; http://yandex.com/bots) -Yeti: +Yeti (Naver): - Mozilla/5.0 (compatible; yeti/1.1; +http://naver.me/spd) -Yeti/Naverbot: + - Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.0 Safari/537.36 (compatible; Yeti/1.1; +http://naver.me/spd) - Yeti/1.1 (Naver Corp.; http://help.naver.com/robots/) Youdao Bot: - Mozilla/5.0 (compatible; YoudaoBot/1.0; http://www.youdao.com/help/webmaster/spider/; ) diff --git a/fixtures/downloads b/fixtures/downloads index 9b66246..a44ec63 160000 --- a/fixtures/downloads +++ b/fixtures/downloads @@ -1 +1 @@ -Subproject commit 9b66246bb25475a73f51bf9872c9d05091ff63dd +Subproject commit a44ec63ac3dd6aab31a93e415d21bc07f1913240 diff --git a/package.json b/package.json index e196372..d644694 100644 --- a/package.json +++ b/package.json @@ -86,7 +86,7 @@ "remark-cli": "^10.0.0", "remark-preset-lint-recommended": "^6.0.0", "rollup": "^2.70.2", - "standard": "^16.0.3", + "standard": "^17.0.0", "stdline": "^1.0.0", "typescript": "^4.6.3", "user-agents": "^1.0.990", diff --git a/page/script.js b/page/script.js index dc0de62..3828ca9 100644 --- a/page/script.js +++ b/page/script.js @@ -28,17 +28,24 @@ import list from '../src/list.json' timer = setTimeout(check, 200, value) } + function append (parent, tag, string) { + if (tag) { + const ele = document.createElement('kbd') + ele.appendChild(document.createTextNode(string)) + parent.appendChild(ele) + } else { + parent.appendChild(document.createTextNode(string)) + } + } + function showMatch (output, ua) { - const pattern = document.createElement('kbd') - pattern.appendChild( - document.createTextNode(isbot.matches(ua)?.pop()) - ) - output.appendChild( - document.createTextNode( - 'I think so, yes\nThe pattern that was matched is: ' - ) - ) - output.appendChild(pattern) + const fragment = document.createDocumentFragment() + append(fragment, null, 'I think so, yes\n') + append(fragment, null, 'The substring ') + append(fragment, 'kbd', isbot.find(ua)) + append(fragment, null, ' matches the pattern ') + append(fragment, 'kbd', isbot.matches(ua)?.pop()) + output.appendChild(fragment) } function noMatch (output) { output.appendChild( diff --git a/src/isbot/index.js b/src/isbot/index.js index 234524d..d04d1c1 100644 --- a/src/isbot/index.js +++ b/src/isbot/index.js @@ -12,12 +12,12 @@ export class Isbot { /** * @type {string[]} */ - #list; + #list /** * @type {RegExp} */ - #pattern; + #pattern constructor (patterns) { this.#list = patterns || list.slice()