thieman/github-selfies — pull request #33 by joeLepper (2014-04-02 05:00:22+00:00)
Title: Adds gif functionality to Chrome

So this is definitely a larger PR than I had originally hoped. Let me explain why.

I made one pass at this about a week ago and ended up so deep in spaghetti code that I couldn't dig myself out. So I ended up going back to square one and refactoring things to encapsulate function and state a bit more and eliminate all of the this / that / self shenanigans in lieu of a global config object (this has the added advantage of eliminating the long list of positional arguments that the GitHubSelfies object needed in favor of a more explicit object with named attributes).

I noted that there was a video element that seemed like we wanted to display, though it was not being shown. I went ahead and got that displayed, as it proved pretty hard to take a reasonable gif without being able to see myself moving. It would be nice in the future to make this a mirror so that movement is more natural.

After I cleaned that up I moved on to pulling styles out of JS as much as possible – taking advantage of the route-conditional stylesheets that Chrome extensions allow. This helps us keep our HTML strings more manageable in the JS, though because of the way that route-matching works I did have to add !important (eww) to a couple of the new-issue rules.

Once I was there I got back to adding in the gif functionality. You'll see a commit that includes a handful of files related to this. Beyond those it was a simple matter of adding in the `dynamicSelfie` functionality and adding a little bit of visual feedback about the progress of the recording.

I'm still dissatisfied with the way that some of the UI works – the progress bar doesn't move left-to-right on all routes, for example. And there are a handful of bugs surrounding the way that we add the buttons / videos to issues / PRs that are closed.

But I think that this PR constitutes a pretty good first version of the feature.