Getting the code structure ready

Let's begin by defining the structure of the JavaScript object that we will need to perform various tasks. Open the js/dashboard.js file and write the following code:

$(document).ready(function()
{
  var dashboard = 
  {
    imageArr : [],
    init : function()
    {
      this.initPortlets();
      this.initSharing();
      this.initFlickr();
      this.initReddit();
      this.setupWeather();
      this.setupImageSelector();
    },
    initPortlets : function()
    {
    },
    initSharing : function()
    {
    },
    initFlickr : function()
    {
    },
    initReddit : function()
    {
    },
    setupWeather : function()
    {
    },
    setupImageSelector : function()
    {
    }
  }
  dashboard.init();
});

We start off by creating a dashboard object and defining an array named imageArr and six methods. The imageArr array will be populated ...

Get Mastering jQuery UI now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.