defer additional_javascript
- this required a fix to file-selector
This commit is contained in:
parent
a7948f09cb
commit
ab8b4b9524
|
@ -8,24 +8,6 @@
|
|||
*/
|
||||
function init_file_selector(max_images) {
|
||||
|
||||
$(document).ready(function () {
|
||||
// add options panel item
|
||||
if (window.Options && Options.get_tab('general')) {
|
||||
Options.extend_tab('general', '<label id="file-drag-drop"><input type="checkbox">' + _('Drag and drop file selection') + '</label>');
|
||||
|
||||
$('#file-drag-drop>input').on('click', function() {
|
||||
if ($('#file-drag-drop>input').is(':checked')) {
|
||||
localStorage.file_dragdrop = 'true';
|
||||
} else {
|
||||
localStorage.file_dragdrop = 'false';
|
||||
}
|
||||
});
|
||||
|
||||
if (typeof localStorage.file_dragdrop === 'undefined') localStorage.file_dragdrop = 'true';
|
||||
if (localStorage.file_dragdrop === 'true') $('#file-drag-drop>input').prop('checked', true);
|
||||
}
|
||||
});
|
||||
|
||||
// disabled by user, or incompatible browser.
|
||||
if (localStorage.file_dragdrop == 'false' || !(window.URL.createObjectURL && window.File))
|
||||
return;
|
||||
|
@ -190,3 +172,26 @@ $(document).on('paste', function (e) {
|
|||
});
|
||||
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
// add options panel item
|
||||
if (window.Options && Options.get_tab('general')) {
|
||||
Options.extend_tab('general', '<label id="file-drag-drop"><input type="checkbox">' + _('Drag and drop file selection') + '</label>');
|
||||
|
||||
$('#file-drag-drop>input').on('click', function() {
|
||||
if ($('#file-drag-drop>input').is(':checked')) {
|
||||
localStorage.file_dragdrop = 'true';
|
||||
} else {
|
||||
localStorage.file_dragdrop = 'false';
|
||||
}
|
||||
});
|
||||
|
||||
if (typeof localStorage.file_dragdrop === 'undefined') localStorage.file_dragdrop = 'true';
|
||||
if (localStorage.file_dragdrop === 'true') $('#file-drag-drop>input').prop('checked', true);
|
||||
}
|
||||
});
|
||||
|
||||
$(document).ready(function () {
|
||||
var maxImages = document.querySelector("form[name=post]").dataset.maxImages;
|
||||
init_file_selector(new Number(maxImages));
|
||||
});
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
{% if not nojavascript %}
|
||||
<script type="text/javascript" src="{{ config.url_javascript }}"></script>
|
||||
{% if not config.additional_javascript_compile %}
|
||||
{% for javascript in config.additional_javascript %}<script type="text/javascript" src="{{ config.additional_javascript_url }}{{ javascript }}"></script>{% endfor %}
|
||||
{% for javascript in config.additional_javascript %}<script defer type="text/javascript" src="{{ config.additional_javascript_url }}{{ javascript }}"></script>{% endfor %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if config.recaptcha %}
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
<form name="post" onsubmit="return dopost(this);" enctype="multipart/form-data" action="{{ config.post_url }}" method="post">
|
||||
<form
|
||||
name="post" onsubmit="return dopost(this);"
|
||||
enctype="multipart/form-data"
|
||||
action="{{ config.post_url }}"
|
||||
method="post"
|
||||
data-max-images="{{ config.max_images }}"
|
||||
>
|
||||
{{ antibot.html() }}
|
||||
{% if id %}<input type="hidden" name="thread" value="{{ id }}">{% endif %}
|
||||
{{ antibot.html() }}
|
||||
|
@ -142,8 +148,6 @@
|
|||
<td>
|
||||
<input type="file" name="file" id="upload_file">
|
||||
|
||||
<script type="text/javascript">if (typeof init_file_selector !== 'undefined') init_file_selector({{ config.max_images }});</script>
|
||||
|
||||
{% if config.allow_upload_by_url %}
|
||||
<div style="float:none;text-align:left" id="upload_url">
|
||||
<label for="file_url">{% trans %}Or URL{% endtrans %}</label>:
|
||||
|
|
Loading…
Reference in New Issue