mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-05-02 07:47:34 +00:00
fa5a70cd19
* nav in process
* edited web.yml
* navbar issue fixed
* added theme switcher
* added privacy matters section
* added features section
* updated nav padding
* added network section
* improved sidebar dark mode colors
* added footer
* simplex private section added
* added some improvements
* nav issue fixed
* simplex unique section added
* a small fix
* added overlay & data to some sections
* added overlay to simplex unique section
added some improvements to other sections too
* added a small fix
* updated CNAME
* markdown files for why simplex is unique
* Revert "markdown files for why simplex is unique"
This reverts commit ef728218f7.
* added hero section
* added comparison and simplex explained section
* added blogs page
* added articles page
* a small fix in hero section
* added contact page
* updated contact
* created files for overlay content
* a light update
* hero animation
* working on hero
* added responsiveness for mobile
* a quick fix
* added responsiveness to tablet screen
* added responsiveness for desktop screen on hero section
* switch theme of hero
* nav color update
* set comparisons sections
* switch theme of comparisons section
* added responsiveness in simplex explained section
* add logic to simplex explained
* added theme switcher to simplex explained
* manage join simplex section
* update what makes simplex private
* a quick update
* add improvements
* a bit update
* add improvements
* texts for why privacy matters section
* update headers
* texts for "why unique" and "features" sections
* EOLs
* update swipers
* update & add transitions to simplex unique section
* updated overlays
* increase the size of cross on overlays
* add overlays to hero
* website: texts for "private" and "explained" sections (#5)
* website: texts for "private" section
* texts for simplex explained
* blog previews and images (#6)
* blog previews and images
* text for dark mode
* add link style
* add overlay to -> unlike p2p networks
* add picture with blue arrows to simplex explained
* update blog list layout
* remove extra css
* bigger navigation circles & center positions
* make bullets (dots) bigger
* make private scroll thicker
* update hero & footer mobile download btns
* fix dark mode animation files (#7)
* improved contrast for light animation in hero section (#8)
* remove old animation
* Made Hero Pixel Perfect to Desktop
* texts in hero section overlays (#10)
* texts in hero section overlays
* replace hero video
* eol
* update footer links (#11)
* update footer links
* eol
* texts, links, fix layout (#12)
* mailchimp form (#13)
* site meta tags (#14)
* site meta tags
* update blog og:url
* amend texts
* font
* update text
* contact page
* Making things Polished in Hero (#15)
* Made Video Responsive on Tablet
* Fixed the issues
* remove extra files for home & contact page
* update invitation
* refactoring
* fix nav for dark
* quick fix
* update blog list layout
* refactoring
* disable inactive nav circles
* contact page
* fix mobile
* detect platform & show btns according to it
* contact & invitation page setting
* complete contact/invitation page
* create variables for download btns
* fixes for hero - for tablet & mobile
* update hero layout
* update footer layout
* increase the size of logo in navbar
* updated nav & footer logos
* add links to join simplex section
* text for p2p networks section
* text on contact page about link
* add touchstart handler to close popup
* update APK links
* update CNAME
Co-authored-by: M Sarmad Qadeer <MSarmadQadeer@gmail.com>
Co-authored-by: Ojas Shukla <54703305+whizzbbig@users.noreply.github.com>
130 lines
3.9 KiB
JavaScript
130 lines
3.9 KiB
JavaScript
window.addEventListener("load", function () {
|
|
const imgPath = "/img/hero"
|
|
const fastImages = mkFastImages(0, 20);
|
|
const slowImages = mkSlowImages([
|
|
["0005", 3],
|
|
["0008", 1],
|
|
["0009", 2],
|
|
["0011", 3],
|
|
["0014", 3],
|
|
["0017", 1],
|
|
["0018", 2],
|
|
["0020", 2],
|
|
["0022", 2],
|
|
["0024", 3],
|
|
["0027", 1],
|
|
["0028", 2],
|
|
["0030", 2],
|
|
["0032", 3],
|
|
["0035", 1],
|
|
["0036", 2],
|
|
["0038", 1],
|
|
["0039", 1]
|
|
])
|
|
|
|
let complete = false;
|
|
run();
|
|
window.onload = run;
|
|
|
|
function mkFastImages(from, to) {
|
|
const seq = [];
|
|
for (let n = from; n <= to; n++) {
|
|
let img = "" + n;
|
|
img = "0".repeat(4 - img.length) + img;
|
|
seq.push([`${imgPath}/light/10fps/${img}.webp`, `${imgPath}/dark/10fps/${img}.webp`, 1]);
|
|
}
|
|
return seq;
|
|
}
|
|
|
|
function mkSlowImages(images) {
|
|
return images.map(([img, n]) => [`${imgPath}/light/2fps/${img}.webp`, `${imgPath}/dark/2fps/${img}.webp`, n])
|
|
}
|
|
|
|
// function setupScroll (imgBackground) {
|
|
// const totalHeight = this.document.body.scrollHeight - this.window.innerHeight;
|
|
// this.window.onscroll = () => {
|
|
// let progressHeight = (window.pageYOffset / totalHeight) * 100;
|
|
// if (progressHeight > 10) {
|
|
// imgBackground.style.position = "absolute";
|
|
// imgBackground.style.top = "100%";
|
|
// } else {
|
|
// imgBackground.style.position = "fixed";
|
|
// imgBackground.style.top = "auto";
|
|
// }
|
|
// };
|
|
// }
|
|
|
|
async function run() {
|
|
const lightImageEl = document.getElementById("hero-phone-light");
|
|
const darkImageEl = document.getElementById("hero-phone-dark");
|
|
const preloadEl = document.getElementById("hero-phone-preload");
|
|
const imgBackground = document.getElementsByClassName("hero-phone-background")[0]
|
|
const videoEl = this.document.getElementById("hero-phone-video")
|
|
if (complete || !lightImageEl || !darkImageEl || !preloadEl || !imgBackground || !videoEl) return;
|
|
complete = true;
|
|
// setupScroll(imgBackground)
|
|
await preload(fastImages.concat(slowImages));
|
|
await animate(fastImages, 100);
|
|
await delay(500)
|
|
await animate(slowImages, 500);
|
|
// todo - this should happen on scroll, not when animation ends
|
|
lightImageEl.style.animationName = "big";
|
|
darkImageEl.style.animationName = "big";
|
|
videoEl.style.animationName = "bigvideo";
|
|
if (window.innerWidth > 1279) {
|
|
videoEl.style.display = "block";
|
|
}
|
|
|
|
async function preload(images) {
|
|
let imgEls = [];
|
|
let resolved = false;
|
|
return new Promise((resolve) => {
|
|
setTimeout(() => {
|
|
if (!resolved) {
|
|
resolved = true;
|
|
resolve();
|
|
}
|
|
}, 2000);
|
|
for (const [lightImg, darkImg] of images) {
|
|
preloadImg(lightImg)
|
|
preloadImg(darkImg)
|
|
}
|
|
|
|
function preloadImg(img) {
|
|
const el = document.createElement("img");
|
|
el.src = img;
|
|
imgEls.push(el);
|
|
preloadEl.appendChild(el);
|
|
const loaded = () => {
|
|
imgEls = imgEls.filter((e) => e !== el);
|
|
if (imgEls.length === 0 && !resolved) {
|
|
resolved = true;
|
|
resolve();
|
|
}
|
|
};
|
|
el.addEventListener("load", loaded);
|
|
el.addEventListener("error", loaded);
|
|
}
|
|
});
|
|
}
|
|
|
|
async function animate(images, ms) {
|
|
let i = 0;
|
|
for (const [lightImg, darkImg, n] of images) {
|
|
lightImageEl.src = lightImg;
|
|
darkImageEl.src = darkImg;
|
|
i++;
|
|
if (ms == 500 && i > 16) {
|
|
// TODO this is hack, also this should happen on scroll, not during the animation
|
|
lightImageEl.style.animationName = "small";
|
|
darkImageEl.style.animationName = "small";
|
|
}
|
|
await delay(ms * n);
|
|
}
|
|
}
|
|
|
|
async function delay(ms) {
|
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
}
|
|
}
|
|
}); |