Skip to content

Commit

Permalink
feat: 支持随机友链
Browse files Browse the repository at this point in the history
  • Loading branch information
hikariyo committed May 14, 2023
1 parent 28d1744 commit 759e63b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions layout/includes/page/flink.pug
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.flink
- let pageContent = page.content
if page.flink_url
- let pageRandom = page.random
script.
(()=>{
const replaceSymbol = (str) => {
Expand All @@ -19,6 +20,9 @@

let listResult = ""
const lists = str[i].link_list
if (!{pageRandom}) {
lists.sort(() => Math.random() - 0.5)
}
for(let j = 0; j < lists.length; j++){
listResult += `
<div class="flink-list-item">
Expand Down Expand Up @@ -48,8 +52,8 @@
- let classDesc = i.class_desc ? `<div class="flink-desc">${i.class_desc}</div>` : ""

- let listResult = ""

each j in i.link_list
- let list = page.random ? i.link_list.slice().sort(() => Math.random() - 0.5) : i.link_list
each j in list
-
listResult += `
<div class="flink-list-item">
Expand Down

0 comments on commit 759e63b

Please sign in to comment.