PageSourceSearch

https://www.df.cl/noticias/js-local/js-global-av-1789418973-av-.js

js df.cl collected 2026-10-01 10:12:37 UTC 7,850 bytes, 277 lines download raw bytes

1/*==== Despliegue barra de búsqueda===*/
2
3function addClass(el, className) {
4   var el = document.querySelectorAll(el);
5   
6   for (i = 0; i < el.length; i++) {
7     if (el.classList) {
8       el[i].classList.add(className);
9     } else {
10       el[i].className += ' ' + className;
11
12     }
13   }
14}
15
16function removeClass(el, className) {
17    var el = document.querySelectorAll(el);
18    
19    for (i = 0; i < el.length; i++) {
20
21      if (el[i].classList) {
22        el[i].classList.remove(className);
23      } else {
24        el[i].className = el.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' ');
25      }
26    }
27}
28
29
30/*==== header sticky ===*/
31
32$(document).ready(function(){
33  window.onscroll = function() {myFunction()};
34
35  var header = document.getElementById("header");
36  var sticky = header.offsetTop;
37  
38  function myFunction() {
39    if (window.pageYOffset > sticky) {
40      header.classList.add("sticky");
41    } else {
42      header.classList.remove("sticky");
43    }
44
45  }
46
47});
48
49
50
51/*==== menujq Accordion ===*/
52$(document).ready(function(){
53  $('.menujq > ul > li:has(ul)').addClass('desplegable');
54   $('.menujq > ul > li > a').click(function() {
55     var comprobar = $(this).next();
56     $('.menujq li').removeClass('active');
57     $(this).closest('li').addClass('active');
58     if((comprobar.is('ul')) && (comprobar.is(':visible'))) {
59        $(this).closest('li').removeClass('active');
60        comprobar.slideUp('normal');
61     }
62     if((comprobar.is('ul')) && (!comprobar.is(':visible'))) {
63        $('.menujq ul ul:visible').slideUp('normal');
64        comprobar.slideDown('normal');
65     }
66  });
67
68  });
69
70// Dropdown click menu
71
72function myFunction() {
73  const dropdown = document.getElementById("myDropdown");
74  const dropbtn = document.querySelector(".dropbtn");
75  const parentDropdown = dropbtn.closest(".dropdown");
76
77  dropdown.classList.toggle("show");
78  dropbtn.classList.toggle("active");
79  parentDropdown.classList.toggle("overlay");
80}
81
82// Close the dropdown if the user clicks outside of it
83window.onclick = function(event) {
84  if (!event.target.matches('.dropbtn')) {
85    var dropdowns = document.getElementsByClassName("dropdown-content");
86    var i;
87    for (i = 0; i < dropdowns.length; i++) {
88      var openDropdown = dropdowns[i];
89      if (openDropdown.classList.contains('show')) {
90        openDropdown.classList.remove('show');
91      }
92    }
93
94    // Remove the active class from the dropbtn and overlay from parent dropdown
95    var dropbtns = document.getElementsByClassName("dropbtn");
96    for (i = 0; i < dropbtns.length; i++) {
97      dropbtns[i].classList.remove('active');
98      var parentDropdown = dropbtns[i].closest(".dropdown");
99      parentDropdown.classList.remove('overlay');
100    }
101  }
102}
103
104// Remove classes on hover over elements with class "desp"
105var despElements = document.getElementsByClassName("desp");
106for (var j = 0; j < despElements.length; j++) {
107  despElements[j].addEventListener("mouseover", function() {
108    // Remove show class from all dropdowns
109    var dropdowns = document.getElementsByClassName("dropdown-content");
110    for (var i = 0; i < dropdowns.length; i++) {
111      dropdowns[i].classList.remove("show");
112    }
113
114    // Remove active class from all dropbtns and overlay from parent dropdowns
115    var dropbtns = document.getElementsByClassName("dropbtn");
116    for (var i = 0; i < dropbtns.length; i++) {
117      dropbtns[i].classList.remove("active");
118      var parentDropdown = dropbtns[i].closest(".dropdown");
119      parentDropdown.classList.remove("overlay");
120    }
121  });
122}
123
124// cierra el menú si se clickea fuera
125$(document).click(function(event) {
126  var clickedToggle = $(event.target).parents('.toggle');
127  
128  $('.toggle > input').each(function() {
129      if ($(this).is(':checked') && (!clickedToggle || !clickedToggle.is($(this).parent()))) {
130          $(this).prop('checked', false);
131      }
132  });
133  
134  if($('.toggle > input').is(':checked') && !clickedToggle.is('.toggle')) {
135      $('.toggle > input').prop('checked', false);
136  }
137});
138
139function savesubcat(){
140  return null
141}
142
143// dropdown button multipe
144
145jQuery(document).ready(function (e) {
146  function t(t) {
147      e(t).bind("click", function (t) {
148          t.preventDefault();
149          e(this).parent().fadeOut()
150      })
151  }
152  e(".dropbtn-m").click(function () {
153      var t = e(this).parents(".dropdown-m").children(".dropdown-content-m").is(":hidden");
154      e(".dropdown-m .dropdown-content-m").hide();
155      e(".dropdown-m .dropbtn-m").removeClass("active");
156      if (t) {
157          e(this).parents(".dropdown-m").children(".dropdown-content-m").toggle().parents(".dropdown-m").children(".dropbtn-m").addClass("active")
158      }
159  });
160  e(document).bind("click", function (t) {
161      var n = e(t.target);
162      if (!n.parents().hasClass("dropdown-m")) e(".dropdown-m .dropdown-content-m").hide();
163  });
164  e(document).bind("click", function (t) {
165      var n = e(t.target);
166      if (!n.parents().hasClass("dropdown-m")) e(".dropdown-m .dropbtn-m").removeClass("active");
167  })
168});
169
170
171/*==== Tabs horizontal ===*/
172
173$(document).ready(function(){
174  $('.tabs').each(function() {
175    var $container = $(this);
176
177    $container.find('.tab').on('click', function(evt) {
178      evt.preventDefault();
179      $container.find('.tab').removeClass('active');
180      $(this).addClass('active');
181      
182      var sel = $(this).data('toggle-target');
183      $container.find('.tab-content').removeClass('active');
184      $container.find(sel).addClass('active');
185    });
186  });
187});
188
189// smooth scroll anchor
190function scrollToTargetWithOffset(target, offset) {
191  const targetElement = target === 'top' ? document.body : document.getElementById(target);
192
193  if (targetElement) {
194      window.scrollTo({
195          top: target === 'top' ? 0 : targetElement.offsetTop - offset,
196          behavior: 'smooth'
197      });
198  }
199}
200
201document.querySelectorAll('a[href^="#"]:not([href="#"])').forEach(anchor => {
202  anchor.addEventListener('click', function (e) {
203      e.preventDefault();
204
205      const target = this.getAttribute('href').substring(1);
206      const offset = 160;
207      scrollToTargetWithOffset(target, offset);
208  });
209});
210
211//custom file Input
212$(document).ready(function() {
213  $('.btn-file').on('click', function() {
214    $(this).siblings('.file').trigger('click');
215
216    $(this).siblings('.file').on('change', function() {
217      var fileName = $(this)[0].files[0].name;    
218      $(this).siblings('.file-name').val(fileName);
219    });
220    return false;
221  });
222
223});
224
225//ancla activa
226$(document).ready(function(){
227  $(".sticky-anchor li").on('click', function(){
228    $(this).siblings().removeClass('active');
229    $(this).addClass('active')
230  })
231})
232function savesubcat(){
233  return null
234}
235
236
237$(window).scroll(function() {
238  var scrollDistance = $(window).scrollTop();
239
240  // Assign active class to nav links while scolling
241  $('.page-section').each(function(i) {
242      if ($(this).position().top <= scrollDistance) {
243          $('.navigation a.active').removeClass('active');
244          $('.navigation a').eq(i).addClass('active');
245      }
246  });
247}).scroll();
248
249
250//despliegue buscador mobile
251var isOpen = false;
252var searchBox = document.getElementById("searchBox");
253
254function toggleSearch() {
255  searchBox.classList.toggle("active");
256  isOpen = !isOpen;
257}
258
259//marquee
260/* var elements = $('ul.marquee-item-list li').length;
261for(var i=0;i < elements; i++){
262 $(".marquee-item-list").clone().prependTo( ".marquee-block" );
263};
264var liEle = [];
265var liEle = $(".marquee-item-list li"); */
266$(document).ready(function(){
267  $('.marquee-block').append($('.marquee-item-list').clone());
268});
269
270document.addEventListener("DOMContentLoaded", () => {
271  const wrapper = document.querySelector(".slider__wrapper");
272  if (wrapper) {
273    if (window.innerWidth <= 767) {
274      wrapper.innerHTML += wrapper.innerHTML; // Duplicar contenido
275    }
276  }
277});

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.