', {'class':'alert shadow rounded alert-'+(sClass=='error'?'danger':sClass), role:'alert'})
.append(sMsg)
.appendTo($Box)
.slideDown('fast')
.delay(3000)
.slideUp('fast', function(){$(this).remove();});
}
};
function emptyBox(element, text)
{
//var textarea = $('#thoughts_form textarea[name="thoughts"]');
if(element.value == text)
{
element.value = '';
}
else if(element.value == '')
{
element.value = text;
}
}
function setHeight(element)
{
var padtext = element.value;
var height = Math.max(300, 130 + Math.round((padtext.length / 85 + padtext.split("\n").length) * 20));
//alert(height);
element.style.height = height+'px';
}
function addInput(form, name, type, value)
{
var registerInput = document.createElement('input');
registerInput.setAttribute('type', type);
registerInput.setAttribute('name', name);
registerInput.setAttribute('value', value);
document.forms[form].appendChild(registerInput);
}
function getInfo(action, fOnSuccess, vars, fOnError, sType/*, bProcessIcon*/)
{
if(!vars) vars = {};
sType = sType || 'GET';
//bProcessIcon = bProcessIcon || false;
//if(bProcessIcon) self.addBufferIcon();
vars['a'] = action;
$.ajax(
{
url: oCATC.consts.context.process_page,
type:sType,
data: vars,
dataType: 'json'
})
.done(function(oData)
{
if(oData.result==oCATC.consts.error)
{
if(!fOnError) console.log(oData.desc);
else fOnError(oData.desc);
}
else
{
//if(bProcessIcon) self.resetIcon();
fOnSuccess(oData.desc, oData.data);
}
})
.fail(function(jqXHR, textStatus, errorThrown)
{
//if(bProcessIcon) self.resetIcon();
if(!fOnError) console.log(textStatus+' '+errorThrown);
else fOnError(textStatus);
});
}
function feedback(sClass, sMsg, $Box)
{
$Box = $Box || $('#feedback');
sMsg = sMsg || '';
switch(sClass) {
case 'notice': sClass = 'primary'; break;
case 'error': sClass = 'danger'; break;
}
if(sClass=='error' && sMsg=='') sMsg = 'Oops ! An unknown error occured';
$('
', {'class':'alert shadow alert-dismissible fade show alert-'+sClass, role:'alert'})
.append($('
', {'class':'fal fa-inline fa-'+sClass}))
.append(addPunctuation(sMsg))
.append($('