Skip to content

Commit bc17ec8

Browse files
committed
pat-inject documentation: autoformat
1 parent 5ef9434 commit bc17ec8

File tree

1 file changed

+19
-22
lines changed

1 file changed

+19
-22
lines changed

src/pat/inject/documentation.md

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ to build infinite lists, where the injection element replaces itself with the ne
258258

259259
A injection may be delayed, by providing a `delay` argument in `data-pat-inject`.
260260
The delay is specified in milliseconds.
261-
This is useful to build a polling loop or to prevent multiple injections happen at once by giving different delays to injections with an ``autoload`` trigger.
261+
This is useful to build a polling loop or to prevent multiple injections happen at once by giving different delays to injections with an `autoload` trigger.
262262

263263
<a href="sources.html#id" class="pat-inject"
264264
data-pat-inject="trigger: autoload">Autoloads as soon as initialised</a>
@@ -269,12 +269,10 @@ This is useful to build a polling loop or to prevent multiple injections happen
269269
<a href="sources.html#id" class="pat-inject"
270270
data-pat-inject="trigger: autoload; delay: 2000">Autoloads 2 seconds after the page is initialised.</a>
271271

272-
273-
For ``trigger: autoload-visible`` injections, the default delay is 200ms.
272+
For `trigger: autoload-visible` injections, the default delay is 200ms.
274273
This allows for long pages to scroll over and past items witn an autoload-visible trigger without loading them.
275274
If the item with the autoload-visible trigger is within the viewport for 200ms, the item is loaded.
276-
You can set this to ``0`` or any other delay time by configuring the delay parameter.
277-
275+
You can set this to `0` or any other delay time by configuring the delay parameter.
278276

279277
<!--
280278
XXX: example infinite list
@@ -337,17 +335,17 @@ After injection was triggered:
337335
### Configurable error pages.
338336

339337
In cases of AJAX errors, you can provide custom error pages by providing custom meta tags.
340-
For example, if you add this meta tag to the html ``<head>``:
338+
For example, if you add this meta tag to the html `<head>`:
341339

342340
<meta name="pat-inject-status-404" content="/test_404.html" />
343341

344-
Then, in case of a ``404`` error, it will try to retrieve the error page and replace the document body contents with the body contents of the error page.
345-
The code looks for a meta tag with the name ``pat-inject-status-`` plus the HTTP status code.
342+
Then, in case of a `404` error, it will try to retrieve the error page and replace the document body contents with the body contents of the error page.
343+
The code looks for a meta tag with the name `pat-inject-status-` plus the HTTP status code.
346344

347-
Another example: You can present the user with a login page in case the session has expired (``401`` error).
345+
Another example: You can present the user with a login page in case the session has expired (`401` error).
348346

349347
You can disable this behavior for debugging by adding the following parameter to the query string:
350-
``pat-inject-errorhandler.off``.
348+
`pat-inject-errorhandler.off`.
351349

352350
### Options reference
353351

@@ -374,21 +372,20 @@ You can customise the behaviour of injection through options in the `data-pat-in
374372
| `history` | | `none` `record` | If set to `record` then injection will update the URL history and the title tag of the HTML page. | String or null. |
375373
| `scroll` | | `none`, `top`, `target`, CSS selector | After injection is done, scroll to to given position. The default or `none` is to not do any scrolling. `top` scrolls to the top of the scroll container. `target` scrolls to the pat-inject target. CSS selector scrolls to the given selector. Note: You have to define a scroll container by setting overflow classes, otherwise `window` is used. | String, CSS selector |
376374

377-
378375
## Developer documentation
379376

380377
pat-inject fires several JavaScript events which bubble up the DOM tree:
381378

382-
| Event name | Type | Triggered on | Bubbles | Description |
383-
| --- | --- | --- | --- | --- |
384-
| `patterns-inject-triggered` | jQuery | pat-inject-element | true | Triggered, right after injection has been triggered. This can be on click, on submit, automatically and so on. |
385-
| `pat-ajax-success` | jQuery | pat-inject element | true | Triggered after successful ajax call but before the response is injected into the document |
386-
| `patterns-injected` | jQuery | parent of injected content | true | Triggered after successful injection |
387-
| `pat-inject-success` | JavaScript | pat-inject element | true | Triggered after successful injection, right after `patterns-injected` but on the pat-inject element and not on the injected content itself. |
388-
| `patterns-injected-scanned` | jQuery | injected content | true | Triggered after injected content was scanned by Pattern registry for new patterns. |
389-
| `patterns-injected-delayed` | JavaScript | injected content | true | Triggered 10ms after `patterns-injected-scanned` |
390-
| `pat-inject-content-loaded` | jQuery | images within injected content | true | Triggered on images within the injected content when those images are loaded. |
391-
| `pat-inject-missingSource` | jQuery | trigger which caused the injection | true | Triggered when no to-be-injected source could be found. |
392-
| `pat-inject-missingTarget` | jQuery | trigger which caused the injection | true | Triggered when no target could be found. |
379+
| Event name | Type | Triggered on | Bubbles | Description |
380+
| ---------------------------------- | ---------- | ---------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
381+
| `patterns-inject-triggered` | jQuery | pat-inject-element | true | Triggered, right after injection has been triggered. This can be on click, on submit, automatically and so on. |
382+
| `pat-ajax-success` | jQuery | pat-inject element | true | Triggered after successful ajax call but before the response is injected into the document |
383+
| `patterns-injected` | jQuery | parent of injected content | true | Triggered after successful injection |
384+
| `pat-inject-success` | JavaScript | pat-inject element | true | Triggered after successful injection, right after `patterns-injected` but on the pat-inject element and not on the injected content itself. |
385+
| `patterns-injected-scanned` | jQuery | injected content | true | Triggered after injected content was scanned by Pattern registry for new patterns. |
386+
| `patterns-injected-delayed` | JavaScript | injected content | true | Triggered 10ms after `patterns-injected-scanned` |
387+
| `pat-inject-content-loaded` | jQuery | images within injected content | true | Triggered on images within the injected content when those images are loaded. |
388+
| `pat-inject-missingSource` | jQuery | trigger which caused the injection | true | Triggered when no to-be-injected source could be found. |
389+
| `pat-inject-missingTarget` | jQuery | trigger which caused the injection | true | Triggered when no target could be found. |
393390

394391
Please note: `jQuery.trigger` events can be catched with jQuery only while JavaScript `dispatchEvent` events can be catched with bare JavaScript `addEventListener` and `jQuery.on`.

0 commit comments

Comments
 (0)