Шаблон:Ajax

Матеріал з Terraria Wiki
Перейти до навігації Перейти до пошуку
Цей шаблон i18n-ready, що означає, що його легко локалізувати для різних мов. Будь ласка, ознайомтеся з i18n та l10n для шаблонів, щоб дізнатися більше.
Див. «Шаблон:Ajax/l10n» для локалізації цього шаблону.
Template-info.svg Документація Наведена нижче документація запозичена з «Шаблон:Ajax/doc». (редагувати | історія)
Для більш повної чи актуальної інформації ви можете переглянути документацію англійською.

Provides AJAX functionality for table content.

Note: AJAX may not render properly on certain mobile devices, hence it should be avoided on pages that mainly feature mobile content.

Parameters

Only one parameter is completely required:

|target=
Target page, loaded when show data link is clicked. The first unnamed parameter will be read as the target if no named target= parameter is provided. When entered without target=, other parameters should follow on the same line (with no line break between the target and another parameter; otherwise a glitch occurs, and the wiki's main page may become the target instead).

All other parameters only customize the table appearance:

|width=
Sets the width of the table. Default is 100%.
|headstyle=
The CSS style of the table head. Default is none.
|head=
The actual text in the table head. Default is blank, but head will still show so that the JavaScript will have somewhere to put the [edit] [show/hide] links.
|bodystyle=
Style of the table's content cell, applies to both before and after the loading of the table data. Requires "style=" for CSS markup, but also accepts wikitable markup. Default is align="center".
|bodyload=
Specifies the body text, along with the AJAX load link text. Wrap the text you want users to click with [link][/link] in this parameter. Default is a general-purpose load link.
|nojs=
What users see when they have JavaScript disabled (which is of course required for AJAX operation). Defaults to:
This table requires JavaScript to be enabled and site tooltips to be turned on to be displayed.
You can also [[{{{target|none}}}|view the data]] on another page.
|mainstyle=
Allows setting table's class to something besides "terraria". Defaults to..."terraria".
|nohead=
If this parameter is set to anything besides a null value, the head is not displayed (including the show/hide/edit links).

Target page syntax

  • Tabular data should be wrapped in a table on the target page. Table formatting should be applied on the target page, not on the calling page.
  • You can enclose data in <span class="ajaxHide"></span> on the target page to hide it on the calling page.
  • By default, Ajax removes the terraria class from all elements on the target page. Add the ajaxForceTerraria class to an element to prevent this for that element.
  • For additional information regarding Ajax formatting, please see User:NoseOfCthulhu/Sandbox1#AJAX_notes.

Examples

Examples use Template talk:Ajax/include as their target.

Without body/link text specified
[link]Натисни сюди щоб розкрити цей зміст. (може бути невелика затримка)[/link]
Ця таблиця вимагає JavaScript щоб увімкнути та відобразити підказки сайту.
Ви також можете переглянути дані на іншій сторінці.
With body/link text specified
The data for this table is not yet loaded.
[link]Click here[/link] to load data.
Ця таблиця вимагає JavaScript щоб увімкнути та відобразити підказки сайту.
Ви також можете переглянути дані на іншій сторінці.