Archived
1
0

initial files imported from srndv2

This commit is contained in:
jeff
2015-08-04 10:03:44 -04:00
parent a415b5d7ee
commit d677f96e08
21 changed files with 477 additions and 0 deletions

25
contrib/static/captcha.js Normal file
View File

@@ -0,0 +1,25 @@
//
// sorry I can't think of any better way to do captcha ;~;
//
window.addEventListener('load', function() {
// get new captcha
var ajax = new XMLHttpRequest();
// get form elements for captcha
var elem_input = document.getElementById("captcha_input");
var elem_img = document.getElementById("captcha_img");
// prepare ajax
ajax.onreadystatechange = function(ev) {
if ( ajax.readyState == XMLHttpRequest.DONE && ajax.status == 200 ) {
// we succeeded
var captcha_id = ajax.responseText;
// set captcha id
elem_input.value = captcha_id;
// set captcha image
elem_img.src = "captcha/" + captcha_id + ".png";
}
};
// open and send the ajax request
ajax.open("GET", "captcha/new");
ajax.send();
});

74
contrib/static/mod.js Normal file
View File

@@ -0,0 +1,74 @@
/*
* mod.js, moderator page js stuff
*/
// TODO: implement mod panel all the way
document.onload = function(ev) {
// populate the mod page with stuff
}
function get_longhash(str) {
var idx = str.indexOf("#") + 1;
if ( idx > 0 ) {
str = str.substr(idx);
}
console.log(str);
return str;
}
// handle delete command
function nntpchan_delete() {
// get the element
var input = document.getElementById("nntpchan_mod_delete");
// get the long hash
var longhash = get_longhash(input.value);
// TODO: check long hash
var elem = document.getElementById("nntpchan_mod_result");
// clear old results
while( elem.firstChild ) {
elem.removeChild(elem.firstChild);
}
// fire off ajax
var ajax = new XMLHttpRequest();
ajax.onreadystatechange = function() {
if (ajax.readyState == XMLHttpRequest.DONE) {
var status = ajax.status;
// we gud?
if (status == 200) {
// yah
var txt = ajax.responseText;
var j = JSON.parse(txt);
if (j.error) {
var e = document.createTextNode(j.error);
elem.appendChild(e);
} else {
if ( j.deleted ) {
for ( var idx = 0 ; idx < j.deleted.length ; idx ++ ) {
var deltxt = "deleted " + j.deleted[idx];
var e = document.createTextNode(deltxt);
elem.appendChild(e);
}
}
if ( j.notdeleted ) {
for ( var idx = 0 ; idx < j.notdeleted.length ; idx ++ ) {
var deltxt = "failed to delete " + j.notdeleted[idx];
var e = document.createTextNode(deltxt);
elem.appendChild(e);
}
}
}
} else {
// nah
// http error
elem.innerHTML = "error: HTTP "+status;
}
input.value = "";
}
}
ajax.open("GET", "del/"+longhash);
ajax.send();
}

59
contrib/static/site.css Normal file
View File

@@ -0,0 +1,59 @@
.thread {
margin_right: 20px;
margin_bottom: 5px;
}
.frontend , .subject {
color: #0f0d2d;
}
.name {
color: #117743;
}
.name , .subject {
font-weight: bold;
}
.post {
background: #d6daf0;
padding: 10px;
}
body {
background: #eef2ff;
}
.reply {
margin-left: 1.8em;
display: inline-block;
}
.frontend {
margin-top: 0px;
background: #e0f0f0;
display: inline-block;
}
.op {
background: #eef2ff;
margin-right: 20px;
margin-bottom: 10px;
}
.post, .post_body {
margin-top: 5px;
margin-bottom: 5px;
padding-right: 3em;
padding-bottom: 0.3em;
}
.tripcode {
color: #de04ef;
}
.memearrows {
color: green;
}

0
contrib/static/user.css Normal file
View File