Skip to content

Commit

Permalink
feat(tp): add skip button for desktop view
Browse files Browse the repository at this point in the history
  • Loading branch information
yong-jie committed Sep 10, 2020
1 parent 1cdd852 commit d0ca036
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
3 changes: 3 additions & 0 deletions public/assets/transition-page/icons/icon-arrow-right.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 13 additions & 1 deletion public/assets/transition-page/styles/transition-page.css
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,12 @@ body {
display: block;
color: white;
font-size: 16px;
margin-bottom: 24px;
margin-bottom: 35px;
}

.loading-image {
width: 100px;
margin: 15px 0 15px;
}

.browser-image {
Expand Down Expand Up @@ -81,6 +82,17 @@ body {
font-size: 13px;
}

#skip {
display: none;
cursor: pointer;
}

#skip > span {
font-size: 13px;
color: #456682;
text-decoration: underline;
}

.footer {
position: absolute;
bottom: 70px;
Expand Down
11 changes: 11 additions & 0 deletions src/server/views/redirect.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ function proceedToDestination() {
window.location = document.getElementById('url').getAttribute('data-href')
}

setTimeout(function(){
var skipButton = document.getElementById('skip')
skipButton.style.display = 'block'
}, 2000)

var secondsUntilRedirect = 6

function handlePlural() {
Expand All @@ -42,3 +47,9 @@ var intervalId = setInterval(function(){
clearInterval(intervalId)
proceedToDestination()
}, 1000)

;(function() {
document.getElementById('skip').addEventListener('click', function (e) {
proceedToDestination()
})
})()
4 changes: 4 additions & 0 deletions src/server/views/transition-page.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
<div class="bottom-half">
<p id="url" data-href="<%- escapedLongUrl %>">You will be redirected in <span id="countdown-seconds">6</span> second<span id="s">s</span></p>
<img class="loading-image" src="/assets/transition-page/images/loading.gif" alt="loading" />
<div id="skip">
<span>I've checked the link. Skip ahead</span>
<img src="/assets/transition-page/icons/icon-arrow-right.svg" alt="right arrow" />
</div>
<div class="footer">
<img src="/assets/transition-page/icons/go-logo.svg" alt="go logo" />
<p>You will only be shown this page the first time you access this short link.</p>
Expand Down

0 comments on commit d0ca036

Please sign in to comment.