Fandom Developers Wiki
Advertisement

AjaxPoll brings Discussions Polls onto your wiki pages. It is named after a popular MW extension which was no longer supported on the UCP.

Features

  • Embed Discussions Polls on the wiki page.
  • Allow voting directly on the poll, even changing your vote, which is not supported by the Discussions Poll itself.
  • Allow easy customization of the poll's styling.

Installation

Usage

  • Create a poll thread in Discussions.
  • Copy the thread ID, which is present in the address bar, e.g https://dev.fandom.com/f/p/ID
  • Setup a div with class d-poll and supply the thread ID to the data-id attribute.

Example:

<div class="d-poll" data-id="4400000000000005134"></div>

Result:

You can also copy and use Template:AjaxPoll which only requires you to supply the ID, and it also automatically adds a fallback link (See about fallback content below).

Fallback content

As custom JavaScript is disabled on mobile, the poll will not be loaded, therefore it is recommended to put some fallback content. The fallback content could be some text to display to the readers when the poll is not loaded, or a spinner/loader to indicate the poll is being loaded, or a link to the original poll.

Example: <div class="d-poll" data-id="4400000000000005134"> [[File:Ajax-loader.gif]] </div>

Result:

Ajax-loader

Styling

Quickly import the available skins below, or easily design your own.

Modern

AjaxPoll Modern

AjaxPoll Modern

Whale

AjaxPoll Whale

AjaxPoll Whale

Bootstrap

AjaxPoll Bootstrap

AjaxPoll Bootstrap

Discussions

AjaxPoll Discussions

AjaxPoll Discussions

HTML Structure (for custom styling)

div.d-poll
    └─ form
        ├─ div.d-poll__question
        ├─ div.d-poll__answer
        |   ├─ label.d-poll__answerName
        |   |   └─ input[type="radio"]
        |   ├─ div.d-poll__answerVotes
        |   └─ div.d-poll__answerBar
        |       └─ div
        ├─ div.d-poll__info
        └─ input[type="submit"]

Known issues

  • Voting does not work on wikis with a content language other than English. Solution: Adjust the form action URL (line 54) to support other wiki languages. - Fixed

Changelog

Dec 1, 2020
KhangND: First commit.
Text above can be found here (edit)
Advertisement