Skip to content

Commit

Permalink
remove the event handlers after installing the css so it doesn't get …
Browse files Browse the repository at this point in the history
…duplicated if a thread is refreshed.
  • Loading branch information
arhughes committed Mar 22, 2010
1 parent 700455b commit 9232941
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions init_events.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ Event.prototype.addHandler = function(callback)
this.eventHandlers.push(callback);
}

Event.prototype.removeHandler = function(callback)
{
var index = this.eventHandlers.indexOf(callback);
if (index >= 0)
this.eventHandlers.splice(index, 1);
}

Event.prototype.raise = function(arg1, arg2, arg3)
{
for (var i = 0; i < this.eventHandlers.length; i++)
Expand Down
7 changes: 7 additions & 0 deletions scripts/highlight_original_poster.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ settingsLoadedEvent.addHandler(function()
css += " { " + HighlightOriginalPoster.css + " }";
insertStyle(css);
}
HighlightOriginalPoster.uninstall();
},

uninstall: function()
{
processPostEvent.removeHandler(HighlightOriginalPoster.gatherCss);
fullPostsCompletedEvent.removeHandler(HighlightOriginalPoster.installCss);
}

}
Expand Down

0 comments on commit 9232941

Please sign in to comment.