Skip to content

Developer Diary

Gustaf Liljegren edited this page Apr 2, 2017 · 12 revisions

2017-04-02

After sacrificing a third week-end on this extension, I've now completed the 0.2.* milestone and I'm well into 0.3.*. There are some important tasks left, but it's mostly about details at this point. I've decided to scrap the idea of whitelistings for various reasons.

2017-03-31

I've just made the last commit in the 0.1.* milestone and I'm very happy about the result so far. In the next milestone, I'll work on the popup and the overall visual appearance. I managed to shrink down the background code with a series of code cleanups, but the content script grew a lot instead. Maybe I can save a few lines and add readability by using jQuery? jQuery would of course constitute more than half of the code, but it only adds 30 KB when packed into a .crx file (from 50 KB to 80 KB).

2017-03-26

Making a Chrome extension for YouTube is like hitting one showstopper after another. With today's overhaul I have solved the hardest one yet - dealing with the Show more button at the buttom of the comment section. There was no way to set up an event listener and intercept click events, because the button is not always there (if there are too few comments), or the comment secton may not be loaded yet (because it loads with a delay or not at all, depending on whether the user scrolls down). Rather than listening for click events, I was able to use the webRequest API to intercept the HTTP POST requests for more comments.

I also had a problem with the content script not loading (which I solved by making the content script match pattern less specific), and that the webRequest event listeners would get -1 for tabId (which seems to have solved itself).

Next up is to get the context menu working.

Clone this wiki locally