text: function loadApps() {
      var url = new URL(window.location.href);
      var identifier = url.searchParams.get("identifier");
      $.getJSON('/loadBuildList?identifier=' + identifier, function(appList) {
          var items = [];
          $.each(appList, function(key, val) {
              items.push('<div class="app-link">' +
              '<div class="app-target">' + val.name + ' (' + val.target + ') ' + val.version + ' (' + val.build + ') ' + '</div>' +
              '<div class="app-bundle">' + val.identifier + '</div>' +
              '</div>'
              );
          });
          $("#apps-container").html(items);
      });
  }
  
  function initDropArea() {
      var dropArea = $("#drop-container");
      dropArea[0].ondragover = function() {
          dropArea.addClass('hover');
          dropArea.removeClass('error');
          dropArea.removeClass('drop');
          dropArea.removeClass('success');
          dropArea.text('Drop your .ipa file here');
          return false;
      };
  
      dropArea[0].ondragleave = function(event) {
          dropArea.removeClass('hover');
          return false;
      };
  
      dropArea[0].ondrop = function upload(event) {
          event.preventDefault();
          dropArea.removeClass('hover');
  
          var file = event.dataTransfer.files[0];
  
          if (!file.name.endsWith(".ipa")) {
              dropArea.text('Not an .ipa file');
              dropArea.addClass('error');
              return false;
          }
  
          if (file.size > 500000000) { // 500Mb
              dropArea.text('File is to large!');
              dropArea.addClass('error');
              return false;
          }
  
          dropArea.addClass('drop');
  
          var data = new FormData();
          data.append('file', file);
  
          jQuery.ajax({
              xhr: function() {
                  var xhr = new window.XMLHttpRequest();
                  xhr.upload.addEventListener("progress", function(evt){
                      if (evt.lengthComputable) {
                          var percent = 100 * evt.loaded / evt.total;
                          dropArea.text('Loading: ' + percent.toFixed(1) + '%');
                      }
                  }, false);
  
              return xhr;
            },
              url: '/upload',
              data: data,
              cache: false,
              contentType: false,
              processData: false,
              method: 'POST',
              success: function(data) {
                  dropArea.text('Upload completed');
                  dropArea.addClass('success');
                  dropArea.removeClass('drop');
              },
              fail: function(data) {
                  dropArea.text('Error');
                  dropArea.addClass('error');
                  dropArea.removeClass('drop');
              }
          });
  
          return false;
      }
  }
  
  function onLoad() {
      this.loadApps();
      this.initDropArea();
  }