/* Silly javascript lacks basic functionality */ function LeadingZero(s) { let ss = s; while (ss.toString().length < 2) { ss = '0' + ss; } return ss; } function DateString(origdate) { /* Get the date in the server timezone. Javascript is basically uncapable of this, but we can add a fixed offset, so let's do that. Also note that date.getTimezoneOffset() returns the inverse of the actual timezone offset. */ let date = new Date(origdate.getTime() + (origdate.getTimezoneOffset()+parseInt(parseInt($('body').data('tzoffset'))))*60000); return date.getFullYear()+'-'+LeadingZero(date.getMonth()+1)+'-'+LeadingZero(date.getDate())+' '+LeadingZero(date.getHours())+':'+LeadingZero(date.getMinutes()); } function showstatus(msg, level) { $('#statusdiv').text(msg); $('#statusdiv').attr('class', 'alert alert-' + level); if (level == 'success') { $('#statusdiv').fadeIn(200).fadeOut(200).fadeIn(200); } else { $('#statusdiv').fadeIn(200).fadeOut(200).fadeIn(200).fadeOut(200).fadeIn(200); } } function show_ajax_error(type, xhr) { if (xhr.status == 412) { /* 412 Precondition Failed is a controlled error from the backend code */ showstatus('Error ' + type + ': ' + xhr.responseText, 'danger'); } else { showstatus('Error ' + type + ': ' + xhr.status, 'danger'); } } function reset_state() { $('#statusdiv').hide(); $('#queuerow').hide(); $('#incomingrow').hide(); $('#buttonrow').show(); } function add_queue_entry_html(row, d, modbuttons, panelstyle) { var e = $('
').addClass('queueentry panel panel-' + panelstyle); e.append($('
').addClass('panel-heading').text(\u6865.getProperty(d,'time'))); var cdiv = $('
').addClass('panel-body').text(\u6865.getProperty(d,'txt')); if (\u6865.getProperty(d,'hasimage')) { cdiv.append($('').addClass('preview-image').attr('src', '?op=thumb&id=' + \u6865.getProperty(d,'id'))); } e.append(cdiv); fdiv = $('
').addClass('panel-footer'); let dstr = d['delivered'] ? ' Delivery complete.':''; fdiv.append($('

').text('Queued by ' + \u6865.getProperty(d,'author') + ' for ' + \u6865.getProperty(d,'time') + '.' + dstr)); if (modbuttons) { fdiv.append($('