PageSourceSearch

https://www.ciencia-ficcion.com/varios/recursos/modimportarcontenido.js

js ciencia-ficcion.com collected 2026-10-02 11:22:19 UTC 20,238 bytes, 490 lines download raw bytes

1// Tansforma e inserta en la capa id_sv4_txt de la página actual el contenido de la capa id_sv4_txt de la página remota.
2var ic_rRutaOrigen;
3
4// https://www.arkaitzgarro.com/jquery/capitulo-7.html
5// 2025-10-17 Se crea el genérico para ir substituyendo las funciones particulares de cada sección.
6// 2026-01-09 Se añade el parámetro mModificadores que mediante las macros[0] '<' y '>' permite añadir texto[1] al principio o al final
7// rv. 2026-01-09
8// ====================
9function ic_TraerTexto(cArchivo, cTitulo, cAutor, cCapaOrigen = 'id_sv4_txt', cCapaDestino = 'id_sv4_txt_contenido', mModificadores = kVZ) {
10
11	ic_rRutaOrigen = '/' + sPS.psRutaSeccion(cArchivo);
12	cArchivo = sPS.psArchivo(cArchivo);
13
14	$.ajax({
15
16		url: ic_rRutaOrigen + cArchivo.toLowerCase() + '.htm',
17
18		type : 'GET',
19
20		dataType : 'html',
21
22		success : function(response) {
23			ic_ImportarContenido(response, cArchivo, cTitulo, cAutor, cCapaOrigen, cCapaDestino, mModificadores); // varios/recursos/modimportarcontenido.js
24			gCabecerasVM(); // Se redibuja porque en el modo móvil hay problemas a la hora de pintarlo a la primera
25		},
26
27		error : function(jqXHR, status, error) {
28			dgi(cCapaDestino, 'Disculpe, se produjo un problema importando el texto.');
29		},
30
31		cache: false
32
33	})
34
35} // ic_TraerTexto
36// ====================
37
38// 2024-05-12
39// 2025-05-22 Lo adapto a la sección Cómics-Autores
40// 2025-10-13 Se adapta para poder traer contenido de <sections> específicas
41// 2026-01-09 Se añade el parámetro mModificadores que permite modificaciones adicionales
42//		El parámetro es una matriz de matrices: mModificadores(Array(Comando1, Texto11, [Texto12]), [Array(Comando2, Texto21, [Texto22]), ...])
43//		Comando puede ser:
44//		'<' -> pone el texto al principio
45//		'>' -> pone el texto al final
46//		'R', 'RT' -> reemplaza todas las apariciones de texto1 por texto2
47//		'R1' -> solo reemplaza la primera aparición de texto1 por texto2
48//		'Eaz' -> elimina las apariciones del texto delimitadas por texto1 y texto2
49//			a = 'I' -> delimitadores incluidos
50//			a = 'X' delimitadores excluidos.
51//			z = '1' -> solo primera aparición
52//          z = 'T' todas las apariciones.
53//		 	Por defecto 'E' = 'EIT'
54//			Hay que tener en cuenta la prelación de reemplazos y eliminaciones.
55// 2026-03-11 Se corrige un error en la opcíón por defecto en la eliminación de partes del contenido
56// rv. 2026-03-11
57// ====================
58function ic_ImportarContenido(cHTML, nmArchOrigen, cTitulo, cAutor, cCapaOrigen = 'id_sv4_txt', cCapaDestino = 'id_sv4_txt_contenido', mModificadores = kVZ) {
59	
60	var c, cCmd, cContenido;
61	var cOrigen = cHTML.gPonerCutes();
62	cOrigen = cOrigen.replace('—', '&mdash;'); // no funciona, problemas con la codificación
63
64	if (nmArchOrigen.gContiene('/')) {
65		mPartes = nmArchOrigen.split('/');
66		nmArchOrigen = mPartes[mPartes.length-1];
67		nmArchOrigen = nmArchOrigen.replace('\.htm', kVZ);
68	}
69
70	// Obtengo el contenido de la página importada
71	cIni = cOrigen.gSubstringX('<div id="'+ cCapaOrigen +  '"', '>', 0, true);
72	cContenido = cOrigen.gSubstringX(cIni, '</div><!-- /'+ cCapaOrigen + ' -->');
73	if (cContenido.length == 0) {
74		cIni = cOrigen.gSubstringX('<section id="'+ cCapaOrigen + '"', '>', 0, true);
75		cContenido = cOrigen.gSubstringX(cIni, '</section><!-- /'+ cCapaOrigen + ' -->');
76	}
77	//alertX('1', cCapaOrigen, cCapaDestino, cContenido.length, '*'+cContenido+'*');
78	//if (cContenido == kVZ) cContenido = cOrigen.gSubstringX('<section id="'+ cCapaOrigen + '">', '</section><!-- /'+ cCapaOrigen + ' -->');
79	//alertX('2', cCapaOrigen, cCapaDestino, cContenido.length, '*'+cContenido+'*');
80	cContenido = cContenido.replaceAll(')</script>', ');</script>'); // para ganar coherencia
81	//alertX('3', cCapaOrigen, cCapaDestino, cContenido.length, '*'+cContenido+'*');
82	cContenido = ic_RehacerImagenes(cContenido, nmArchOrigen)
83	//alertX('4', cCapaOrigen, cCapaDestino, cContenido.length, '*'+cContenido+'*');
84	cContenido = ic_RehacerISBN(cContenido);
85	//alertX('5', cCapaOrigen, cCapaDestino, cContenido.length, '*'+cContenido+'*');
86	cContenido = ic_RehacerNotas(cContenido);
87	//alertX('6', cCapaOrigen, cCapaDestino, cContenido.length, '*'+cContenido+'*');
88	cContenido = ic_RehacerEnlaceComentarios(cContenido, nmArchOrigen, cTitulo, cAutor);
89	//alertX('7', cCapaOrigen, cCapaDestino, cContenido.length, '*'+cContenido+'*');
90	cContenido = ic_LimpiezasAdicionales(cContenido, nmArchOrigen, cTitulo, cAutor);
91	//alertX('8', cCapaOrigen, cCapaDestino, cContenido.length, '*'+cContenido+'*');
92	cContenido = cContenido.gPonerCutes();
93	//alertX('9', cCapaOrigen, cCapaDestino, cContenido.length, '*'+cContenido+'*');
94
95	if (Array.isArray(mModificadores)) {
96
97		for (n = 0; n < mModificadores.length; n++) {
98		
99			cCmd = mModificadores[n][0].toUpperCase();
100
101			if (cCmd == '<') {	// Pone el texto adicional al principio del contenido importado
102				cContenido = mModificadores[n][1] + cContenido;
103
104			} else if (cCmd == '>') { // Pone el texto adicional al final del contenido importado
105
106				cContenido = cContenido + mModificadores[n][1];
107
108			} else if (cCmd.gEnLista('R, RT')) { // Sustituye todo Texto1 por Texto 2
109				
110				cContenido = cContenido.replaceAll(mModificadores[n][1], mModificadores[n][2]); 				
111
112			} else if (cCmd.gEnLista('R1')) { // Sustituye solo el primer Texto1 por Texto 2
113
114				cContenido = cContenido.replace(mModificadores[n][1], mModificadores[n][2]) ;
115
116			} else if (cCmd.gLeft(1) == 'E') { // Elimina el contenido entre Texto1 y Texto 2. 'E' solo elimina todas las incidencias, separadores incluidos.
117
118				if (cCmd == 'E') cCmd = 'EIT'
119				c = cContenido.gSubstringX(mModificadores[n][1], mModificadores[n][2], 0, cCmd.gLeft(2) == 'EI'); // EI -> Incluye los delimitadores, EX los excluye
120				if (cCmd.gLeft(3).gEnLista('EI1, EX1')) { // nn1 solo elimina el primer contenido
121					cContenido = cContenido.replace(c, kVZ);
122				} else { //if (cCmd.gLeft(3).gEnLista('EIT', 'EXT') {
123					cContenido = cContenido.replaceAll(c, kVZ) ;
124				};
125
126			};
127		};
128	};
129
130	document.getElementById(cCapaDestino).innerHTML = cContenido;
131
132	// arreglo el info. Echar un ojo a esto porque da problemas al cargarse la sección INFO
133	if (!vgSeccion.gEnLista('Cómics')) {
134		if (gIsObject('info')) {
135			dgi('info', kVZ);
136			dgi('info', dgi('info') + '<div id="idfnBuscarMas">\n' + gBuscarMas(cTitulo + ', ' + cAutor, false, false, true) + '\n</div><!-- /idfnBuscarMas -->\n');
137		};
138	};	
139}; // /ic_ImportarContenido
140// ====================
141
142// 2024-05-12 Rehace la ruta de las imágenes corresponda a partir de la función gImagen, 
143// a la que se rellama para que devuelva el código, además de tratar los casos especiales.
144// 2024-07-02 Lo adapto a la sección Cómics
145// 2024-10-22 Lo adapto a la sección Firmas
146// 2025-10-13 Se resuelve un problema con la prelación de la detección del origen
147// rv. 2025-10-13
148// ====================
149function ic_RehacerImagenes(cTxt, nmArchOrigen) {
150let k, uRuta, mParamImg, cHrefA, cHrefN, cSrcA, cSrcN, cImgA, cImgN;	
151
152	// parche
153	cTxt = cTxt.replaceAll(' cursor:pointer;" onclick="gVentana(\'$Archivo$\', \'800\', \'600\')"', kCD); //revisar el HTML mal, esto da problemas a la hora de tratar los enlaces.
154
155	uRuta = location.href;
156	mParamImg = Array(6);
157	//alertX('Seccion: '+vgSeccion, 'ArchOrigen: ' +nmArchOrigen, 'uRuta: '+uRuta)
158	if (vgSeccion.gEnLista('Películas, Cómics')) {
159
160		if (vgSeccion == 'Cómics') {
161			cTxt = cTxt.replace(cTxt.gSubstringX('<script>gImagen(\'qsq_', '</script>', 0, true), kVZ);
162			cTxt = cTxt.replace(cTxt.gSubstringX('<!-- imgInv -->', '<!-- /imgInv -->', 0, true), kVZ);
163			cTxt = cTxt.replace('class="portada', 'class="w150');
164		}
165		cTxt = cTxt.replaceAll('src="imag/', 'src="' + gNv + 'opinion/imag/');
166		cTxt = cTxt.replace('src="otros/', 'src="' + gNv + 'opinion/otros/');
167
168	} else if (nmArchOrigen.gEmpiezaPor('f2')) { //Firmas Ojo con esto porque hay colisiones dependiendo del orden de los if. 
169	
170		cTxt = cTxt.replaceAll('src="imag/', 'src="' + gNv + 'varios/firmas/imag/');
171
172	} else if (nmArchOrigen.gEmpiezaPor('op')) {
173		//alertX('2');
174		cTxt = cTxt.replaceAll('src="imag/', 'src="' + gNv + 'opinion/imag/');
175
176	} else if (uRuta.gContiene('/series/startrek/st')) {
177	
178		cTxt = cTxt.replaceAll('src="imag/', 'src="' + gNv + 'opinion/imag/');
179		cRedirector = cTxt.gSubstringX('<div id="especial_articulo">', '</div>');
180		cHrefA = cRedirector.gSubstringX('<a href="', '" ');
181		cHrefN = gNv + 'opinion/' + nmArchOrigen.replace('.htm', kVZ) + '.htm';
182		cTxt = cTxt.replaceAll(cHrefA, cHrefN);
183
184	} else if (uRuta.gContiene('/autores/atq/novelas/')) {
185
186		if (nmArchOrigen.gEmpiezaPor('op')) cTxt = cTxt.replaceAll('src="imag/', 'src="' + gNv + 'opinion/imag/');
187
188	//} else if (uRuta.gContiene('/autores/ghw/autor/')) {
189
190		//if (nmArchOrigen.gEmpiezaPor('op')) cTxt = cTxt.replaceAll('src="imag/', 'src="' + gNv + 'opinion/imag/');
191
192	} else {
193
194		k = -1
195		cSrcA = cTxt.gSubstringX('<img src="', '"', 0, false);
196		while (cSrcA != kVZ) {
197			if (cSrcA.gContiene('../')) {
198				cSrcN = gNv + cSrcA.replace('\.\.\/\g', kVZ);
199			} else {
200				cSrcN = (!cSrcA.gEmpiezaPor('/') ? ic_rRutaOrigen : kVZ) + cSrcA;
201			}
202			cTxt = cTxt.replace(cSrcA, cSrcN);
203			cSrcA = cTxt.gSubstringX('<img src="', '"', cTxt.indexOf(cSrcN) + cSrcN.length, false);
204			if (k++ > 100) break; // ñapa para evitar bucles infinitos
205		}; // / while
206
207	};
208
209	// Convierto las funciones gImagen() a código HTML
210	// OJO, cada gImagen debe estar delimitada por sus propias etiquetas <script>
211	//alertX('3', 'Convierto las funciones gImagen() a código HTML');
212	cImgA = cTxt.gSubstringX('<script>gImagen(', ');</script>', 0, true);
213	while (cImgA != kVZ) {
214		mParamImg = gParametrosJS(cImgA.gSubstringX('(', ')'), false);
215		cImgN = gImagen(mParamImg[0], mParamImg[1], mParamImg[2], mParamImg[3], mParamImg[4], mParamImg[5], 'devolver')
216		cTxt = cTxt.replace(cImgA, cImgN);
217		cImgA = cTxt.gSubstringX('<script>gImagen(', ');</script>', 0, true);
218	} // / while
219
220	//alertX('4');
221	// Pongo los Id en las imánges por si no los tienen
222	cImgA = cTxt.gSubstringX('<img src="', '>', 0, true);
223	while (cImgA != kVZ) {
224		if (!cImgA.gContiene('id=')) {
225			cId = ' id="img_ic_' + gRellena(gAleatorio(0, 9999), '4:0:<') + kCD;  // el id debe ser aleatorio porque si se llama dos veces a ic_ImportarContenido desde la misma página se repiten.
226			cSrc = cImgA.gSubstringX('<img src="', '"', 0, true);
227			cImgN = cImgA.replace('>', cId + kS1  + '>');
228			cTxt = cTxt.replace(cImgA, cImgN);
229			cImgA = cTxt.gSubstringX('<img src="', '>', cTxt.indexOf(cImgN) + cImgN.length, true);
230		};
231	}; // / while
232
233	//alertX('5');
234	return cTxt;
235
236}; // /ic_RehacerImagenes
237// ====================
238
239// 2024-05-12 Rehace el enlace al ISBN o al IMdb según corresponda a partir de la función gISBN, 
240// a la que se rellama para que devuelva el código.
241// rv. 2024-05-12
242// ====================
243function ic_RehacerISBN(cTxt) {
244
245	var n, cIsbnA, cIsbnN, cParam, mParam = Array(2);
246
247	cIsbnA = cTxt.gSubstringX('<script>gISBN(', ');</script>', 0, true);
248	if (cIsbnA != kVZ) {
249		cParam = cIsbnA.gSubstringX('gISBN(', ')');
250		mParam = gParametrosJS(cParam, false);
251		cIsbnN = gISBN(mParam[0], mParam[1] + ' devolver'); 		
252		cTxt = cTxt.replace(cIsbnA, cIsbnN);
253		cIsbnA = cTxt.gSubstringX('<script>gISBN(', ');</script>', 0, true);	
254	};
255
256	return cTxt;
257
258}; // /ic_RehacerISBN
259// ====================
260
261// 2024-05-12 Rehago el enlace a los comentarios. Obviamente el enlace a los comentarios no tendrá
262// las mismas facilidades que el gComentario original
263// 2024-06-26 Si el número de parámetros de gComentarios no es correcto, sale de la función
264// rv. 2024-06-26
265// ====================
266function ic_RehacerEnlaceComentarios(cTxt, nmArchOrigen, cTitulo, cAutor) {
267	
268	var cComentariosA, cComentariosN, mParam, cArticulo;
269
270	cComentariosA = cTxt.gSubstringX('<div class="c_comentario">', '</div>', 0, true);
271	while (cComentariosA != kVZ) {
272
273		mParam = gParametrosJS(cComentariosA.gSubstringX('gComentarios(', ')'), false);
274		if (mParam.length < 4) {
275
276			break;
277
278		} else {		
279
280			cColaborador = mParam[3];
281			if (mParam[0].gContiene('vgPag')) {
282				cArticulo = mParam[0].replaceAll(kS1, kVZ);
283				cArticulo = cArticulo.replaceAll('vgPag+', nmArchOrigen);
284				cArticulo = cArticulo.replaceAll('+vgPag', nmArchOrigen);
285				cArticulo = cArticulo.replaceAll(nmArchOrigen+ '\'', '\'' + nmArchOrigen);
286				cArticulo = cArticulo.replaceAll('\'+' + nmArchOrigen, nmArchOrigen + '\'');
287			} else {
288				cArticulo = nmArchOrigen;
289				if (cArticulo.gLeft(2) !== 'f2') {
290					cArticulo = cArticulo + '_' + cColaborador.gIniciales(false);
291				};
292			};
293
294			cComentariosN = '<div class="c_comentario"><img src="' + gNv + 'imag/_mnu_est.gif" alt="*" class="estr" title="*">' + 
295						'<a href="javascript:gVentana(\'' + gNv + 'varios/comentarios/_comentarios.php' +
296							'?articulo=' + cArticulo +
297							'&titulo=' + cTitulo + '%2C%20de%20' + cAutor.replace(kS1, '%20') + 
298							'&autor=' + cColaborador.replace(kS1, '%20') + '\',' +
299						' \'800\', \'600\')">' + 
300						'<b>Comentar este artículo</b></a>' + 
301							'<script src="' + gNv + 'varios/comentarios/_comentarios.php' + 
302								'?cmd=cuenta' + 
303								'&articulo=' + encodeURIComponent(cArticulo) + '">' + 
304							'</script>';
305			cTxt = cTxt.replace(cComentariosA, cComentariosN);
306
307			cComentariosA = cTxt.gSubstringX('<div class="c_comentario">', '</div>', cTxt.indexOf(cComentariosN)+cComentariosN.length, true);
308
309		}; // /mParam.length
310
311	}; // / while
312	
313	return cTxt;
314
315}; // /ic_RehacerEnlaceComentarios
316// ====================
317
318// 2024-05-12 Rehago las notas tanto en el texto como en el pie
319// rv. 2024-05-12
320// ====================
321function ic_RehacerNotas(cTxt) {
322
323	cNotaA = cTxt.gSubstringX('<script>gNotaR(', ');</script>', 0, true);
324	while (cNotaA != kVZ) {
325		nNota = cNotaA.gQuitarNoNumeros();
326		cNotaN = '<span id="ref' + nNota + '" class="enlacenota">[<a href="javascript:gIrAReferencia(\'nota' + nNota + '\');">' + nNota + '</a>]</span>';
327		cTxt = cTxt.replace(cNotaA, cNotaN);
328		cNotaA = cTxt.gSubstringX('<script>gNotaR(', ');</script>', 0, true); //cTxt.indexOf(cNotaN) + cNotaN.length
329	} // / while
330
331	cNotaA = cTxt.gSubstringX('<script>gNotaP(', ');</script>', 0, true);
332	while (cNotaA != kVZ) {
333		nNota = cNotaA.gQuitarNoNumeros();
334		cNotaN = '<span id="nota' + nNota + '">[<b><a href="javascript:gIrAReferencia(\'ref' + nNota + '\');">' + nNota + '</a></b>]</span>';
335		cTxt = cTxt.replace(cNotaA, cNotaN);
336		cNotaA = cTxt.gSubstringX('<script>gNotaP(', ');</script>', 0, true); //cTxt.indexOf(cNotaN) + cNotaN.length
337	} // / while
338
339	// también se rehace el aviso legal
340	cLegalA = cTxt.gSubstringX('<script>gLicenciaSitio(', ');</script>', 0, true);
341	while (cLegalA != kVZ) {
342		mParam = gParametrosJS(cLegalA.gSubstringX('gLicenciaSitio(', ')'), false);
343		cLegalN = gLicenciaSitio(mParam[0], mParam[1], 'devolver');
344		cTxt = cTxt.replace(cLegalA, cLegalN);
345		cLegalA = cTxt.gSubstringX('<script>gLicenciaSitio(', ');</script>', 0, true);
346	}; // while
347	return cTxt;
348
349}; // /ic_RehacerNotas 
350// ====================
351
352// 2024-05-12 Limpio el resultado de sobrantes dependiendo de la sección
353// 2024-07-02 Lo adapto a la sección Cómics
354// 2025-05-22 Lo adapto a la sección Cómics-Autores
355// 2025-10-20 Enlazo desde Series-Star Trek al origen del texto en Opinión
356// rv. 2025-10-20
357// ====================
358function ic_LimpiezasAdicionales(cTxt, nmArchOrigen, cTitulo, cAutor) {
359var c, h, i;
360	
361	//alert(vgSeccion + ' ' + vgSubSeccion + ' ' + nmArchOrigen);
362
363	// genérico
364	cTxt = cTxt.replace(cTxt.gSubstringX('<script>gInserciones(', ');</script>', 0, true), kVZ);
365
366	if (cTxt.gContiene('itemprop="Seccion" content="Firmas"')) { // Limpio el artículo de Firmas
367
368		cTxt = cTxt.replace(cTxt.gSubstringX('<script>gInserciones(', ');</script>', 0, true), kVZ);
369		cTxt = cTxt.replace(cTxt.gSubstringX('<header', '>', 0, true), kVZ);
370		cTxt = cTxt.replace(cTxt.gSubstringX('<script>fmCabecera(', ');</script>', 0, true), kVZ);
371		cTxt = cTxt.replace(cTxt.gSubstringX('</header', '>', 0, true), kVZ);
372		cTxt = cTxt.replace(cTxt.gSubstringX('<article', '>', 0, true), kVZ);
373		cTxt = cTxt.replace(cTxt.gSubstringX('<section', '>', 0, true), kVZ);
374		cTxt = cTxt.replace(cTxt.gSubstringX('<div class="c_nfo"', '</div>', 0, true), kVZ);
375		cTxt = cTxt.replace(cTxt.gSubstringX('</section', '>', 0, true), kVZ);
376		cTxt = cTxt.replace(cTxt.gSubstringX('<section id="info">', '</section>', 0, true), kVZ);
377		cTxt = cTxt.replace(cTxt.gSubstringX('</article', '>', 0, true), kVZ);
378
379	} else if (vgSubSeccion == 'Star Trek' && nmArchOrigen.gEmpiezaPor('op')) { // Rehago el enlace a Opinión desde Star Trek - Series
380
381		a = cTxt.gSubstringX('<div id="especial_articulo">', '</div>', 0, true);
382		if (a != kVZ){
383			a = a.gSubstringX('<a href=', '</a>', 0, true);
384			if (a != kVZ) {
385				b = '<a href="' + gNv + 'opinion/' + nmArchOrigen + '.htm" target="_top" class="ein">' + a.gQuitarHTML() + '</a>';
386				cTxt = cTxt.replace(a, b);
387			};
388		};
389
390	};
391
392	// alertX('2', '*'+cTxt+'*');
393	if (vgSeccion.gEnLista('Cómics')) {
394		
395		h = cTxt.gSubstringX('<header>', '</header>', 0, true)
396		if (h != kVZ) {
397			cTxt = cTxt.replace(h, kVZ);	
398			i = h.gSubstringX('<img src=', '>', 0, true)
399			if (i != kVZ) cTxt = cTxt.replace('<p class="ppt">', i + '\n\t\t\t<p class="ppt">');
400		};
401		i = cTxt.gSubstringX('<section id="info">', '</section>', 0, true)
402		if (i != kVZ) cTxt = cTxt.replace(i, kVZ);
403		i = cTxt.gSubstringX('<article>', '</article>');
404		if (i != kVZ) cTxt = i;
405
406	};  // / Cómics
407	// alertX('3', '*'+cTxt+'*');
408
409	if (vgSeccion.gEnLista('A.T.Q.')) {
410
411		i = '<header>';		
412		h = cTxt.gSubstringX('<header>', '</header>', 0, true)
413		if (vgSubSeccion.gEnLista('Novelas')) {
414			i = h.replace(i, i + '\t\t<div style="vertical-align: top;" id="id_cab_atq_oes">' + 
415										'<a href="index.html" class="sinsub" target="_top">' + 
416											'<span class="rotuloCE">Novelas</span>' +  
417										'</a><hr class="hrlegalsup hr40i">' + 
418								'</div>');
419		};
420		cTxt = cTxt.replace(h, i);
421
422	}; // /A.T.Q.
423
424	if (vgSeccion.gEnLista('G.H.W.')) {
425
426		h = cTxt.gSubstringX('<header>', '</header>', 0, true);
427		i = h;
428		if (h.gContiene('<div id="especial_articulo">')) {
429			i = h.replace(h.gSubstringX('<div id="especial_articulo">', '</div>', 0, true), kVZ);
430			i = i.replace('<header>', '<header>\n' + gwCabeceraSeccion(vgSubSeccion, vgApartado, kVZ, true));
431		};
432
433		cTxt = cTxt.replace(h, i);
434
435	}; // /G.H.W.
436
437	// Elimino el especial artículo en las secciones donde no haga falta.
438	if (vgSeccion.gEnLista('Películas')) {
439		cTxt = cTxt.replace(cTxt.gSubstringX('<div id="especial_articulo">', '</div>', 0, true), kVZ);
440	};
441
442	// Pongo el enlace a Opinión en el título de Películas 
443	if (vgSeccion.gEnLista('Películas, Libros')) {
444		h = cTxt.gSubstringX('<div class="titulo_articulo">', '</div>', 0, true);
445		i = h.replace('titulo_articulo">', 'titulo_articulo"><a href="' + gNv + 'opinion/' + nmArchOrigen + '.htm" target="_top">');
446		i = i.replace('</div>', '</a></div>');
447		cTxt = cTxt.replace(h, i);
448	};
449
450	// Limpia caracteres no imprimibles. Investigar más a fondo
451	//cTxt = cTxt.replace(/[^\x20-\x7E]/g, kVZ);
452
453	// quito comentarios
454	cComentarioA = cTxt.gSubstringX('<!--', '-->', 0, true);
455	while (cComentarioA != kVZ) {
456		cTxt = cTxt.replace(cComentarioA, kVZ);
457		cComentarioA = cTxt.gSubstringX('<!--', '-->', 0, true);
458	}; // / while
459
460	// para depuración
461	//----------------
462//	cIni = '<img'; cFin = '>'; cCachoA = cTxt.gSubstringX(cIni, cFin, 0, true);
463//	while (cCachoA != kVZ) {
464//		alert(cCachoA);
465//		cTxt = cTxt.replaceAll(cCachoA, kVZ);
466//		cCachoA = cTxt.gSubstringX(cIni, cFin, 0, true);
467//	} // / while
468//
469//	cIni = '<div'; cFin = '</div>'; cCachoA = cTxt.gSubstringX(cIni, cFin, 0, true);
470//	while (cCachoA != kVZ) {
471//		cTxt = cTxt.replaceAll(cCachoA, kVZ);
472//		cCachoA = cTxt.gSubstringX(cIni, cFin, 0, true);
473//	} // / while
474//
475//	cIni = '<p'; cFin = '</p>'; cCachoA = cTxt.gSubstringX(cIni, cFin, 0, true);
476//	while (cCachoA != kVZ) {
477//		cTxt = cTxt.replaceAll(cCachoA, kVZ);
478//		cCachoA = cTxt.gSubstringX(cIni, cFin, 0, true);
479//	} // / while
480	//----------------
481
482	// limpio saltos de línea y tabuladores extraños
483	cTxt = cTxt.replaceAll(/\t\r\n/g, '\r\n');
484	cTxt = cTxt.replaceAll(/\r\n\t\r\n/g, '\r\n\r\n');
485	cTxt = cTxt.replaceAll(/\r\n\r\n\r\n/g, '\r\n');
486
487	return cTxt.trim();
488
489}; // /ic_RehacerNotas 
490// ====================

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.