Glad you got it working Philip, I was just coming on to give you a screenshot of the console with it in, but I see that Ryan gave you the same tip. Pleased you have it working. With at least two of us having successfully implemented this fix for the preview/publish, you would have thought that it is going to work for everyone.
Have a good weekend!