Skip to content

Commit

Permalink
update desktop download link
Browse files Browse the repository at this point in the history
  • Loading branch information
hyrious committed Nov 9, 2023
1 parent 4331399 commit cddd1fc
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 39 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@
<p class="center subtitle">Simultaneously supports iOS, Android, iPadOS, macOS, Windows versions, not limited by devices</p>

<div class="download-list mt4">
<a class="mobile-disabled" href="https://flat-storage-sg.oss-accelerate.aliyuncs.com/versions/latest/stable/win/Flat-x64-2.3.1.exe">
<a class="mobile-disabled" href="https://flat-storage-sg.oss-accelerate.aliyuncs.com/versions/latest/stable/win/Flat-x64-2.3.2.exe">
<div class="icon-container">
<img src="./image/windows.svg" alt="windows">
</div>
Expand Down
77 changes: 39 additions & 38 deletions utils/index.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
export function getCurrentLanguage() {
return location.pathname.split("/").filter(Boolean)[0] || "en"
return location.pathname.split("/").filter(Boolean)[0] || "en";
}

export function isChinese() {
return getCurrentLanguage() === "zh"
return getCurrentLanguage() === "zh";
}

export function macDownloadBody() {
const href = (arch) => `https://flat-storage-sg.oss-accelerate.aliyuncs.com/versions/latest/stable/mac/Flat-${arch}-2.3.1.dmg`
const m1 = href('arm64')
const intel = href('x64')
const href = (arch) =>
`https://flat-storage-sg.oss-accelerate.aliyuncs.com/versions/latest/stable/mac/Flat-${arch}-2.3.2.dmg`;
const m1 = href("arm64");
const intel = href("x64");

return isChinese()
? ` <div class="modal-header">
return isChinese()
? ` <div class="modal-header">
<img class="modal-close-btn" src="../image/close.svg" alt="close modal">
</div>
<div class="modal-body">
Expand All @@ -34,7 +35,7 @@ export function macDownloadBody() {
<li>查看芯片类型是「Intel」还是「Apple」,并选择对应版本下载</li>
</ul>
</div>`
: ` <div class="modal-header">
: ` <div class="modal-header">
<img class="modal-close-btn" src="./image/close.svg" alt="close modal">
</div>
<div class="modal-body">
Expand All @@ -59,60 +60,60 @@ export function macDownloadBody() {
}

export function generateModalItem({ value }, callback) {
const p = document.createElement("p")
p.innerHTML = value
p.on("click", callback)
return p
const p = document.createElement("p");
p.innerHTML = value;
p.on("click", callback);
return p;
}

/**
*
*
* @param {*} param container options
* @param {*} type mobile or desktop
* @returns
* @returns
*/
export function addModal({ id, bodyCls }, type = "mobile") {
const modalContainer =
type === "mobile"
? generateMobileModalContainer({ id, bodyCls })
: generateDesktopModalContainer({ id, bodyCls });

const modalContainer = type === "mobile"
? generateMobileModalContainer({ id, bodyCls })
: generateDesktopModalContainer({ id, bodyCls })
setTimeout(() => {
modalContainer.classList.add("active");
}, 0);

setTimeout(() => {
modalContainer.classList.add('active');
}, 0);

appendToBody(modalContainer)
return modalContainer
appendToBody(modalContainer);
return modalContainer;
}

function generateDesktopModalContainer({ id, bodyCls }) {
const div = document.createElement("div")
div.setAttribute("id", id)
div.classList.add('modal-root');
div.classList.add('disabled');
const div = document.createElement("div");
div.setAttribute("id", id);
div.classList.add("modal-root");
div.classList.add("disabled");

div.innerHTML = `
div.innerHTML = `
<div class="modal-mask modal-mask"></div>
<div class="modal-wrap ${bodyCls}"></div>
`
`;

return div
return div;
}

function generateMobileModalContainer({ id, bodyCls }) {
const div = document.createElement("div")
div.setAttribute("id", id)
div.classList.add('modal-root');
div.classList.add('disabled');
const div = document.createElement("div");
div.setAttribute("id", id);
div.classList.add("modal-root");
div.classList.add("disabled");

div.innerHTML = `
div.innerHTML = `
<div class="modal-mask modal-mask-mobile"></div>
<div class="modal-wrap-mobile ${bodyCls}"></div>
`
`;

return div
return div;
}

function appendToBody(el) {
el && document.body.append(el)
el && document.body.append(el);
}

0 comments on commit cddd1fc

Please sign in to comment.