Fandom Developers Wiki
Advertisement

The Discussions API is not officially supported. The API may change at any moment, resulting in the script breaking.

DiscussionsEmbed is an embeddable module containing either trending posts or the most recent posts on wikis with Discussions enabled. It may be configured to allow for a different number of entries (default: 5) or to show only posts from a specific forum.

Installation

Usage

To place the Discussions module on a page, insert:<div class="discussions-embed"></div> into its source.

Configuration

The script has three configuration variables that may be set in a wiki's MediaWiki:Common.js.

Variable Default Explanation
window.discussEmbedLimit
5 Number of entries to be contained in the module.
window.discussEmbedForum
None ID of the forum desired for the module to show. If left unset, the module will display posts from all forums. The ID may be found by going to the page displaying the desired forum, in the format https://wiki.fandom.com/f?catId=ID. The number after catID= is what should be entered. Enclose this number in quotes to prevent rounding.
window.discussEmbedSortTrending
0 If set to 1, the module will show trending posts. Otherwise, the module will show the most recent posts.

Example:

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.

Configuration options load too late, don't work
// 1. AjaxRC import statement
importArticles({
    type: 'script',
    articles: [
        'u:dev:MediaWiki:AjaxRC.js'
    ]
});

// 2. AjaxRC configuration option
window.ajaxRefresh = 30000;
Proper placement of configuration options
// 1. AjaxRC configuration option
window.ajaxRefresh = 30000;

// 2. AjaxRC import statement
importArticles({
    type: 'script',
    articles: [
        'u:dev:MediaWiki:AjaxRC.js'
    ]
});

Demo

Text above can be found here (edit)
Advertisement