User:PerfektesChaos/js/pageTeaserHint
JavaScript gadget – present summarizing texts and teasers for a greater number of pages.
The goals of this tool are:
- Enrich search results, and
- maintain page summaries and short information about pages.
Page previews are available for main namespace (Wikipedia articles) right now. Assigned Wikidata items are available also for other namespaces.
Purpose
editSearch results
editIn 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
editAuthors are usually not aware what brief information is presented to users with mobile devices or activated page preview popups.
- Especially for all articles within a category this tool will show a comprehensive survey which texts are generated now.
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.
- 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
edit- 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):
mw.loader.load( "https://en.wikipedia.org/w/index.php?title=User:PerfektesChaos/js/pageTeaserHint/r.js&action=raw&maxage=86400&ctype=text/javascript" );
Page types
editThe tool may be used on any wiki run by MediaWiki.
Linked pages
editOnly 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
editThe 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
editOn 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:
<div class="pageteaserhint-private"> * [[Paris]] (FR) * [[Athens]] (GR) * [[Oslo]] (NO) </div>
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.
Functionality
editOn 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
editIf 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
editSymbol / content | Functionality |
---|---|
Page name | Linked; might be completed by existing amendments. |
This is a redirecting page. | |
Link to target page | The link to redirecting page will stay there (redirect=no). That link will not follow to target page. Therefore it is possible to edit the redirecting page. |
Text | Local description via {{SHORTDESC:...}} Might contain a deviating local description, while the global item description goes for all wikis. Currently activated in English Wikipedia only. |
Link to assigned Wikidata item. ID of this item accessible as tooltip. | |
Text | Central description (at Wikidata) for all projects |
Text
|
More or less the introduction section or paragraph, without inserted issues enclosed in round brackets. |
Link to page information This page is usually smaller and easier to load than a large article. More metadata will be listed there. | |
2024-10-14 13:43
|
Presented in UTC according to ISO 8601. Local time in user language formatting accessible as tooltip (also reflecting local DST). |
5 kB | Page size |
This page has been marked as disambiguation. | |
CSS, Lua, JavaScript, JSON |
Code page |
Our page won a prize. | |
(visitors after login only) Page is “fully protected”: Sysops only are able to edit or move this page. A tooltip might indicate if this was applied for infinite duration. | |
(visitors after login only) There is some page protection but not completely. A tooltip will indicate further details. | |
☆ | Page is not watched. Click for watching. |
★ | Page is watched. Click to terminate watching. |
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
editBefore the request for loading described at “Usage” the following statement might be executed (here for default behaviour):
mw.hook( "pageTeaserHint.config" ).fire( { limited: true,
listen: false } );
By those keywords the processed might be influenced as described here:
Keyword | Value | Meaning |
---|---|---|
limited
|
true
|
(Default) Restrict to links into main space (articles within a Wikipedia). |
false
|
Consider linked pages into other appropriate name spaces. | |
listen
|
false
|
(Default) Limit evaluation to software generated collections. |
true
|
Look for user defined lists. |
Only one call of this assignment is permitted. It is not necessary to assign every feature, and there are other possible syntactical means.
Cookies
editText fragments in user language are attempted to store via localStorage, and timestamp of update, at pageTeaserHint
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:
mw.hook( "pageTeaserHint.clear" ).fire();
Internationalization
editAll 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
editSource code |
|
ResourceLoader |
|
Namespaces |
|
Cookies | localStorage
|
mw.libs
|
pageTeaserHint (reserved, but currently unused)
|
mw.hook
|
|
MediaWiki | MW 1.22 |
JavaScript | 1.5 (2000)
|