PageSourceSearch

https://www.energynomics.ro/wp-content/themes/energynomics/resurse/scripts/theme.js?ver=6abfa681ab997

js energynomics.ro collected 2026-10-02 17:18:12 UTC 4,857 bytes, 120 lines download raw bytes

1"use strict";
2
3/* When the user scrolls down, hide the navbar. When the user scrolls up, show the navbar */
4var prevScrollpos = window.pageYOffset;
5window.onscroll = function() {
6	var currentScrollPos = window.pageYOffset;
7	if (prevScrollpos > currentScrollPos) {
8		document.querySelector(".header-top").style.top = "0";
9		document.querySelector(".header-top").style.position = "relative";
10	} else {
11		document.querySelector(".header-top").style.top = "-50px";
12		document.querySelector(".header-top").style.position = "absolute";
13	}
14	prevScrollpos = currentScrollPos;
15}
16
17
18/* close / expand banner bottom widget */
19let bannerContainer = document.getElementById('banner-container');
20let bannerTop = document.getElementById('banner-top');
21let openIcon = document.getElementById('open-icon');
22let downIcon = document.getElementById('down-icon');
23let bannerBottom = document.getElementById('banner');
24let valuePropsUL = document.getElementById('banner-header-value-props');
25let close_banner_cookie = getCookie("close_banner");
26
27if(close_banner_cookie != 1 || close_banner_cookie == null){
28
29	bannerTop.addEventListener('click', function() {
30	  if((openIcon.style.display === 'none') || (openIcon.style.display === '') ) {
31	    console.log('close banner');
32	    closeBanner();
33	  } else {
34	    console.log('expand banner');
35	    openBanner();
36	  }
37	});
38}
39
40
41function openBanner() {
42  openIcon.style.display = 'none';
43  downIcon.style.display = 'block';
44  valuePropsUL.style.display = 'none';
45  bannerContainer.style.transform = 'translateY(0)';
46  bannerBottom.style.opacity = '1';
47  bannerBottom.style.marginBottom = '20px';
48  document.cookie = "close_banner=0";
49}
50
51function closeBanner() {
52  downIcon.style.display = 'none';
53  openIcon.style.display = 'block';
54  valuePropsUL.style.display = 'block';
55  bannerContainer.style.transform = 'translateY(65px)';
56  bannerBottom.style.opacity = '0';
57  bannerBottom.style.margin = '0';
58  document.cookie = "close_banner=1";
59}
60
61/* get_cookie function helper */
62function getCookie(cname) {
63  let name = cname + "=";
64  let decodedCookie = decodeURIComponent(document.cookie);
65  let ca = decodedCookie.split(';');
66  for(let i = 0; i <ca.length; i++) {
67    let c = ca[i];
68    while (c.charAt(0) == ' ') {
69      c = c.substring(1);
70    }
71    if (c.indexOf(name) == 0) {
72      return c.substring(name.length, c.length);
73    }
74  }
75  return "";
76}
77
78/* Style newsletter iframe content */
79(function() {
80  function styleNewsletterIframe() {
81    var iframe = document.querySelector('.nl_home iframe');
82    if (iframe) {
83      try {
84        var iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
85        if (iframeDoc) {
86          var style = iframeDoc.createElement('style');
87          style.textContent = `
88            .TurnKeyCRM { font-size: 11px !important; }
89            .TurnKeyCRM fieldset { margin: 5px !important; padding: 5px !important; }
90            .TurnKeyCRM legend { font-size: 12px !important; line-height: 1.2 !important; margin-bottom: 5px !important; }
91            .TurnKeyCRM label { font-size: 10px !important; line-height: 1.2 !important; padding-top: 2px !important; margin-bottom: 1px !important; }
92            .TurnKeyCRM .InputBlock { margin-bottom: 5px !important; }
93            .TurnKeyCRM input[type="text"], .TurnKeyCRM input[type="email"], .TurnKeyCRM input[type="date"], .TurnKeyCRM input[type="password"], .TurnKeyCRM select, .TurnKeyCRM textarea { font-size: 10px !important; padding: 3px 4px !important; height: 22px !important; line-height: 1.2 !important; margin-top: 2px !important; margin-bottom: 3px !important; }
94            .TurnKeyCRM input[type="submit"], .TurnKeyCRM input[type="button"], .TurnKeyCRM button { font-size: 10px !important; padding: 4px 8px !important; margin-top: 5px !important; height: 26px !important; }
95            .TurnKeyCRM .Description { font-size: 9px !important; line-height: 1.2 !important; margin-top: 2px !important; margin-bottom: 2px !important; }
96            body { font-size: 11px !important; line-height: 1.2 !important; }
97            p, div, span { margin-top: 2px !important; margin-bottom: 2px !important; padding-top: 0 !important; padding-bottom: 0 !important; }
98          `;
99          iframeDoc.head.appendChild(style);
100        }
101      } catch (e) {
102        // Cross-origin restriction - use CSS transform instead
103        console.log('Cannot access iframe content due to cross-origin policy');
104      }
105    }
106  }
107  
108  // Try to style iframe when it loads
109  if (document.readyState === 'loading') {
110    document.addEventListener('DOMContentLoaded', function() {
111      setTimeout(styleNewsletterIframe, 1000);
112    });
113  } else {
114    setTimeout(styleNewsletterIframe, 1000);
115  }
116  
117  // Also try after a delay to catch dynamically loaded iframes
118  setTimeout(styleNewsletterIframe, 2000);
119  setTimeout(styleNewsletterIframe, 3000);
120})();

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.