Advertisement
Guest User

Untitled

a guest
May 17th, 2013
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. window.addEvent("load",function(){
  2.     $$(".gkIsWrapper-fp").each(function(el){
  3.         if(!el.hasClass('activated')) {
  4.             el.addClass('activated');  
  5.             var elID = el.getProperty("id");
  6.             var wrapper = document.id(elID);
  7.             var $G = $Gavick[elID];
  8.             $G['actual_animation'] = false;
  9.             $G['actual_slide'] = 0;
  10.             var slides = [];
  11.             var contents = [];
  12.             var loadedImages = false;
  13.             var btns = false;
  14.             var btns_fx = false;
  15.             var show_btns = false;
  16.             var hovers = false;
  17.             var hovers_fx = false;
  18.    
  19.             if(window.webkit) wrapper.getElement('.gkIsContent').setStyles({"margin-left":0,"margin-right":0});
  20.    
  21.             wrapper.getElements('.gkIsContent').setStyle('overflow',"hidden");
  22.             wrapper.getElement('.gkIsContent').setStyle('height',wrapper.getSize().y+"px");
  23.             wrapper.getElements('.gkIsArt').removeClass('gkUnvisible');
  24.             wrapper.getElements('.gkIsArt').setOpacity(0);
  25.             wrapper.getElement('.gkIsArt').setOpacity(1);
  26.    
  27.             switch($G['anim_type']){
  28.                 case 'opacity': break;
  29.                 case 'top':
  30.                     wrapper.getElements('.gkIsArt').setStyle('margin-top',(-1) * wrapper.getSize().y);
  31.                     wrapper.getElement('.gkIsArt').setStyle('margin-top',0);
  32.                 break;     
  33.                
  34.                 case 'bottom':  
  35.                     wrapper.getElements('.gkIsArt').setStyle('margin-top', wrapper.getSize().y);
  36.                     wrapper.getElement('.gkIsArt').setStyle('margin-top', 0);
  37.                 break; 
  38.             }
  39.            
  40.             if(wrapper.getElement('.gkIsPrev')) {
  41.                 btns = [wrapper.getElement('.gkIsPrev'),wrapper.getElement('.gkIsNext')];
  42.                 hovers = [wrapper.getElement('.gkIsPrev div'), wrapper.getElement('.gkIsNext div')];
  43.                 btns_fx = [new Fx.Tween(btns[0],{property:'opacity', duration:350}),new Fx.Tween(btns[1],{property:'opacity', duration:350})];
  44.                 hovers[0].setStyle("display","block");
  45.                 hovers[1].setStyle("display","block");
  46.                 hovers_fx = [new Fx.Tween(hovers[0],{property:'opacity',duration:200}).set(0),new Fx.Tween(hovers[1],{property:'opacity',duration:200}).set(0)];
  47.                 btns[0].addEvent("mouseenter", function(){hovers_fx[0].start(1);});
  48.                 btns[0].addEvent("mouseleave", function(){hovers_fx[0].start(0);});
  49.                 btns[1].addEvent("mouseenter", function(){hovers_fx[1].start(1);});
  50.                 btns[1].addEvent("mouseleave", function(){hovers_fx[1].start(0);});
  51.    
  52.                 if(window.getWidth() < wrapper.getSize().x + 80){
  53.                     btns[0].setStyles({'left': '10px', 'z-index' : 100});
  54.                     btns[1].setStyles({'right': '10px','z-index' : 100});
  55.                 }
  56.             }
  57.            
  58.             var imagesToLoad = [];
  59.            
  60.             if(btns && btns[0].hasClass('anim')){
  61.                 btns_fx[0].set(0);
  62.                 btns_fx[1].set(0);
  63.    
  64.                 wrapper.addEvent("mousemove",function(){
  65.                     show_btns = true
  66.                 });
  67.    
  68.                 [wrapper.getElement('.gkIsPrev'), wrapper.getElement('.gkIsNext'), wrapper].each(function(el){
  69.                     el.addEvent("mouseenter", function(){
  70.                         show_btns = true;
  71.                         btns_fx[0].start(1);   
  72.                         btns_fx[1].start(1);   
  73.                     });
  74.                    
  75.                     el.addEvent("mouseleave", function(){
  76.                         show_btns = false;
  77.                         (function(){
  78.                             if(show_btns == false){
  79.                                 btns_fx[0].start(0);
  80.                                 btns_fx[1].start(0);
  81.                             }
  82.                         }).delay(1000);
  83.                     });
  84.                 });
  85.             }
  86.            
  87.             wrapper.getElements('.gkIsSlide').each(function(el,i){
  88.                 var newImg = new Element('img',{
  89.                     "title":el.getProperty('title'),
  90.                     "class":el.getProperty('class'),
  91.                     "style":el.getProperty('style')
  92.                 });
  93.    
  94.                 newImg.setProperty("src",el.innerHTML);
  95.                 imagesToLoad.push(newImg);
  96.                 newImg.injectAfter(el);
  97.                 el.destroy();
  98.             });
  99.    
  100.             var time = (function(){
  101.                 var process = 0;               
  102.                 imagesToLoad.each(function(el,i){
  103.                     if(el.complete) process++;
  104.                 });
  105.    
  106.                 if(process == imagesToLoad.length){
  107.                     $clear(time);
  108.                     loadedImages = process;
  109.                     (function(){new Fx.Tween(wrapper.getElement('.gkIsPreloader'),{property:'opacity'}).start(1,0);}).delay(400);
  110.                 }
  111.             }).periodical(200);
  112.    
  113.             var time_main = (function(){
  114.                 if(loadedImages){
  115.                     $clear(time_main);
  116.                    
  117.                     wrapper.getElements(".gkIsSlide").each(function(elmt,i){
  118.                         slides[i] = elmt;
  119.                     });
  120.                    
  121.                     slides.each(function(el,i){
  122.                         if(i != 0) el.setOpacity(0);
  123.                     });
  124.    
  125.                     $G['actual_slide'] = 0;
  126.                     if(wrapper.getElement('.gkIsList')) wrapper.getElement('.gkIsList ul li').setProperty("class", "active");
  127.                     if($G['autoanimation']){
  128.                         $G['actual_animation'] = (function(){
  129.                             gk_is_corporate2_anim(wrapper, contents, slides, $G['actual_slide']+1, $G);
  130.                         }).periodical($G['anim_interval']+$G['anim_speed']);
  131.                     }
  132.    
  133.                     if(btns){
  134.                         btns[0].addEvent("click", function(){
  135.                             $clear($G['actual_animation']);
  136.                             gk_is_corporate2_anim(wrapper, contents, slides, $G['actual_slide']-1, $G);
  137.                             if($G['autoanimation']){
  138.                                 $G['actual_animation'] = (function(){
  139.                                     gk_is_corporate2_anim(wrapper, contents, slides, $G['actual_slide']+1, $G);
  140.                                 }).periodical($G['anim_interval']+$G['anim_speed']);
  141.                             }
  142.                         });
  143.    
  144.                         btns[1].addEvent("click", function(){
  145.                             $clear($G['actual_animation']);
  146.                             gk_is_corporate2_anim(wrapper, contents, slides, $G['actual_slide']+1, $G);
  147.                             if($G['autoanimation']){
  148.                                 $G['actual_animation'] = (function(){
  149.                                     gk_is_corporate2_anim(wrapper, contents, slides, $G['actual_slide']+1, $G);
  150.                                 }).periodical($G['anim_interval']+$G['anim_speed']);                       
  151.                             }
  152.                         });
  153.                     }
  154.    
  155.                     if(wrapper.getElement('.gkIsList')){
  156.                         wrapper.getElements('.gkIsList li').each(function(el,i){
  157.                             el.addEvent("click", function(){
  158.                                 $clear($G['actual_animation']);
  159.                                 gk_is_corporate2_anim(wrapper, contents, slides, i, $G);
  160.    
  161.                                 if($G['autoanimation']){
  162.                                     $G['actual_animation'] = (function(){
  163.                                         gk_is_corporate2_anim(wrapper, contents, slides, $G['actual_slide']+1, $G);
  164.                                     }).periodical($G['anim_interval']+$G['anim_speed']);
  165.                                 }
  166.                             });
  167.                         });
  168.                     }
  169.                 }
  170.             }).periodical(250);
  171.         }
  172.     });
  173. });
  174.  
  175. function gk_is_corporate2_anim(wrapper, contents, slides, which, $G){
  176.     if(which != $G['actual_slide']){
  177.         var max = slides.length-1;
  178.         if(which > max) which = 0;
  179.         if(which < 0) which = max;
  180.         var actual = $G['actual_slide'];
  181.         $G['actual_slide'] = which;
  182.         slides[$G['actual_slide']].setStyle("z-index",max+1);
  183.         new Fx.Tween(slides[actual],{property:'opacity', duration: $G['anim_speed']}).start(1,0);
  184.         new Fx.Tween(slides[which],{property:'opacity', duration: $G['anim_speed']}).start(0,1);   
  185.         var text_fx1 = new Fx.Tween(wrapper.getElements('.gkIsArt')[actual],{property:'opacity', duration: $G['anim_speed'] / 2});
  186.         var text_fx2 = new Fx.Tween(wrapper.getElements('.gkIsArt')[which],{property:'opacity', duration: $G['anim_speed'] / 2});
  187.         text_fx1.start(1,0);
  188.         text_fx2.start(0,1);
  189.        
  190.         switch($G['anim_type']){
  191.                 case 'opacity': break;
  192.                 case 'top': new Fx.Tween(wrapper.getElements('.gkIsArt')[actual],{property:'margin-top',duration: 0.25 * $G['anim_speed'], transitions:Fx.Transitions.Circ.easeOut}).start(0, wrapper.getSize().y);break;
  193.                 case 'bottom': new Fx.Tween(wrapper.getElements('.gkIsArt')[actual],{property:'margin-top', duration: 0.25 * $G['anim_speed'], transitions:Fx.Transitions.Circ.easeOut}).start(0, (-1) * wrapper.getSize().y);break;
  194.         }
  195.  
  196.             switch($G['anim_type']){
  197.                 case 'opacity': break;
  198.                 case 'top': new Fx.Tween(wrapper.getElements('.gkIsArt')[which],{property:'margin-top',duration: 0.75 * ($G['anim_speed']), transitions:Fx.Transitions.Circ.easeOut}).start((-1)*wrapper.getSize().y,0);break;
  199.                 case 'bottom': new Fx.Tween(wrapper.getElements('.gkIsArt')[which],{property:'margin-top',duration: 0.75 * ($G['anim_speed']), transitions:Fx.Transitions.Circ.easeOut}).start(wrapper.getSize().y,0);break;
  200.             }
  201.  
  202.             text_fx1.start(0,1);
  203.  
  204.         if(wrapper.getElement('.gkIsList')){
  205.             wrapper.getElements('.gkIsList ul li').setProperty("class", "");
  206.             wrapper.getElements('.gkIsList ul li')[which].setProperty("class", "active");
  207.         }
  208.  
  209.         (function(){slides[$G['actual_slide']].setStyle("z-index",$G['actual_slide']);}).delay($G['anim_speed']);
  210.     }
  211. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement