@nullcc/diff2html-cli
Version:
Fast Diff to colorized HTML
64 lines (54 loc) • 2.01 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Diff And Coverage</title>
<!--
Diff to HTML (template.html)
Author: rtfpessoa
-->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.9.0/styles/github.min.css" />
<!--diff2html-css-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.3/jquery.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.9.0/highlight.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.9.0/languages/scala.min.js"></script>
<!--diff2html-js-ui-->
<script>
$(document).ready(function() {
var diff2htmlUi = new Diff2HtmlUI();
//diff2html-fileListCloseable
//diff2html-synchronisedScroll
diff2htmlUi.highlightCode("#diff");
});
function copyToClipboard(textToCopy) {
// navigator clipboard api needs a secure context (https)
if (navigator.clipboard && window.isSecureContext) {
// navigator clipboard api method'
return navigator.clipboard.writeText(textToCopy);
} else {
// text area method
let textArea = document.createElement("textarea");
textArea.value = textToCopy;
// make the textarea out of viewport
textArea.style.position = "fixed";
textArea.style.left = "-999999px";
textArea.style.top = "-999999px";
document.body.appendChild(textArea);
textArea.focus();
textArea.select();
return new Promise((res, rej) => {
// here the magic happens
document.execCommand('copy') ? res() : rej();
textArea.remove();
});
}
}
</script>
</head>
<body style="text-align: center; font-family: 'Source Sans Pro',sans-serif;">
<h1>Coverage For Diff</h1>
<div id="diff">
<!--diff2html-diff-->
</div>
</body>
</html>