Created
August 5, 2018 08:40
-
-
Save joseph-tran-tn/5e966a2e52475a3c088ec5fd24cfa90f to your computer and use it in GitHub Desktop.
Random member in AliveVietnam's Team
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.getScript("http://localhost/sparkleHover.js", function() { | |
console.log("Script loaded but not necessarily executed."); | |
$(".team-wrap").sparkleHover({ | |
lifespan: 1000, | |
}); | |
$(".team-wrap ul").sparkleHover({ | |
colors : ['purple', 'pink', 'red'], | |
num_sprites: 24, | |
lifespan: 1000, | |
radius: 800, | |
sprite_size: 24, | |
shape: "triangle", | |
}); | |
}); | |
prepareLottery(); | |
$(window).keyup(function(e){ | |
if(e.keyCode == 13) {run()} | |
if(e.keyCode == 32) {run(1)} | |
}) | |
function prepareLottery() { | |
$(".team-wrap li").eq(28).remove(); | |
$(".team-wrap li").eq(24).remove(); | |
$(".team-wrap li").eq(12).remove(); | |
$(".team-wrap li").eq(0).remove(); | |
$(".team-wrap ul").prepend('<li style="display: none; height: 249px; position: relative;"><figure class="team-box" itemscope="" itemtype="http://schema.org/Person"><div class="img-box"><img itemprop="image" src="https://alive-web.vn/assets/images/team/bac.jpg" alt="" width="502" height="350" pagespeed_url_hash="2944614542" onload="pagespeed.CriticalImages.checkImageForCriticality(this);"></div><figcaption><h3 itemprop="name">Luu Hoang Bac</h3><p itemprop="jobTitle">Developer</p><a href="https://alive-web.vn/team/p305/" itemprop="url"></a></figcaption></figure></li>') | |
$(".team-wrap ul").prepend('<li style="display: none; height: 249px; position: relative;"><figure class="team-box" itemscope="" itemtype="http://schema.org/Person"><div class="img-box"><img itemprop="image" src="https://alive-web.vn/assets/images/team/trang.jpg" alt="" width="502" height="350" pagespeed_url_hash="2944614542" onload="pagespeed.CriticalImages.checkImageForCriticality(this);"></div><figcaption><h3 itemprop="name">Vo Thi Thuy Trang</h3><p itemprop="jobTitle">Developer</p><a href="https://alive-web.vn/team/p305/" itemprop="url"></a></figcaption></figure></li>') | |
$(".team-wrap ul").prepend('<li style="display: none; height: 249px; position: relative;"><figure class="team-box" itemscope="" itemtype="http://schema.org/Person"><div class="img-box"><img itemprop="image" src="https://alive-web.vn/assets/images/team/minh.jpg" alt="" width="502" height="350" pagespeed_url_hash="2944614542" onload="pagespeed.CriticalImages.checkImageForCriticality(this);"></div><figcaption><h3 itemprop="name">Le Ngoc Minh</h3><p itemprop="jobTitle">Developer</p><a href="https://alive-web.vn/team/p305/" itemprop="url"></a></figcaption></figure></li>') | |
$(".team-wrap ul").prepend('<li style="display: none; height: 249px; position: relative;"><figure class="team-box" itemscope="" itemtype="http://schema.org/Person"><div class="img-box"><img itemprop="image" src="https://alive-web.co.jp/wp/wp-content/uploads/2012/11/1804_card.jpg" alt="" width="502" height="350" pagespeed_url_hash="2944614542" onload="pagespeed.CriticalImages.checkImageForCriticality(this);"></div><figcaption><h3 itemprop="name">Vo Ngoc Y Nhi</h3><p itemprop="jobTitle">Designer</p><a href="https://alive-web.vn/team/p305/" itemprop="url"></a></figcaption></figure></li>') | |
$(".team-wrap ul").prepend('<li style="display: none; height: 249px; position: relative;"><figure class="team-box" itemscope="" itemtype="http://schema.org/Person"><div class="img-box"><img itemprop="image" src="https://alive-web.vn/assets/images/team/wakana.jpg" alt="" width="502" height="350" pagespeed_url_hash="2944614542" onload="pagespeed.CriticalImages.checkImageForCriticality(this);"></div><figcaption><h3 itemprop="name">林わかな</h3><p itemprop="jobTitle">Designer</p><a href="https://alive-web.vn/team/p305/" itemprop="url"></a></figcaption></figure></li>') | |
$(".team-wrap ul").prepend('<li style="display: none; height: 249px; position: relative;"><figure class="team-box" itemscope="" itemtype="http://schema.org/Person"><div class="img-box"><img itemprop="image" src="https://alive-web.co.jp/wp/wp-content/uploads/2014/03/miwa-2.jpg" alt="" width="502" height="350" pagespeed_url_hash="2944614542" onload="pagespeed.CriticalImages.checkImageForCriticality(this);"></div><figcaption><h3 itemprop="name">三輪 尚士</h3><p itemprop="jobTitle">CEO / Founder</p><a href="https://alive-web.vn/team/p305/" itemprop="url"></a></figcaption></figure></li>') | |
$(".team-wrap li").eq(0).slideDown() | |
$(".team-wrap li").eq(1).slideDown() | |
$(".team-wrap li").eq(2).slideDown() | |
$(".team-wrap li").eq(3).slideDown() | |
$(".team-wrap li").eq(4).slideDown() | |
$(".team-wrap li").eq(5).slideDown() | |
} | |
function getRandom(){ | |
var max = $(".team-wrap li").length; | |
return Math.random() * (max - 0) + 0; | |
} | |
function run(test = 0) { | |
var name, count = 0; | |
$("body").append('<style>*{background-color:#000; color: #fff;}*:hover{opacity:1!important;}</style>'); | |
$("footer, header").remove(); | |
$(".custom_pager").remove(); | |
$("#breadcrumb").remove(); | |
$("#team #wrap").attr('style', 'padding-top:0!important'); | |
$(".topTitle h1").html('The battle... begin').css({'font-weight':'100', 'margin-bottom':'30px'}); | |
$(".topTitle h1 span").remove(); | |
$(".team-wrap li").css({ | |
'width': '50%', | |
'margin': '0 auto', | |
'float': 'none', | |
'height': 'auto!important', | |
}); | |
if(count > 0) $(".team-wrap li:visible").remove(); | |
count++; | |
$(".team-wrap").css({'text-align' : 'center', 'margin': '20px 0 0 0'}) | |
$(".team-wrap .item").css({'float': 'none', 'display': 'inline-block', 'width': '50%'}) | |
if($(".team-wrap #subTitle").length == 0) $(".topTitle h1").after('<div id="subTitle" class="taC fwB fz20"></div>'); | |
var refreshIntervalId = setInterval(function(){ | |
var randomNum = parseInt(getRandom()); | |
$(".team-wrap li").hide(); | |
$(".team-wrap li").eq(randomNum).fadeIn(10); | |
name = $(".team-wrap li:visible").find('h3').html(); | |
console.log(randomNum + ': ' + name); | |
},100) | |
var aud = new Audio(); | |
aud.src = 'http://localhost/lottery.wav'; | |
aud.play(); | |
$(".topTitle h1").html('6') | |
var timer = 5; | |
$(".topTitle h1").html(timer) | |
var countTime = setInterval(function(){ | |
timer-- | |
$(".topTitle h1").html(timer) | |
}, 1000); | |
setTimeout(function(){ | |
clearInterval(refreshIntervalId) | |
clearInterval(countTime) | |
$(".topTitle h1").html('0') | |
if(test == 0) { | |
$(".team-wrap li").hide(); | |
$(".team-wrap li").eq(6).fadeIn(10); | |
} | |
name = $(".team-wrap li:visible").find('h3').html(); | |
console.log(name); | |
$(".topTitle h1").html('Congratulation: ' + name); | |
aud.pause(); | |
$(".team-wrap").trigger('mouseover') | |
setInterval(function(){ | |
$(".team-wrap").trigger('mouseover') | |
},1000) | |
setTimeout(function(){ | |
$(".team-wrap ul").trigger('mouseover') | |
setInterval(function(){ | |
$(".team-wrap ul").trigger('mouseover') | |
},1000) | |
},300) | |
},6000) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment