FlightGear wiki:Howto: Wiki addon development

From FlightGear wiki
Jump to navigation Jump to search
This article is a stub. You can help the wiki by expanding it.
Screenshot showing the web-extension port of the InstantRefs user-script in FireFox.

Status

As of 03/2018, we have two different scripts to help with editing the FlightGear wiki. And we're looking for ways to integrate/port them to the web extension framework (JavaScript), probably with node.js support, so that the low-level helpers can also be tested/used without requiring a browser.

Objective

Come up with a single unified browser addon (web-extension) to help with editing the Flightgear wiki and work around some of its limitations.

Background

dot_sent came up with a tool for editing the FlightGear wiki, it's written in Perl and the source code is on Github: https://github.com/dot-sent/FlightGearWikiClient[1]

In addition, there is the Instant-Cquotes script (written in JavaScript) which started out as a userscript (via GreaseMonkey), which got meanwhile ported to the Web extension framework. dot_sent mentioned plans to also use JavaScript for his tool.

Originally, Instant-Cquotes started out as JavaScript-based tool to edit the FlightGear wiki which was created over the years to aggregate community discussions, i.e. to help bootstrap new wiki articles and help maintain those articles that are no longer actively maintained. It's a rather simple piece of code actually that grew over time - originally it was just a UserScript using Greasemonkey - more recently, it's been ported to the Web Extension framework.[2]

This step also cause a number of regressions, because we are no longer using certain dependencies, e.g. jQuery. Also, the conceptual split into so called content scripts and background scripts made it necessary to move certain functionality out of the original userscript.

We're now exploring if it makes sense to integrate both "scripts" to grow a library of useful tools and APIs to help edit/maintain the FlightGear wiki.

Requirements

Note  Strictly speaking, web-ext/npm isn't really required currently - i.e. you can just as well test the addon by installing it temporarily via the about:debugging tab in firefox

For the sake of simplicity, it's recommended to have the following tools installed:

  • git (version control)
  • npm (package manager, used to install web-ext)
  • node.js (javascript for the console)
  • web-ext (tool used to actually develop/test web extensions)

Testing the extension

Note  When using web-ext to test the extension, this will set up a new firefox profile, so that features using persistent settings, won't work as expected
  • download the ZIP file: https://ufile.io/kwrbm
  • extract it to a new directory, change to that dir
  • execute web-ext run inside the new directory
  • in firefox, go to a supported forum/mailing list URL
  • make a selection using the mouse
  • to configure the addon, go to about:addons and navigate to the "Preferences" button next to the extension's entry.
  • to install the dependencies of the headless script (node.js), run npm install inside the extension folder

Known Issues

Dependencies

List of dependencies that we may want to evaluate:

Wiki API

Development

Roadmap

Related

References
  1. dot_sent  (Feb 1st, 2018).  My personal solution to Wiki bugs .
  2. Hooray  (Feb 2nd, 2018).  Re: My personal solution to Wiki bugs .