更改Tile对齐

master
落雨楓 2 months ago
parent b7b0a6f490
commit be5ad56fe4

@ -21,12 +21,14 @@ class PreviewPageListWidget {
$pageListHtml = [];
foreach ($pageList as $pageTitle) {
$title = Title::newFromText($pageTitle);
if ($title) {
$pageListHtml[] = Html::rawElement('a', ['class' => 'isekai-list-item', 'href' => $title->getLocalURL()],
Html::rawElement('div', ['class' => 'isekai-list-item-content'],
Html::element('div', ['class' => 'isekai-list-item-title'], $title->getPrefixedText())
)
);
}
}
return
Html::openElement('div', [
@ -61,6 +63,7 @@ class PreviewPageListWidget {
$lazyLoad = true;
}
$resultHtml = null;
switch ($loader) {
case 'pages':
$pageList = explode("\n", trim($text));
@ -68,18 +71,21 @@ class PreviewPageListWidget {
return trim($page);
}, $pageList);
return Html::openElement('div', [
$resultHtml = Html::openElement('div', [
'class' => self::CONTAINER_CLASS_NAME,
'data-loader' => $loader,
'data-autofocus' => $autoFocus,
'data-lazyload' => $lazyLoad,
]) .
Html::element('script', [
Html::openElement('script', [
'type' => 'application/json',
'data-pages' => true,
], json_encode($pageList)) .
]) .
json_encode($pageList) .
Html::closeElement('script') .
self::buildFallbackPageList($pageList) .
Html::closeElement('div');
break;
case 'category':
$category = $params['category'] ?? null;
if (!$category) {
@ -118,7 +124,7 @@ class PreviewPageListWidget {
]);
}
return Html::openElement('div', [
$resultHtml = Html::openElement('div', [
'class' => self::CONTAINER_CLASS_NAME,
'data-loader' => $loader,
'data-category' => $categoryTitleText,
@ -127,10 +133,15 @@ class PreviewPageListWidget {
]) .
self::buildFallbackPageList($pageList) .
Html::closeElement('div');
break;
}
return Html::element('span', [
if (!$resultHtml) {
$resultHtml = Html::element('span', [
'class' => 'error'
], wfMessage('isekai-preview-page-list-error-invalid-loader', $loader)->parse());
}
return $resultHtml;
}
}

@ -138,6 +138,11 @@ class CategoryPageListLoader extends BasePageListLoader {
}
}
function htmlDecode(input) {
var doc = new DOMParser().parseFromString(input, "text/html");
return doc.documentElement.textContent;
}
let previewPageList = document.querySelectorAll('.isekai-preview-page-list-card');
if (previewPageList.length > 0) {
const App = require("./PreviewPageList.vue");
@ -154,7 +159,8 @@ if (previewPageList.length > 0) {
let pagesJsonEl = document.querySelector('script[type="application/json"][data-pages]');
let pageList = [];
if (pagesJsonEl) {
pageList = JSON.parse(pagesJsonEl.innerText);
let jsonStr = htmlDecode(pagesJsonEl.innerText);
pageList = JSON.parse(jsonStr);
}
props.pageListLoader = new PresetPageListLoader(pageList);
break;

@ -1186,6 +1186,7 @@
width: 100%;
float: left;
overflow: visible;
justify-content: center;
}
.tiles-group::before {
content: attr(data-group-title);

Loading…
Cancel
Save