1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-07 23:27:17 +02:00

Move inline event handlers to <script>

This commit is contained in:
Jakub Vrana
2018-01-12 14:35:22 +01:00
parent 650221357d
commit da671df728
3 changed files with 7 additions and 6 deletions

View File

@@ -119,8 +119,8 @@ function checkbox($name, $value, $checked, $label = "", $onclick = "", $class =
$return = "<input type='checkbox' name='$name' value='" . h($value) . "'"
. ($checked ? " checked" : "")
. ($labelled_by ? " aria-labelledby='$labelled_by'" : "")
. ($onclick ? ' onclick="' . h($onclick) . '"' : '')
. ">"
. ($onclick ? "<script>qsl('input').onclick = function () { $onclick };</script>" : "")
;
return ($label != "" || $class ? "<label" . ($class ? " class='$class'" : "") . ">$return" . h($label) . "</label>" : $return);
}
@@ -160,9 +160,10 @@ function optionlist($options, $selected = null, $use_keys = false) {
function html_select($name, $options, $value = "", $onchange = true, $labelled_by = "") {
if ($onchange) {
return "<select name='" . h($name) . "'"
. (is_string($onchange) ? ' onchange="' . h($onchange) . '"' : "")
. ($labelled_by ? " aria-labelledby='$labelled_by'" : "")
. ">" . optionlist($options, $value) . "</select>";
. ">" . optionlist($options, $value) . "</select>"
. (is_string($onchange) ? "<script>qsl('select').onchange = function () { $onchange };</script>" : "")
;
}
$return = "";
foreach ($options as $key => $val) {