mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-10 05:18:52 +00:00
[ticket/17449] Better handling of emoji in site name for webpush manifest
PHPBB-17449
This commit is contained in:
parent
259d086e45
commit
5da62d729f
2 changed files with 21 additions and 2 deletions
|
@ -162,6 +162,22 @@ function parse_document(container)
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dynamically control a text field's maxlength (allows emoji to be counted as 1 character)
|
||||||
|
*/
|
||||||
|
container.find('#sitename_short').each(function() {
|
||||||
|
const $this = this;
|
||||||
|
const maxLength = $this.maxLength;
|
||||||
|
$this.maxLength = maxLength * 2;
|
||||||
|
$this.addEventListener('input', () => {
|
||||||
|
const inputChars = Array.from($this.value);
|
||||||
|
if (inputChars.length > maxLength) {
|
||||||
|
$this.value = inputChars.slice(0, maxLength).join('');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Responsive tabs
|
* Responsive tabs
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -69,9 +69,12 @@ class manifest
|
||||||
|
|
||||||
$board_path = $this->config['force_server_vars'] ? $this->config['script_path'] : $this->path_helper->get_web_root_path();
|
$board_path = $this->config['force_server_vars'] ? $this->config['script_path'] : $this->path_helper->get_web_root_path();
|
||||||
|
|
||||||
|
$sitename = html_entity_decode($this->config['sitename'], ENT_QUOTES, 'UTF-8');
|
||||||
|
$sitename_short = html_entity_decode($this->config['sitename_short'], ENT_QUOTES, 'UTF-8');
|
||||||
|
|
||||||
$manifest = [
|
$manifest = [
|
||||||
'name' => $this->config['sitename'],
|
'name' => $sitename,
|
||||||
'short_name' => $this->config['sitename_short'] ?: substr($this->config['sitename'], 0, 12),
|
'short_name' => $sitename_short ?: utf8_substr($sitename, 0, 12),
|
||||||
'display' => 'standalone',
|
'display' => 'standalone',
|
||||||
'orientation' => 'portrait',
|
'orientation' => 'portrait',
|
||||||
'dir' => $this->language->lang('DIRECTION'),
|
'dir' => $this->language->lang('DIRECTION'),
|
||||||
|
|
Loading…
Add table
Reference in a new issue