mirror of
https://github.com/TeamNewPipe/CrashReportToMarkdown
synced 2024-12-04 07:25:18 +00:00
169 lines
5.5 KiB
HTML
169 lines
5.5 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>Error Report to Markdown reporter</title>
|
|
<link rel="icon" href="icons/report_problem-black-192dp.svg">
|
|
<style>
|
|
html, body {
|
|
font-family: Roboto, Arial, sans-serif;
|
|
margin: 0;
|
|
padding: 15px;
|
|
background: #f3eff2;
|
|
color: #070000;
|
|
}
|
|
button {
|
|
display: inline-block;
|
|
background: #4d4d4d;
|
|
color: #fff;
|
|
border: 0;
|
|
border-radius: 4px;
|
|
padding: 10px 15px;
|
|
margin: 0 10px 15px 0;
|
|
}
|
|
button:hover,
|
|
button:focus,
|
|
button:active {
|
|
background: #3d3d3d;
|
|
}
|
|
div + button {
|
|
margin-top: 15px;
|
|
}
|
|
div {
|
|
display: flex;
|
|
}
|
|
textarea {
|
|
max-width: 100%;
|
|
border: 0;
|
|
background: white;
|
|
padding: 10px;
|
|
overflow: auto;
|
|
color: #898989;
|
|
font-size: 1.2em;
|
|
}
|
|
textarea.placeholder {
|
|
height: 1.3em;
|
|
}
|
|
textarea::placeholder {
|
|
font-size: 1em;
|
|
line-height: 1em;
|
|
color: #898989;
|
|
}
|
|
#clipboard-message {
|
|
display: block;
|
|
position: fixed;
|
|
text-align: center;
|
|
padding: 30px;
|
|
width: 50%;
|
|
bottom: 30px;
|
|
left: calc(25% - 30px);
|
|
border-radius: 5px;
|
|
background: #4d4d4d;
|
|
color: white;
|
|
opacity: 0;
|
|
transition: opacity 1s ease-in-out;
|
|
}
|
|
#clipboard-message.visible {
|
|
opacity: 1;
|
|
}
|
|
a button {
|
|
text-decoration: none;
|
|
color: #fff;
|
|
display: inline-block;
|
|
}
|
|
@media (min-width: 320px) and (max-width: 480px) {
|
|
textarea.placeholder {
|
|
height: 3.5em;
|
|
}
|
|
html, body {
|
|
padding: 0px 15px;
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h1>The incredible NPE to Markdown converter</h1>
|
|
<h3>Paste the JSON bugreport here</h3>
|
|
<div><textarea rows="1" cols="150" id="input" class="placeholder" placeholder="Paste the JSON bugreport here" onchange="onResize(this)" onkeyup="onResize(this)"></textarea></div>
|
|
<button onClick="onTransform()">transform</button>
|
|
<div><textarea rows="1" cols="150" id="output" class="placeholder" placeholder="Click transform and your human readable bugreport will appear here."></textarea></div>
|
|
<h3>Paste it into your Github issue</h3>
|
|
<button onClick="onCopy()">copy to clipboard</button>
|
|
<form style="display:inline;" action="https://github.com/TeamNewPipe/NewPipe/issues/new?assignees=&labels=bug&template=bug_report.md" method="get">
|
|
<button>new issue</button>
|
|
</form>
|
|
<span id="clipboard-message">Copied to clipboard!</span>
|
|
|
|
<script>
|
|
|
|
function onTransform() {
|
|
input = document.getElementById("input");
|
|
output = document.getElementById("output");
|
|
|
|
try {
|
|
report = JSON.parse(input.value);
|
|
} catch (e) {
|
|
var msg = "Cannot convert bug report to Markdown:\n\n";
|
|
if (e instanceof SyntaxError) {
|
|
alert(msg + "Failed to parse JSON due to syntax error:\n" + e.message);
|
|
} else {
|
|
alert(msg + "Unknown error occurred:\n" + e.name + ": " + e.message)
|
|
}
|
|
return;
|
|
}
|
|
|
|
output.value = "";
|
|
|
|
output.value += "## Exception";
|
|
output.value += "\n* __User Action:__ " + report.user_action;
|
|
output.value += "\n* __Request:__ " + report.request;
|
|
output.value += "\n* __Content Language:__ " + report.content_language;
|
|
output.value += "\n* __Service:__ " + report.service;
|
|
output.value += "\n* __Version:__ " + report.version;
|
|
output.value += "\n* __OS:__ " + report.os;
|
|
|
|
output.value += "\n" + report.user_comment + "\n";
|
|
|
|
output.value += "\n<details><summary><b>Crash log</b></summary><p>\n";
|
|
output.value += "\n```\n";
|
|
report.exceptions.forEach(function(exception, index) {
|
|
output.value += exception;
|
|
if (index !== report.exceptions.length - 1) output.value += "\n-------------------\n\n";
|
|
});
|
|
|
|
output.value += "\n```\n";
|
|
output.value += "</p></details>\n";
|
|
output.value += "<hr>\n";
|
|
onResize(output);
|
|
}
|
|
|
|
function onCopy() {
|
|
output = document.getElementById("output");
|
|
if (output.value === "") return;
|
|
output.select();
|
|
document.execCommand("copy");
|
|
output.blur();
|
|
var clipboardMsg = document.getElementById("clipboard-message");
|
|
clipboardMsg.classList.add("visible");
|
|
setTimeout(function () {
|
|
clipboardMsg.classList.remove("visible");
|
|
}, 4000);
|
|
}
|
|
|
|
function onResize(el) {
|
|
lines = el.value.split('\n');
|
|
el.rows = lines.length < 20 ? ""+lines.length+"" : '20';
|
|
if (lines.length === 1) el.classList.add("placeholder");
|
|
else el.classList.remove("placeholder");
|
|
}
|
|
</script>
|
|
|
|
<noscript>
|
|
<p>
|
|
Please enable javascript, otherwise you won't be able to convert the crash report. You can see its (little) code <a href="https://github.com/TeamNewPipe/CrashReportToMarkdown">here</a>.
|
|
</p>
|
|
</noscript>
|
|
</body>
|
|
</html>
|