apps.json commit remember position of column titles (8ab0160)
   1document.addEventListener("DOMContentLoaded", function() {
   2    chrome.management.getAll(getAllCallback);
   3  });
   4  
   5  var getAllCallback = function(list) {
   6        chrome.storage.sync.get({
   7        "showApps": true
   8        }, function(items) {
   9                if (items["showApps"] == true) {
  10                        var apps = document.getElementById("apps");
  11
  12                        function isEnabledApp(x) {
  13                                 return x.isApp;
  14                        }
  15                        list = list.filter(isEnabledApp);
  16                        for(var i=0;i<list.length;i++) {
  17                          // we don't want to do anything with extensions
  18                          var extInf = list[i];
  19                          if(extInf.isApp && extInf.enabled) {
  20                                var app = document.createElement("div");
  21
  22                                var img = new Image();
  23                                img.className = "image";
  24                                img.src = find128Image(extInf.icons);
  25                                img.addEventListener("click", (function(ext) {
  26                                  return function() {
  27                                    chrome.management.launchApp(ext.id);
  28                                        window.close();
  29                                  };
  30                                })(extInf));
  31
  32                                var name = document.createElement("div");
  33                                name.className = "name";
  34                                name.textContent = extInf.name;
  35
  36                                app.className = "app";
  37                        app.setAttribute("data-id", i+1);
  38                                app.appendChild(img);
  39                                app.appendChild(name);
  40                                apps.appendChild(app);
  41                          }
  42                        }
  43                }
  44        });
  45  };
  46
  47  var find128Image = function(icons) {
  48    for(var icon in icons) {
  49      if(icons[icon].size == "128") {
  50        return icons[icon].url;
  51      }
  52    }
  53
  54    return "/noicon.png";
  55};