mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Copy Log to Clipboard
This commit is contained in:
parent
545b33b647
commit
018651f099
@ -169,12 +169,24 @@ $(document).ready(function() {
|
|||||||
messages = (event.response.result.messages);
|
messages = (event.response.result.messages);
|
||||||
if(messages.length != 0 && !createdCont)
|
if(messages.length != 0 && !createdCont)
|
||||||
{
|
{
|
||||||
$('#log_content').html('<pre><div id="logmessages" style="overflow:scroll;max-height:400px"></div></pre><button class="btn btn-primary" id="btn_autoscroll"><i class="fa fa-long-arrow-down fa-fw"></i>'+$.i18n('conf_logging_btn_autoscroll')+'</button>');
|
$('#log_content').html('\
|
||||||
|
<pre><div id="logmessages" style="overflow:scroll;max-height:400px"></div></pre>\
|
||||||
|
<button class="btn btn-danger" id="btn_autoscroll"><i class="fa fa-long-arrow-down fa-fw"></i>'+$.i18n('conf_logging_btn_autoscroll')+'</button>\
|
||||||
|
<button class="btn btn-primary" id="btn_clipboard"><i class="fa fa-clipboard fa-fw"></i>Copy Log to Clipboard</button>');
|
||||||
createdCont = true;
|
createdCont = true;
|
||||||
|
|
||||||
$('#btn_autoscroll').off().on('click',function() {
|
$('#btn_autoscroll').off().on('click',function() {
|
||||||
toggleClass('#btn_autoscroll', "btn-success", "btn-danger");
|
toggleClass('#btn_autoscroll', "btn-success", "btn-danger");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#btn_clipboard').off().on('click',function() {
|
||||||
|
const temp = document.createElement('textarea');
|
||||||
|
temp.textContent = document.getElementById("logmessages").textContent;
|
||||||
|
document.body.append(temp);
|
||||||
|
temp.select();
|
||||||
|
document.execCommand("copy");
|
||||||
|
temp.remove();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
for(var idx = 0; idx < messages.length; idx++)
|
for(var idx = 0; idx < messages.length; idx++)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user