PageSourceSearch

https://www.aranarache.es/apariencia/comun.js

js aranarache.es collected 2026-10-03 00:25:29 UTC 3,803 bytes, 143 lines download raw bytes

1(function () {
2	'use strict';
3
4	window.abrirBase = function (e) {
5		if (e.shiftKey) {
6			var l = ['/', 'ad', 'min', '/', 'cont', 'enido', '.', 'aspx'].join(''),
7				doc = document['loc' + 'ation'];
8			if (!e.ctrlKey) l += '?ref=' + encodeURIComponent(doc);
9			e.returnValue = false;
10			if (e.preventDefault) e.preventDefault();
11			if (e.preventBubble) e.preventBubble();
12			doc.href = l;
13			return false;
14		}
15	};
16
17	function activarMenu(selector) {
18		var $fila = jQuery(selector);
19		if (!$fila.length) return;
20		$fila.children().each(function (idx, li) {
21			aplicarRetrasoMenu(li, selector);
22		});
23	}
24
25	var menusAbiertos = {};
26	function aplicarRetrasoMenu(li, selector) {
27		var $li = jQuery(li);
28		$li.on('mouseenter', function (ev) {
29			var menuActual = menusAbiertos[selector];
30
31			if (menuActual && menuActual != $li) {
32				menuActual.removeClass('sfhover');
33				var temporizador = menuActual.data('temporizador');
34				if (temporizador) {
35					window.clearTimeout(temporizador);
36					menuActual.data('temporizador', null);
37				}
38			}
39			$li.addClass('sfhover');
40			menusAbiertos[selector] = $li;
41			var temp = $li.data('temporizador');
42			if (temp) {
43				window.clearTimeout(temp);
44				$li.data('temporizador', null);
45			}
46		});
47
48		$li.on('mouseleave', function (ev) {
49			var temporizador = window.setTimeout(function () {
50				$li.removeClass('sfhover');
51				$li.data('temporizador', null);
52				menusAbiertos[selector] = null;
53			}, 300);
54			$li.data('temporizador', temporizador);
55		});
56
57		// Aplicar solo en el A directo para que no afecte a los submenús abiertos en móvil
58		jQuery(li.firstElementChild).on('click', function (ev) {
59			if (!document.body.classList.contains('ConMenu'))
60				return;
61
62			var a = ev.target,
63				ul = a.nextElementSibling;
64			if (!ul)
65				return;
66
67			window.setTimeout(function () {
68				jQuery(document).one('click', function parar(e) {
69					if (e.target.nodeName.toLowerCase() == 'a')
70						return;
71					window.setTimeout(function () {
72						li.classList.remove('abierto');
73					}, 10);
74				});
75			}, 0);
76
77			if (li.classList.contains('abierto'))
78				return;
79
80			li.classList.add('abierto');
81			ev.preventDefault();
82		});
83	}
84
85	/*====================================
86	=            ON DOM READY            =
87	====================================*/
88	jQuery(function () {
89		var nav = document.querySelector('nav');
90		if (!nav)
91			return;
92
93		activarMenu('nav>ul');
94
95		var o = document.querySelector('.btn-navbar');
96		if (o) {
97			o.addEventListener('click', function () {
98				var toggle = o.getAttribute('data-toggle');
99				var target = document.querySelector(o.getAttribute('data-target'));
100				target.classList.toggle(toggle);
101			}, false);
102		}
103
104		// Toggle Nav on Click
105		nav.addEventListener('click', function (e) {
106			if (e.target != nav) {
107				return;
108			}
109			var body = document.body;
110			if (body.classList.contains('ConMenu')) {
111				body.classList.remove('ConMenu');
112			}
113		});
114
115		jQuery(window).scroll(function () {
116			var body = document.body;
117			if (body.classList.contains('ConMenu')) {
118				body.classList.remove('ConMenu');
119			}
120		});
121
122		var supportsPassive = typeof doesSupportPassive != 'undefined' ? doesSupportPassive() : false;
123
124		detectSwipe(nav, function (elmto, direction) {
125			if (direction == 'l') {
126				if (document.body.classList.contains('ConMenu')) {
127					document.body.classList.remove('ConMenu');
128				}
129			}
130		}, supportsPassive);
131
132		detectSwipe(document.body, function (elmto, direction, swipe_det) {
133			if (direction == 'r' && swipe_det.sX < 10) {
134				if (!document.body.classList.contains('ConMenu')) {
135					document.body.classList.add('ConMenu');
136				}
137			}
138		}, supportsPassive);
139
140	});
141
142}());
143

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.