forked from science-ation/science-ation
78 lines
1.7 KiB
JavaScript
78 lines
1.7 KiB
JavaScript
//useful function that we'll be using throughout
|
|
function confirmClick(msg)
|
|
{
|
|
var okay=confirm(msg);
|
|
if(okay)
|
|
return true;
|
|
else
|
|
return false;
|
|
}
|
|
|
|
function el(str,domain,name)
|
|
{
|
|
document.write('<a href="ma'+'il'+'to:' + str + '@' + domain + '">' + name + '</a>');
|
|
}
|
|
|
|
function em(str,domain)
|
|
{
|
|
document.write('<a href="ma'+'il'+'to:' + str + '@' + domain + '">' + str + '@' + domain + '</a>');
|
|
}
|
|
|
|
var anyFieldHasBeenChanged=false;
|
|
|
|
function fieldChanged()
|
|
{
|
|
anyFieldHasBeenChanged=true;
|
|
}
|
|
|
|
function confirmChanges()
|
|
{
|
|
if(anyFieldHasBeenChanged)
|
|
{
|
|
var okay=confirm('<?=i18n("You have unsaved changes. Click \"Cancel\" to return so you can save your changes, or press \"OK\" to discard your changes and continue")?>');
|
|
if(okay)
|
|
return true;
|
|
else
|
|
return false;
|
|
}
|
|
else
|
|
return true;
|
|
}
|
|
|
|
var _notice_id = 0;
|
|
function notice_delete(id)
|
|
{
|
|
$("#notice_"+id).slideUp('slow', function() {
|
|
$("#notice_"+id).remove();
|
|
});
|
|
}
|
|
|
|
function notice_create(type,str,timeout)
|
|
{
|
|
if(timeout == -1) timeout = 5000;
|
|
_notice_id++;
|
|
$("#notice_area").append("<div id=\"notice_"+_notice_id+"\" class=\""+type+"\" >"+str+"</div>");
|
|
$("#notice_"+_notice_id).show('puff');
|
|
$("#notice_"+_notice_id).fadeTo('fast', 0.95);
|
|
setTimeout("notice_delete("+_notice_id+")", timeout);
|
|
}
|
|
|
|
function notice_(str)
|
|
{
|
|
notice_create('notice',str,-1);
|
|
}
|
|
|
|
/* Stuff to do after the document loads */
|
|
$(document).ready(function()
|
|
{
|
|
/* Do label/input styles on all edit tables */
|
|
$(".editor tr td:first-child").addClass('label');
|
|
$(".editor tr td:nth-child(2)").addClass('input');
|
|
|
|
/* Stripe tableviews */
|
|
$(".tableview tr:even").addClass('even');
|
|
$(".tableview tr:odd").addClass('odd');
|
|
});
|
|
|
|
|