PageSourceSearch

https://ctfc.cat/js/script.js

js ctfc.cat collected 2026-09-24 09:00:22 UTC 3,313 bytes, 97 lines download raw bytes

1$(document).ready(function() {
2	
3	
4
5	/* SMOOTH SCROLLING SCRIPT*//*
6	// Add smooth scrolling to all links
7	$(".navbar-nav li a").on('click', function(event) {
8
9		// Make sure this.hash has a value before overriding default behavior
10		if (this.hash !== "") {
11			// Prevent default anchor click behavior
12			event.preventDefault();
13
14			// Store hash
15			var hash = this.hash;
16
17			// Using jQuery's animate() method to add smooth page scroll
18			// The optional number (800) specifies the number of milliseconds it takes to scroll to the specified area
19			$('html, body').animate({
20				scrollTop: $(hash).offset().top
21			}, 800, function(){
22
23				// Add hash (#) to URL when done scrolling (default click behavior)
24				window.location.hash = hash;
25			});
26		} // End if
27	});*/
28
29	/****************************BACK TO TOP************************************/
30	$('#scroll-top-div').on('click', function (e) {
31        e.preventDefault();
32        $('html,body').animate({
33            scrollTop: 0
34        }, 700);
35    });
36	
37	/*tariem el meny styky
38	/* Navigation Menu*/
39	/*var offsettop = $('.navbar').offset().top;
40	if (offsettop > 50) {
41        $('.navbar').addClass('colored-nav');
42        $('.navbar').addClass('gradient-violat');
43        $("#scroll-top-div").fadeIn('500');
44    } else {
45        $('.navbar').removeClass('colored-nav');
46        $('.navbar').removeClass('gradient-violat');
47        $("#scroll-top-div").fadeOut('500');
48    }
49	var num = 50; ///number of pixels before modifying styles
50
51	$(window).bind('scroll', function () {
52	    if ($(window).scrollTop() > num) {
53	        $('.navbar').addClass('colored-nav');
54	        $('.navbar').addClass('gradient-violat');
55	        $("#scroll-top-div").fadeIn('500');
56	    } else {
57	        $('.navbar').removeClass('colored-nav');
58	        $('.navbar').removeClass('gradient-violat');
59	        $("#scroll-top-div").fadeOut('500');
60	    }
61	});*/
62	
63	
64
65  // Processem tots els elements amb id "variable" (només si existeixen)
66  const elements = document.querySelectorAll('#variable');
67  
68  if (elements.length === 0) return; // Sortim si no hi ha elements
69  
70  elements.forEach((el) => {
71    // Analitzem el text per detectar paraules llargues
72    const textContent = el.textContent || el.innerText;
73    const words = textContent.split(/\s+/);
74    const longWords = words.filter(word => word.length > 12);
75    
76    if (longWords.length > 0) {
77      // Reduïm la font proporcionalment segons la paraula més llarga
78      const longestWord = Math.max(...longWords.map(word => word.length));
79      const style = window.getComputedStyle(el, null).getPropertyValue('font-size');
80      const currentSize = parseFloat(style);
81      const reductionFactor = Math.min(1, 12 / longestWord);
82      const newSize = Math.max(8, currentSize * reductionFactor);
83      
84      el.style.fontSize = newSize + 'px';
85    }
86    
87    // Fallback: reduïm si encara desborda
88    while (el.scrollWidth > el.clientWidth || el.scrollHeight > el.clientHeight) {
89      const style = window.getComputedStyle(el, null).getPropertyValue('font-size');
90      const currentSize = parseFloat(style);
91      if (currentSize <= 8) break;
92      el.style.fontSize = (currentSize - 1) + 'px';
93    }
94  });
95 
96});
97

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.