blob: 6de31dcd77a3604dbe355874d2c47d04c1a544e9 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2014-2015 Eclipse Foundation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Christopher Guindon (Eclipse Foundation)
* Denis Roy (Eclipse Foundation)
*******************************************************************************/
jQuery(document).ready(function() {
$(".hipp-control-action-link").click(function(e) {
e.preventDefault();
var action = $(this).data("action");
var shortname = $(this).data("shortname");
var projectid = $(this).data("projectid");
if(action != "readme") {
$("#" + shortname + "_state").html("");
}
$.post("control_hipp/index.php", {action: action, project: projectid })
.done(function(data) {
var output = data;
var regexp = /^token:/;
if (regexp.test(data)) {
var token = data.split(":");
var output = "<i class=\"fa fa-spinner fa-spin\"></i>";
var timer, delay = 5000;timer = setInterval(function(){
$.post("control_hipp/index.php", { action: "check", token: token[1] })
.done(function(html){
$("#" + shortname + "_instance").html(html);
})
},delay);
};
if(action == "readme") {
output = output.replace(/\n/g, "<br />");
$("#" + shortname + "_readme").html(output);
}
else {
$("#" + shortname + "_instance").html(output);
}
});
});
});