-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix reset button rendering on iOS, minor refactoring
- Loading branch information
Showing
4 changed files
with
51 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ Triggers a `rated` event in the DOM, so can be used with HTMX, hyperscript or ot | |
## Example usage | ||
Import `hyperstars.css` before loading hyperscript: | ||
``` | ||
<link href="hyperstars.css" rel="stylesheet" type="text/css" /> | ||
<link href="hyperstars.css" rel="stylesheet" type="text/css"> | ||
<script src="hyperstars._hs" type="text/hyperscript"></script> | ||
<script src="https://unpkg.com/[email protected]"></script> | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,26 +17,52 @@ | |
input[type=range] { | ||
display: none; | ||
} | ||
|
||
pre { | ||
display: block; | ||
} | ||
</style> | ||
<link href="hyperstars.css" rel="stylesheet" type="text/css" /> | ||
<link href="hyperstars.css" rel="stylesheet" type="text/css"> | ||
<script src="hyperstars._hs" type="text/hyperscript"></script> | ||
<script src="https://unpkg.com/[email protected]"></script> | ||
</head> | ||
|
||
<body> | ||
<h1>_hyperstars examples</h1> | ||
<h2>Default:</h2> | ||
<h3>Default:</h3> | ||
<pre> | ||
<code _="init put escapeHTML(outerHTML of next <span/>) into me"></code> | ||
</pre> | ||
<span _="install Hyperstars()"></span> | ||
<h2>With reset button:</h2> | ||
<h3>With reset button:</h3> | ||
<pre> | ||
<code _="init put escapeHTML(outerHTML of next <span/>) into me"></code> | ||
</pre> | ||
<span _="install Hyperstars(resettable: true)"></span> | ||
<h2>With custom input:</h2> | ||
<h3>With custom input:</h3> | ||
<pre> | ||
<code _="init put escapeHTML(outerHTML of next <span/>) into me"></code> | ||
</pre> | ||
<span _="install Hyperstars()"> | ||
<input type="range" min="2" max="10" step="1" value="5"> | ||
</span> | ||
<h2>Readonly/disabled:</h2> | ||
<h3>Readonly/disabled:</h3> | ||
<pre> | ||
<code _="init put escapeHTML(outerHTML of next <span/>) into me"></code> | ||
</pre> | ||
<span _="install Hyperstars()"> | ||
<input type="range" value="2.5" readonly> | ||
<input type="range" value="2.5" disabled> | ||
</span> | ||
|
||
<script type="text/hyperscript"> | ||
def escapeHTML(html) | ||
js(html) | ||
return html.replace(/[\u00A0-\u9999<>\&]/g, | ||
i => '&#'+i.charCodeAt(0)+';') | ||
end | ||
return it | ||
end | ||
</script> | ||
</body> | ||
|
||
</html> |