JSFiddle - React, Tailwind, and code Playground
by daybarr
JavaScript
function function2(id1) {
document.getElementById(id1).style.top = document.body.scrollTop;
}
function showm(id1) {
window.onscroll = function2(id1);
document.getElementById(id1).style.display = "block";
document.getElementById(id1).style.top = document.body.scrollTop;
}
function hideModal(id1) {
document.getElementById(id1).style.display = "none";
}
function getXMLHttp() {
var XMLHttp = null;
if (window.XMLHttpRequest) {
try {
XMLHttp = new XMLHttpRequest();
}
catch (e1) {}
}
else if (window.ActiveXObject) {
try {
XMLHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e2) {}
}
return XMLHttp;
}
function delete_f(file) {
var r = new getXMLHttp();
r.open("POST", "index.php");
r.onreadystatechange = function() {
if (r.readyState == 4) {
if (r.responseText == 'd') {
alert("file deleted!");
} else {
alert(r.responseText);
}
}
};
r.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
r.send("action=delete&file=" + file);
document.getElementById(file).style.display = "none";
}
function save(file, name, txt) {
var r2 = new getXMLHttp();
r2.open("POST", 'index.php');
r2.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
r2.onreadystatechange = function() {
if (r2.readyState == 4) {
if (r2.responseText == 'd') {
done = true;
}
}
};
var sendstr = "action=edit&file=" + file + "&name=" + name + "&text=" + text;
r2.send(sendstr);
if (!done) {
alert("could not be saved!");
}
hideModal('edit');
}
function edit(file) {
var r = new getXMLHttp();
r.open("POST", 'index.php');
r.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
r.onreadystatechange = function() {
if...