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

@ -36,7 +36,7 @@ function connect_error() {
. "<th>" . lang('Database') . " - <a href='" . h(ME) . "refresh=1'>" . lang('Refresh') . "</a>"
. "<td>" . lang('Collation')
. "<td>" . lang('Tables')
. "<td>" . lang('Size') . " - <a href='" . h(ME) . "dbsize=1' onclick=\"return ajaxSetHtml('" . h(js_escape(ME)) . "script=connect');\">" . lang('Compute') . "</a>"
. "<td>" . lang('Size') . " - <a href='" . h(ME) . "dbsize=1'>" . lang('Compute') . "</a><script>qsl('a').onclick = partial(ajaxSetHtml, '" . js_escape(ME) . "script=connect');</script>"
. "</thead>\n"
;
@ -57,7 +57,7 @@ function connect_error() {
echo "</table>\n";
echo (support("database")
? "<fieldset><legend>" . lang('Selected') . " <span id='selected'></span></legend><div>\n"
. "<input type='hidden' name='all' value='' onclick=\"selectCount('selected', formChecked(this, /^db/));\">\n" // used by trCheck()
. "<input type='hidden' name='all' value=''><script>qsl('input').onclick = function () { selectCount('selected', formChecked(this, /^db/)); };</script>\n" // used by trCheck()
. "<input type='submit' name='drop' value='" . lang('Drop') . "'" . confirm() . ">\n"
. "</div></fieldset>\n"
: ""

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) {

View file

@ -465,7 +465,7 @@ if (!$columns && support("table")) {
);
if ($jush != "simpledb") {
echo '<a href="' . h(remove_from_uri("page")) . '">' . lang('Page') . "</a>:";
echo "<script>qsl('a').onclick = function () { pageClick(this.href, +prompt('" . lang('Page') . "', '" . ($page + 1) . "')); return false; }</script>\n";
echo "<script>qsl('a').onclick = function () { pageClick(this.href, +prompt('" . lang('Page') . "', '" . ($page + 1) . "')); return false; };</script>\n";
echo pagination(0, $page) . ($page > 5 ? " ..." : "");
for ($i = max(1, $page - 4); $i < min($max_page, $page + 5); $i++) {
echo pagination($i, $page);