Jump to content

User:Opencooper/highlightStrings

From Wikipedia, the free encyclopedia

highlightStrings.js points out formatting issues in articles, drawing a border around them. Explanations are provided for the issues. The script's focus is on formatting rather than content.

Installation

[edit]

The script requires an up-to-date browser due to its use of the latest browser features. If you are using a browser that has not been updated in months, or is unsupported, such as Internet Explorer, the script will not function.

To install the script, add the following to your common.js page:

importScript('User:Opencooper/highlightStrings.js'); // Backlink: [[User:Opencooper/highlightStrings.js]]

Usage

[edit]

To use the script, while reading an article, go to the tabs at the top of the page, hover over the "More" dropdown, and click "Highlight strings".

The script will process the page and list the number of matches under the page title. "Optional" matches are those that are deemed minor.

Matches: 1
Optional: 2

Below these statistics, there will be expandable sections, with a number inside parenthesis indicating the number of items inside. The first, Highlights, will show the issues matched in a table. Each issue will have a name, a description explaining it, and the number of occurences. Clicking the checkbox in these rows will toggle the rule, disabling it for the current page's results.

▶ Highlights (3)

The other sections are for non-highlights, which might indicate things that need to be fixed, or could just be informational. These will usually have the specific thing underlined. A special section is "References", showing most—but not always all—of the article's citations in a sortable table.

Scrolling down to the article, you will notice that the script applies styling changes to the page. Issues with the page will be highlighted with a yellow box around them. Hovering your cursor over these boxes will display the title of the issue, matching that in the summary table.

The script also applies other formatting to the article to enhance editing and reveal hidden information. The original text of piped links is shown. Italicized text is given a red overline. The dimensions of images are shown, as is any ALT text. Et cetera.

[edit]

While the highlights could be navigated by scrolling with the mouse and hovering over highlights, the script has another means of moving between them. At the left side of the page will be an orange box. The number in the upper-left shows the current highlight over the total number of highlights. The arrows can be clicked on to move between highlights. The keyboard can also be used, with n going to the next highlight, and ⇧ Shift+n to the previous.

Once a highlight is moved to, the page will scroll automatically to it. The orange box will then show the highlight's title and description, as well as a checkbox to ignore it for the article.

How it works

[edit]

The script functions in two stages. In the first stage, it tries matching templates or HTML elements to find issues. Then it searches the raw HTML for patterns, which can be prone to false positives. Filters are employed for each rule to try to avoid false positives. This concludes the highlighting. In the second stage, the Wikitext of the page is searched, forming the other informational sections in the results summary.

FAQ

[edit]
Does this script fix the issues for me?
No. It only highlights them for you. You are then expected to use editorial judgement and your knowledge of Wikipedia's policies to decide which ones to fix.
What is the basis for the highlights?
Many of the rules the script uses are based on Wikipedia's Manual of Style. These will be cited in their descriptions. Other rules are things that I feel fixing would improve the encyclopedia.
I'd like to request a highlight or informational section
Contact me and we can see if it's something the rules could feasibly match and it's something that makes sense editorially.
I don't agree with a highlight
The Manual of Style is only a guideline. Other rules the script uses might be based on my own subjectivities. Feel free to contact me and we can discuss if a highlight is worth removing or fine-tuning.
The highlight doesn't actually have the issue it claims
Since the script uses rules and pattern-matching, false positives are unavoidable. Please comment on my talk page with the article in question and details, and we can see if the rule could be fine-tuned or that case filtered out.
How do I cancel the script and go back to the normal article view?
Simply refresh the page. The script does not modify the original article.
Why do highlights change color from orange when navigated to?
To help distinguish adjacent or overlapping highlights, the currently viewed highlight is given a different color. Yellow is for optional highlights, while red is for normal ones.
Why do author names in the References table have slashes?
The slash separates parts of names so it can be distinguished that they were specified separately rather than as one parameter.

License

[edit]

This script and any associated files are licensed under Creative Commons Zero.

Two icons used in the script's UI are MIT licensed: