Linkify Plus Plus

Based on Linkify Plus. Turn plain text URLs into links.

< 脚本 Linkify Plus Plus 的反馈

提问 / 留言

§
发布于:2014-11-12

significant increase in page load time - browser stops responding

win 7
ff 33.*
LPP 2.4.3

on quite a few sites i am seeing a very significant increase in load time while the browser stops responding - this is one example where the load time is > 20 sec. (560+ KB) ...
https://github.com/RequestPolicyContinued/requestpolicy/compare/RequestPolicy:dev-1.0...dev-1.0

woxxom管理员
§
发布于:2014-11-12
编辑于:2014-11-12

Seems like a bug in FF's implementation of string comparison and/or xpath. I've attached a screenshot from gecko profiler addon. BTW, I wonder if using asm.js could help by speeding up such functions as isIP, inAngular, stripSingleParenthesis... Or maybe it's faster to directly access the DOM tree and analyze text content per element...

eight作者
§
发布于:2014-11-12
编辑于:2014-11-12

Here's the xpath in version 2.4.3.

document.evaluate(".//text()[not(ancestor::a) and not(ancestor::code) and not(ancestor::head) and not(ancestor::noscript) and not(ancestor::option) and not(ancestor::script) and not(ancestor::style) and not(ancestor::title) and not(ancestor::textarea) and not(ancestor::svg) and not(ancestor::canvas) and not(ancestor::button) and not(ancestor::select) and not(ancestor::template) and not(ancestor::meter) and not(ancestor::progress) and not(ancestor::math) and not(ancestor::h1) and not(ancestor::h2) and not(ancestor::h3) and not(ancestor::h4) and not(ancestor::h5) and not(ancestor::h6) and not(ancestor::*[contains(@class, 'highlight') or contains(@class, 'editbox') or contains(@class, 'code') or contains(@class, 'brush:') or contains(@class, 'bdsug')]) and not(ancestor::*[@contenteditable='true']) and not(ancestor::*[contains(@class, 'linkifyplus')])]", document.body, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null)

It took 6~7 seconds to execute on my notebook. I agree that filtering out the ancestors is not the best idea.

I'll try to use other methods, including traversing the DOM tree.

eight作者
§
发布于:2014-11-13

Updated to version 3.0.0. The script will traverse the DOM now.

§
发布于:2015-04-22

missed your comment until now - i was never notified
thanks, i'll give the script another shot :)

发布留言

登录(不可用)以发布留言。

长期地址
遇到问题?请前往 GitHub 提 Issues。