You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
redonate/public_html/static/script/script.js

64 lines
1000 B
JavaScript

$(function(){
$('.clickable').click(function(event)
{
if($(this).data('url'))
{
url = $(this).data('url');
if(event.which == 1)
{
if($(this).hasClass('external'))
{
window.open(url);
}
else
{
window.location = url;
}
event.stopPropagation();
return false;
}
else if(event.which == 2)
{
window.open(url);
event.stopPropagation();
return false;
}
}
});
$('.conditional').each(function(element){
var affected = $(this);
var target = $("#" + affected.data("conditional-element"));
var desired = $(this).data("conditional-value");
target.change(function(){
if($(this).val() == desired)
{
affected.show();
}
else
{
affected.hide();
}
});
if(target.val() == desired)
{
affected.show();
}
else
{
affected.hide();
}
});
$('button[type=submit]').mousedown(function(event){
if(event.which == 1)
{
$(this).closest('form').submit();
}
});
});