Skip to content

hinell/historyhelper-wikipedia

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HistoryHelper Demo

A JavaScript Wikipedia Plugin for History & Revisions pages

HistoryHelper for Wikipedia

The HistoryHelper plugin (HH) basically helps you to copy & past multiple entries to initiate a discussion of concerning edits. It also can highlight offensive words. It was first pusblished on May 12, 2021.

Install

You are assumed to have a wikipedia account in order to be able to install this script. Otherwise, you probably would need to install a browser extension that runs user-scripts instead. I do not consider to create a separate plugin for web the browser until paid.

On wikipedia

See: History Helper Install instructions.

Usage

Plugin binds a few key strokes. See demons below.

  • click+drag — on checkboxes to select multiple entries simultaneously.
  • ⇧shift+click — on checkbox to select multiple entries simultaneously.

Demos

Config

By default HH higlights some uncivil words (see line 839 for a fill list). You can add your own words or phrases by using the following config below. Use Regular expression for matching. By default every word is highlighted by using {{Tl|highlight}} wikipedia tag

    window.HistoryHelper= window.HistoryHelper || {}; 
    window.HistoryHelper.highlights=[
     // matches liar 2 times, or pants, or "on fire" 
     /(liar){1,2}|pants|on fire/ig
    ];

Limitations

I18n

Currently this plugin doesn't international wikipedias (i.e. outside of en.wikipedia.orgdomain). Date locales may be parsed wrongly or with errors.

Security and Legal Statement

See also LICENSE

The plugin is open source and free of charge. It doesn't gather, store, or send any sensetive information. It never accesses your cookies, neither it tries to obtain any sensetive data via fake dialogs etc. Checkout the source code to make sure there is no suspicious code before using this plugin.

Development

The plugin is written in JavaScript. The following dot graph approximates a script lifecycle and basic classes: Project LifeCycle

Script overview

On wikipedia page the script maps button actions into copying entries from the current page's revisions. Revisions are kept in an array class Revisions.

The main class is HH. It keeps actions map that maps UI button events into specific actions to be performed over Revisions instance (i.e. formatting & copying diff links into the system clipboard upon click)

When run, the script performs several steps:

  • It maps DOM html revisions tree into a Revisions class
  • Which further wraps every sub-entry (<li>...<li/> element) into Entry class
  • Adds MediaWiki ButtonWidget-based UI buttons

TODO

  • Fetch revisions from wikipedia DATA/DB API.

Created-at: September 10, 2022
Modified-at: August 13, 2023