2015-10-05 03:42:56 +02:00
|
|
|
// @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-v3-or-Later
|
|
|
|
|
2015-09-30 18:06:23 +02:00
|
|
|
var navlist = document.getElementById("info").getElementsByClassName("right")[0];
|
|
|
|
|
|
|
|
init();
|
|
|
|
|
|
|
|
function init() {
|
|
|
|
var editA = document.createElement('a');
|
|
|
|
|
|
|
|
editA.setAttribute("href", "#");
|
2015-10-04 09:14:21 +02:00
|
|
|
editA.addEventListener('click', function(ev) {
|
2015-10-04 23:13:29 +02:00
|
|
|
edit(ev);
|
2015-10-04 09:14:21 +02:00
|
|
|
return false;
|
|
|
|
});
|
2015-09-30 18:06:23 +02:00
|
|
|
editA.innerHTML = "edit";
|
|
|
|
|
|
|
|
var separator = document.createTextNode(" | ");
|
|
|
|
navlist.insertBefore(editA, navlist.firstChild);
|
|
|
|
navlist.insertBefore(separator, navlist.children[1]);
|
|
|
|
|
2015-10-04 23:13:29 +02:00
|
|
|
document.getElementById('save').addEventListener('click', paste);
|
|
|
|
document.getElementById('wordwrap').addEventListener('click', wrap);
|
2015-09-30 18:06:23 +02:00
|
|
|
}
|
|
|
|
|
2015-10-04 23:13:29 +02:00
|
|
|
function edit(ev) {
|
2015-10-10 07:20:17 +02:00
|
|
|
ev.preventDefault();
|
2015-09-30 18:06:23 +02:00
|
|
|
|
|
|
|
navlist.remove();
|
|
|
|
document.getElementById("filename").remove();
|
2015-10-04 23:13:29 +02:00
|
|
|
document.getElementById("editform").style.display = "block";
|
2015-09-30 18:06:23 +02:00
|
|
|
|
|
|
|
var normalcontent = document.getElementById("normal-content");
|
|
|
|
normalcontent.removeChild(document.getElementById("normal-code"));
|
2015-10-04 08:58:56 +02:00
|
|
|
|
2015-09-30 18:06:23 +02:00
|
|
|
var editordiv = document.getElementById("editor");
|
|
|
|
editordiv.style.display = "block";
|
2015-10-10 07:20:17 +02:00
|
|
|
editordiv.addEventListener('keydown', handleTab);
|
2015-09-30 18:06:23 +02:00
|
|
|
}
|
|
|
|
|
2015-10-04 23:13:29 +02:00
|
|
|
function paste(ev) {
|
2015-10-04 23:27:47 +02:00
|
|
|
var editordiv = document.getElementById("editor");
|
|
|
|
document.getElementById("newcontent").value = editordiv.value;
|
2015-09-30 18:06:23 +02:00
|
|
|
document.forms["reply"].submit();
|
|
|
|
}
|
|
|
|
|
2015-10-04 23:13:29 +02:00
|
|
|
function wrap(ev) {
|
2015-09-30 18:06:23 +02:00
|
|
|
if (document.getElementById("wordwrap").checked) {
|
|
|
|
document.getElementById("codeb").style.wordWrap = "break-word";
|
|
|
|
document.getElementById("codeb").style.whiteSpace = "pre-wrap";
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
document.getElementById("codeb").style.wordWrap = "normal";
|
|
|
|
document.getElementById("codeb").style.whiteSpace = "pre";
|
|
|
|
}
|
|
|
|
}
|
2015-10-05 03:42:56 +02:00
|
|
|
|
|
|
|
// @license-end
|