PageSourceSearch

https://www.livextension.com/wp-content/themes/lx16/js/main.js?v=?v=1791597520

js livextension.com collected 2026-10-10 01:58:59 UTC 20,457 bytes, 824 lines download raw bytes

1var isMinWidthForFx;
2var isMinHeightForFx;
3var minWidthForFx = 768;
4var minHeightForFx = 500;
5
6var scrollCount = 1;
7var scrollSlideCount = 1;
8var slideNum = 3;
9
10var creaLines = false;
11var oritop =-1 ;
12                     
13var sectionIds = [];
14var currentSection=0;
15var totalSections;
16
17var timeout;
18var checkedFirstScroll = false;
19var slideWorkHeight;
20var currentSlide = 0;
21
22var hovering = false;
23
24var creaTimer;
25var disableDesktopFX = true;
26
27  console.log(allMinimized+" "+vers);
28
29$(window).load(function(){
30
31  var img = $('#ch-1').find('img');
32  var outW = img.width();
33  var inW = $('#ch-1').width();
34  var margin = (outW - inW ) / -2;
35   img.css('left', margin);
36
37 
38
39
40
41});
42
43
44$(window).one('scroll',function() {
45    clearTimeout(timeout);  
46    timeout = setTimeout(function() {
47
48    checkSectionVisibility();
49
50
51    }, 500);
52});
53var resizeTimer;
54
55$(window).on('resize', function(e) {
56
57  clearTimeout(resizeTimer);
58  resizeTimer = setTimeout(function() {
59
60  checkDims();
61  $('#risultati, #crea, .circle').removeAttr('style');
62
63  }, 250);
64
65});
66
67
68
69function checkDims(){
70    var docWidth = $(document).width();
71    var docHeight = $(window).height();
72    
73    if (docWidth > minWidthForFx ) {isMinWidthForFx = true;} else {isMinWidthForFx = false;}
74    if (docHeight > minHeightForFx ) {isMinHeightForFx = true;} else {isMinHeightForFx = false;}
75    
76    if ( isMinWidthForFx && isMinHeightForFx ) disableDesktopFX = false; else disableDesktopFX = true;
77 //   console.clear();
78 //   console.log(docWidth,isMinWidthForFx, docHeight,isMinHeightForFx, "--->", disableDesktopFX);
79
80}    
81
82
83
84$(document).ready(function(){
85
86$('a[href^="http://"], a[href^="https://"]').not('a[href*=livextension]').not('.popup').attr('target','_blank');
87  checkDims();
88
89setBlogBlocks();
90
91if (isSingle) {
92
93  $("#sticky-side").stick_in_parent({parent: "#master-section", offset_top : 40});
94console.log(isSingle);
95}
96
97if
98 (isBlogArchive) $('#menu-item-2344').addClass('current-menu-item');
99
100
101
102
103  $('.home #livextension-logo').click(function(e){
104    e.preventDefault();
105    goToSection('#intro-area');
106  });
107
108  $('.home .menu-item:last-child').click(function(e){
109    if(disableDesktopFX) return;
110    e.preventDefault();
111    toggleForm();
112  });
113
114
115
116  $('#news')
117  .mouseenter(function(){
118    $('.mainframe2').addClass('hovered');
119  })
120  .mouseleave(function(){
121    $('.mainframe2').removeClass('hovered');
122  });
123
124 
125
126  var lastAnimation = 0;
127  var animationTime = 900; // in ms
128  var quietPeriod = 300; // in ms, time after animation to ignore mousescroll
129
130  slideWorkHeight = $('.ch').first().height()-40;
131   
132  $('.popup').click(function(e){
133      if( !disableDesktopFX ) {
134          e.preventDefault();
135          window.open( $(this).attr('href'), "Condividi", "width=500,height=500");
136      
137      }
138      
139  });
140
141
142  $('.next-work').click(function(){
143    nextWork();
144  })
145
146  $('.prev-work').click(function(){
147    prevWork();
148  });
149
150
151// Find all YouTube videos
152var $allVideos = $('iframe[src*="vimeo.com"]'),
153
154    // The element that is fluid width
155    $fluidEl = $(".post-content");
156
157
158//   console.log($allVideos);
159
160// Figure out and save aspect ratio for each video
161$allVideos.each(function(i) {
162  var vidtype="horizontal";
163  var frH = parseInt ( $(this).attr("height") );
164  var frW = parseInt ( $(this).attr("width") ) ;
165
166
167  if( frH > frW ) vidtype="vertical";
168  if( frH == frW ) vidtype="square";
169// console.log(i, frW, frH, vidtype);
170
171
172  $(this)
173  .addClass("ifvid")
174    .wrap( "<div class='videoWrapperOut "+vidtype+" '><div class='videoWrapper'></div></div>" )
175    .data('aspectRatio', this.height / this.width)
176
177    // and remove the hard coded width/height
178    .removeAttr('height')
179    .removeAttr('width');
180
181});
182
183
184
185
186  function nextWork(){
187    $('#ch-box')
188      .animate({'top':"-="+slideWorkHeight},500)
189      .toggleClass('oddPosition');
190
191  }
192  function prevWork(){
193      $('#ch-box')
194      .animate({'top':"+="+slideWorkHeight},500)
195      .toggleClass('oddPosition');
196  }
197  function startTimer(){
198      if( isMinWidthForFx && isMinHeightForFx) creaTimer = setInterval ( function() {toggleCreaLines();}, 6000);
199
200  }
201  // startTimer();
202  $('#crea, #risultati').click(function() {
203    if( disableDesktopFX) return; 
204    // clearInterval(creaTimer);
205    
206   toggleCreaLines();
207    
208  });
209
210  function toggleCreaLines() {
211             $('#creativity-details span').each(function(i){
212            var row = $(this);
213              setTimeout( function() { row.toggleClass('visible'); }, i*300);
214            });
215            $('.circle').each(function(i){
216            var circle = $(this);
217              setTimeout( function() {circle.toggleClass('visible');}, i*150);
218            });
219       $('#creativity-details').toggleClass('visible')
220
221            creaLines = !creaLines;
222    
223    }
224
225
226  function scrollThis(event, delta, deltaX, deltaY) {
227  var section = $(this).data('sectionName');
228
229    if(disableDesktopFX) return;
230      var timeNow = new Date().getTime();
231
232      deltaOfInterest = deltaY;
233      
234      if (deltaOfInterest == 0) return;
235      
236      if(timeNow - lastAnimation < quietPeriod + animationTime) {
237          event.preventDefault();
238          return;
239      }
240      if (deltaOfInterest < 0 && section=="contacts") return;
241
242      if (deltaOfInterest < 0) {
243              nextSection();
244      } else {
245          prevSection();
246      }
247          lastAnimation = timeNow;        
248  }
249
250
251
252  if(isHome && isMinHeightForFx && isMinWidthForFx ) $('section, #form-box').mousewheel(scrollThis);
253
254  $('#ch-text').hover(function() {
255    $('.main-ch').addClass('hovered');
256  });
257
258
259  $('.ch, .main-ch').on( {
260     'mouseenter':function() {   
261      $('.main-ch').removeClass('hovered');
262      $(this).addClass('hovered');
263  },
264     'mouseleave':function() {   $(this).removeClass('hovered') }
265  });
266
267   enableMobileMenu();
268
269  var sectionNavy='';
270  var filledClass='';
271
272
273  $('section').each(function(i){
274    var id = $(this).attr('id');
275    sectionIds.push('#'+id); 
276    if ( i==0 ) filledClass = "filled "; else filledClass = "";
277    totalSections = sectionIds.length-1;
278    var sectionName = $(this).data('sectionLabel');; 
279    sectionNavy += '<div class="mini-menu-item go-section" data-target="#'+id+'"><span class="mini-label">'+sectionName+'</span><div class="disc '+filledClass+'"></div></div>';
280  });
281
282
283  $('#scroller').after( '<div id="section-navy">'+ sectionNavy +'</div>');
284
285
286  $('.go-next').on('click',function(e) {
287      e.preventDefault;
288      nextSection();
289   });
290
291
292  $('.go-intro').on('click',function(e) {
293      e.preventDefault;
294      goToSection('#intro');
295   });
296
297  $('.go-section').on('click', function(e) {
298    e.preventDefault;
299    var id = $(this).data('target');
300    goToSection(id);
301   });
302
303
304
305  var hovering = false;
306  var updating;
307
308  var hovering2 = false;
309  var updating2;
310
311  $(window).scroll(function (event) {
312      var scroll = $(window).scrollTop();
313      if(scroll > 100 ) 
314          $('#top-header').addClass('movedbody');
315      else
316          $('#top-header').removeClass('movedbody');
317
318  });
319
320
321var maxSlide = $('.slide-stage').length-1;
322
323
324$('.go-next-slide').on('click',function(){
325    changeSlide(1)
326})
327$('.go-prev-slide').on('click',function(){
328    changeSlide(-1)
329})
330
331function changeSlide(factor) {
332
333  var absTop = $('#slide-screen').css('top') ;
334  var lastItemTop = $('.ch').last().offset().top ;
335  var screenH = $('#slide-screen').height()+60;
336
337    if ( absTop == "0px" && factor == -1 ) return;
338   if ( lastItemTop < screenH && factor == 1 ) return;
339  currentSlide += factor;
340   if(currentSlide > maxSlide) currentSlide = 0;
341  if(currentSlide < 0) currentSlide = maxSlide;
342
343  // $('.current-slide').removeClass('current-slide');
344  // $('#slide-'+currentSlide).addClass('current-slide');
345  var plusminus = "-=";
346  if (factor<0) plusminus = "+=";
347  var newTop = plusminus + $('.ch').first().height() + "px";
348  $('#slide-screen').animate({'top': newTop},500,function(){
349
350
351  });
352
353
354 
355}
356
357function getRandom(min, max) {
358  return Math.random() * (max - min) + min;
359}
360
361    if(isHome) $('body').mousemove(function (e) {
362
363    //  console.clear();
364    //  console.log(isMinWidthForFx,isMinHeightForFx,disableDesktopFX);
365
366         //  parallax(e, this, 1);
367
368    parallax2(e, document.getElementById('balloon'), 2.3);
369
370
371    scaleZoom(e, document.getElementById('moving-phone'), 10);
372
373     parallax(e, document.getElementById('legs'), 1.2);
374     parallax(e, document.getElementById('buildings'), 1);
375
376     parallax(e, document.getElementById('crea'), 1.4);
377
378     parallax(e, document.getElementById('ci1'), 2);
379     parallax(e, document.getElementById('ci2'), 1.9);
380     parallax(e, document.getElementById('ci3'), 1.8);
381     parallax(e, document.getElementById('ci4'), 2);
382     // parallax(e, document.getElementById('ci5'), 2.4);
383     // parallax(e, document.getElementById('ci6'), 2);
384
385     parallax(e, document.getElementById('risultati'), 1.6);
386     parallax(e, document.getElementById('creativity-details'), 2);
387     parallax(e, document.getElementById('mountains'), 1.4);
388     parallax(e, document.getElementById('mountains-2'), 0.8);
389    
390    });
391 
392
393
394
395
396$('.creativity-out').hover( 
397    function(){
398
399      hovering2 = true;
400      updating2 = setInterval(  updateStuffPos2 , 200);
401    
402    },
403
404    function(){
405   // $('.creativity-out').css('background-position-y','0') ;
406     //   hovering2 = false;
407        scrollSlideCount=1;
408        clearInterval(updating2);
409     }
410);
411
412
413$('.main h1, .main2 h2, #weird-list-close').click(function(){
414  toggleInfo();
415})
416
417
418
419  
420 $('.flexslider').each(function(){
421 
422    var data = $(this).data();
423     $(this).flexslider({
424        animation: data.animation,              //String: Select your animation type, "fade" or "slide"
425        animationLoop : data.loop,
426        slideshow: data.auto,                //Boolean: Animate slider automatically
427        slideshowSpeed: data.slideduration,           //Integer: Set the speed of the slideshow cycling, in milliseconds
428        animationSpeed: data.transitionspeed,            //Integer: Set the speed of animations, in milliseconds
429        startAt: 0,                     //Integer: The slide that the slider should start on. Array notation (0 = first slide)
430        initDelay: 0,                   //{NEW} Integer: Set an initialization delay, in milliseconds
431         
432        // Usability features
433        pauseOnAction: data.pauseaction,            //Boolean: Pause the slideshow when interacting with control elements, highly recommended.
434        pauseOnHover: data.pausehover,  
435                  //Boolean: Pause the slideshow when hovering over slider, then resume when no longer hovering
436
437        manualControls: data.controls,             //Selector: Declare custom control navigation. Examples would be ".flex-control-nav li" or "#tabs-nav li img", etc. The number of elements in your controlNav should match the number of slides/tabs.
438
439        
440        // Primary Controls
441        controlNav: data.controlnav,               //Boolean: Create navigation for paging control of each clide? Note: Leave true for manualControls usage
442        directionNav: data.directionnav,             //Boolean: Create navigation for previous/next navigation? (true/false)
443        prevText: "Previous",           //String: Set the text for the "previous" directionNav item
444        nextText: "Next",      
445
446
447        useCSS: true,                   //{NEW} Boolean: Slider will use CSS3 transitions if available
448        touch: true,                    //{NEW} Boolean: Allow touch swipe navigation of the slider on touch-enabled devices
449        video: false,                   //{NEW} Boolean: If using video in the slider, will prevent CSS3 3D Transforms to avoid graphical glitches
450      
451      // Callback API
452        start: function(){
453        },            //Callback: function(slider) - Fires when the slider loads the first slide
454        before: function(){},           //Callback: function(slider) - Fires asynchronously with each slider animation
455        after: function(){
456        },            //Callback: function(slider) - Fires after each slider animation completes
457        end: function(){},              //Callback: function(slider) - Fires when the slider reaches the last slide (asynchronous)
458        added: function(){},            //{NEW} Callback: function(slider) - Fires after a slide is added
459        removed: function(){}           //{NEW} Callback: function(slider) - Fires after a slide is removed
460      
461      
462      
463        
464     });
465 
466 });
467
468 
469  
470});
471
472
473
474function nextSection() {
475  if(currentSection==totalSections) return;
476  currentSection++;
477  var target =  sectionIds[currentSection];
478  goToSection(target);
479}
480  
481function prevSection() {
482    if(currentSection==0) return;
483
484    currentSection--;
485    var target =  sectionIds[currentSection];
486    goToSection(target);
487  }
488  
489function fillDisc(targetIndex){
490
491  var targetDisc = $('.disc').eq(targetIndex);
492
493
494  if( !$(targetDisc).hasClass('filled') ){
495    $('.disc').removeClass('filled');
496    $('.disc').eq(targetIndex).addClass('filled');
497
498  }
499}
500
501
502
503
504function goToSection(target) {
505    var targetIndex = sectionIds.indexOf( target );  
506
507    currentSection = targetIndex;
508    checkScroller();
509
510    fillDisc(targetIndex);
511     // target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
512      $('.active').removeClass('active');
513      if (target.length) {
514        if(target=="#creativity-area") {
515
516            $('#balloon').animate({ bottom : '440px'},5000 );
517        }
518        if(target=="#contacts-area") {
519         $('#scroller').addClass('invisible');
520        showForm();
521         } else { 
522         $('#scroller').removeClass('invisible');
523
524        hideForm(); 
525      }
526
527        $('html,body').animate(
528
529          { scrollTop: $(target).offset().top  },
530          1000, 
531          function() {$(target).addClass('active');}
532        
533        );
534
535
536
537        return false;
538      }
539
540}
541
542
543function checkScroller(){
544   if(currentSection==totalSections) {
545    // $('#scroller').removeClass('go-next').addClass('go-intro');
546    }
547    else {
548 
549    }
550
551}
552
553function scaleZoom(e, target, layer) {
554    
555    var scroll = $(window).scrollTop();
556    var realPageY= scroll-e.pageY;
557   
558    // $(window).height() : 1.5 = posY : scale
559    var minRange = 0.8;
560    var maxRange = 1.5;
561
562    var minRangeY = -10;
563    var maxRangeY = 50;
564
565    var delta =   minRange + parseFloat ( Math.abs(   (maxRange - minRange) * -e.pageX / $(window).width() ).toFixed(2) ) ;
566    var deltaY =   minRangeY + parseFloat ( Math.abs(   (maxRangeY - minRangeY) * -realPageY / $(window).height() ).toFixed(2) ) ;
567    
568    var newX =  -80 * delta* 2;
569    var newW = 600 * delta;
570    var newH= 335 * delta;
571    var newY = deltaY +"%";
572
573    $(target).css( {  width: newW, height:newH, right: newX, top: newY } );
574
575
576}
577
578
579
580function parallax(e, target, layer) {
581 
582// console.log (disableDesktopFX);
583    if ( disableDesktopFX ) return;
584
585    var initX = $(target).data('inx');
586    var initY = $(target).data('iny');
587    if (!initX) {
588      var initX =   parseInt ( $(target).css('left').replace(/[^-\d\.]/g, '') );
589      $(target).data('inx',initX);
590     }
591
592    if (!initY) {
593      var initY =   parseInt ( $(target).css('bottom').replace(/[^-\d\.]/g, '') );
594      $(target).data('iny',initY);
595     }
596
597    var layer_coeff = 10 / layer;
598
599    var scroll = $(window).scrollTop();
600    var realPageY= scroll-e.pageY;
601
602    var x = ($(window).width() - target.offsetWidth) / 2 - (e.pageX - ($(window).width() / 2)) / layer_coeff;
603    var y = ($(window).height() - target.offsetHeight) / 2 - (realPageY - ($(window).height() / 2)) / layer_coeff;
604
605    centerX = parseInt  ( $(window).width() / 2 );
606    xDiff = -1*( e.pageX - centerX );
607
608    centerY = parseInt  ( $(window).height() / 2 );
609    yDiff =  Math.abs(realPageY) - centerY  ;
610  //  x = parseInt ( x / 5 ) -50;
611    
612    var xx =  parseInt ( $(target).css('left').replace(/[^-\d\.]/g, '') );
613    var x = initX + ( xDiff / layer_coeff ) ;
614
615
616    var yy =  parseInt ( $(target).css('bottom').replace(/[^-\d\.]/g, '') );
617    var y = initY + ( yDiff / layer_coeff * 1.5  ) ;
618 
619    $(target).css( {  bottom :  y+'px' } );
620
621    if(e.pageX > 0 ) $(target).css( {  left : x +'px' } );
622
623
624
625
626};
627
628function parallax2 (e, target, layer) {
629 
630// console.log (disableDesktopFX);
631    if ( disableDesktopFX ) return;
632
633    var initX = $(target).data('inx');
634
635    if (!initX) {
636      var initX =   parseInt ( $(target).css('left').replace(/[^-\d\.]/g, '') );
637      $(target).data('inx',initX);
638     }
639
640
641    var layer_coeff = 10 / layer;
642
643    var scroll = $(window).scrollTop();
644    var realPageY= scroll-e.pageY;
645
646    var x = ($(window).width() - target.offsetWidth) / 2 - (e.pageX - ($(window).width() / 2)) / layer_coeff;
647
648    centerX = parseInt  ( $(window).width() / 2 );
649    xDiff = -1*( e.pageX - centerX );
650  //  x = parseInt ( x / 5 ) -50;
651    
652
653
654    var xx =  parseInt ( $(target).css('left').replace(/[^-\d\.]/g, '') );
655    var x = initX + ( xDiff / layer_coeff ) ;
656    if(e.pageX > 0 ) $(target).css( {  left : x +'px' } );
657
658
659};
660
661
662
663function updateStuffPos2 () {
664
665 var h = $('#creative-slide').height();
666if ( scrollSlideCount > slideNum ) scrollSlideCount=1;
667 if (hovering2 ) {
668
669 var newP= (h*scrollSlideCount ) - h;
670 
671    $('.creativity-out').css('background-position-y', newP) ;
672    scrollSlideCount++;
673
674  }
675
676}
677
678function toggleInfo() {
679
680 
681      var waitTime = 0;
682      if(!$('.bg-back').hasClass('visible')  ) {
683        waitTime = 500; 
684        $('#about-this').fadeOut();
685      }
686      else{
687        $('#about-this').fadeIn();
688      }
689
690      $('#weird-list-close').toggleClass('visible');
691
692          toggleInfoRows();
693          setTimeout( function() { 
694                $('.bg-back').toggleClass('visible');
695                $('.main2').toggleClass('visible');
696         }, waitTime);
697
698}
699
700function toggleInfoRows() {
701          $('span.anim').each(function(i){
702          var row = $(this);
703            setTimeout( function() {row.toggleClass('animated');}, i*200);
704          });
705        }
706
707
708
709
710   
711function startStellarParallax(){
712  	$.stellar({
713  		horizontalScrolling: false,
714  		verticalOffset: 40
715  	});
716  
717  }
718
719
720  
721function enableMobileMenu(){
722           $('.mobile-menu').click(function(e){
723              e.preventDefault();
724              $('#navy').toggleClass('enabled');
725          })
726  
727}
728
729
730
731function getScrollOffsets(w) {
732
733    // Use the specified window or the current window if no argument 
734    w = w || window;
735
736    // This works for all browsers except IE versions 8 and before
737    if (w.pageXOffset != null) return {
738        x: w.pageXOffset, 
739        y:w.pageYOffset
740    };
741
742    // For IE (or any browser) in Standards mode
743    var d = w.document;
744    if (document.compatMode == "CSS1Compat") {
745        return {
746            x:d.documentElement.scrollLeft, 
747            y:d.documentElement.scrollTop
748        };
749    }
750
751    // For browsers in Quirks mode
752    return { 
753        x: d.body.scrollLeft, 
754        y: d.body.scrollTop 
755    }; 
756}
757 
758
759
760
761function checkSectionVisibility() {
762 var visibleSection = "";
763 $('section').each(function(){
764    if (  $(this).visible()  ) visibleSection = $(this).attr('id');
765    return;
766
767 });
768   if(visibleSection){
769    $('section.active').addClass('active');
770    $("#"+visibleSection).addClass('active');
771
772  var currentIndex = sectionIds.indexOf( "#"+visibleSection );  
773
774  if(currentIndex) {
775      currentSection = currentIndex;
776      if( currentSection==5  ) showForm();
777      if( currentSection==1  ) $('#balloon').animate({ bottom : '440px'},5000 );
778      fillDisc(currentSection);
779 
780    }
781
782  };
783
784}
785function toggleForm(){
786if( $('#form-box').hasClass('visible') ) hideForm();
786 else showForm();
787
788}
789
790function hideForm(){
791
792  $('.contact-info').removeClass('visible');
793  $('.relevant').removeClass('invisible');
794  $('#form-box').removeClass('visible');
795  $('.contact-us').text('Contattaci')
796
797}
798
799function showForm(){
800console.log(1);
801  var target =  sectionIds[currentSection];
802//   if(target=="#contacts-area") $('.contact-info').addClass('visible');
803 $('.contact-info').addClass('visible');
804
805  $(target).find('.relevant').addClass('invisible');
806  $('#form-box').addClass('visible');
807    $('.contact-us').text('Chiudi')
808
809}
810
811
812function setBlogBlocks() {
813 var postHeight=0;
814  $('#archive-index .highlight').each(function(){
815    var el = $(this);
816    var h = el.height();
817    if( h > postHeight ) postHeight = h;
818  })
819  if(disableDesktopFX) $('#archive-index .highlight').css('height','auto');
820  else $('#archive-index .highlight').height(postHeight);
821
822}
823
824

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.