mirror of
https://github.com/vrana/adminer.git
synced 2025-08-08 07:36:44 +02:00
AdminerSqlGemini: Avoid button jumping
This commit is contained in:
@@ -44,17 +44,24 @@ class AdminerSqlGemini {
|
||||
|
||||
function sqlPrintAfter() {
|
||||
echo "<p><textarea name='gemini' rows='5' cols='50' title='AI prompt'>" . Adminer\h($_POST["gemini"]) . "</textarea>\n";
|
||||
echo "<p><input type='button' value='Gemini'>" . Adminer\script("qsl('input').onclick = function () { ajax(
|
||||
?>
|
||||
<p><input type='button' value='Gemini'>
|
||||
<script <?php echo Adminer\nonce(); ?>>
|
||||
function setSqlareaValue(value) {
|
||||
qs('textarea.sqlarea').value = value;
|
||||
qs('pre.sqlarea').textContent = value;
|
||||
qs('pre.sqlarea').oninput(); // syntax highlighting
|
||||
}
|
||||
|
||||
qsl('input').onclick = function () {
|
||||
setSqlareaValue('-- Just a sec...'); // this is the phrase used by Google Gemini
|
||||
ajax(
|
||||
'',
|
||||
req => {
|
||||
qs('textarea.sqlarea').value = req.responseText;
|
||||
const sqlarea = qs('pre.sqlarea');
|
||||
sqlarea.textContent = req.responseText;
|
||||
sqlarea.oninput(); // syntax highlighting
|
||||
alterClass(qs('#ajaxstatus'), 'hidden', true);
|
||||
},
|
||||
'gemini=' + encodeURIComponent(this.form['gemini'].value),
|
||||
'Just a sec…' // this is the phrase used by Google Gemini
|
||||
); }");
|
||||
req => setSqlareaValue(req.responseText),
|
||||
'gemini=' + encodeURIComponent(this.form['gemini'].value)
|
||||
);
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user