User:Mfaizsyahmi/notiplus

notiplus is a script that lets you add localized wiki-specific notifications alongside Wikia's global notifications. It supports start dates and duration for each notification and normal wiki-formatting. You can also set whether to have visitors to your wiki opt-in to the notifications (currently it's a one-off deal).

Options
You can set a few settings by adding the following lines before the calling importArticles: The explanation for the above settings is as follows:
 * notiplus.url
 * Sets the URL of the page that contains the notifications
 * This must be a local URL (i.e. starts with the relative path '/wiki/')
 * '?action=render' at the end is required
 * See the section on how to add notifications
 * Default: "/wiki/Project:Notiplus?action=render"


 * notiplus.cookiePrefix
 * The prefix to set the cookies used by notiplus. Useful to group cookies for easier searching with cookie management browser extensions.
 * Should not contain spaces, commas or dots.
 * A dash or underscore should be included at the end, or the cookie names generated can get messy.
 * Using your wiki's name or initials is recommended
 * Default: "notiplus-"


 * notiplus.consentRequired
 * If true, then notiplus will need your wiki's users' consent to function.
 * Default: true


 * notiplus.lang
 * Specifies the interface language (currently used only for the consent popup)
 * See the language support section for a list of languages currently supported
 * Default: "en" for English

Adding notifications
By default, the notification page that notiplus uses is Project:Notiplus. This can be changed by changing the notiplus.url setting as described above.

Adding a notification is simply a matter of placing wikitext in the following format to the page: 

YOUR NOTIFICATION HERE. Most [wikitext] are supported.
 * unfortunately
 * 1) lists
 * aren't
 * supported.

Where:
 * id
 * Unique id for that particular notification item. This will be used on both interface and cookie handling.


 * data-start
 * Start date of the notification. The notification will not be displayed earlier than this date
 * To avoid possible ambiguity, set the time and timezone to UTC e.g. "31 October 2015 12:00:00 UTC"


 * data-expires
 * Defines how many days the cookies are stored for each notification.
 * This is also used to determine the end date for the notification, calculated as (start + days). If the current date past this end date the notification will not be displayed.

You can add an unlimited amount of notifications by simply repeating the above format, changing the ID, text and start dates of each one.

Limitations

 * Wikia only displays paragraphs within their notification balloon. Lists are not supported.
 * For the above reason the empty lines after the start and before the closing div tag is required

Using templates
To simplify and making the notifications consistent you can use a template page notiplus which contains the following: 

And call the template in the notification page:

Language support
Curently notiplus supports the following languages:
 * English (en) - by author