Harry Bailey

Agency focused strategist, Agile coach and champion of humans

Twitter ‘patch’ the “don’t click” virus with one line of code

Before I get started, I would just like to confirm there is absolutely no reason to change your Twitter password. That’s right. Your password is safe even if you fell for the don’t click scam.

A harmless virus has been seen on Twitter over the last couple of weeks. It manifests itself as a tweet from someone which simply reads ‘Don’t click {link}’
If you are logged into twitter and you click the link, followed by a link on the following page which also reads ‘Don’t click’ then an identical message is posted without your knowledge to your own feed.

Continue reading

Hide / Remove Info Window / Bubble for Embedded Google Maps

A quick note added in February 2011. Google has now removed the iwloc part of the url in most cases. To remove the pin, you can now add &iwloc=near to the end of the iframe src attribute. So….

<iframe width=”300″ height=”300″ frameborder=”0″ scrolling=”no” marginheight=”0″ marginwidth=”0″ src=”http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=manchester&aq=&sll=53.41654,-2.236788&sspn=0.033864,0.090294&ie=UTF8&hq=&hnear=Manchester&t=h&z=12&ll=53.480712,-2.234376&output=embed“></iframe>

…would become…

<iframe width=”300″ height=”300″ frameborder=”0″ scrolling=”no” marginheight=”0″ marginwidth=”0″ src=”http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=manchester&aq=&sll=53.41654,-2.236788&sspn=0.033864,0.090294&ie=UTF8&hq=&hnear=Manchester&t=h&z=12&ll=53.480712,-2.234376&output=embed&iwloc=near“></iframe>

Thanks to John below for pointing this out

Old information:

Google have tweaked things again. Here is the latest way (March 2009) to embed a map including a location pin without the annoying info window or info bubble showing above it and ruining the maps centre location.

This is particularly important if you are using a small sized map less than around 400px square.

Continue reading

Facebook FBJS basics

Just a post about the most basic parts of Facebook built in canvas Javascript library which they has called FBJS (Facebook Javascript).

To protect themselves from the more evil developers Facebook have introduced Javascript in a limited and controlled way. You can still do most things you can in Javascript but mainly using getter and setter function.

Accessing elements and walking the DOM

You can still use many of the standard methods for accessing and navigating the DOM.

document.getElementById(id) // as you would expect
document.getRootElement() // gets the highest dom tree element accessible to canvas page developers
document.creatElement('DIV') // would create a new div element
document.getElementsByTagName('DIV') // returns all div elements

I would suggest setting up a base function to save yourself some repetition

function byId(id)
{
    return document.getElementById(id)||false;
}

Facebook use getters and setters for many Javascript functions including

byId('id').getNextSibling(); // same as .nextSibling;
byId('id').getPreviousSibling(); // same as .previousSibling;
byId('id').getFirstChild(); // same as .firstChild;
byId('id').getLastChild(); // same as .lastChild;
byId('id').getParentNode(); // same as .parentNode;
byId('id').getChildNodes(); // same as .childNodes;

Manipulating Elements

byId('id').appendChild(node); // as .appendChild(node);
byId('id').insertBefore(node,caret); // as .insertBefore(node,caret);
byId('id').removeChild(node); // as .removeChild(node);
byId('id').replaceChild(node);
byId('id').cloneNode(tree); // as .cloneNode(tree);

Manipulating Tags and Attributes

byId('id').setTextValue(text); // innerHTML with text only

byId('id').setValue(value); // as .value=newValue;
byId('id').getValue(); // as .value;