Thursday, June 2, 2016

Finished the Stack Exchange review attribution helper

Yesterday, I wrote a good chunk of StackReviewAttrib, a tool to create a references/attribution list for reviewed posts at Stack Exchange. Today I worked out the bugs and wrote the Chrome extension.

The problem with the WebBrowser control was challenging to fix. The DocumentText property doesn't seem to update as JavaScript does its work. Instead, I had to use this:

Document.GetElementsByTagName("html")(0).OuterHtml

I also added a 1.5 second wait between the DocumentCompleted event firing and the accessing of that property to make sure that all script had time to finish. I then fixed some minor glitches in the final HTML output renderer and addressed some edge cases in the review items (like an answer being deleted).

The only hiccups in the construction of the Chrome extension were Chrome's security policies. I had to wire up all event handlers in the extension's icon popup via JavaScript without having any JavaScript literals in the HTML page.

The code for both components is now on GitHub.

No comments:

Post a Comment