User:PerfektesChaos/js/pageTeaserHint

JavaScript gadget – present summarizing texts and teasers for a greater number of pages.

The goals of this tool are: Page previews are available for main namespace (Wikipedia articles) right now. Assigned Wikidata items are available also for other namespaces.
 * Enrich search results, and
 * maintain page summaries and short information about pages.

Search results
In addition to matching pages, where a short snippet around the detected word is shown, otherwise a brief beginning of page text, the tool will elaborate a bit more what that page is about.

Maintaining page teasers
Authors are usually not aware what brief information is presented to users with mobile devices or activated page preview popups. Furthermore by Wikidata short info it is reflected not only how the item is described there, but also if no item has been assigned yet but the topic is an entity in real world which deserves an entry. An item might exist already but has not been linked to that page yet.
 * Especially for all articles within a category this tool will show a comprehensive survey which texts are generated now.
 * Wikidata items are good for definite objects in real world.
 * Those define unanimously themselves by their physical existence.
 * Persons, locations, vehicle models, artwork are belonging to this group.
 * They should be assigned to a Wikidata item always.
 * The item might exist already but needs to be searched.
 * Thematic subdivision might differ between wiki projects and compared to Wikidata, and no assignment is possible. Especially when subtypes and supertypes are mapped by different concepts to articles a link might become impossible. Other things like History of … or Persons related to … are candidates which should not be linked.
 * Abstract philosophical and language dependent concepts are difficult as Wikidata item specification.
 * On soft issues there is often no global mapping possible; especially when no unique scientific definition is agreed.
 * Disambiguation pages are not a good issue for globally comparable issues. They are a mixture of names in certain scripting, and language dependent meanings of a particular word or expression. This does not match with the same spelling in other languages, and the semantics are not the same in other languages.

Usage

 * If your project has registered this as a gadget, just activate on your Preferences page.

Otherwise insert the following line into your personal common.js, global.js or by other means (even for anonymous users):

Page types
The tool may be used on any wiki run by MediaWiki.

Linked pages
Only trivial links into the own wiki will be explored. Target pages should feed the expectation that relevant information will be retrieved.
 * All pages in main namespace (articles of a Wikipedia).
 * Talk pages, special pages, user pages, file and category description, system messages are always excluded.
 * Other pages in the same wiki might be considered via individual configuration.

Analysed pages
The following types of pages will be equipped for further activities:
 * Categories
 * Search results
 * All pages lists
 * Prefixed page lists
 * User contributions
 * What links here?
 * Page information (just summary added, since all other information is already present)
 * User defined lists

User defined lists
On project or user pages, actually everywhere but not categories nor main namespace nor code pages, an individual list might be defined as follows, and as often and with any number of lists as needed: It ist necessary to request via individual configuration to search all pages for such entries. They will be treated like any other collection generated by software.
 * Paris (FR)
 * Athens (GR)
 * Oslo (NO)

Functionality
On pages mentioned at „Analysed pages“ it will be explored which links are present and whether they match the criteria.

Is at least one link is found a button will be offered: 

If triggered analysis will start, which might take some time.

Preview images
If page assigned images were found, now a further button will be offered:  That will provide furnishing all entries with images if present.

Legend for presentation of results
It depends on availability which issues are presented.
 * On page information just the summary will be added, since all other information is already present.

Individual Configuration
Before the request for loading described at “Usage” the following statement might be executed (here for default behaviour): By those keywords the processed might be influenced as described here:

Only one call of this assignment is permitted. It is not necessary to assign every feature, and there are other possible syntactical means.

Cookies
Text fragments in user language are attempted to store via localStorage, and timestamp of update, at  entry.

This can be cleared manually for a particular wiki, if in context of a page already equipped with additional information by any means the following code is executed:

Internationalization
All texts will be retrieved from system messages. On first visit they are not present in time, but learnt after first result presentation in the particular user language. The mechanism mentioned in cookies will memorize and update them. Without that some basic vocabulary will be used.

A translation of this page may be offered.

Codes
de:User:PerfektesChaos/js/pageTeaserHint