Remove inline js (#16308)

* Removed inline onclick javascript

Signed-off-by: Nikkolai Fernandez <nikkolaifernandez14@gmail.com>
This commit is contained in:
Nikkolai Fernandez 2020-08-19 23:52:36 +08:00 committed by GitHub
parent 28436399dd
commit aa8c4a773c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 25 additions and 7 deletions

View File

@ -1042,4 +1042,14 @@ AJAX.registerOnload('export.js', function () {
e.preventDefault();
setSelectOptions(false);
});
$('#buttonGo').on('click', function () {
var timeLimit = parseInt($(this).attr('data-exec-time-limit'));
// If the time limit set is zero,
// then time out won't occur so no need to check for time out.
if (timeLimit > 0) {
Export.checkTimeOut(timeLimit);
}
});
});

View File

@ -5,4 +5,9 @@ AJAX.registerOnload('export_output.js', function () {
$('#export_refresh_form').trigger('submit');
}
});
$('#export_refresh_btn').on('click', function (e) {
e.preventDefault();
$('#export_refresh_form').trigger('submit');
});
});

View File

@ -923,6 +923,11 @@ $(function () {
*/
$(document).on('click', 'a.ajax.add_anchor, a.ajax.edit_anchor', function (event) {
event.preventDefault();
if ($(this).hasClass('add_anchor')) {
$.datepicker.initialized = false;
}
var type = $(this).attr('href').substr(0, $(this).attr('href').indexOf('&'));
if (type.indexOf('routine') !== -1) {
type = 'routine';

View File

@ -600,7 +600,7 @@ class Export
$html .= $back_button;
$refreshButton = '<form id="export_refresh_form" method="POST" action="'
. Url::getFromRoute('/export') . '" class="disableAjax">';
$refreshButton .= '[ <a class="disableAjax" onclick="$(this).parent().submit()">' . __('Refresh') . '</a> ]';
$refreshButton .= '[ <a class="disableAjax" id="export_refresh_btn">' . __('Refresh') . '</a> ]';
foreach ($_POST as $name => $value) {
if (is_array($value)) {
foreach ($value as $val) {

View File

@ -100,7 +100,7 @@
<legend>{% trans %}New{% context %}Create new event{% endtrans %}</legend>
<div class="wrap">
{% if has_privilege %}
<a class="ajax add_anchor" href="{{ url('/database/events', {'db': db, 'add_item': true}) }}" onclick="$.datepicker.initialized = false;">
<a class="ajax add_anchor" href="{{ url('/database/events', {'db': db, 'add_item': true}) }}">
{{ get_icon('b_event_add') }}
{% trans 'Add event' %}
</a>

View File

@ -2,7 +2,7 @@
<legend>{% trans %}New{% context %}Create new routine{% endtrans %}</legend>
<div class='wrap'>
{% if has_privilege %}
<a class="ajax add_anchor" href="{{ url('/database/routines', {'db': db, 'table': table, 'add_item': true}) }}" onclick="$.datepicker.initialized = false;">
<a class="ajax add_anchor" href="{{ url('/database/routines', {'db': db, 'table': table, 'add_item': true}) }}">
{{ get_icon('b_routine_add') }}
{% trans 'Add routine' %}
</a>

View File

@ -2,7 +2,7 @@
<legend>{% trans %}New{% context %}Create new trigger{% endtrans %}</legend>
<div class='wrap'>
{% if has_privilege %}
<a class="ajax add_anchor" href="{{ url('/database/triggers', {'db': db, 'table': table, 'add_item': true}) }}" onclick="$.datepicker.initialized = false;">
<a class="ajax add_anchor" href="{{ url('/database/triggers', {'db': db, 'table': table, 'add_item': true}) }}">
{{ get_icon('b_trigger_add') }}
{% trans 'Add trigger' %}
</a>

View File

@ -419,8 +419,6 @@
{% endif %}
<div class="exportoptions justify-content-end" id="submit">
<input id="buttonGo" class="btn btn-primary" type="submit" value="{% trans 'Go' %}"
{#- If the time limit set is zero, then time out won't occur so no need to check for time out. -#}
{%- if exec_time_limit > 0 %} onclick="Export.checkTimeOut({{ exec_time_limit }})"{% endif %}>
<input id="buttonGo" class="btn btn-primary" type="submit" value="{% trans 'Go' %}" data-exec-time-limit="{{ exec_time_limit }}">
</div>
</form>