<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript">
function init()
{
var a=text_search();animation_elements=animation_tag_search(a),hide_elems_page_load()
}
function construct_elements_array(a)
{
for(var b=0;b<a.length;b++)
{
var c=a[b],d=c.elements[0];elements_array[b]=
{
elements:c.elements,animation:c.animation,activated:!1,top:d.offset().top,bottom:d.offset().top+d.height()
}
}
}
function init_elements()
{
for(var a=0;a<elements_array.length;a++)
{
var b=elements_array[a].elements,c=elements_array[a].activated;switch(elements_array[a].animation)
{
case"fade":for(var d=0;d<b.length;d++)c||b[d].css("opacity",1);break;case"slide-left":for(var d=0;d<b.length;d++)c||b[d].css(
{
position:"relative",left:-page_width
}
);break;case"slide-right":for(var d=0;d<b.length;d++)c||b[d].css(
{
position:"relative",left:page_width
})
}
elements_array[a].top=b[0].offset().top
}
}
function hide_elems_page_load()
{
for(var a=0;a<animation_elements.length;a++)for(var b=animation_elements[a].elements,c=0;c<b.length;c++)b[c].css(
{
opacity:0
})
}
function show_elems_page_load()
{
for(var a=0;a<elements_array.length;a++)for(var b=elements_array[a].elements,c=elements_array[a].animation,d=0;d<b.length;d++)"fade"!=c&&b[d].css(
{
opacity:1
})
}
function text_search()
{
var a=[];return $.fn.mytext=function()
{
var a="";return this.contents().each(function()
{
3==this.nodeType&&(a+=this.textContent||this.innerText||"")
}),a
}
,$("*").not("script").not("style").each(function(b,c)
{
var d=$(this).mytext();d=d.replace(/\s+/g,""),d&&0!==d.length&&null!=d&&""!=d&&""!==d&&a.push($(this))
}),a
}
function animation_tag_search(a)
{
for(var b=[],c=0;c<a.length;)
{
var d=a[c].html();if(d.indexOf("[fade]")>=0||d.indexOf("[slide-left]")>=0||d.indexOf("[slide-right]")>=0)
{
var e={};d.indexOf("[fade]")>=0?(a[c].html(d.replace("[fade]","")),e.animation="fade",e.elements=search_for_end_tag(a,c,"[/fade]")):d.indexOf("[slide-left]")>=0?(a[c].html(d.replace("[slide-left]","")),e.animation="slide-left",e.elements=search_for_end_tag(a,c,"[/slide-left]")):d.indexOf("[slide-right]")>=0&&(a[c].html(d.replace("[slide-right]","")),e.animation="slide-right",e.elements=search_for_end_tag(a,c,"[/slide-right]")),b.push(e),c+=e.elements.length
}
else c++
}
return b
}
function search_for_end_tag(a,b,c)
{
for(var d=!1,e=[],f=b;0==d&&f<a.length;)
{
e.push(a[f]);var g=a[f].html();g.indexOf(c)>=0?(a[f].html(g.replace(c,"")),d=!0):d=!1,f++
}
return e
}
function animate_elements()
{
for(var a=$(window).scrollTop()+window.innerHeight/4*3+scroll_offset,b=0;b<elements_array.length;b++)
{
var c=elements_array[b].elements;if(elements_array[b].top<a&&!elements_array[b].activated)
{
switch(elements_array[b].animation)
{
case"fade":for(var d=0;d<c.length;d++)c[d].delay(animation_delay).animate(
{
opacity:1
}
,
{
duration:1e3,easing:"swing"
}
);break;case"slide-left":for(var d=0;d<c.length;d++)c[d].delay(animation_delay).animate(
{
left:0
}
,
{
duration:1e3,easing:"swing"
}
)
}
elements_array[b].activated=!0
}
}
}
var elements=null,animation_elements=[],elements_array=[],scroll_offset=0,width_offset=0,page_width=$(window).width()+width_offset,animation_delay=800;init(),$(window).load(function()
{
construct_elements_array(animation_elements),init_elements(),animate_elements(),animation_delay=200,show_elems_page_load()
}
),$(document).scroll(function()
{
animate_elements()
}
),$(window).resize(function()
{
page_width=$(window).width()+width_offset,init_elements()
}
);
</script>