The Fox Forum Chrome Plugin is available

Update: Turns out Chrome warns you that you are in Developer Mode when you start it up anytime you have an unsigned extension loaded. I had not closed all Chrome Windows when testing that. It’s not all that big a threat if you read the message. It’s only telling you that you have an unsigned extension loaded. But it is an annoyance as you get prompted every time you start Chrome. To avoid that you can go into the  extensions tab where you installed the extension and disable this extension when not needed. Another option is to install a parallel version of Chrome on your system and use that only for using non-secure things. Read up on Chrome Canary builds, which are cutting-edge versions of Chrome that install in a separate location than the release versions of Chrome and do not interact with each other.


For those who use the scripts I’ve developed you have been pasting those scripts into the console of your browser, or for you have discovered Chrome Snippets, still selecting to run the snippets. And you do that every time you go to a Fox Forum page or refresh the one you are one. I admire your persistence for those who do.

I get around this by using an Windows Application written in C# which uses a browser automation library called Selenium to launch Chrome for the Fox Forum. It then talks to that instance of Chrome and loads the relevant JavaScript code into the browser. It also does a few other things like managing my several 😉 Fox News accounts. It also will download every post for an article as well as do automated posting, what me do that???. Maybe a few other things I’ve forgotten too.

But I don’t want to provide a Windows Application as you should never run one written by someone you don’t trust. And why trust me? I rarely do.

So the alternative is to provide a Chrome Extension that you can use to load those scripts. You still have to trust me a bit but I can walk you through the code in it to show it’s not doing anything nefarious.

At this time I don’t have a Chrome Developer Account so can’t upload it to the store but can provide it as an unpacked extension and give you instructions on how to install it into your browser.

How the extension works

This is what you will see once installed; it’s the smiley one:

chrome-extension-in-tray-inactive

You’ll probably say, oh, good job. It don’t work! (Or for those with better grammar, it doesn’t work!). That’s because it is a Page Extension that is only loaded when a relevant page is loaded in your browser. So when you navigate to a Fox News page, voilà!, it will become active and look like this:

chrome-extension-in-tray

The benefit of a page extension is it does not load and take up resources except on Fox News pages and also is not running so has no access to anything in your browser on other pages.

Once you click it you see this, (kinda embarrassing but I’m not a U/I developer):

chrome-extension-popup

What this does is let you select which scripts to load and then “Apply” loads them into the current page.

“Save Options” stores the state of the check-boxes so the next time you come back they will be in that same state.

The next go-round will have an improvement so you can enable it to automatically run when a Fox Forum page is loaded. The reason it does not do that now is if you had the “Clean Page” option selected, it would remove the top banner from Fox News front page so you could not log in.  Plus for the initial release this is safer as it only acts on the current page and if you refresh or navigate away any changes made to the page are not retained.

What do you you need to do to get this running?

  1. Obtain the code
  2. Inspect the extension (I’ll call this step two but will explain it last for you impatient types)
  3. Install the extension in your browser

Obtaining The Code

The code is stored on GitHub in my project  FoxForumExtension (https://github.com/holly4/FoxForumExtension)

On that page you can download the code to your computer:

github-clone-or-download

This gives three ways to get the code:

  1. Developers familiar with git would use the “clone” option. This makes a copy of the repository on their system and then lets them change the code and push it back.
  2. “Open in Desktop” is only useful if you have the Github Desktop Application installed on your system.
  3. Others will use the “Download ZIP” option, which is what I will be describing.

Select Download ZIP and then pick a folder where you want the code to end up and copy the zip file you downloaded there,  in this case I am using c:\src\holly.

c-src-holly

You can see the name of the zip file was FoxForumExtension-master.zip. Most recent version of windows have the ability to unzip zip files built in, so right-click it and select “extract here”. If you are using a old version of windows or a mac you’ll have to figure out how to unzip the file yourself.

So now in the folder that was created all of the files for the extension were unzipped and you now have the code on your system!

chrome-extension-unzipped-files

Installing the extension in Chrome

Normally Chrome only allows installing extensions from the Chrome Store. Not that you have to pay for many of them but it’s a safety factor. For developers the option exists to load an extension from the file system. It’s how we load an extension while it is under development.

To do this start Chrome and go the the extensions page. An easy way is to type chrome://extensions/ into the address of the browser.

chrome-extension-load

Next you will have to check the the “Developer mode” checkbox and then press the “Load unpacked extension” button. Chrome will then open a folder-chooser in which you will navigate to the folder where you unpacked the files and press OK. Then you will now see the extension is loaded.

chrome-extension-loaded

Take the time now to uncheck the “Developer mode” box; it’s only needed to load the extension. Otherwise Chrome will nag you every time it starts that you are in development mode.

So now you should see the icon loaded for the extension in the upper right corner of Chrome. It will be grey as you are not on a Fox News page, but go back to the top of this document and follow the “How it works” section and try it out!

Inspect the extension

Presuming you are security cautious you skipped down to here before installing the extension. The good news if you did not is that the extension is only doing what was described, but here I will walk you through how you can know that. Let’s do it this way. Take all the files for the extension and copy them somewhere else and then as I explain them you can delete them and when done and we have no files left over then you know you’re safe.

README.MD and LICENSE

The README.MD and LICENSE file are text files that do what they describe. You can open them and look or even just delete them from the folder where the actual extension is before installing as they are not referenced by it.

manifest.json

Manifest.json is the most important file of any extension as it tells chrome what files it will load and what permissions are needed. If you look inside the file there are comments explaining what is being done. This extension needs permission to access tabs, storage and access to FoxNews.com.

In particular note that  some permissions that are not being asked for that would worry you are:

  • bookmarks/history – allow access to your bookmarks and/or history
  • clipboardRead/clipboardWrite – allow access to your system clipboard
  • cookies – allow access to browser cookies
  • desktopCapture – (not sure what this one does but sounds scary if not needed by what the extension does)
  • geolocation/identity – allows the extension to know where you are or who you are

There are something like 58 different permissions an extension can ask for and if you install one from the store then you will be asked if you want to give those permissions. Somewhere there is a permission to access your microphone or camera and if an extension that should not need access to those but wants it, run!

popup.css, popup.html, popup.js, smiley-icon-16.png

These four files make up the U/I of the extension. There are comments in them saying what the code is doing and it is not complex.

actionCleanPage.js, actionDisableScrolling.js, actionShowFilteredComments.js, actionShowLikerAvatars.js

These files contain the same code as provided separately before only each is now encapsulated in a function to be run when requested.

eventPage.js, listener.js

These two files vector requests from the U/I to run the content scripts provided in the actionXXX files.

jquery-3.1.1.slim.min.js

JQuery is a utility library that most web sites use. In particular, here it is being used to provide easier access by the code to the controls on the U/I. If you did open this file you would be totally confused. In particular, the “min” part in the name means that it has been compressed by removing the white space in there that could make it easier to read but still not all that understandable except to expert javascript developers, which certainly does not include me. The simplest way to verify that this file contains no malware is to replace it with a copy download from the JQuery project and at this link: Download the compressed, production jQuery 3.1.1 slim build.

You could also download it and use a file compare against what’s included with the extension, but as you are already downloading it anyway just replace what is there.

Now you should have no more files left in the folder to compare so install the extension and have fun!