//----------------------------------------------------------------- // CONFIGURAÇÕES URL E PATHS //----------------------------------------------------------------- var Dados = { BASE_URL :'http://joparseguros.com.br/', IMG_URL :'http://joparseguros.com.br/img/' }; $.fn.extend({ serializeUni: function() { return jQuery.param( this.serializeArrayUni() ); }, serializeArrayUni: function() { var rselectTextarea = /select|textarea/i; var rinput = /text|hidden|password|search/i; var rCRLF = /\r?\n/g; return this.map(function(){ return this.elements ? jQuery.makeArray( this.elements ) : this; }) .filter(function(){ return this.name && !this.disabled && ( this.checked || rselectTextarea.test( this.nodeName ) || rinput.test( this.type ) ); }) .map(function( i, elem ){ var val = $(this).uni2ent(jQuery( this ).val()); return val == null ? null : jQuery.isArray( val ) ? jQuery.map( val, function( val, i ){ return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; }) : { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; }).get(); }, uni2ent: function (srcTxt) { var entTxt = ''; var c, hi, lo; var len = 0; for (var i=0, code; code=srcTxt.charCodeAt(i); i++) { var rawChar = srcTxt.charAt(i); // needs to be an HTML entity if (code > 255) { // normally we encounter the High surrogate first if (0xD800 <= code && code <= 0xDBFF) { hi = code; lo = srcTxt.charCodeAt(i+1); // the next line will bend your mind a bit code = ((hi - 0xD800) * 0x400) + (lo - 0xDC00) + 0x10000; i++; // we already got low surrogate, so don't grab it again } // what happens if we get the low surrogate first? else if (0xDC00 <= code && code <= 0xDFFF) { hi = srcTxt.charCodeAt(i-1); lo = code; code = ((hi - 0xD800) * 0x400) + (lo - 0xDC00) + 0x10000; } // wrap it up as Hex entity c = "" + code.toString(16).toUpperCase() + ";"; } else { c = rawChar; } entTxt += c; len++; } return entTxt; }, charCount: function(options) { var oEL = $(this[0]); // default configuration properties var defaults = { allowed: 140, warning: 25, css: 'counter', counterElement: 'span', cssWarning: 'warning', cssExceeded: 'exceeded', counterText: '', tipo: 'textarea' }; var options = $.extend(defaults, options); function calculate(){ if(options.tipo == 'editor'){ var editor = '.sceditor-container iframe'; this.editor=editor; var count = $(editor).contents().find('body').text().length; } else { var count = $(oEL).val().length; } var available = options.allowed - count; if(available <= options.warning && available >= 0){ $(oEL).next().addClass(options.cssWarning); } else { $(oEL).next().removeClass(options.cssWarning); } if(available < 0){ $(oEL).next().addClass(options.cssExceeded); } else { $(oEL).next().removeClass(options.cssExceeded); } $(oEL).next().html(options.counterText + available); }; this.each(function() { $(oEL).after('<'+ options.counterElement +' class="' + options.css + '">'+ options.counterText +''+ options.counterElement +'>'); calculate(); if(options.tipo == 'editor'){ $(editor).contents().keyup(function(){calculate()}); $(editor).contents().change(function(){calculate()}); } else { $(oEL).keyup(function(){calculate()}); $(oEL).change(function(){calculate()}); } }); } }); //---------------------------------------------------------------------------------- // JQUERY SCRIPTS PERSONALIZADOS //---------------------------------------------------------------------------------- var fnp = { // FUNCAO PADRÃO PARA AVISAR QUE APENAS UM ELEMENTO DEVE SER SELECIONADO NO CHECKBOX check_elementos : function(path,act,elID,formID,rID,colorboxShow){ $(elID).live('click', function(){ if($("input[name='opcoes[]']:checked").length == 1){ var data = $(this).attr('data-act'); fnp.form(path,act,data,formID,rID,colorboxShow); } else { $.colorbox({transition: 'none', html: '