|
|
|
|
@@ -894,7 +894,7 @@ function drawChart(id,_,series){
|
|
|
|
|
var _notifRows=[];
|
|
|
|
|
var _NOTIF_EVENTS=['started','finished','failed','cancelled','paused','progress'];
|
|
|
|
|
function notifRenderList(entries){
|
|
|
|
|
_notifRows=entries.map(function(e){return {url:e.url||'',events:e.events||[]};});
|
|
|
|
|
_notifRows=entries.map(function(e){return {url:e.url||'',events:e.events||[],include_image:!!e.include_image};});
|
|
|
|
|
notifRefreshDOM();
|
|
|
|
|
}
|
|
|
|
|
function notifRefreshDOM(){
|
|
|
|
|
@@ -912,6 +912,9 @@ function notifRefreshDOM(){
|
|
|
|
|
+'<input type="checkbox" data-notif-idx="'+idx+'" data-notif-ev="'+ev+'" '+checked
|
|
|
|
|
+' onchange="notifToggleEvent('+idx+',\''+ev+'\')" style="width:auto;margin:0"> '+lbl+'</label>';
|
|
|
|
|
}).join(' ');
|
|
|
|
|
var imgCheck='<label style="display:inline-flex;align-items:center;gap:3px;font-size:11px;cursor:pointer;margin-left:4px;padding-left:8px;border-left:1px solid var(--border)" title="'+(T.settings_notif_send_image||'Send image')+'">'
|
|
|
|
|
+'<input type="checkbox" '+(row.include_image?'checked':'')+' onchange="notifToggleImage('+idx+')" style="width:auto;margin:0"> '
|
|
|
|
|
+'📷 '+(T.settings_notif_send_image||'Image')+'</label>';
|
|
|
|
|
return '<div style="background:var(--raised);border-radius:6px;padding:8px;margin-bottom:6px">'
|
|
|
|
|
+'<div style="display:flex;gap:6px;align-items:center;margin-bottom:6px">'
|
|
|
|
|
+'<input type="text" value="'+_escHtml(row.url)+'" placeholder="discord://… telegram://… gotify://…"'
|
|
|
|
|
@@ -919,14 +922,14 @@ function notifRefreshDOM(){
|
|
|
|
|
+'<button onclick="notifTest('+idx+')" style="background:var(--raised2,var(--raised));border:1px solid var(--border);color:var(--txt);border-radius:4px;cursor:pointer;padding:2px 8px;font-size:11px" id="notif-test-btn-'+idx+'">'+(T.settings_notif_test||'Test')+'</button>'
|
|
|
|
|
+'<button onclick="notifRemoveRow('+idx+')" style="background:none;border:none;color:var(--err);cursor:pointer;font-size:16px;line-height:1" title="remove">✕</button>'
|
|
|
|
|
+'</div>'
|
|
|
|
|
+'<div style="display:flex;flex-wrap:wrap;gap:8px">'+evChecks+'</div>'
|
|
|
|
|
+'<div style="display:flex;flex-wrap:wrap;gap:8px;align-items:center">'+evChecks+imgCheck+'</div>'
|
|
|
|
|
+'<div id="notif-test-status-'+idx+'" style="font-size:11px;margin-top:4px"></div>'
|
|
|
|
|
+'</div>';
|
|
|
|
|
}).join('');
|
|
|
|
|
}
|
|
|
|
|
function _escHtml(s){return (s||'').replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"');}
|
|
|
|
|
function notifAddRow(){
|
|
|
|
|
_notifRows.push({url:'',events:['finished','failed']});
|
|
|
|
|
_notifRows.push({url:'',events:['finished','failed'],include_image:false});
|
|
|
|
|
notifRefreshDOM();
|
|
|
|
|
}
|
|
|
|
|
function notifRemoveRow(idx){
|
|
|
|
|
@@ -942,9 +945,12 @@ function notifToggleEvent(idx,ev){
|
|
|
|
|
var pos=evs.indexOf(ev);
|
|
|
|
|
if(pos>=0)evs.splice(pos,1);else evs.push(ev);
|
|
|
|
|
}
|
|
|
|
|
function notifToggleImage(idx){
|
|
|
|
|
if(_notifRows[idx])_notifRows[idx].include_image=!_notifRows[idx].include_image;
|
|
|
|
|
}
|
|
|
|
|
function notifCollect(){
|
|
|
|
|
return _notifRows.filter(function(r){return r.url.trim();}).map(function(r){
|
|
|
|
|
return {url:r.url.trim(),events:r.events};
|
|
|
|
|
return {url:r.url.trim(),events:r.events,include_image:!!r.include_image};
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
function notifTest(idx){
|
|
|
|
|
|