ArticleRating adds a rating module on each article page and allows rating.

Installation

How it works

The script loads and saves rating data from and to a storage (Module:Rating-storage) on the wiki for each rating action performed by users and anon.

Customizations

Options

The window.ArticleRating object provides the following customizable options:

Option Description Data type Default value
title Changes the module title:
  • For all articles (string)
  • For a specific category (object)
String/Object
'Rate This Article'
values Changes rating values Array of strings
['Worst', 'Bad', 'Average', 'Good', 'Great']
starSize Changes width and height of the stars respectively Array of integers
[24, 24]
starColor Changes colors of unrated and rated stars respectively Array of strings
['#ccc', '#ffba01']
starStroke Changes stroke color of stars String
'#000'
exclude Disables the module on these pages Array of strings -
excludeCats Disables the module on these categories Array of strings -
location Changes the module location. Accepted values: top-rail, bottom-rail, bottom-page String
'top-rail'

How to

To use the above customized options, add the following code to a local JS page on your wiki and change the values to your needs:

window.ArticleRating = {
  title: 'Rate This Article',
  values: ['Worst', 'Bad', 'Average', 'Good', 'Great'],
  starSize: [24, 24],
  starColor: ['#ccc', '#ffba01'],
  starStroke: '#000',
  exclude: ['Page A', 'Page B'],
  excludeCats: ['Category:A', 'Category:B'],
  location: 'top-rail'
}

Title option

To change the module title for a specific category, specify the title option using the following format:

title: {
  'Category:Books': 'Rate this book',
  'Category:Movies': 'Rate this movie'
}

Personal note

If you want to disable this module for the entire wiki, add the following code to your personal JS:

window.ArticleRatingLoaded = true;

Notes

  • Due to the script's mechanism, Special:RecentChanges might be flooded with edits to the storage, to hide these edits, exclude the "Module" namespace from the dropdown list or append ?namespace=828&invert=1 to the URL.
  • Once you rate an article, you won't be able to rate again until you reload the page. This is to reduce abusing rate and flooding Special:RecentChanges.

To-do

Module
  • Add rating with comment
  • Remove this module on redirect pages
Insights
  • More detailed view

Changelog

v2.6 - November 24, 2019
KhangND: Extended title option, added excludeCats option.
v2.5 - June 26, 2019
KhangND: Added options: exclude, location. Insights bugfix.
v2.4 - June 23, 2019
KhangND: Insights: added pagination, bugfix for anon.
v2.3 - June 19, 2019
KhangND: New Insights page (Special:ArticleRating).
v1.3 - June 17, 2019
KhangND: Improved UI, rating details.
v1.2 - June 10, 2019
KhangND: Allowed anon rating, minor bugfix.
v1.1 - June 4, 2019
KhangND: Major improvements.
v1.0 - June 3, 2019
KhangND: Initial revision.
Text above can be found here (edit)
Community content is available under CC-BY-SA unless otherwise noted.