API обсуждений не имеет официальной поддержки. Оно может измениться в любой момент, из-за чего скрипт перестанет работать.
DiscussionsEmbed представляет из себя встраиваемый модуль, в котором перечислены последние темы обсуждений. Он может быть настроен для показа другого количества записей (по умолчанию их пять) или для показа тем из конкретной категории.
Installation
Usage
Чтобы добавить модуль на страницу, используйте следующий код: <div class="discussions-embed"></div>
Configuration
У скрипта есть две переменные для настройки, которые могут быть использованы на MediaWiki:Common.js.
| Переменная | Значение по умолчанию | Описание |
|---|---|---|
window.discussEmbedLimit
|
5 | Число постов, отображаемых модулем. |
window.discussEmbedForum
|
N/A | ID категории, посты из которой будут показаны. Если ничего не указано, будут отображаться все темы. ID можно найти в URL на странице категории, имеющем формат https://WIKI.fandom.com/f?catId=ID. Вам нужна часть после catId=. Во избежание округления идентефикатора используйте кавычки.
|
window.discussEmbedSortTrending
|
0 | If set to 1, the module will show trending posts. Otherwise, the module will show the most recent posts. |
Пример:
window.discussEmbedLimit = 10;
window.discussEmbedForum = "1234567890";
window.discussEmbedSortTrending = 1;
Using configuration options with Fandom Developers Wiki scripts
The instructions on this page describe how to use configuration options with a script. Here on the Fandom Developers Wiki, many scripts provide optional configuration settings as a mean to alter or enhance the default behavior of the script. When installing configuration options in your JavaScript file, please note that they need to go above the import statement in order to work — unless the directions say otherwise. In case MediaWiki:ImportJS is used to load the scripts, it will be executed last.
// 1. AjaxRC import statement
importArticles({
type: 'script',
articles: [
'u:dev:MediaWiki:AjaxRC.js'
]
});
// 2. AjaxRC configuration option
window.ajaxRefresh = 30000;
// 1. AjaxRC configuration option
window.ajaxRefresh = 30000;
// 2. AjaxRC import statement
importArticles({
type: 'script',
articles: [
'u:dev:MediaWiki:AjaxRC.js'
]
});