szurubooru/public_html/media/js/core.js
2013-10-14 00:25:40 +02:00

42 lines
705 B
JavaScript

if ($.when.all === undefined)
{
$.when.all = function(deferreds)
{
var deferred = new $.Deferred();
$.when.apply($, deferreds).then(function()
{
deferred.resolve(Array.prototype.slice.call(arguments, 0));
}, function()
{
deferred.fail(Array.prototype.slice.call(arguments, 0));
});
return deferred;
}
}
$(function()
{
$('.safety a').click(function(e)
{
e.preventDefault();
var aDom = $(this);
if (aDom.hasClass('inactive'))
return;
aDom.addClass('inactive');
var url = $(this).attr('href') + '?json';
$.get(url, function(data)
{
if (data['success'])
{
window.location.reload();
}
else
{
alert(data['errorMessage']);
}
});
});
});