summaryrefslogtreecommitdiffstats
path: root/script/custom.js
blob: 12e760afd666648db7033e4c7767fc8483207a28 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
function loadContent(elem, source)
{
	$(elem).html('<div class="progress progress-striped active"><div class="progress-bar" style="width:100%"><span class="sr-only">In Progress....</span></div></div>');
	$(elem).load(source);
}

function selectDir(obj)
{
	dirname = $(obj).parent().parent().find('td.isdir').text() + '/';
	console.log("CALLED! Dirname: " + dirname);
	$('td.fileEntry').each(function() {
		var text = $(this).text();
		if (text.length < dirname.length) return;
		if (text.substr(0, dirname.length) !== dirname) return;
		$(this).parent().find('.fileBox')[0].checked = obj.checked;
	});
}
*/

function updater(url, postdata, callback)
{
	var updateTimer = setInterval(function () {
		if (typeof $ === 'undefined')
			return;
		$.post(url, postdata, function (data, status) {
			if (!callback(data, status))
				clearInterval(updateTimer);
		}, 'json').fail(function (jqXHR, textStatus, errorThrown) {
			if (!callback(errorThrown, textStatus))
				clearInterval(updateTimer);
		});
	}, 1000);
}