/* * Codificación UTF-8 * * FUNCIONES LLAMADAS A OPERACIONES: * buscar( objElemento ) * guardar( objElemento ) * cancelar( objElemento ) * insert( objElemento ) * deleted( objElemento ) * update( objElemento ) * cancelarVS( objElemento ) * okWS() * aceptarVS( objElemento ) * * FUNCIONES LLAMADAS A NEGOCIO: * callControllerJS( objElemento ) * loading( modo, message ) * * FUNCIONES MENSAJES: * showMessage( langCod, type, msg ) * showConfirm( id, codigo, descBreve, text, btnOk, btnCancel, destino, panel, claseM, destinoNO ) * * FUNCIONES CONTROL EVENTOS: * semaforoChange( funcion, objElemento ) * * getUrlParameter(sParam) * * REVIEW: * getRulesFilter(idFilter, claseM, panel) * createTree(idTree, node, multiple, url, claseM, destino, actualizaA, idForm) * select2.defaults(width, allowClear, closeOnSelect, placeholder, containerCssClass, dropdownCssClass) * validateDate(id, fecha, separador, mascara) * showLinkTree(id,linkRama) * popupwindow() */ /********************************************* / * FUNCIONES LLAMADAS A OPERACIONES /*********************************************/ /** * buscar: buscar del panel filtro * El elemento necesita tener los siguientes atributos si se crea de forma directa en html: * -> data-gvhFunction = 'buscar' * -> data-gvhClaseManejadora * -> data-gvhDestino * -> data-gvhPanelOn * -> data-gvhConfirm * -> data-gvhNewWindow * @access private * @var objElemento: componente botón que se ha pulsado */ gvh.buscar = function( objElemento ) { var idForm = objElemento.closest( 'form' ).attr( 'id' ); var panel = objElemento.attr( 'data-gvhPanelOn' ); var destino = objElemento.closest( 'form' ).attr( 'action' ); var claseM = objElemento.attr( 'data-gvhClaseManejadora' ); var id = objElemento.attr( 'id' ); var destinoLength = objElemento.attr( 'data-gvhDestino' ).length; if( destinoLength > 0 ) { destino = objElemento.attr( 'data-gvhDestino' ); } if( objElemento.attr( 'data-gvhConfirm' ) ) { var confirm = objElemento.attr( 'data-gvhConfirm' ); var vConfirm = confirm.split( '___' ); //showConfirm() - PARAMS: id, codigo, descBreve, text, btnOk, btnCancel, destino, panel, claseM, destinoNO gvh.showConfirm( id , vConfirm[0] , desescapeIGEPjs( vConfirm[1] ) , desescapeIGEPjs( vConfirm[2] ) , desescapeIGEPjs( vConfirm[3] ) , desescapeIGEPjs( vConfirm[4] ) , destino , panel , claseM ); } else { var idDiv = $( 'div' ).filter(' [data-gvhCWSource=CWFilter] ').attr( 'id' ); if( idDiv != undefined ) { gvh.getRulesFilter($('#'+idDiv)); } gvh.callControllerJS( objElemento ); } } /** * guardar: Enviar a negocio los datos del panel para ser guardados * El elemento necesita tener los siguientes atributos si se crea de forma directa en html: * -> data-gvhFunction = 'guardar' * -> data-gvhClaseManejadora * -> data-gvhDestino * -> data-gvhPanelOn * -> data-gvhConfirm * @access private * @var objElemento: componente botón que se ha pulsado */ gvh.guardar = function( objElemento ) { gvh.showConsoleMsg('log',' *** gvh_functions.js - gvh.guardar() '); gvh.showConsoleMsg('log',objElemento); var accionActivaP = 'accionActivaP_'+objElemento.closest( 'form' ).attr( 'id' ); var panel = objElemento.attr( 'data-gvhPanelOn' ); var idGuardar = objElemento.attr( 'id' ); var claseManejadora = objElemento.attr( 'data-gvhClaseManejadora' ); //var estadoPanel = $( '#P_'+panel+'[data-gvhClaseManejadora='+claseManejadora+']' ).attr( 'data-gvhestadopanel' ); var destino = objElemento.closest( 'form' ).attr( 'action' ); var destinoLength = objElemento.attr( 'data-gvhDestino' ).length; if( destinoLength > 0 ) { destino = objElemento.attr( 'data-gvhDestino' ); } var fields = gvh.fieldsRequired(objElemento); if( fields != '' ) { gvh.showMessage( 'gvhlang_msj901', 'alert', fields ); return; } // TODO : FALTA data-gvhConfirm con JSON var confirm = objElemento.attr( 'data-gvhConfirm' ); if( (confirm != '') && (confirm != undefined) ) { var vConfirm = confirm.split( '___' ); var destinoNO = objElemento.attr( 'data-gvhConfirmCancel' ); //showConfirm() - PARAMS: id, codigo, descBreve, text, btnOk, btnCancel, destino, panel, claseM, destinoNO gvh.showConfirm( idGuardar , vConfirm[0] , desescapeIGEPjs( vConfirm[1] ) , desescapeIGEPjs( vConfirm[2] ) , desescapeIGEPjs( vConfirm[3] ) , desescapeIGEPjs( vConfirm[4] ) , destino , panel , claseManejadora , destinoNO ); } else { gvh.callControllerJS( objElemento ); } } /** * cancelar: Cancelar la acción que se haya indicado realizar en el panel * El elemento necesita tener los siguientes atributos si se crea de forma directa en html: * -> data-gvhFunction = 'guardar' * -> data-gvhClaseManejadora * -> data-gvhDestino * -> data-gvhPanelOn * -> data-gvhConfirm * -> data-gvhNewWindow * @access private * @var objElemento: componente botón que se ha pulsado */ gvh.cancelar = function( objElemento ) { let modo = 'R'; let panel = objElemento.attr( 'data-gvhPanelOn' ); let claseM = objElemento.attr( 'data-gvhClaseManejadora' ); gvh.blockExit( true, modo, panel, claseM ); var destino = objElemento.attr( 'data-gvhDestino' ); if( (destino != 'cancelar') && (destino != '') ) { gvh.callControllerJS( objElemento ); } else { objElemento.loading( { message: 'Cancelando...' } ); setTimeout( 'window.top.location.reload()', 100 ); } } /** * insert: Inserción de los datos introducidos en el panel * El elemento necesita tener los siguientes atributos si se crea de forma directa en html: * -> data-gvhFunction = 'insert' * -> data-gvhClaseManejadora * -> data-gvhDestino * -> data-gvhPanelOn * -> data-gvhPatronPanel * -> data-gvhActSobre * @access private * @var objElemento: componente que lanza el evento de insertar */ gvh.insert = function( objElemento ) { gvh.showConsoleMsg('log', ' *** gvh_function.js - insert()' ); let patronPanel = objElemento.attr( 'data-gvhPatronPanel' ); let panelOn = objElemento.attr( 'data-gvhPanelOn' ); let destino = objElemento.attr( 'data-gvhDestino' ); let actuaSobre = objElemento.attr( 'data-gvhActSobre' ); let claseM = objElemento.attr( 'data-gvhClaseManejadora' ); if( panelOn != 'fil' && panelOn == actuaSobre ) { gvh.blockExit( false, 'I', panelOn, claseM ); } switch( patronPanel ) { case 'TR': gvh.callControllerJS( objElemento ); break; case 'simple': case 'maestro': case 'detalle': $( 'div[data-gvhpagina=block][data-gvhWindow='+gvh.ambito+']' ).hide(); if( (panelOn == 'fil') || ((destino != undefined) && (destino != '')) ) { gvh.callControllerJS( objElemento ); } else { gvh.formOnInsert(objElemento); } break; default: break; } } /** * deleted: Eliminar el registro(s) seleccionado(s) * El elemento necesita tener los siguientes atributos si se crea de forma directa en html: * -> data-gvhFunction = 'delete' * -> data-gvhClaseManejadora * -> data-gvhPanelOn * @access private * @var objElemento: componente que lanza el evento de eliminar */ gvh.deleted = function( objElemento ) { gvh.showConsoleMsg('log', ' *** gvh_function.js - deleted()' ); let id = objElemento.attr( 'id' ); let claseM = objElemento.attr( 'data-gvhClaseManejadora' ); let panelOn = objElemento.attr( 'data-gvhPanelOn' ); let panelJSON = panelOn.substr( 0, 3 ); let raizJSON = gvh.getRoot( claseM, panelJSON ); if( panelOn != 'fil' ) { gvh.blockExit( false, 'D', panelOn, claseM ); } switch( panelOn ) { case 'lis': case 'lisDetalle': let vSufijos = []; if( $('input:checkbox[id^=checkAll_'+panelOn+']').is(':checked') ) { gvh.formOnDelete( objElemento ); } else { $( 'input[data-gvhWindow='+gvh.ambito+'][id*=check_'+panelOn+']:checked' ).each( function() { let sufijo = $(this).attr( 'id' ).split('check_')[1]; let row = $(this).attr( 'data-gvhRow' ); let indiceJSON = gvh.indexDataJSON( raizJSON, row ); let estado = gvh.getStateReg(raizJSON,indiceJSON,'state'); if( estado == 'nada' ) { vSufijos.push( sufijo ); } } ); if( vSufijos.length > 0 ) { gvh.formOnDelete(objElemento); } else { gvh.showMessage( 'gvhlang_msj16', 'alert' ); } } break; case 'edi': case 'ediDetalle': var sufijo = ''; $( 'div[id*=pag_'+panelOn+'_]' ).each( function() { if( $(this).is( ':visible' ) ) { sufijo = $(this).attr( 'id' ).substring( 3, objElemento.attr('id').length ); } } ); gvh.formOnDelete(objElemento); break; default: break; } }//gvh.deleted /** * update: Modificar el registro(s) seleccionado(s) * El elemento necesita tener los siguientes atributos si se crea de forma directa en html: * -> data-gvhFunction = 'update' * -> data-gvhClaseManejadora * -> data-gvhPanelOn * @access private * @var objElemento: componente que lanza el evento de update */ gvh.update = function( objElemento ) { gvh.showConsoleMsg('log', ' *** gvh_function.js - update()' ); let id = objElemento.attr('id'); let claseM = objElemento.attr('data-gvhClaseManejadora'); let panelOn = objElemento.attr('data-gvhPanelOn'); let patronPanel = objElemento.attr('data-gvhPatronPanel'); let panelJSON = panelOn.substr(0,3); let raizJSON = gvh.datosJSON[claseM][panelJSON]; let actuaSobre = objElemento.attr('data-gvhActSobre'); /* if( panelOn != 'fil' && panelOn == actuaSobre ) { gvh.blockExit( false, 'W', panelOn, claseM ); }*/ switch( panelOn ) { case 'edi': case 'ediDetalle': //var sufijo = panelOn+'_0'; gvh.formOnUpdate(objElemento); break; case 'lis': case 'lisDetalle': if( patronPanel == 'simple' ) // Patrón tabular simple/maestro/detalle { let vSufijos = []; if( $('input:checkbox[data-gvhWindow='+gvh.ambito+'][data-gvhFunction=checkAll]').is(':checked') ) { gvh.formOnUpdate(objElemento); } else { $( 'input[data-gvhFunction=checkRow][data-gvhWindow='+gvh.ambito+'][data-gvhPanelOn='+panelOn+']:checked' ).each( function() { let gvhWindow = objElemento.attr( 'data-gvhWindow' ); if( gvh.ambito == gvhWindow ) { let sufijo = $(this).attr( 'id' ).split('check_')[1]; let row = $(this).attr( 'data-gvhRow' ); let raizJSON = gvh.getRoot( claseM, panelJSON ); let indiceJSON = gvh.indexDataJSON(raizJSON, row ); let estado = gvh.getStateReg(raizJSON,indiceJSON,'state'); if( estado == 'nada' ) { vSufijos.push( row ); } } } ); if( vSufijos.length > 0 ) { gvh.formOnUpdate(objElemento); } else { gvh.showMessage( 'gvhlang_msj16', 'alert' ); } } } else if ( patronPanel == 'TR' ) // Patrón Tabular-Registro { let filaCheck = false; $( 'input[data-gvhFunction=checkRow][data-gvhWindow='+gvh.ambito+'][data-gvhPanelOn='+panelOn+']:checked' ).each( function() { if( $(this).is( ':checked' ) ) { filaCheck = true; return false; } } ); if( filaCheck ) { gvh.callControllerJS( objElemento ); } else { gvh.showMessage( 'gvhlang_msj16', 'alert' ); } } else { gvh.showConsoleMsg('error', ' ¡¡Botón tooltip modificar no definido el tipo de panel!! ' ); } break; default: gvh.showConsoleMsg('error', ' ¡¡Botón tooltip modificar no asociado a ningún panel!! ' ); break; } }//gvh.update /** * cancelarVS: Cancelar la acción de la ventana de selección * El elemento necesita tener los siguientes atributos si se crea de forma directa en html: * -> data-gvhFunction = ['cancelarvs'] * -> data-gvhClaseManejadora * -> data-gvhDestino * -> data-gvhPanelOn * -> data-gvhConfirm * @access private * @var objElemento: componente botón que se ha pulsado */ gvh.cancelarVS = function( objElemento ) { let panel = objElemento.attr( 'data-gvhPanelOn' ); if( objElemento.attr('data-gvhConfirm') ) { let confirm = objElemento.attr( 'data-gvhConfirm' ); let vConfirm = confirm.split( '___' ); let destino = objElemento.attr( 'data-gvhDestino' ); let claseM = objElemento.attr( 'data-gvhClaseManejadora' ); let id = objElemento.attr( 'id' ); //showConfirm() - PARAMS: id, codigo, descBreve, text, btnOk, btnCancel, destino, panel, claseM, destinoNO gvh.showConfirm( id , vConfirm[0] , desescapeIGEPjs( vConfirm[1] ) , desescapeIGEPjs( vConfirm[2] ) , desescapeIGEPjs( vConfirm[3] ) , desescapeIGEPjs( vConfirm[4] ) , destino , panel , claseM ); } else { gvh.dialogWS.modal( 'hide' ); if( gvh.dialogIdWM.length <= 0 ) { gvh.ambito = 'gvhMain'; } else { gvh.ambito = 'gvhModal'; } } } /** * okWS: Aceptar la acción de la ventana de selección * @access private * @var actionOrigen: * @var fila: * @var panel: * @var fieldsSource: * @var fieldsWS: * @var claseMO: */ gvh.okWS = function(objElemento, actionOrigen, fila, panel, fieldsSource, fieldsWS, claseMO) { gvh.showConsoleMsg('log',' *** gvh_Function.js - okWS() '); // DATOS DE LA VENTANA SELECCIÓN // Clase manejadora de ventana selección var claseM_WS = objElemento.attr('data-gvhClaseManejadora'); // Datos JSON de la ventana de selección var raizJSON_WS = gvh.getRoot(claseM_WS,'lis'); var panelJSON = panel.substring(0,3); // DATOS DE LA VENTANA PADRE // Clase manejadora padre var ClaseMPadre = claseMO; gvh.showConsoleMsg('log',claseMO); var raizJSON = gvh.getRoot(claseMO,panelJSON); // Pág activa desde la que se ha invocado la ventana var indiceJSONPadre = 0; var regPadre = 0; if ((panel == 'lis') || (panel == 'lisDetalle')) { regPadre = $('#registroOrigen').val(); var indiceJSONPadre = gvh.indexDataJSON(raizJSON,regPadre); } // Datos JSON de la ventana padre // Estado panel padre, id campo var prefijo = "cam___"; var estado = "updated"; var modoPanelOn = objElemento.attr('data-gvhModoPanelOn'); if ((modoPanelOn == 'I') && (panel != 'fil')) { var prefijo = "ins___"; var estado = "inserted"; regPadre = raizJSON['panel']['pagActive']; }; // Var para marcar el panel como modificado var panelModif = false; var fieldActualiza = []; // Bucle de los campos a actualizar con los valores de la ventana de selección $.each(fieldsSource,function(index,value) { // Campo ventana padre var fSource = fieldsSource[index]; // Campo ventana de selección var fWS = fieldsWS[index]; // Cálculo del indiceJSON: registro seleccionado //var raizJSONWS = gvh.getRoot(claseM_WS,'lis'); var indiceJSONWS = gvh.indexDataJSON(raizJSON_WS,fila); //var indiceJSONWS = gvh.indexDataJSON(claseM_WS,'lis',fila); var newVal = gvh.getValue(raizJSON_WS,fWS,indiceJSONWS); var idSource = ''; // Actualización del objeto JSON de datos if (gvh.getExistField(raizJSON,fSource,indiceJSONPadre)) { gvh.setValue(raizJSON,fSource,indiceJSONPadre,newVal); if (panelJSON == 'fil') { idSource = gvh.getIdField(raizJSON,fSource,indiceJSONPadre); } else { idSource = prefijo+fSource+'___'+panel+'_'+regPadre; } $('#'+idSource+'[data-gvhClaseManejadora='+ClaseMPadre+']').val(newVal); gvh.setStateReg(raizJSON,estado,indiceJSONPadre); if ((panelModif == false) && (panelJSON != 'fil')) { idSource = gvh.getIdField(raizJSON,fSource,indiceJSONPadre); if ($('#'+idSource+'[data-gvhClaseManejadora='+ClaseMPadre+']').attr('readonly')) { panelModif = true; } } var funcion = ''; if ($('button[id='+value+']').attr('id')) { funcion = $('button[id='+value+']').attr('data-gvhFunction'); // Botón tooltip "updateField" } var actualizaA = $('#'+idSource+'[data-gvhClaseManejadora='+ClaseMPadre+']').attr('data-gvhActualizaA'); if (((actualizaA != 'undefined') && (actualizaA != undefined)) || (funcion == 'updateField')) { fieldActualiza.push(idSource); } } else { gvh.showConsoleMsg('error','¡¡¡ No existe el campo '+fSource+' para la clase manejadora '+claseM_WS); } }); if (fieldActualiza.length > 0) { $.each(fieldActualiza,function(index,value) { gvh.updateEvent($('#'+value+'[data-gvhClaseManejadora='+ClaseMPadre+']')); }); } gvh.dialogWS.modal('hide'); if (gvh.dialogIdWM.length <= 0) gvh.ambito = 'gvhMain'; else gvh.ambito = 'gvhModal'; } /** * aceptarVS: Aceptar la acción de la ventana de selección * El elemento necesita tener los siguientes atributos si se crea de forma directa en html: * -> data-gvhFunction = ['cancelarvs'] * -> data-gvhClaseManejadora * -> data-gvhDestino * -> data-gvhPanelOn * -> data-gvhConfirm * @access private * @var objElemento: componente botón que se ha pulsado */ gvh.aceptarVS = function(objElemento ) { gvh.showConsoleMsg('log',' *** gvh_Function.js - aceptarVS() '); gvh.showConsoleMsg('log',objElemento); let panel = objElemento.attr( 'data-gvhPanelOn' ); let panelActua = objElemento.attr( 'data-gvhPanelActua' ); if( objElemento.attr('data-gvhConfirm') ) { let confirm = objElemento.attr( 'data-gvhConfirm' ); let vConfirm = confirm.split( '___' ); let destino = objElemento.attr( 'data-gvhDestino' ); let claseM = objElemento.attr( 'data-gvhClaseManejadora' ); let id = objElemento.attr( 'id' ); //showConfirm() - PARAMS: id, codigo, descBreve, text, btnOk, btnCancel, destino, panel, claseM, destinoNO gvh.showConfirm( id , vConfirm[0] , desescapeIGEPjs( vConfirm[1] ) , desescapeIGEPjs( vConfirm[2] ) , desescapeIGEPjs( vConfirm[3] ) , desescapeIGEPjs( vConfirm[4] ) , destino , panel , claseM ); } else { let destino = objElemento.attr( 'data-gvhDestino' ); let fieldsWS = objElemento.attr( 'data-gvhFieldsWS' ).split( ',' ); let fieldsSource = objElemento.attr( 'data-gvhFieldsSource' ).split( ',' ); let action = $( '#actionOrigen' ).val(); let id = $( 'input:radio[name=vsRadio]:checked' ).attr( 'id' ); if( id == undefined ) { $.getJSON( gvh.urlLang, function( data ) { let cod = desescapeIGEPjs( data['gvhlang_msj16']['cod'] ); let title = desescapeIGEPjs( data['gvhlang_msj16']['title'] ); let descrip = desescapeIGEPjs( data['gvhlang_msj16']['descr'] ); } ) .done( function() { alertify.suggest( cod, title, descrip ); } ); } else { let fila = id.split('_')[2]; // check_Tabla1_1 let modoPanel = objElemento.attr( 'data-gvhModoPanelOn' ); let claseMOrigen = objElemento.attr( 'data-gvhClaseMOrigen' ); gvh.okWS(objElemento, action,fila,panelActua,fieldsSource,fieldsWS,claseMOrigen); } } }; /********************************** / * FUNCIONES LLAMADAS A NEGOCIO /**********************************/ /** * callControllerJS: Llamada a negocio con los datos del panel * El elemento necesita tener los siguientes atributos si se crea de forma directa en html: * -> data-gvhClaseManejadora * -> data-gvhDestino * -> data-gvhPanelOn * -> data-gvhConfirm * -> data-gvhNewWindow * @access private * @var objElemento: componente botón que se ha pulsado */ gvh.callControllerJS = function( objElemento ) { gvh.showConsoleMsg('log',' *** gvh_Function.js - callControlerJS()'); let className = objElemento.attr( 'class' ); if( className == 'btnTooltip' ) { return; } let id = objElemento.attr( 'id' ); let claseM = objElemento.attr( 'data-gvhClaseManejadora' ); let panel = objElemento.attr( 'data-gvhPanelOn' ); let objPanel = $('#P_'+panel+'[data-gvhClaseManejadora='+claseM+']'); let destino = objElemento.attr( 'data-gvhDestino' ); let newWindow = objElemento.attr( 'data-gvhNewWindow' ); let confirmacion = objElemento.attr( 'data-gvhConfirm' ); // Averiguar si debemos comprobar los datos del formulario let checkForm = false; let estado = 'R'; const regex = /^.*checkForm=(0|1|true|false).*$/i; let m; if( (m = regex.exec(destino)) !== null ) { checkForm = m[1]; } checkForm = !(checkForm == false); // Obtenemos el estado del panel (=lectura/escritura/inserción/...) estado = $('#'+gvh.ambito).attr( 'data-gvhEstadoPanel' ); $( 'div[id^=P_][data-gvhWindow='+gvh.ambito+']' ).map( function() { let estadoPanel = $(this).attr( 'data-gvhEstadoPanel' ); if ( (estadoPanel != 'R') || (estado == undefined) ) { estado = estadoPanel; } }); // Comprobamos si el panel ha sido modificado let changed = false; if( objPanel.length > 0 ) { let gvhchanged = objPanel.attr( 'data-gvhchanged' ); if (typeof gvhchanged !== typeof undefined && gvhchanged !== false) { if( gvhchanged == 'true' || gvhchanged == '1' ) { changed = true; } } } //console.log( 'Changed!!! : ' + changed ); if( confirmacion ) { var vConfirm = confirmacion.split( '___' ); //showConfirm() - PARAMS: id, codigo, descBreve, text, btnOk, btnCancel, destino, panel, claseM, destinoNO gvh.showConsoleMsg('log',' ** showConfirm() '); gvh.showConsoleMsg('log',' id => '+id); gvh.showConsoleMsg('log',' codigo => '+vConfirm[0]); gvh.showConsoleMsg('log',' descBreve => '+desescapeIGEPjs( vConfirm[1] )); gvh.showConsoleMsg('log',' text => '+desescapeIGEPjs( vConfirm[2] )); gvh.showConsoleMsg('log',' btnOk => '+desescapeIGEPjs( vConfirm[3] )); gvh.showConsoleMsg('log',' btnCancel => '+desescapeIGEPjs( vConfirm[4] )); gvh.showConsoleMsg('log',' destino => '+destino); gvh.showConsoleMsg('log',' panel => '+panel); gvh.showConsoleMsg('log',' claseM => '+claseM); gvh.showConsoleMsg('log',' *********** '); gvh.showConfirm( id , vConfirm[0] , desescapeIGEPjs( vConfirm[1] ) , desescapeIGEPjs( vConfirm[2] ) , desescapeIGEPjs( vConfirm[3] ) , desescapeIGEPjs( vConfirm[4] ) , destino , panel , claseM ); } //else if( estado == 'R' || !changed || !checkForm ) else { objElemento.controllerJS( { id: id , claseM: claseM , panel: panel , destino: destino , newWindow: newWindow , confirm: '' , message: 'cargando' } ); //gvh.controllerJS(id, panel, destino, claseM, newWindow, '', 'cargando'); } /*else { console.error( ' ¡¡¡ El panel está en modo activo (W/I) hay que acabar la acción o cancelarla para poder cambiar de panel!!! ' ); gvh.showMessage( 'gvhlang_msjUI', 'alert' ); }*/ } /** * loading: Muestra el cargando * @access private * @var modo: activar o desactivar ['on'|'off'] * @var message: cadena de texto si se quiere particularizar el mensaje "cargando" */ gvh.loading = function( modo, message ) { if( modo != 'on' ) { $( '#load-cover' ).hide(); $( '#load' ).hide(); $( '#load-cover' ).remove(); $( '#load' ).remove(); return; } if( $('#load-cover').length > 0 ) { $( '#load-cover' ).show(); $( '#load' ).show(); return; } var elCover = document.createElement( "div" ); elCover.setAttribute( "id", "load-cover" ); elCover.className = "load-cover"; document.body.appendChild( elCover ); var elLoad = document.createElement( "section" ); elLoad.setAttribute( "id", "load" ); elLoad.className = ""; document.body.appendChild( elLoad ); var contenido = '