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