mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-22 03:50:55 +08:00
This commit is contained in:
parent
b4bbabde4e
commit
23af5742a0
@ -824,26 +824,27 @@ export const bazaar = {
|
|||||||
const localSort = window.siyuan.storage[Constants.LOCAL_BAZAAR];
|
const localSort = window.siyuan.storage[Constants.LOCAL_BAZAAR];
|
||||||
const panelElement = selectElement.parentElement.parentElement;
|
const panelElement = selectElement.parentElement.parentElement;
|
||||||
let html = "";
|
let html = "";
|
||||||
|
const cardElements = Array.from(panelElement.querySelectorAll(".b3-card"));
|
||||||
if (selectElement.value === "0") { // 更新时间降序
|
if (selectElement.value === "0") { // 更新时间降序
|
||||||
Array.from(panelElement.querySelectorAll(".b3-card")).sort((a, b) => {
|
cardElements.sort((a, b) => {
|
||||||
return JSON.parse(b.getAttribute("data-obj")).updated < JSON.parse(a.getAttribute("data-obj")).updated ? -1 : 1;
|
return JSON.parse(b.getAttribute("data-obj")).updated < JSON.parse(a.getAttribute("data-obj")).updated ? -1 : 1;
|
||||||
}).forEach((item) => {
|
}).forEach((item) => {
|
||||||
html += item.outerHTML;
|
html += item.outerHTML;
|
||||||
});
|
});
|
||||||
} else if (selectElement.value === "1") { // 更新时间升序
|
} else if (selectElement.value === "1") { // 更新时间升序
|
||||||
Array.from(panelElement.querySelectorAll(".b3-card")).sort((a, b) => {
|
cardElements.sort((a, b) => {
|
||||||
return JSON.parse(b.getAttribute("data-obj")).updated < JSON.parse(a.getAttribute("data-obj")).updated ? 1 : -1;
|
return JSON.parse(b.getAttribute("data-obj")).updated < JSON.parse(a.getAttribute("data-obj")).updated ? 1 : -1;
|
||||||
}).forEach((item) => {
|
}).forEach((item) => {
|
||||||
html += item.outerHTML;
|
html += item.outerHTML;
|
||||||
});
|
});
|
||||||
} else if (selectElement.value === "2") { // 下载次数降序
|
} else if (selectElement.value === "2") { // 下载次数降序
|
||||||
Array.from(panelElement.querySelectorAll(".b3-card")).sort((a, b) => {
|
cardElements.sort((a, b) => {
|
||||||
return JSON.parse(b.getAttribute("data-obj")).downloads < JSON.parse(a.getAttribute("data-obj")).downloads ? -1 : 1;
|
return JSON.parse(b.getAttribute("data-obj")).downloads < JSON.parse(a.getAttribute("data-obj")).downloads ? -1 : 1;
|
||||||
}).forEach((item) => {
|
}).forEach((item) => {
|
||||||
html += item.outerHTML;
|
html += item.outerHTML;
|
||||||
});
|
});
|
||||||
} else if (selectElement.value === "3") { // 下载次数升序
|
} else if (selectElement.value === "3") { // 下载次数升序
|
||||||
Array.from(panelElement.querySelectorAll(".b3-card")).sort((a, b) => {
|
cardElements.sort((a, b) => {
|
||||||
return JSON.parse(b.getAttribute("data-obj")).downloads < JSON.parse(a.getAttribute("data-obj")).downloads ? 1 : -1;
|
return JSON.parse(b.getAttribute("data-obj")).downloads < JSON.parse(a.getAttribute("data-obj")).downloads ? 1 : -1;
|
||||||
}).forEach((item) => {
|
}).forEach((item) => {
|
||||||
html += item.outerHTML;
|
html += item.outerHTML;
|
||||||
@ -851,6 +852,9 @@ export const bazaar = {
|
|||||||
}
|
}
|
||||||
localSort[selectElement.parentElement.parentElement.getAttribute("data-type")] = selectElement.value;
|
localSort[selectElement.parentElement.parentElement.getAttribute("data-type")] = selectElement.value;
|
||||||
setStorageVal(Constants.LOCAL_BAZAAR, window.siyuan.storage[Constants.LOCAL_BAZAAR]);
|
setStorageVal(Constants.LOCAL_BAZAAR, window.siyuan.storage[Constants.LOCAL_BAZAAR]);
|
||||||
|
if (cardElements.length > 1 && cardElements.length % 2 ===1) {
|
||||||
|
html += '<div class="fn__flex-1" style="margin-left: 15px;min-width: 342px;"></div>';
|
||||||
|
}
|
||||||
panelElement.querySelector(".b3-cards").innerHTML = html;
|
panelElement.querySelector(".b3-cards").innerHTML = html;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -19,8 +19,11 @@ export const avRender = (element: Element) => {
|
|||||||
filter:{},
|
filter:{},
|
||||||
sorts: {},
|
sorts: {},
|
||||||
columns:[{
|
columns:[{
|
||||||
|
width: "",
|
||||||
|
icon:"",
|
||||||
id:"",
|
id:"",
|
||||||
name:"",
|
name:"",
|
||||||
|
wrap:"",
|
||||||
type:"",
|
type:"",
|
||||||
}],
|
}],
|
||||||
rows:[{
|
rows:[{
|
||||||
|
Loading…
Reference in New Issue
Block a user