User:V111P/js/Sum numbers

Sum numbers is a user script for adding up numbers you selected on the page with the mouse. You should be able to select a row in a table to get the row totals in all recent browsers. However, only in Firefox you can select multiple text ranges, and therefore multiple numbers, by holding down Ctrl while selecting text, and you can select a table column by holding Ctrl while dragging the mouse across the cells in the column.

The script does not work in the text box where you edit the wiki source of the article, only outside of it. If you are source-editing an article, you can click the Show preview button to get the numbers on the page and then use this tool to add them.

To use this tool, first install it, as described below. Then on any page, click the Sum numbers link in the Tools section in the sidebar. Buttons will appear after level 1 and level 2 headings and before and after tables. Select some numbers on the page as explained in the introduction and click any of the + buttons on the page, the added numbers and their sum will appear under the pressed button, along with any strings that were not recognized as valid numbers and were ignored when calculating the sum.

See also my other user scripts. Thank you.

Installation
For the English Wikipedia, add this code to your common.js (or vecor.js, or monobook.js, whichever you are using) file:

In other Wikipedias:

Note that currently the decimal marker is assumed to be comma for all Wikipedias other than the English Wikipedia, where the decimal marker is the period (.) and all commas are ignored. If you need to change that, let me know, or just set the global string variable.