Skip to content
Kyle Szombathy edited this page Dec 12, 2015 · 1 revision

I'm just going to make this super quick and copy from a hackathon application I wrote to describe exactly what was done here if the comments in the code aren't clear enough.

Here goes:

RateMyCSUS – A Chrome Extension for CSUS Students http://kyleszombathy.com/RateMyCSUS.html A project I worked on to help students choose classes. It injects RateMyProfessor ratings into the Sac State Student Center. I use it myself whenever choosing classes and have received many great compliments on its effectiveness. · Modifies the HTML DOM of Sac States Student Center, creating user interface elements to show RateMyProfessor ratings. · Bypasses Chrome’s CSP to retrieve RMP ratings without an API by extensive use of AJAX, Regex, and Chrome’s API. · Uses JavaScript and jQuery throughout, along with jQuery UI and qTip2 tooltips to display ratings. I loved working on my RateMyCSUS Chrome Extension. Choosing classes can be extremely difficult and getting a good professor can make a huge difference. I made the tool as a kind of community service project to other Sac State students. I think technology should aid us and act as a tool in getting things done. My approach on this was to build a tool for something that was difficult to do in its current state.

First I needed to find a way to pull all professor names from Sac States website. This was a challenge because the site content was displayed in iframes. I used timers to detect when the iframe changed. Once a change was detected I searched for professors within the iframes HTML themselves. I was able to push changes to the iframes as well, making the next steps possible.

RateMyProfessor didn't have an API so I needed a way to bypass cross origin policy in order to scrape RateMyProfessors pages. I found I could do this with a AJAX get request in the background thread of the extension. I did two AJAX requests per teacher. First to search RateMyProfessor with the teachers name and the second to get the actual ratings. I searched for the data needed with regex. Using regex proved to be more future proof because it ensured that if RateMyProfessor ever changed their page content, the regex would still pick out the data needed.

Instead of using a server side solution (not natively possible with a chrome extension) I decided to load all content dynamically on the user side. In order to increase and spread out load times, I initiated each data request on a mouse over event for each professor name. When the user moused over a professor name, the ratings for that professor loaded dynamically in under a second.

Clone this wiki locally