mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 12:28:52 +00:00
[ticket/17100] Remove inline javascript from lang select
PHPBB3-17100
This commit is contained in:
parent
4846723bb6
commit
fb1899de62
1 changed files with 13 additions and 14 deletions
|
@ -3,22 +3,10 @@
|
||||||
<!-- IF S_SHOW_COPPA or S_REGISTRATION -->
|
<!-- IF S_SHOW_COPPA or S_REGISTRATION -->
|
||||||
|
|
||||||
{% if lang_options|length > 0 %}
|
{% if lang_options|length > 0 %}
|
||||||
<script>
|
|
||||||
/**
|
|
||||||
* Change language
|
|
||||||
*/
|
|
||||||
function change_language(lang_iso)
|
|
||||||
{
|
|
||||||
document.cookie = '{COOKIE_NAME}_lang=' + lang_iso + '; path={COOKIE_PATH}';
|
|
||||||
document.forms['register'].change_lang.value = lang_iso;
|
|
||||||
document.forms['register'].submit();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<form method="post" action="{S_UCP_ACTION}" id="register">
|
<form method="post" action="{S_UCP_ACTION}" id="register">
|
||||||
<p class="rightside">
|
<p class="rightside">
|
||||||
<label for="lang">{L_LANGUAGE}{L_COLON}</label>
|
<label for="lang">{{ lang('LANGUAGE') ~ lang('COLON') }}</label>
|
||||||
<select name="lang" id="lang" onchange="change_language(this.value); return false;" title="{L_LANGUAGE}">
|
<select name="lang" id="lang" title="{{ lang('LANGUAGE') }}">
|
||||||
{% for option in lang_options %}
|
{% for option in lang_options %}
|
||||||
<option value="{{ option.LANG_ISO }}"{% if option.SELECTED %} selected="selected"{% endif %}>{{ option.LANG_LOCAL_NAME }}</option>
|
<option value="{{ option.LANG_ISO }}"{% if option.SELECTED %} selected="selected"{% endif %}>{{ option.LANG_LOCAL_NAME }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -29,6 +17,17 @@
|
||||||
|
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
/**
|
||||||
|
* Change language on change
|
||||||
|
*/
|
||||||
|
document.querySelector('#lang').addEventListener('change', (event) => {
|
||||||
|
const langIso = event.target.value;
|
||||||
|
document.cookie = '{{ COOKIE_NAME }}_lang=' + langIso + '; path={{ COOKIE_PATH }}';
|
||||||
|
document.forms['register'].change_lang.value = langIso;
|
||||||
|
document.forms['register'].submit();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<form method="post" action="{S_UCP_ACTION}" id="agreement">
|
<form method="post" action="{S_UCP_ACTION}" id="agreement">
|
||||||
|
|
Loading…
Add table
Reference in a new issue