On Wed, Jan 11, 2012 at 12:19 PM, Daniel Kinzler <daniel(a)brightbyte.de> wrote:
$.holdReady(true);
mediaWiki.loader.load("https://toolserver.org/~netaction/wikitrust.js&….js");
Note that this will disable all gadgets and custom scripts: $.holdReady(true) is
a hack to prevent other user scripts from running. That sucks of course.
I think holdReady is probably the most reliable way to prevent scripts
from messing with your DOM, although I defer to Krinkle for a more
authoritative answer. Writing an extension allows you to contrrol
where WikiPraise's <script> tag will be put, but I'm not sure how much
that'll help you.
Do you need the clean DOM just for reading, or for writing as well? If
you only need a clean DOM for reading and can write even to a dirty
DOM, there are some alternatives:
* hold the ready "lock" only for cloning the DOM, then release it and
do your processing while other scripts run
* use AJAX to fetch the HTML source of the page, and work with that
It would be really nice if your blame engine didn't rely on character
offsets in the HTML, but used something more robust. As you said, the
preferred implementation would be something that's close to the parser
and puts extra annotations (like <span> tags) in the parser-generated
HTML (the InlineEditor extension does this). Server-side blaming
doesn't have to be expensive as long as you use an incremental
blame-as-you-go implementation where you store a blame map for each
revision, and after each edit you use the edit diff and the previous
revision's blame map to generate the new revision's blame map. This
should be a fairly cheap edit-time operation. You would need to
generate blame maps for all old revisions, though, but that could be
done offline on a few high-performance boxes before the feature is
even enabled.
Roan