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;

Microsoft Plans Quick Fix for IE

As a webdeveloper I know a lot about Internet Explorer.

The number of security issues it has and the none standards complient way it renders webpages often makes me wish they would say “You know what, lets just stop making browsers, we clearly aren’t up to the task, lets just suggest everyone go and get firefox instead”

But instead they suggest this useless list of tips:

Continue reading

Using iDrive But Stop iDriveMonitor Autostarting

I like iDrive. It quietly keeps my selected folders backed up. But this isn’t a review of iDrive, it’s instructions for how to use iDrive but stop the iDriveMonitor application from forcing itself to the front of the startup queue when you login.

It took me a while to get to the bottom of the problem after I started delaying application launch to ease memory use on startup.

I knew I needed iDriveMonitor to start at login, but I didn’t want it to start first because it seems to bog down os x when started along with multiple other apps.

But if I removed it from the login items and manually started it, it automatically added itself back to my Login Items. There is no option to stop it doing this built into iDrive. How annoying.

Continue reading