Book Image

Mastering jQuery UI

By : Vijay Joshi
Book Image

Mastering jQuery UI

By: Vijay Joshi

Overview of this book

Table of Contents (19 chapters)
Mastering jQuery UI
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Getting the code structure ready


As we did in previous chapter, Chapter 3, Creating a Website Tour, we will use the object literal pattern to keep our code manageable and inside a single object. We will define an object named myReddit, inside which there will be properties and methods (they can be called members as well) to create our news reader. Let's start by writing the code for the same in the myReddit.js file:

var myReddit = 
{
  apiURL : 'http://www.reddit.com',
  tabCount : 1,
  init : function()
  {
  },
  getJSONFromAPI : function(type, id)
  {
  },
  createTab : function(subredditName, postList)
  {
  },
  getPostListingHtml : function(postListing)
  {
  },
  displayComments : function(data)
  {
  },
  getCommentsHTML : function(commentsList)
  {
  },
  htmlDecode : function(input)
  {
  }
};

$(document).ready(function()
{
  myReddit.init();
});

We created an object called myReddit with some members. Let's analyze these members one by one:

  • The first name value pair is apiURL. This...