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

View File

@ -0,0 +1,34 @@
<html>
<head>
<meta charset="utf-8" />
<script type="text/javascript" src="{{board.Prefix}}static/captcha.js"></script>
<link rel="stylesheet" href="{{board.Prefix}}static/site.css"></link>
<title>{{board.Board}}</title>
</head>
<body>
<!-- begin header -->
{{{board.RenderNavbar}}}
<!-- end header -->
<!-- postform -->
<div id="postform_container">
{{{form}}}
</div>
<hr />
<div id="threads_container">
{{#board.Threads}}
<div class="thread" id="thread_{{OP.PostHash}}">
<div clsss="thread_header">
</div>
{{{OP.RenderPost}}}
{{#Replies}}
{{{RenderPost}}}
<br />
{{/Replies}}
</div>
<br/>
<hr/>
{{/board.Threads}}
</div>
</body>
</html>

View File

@ -0,0 +1,12 @@
<html>
<head>
<meta charset="utf-8"></meta>
<link rel="stylesheet" href="{{prefix}}static/site.css"></link>
<title> here is a new tripcode </title>
</head>
<body>
<pre>New Tripcode:
<div id="secret_key">secret: {{secret}}</div><div id="public_key">public: {{public}}</div><div>tripcode: <span class="tripcode" id="capcode_key">{{{tripcode}}}</span></div>
</pre>
</body>
</html>

View File

@ -0,0 +1,13 @@
<html>
<head>
<link ref="stylesheet" href="{{prefix}}static/site.css"></link>
<title>login</title>
</head>
<body>
<form action="login" method="POST" name="modlogin">
<label for="mod_key">secret</label>
<input type="password" id="mod_key" name="privkey" />
<input type="submit" value="login" />
</form>
</body>
</html>

View File

@ -0,0 +1,10 @@
<html>
<head>
<link ref="stylesheet" href="{{prefix}}static/site.css"></link>
<meta http-equiv="refresh" content="1; {{mod_prefix}}"></meta>
<title>login</title>
</head>
<body>
<p>{{message}}</p>
</body>
</html>

View File

@ -0,0 +1,23 @@
<html>
<head>
<link rel="stylesheet" href="{{prefix}}static/site.css"></link>
<!-- yes it uses js -->
<script type="text/javascript" src="{{prefix}}static/mod.js"></script>
<title> nntpchan mod page </title>
</head>
<body>
<div>
<div> post actions </div>
<hr />
<div>
<label for="nntpchan_mod_delete">delete by url</label>
<input id="nntpchan_mod_delete" type="text" />
</div>
<button id="nntpchan_mod" onclick="nntpchan_delete()">go</button>
<span id="nntpchan_mod_result"></span>
</div>
<noscript>
<b>enable js to use the mod panel kthx</b>
</noscript>
</body>
</html>

View File

@ -0,0 +1,7 @@
<hr />
<div>
<span class="board_title">{{{board.Name}}}</span>
on
<span class="frontend_title">{{{board.Frontend}}}</span>
</div>
<hr />

View File

View File

@ -0,0 +1,37 @@
<div class="{{{CSSClass}}}" id="post_{{PostHash}}">
<p class="intro">
<label for="delete_{{PostHash}}">
<span class="subject">
{{Subject}}
</span>
<span class="name">
{{#Sage}}
<a href="mailto:sage">
{{Name}}
</a>
{{/Sage}}
{{^Sage}}
{{Name}}
{{/Sage}}
</span>
<span class="postdate">
{{Date}}
</span>
</label>
<a href="{{PostURL}}" onclick="">No. {{ShortHash}}</a>
{{#OP}}
<a href="{{PostURL}}">[reply]</a>
{{/OP}}
</p>
<p class="frontend">
[[ {{Frontend}} ]]
</p>
<div class="files">
{{#Attachments}}
<a class="file" href="{{Source}}" title="{{Filename}}">
<img class="file-thumbnail" src="{{Thumbnail}}" alt="{{Filename}}" />
</a>
{{/Attachments}}
</div>
<div class="post_body">{{{RenderBody}}}</div>
</div>

View File

@ -0,0 +1,6 @@
<html>
<meta http-equiv="refresh" content="1; {{redirect_url}}" />
<body>
<p>post failed: {{reason}}</p>
</body>
</html>

View File

@ -0,0 +1,6 @@
<html>
<meta http-equiv="refresh" content="5; {{{redirect_url}}}" />
<body>
<pre>posted as {{message_id}}</pre>
</body>
</html>

View File

@ -0,0 +1,64 @@
{{!
postform.mustache
template parameters:
- post_url ( the url of the post form )
- reference ( the post we are replying to, or empty string if it's an op )
- button ( the text for the reply button )
}}
<h1> posting </h1>
<form action="{{post_url}}" enctype="multipart/form-data" name="post" method="post">
<input type="hidden" name="reference" value="{{reference}}" />
<input type="hidden" name="captcha" value="" id="captcha_input" />
<table class="postform">
<tbody>
<tr>
<th>
Name
</th>
<td>
<input type="text" name="name" value="" />
</td>
</tr>
<tr>
<th>
Subject
</th>
<td>
<input type="text" name="subject" value="" />
<input type="submit" value="{{button}}" />
</td>
</tr>
<tr>
<th>
Comment
</th>
<td>
<textarea type="text" name="message" cols=35 rows=5></textarea>
</td>
</tr>
<tr>
<th>
File
</th>
<td>
<input type="file" name="attachment" />
</td>
</tr>
<tr>
<th>
Captcha
</th>
<td>
<img id="captcha_img" src="" alt="captcha" />
</td>
</tr>
<tr>
<th>
</th>
<td>
<input type="text" name="captcha_solution" />
</td>
</tr>
</tbody>
</table>
</form>

View File

@ -0,0 +1,33 @@
<div class="thread_reply" id="post_{{PostHash}}">
<p class="intro">
<label for="delete_{{PostHash}}">
<span class="subject">
{{Subject}}
</span>
<span class="name">
{{#Sage}}
<a href="mailto:sage">
{{Name}}
</a>
{{/Sage}}
{{^Sage}}
{{Name}}
{{/Sage}}
</span>
<time
</label>
<a href="{{PostURL}}" onclick="">
No. {{PostHash}}
</a>
</p>
<div class="files">
{{#Image}}
<a class="file" href="{{Source}}">
<img class="file-thumbnail" src="{{Thumbnail}}" />
</a>
{{/Image}}
</div>
<div class="thread_reply_body">
{{{RenderBody}}}
</div>
</div>

View File

@ -0,0 +1,9 @@
<html>
<head>
<meta charset="utf-8" />
<title>{{title}}</title>
</head>
<body>
{{{content}}}
</body>
</html>

View File

@ -0,0 +1,26 @@
<html>
<head>
<meta charset="utf-8" />
<script type="text/javascript" src="{{thread.Prefix}}static/captcha.js"></script>
<link rel="stylesheet" href="{{thread.Prefix}}static/site.css"></link>
<title> {{thread.OP.Subject}} </title>
</head>
<body>
<!-- postform -->
<div id="postform_container">
{{{form}}}
</div>
<hr />
<div class="thread" id="thread_{{thread.OP.PostHash}}">
<div class="thread_header">
</div>
{{{thread.OP.RenderPost}}}
{{# repls}}
{{{RenderPost}}}
<br/>
{{/ repls}}
</div>
<br/>
<hr/>
</body>
</html>

View File

@ -0,0 +1,26 @@
<html>
<head>
<title> ukko </title>
<meta charset="utf-8" />
<link rel="stylesheet" href="{{prefix}}static/site.css"></link>
</head>
<body>
<div id="ukko_threads" class="threads_container">
{{#threads}}
<div class="ukko_thread_header">
<p> Posted on <a href="{{{BoardURL}}}"><span class="ukko_boardname">{{OP.Board}}</span></a></p>
</div>
<div class="thread" id="thread_{{OP.PostHash}}">
<div clsss="thread_header">
</div>
{{{OP.RenderPost}}}
{{#Replies}}
{{{RenderPost}}}
<br />
{{/Replies}}
</div>
<hr/>
{{/threads}}
</div>
</body>
</html>

View File

@ -0,0 +1,13 @@
<html>
<head>
<link rel="stylesheet" href="{{prefix}}static/site.css"></link>
<title> here is a new tripcode </title>
</head>
<body>
<pre>New Tripcode:
<b id="secret_key">secret: {{secret}}</b>
<b id="public_key">public: {{public}}</b>
<b id="capcode_key">tripcode: {{tripcode}}</b>
</pre>
</body>
</html>