Merge remote-tracking branch 'origin/master' into dev

# Conflicts:
#	www/content/docs.md
This commit is contained in:
Carson Gross 2023-11-16 16:53:23 -07:00
commit 242f6631fa
14 changed files with 165 additions and 31 deletions

18
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@ -0,0 +1,18 @@
## Description
*Please describe what changes you made, and why you feel they are necessary. Make sure to include
code examples, where applicable.*
Corresponding issue:
## Testing
*Please explain how you tested this change manually, and, if applicable, what new tests you added. If
you're making a change to just the website, you can omit this section.*
## Checklist
* [ ] I have read the contribution guidelines
* [ ] I have targeted this PR against the correct branch (`master` for website changes, `dev` for
source changes)
* [ ] This is either a bugfix, a documentation update, or a new feature that has been explicitly
approved via an issue
* [ ] I ran the test suite locally (`npm run test`) and verified that it succeeded

View File

@ -1,26 +1,31 @@
# Contributing
Thank you for your interest in contributing! Because we're a small team, we have a couple
contribution guidelines that make it easier for us to triage all the incoming suggestions.
tl;dr: if proposing a new feature, start with an issue; if you think your change is a bugfix or otherwise uncontroversial, feel free to PR, but know that we might close it and kick you back to an issue if more discussion is required.
Want to contribute but don't know where to start? Look for issues with the "help wanted" tag.
Thank you for your interest in contributing! Because we're a small team, we have a couple contribution guidelines that make it easier for us to triage all the incoming suggestions.
## Issues
1. Issues are the best place to propose a new feature. Keep in mind that htmx is a small library, so there are lots of great ideas that don't fit in the core; it's always best to check in about an idea before doing a bunch of work on it.
1. If you are adding a feature, consider doing it as an [extension](https://htmx.org/extensions). Even if we don't end up supporting it officially, you can publish it yourself and we can link to it.
1. When proposing a new features, we will often suggest that you implement it as an [extension](https://htmx.org/extensions), so try that first. Even if we don't end up supporting it officially, you can publish it yourself and we can link to it.
1. Search the issues before proposing a feature to see if it is already under discussion. Referencing existing issues is a good way to increase the priority of your own.
1. We don't have an issue template yet, but the more detailed your explanation, the more quickly we'll be able to evaluate it.
1. We don't have an issue template yet, but the more detailed your description of the issue, the more quickly we'll be able to evaluate it.
1. See an issue that you also have? Give it a reaction (and comment, if you have something to add). We note that!
1. If you haven't gotten any traction on an issue, feel free to bump it in the #issues-and-pull-requests channel on our Discord.
1. Want to contribute but don't know where to start? Look for issues with the "help wanted" tag.
## Pull Requests
1. Open PRs represent issues that we're actively thinking working on merging (at a pace we can manage). If we think a proposal needs more discussion, or that the existing code would require a lot of back-and-forth to merge, we might close it and suggest you make an issue.
1. All PRs should be made against the `dev` branch, except documentation PRs (`www/` directory) which can be made against `master`.
1. Please avoid sending the `dist` files along your PR, only include the `src` ones
### Technical Requirements
1. Code, including tests, must be written in ES5 for [IE 11 compatibility](https://stackoverflow.com/questions/39902809/support-for-es6-in-internet-explorer-11).
1. All PRs must be made against the `dev` branch, except documentation PRs (that only modify the `www/` directory) which can be made against `master`.
1. Please avoid sending the `dist` files along your PR, only include the `src` ones.
1. Please include test cases in [`/test`](https://github.com/bigskysoftware/htmx/tree/dev/test) and docs in [`/www`](https://github.com/bigskysoftware/htmx/tree/dev/www).
1. We squash all PRs, so you're welcome to submit with as many commits are you like; they will be evaluated as a single, standalone change.
### Review Guidelines
1. Open PRs represent issues that we're actively thinking working on merging (at a pace we can manage). If we think a proposal needs more discussion, or that the existing code would require a lot of back-and-forth to merge, we might close it and suggest you make an issue.
1. Smaller PRs are easier and quicker to review. If we feel that the scope of your changes is too large, we will close the PR and try to suggest ways that the change could be broken down.
1. Please do not PR new features unless you have already made an issue proposing the feature, and had it accepted by a core maintainer. This helps us triage the features we can support before you put a lot of work into them.
1. Correspondingly, it is fine to directly PR bugfixes for behavior that htmx already guarantees, but please check if there's an issue first, and if you're not sure whether this *is* a bug, make an issue where we can hash it out..
1. Refactors that do not make functional changes will be automatically closed, unless explicitly solicited. Imagine someone came into your house unannounced, rearranged a bunch of furniture, and left.
1. Typo fixes in documentation are welcome, but if it's at all debatable we might just close it.
1. Typo fixes in the documentation (not the code comments) are welcome, but formatting or debatable grammar changes will be automatically closed.
## Misc
1. If you think we closed something incorrectly, feel free to (politely) tell us why! We're human and make mistakes.
1. There are lots of ways to improve htmx besides code changes. Sometimes a problem can be solved with better docs, usage patterns, extensions, or community support. Talk to us and we can almost always help you get to a solution.

View File

@ -72,6 +72,7 @@ Thank you to all our generous <a href="https://github.com/sponsors/bigskysoftwar
#sponsor-table td {
text-align: center;
padding: 16px;
min-height: 100px;
}
@media only screen and (max-width: 760px) {
@ -91,25 +92,27 @@ Thank you to all our generous <a href="https://github.com/sponsors/bigskysoftwar
<a href="https://www.jetbrains.com//"><img src="/img/jetbrains.png" style="max-width:30%;min-width:200px;"></a>
</td>
<td>
<a href="https://www.nuclei.ai/"><img src="/img/nuclei_logo_with_text.svg" style="max-width:50%;min-width:200px;"></a>
<a href="https://github.blog/2023-04-12-github-accelerator-our-first-cohort-and-whats-next//"><img src="/img/Github_Logo.png" style="max-width:30%;min-width:200px;"></a>
</td>
<tr>
<td>
<a href="https://github.blog/2023-04-12-github-accelerator-our-first-cohort-and-whats-next//"><img src="/img/Github_Logo.png" style="max-width:30%;min-width:200px;"></a>
<a href="https://www.commspace.co.za/"><img src="/img/commspace.svg" style="width:100%;max-width:400px"></a>
</td>
<td>
<a href="https://www.commspace.co.za/"><img src="/img/commspace.svg" style="width:100%;max-width:600px"></a>
<a href="https://craftcms.com"><img src="/img/logo-craft-cms.svg" style="width:90%;max-width:200px"></a>
</td>
</tr>
<tr>
<td>
<a href="https://craftcms.com"><img src="/img/logo-craft-cms.svg" style="width:90%;max-width:200px"></a>
</td>
<td>
<a href="https://buttercms.com/?utm_campaign=sponsorship&utm_medium=banner&utm_source=htmxhome">
<img src="/img/butter-cms.svg" style="width:100%;max-width:200px">
</a>
</td>
<td>
<a href="https://black.host/">
<img src="/img/blackhost-logo.svg" style="width:100%;max-width:200px">
</a>
</td>
</tr>
<tr>
<td>

View File

@ -105,9 +105,10 @@ Note that using a [meta tag](@/docs.md#config) is the preferred mechanism for se
##### Properties
* `attributesToSettle:["class", "style", "width", "height"]` - array of strings: the attributes to settle during the settling phase
* `refreshOnHistoryMiss:false` - boolean: if set to `true` htmx will issue a full page refresh on history misses rather than use an AJAX request
* `defaultSettleDelay:20` - int: the default delay between completing the content swap and settling attributes
* `defaultSwapDelay:0` - int: the default delay between receiving a response from the server and doing the swap
* `defaultSwapStyle:'innerHtml'` - string: the default swap style to use if [`hx-swap`](@/attributes/hx-swap.md) is omitted
* `defaultSwapStyle:'innerHTML'` - string: the default swap style to use if [`hx-swap`](@/attributes/hx-swap.md) is omitted
* `historyCacheSize:10` - int: the number of pages to keep in `localStorage` for history support
* `historyEnabled:true` - boolean: whether or not to use history
* `includeIndicatorStyles:true` - boolean: if true, htmx will inject a small amount of CSS into the page to make indicators invisible unless the `htmx-indicator` class is present
@ -118,10 +119,20 @@ Note that using a [meta tag](@/docs.md#config) is the preferred mechanism for se
* `swappingClass:'htmx-swapping'` - string: the class to place on target elements when htmx is in the swapping phase
* `allowEval:true` - boolean: allows the use of eval-like functionality in htmx, to enable `hx-vars`, trigger conditions & script tag evaluation. Can be set to `false` for CSP compatibility.
* `allowScriptTags:true` - boolean: allows script tags to be evaluated in new content
* `inlineScriptNonce:''` - string: the [nonce](https://developer.mozilla.org/docs/Web/HTML/Global_attributes/nonce) to add to inline scripts
* `useTemplateFragments:false` - boolean: use HTML template tags for parsing content from the server. This allows you to use Out of Band content when returning things like table rows, but it is *not* IE11 compatible.
* `withCredentials:false` - boolean: allow cross-site Access-Control requests using credentials such as cookies, authorization headers or TLS client certificates
* `wsReconnectDelay:full-jitter` - string/function: the default implementation of `getWebSocketReconnectDelay` for reconnecting after unexpected connection loss by the event code `Abnormal Closure`, `Service Restart` or `Try Again Later`
* `scrollBehavior:smooth` - string: the behavior for a boosted link on page transitions. The allowed values are `auto` and `smooth`. Smooth will smoothscroll to the top of the page while auto will behave like a vanilla link.
* `timeout:0` - int: the number of milliseconds a request can take before automatically being terminated
* `wsReconnectDelay:'full-jitter'` - string/function: the default implementation of `getWebSocketReconnectDelay` for reconnecting after unexpected connection loss by the event code `Abnormal Closure`, `Service Restart` or `Try Again Later`
* `wsBinaryType:'blob'` - string: the [the type of binary data](https://developer.mozilla.org/docs/Web/API/WebSocket/binaryType) being received over the WebSocket connection
* `disableSelector:"[hx-disable], [data-hx-disable]"` - array of strings: htmx will not process elements with this attribute on it or a parent
* `scrollBehavior:'smooth'` - string: the behavior for a boosted link on page transitions. The allowed values are `auto` and `smooth`. Smooth will smoothscroll to the top of the page while auto will behave like a vanilla link.
* `defaultFocusScroll:false` - boolean: if the focused element should be scrolled into view, can be overridden using the [focus-scroll](@/attributes/hx-swap.md#focus-scroll) swap modifier
* `getCacheBusterParam:false` - boolean: if set to true htmx will include a cache-busting parameter in `GET` requests to avoid caching partial responses by the browser
* `globalViewTransitions:false` - boolean: if set to `true`, htmx will use the [View Transition](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API) API when swapping in new content.
* `methodsThatUseUrlParams:["get"]` - array of strings: htmx will format requests with these methods by encoding their parameters in the URL, not the request body
* `selfRequestsOnly:false` - boolean: if set to `true` will only allow AJAX requests to the same domain as the current document
* `ignoreTitle:false` - boolean: if set to `true` htmx will not update the title of the document when a `title` tag is found in new content
* `scrollIntoViewOnBoost:true` - boolean: whether or not the target of a boosted element is scrolled into the viewport. If `hx-target` is omitted on a boosted element, the target defaults to `body`, causing the page to scroll to the top.
##### Example

View File

@ -114,7 +114,7 @@ The fastest way to get going with htmx is to load it via a CDN. You can simply a
and get going:
```html
<script src="https://unpkg.com/htmx.org@1.9.9" integrity="sha384-EAzY246d6BpbWR7sQ8+WEm40J8c3dHFsqC58IgPlh4kMbRRI6P6WA+LA/qGAyAu8" crossorigin="anonymous"></script>
<script src="https://unpkg.com/htmx.org@1.9.9" integrity="sha384-TODO" crossorigin="anonymous"></script>
```
While the CDN approach is extremely simple, you may want to consider [not using CDNs in production](https://blog.wesleyac.com/posts/why-not-javascript-cdn).

View File

@ -22,6 +22,7 @@ page_template = "essay.html"
* [A Response To "Have SPAs Ruined The Web"](@/essays/a-response-to-rich-harris.md)
* [When To Use Hypermedia?](@/essays/when-to-use-hypermedia.md)
* [The API Churn/Security Trade-off](https://intercoolerjs.org/2016/02/17/api-churn-vs-security.html)
* [Does Hypermedia Scale?](@/essays/does-hypermedia-scale.md)
* [SPA Alternative](@/essays/spa-alternative.md)
### Building Hypermedia Applications

View File

@ -12,7 +12,7 @@ One objection that we sometimes hear to htmx and hypermedia is some variation of
> Well, it might work well for something small, but it won't scale.
It is always dangerous to provoke us with essay-fodder and so lets dig into this claim a bit and see if we can
shed some light on whether [Hypermedia-Driven Applications]((@/essays/hypermedia-driven-applications.md)) (HDAs) can scale.
shed some light on whether [Hypermedia-Driven Applications](@/essays/hypermedia-driven-applications.md) (HDAs) can scale.
## Scaling

View File

@ -143,6 +143,7 @@ Here are some known implementations of the fragment concept:
* PHP
* [Latte](https://latte.nette.org/en/template-inheritance#toc-blocks) - Use the 3rd parameter to only render 1 block from the template - `$Latte_Engine->render('path/to/template.latte', [ 'foo' => 'bar' ], 'content');`
* [Laravel Blade](https://laravel.com/docs/10.x/blade#rendering-blade-fragments) - includes built-in support for template fragments as of v9.x
* [Twig](https://twig.symfony.com/doc/3.x/api.html#rendering-templates) - `$template->renderBlock('block_name', ['the' => 'variables', 'go' => 'here']);`
* Python
* [Django Render Block Extension](https://pypi.org/project/django-render-block/) - see [example code for htmx](https://github.com/spookylukey/django-htmx-patterns/blob/master/inline_partials.rst)
* [jinja2-fragments package](https://github.com/sponsfreixes/jinja2-fragments)

View File

@ -31,7 +31,7 @@ You can copy and paste them and then adjust them for your needs.
| [File Upload](@/examples/file-upload.md) | Demonstrates how to upload a file via ajax with a progress bar
| [Preserving File Inputs after Form Errors](@/examples/file-upload-input.md) | Demonstrates how to preserve file inputs after form errors
| [Dialogs - Browser](@/examples/dialogs.md) | Demonstrates the prompt and confirm dialogs
| [Dialogs - UIKIt](@/examples/modal-uikit.md) | Demonstrates modal dialogs using UIKit
| [Dialogs - UIKit](@/examples/modal-uikit.md) | Demonstrates modal dialogs using UIKit
| [Dialogs - Bootstrap](@/examples/modal-bootstrap.md) | Demonstrates modal dialogs using Bootstrap
| [Dialogs - Custom](@/examples/modal-custom.md) | Demonstrates modal dialogs from scratch
| [Tabs (Using HATEOAS)](@/examples/tabs-hateoas.md) | Demonstrates how to display and select tabs using HATEOAS principles

View File

@ -17,7 +17,7 @@ We start with a search input and an empty table:
<input class="form-control" type="search"
name="search" placeholder="Begin Typing To Search Users..."
hx-post="/search"
hx-trigger="keyup changed delay:500ms, search"
hx-trigger="input changed delay:500ms, search"
hx-target="#search-results"
hx-indicator=".htmx-indicator">
@ -34,16 +34,16 @@ We start with a search input and an empty table:
</table>
```
The input issues a `POST` to `/search` on the `keyup` event and sets the body of the table to be the resulting content.
The input issues a `POST` to `/search` on the [`input`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/input_event) event and sets the body of the table to be the resulting content. Note that the `keyup` event could be used as well, but would not fire if the user pasted text with their mouse (or any other non-keyboard method).
We add the `delay:500ms` modifier to the trigger to delay sending the query until the user stops typing. Additionally,
we add the `changed` modifier to the trigger to ensure we don't send new queries when the user doesn't change the
value of the input (e.g. they hit an arrow key).
value of the input (e.g. they hit an arrow key, or pasted the same value).
Since we use a `search` type input we will get an `x` in the input field to clear the input.
To make this trigger a new `POST` we have to specify another trigger. We specify another trigger by using a comma to
separate them. The `search` trigger will be run when the field is cleared but it also makes it possible to override
the 500 ms delay on `keyup` by just pressing enter.
the 500 ms `input` event delay by just pressing enter.
Finally, we show an indicator when the search is in flight with the `hx-indicator` attribute.
@ -78,7 +78,7 @@ Search Contacts
<input class="form-control" type="search"
name="search" placeholder="Begin Typing To Search Users..."
hx-post="/search"
hx-trigger="keyup changed delay:500ms, search"
hx-trigger="input changed delay:500ms, search"
hx-target="#search-results"
hx-indicator=".htmx-indicator">

View File

@ -12,6 +12,7 @@ title = "Reference"
* [htmx Events](#events)
* [htmx Extensions](/extensions#included)
* [JavaScript API](#api)
* [Configuration Options](#config)
## Core Attribute Reference {#attributes}
@ -207,3 +208,51 @@ The table below lists all other attributes available in htmx.
</div>
## Configuration Reference {#config}
Htmx has some configuration options that can be accessed either programmatically or declaratively. They are
listed below:
<div class="info-table">
| Config Variable | Info |
|---------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `htmx.config.historyEnabled` | defaults to `true`, really only useful for testing |
| `htmx.config.historyCacheSize` | defaults to 10 |
| `htmx.config.refreshOnHistoryMiss` | defaults to `false`, if set to `true` htmx will issue a full page refresh on history misses rather than use an AJAX request |
| `htmx.config.defaultSwapStyle` | defaults to `innerHTML` |
| `htmx.config.defaultSwapDelay` | defaults to 0 |
| `htmx.config.defaultSettleDelay` | defaults to 20 |
| `htmx.config.includeIndicatorStyles` | defaults to `true` (determines if the indicator styles are loaded) |
| `htmx.config.indicatorClass` | defaults to `htmx-indicator` |
| `htmx.config.requestClass` | defaults to `htmx-request` |
| `htmx.config.addedClass` | defaults to `htmx-added` |
| `htmx.config.settlingClass` | defaults to `htmx-settling` |
| `htmx.config.swappingClass` | defaults to `htmx-swapping` |
| `htmx.config.allowEval` | defaults to `true`, can be used to disable htmx's use of eval for certain features (e.g. trigger filters) |
| `htmx.config.allowScriptTags` | defaults to `true`, determines if htmx will process script tags found in new content |
| `htmx.config.inlineScriptNonce` | defaults to `''`, meaning that no nonce will be added to inline scripts |
| `htmx.config.attributesToSettle` | defaults to `["class", "style", "width", "height"]`, the attributes to settle during the settling phase |
| `htmx.config.useTemplateFragments` | defaults to `false`, HTML template tags for parsing content from the server (not IE11 compatible!) |
| `htmx.config.wsReconnectDelay` | defaults to `full-jitter` |
| `htmx.config.wsBinaryType` | defaults to `blob`, the [the type of binary data](https://developer.mozilla.org/docs/Web/API/WebSocket/binaryType) being received over the WebSocket connection |
| `htmx.config.disableSelector` | defaults to `[hx-disable], [data-hx-disable]`, htmx will not process elements with this attribute on it or a parent |
| `htmx.config.withCredentials` | defaults to `false`, allow cross-site Access-Control requests using credentials such as cookies, authorization headers or TLS client certificates |
| `htmx.config.timeout` | defaults to 0, the number of milliseconds a request can take before automatically being terminated |
| `htmx.config.scrollBehavior` | defaults to 'smooth', the behavior for a boosted link on page transitions. The allowed values are `auto` and `smooth`. Smooth will smoothscroll to the top of the page while auto will behave like a vanilla link. |
| `htmx.config.defaultFocusScroll` | if the focused element should be scrolled into view, defaults to false and can be overridden using the [focus-scroll](@/attributes/hx-swap.md#focus-scroll) swap modifier. |
| `htmx.config.getCacheBusterParam` | defaults to false, if set to true htmx will include a cache-busting parameter in `GET` requests to avoid caching partial responses by the browser |
| `htmx.config.globalViewTransitions` | if set to `true`, htmx will use the [View Transition](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API) API when swapping in new content. |
| `htmx.config.methodsThatUseUrlParams` | defaults to `["get"]`, htmx will format requests with these methods by encoding their parameters in the URL, not the request body |
| `htmx.config.selfRequestsOnly` | defaults to `false`, if set to `true` will only allow AJAX requests to the same domain as the current document |
| `htmx.config.ignoreTitle` | defaults to `false`, if set to `true` htmx will not update the title of the document when a `title` tag is found in new content |
| `htmx.config.scrollIntoViewOnBoost` | defaults to `true`, whether or not the target of a boosted element is scrolled into the viewport. If `hx-target` is omitted on a boosted element, the target defaults to `body`, causing the page to scroll to the top. |
</div>
You can set them directly in javascript, or you can use a `meta` tag:
```html
<meta name="htmx-config" content='{"defaultSwapStyle":"outerHTML"}'>
```

View File

@ -138,6 +138,15 @@ These examples may make it a bit easier to get started using htmx with your plat
- <https://github.com/michalsn/codeigniter-htmx-demo>
### Laravel
- <https://spirofloropoulos.com/laravel-htmx-hard-mode-1.html>
### Symfony
- <https://github.com/tomcri/htmxfony>
## Elixir
### Phoenix

View File

@ -0,0 +1,33 @@
<!-- Generator: Adobe Illustrator 25.1.0, SVG Export Plug-In -->
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="189.51px" height="22.2px" viewBox="0 0 189.51 22.2" style="overflow:visible;enable-background:new 0 0 189.51 22.2;"
xml:space="preserve">
<style type="text/css">
.st0{fill:#00;}
</style>
<defs>
</defs>
<g>
<path class="st0" d="M16.59,16.11c0,4.11-2.34,5.94-6.63,5.94H0V0.15h8.04c4.56,0,6.9,2.07,6.9,5.97c0,3.15-2.04,4.14-2.73,4.35
C14.64,11.01,16.59,12.66,16.59,16.11z M3.15,3.3v6.27h4.71c2.67,0,3.93-0.99,3.93-3.09c0-2.01-1.2-3.18-4.14-3.18H3.15z M9.6,18.9
c2.55,0,3.84-0.84,3.84-3.03c0-2.1-1.26-3.39-4.14-3.39H3.15v6.42H9.6z"/>
<path class="st0" d="M32.73,18.9v3.15h-13.5V0.15h3.15V18.9H32.73z"/>
<path class="st0" d="M50.67,22.05c-0.84-2.37-1.65-4.62-2.4-6.63h-9.48c-0.72,2.01-1.53,4.26-2.37,6.63h-3.3
c4.89-13.89,8.46-21.9,8.46-21.9h3.9c0,0,3.57,8.01,8.49,21.9H50.67z M47.19,12.48C45,6.6,43.53,3.03,43.53,3.03
s-1.44,3.57-3.63,9.45H47.19z"/>
<path class="st0" d="M65.22,0c6,0,8.19,2.85,8.85,3.72c-0.54,1.8-1.74,2.91-1.74,2.91c-1.05-1.5-2.76-3.51-7.11-3.51
c-4.29,0-7.89,2.55-7.89,7.98c0,5.76,3.48,7.98,7.89,7.98c4.26,0,6.36-1.86,7.35-3.45c0,0,1.08,0.99,1.71,2.67
c-0.63,0.96-3.03,3.9-9.03,3.9c-6.27,0-11.07-3.63-11.07-11.1C54.18,3.87,58.95,0,65.22,0z"/>
<path class="st0" d="M91.68,22.05c-2.82-4.41-5.28-7.68-6.33-9.03c-1.56,0.96-3.36,1.71-5.37,2.28v6.75h-3.15V0.15h3.15v12
c5.16-1.41,8.91-4.77,10.8-12h3.15c-1.44,5.07-3.39,8.55-6.03,10.98c1.08,1.41,4.05,5.4,7.47,10.92H91.68z"/>
<path class="st0" d="M125.61,0.15v21.9h-4.95V14.1h-11.1v7.95h-4.95V0.15h4.95v9h11.1v-9H125.61z"/>
<path class="st0" d="M139.26,0c6.3,0,10.95,3.75,10.95,11.1c0,7.35-4.65,11.1-10.95,11.1s-10.95-3.75-10.95-11.1
C128.31,3.75,132.96,0,139.26,0z M139.26,17.25c3.75,0,6-2.4,6-6.15c0-3.75-2.25-6.15-6-6.15s-6,2.4-6,6.15
C133.26,14.85,135.51,17.25,139.26,17.25z"/>
<path class="st0" d="M164.91,7.95c0,0,0.3-0.45,0.3-1.35c0-1.35-0.75-2.37-3.9-2.37c-3,0-4.05,1.02-4.05,2.37
c0,4.5,13.2,0.9,13.2,9c0,4.2-2.55,6.6-9,6.6c-6.75,0-8.85-2.7-9.3-6.45c0,0,1.8-0.75,4.65-1.05c0.3,2.25,1.5,3.45,4.95,3.45
c3,0,4.05-0.75,4.05-2.25c0-4.2-13.35-0.75-13.35-9.45c0-3.75,2.55-6.45,9-6.45c6.75,0,8.7,2.7,8.7,5.55c0,1.8-0.45,2.4-0.45,2.4
H164.91z"/>
<path class="st0" d="M189.51,5.1h-6.6v16.95h-4.95V5.1h-6.6V0.15h18.15V5.1z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -28,8 +28,8 @@ function parseParams(str) {
str = str.substr(1);
}
while (e = re.exec(str)) {
var k = decode(e[1]);
var v = decode(e[2]);
var k = encodeHTML(decode(e[1]));
var v = encodeHTML(decode(e[2]));
if (params[k] !== undefined) {
if (!Array.isArray(params[k])) {
params[k] = [params[k]];
@ -52,6 +52,10 @@ function getQuery(url) {
url.substring(question + 1, hash);
}
function encodeHTML(s) {
return s.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/"/g, '&quot;');
}
function params(request) {
if (server.getHTTPMethod(request) == "GET") {
return parseParams(getQuery(request.url));