// Traverse the bookmark tree, and print the folder and nodes.
function dumpBookmarks(query) {
  var bookmarkTreeNodes = chrome.bookmarks.getTree(
    function(bookmarkTreeNodes) {
      $('#bookmarks').append(dumpTreeNodes(bookmarkTreeNodes, query));
    });
}

function dumpTreeNodes(bookmarkNodes, query) {
  var list = $('<ul>');
  var i;
  for (i = 0; i < bookmarkNodes.length; i++) {
    list.append(dumpNode(bookmarkNodes[i], query));
  }
  return list;
}

function dumpNode(bookmarkNode, query) {
  if (bookmarkNode.title) {
    if (query && !bookmarkNode.children) {
      if (String(bookmarkNode.title).indexOf(query) == -1) {
        return $('<span></span>');
      }
    }
    var anchor = $('<a>');
    anchor.attr('href', bookmarkNode.url);
    anchor.text(bookmarkNode.title);
    /*
     * When clicking on a bookmark in the extension, a new tab is fired with
     * the bookmark url.
     */
    anchor.click(function() {
      chrome.storage.local.get(bookmarkNode.title, function(result) {
        if (result[bookmarkNode.title] != undefined) {
	  var obj = {};
	  obj[bookmarkNode.title] = result[bookmarkNode.title] + 1;
          chrome.storage.local.set(obj);
	}
      });
      chrome.tabs.create({url: bookmarkNode.url});
    });
    var span = $('<span>');
    span.append(anchor);
    chrome.storage.local.get(bookmarkNode.title, function(result) {
      if (result[bookmarkNode.title]) {
        span.append(result[bookmarkNode.title]);
      } else {
	var obj = {}
	obj[bookmarkNode.title] = 0
        chrome.storage.local.set(obj);
        span.append(0);
      }
    });
  }
  var li = $(bookmarkNode.title ? '<li>' : '<div>').append(span);
  if (bookmarkNode.children && bookmarkNode.children.length > 0) {
    li.append(dumpTreeNodes(bookmarkNode.children, query));
  }
  return li;
}

var alarmClock = {

        bookmark: "initial",

        onHandler : function(e) {
            chrome.storage.local.get(null, function(items) {
	      var allKeys = Object.keys(items);
              var randIndex = Math.floor(Math.random() * 100);
              alarmClock.bookmark = allKeys[randIndex];
              chrome.alarms.create(alarmClock.bookmark, {delayInMinutes: 0.1, periodInMinutes: 0.2} );
              window.close();
	    });
        },

        offHandler : function(e) {
            chrome.alarms.clear(alarmClock.bookmark);
            window.close();
        },

        setup: function() {
            var a = document.getElementById('alarmOn');
            a.addEventListener('click',  alarmClock.onHandler );
            var a = document.getElementById('alarmOff');
            a.addEventListener('click',  alarmClock.offHandler );
        }
};

document.addEventListener('DOMContentLoaded', function () {
  dumpBookmarks();
  alarmClock.setup();
});

@@ -1833,22 +1833,16 @@
 ck = %7B%0A%0A
-      
   bookma
@@ -1857,22 +1857,16 @@
 tial%22,%0A%0A
-      
   onHand
@@ -1881,32 +1881,24 @@
 nction(e) %7B%0A
-        
     chrome.s
@@ -1938,17 +1938,16 @@
 tems) %7B%0A
-%09
       va
@@ -1978,24 +1978,16 @@
 items);%0A
-        
       va
@@ -2033,24 +2033,16 @@
 * 100);%0A
-        
       al
@@ -2083,32 +2083,24 @@
 dex%5D;%0A      
-   
-     
 chrome.alarm
@@ -2172,32 +2172,24 @@
 es: 0.2%7D );%0A
-        
       window
@@ -2202,17 +2202,16 @@
 ();%0A
-%09
     %7D);%0A
     
@@ -2206,34 +2206,22 @@
     %7D);%0A
-      
   %7D,%0A%0A
-      
   offHan
@@ -2237,32 +2237,24 @@
 nction(e) %7B%0A
-        
     chrome.a
@@ -2287,24 +2287,16 @@
 kmark);%0A
-        
     wind
@@ -2313,24 +2313,12 @@
 ;%0A  
-      %7D,%0A%0A      
+%7D,%0A%0A
   se
@@ -2335,37 +2335,35 @@
 ion() %7B%0A    
-        var a
+var alarmOn
  = document.
@@ -2389,33 +2389,31 @@
 rmOn');%0A    
-        a
+alarmOn
 .addEventLis
@@ -2460,21 +2460,20 @@
     
-        var a
+var alarmOff
  = d
@@ -2516,17 +2516,16 @@
     
-        a
+alarmOff
 .add
@@ -2573,22 +2573,16 @@
 dler );%0A
-      
   %7D%0A%7D;%0A%0A

Fix code convention & Change variable name