')
.css({'float':e.css('float')});
e.wrap(caption).parent()
.append($('
')
.append($('
')
.attr('download', info.filename)
.attr('title', __('Download'))
)
);
e.data('wrapped', true);
}
});
};
getConfig = (function() {
var dfd = $.Deferred(),
requested = false;
return function() {
return dfd;
};
})();
$.translate_format = function(str) {
var translation = {
'd':'dd',
'j':'d',
'z':'o',
'm':'mm',
'F':'MM',
'n':'m',
'Y':'yy'
};
// Change PHP formats to datepicker ones
$.each(translation, function(php, jqdp) {
str = str.replace(php, jqdp);
});
return str;
};
$.sysAlert = function (title, msg, cb) {
var $dialog = $('.dialog#alert');
if ($dialog.length) {
$('#title', $dialog).html(title);
$('#body', $dialog).html(msg);
$dialog.show();
} else {
msg = msg.replace(/
/, "\n").replace(/<\/?\w+[^>]*>/g, '');
alert(title+':\n'+msg);
}
};
function __(s) {
if ($.oststrings && $.oststrings[s])
return $.oststrings[s];
return s;
}
$.clientPortal = true;
$(document).on('submit', 'form', function() {
// Reformat dates
$('.dp', $(this)).each(function(i, e) {
var $e = $(e),
d = $e.datepicker('getDate');
if (!d) return;
var day = ('0'+d.getDate()).substr(-2),
month = ('0'+(d.getMonth()+1)).substr(-2),
year = d.getFullYear();
$e.val(year+'-'+month+'-'+day);
});
});
$(document).on('click', '.link:not(a):not(.button)', function(event) {
var $e = $(event.currentTarget);
$('
').prop({href: $e.attr('href'), 'class': $e.attr('class')})
.hide()
.insertBefore($e)
.get(0).click(event);
});