Skip to content

Commit

Permalink
Allow the homepage to show only download link (#142)
Browse files Browse the repository at this point in the history
  • Loading branch information
mewim authored Feb 14, 2024
1 parent 2aebc99 commit ea57dd3
Show file tree
Hide file tree
Showing 3 changed files with 122 additions and 118 deletions.
21 changes: 21 additions & 0 deletions assets/js/download.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,27 @@ if (isLinux) {

let selectedPlatform = platform;

const showOnlyDownloadSection = () => {
/**
* This is a hack to show only the download section.
* It clones the download section and replaces the entire body with it.
*/
const downloadSection = document.querySelector("section#download");
const downloadSectionCopy = downloadSection.cloneNode(true);
document.body.innerHTML = `<div id="wrapper"><div id="main"></div></div>`;
const main = document.querySelector("#main");
main.appendChild(downloadSectionCopy);
document.title = "Download Kùzu";
downloadSectionCopy.querySelector("header").remove();
document.body.style.backgroundColor = "white";
};

if( window.location.hash === "#download-only" ) {
showOnlyDownloadSection();
}

$("body").show();

const detectedPlatformSpan = $("#detected-platform-span");
if (!Object.values(PLATFORMS).includes(platform)) {
detectedPlatformSpan.text(`${platform} (Unsupported)`);
Expand Down
215 changes: 98 additions & 117 deletions assets/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,120 +4,101 @@
Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
*/

(function($) {

var $window = $(window),
$body = $('body'),
$main = $('#main');

// Breakpoints.
breakpoints({
xlarge: [ '1281px', '1680px' ],
large: [ '981px', '1280px' ],
medium: [ '737px', '980px' ],
small: [ '481px', '736px' ],
xsmall: [ '361px', '480px' ],
xxsmall: [ null, '360px' ]
});

// Play initial animations on page load.
$window.on('load', function() {
window.setTimeout(function() {
$body.removeClass('is-preload');
}, 100);
});

// Nav.
var $nav = $('#nav');

if ($nav.length > 0) {

// Shrink effect.
$main
.scrollex({
mode: 'top',
enter: function() {
$nav.addClass('alt');
},
leave: function() {
$nav.removeClass('alt');
},
});

// Links.
var $nav_a = $nav.find('a');

$nav_a
.scrolly({
speed: 1000,
offset: function() { return $nav.height(); }
})
.on('click', function() {

var $this = $(this);

// External link? Bail.
if ($this.attr('href').charAt(0) != '#')
return;

// Deactivate all links.
$nav_a
.removeClass('active')
.removeClass('active-locked');

// Activate link *and* lock it (so Scrollex doesn't try to activate other links as we're scrolling to this one's section).
$this
.addClass('active')
.addClass('active-locked');

})
.each(function() {

var $this = $(this),
id = $this.attr('href'),
$section = $(id);

// No section for this link? Bail.
if ($section.length < 1)
return;

// Scrollex.
$section.scrollex({
mode: 'middle',
initialize: function() {

// Deactivate section.
if (browser.canUse('transition'))
$section.addClass('inactive');

},
enter: function() {

// Activate section.
$section.removeClass('inactive');

// No locked links? Deactivate all links and activate this section's one.
if ($nav_a.filter('.active-locked').length == 0) {

$nav_a.removeClass('active');
$this.addClass('active');

}

// Otherwise, if this section's link is the one that's locked, unlock it.
else if ($this.hasClass('active-locked'))
$this.removeClass('active-locked');

}
});

});

}

// Scrolly.
$('.scrolly').scrolly({
speed: 1000
});

})(jQuery);
(function ($) {
var $window = $(window),
$body = $("body"),
$main = $("#main");

$body.hide();
// Breakpoints.
breakpoints({
xlarge: ["1281px", "1680px"],
large: ["981px", "1280px"],
medium: ["737px", "980px"],
small: ["481px", "736px"],
xsmall: ["361px", "480px"],
xxsmall: [null, "360px"],
});

// Play initial animations on page load.
$window.on("load", function () {
window.setTimeout(function () {
$body.removeClass("is-preload");
}, 100);
});

// Nav.
var $nav = $("#nav");

if ($nav.length > 0) {
// Shrink effect.
$main.scrollex({
mode: "top",
enter: function () {
$nav.addClass("alt");
},
leave: function () {
$nav.removeClass("alt");
},
});

// Links.
var $nav_a = $nav.find("a");

$nav_a
.scrolly({
speed: 1000,
offset: function () {
return $nav.height();
},
})
.on("click", function () {
var $this = $(this);

// External link? Bail.
if ($this.attr("href").charAt(0) != "#") return;

// Deactivate all links.
$nav_a.removeClass("active").removeClass("active-locked");

// Activate link *and* lock it (so Scrollex doesn't try to activate other links as we're scrolling to this one's section).
$this.addClass("active").addClass("active-locked");
})
.each(function () {
var $this = $(this),
id = $this.attr("href"),
$section = $(id);

// No section for this link? Bail.
if ($section.length < 1) return;

// Scrollex.
$section.scrollex({
mode: "middle",
initialize: function () {
// Deactivate section.
if (browser.canUse("transition")) $section.addClass("inactive");
},
enter: function () {
// Activate section.
$section.removeClass("inactive");

// No locked links? Deactivate all links and activate this section's one.
if ($nav_a.filter(".active-locked").length == 0) {
$nav_a.removeClass("active");
$this.addClass("active");
}

// Otherwise, if this section's link is the one that's locked, unlock it.
else if ($this.hasClass("active-locked"))
$this.removeClass("active-locked");
},
});
});
}

// Scrolly.
$(".scrolly").scrolly({
speed: 1000,
});
})(jQuery);
4 changes: 3 additions & 1 deletion assets/js/team.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,7 @@ for (const member of members) {
memberWrapper.appendChild(memberImg);
memberWrapper.appendChild(textWrapper);
memberDiv.appendChild(memberWrapper);
teamMembersDiv.appendChild(memberDiv);
if (teamMembersDiv) {
teamMembersDiv.appendChild(memberDiv);
}
}

0 comments on commit ea57dd3

Please sign in to comment.