1
0
Fork 0
mirror of https://github.com/wukko/cobalt.git synced 2025-04-15 06:35:09 +02:00
cobalt/api/src/modules/pageRender/onDemand.js

34 lines
1.3 KiB
JavaScript
Raw Normal View History

2022-09-11 21:04:06 +06:00
import changelogManager from "../changelog/changelogManager.js"
2023-08-05 00:43:12 +06:00
import { cleanHTML } from "../sub/utils.js";
2022-09-11 21:04:06 +06:00
let cache = {}
2022-09-11 21:04:06 +06:00
export function changelogHistory() { // blockId 0
if (cache['0']) return cache['0'];
2022-09-11 21:04:06 +06:00
let history = changelogManager("history");
let render = ``;
2022-11-15 23:37:33 +06:00
2023-04-03 22:36:23 +06:00
let historyLen = history.length;
2022-09-11 21:04:06 +06:00
for (let i in history) {
2023-04-03 22:36:23 +06:00
let separator = (i !== 0 && i !== historyLen) ? '<div class="separator"></div>' : '';
2023-08-05 00:43:12 +06:00
render += `
${separator}${history[i]["banner"] ?
`<div class="changelog-banner">
<img class="changelog-img" ` +
`src="${history[i]["banner"]["url"]}" ` +
`alt="${history[i]["banner"]["alt"].replaceAll('"', '&quot;')}" ` +
`width="${history[i]["banner"]["width"]}" ` +
`height="${history[i]["banner"]["height"]}" ` +
`onerror="this.style.opacity=0" loading="lazy">`+
`
2023-08-05 00:43:12 +06:00
</div>` : ''}
<div class="popup-desc changelog-tags">${history[i]["version"]}</div>
<div class="popup-desc changelog-subtitle">${history[i]["title"]}</div>
<div class="popup-desc desc-padding">${history[i]["content"]}</div>`
2022-09-11 21:04:06 +06:00
}
2023-08-05 00:43:12 +06:00
render = cleanHTML(render);
cache['0'] = render;
2022-09-11 21:04:06 +06:00
return render;
2022-11-15 23:37:33 +06:00
}