-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #95 from iMattPro/emoji-count
Limit shortname length, but support emoji
- Loading branch information
Showing
2 changed files
with
19 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{% if S_PWA_OPTIONS %} | ||
<script> | ||
const input = document.getElementById('pwa_short_name'); | ||
const maxLength = 12; | ||
|
||
input.addEventListener('input', () => { | ||
// Use Array.from to count characters correctly | ||
const inputChars = Array.from(input.value); | ||
|
||
// If input exceeds maxLength, truncate it | ||
if (inputChars.length > maxLength) { | ||
input.value = inputChars.slice(0, maxLength).join(''); | ||
} | ||
}); | ||
</script> | ||
{% endif %} |
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