Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // In the order it is defined at myfile.js, which is loaded after jquery.js
- var generic_check = function (url, callback) {
- jQuery.getJSON(url, callback);
- };
- // Here there is a lot of experimentation on a trial and error basis... I had some
- // problem converting this from MochiKit (where I used a swap dom method) to jQuery
- var generic_display = function (id, url, am_an, tipo_plural, tipo_singular, tempo, dados) {
- var destino = jQuery("<div id='" + id + "'></div>");
- if (dados.quantidade > 1) {
- destino.append("<a href='" + url + "'>Há " + dados.quantidade +
- am_an + 's ' + tipo_plural + ' ' + tempo + "</a>");
- } else if (dados.quantidade == 1) {
- destino.append("<a href='" + url + "'>Há 1 " +
- am_an + tipo_singular + ' ' + tempo + "</a>");
- }
- if (dados.quantidade >= 1) {
- jQuery(id).replaceWith(destino);
- } else {
- jQuery(id).replaceWith('');
- }
- };
- var displayConcessoesPendentes = function (dados) {
- generic_display('concessoes-pendentes',
- '/pendencias/concessoes_pendentes/',
- 'registro',
- 'aguardando concessão',
- 'aguardando concessão',
- '',
- dados);
- };
- var checarConcessoesPendentes = function () {
- this.generic_check('/pendencias/checar_concessoes_pendentes/?' +
- 'tg_random=' + timestamp(),
- this.displayConcessoesPendentes);
- };
- var g2c = new Object();
- g2c.alertas = function() {
- this.timestamp = timestamp;
- this.generic_check = generic_check;
- this.generic_display = generic_display;
- this.checarAmostrasAguardandoLiberacao = checarAmostrasAguardandoLiberacao;
- this.checarAmostrasNaoFracionadas = checarAmostrasNaoFracionadas;
- this.checarAmostrasNaoRecebidas = checarAmostrasNaoRecebidas;
- this.checarAmostrasVencendo = checarAmostrasVencendo;
- this.checarConcessoesPendentes = checarConcessoesPendentes;
- this.displayAmostrasAguardandoLiberacao = displayAmostrasAguardandoLiberacao;
- this.displayAmostrasNaoFracionadas = displayAmostrasNaoFracionadas;
- this.displayAmostrasNaoRecebidas = displayAmostrasNaoRecebidas;
- this.displayAmostrasVencendo = displayAmostrasVencendo;
- this.displayConcessoesPendentes = displayConcessoesPendentes;
- }
Add Comment
Please, Sign In to add comment