ProfouzorsLinx/static/js/bin.js

52 lines
1.4 KiB
JavaScript
Raw Normal View History

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", "#");
editA.setAttribute("onclick", "edit();return false;");
editA.innerHTML = "edit";
var separator = document.createTextNode(" | ");
navlist.insertBefore(editA, navlist.firstChild);
navlist.insertBefore(separator, navlist.children[1]);
}
function edit() {
navlist.remove();
document.getElementById("filename").remove();
document.getElementById("foarm").style.display = "block";
var normalcontent = document.getElementById("normal-content");
normalcontent.removeChild(document.getElementById("normal-code"));
var editordiv = document.getElementById("editor");
editordiv.style.display = "block";
}
function paste() {
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();
}
function wrap() {
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";
}
}