如中文 wiki 信息过时,可以参考英文 wiki 对应页面。
见 Terraria Wiki:项目/1.4.5 获取 wiki 状态与更新指南
Template:Ajax
This template allows loading the content of another wiki page into a box when the reader clicks a link. The functionality is provided by Common.js via AJAX.
Note: AJAX may not render properly on certain mobile devices, hence it should be avoided on pages that mainly feature mobile content.
Usage
{{ ajax | <target page> | keepterraria = y/yes | width = <box width> | head = <box heading text> | headstyle = <heading styling> | nohead = y/yes | bodystyle = <box content styling> | bodyload = <box text> | nojs = <non-JavaScript text> | mainclass = <box CSS class> | mainstyle/maincss = <box CSS styling> }}
- First unnamed parameter or target
Name of the wiki page that will be loaded when the link is clicked. This is the only parameter that is required; the rest are optional.
If this parameter is not passed as |target=... (but as the first unnamed parameter instead, i.e. just |...), then the other parameters should follow on the same line, with no line break between the wiki page name and another parameter. Otherwise, a glitch occurs and the wiki's main page may become the target instead.
- keepterraria
By default, Ajax removes the CSS class terraria from all elements on the target page, resulting in e.g. tables without lines. Use this parameter to prevent that.
- width
Width of the wrapper table, defaults to 100%.
- head
Text in the heading of the wrapper table. The heading is blank by default but will still be shown, so that the "edit" and "show/hide" links on the right are visible.
- headstyle
Custom styling for the heading of the wrapper table. CSS styles must be wrapped in style="..." and wiki table styling (e.g. align=left) is available.
- nohead
Hides the heading of the wrapper table. Note that this also means that the "edit" and "show/hide" links are inaccessible.
- bodystyle
Custom styling for the content of the wrapper table, both before and after the loading of the target page. CSS styles must be wrapped in style="..." and wiki table styling (e.g. align=left) is available. The default styling is align=center.
- bodyload
Initial text in the wrapper table, before the target page is loaded. Wrap the text that should be displayed as the "load" link in [link]...[/link].
- nojs
Text for users that have JavaScript disabled (which is of course required for AJAX operations).
- mainclass
CSS class names for the wrapper table, defaults to terraria.
- mainstyle/maincss
Custom CSS styling for the wrapper table. Unlike with $headstyle/$bodystyle, the value of this parameter must not be wrapped in style="..." and wiki table styling is not available.
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. - 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 |
|---|
| With body/link text specified |
|---|