Use Twig's JS escaping

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
This commit is contained in:
Kamil Tekiela 2022-10-15 17:13:37 +01:00
parent 2c1c873220
commit 48e3f7f882
3 changed files with 5 additions and 5 deletions

View File

@ -8,14 +8,14 @@
<meta http-equiv="Refresh" content="0;url={{ uri }}">
<script type="text/javascript">
//<![CDATA[
setTimeout(function() { window.location = decodeURI('{{ uri|escape_js_string }}'); }, 2000);
setTimeout(function() { window.location = decodeURI('{{ uri|e('js') }}'); }, 2000);
//]]>
</script>
</head>
<body>
<script type="text/javascript">
//<![CDATA[
document.write('<p><a href="{{ uri|e|escape_js_string }}">{% trans 'Go' %}</a></p>');
document.write('<p><a href="{{ uri|e('js') }}">{% trans 'Go' %}</a></p>');
//]]>
</script>
</body>

View File

@ -10,7 +10,7 @@ $( function() {
'import_status': 1
}, '&') %}
{% set promot_str = 'The file being uploaded is probably larger than the maximum allowed size or this is a known bug in webkit based (Safari, Google Chrome, Arora etc.) browsers.'|trans|js_format(false) %}
{% set statustext_str = '%s of %s'|trans|escape_js_string %}
{% set statustext_str = '%s of %s'|trans|e('js') %}
{% set second_str = '%s/sec.'|trans|js_format(false) %}
{% set remaining_min = 'About %MIN min. %SEC sec. remaining.'|trans|js_format(false) %}
{% set remaining_second = 'About %SEC sec. remaining.'|trans|js_format(false) %}

View File

@ -10,13 +10,13 @@
{% if files is not empty %}
window.AJAX.scriptHandler
{% for file in files %}
.add('{{ file.filename|escape_js_string }}', {{ file.has_onload ? 1 : 0 }})
.add('{{ file.filename|e('js') }}', {{ file.has_onload ? 1 : 0 }})
{% endfor %}
;
$(function() {
{% for file in files %}
{% if file.has_onload %}
window.AJAX.fireOnload('{{ file.filename|escape_js_string }}');
window.AJAX.fireOnload('{{ file.filename|e('js') }}');
{% endif %}
{% endfor %}
});