Carl Topham

Blog posts

Creating a chrome extension that uses jQuery to manipulate the DOM of a page

There are plenty of tutorials and guides on how to make a chome extension and there are hundeds for jQuery manipulation of the DOM. There are also a few about using jQuery in a chome extension, but only for the popup window. There seems to be a lack of using jQuery to actually do something on a page.This is something that too me a while to get my head around and a bit of googling to figure out, so now it's time to share.

Create a folder for the extension files. It's probably best to name it after your extension so you can find it later on.

In a plain text editor such as Notepad, Textmate or TextEdit create 3 blank documents. You can save the files as manifest.json, background.js and background.html. Using your favorite image editing software create a png icon with a transparent background (20px x 20px should be ok for now). Chome should scale the icon for the different areas it shows. Later we can create different resolution icons and tell chome to use them.

Get a copy of jQuery. and add it to the folder.

In your folder you should now have the following files:

manifest.json
background.html
background.js
icon.png
jquery.min.js

Let's go over what each of the files will contain, and then what that does.

manifest.json

{
  "name": "jQuery DOM",
  "version": "1",
  "description": "Manipulate the DOM when the page is done loading",
  "background_page": "background.html",
  "browser_action": {
    "name": "Manipulate DOM",
    "icons": ["icon.png"],
    "default_icon": "icon.png"
  },
  "content_scripts": [ {
    "js": [ "jquery.min.js", "background.js" ],
    "matches": [ "http://*/*", "https://*/*"]
  }]
}

The important part of the manifest.json is:

"content_scripts": [ {
    "js": [ "jquery.min.js", "background.js" ],
    "matches": [ "http://*/*", "https://*/*"]
  }]

The js tells the extension to load jquery and then ...

Continue reading (permalink)

Posted in 'Web development'.

New Adobe apps for iPad and CS5.

Today I will be attempting to review Adobe Nav and Adobe Easel for the iPad.

First I'll cover Nav. This looks like a mighty handy app but there is one fatal floor to it's main feature. The toolbar… One hand is already on my mouse and my other hand is on my keyboard. Currently if I want to swap the foreground-background colour I just hit 'cmd-x' and it's done. To do this on the iPad I need to move one hand to the device and click it… Not much more effort, but an extra step… That's hardly streamlining workflow. The same goes for any other toolbar item, especially if I then need the keyboard to specify a corner radius or some other detail. So far the best use I have come across with Nav is the tab manager, because I get screenshots for each window which makes switching between untitled docs a breeze. This is the first version of the app and I'm pretty sure Adobe will be keen to enhance the app as time goes on.

Easel is more of a painting app for the iPad, similar in the basics to Brushes etc. The difference here is that I can paint away and then send that drawing to photoshop where I can do the finishing touches. This is a nice touch and I can see where this would be really handy. The only thing missing is the ability of sending even a flat image back from photoshop to the iPad. I like this app and I'm pretty sure some of you digital artists out there will be making some awesome drawings on it. I'm not sure who else will use this app though since Brushes and other painting apps are better at ...

Continue reading (permalink)

Posted in 'Design & Illustration'.