PageSourceSearch

https://forbes.es/wp-content/themes/tapasmagazine23/js/navigation.js?ver=2.0.99

js forbes.es collected 2026-09-24 07:44:50 UTC 5,227 bytes, 147 lines download raw bytes

1/**
2 * File navigation.js.
3 *
4 * Menú lateral
5 * Cabecera fixed
6 */
7/* Set the width of the side navigation to 250px */
8function openNav() {
9	document.getElementById("sidebar-navigation").classList.add('sidebar-open');
10	document.getElementById("sidebar-background").classList.add('sidebar-open');
11}
12
13/* Set the width of the side navigation to 0 */
14function closeNav() {
15	document.getElementById("sidebar-navigation").classList.remove('sidebar-open');
16	document.getElementById("sidebar-background").classList.remove('sidebar-open');
17}
18
19function EPETBrowserDims() {
20	var viewportwidth = 0;
21	var viewportheight = 0;
22	if (typeof window.innerWidth != 'undefined') {
23		viewportwidth = window.innerWidth,
24			viewportheight = window.innerHeight
25	}
26	else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0) {
27		viewportwidth = document.documentElement.clientWidth,
28			viewportheight = document.documentElement.clientHeight
29	} else {
30		viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
31			viewportheight = document.getElementsByTagName('body')[0].clientHeight
32	}
33	return {
34		"ancho": viewportwidth, "alto": viewportheight
35	};
36}
37
38
39(function ($) {
40
41	/**
42	 * Menú sticky
43	 */
44	var $window = $(window);
45
46	$window.scroll(function () {
47		//console.log($window.scrollTop());
48		if ($window.scrollTop() >= 500) {
49			$("#masthead").addClass("is_stuck");
50		} else {
51			$("#masthead").removeClass("is_stuck");
52		}
53	});
54
55	/**
56	 * Cerrar menú desplegable al hacer click en el resto de la página
57	 */
58	$('#sidebar-background').on('click', function() {
59		$("#sidebar-navigation").removeClass('sidebar-open');
60		$(this).removeClass('sidebar-open');
61	})
62
63	/**
64	 * Search toggle en móvil
65	 */
66	$('.search-toggle').on('click', function(){
67
68		$(this).toggleClass('active');
69		$('.search-block').toggleClass('active');
70
71		return false;
72	});
73
74	$('.search-block .icon-close').on('click', function() {
75		$('.search-toggle').toggleClass('active');
76		$('.search-block').toggleClass('active');
77	});
78
79	/**
80	 * Banners de publicidad
81	 */
82	var browser_dimensiones = EPETBrowserDims();
83
84	if ( $('.single-post #secondary').length ) {
85		if (browser_dimensiones.ancho < 728) {
86			// Caso especial: postid-882444 -> .roba1 dentro de .entry-content, lo primero (antes del 1er <p>)
87			if ( $('body').hasClass('postid-882444') ) {
88				var $entry = $('.single-post .entry-content').first();
89				var $roba1 = $('.single-post #secondary .roba1').first();
90				var $firstP = $entry.children('p').first();
91
92				if ($entry.length && $roba1.length) {
93					if ($firstP.length) {
94						$roba1.insertBefore($firstP);
95					} else {
96						$entry.prepend($roba1);
97					}
98				}
99			} else {
100				$('.single-post #secondary .roba1').insertAfter($(".entry-content").children('p').eq(1));
101			}
102			$('.single-post #secondary .roba2').insertAfter($(".entry-content").children('p').eq(3));
103
104			var extraRobas = [
105				{
106					index: 5,
107					code: "<!-- /143274330/dfp_forbes/fbs_roba_v3 --><div id='div-gpt-ad-1788853009147-0' style='min-width: 300px; min-height: 250px;text-align:center;'><script>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1788853009147-0'); });</script></div>"
108				},
109				{
110					index: 7,
111					code: "<!-- /143274330/dfp_forbes/fbs_roba_v4 --><div id='div-gpt-ad-1788853029428-0' style='min-width: 300px; min-height: 250px;text-align:center;'><script>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1788853029428-0'); });</script></div>"
112				},
113				{
114					index: 9,
115					code: "<!-- /143274330/dfp_forbes/fbs_roba_v5 --><div id='div-gpt-ad-1788853040600-0' style='min-width: 300px; min-height: 250px;text-align:center;'><script>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1788853040600-0'); });</script></div>"
116				},
117				{
118					index: 11,
119					code: "<!-- /143274330/dfp_forbes/fbs_roba_v6 --><div id='div-gpt-ad-1788853130599-0' style='min-width: 300px; min-height: 250px;text-align:center;'><script>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1788853130599-0'); });</script></div>"
120				},
121				{
122					index: 13,
123					code: "<!-- /143274330/dfp_forbes/fbs_roba_v7 --><div id='div-gpt-ad-1788853144679-0' style='min-width: 300px; min-height: 250px;text-align:center;'><script>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1788853144679-0'); });</script></div>"
124				},
125				{
126					index: 15,
127					code: "<!-- /143274330/dfp_forbes/fbs_roba_v8 --><div id='div-gpt-ad-1788853162289-0' style='min-width: 300px; min-height: 250px;text-align:center;'><script>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1788853162289-0'); });</script></div>"
128				}
129			];
130
131			var $entryParagraphs = $(".entry-content").children('p');
132			extraRobas.forEach(function(roba) {
133				var $targetP = $entryParagraphs.eq(roba.index);
134				if ($targetP.length) {
135					$(roba.code).insertAfter($targetP);
136				}
137			});
138		}
139	}
140
141	if ( $('.archive #secondary').length ) {
142		if (browser_dimensiones.ancho < 728) {
143			$('.archive #secondary .roba1').insertAfter($(".listados-blog.apertura"));
144			$('.archive #secondary .roba2').insertAfter($(".listados-blog.listado3"));
145		}
146	}
147})(jQuery);

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.