80 |
</section> |
</section> |
81 |
|
|
82 |
<menu><a href="javascript:togglePanel ()" class=editor-only>Panel</a> |
<menu><a href="javascript:togglePanel ()" class=editor-only>Panel</a> |
83 |
|
<a href="javascript:savePNG ()" class=editor-only>PNGize</a> |
84 |
<a href="client.html?mode=editor" id=edit-link rel=edit class=viewer-only>Edit</a> |
<a href="client.html?mode=editor" id=edit-link rel=edit class=viewer-only>Edit</a> |
85 |
<a href="client.html?mode=viewer" id=view-link class=editor-only>View</a> |
<a href="client.html?mode=viewer" id=view-link class=editor-only>View</a> |
86 |
<a href="server.cgi?mode=list" rel=index>List</a> |
<a href="server.cgi?mode=list" rel=index>List</a> |
87 |
<a href="server.cgi?mode=prev" id=prev-link rel=prev>Prev</a> |
<a href="server.cgi?mode=prev" id=prev-link rel=prev>Prev</a> |
88 |
<a href="server.cgi?mode=next" id=next-link rel=next>Next</a> |
<a href="server.cgi?mode=next" id=next-link rel=next>Next</a> |
89 |
|
<a href="client.html?mode=editor" id=clone-link>Clone</a> |
90 |
<a href="client.html?mode=editor">New</a></menu> |
<a href="client.html?mode=editor">New</a></menu> |
91 |
|
|
92 |
<script> |
<script> |
112 |
$('view-link').href += ';date=' + date; |
$('view-link').href += ';date=' + date; |
113 |
$('prev-link').href += ';date=' + date; |
$('prev-link').href += ';date=' + date; |
114 |
$('next-link').href += ';date=' + date; |
$('next-link').href += ';date=' + date; |
115 |
|
$('clone-link').href += ';import-date=' + date; |
116 |
|
|
117 |
param.mode = param.mode || 'editor'; |
param.mode = param.mode || 'editor'; |
118 |
document.body.className = 'mode-' + param.mode; |
document.body.className = 'mode-' + param.mode; |
119 |
|
|
120 |
|
var newEvents = []; |
121 |
|
|
122 |
|
if (param['import-date']) { |
123 |
|
newEvents = readRemoteImage ('server.cgi?date=' + param['import-date']); |
124 |
|
} |
125 |
|
|
126 |
if (param.mode == 'viewer') { |
if (param.mode == 'viewer') { |
127 |
readRemoteImage (); |
readRemoteImage (); |
128 |
setInterval (readRemoteImage, 2000); |
setInterval (readRemoteImage, 2000); |
155 |
drawing = false; |
drawing = false; |
156 |
}; |
}; |
157 |
|
|
|
var newEvents = []; |
|
158 |
function write () { |
function write () { |
159 |
newEvents.push (Array.prototype.join.call (arguments, ',')); |
newEvents.push (Array.prototype.join.call (arguments, ',')); |
160 |
} |
} |
176 |
write (n, v); |
write (n, v); |
177 |
} |
} |
178 |
|
|
179 |
function readRemoteImage () { |
function readRemoteImage (u) { |
180 |
|
u = u || url; |
181 |
var xhr = new XMLHttpRequest (); |
var xhr = new XMLHttpRequest (); |
182 |
xhr.open ('GET', url, false); |
xhr.open ('GET', u, false); |
183 |
xhr.setRequestHeader ('Cache-Control', 'no-cache'); |
xhr.setRequestHeader ('Cache-Control', 'no-cache'); |
184 |
xhr.send (null); |
xhr.send (null); |
185 |
if (xhr.responseText) { |
if (xhr.responseText) { |
188 |
canvas.width = canvas.width; // clear |
canvas.width = canvas.width; // clear |
189 |
processEvents(events); |
processEvents(events); |
190 |
} |
} |
191 |
|
return events; |
192 |
} |
} |
193 |
|
return []; |
194 |
} |
} |
195 |
|
|
196 |
function processEvents (events) { |
function processEvents (events) { |
223 |
$('panel').setAttribute ('hidden', ''); |
$('panel').setAttribute ('hidden', ''); |
224 |
} |
} |
225 |
} |
} |
226 |
|
|
227 |
|
function savePNG () { |
228 |
|
var data = canvas.toDataURL ('image/png'); |
229 |
|
var xhr = new XMLHttpRequest (); |
230 |
|
xhr.open ('POST', url + ';mode=png', false); |
231 |
|
xhr.setRequestHeader ('Content-Type', 'text/plain'); |
232 |
|
xhr.send (data); |
233 |
|
// if (xhr.status == 201) { |
234 |
|
// location.href = xhr.getResponseHeader ('Location'); |
235 |
|
// } |
236 |
|
} |
237 |
</script> |
</script> |