mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-26 23:13:00 +02:00
Origin commit data
------------------
Branch: ni/coolstream
Commit: 17851cffc0
Author: vanhofen <vanhofen@gmx.de>
Date: 2023-03-07 (Tue, 07 Mar 2023)
Origin message was:
------------------
- yWeb: add configurable screenshot timeout
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
178 lines
5.3 KiB
Plaintext
178 lines
5.3 KiB
Plaintext
{=var-set:grab={=find-exec:grab=}=}
|
|
{=var-set:fbshot={=find-exec:fbshot=}=}
|
|
|
|
{=include-block:Y_Blocks.txt;head=}
|
|
{=include-block:Y_Blocks.txt;js_jquery=}
|
|
{=include-block:Y_Blocks.txt;js_jquery_ui=}
|
|
<script src="/Y_Baselib.js"></script>
|
|
<script>
|
|
var enableOSD;
|
|
var enableVideo;
|
|
var enablePiP;
|
|
var interval;
|
|
|
|
function checkEnable() {
|
|
enableOSD = (id('checkOSD').checked == true) ? 1 : 0;
|
|
enableVideo = (id('checkVideo').checked == true) ? 1 : 0;
|
|
{=if-empty:{=var-get:grab=}~
|
|
enablePiP = 0;
|
|
~
|
|
enablePiP = (id('checkPiP').checked == true) ? 1 : 0;
|
|
=}
|
|
|
|
if (enableOSD == 0 && enableVideo == 0) {
|
|
alert("{=L:bc.screenshot.checkenable=}");
|
|
return false;
|
|
}
|
|
if (enableVideo == 0 && enablePiP == 1) {
|
|
alert(unescape("{=L:bc.screenshot.checkpip=}"));
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
function rcsim(_key) {
|
|
if (!checkEnable()) return;
|
|
|
|
if(_key == "KEY_POWER"){
|
|
var __result = trim(loadSyncURL("/control/standby"));
|
|
if (__result == "off") {
|
|
if (confirm("{=L:bc.control.shutdown.ask=}") != true)
|
|
return;
|
|
}
|
|
}
|
|
loadSyncURL("/control/rcem?" + _key);
|
|
window.setTimeout("do_snapshot()", 750);
|
|
}
|
|
|
|
function do_snapshot() {
|
|
if (!checkEnable()) return;
|
|
|
|
jQuery('#shot').hide();
|
|
jQuery('#shot').attr("src", "");
|
|
jQuery('#buttons').hide();
|
|
jQuery('#status').show();
|
|
|
|
var filename = "screenshot";
|
|
if (id('filename').value != "") {
|
|
filename = id("filename").value;
|
|
}
|
|
|
|
if ("{=var-get:grab=}" != "")
|
|
{
|
|
var pip_opts = "";
|
|
if (enableVideo == 1 && enablePiP == 1)
|
|
pip_opts = "-x 1 ";
|
|
|
|
if (enableOSD == 1 && enableVideo == 1)
|
|
stb_exec_tools("fbshot grab -q -p "+pip_opts+"/tmp/"+filename+".png");
|
|
else if (enableVideo == 1)
|
|
stb_exec_tools("fbshot grab -q -p -v "+pip_opts+"/tmp/"+filename+".png");
|
|
else if (enableOSD == 1)
|
|
stb_exec_tools("fbshot grab -q -p -o /tmp/"+filename+".png");
|
|
}
|
|
else if ("{=var-get:fbshot=}" != "" && enableVideo == 0)
|
|
stb_exec_tools("fbshot fbshot /tmp/"+filename+".png");
|
|
else
|
|
loadSyncURL("/control/screenshot?name="+filename+"&osd="+enableOSD+"&video="+enableVideo);
|
|
|
|
do_showshot(filename);
|
|
}
|
|
|
|
function do_showshot(_filename) {
|
|
if (_filename == "")
|
|
_filename = "screenshot";
|
|
|
|
jQuery('#status').hide();
|
|
jQuery('#buttons').show();
|
|
jQuery('#shot').attr("src", "/tmp/"+_filename+".png?" + Math.random());
|
|
jQuery('#shot').show();
|
|
}
|
|
|
|
function do_clearshot() {
|
|
jQuery('#shot').hide();
|
|
jQuery('#shot').attr("src", "");
|
|
|
|
loadSyncURL("/control/exec?Y_Tools&screenshot_clear");
|
|
}
|
|
|
|
function do_switchrc() {
|
|
jQuery('#remote').toggle('slide', {direction: 'left'}, 'slow', function() {
|
|
do_switchrc_txt();
|
|
});
|
|
}
|
|
|
|
function do_switchrc_txt(){
|
|
if (id('remote').style.display == 'none')
|
|
jQuery('#switchrc').text("{=L:bc.control.remote=} {=L:show=}");
|
|
else
|
|
jQuery('#switchrc').text("{=L:bc.control.remote=} {=L:hide=}");
|
|
}
|
|
|
|
function do_reload(){
|
|
if (id('checkReload').checked)
|
|
interval = setInterval(do_snapshot, id('inputReload').value + "000");
|
|
else
|
|
clearInterval(interval);
|
|
}
|
|
</script>
|
|
{=include-block:Y_Blocks.txt;head_close=}
|
|
<body onload="do_switchrc_txt(); do_snapshot();">
|
|
<div class="work_box" id="work_box">
|
|
<div class="work_box_head"><div class="work_box_head_h2">
|
|
{=var-set:menu={=L:bc.menue.screenshot=}=}{=include-block:Y_Blocks.txt;work_menu=}</div></div>
|
|
<div class="work_box_body">
|
|
<div id="screenshot_header">
|
|
<div id="buttons" style="display: block">
|
|
<div class="left">
|
|
<button name="snapshot" ytype="snapshot" onclick="do_snapshot()">{=L:bc.screenshot.create=}</button>
|
|
<button name="clearshot" ytype="clearshot" onclick="do_clearshot()">{=L:bc.screenshot.delete=}</button>
|
|
<button name="switchrc" ytype="switchrc" onclick="do_switchrc()" id="switchrc">{=L:bc.control.remote=}</button>
|
|
</div>
|
|
<div class="right">
|
|
<form onsubmit="do_snapshot(); return false">
|
|
{=L:filename=}: <input type="text" value="screenshot" id="filename" size="10" />
|
|
OSD: <input id="checkOSD" name="checkOSD" type="checkbox" {=if-empty:{=osd=}~~checked="checked"=} />
|
|
TV: <input id="checkVideo" name="checkVideo" type="checkbox" {=if-empty:{=video=}~~checked="checked"=} />
|
|
{=if-empty:{=var-get:grab=}~~
|
|
PiP: <input id="checkPiP" name="checkPiP" type="checkbox" {=if-empty:{=pip=}~~checked="checked"=} />
|
|
=}
|
|
</form>
|
|
</div>
|
|
<div class="clear"></div>
|
|
<div class="right">
|
|
Reload: <input type="number" value="{=ini-get:%(CONFIGDIR)/yWeb.conf;screenshot_timeout;15=}" id="inputReload" min="1" max="180" title="{=L:bc.screenshot.reload_desc=}" disabled /> <input id="checkReload" name="checkReload" type="checkbox" />
|
|
</div>
|
|
<div class="clear"></div>
|
|
</div>
|
|
<div id="status" style="display: none">
|
|
<img src="/images/wait.gif" alt="{=L:bc.screenshot.wait_text=}"/>
|
|
{=L:bc.screenshot.wait_text=}
|
|
</div>
|
|
</div>
|
|
<table cellpadding="0" class="screenshot">
|
|
<tr>
|
|
<td id="remote" {=if-equal:{=rc=}~false~style="display: none"~=}>
|
|
{=include-block:Y_Blocks.txt;remote=}
|
|
</td>
|
|
<td class="shot">
|
|
<img id="shot" src="" onclick="do_switchrc()" style="display: none" />
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
id('checkReload').onclick = function() {
|
|
if (this.checked ) {
|
|
interval = setInterval(do_snapshot, id("inputReload").value + "000");
|
|
id("inputReload").disabled = false;
|
|
} else {
|
|
clearInterval(interval);
|
|
id("inputReload").disabled = true;
|
|
}
|
|
};
|
|
</script>
|
|
</body>
|
|
</html>
|