From 3a4f8dc7980ddd9a18a5bf87a4374ef57647d69f Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Sat, 26 Mar 2011 17:46:59 -0400 Subject: Do not assign an anchor to an attachment flag if it already has one. Fix for https://bitbucket.org/ehsan/bugzilla-tweaks/issue/4/attachment-flag-link-doesnt-correctly-get --- data/js/bug-page-mod.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/data/js/bug-page-mod.js b/data/js/bug-page-mod.js index a75e776..561dda8 100644 --- a/data/js/bug-page-mod.js +++ b/data/js/bug-page-mod.js @@ -703,7 +703,9 @@ AttachmentFlagHandlerCtor.prototype = { if (!(id in this._interestingFlags)) continue; for (var j = 0; j < this._interestingFlags[id].length; ++j) { - if (flag.equals(this._interestingFlags[id][j])) { + // Take care to not assign an anchor to a flag which already has one + if (flag.equals(this._interestingFlags[id][j]) && + !("anchor" in this._interestingFlags[id][j])) { // found an interesting flag this._interestingFlags[id][j].anchor = this.anchorName; anchorsCreated.push(this.anchorName); @@ -1170,7 +1172,7 @@ function tbplbotSpamCollapser(d) { a.href = "#"; a.addEventListener("click", function(e) { e.preventDefault(); - var win = d.defaultView.wrappedJSObject; + var win = d.defaultView; var comments = d.querySelectorAll(".bz_comment"); for (var i = 0; i < comments.length; ++i) { var comment = comments[i]; -- cgit