Commit 881c9ace authored by Michael Murtaugh's avatar Michael Murtaugh

timestamp + author shown

parent a9de6906
......@@ -48,6 +48,7 @@
<ul id="sources">
<li><a id="use" href="test.etherpad.json">test</a></li>
<li><a href="constantcodeofconduct2.etherpad.json">constantcodeofconduct2</a></li>
<li><a href="multi.etherpad">multi</a></li>
</ul>
<span id="info"><span id="rev">&mdash;</span> / <span id="total_revs">&mdash;</span></span>
<button id="prev">&larr;</button>
......@@ -60,7 +61,7 @@
<div id="content_raw" class="toggle_body"></div>
</div>
<div class="toggle">
<h3 class="toggle_trigger">diff</h3>
<h3 class="toggle_trigger">general</h3>
<div id="content_summary" class="toggle_body"></div>
</div>
<div class="toggle">
......@@ -86,6 +87,24 @@ let content_raw = document.getElementById("content_raw"),
current_rev = 0,
pad;
function changeset_summary_html (cs) {
var ret = document.createElement("div"),
diff = document.createElement('div'),
date = document.createElement('div'),
time = document.createElement("div"),
author = document.createElement("div"),
ts = new Date(cs.meta.timestamp);
diff.textContent = "source length: " + cs.source_length + ", change: " + (cs.final_op == ">" ? "+" : "-") + cs.final_diff;
ret.appendChild(diff);
date.textContent = ts.toDateString();
ret.appendChild(date);
time.textContent = ts.toTimeString();
ret.appendChild(time);
author.textContent = cs.meta.author;
ret.appendChild(author);
return ret;
}
function htmlify_changeset_op (op) {
var ret = document.createElement("div"),
opstr = document.createElement('span'),
......@@ -107,11 +126,13 @@ function htmlify_changeset_op (op) {
ret.appendChild(raw);
return ret;
}
function show_changeset (n) {
rev.innerHTML = n;
let cs = pad.changesets[n];
content_raw.textContent = cs.raw;
content_summary.textContent = "source length: " + cs.source_length + ", change: " + (cs.final_op == ">" ? "+" : "-") + cs.final_diff;
content_summary.innerHTML = "";
content_summary.appendChild(changeset_summary_html(cs));
content_ops.innerHTML = "";
for (var i=0, l=cs.ops.length; i<l; i++) {
content_ops.appendChild(htmlify_changeset_op(cs.ops[i]));
......
......@@ -93,8 +93,11 @@ var etherpad = (function (exports) {
// console.log("loaded");
// last_rev = 10;
for (let r = 0; r<=last_rev; r++) {
let d = data[`pad:${this.padname}:revs:${r}`];
this.changesets.push(changeset_parse(d.changeset));
let d = data[`pad:${this.padname}:revs:${r}`],
cs = changeset_parse(d.changeset);
// meta.author + meta.timestamp
cs.meta = d.meta;
this.changesets.push(cs);
}
// console.log("SAME", (this.text == pad_data.atext.text));
// console.log("done", last_rev)
......
......@@ -90,8 +90,11 @@ export class Etherpad {
// console.log("loaded");
// last_rev = 10;
for (let r = 0; r<=last_rev; r++) {
let d = data[`pad:${this.padname}:revs:${r}`];
this.changesets.push(changeset_parse(d.changeset))
let d = data[`pad:${this.padname}:revs:${r}`],
cs = changeset_parse(d.changeset);
// meta.author + meta.timestamp
cs.meta = d.meta;
this.changesets.push(cs)
}
// console.log("SAME", (this.text == pad_data.atext.text));
// console.log("done", last_rev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment