PageSourceSearch

https://www.ciegodeavila.gob.cu/plugins/system/encrypt/encrypt/convert203.js

js ciegodeavila.gob.cu collected 2026-10-03 17:56:12 UTC 4,897 bytes, 189 lines download raw bytes

1
2function encrypt_plugin_redundacy_check(s)
3{
4   var i;
5   var sum = 0;
6   for(i = 0; i < s.length; i++)
7   {
8      sum += s.charCodeAt(i);
9   }
10   var a="0123456789abcdef";
11   var hex = '';
12   hex += a.charAt((sum & 0xF0) >> 4) + a.charAt(sum & 0x0F);
13   return hex;	
14}
15
16function encrypt_plugin_encryptValue(value)
17{
18	return plgEncrypt_rsaObject.encrypt(encrypt_plugin_redundacy_check(value) + value);
19}
20
21function encrypt_plugin_getElementByNameAndId(name, id)
22{
23	var coll = document.getElementsByName(name);
24	var items = new Array();
25	var i;
26	for(i = 0; i < coll.length; i++)
27	{
28		if(coll.item(i).id == id)
29			items.push( coll.item(i) );
30	}
31	return items;
32}
33
34function encrypt_plugin_get_parent_form(control, formName, formId)
35{
36	var forms = encrypt_plugin_getElementByNameAndId(formName, formId);
37	for(var f = 0; f < forms.length; f++)
38	{
39		var form = forms[f];
40		var i;
41		for(i = 0; i < form.elements.length; i++)
42		{
43			if(form.elements.item(i) == control)
44				return form;
45		}
46	}
47	return null;
48}
49
50function encrypt_plugin_show_encrypt_signal(control)
51{
52	var x = encrypt_plugin_getAbsXCoord(control);
53	var y = encrypt_plugin_getAbsYCoord(control);
54	var div = document.createElement('DIV');
55	document.body.appendChild(div);
56	div.innerHTML = plgEncrypt_EncryptedSignal;
57	div.style.backgroundColor = '#ffffff';
58	div.style.border = '1px dotted';
59	div.style.position = 'absolute';
60	div.style.visibility = 'visible';
61	div.style.left = x + 'px';
62	div.style.top = y + 'px';
63}
64
65function encrypt_plugin_getPositionType(element)
66{
67	if(window.getComputedStyle)
68		return window.getComputedStyle(element,null).position;
69	else if(element.currentStyle)
70		return element.currentStyle.position;
71	else
72		return 'static';
73}
74
75function encrypt_plugin_getAbsXCoord(element)
76{
77    var x = 0;
78	var node = element;
79    while(node != null && encrypt_plugin_getPositionType(node) == 'static')
80    {
81        x += node.offsetLeft;
82        node = node.offsetParent;
83    }
84    return x;
85}
86
87function encrypt_plugin_getAbsYCoord(element)
88{
89    var y = 0;
90	var node = element;
91    while(node != null && encrypt_plugin_getPositionType(node) == 'static')
92    {
93        y += node.offsetTop;
94        node = node.offsetParent;
95    }
96    return y;
97}
98
99
100function encrypt_plugin_checkParentForm(control, form)
101{
102	var node = control;
103	while(node != null)
104	{
105		if(node == form)
106			return true;
107		node = node.parentNode;
108	}
109	return false;
110}
111
112function encrypt_plugin_getParentForm(control)
113{
114	var node = control;
115	while(node != null)
116	{
117		if(node.nodeName == "FORM")
118			return node;
119		node = node.parentNode;
120	}
121	return null;
122}
123
124function encrypt_plugin_getElementByNameIdAndForm(name, id, form)
125{
126	var coll = document.getElementsByName(name);
127	var items = new Array();
128	var i;
129	for(i = 0; i < coll.length; i++)
130	{
131		if(coll.item(i).id == id)
132		{
133			if(encrypt_plugin_checkParentForm(coll.item(i), form))
134				return coll.item(i);
135		}
136	}
137	return null;
138}
139
140function encrypt_plugin_removeBrackets(str)
141{
142	str = str.replace(/\[/g, '');
143	str = str.replace(/\]/g, '');
144	return str;
145}
146
147function encrypt_plugin_encryptform(formName, formId, form)
148{
149	var i;
150	form = encrypt_plugin_getParentForm(form);
151	for(i = 0; i < plgEncrypt_controls.length; i++)
152	{
153		if(plgEncrypt_controls[i].formName == formName && plgEncrypt_controls[i].formid == formId 
154			&& !plgEncrypt_controls[i].encrypted)
155		{
156			var control = encrypt_plugin_getElementByNameIdAndForm(
157				plgEncrypt_controls[i].controlName, 
158				plgEncrypt_controls[i].controlId, form);
159			if(control != null)
160			{
161				var encrypted = false;
162				var dest_name = 'encrypted_' + 
163					plgEncrypt_controls[i].formName + '_' + plgEncrypt_controls[i].formid + '_' +
164					encrypt_plugin_removeBrackets(plgEncrypt_controls[i].controlName) + '_' + 
165					plgEncrypt_controls[i].controlId;
166				var token_name = 'formtoken_' + plgEncrypt_controls[i].formName  + '_' + 
167					plgEncrypt_controls[i].formid;
168				var dest_control = encrypt_plugin_getElementByNameIdAndForm(dest_name, dest_name, form);
169				var token = encrypt_plugin_getElementByNameIdAndForm(token_name, token_name, form);
170				if(dest_control != null && token != null && dest_control.value == '')
171				{
172					if(plgEncrypt_controls[i].encryptEmpty || (control.value != '' && control.value.length >= plgEncrypt_controls[i].minLength))
173					{
174						encrypted = true;
175						dest_control.value = encrypt_plugin_encryptValue(token.value + ':' +control.value);
176					}
177				}
178				if(encrypted)
179				{
180					control.setAttribute('autocomplete', 'off');
181					control.value = 'rE34f@fffrE34f@fffrE34f@fffrE34f@fff';
182					plgEncrypt_controls[i].encrypted = true;
183					if(plgEncrypt_controls[i].showSignal)
184						encrypt_plugin_show_encrypt_signal(control);
185				}
186			}
187		}
188	}
189}

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.