diff --git a/contrib/static/captcha.js b/contrib/static/captcha.js new file mode 100644 index 0000000..c769207 --- /dev/null +++ b/contrib/static/captcha.js @@ -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(); +}); diff --git a/contrib/static/mod.js b/contrib/static/mod.js new file mode 100644 index 0000000..0fcaae6 --- /dev/null +++ b/contrib/static/mod.js @@ -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(); +} diff --git a/contrib/static/site.css b/contrib/static/site.css new file mode 100644 index 0000000..3233be3 --- /dev/null +++ b/contrib/static/site.css @@ -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; +} \ No newline at end of file diff --git a/contrib/static/user.css b/contrib/static/user.css new file mode 100644 index 0000000..e69de29 diff --git a/contrib/templates/default/attachment.mustache b/contrib/templates/default/attachment.mustache new file mode 100644 index 0000000..e69de29 diff --git a/contrib/templates/default/board.mustache b/contrib/templates/default/board.mustache new file mode 100644 index 0000000..c2e49fb --- /dev/null +++ b/contrib/templates/default/board.mustache @@ -0,0 +1,34 @@ + +
+ + + +New Tripcode: ++ + \ No newline at end of file diff --git a/contrib/templates/default/modlogin.mustache b/contrib/templates/default/modlogin.mustache new file mode 100644 index 0000000..9d06df8 --- /dev/null +++ b/contrib/templates/default/modlogin.mustache @@ -0,0 +1,13 @@ + + + +secret: {{secret}}public: {{public}}tripcode: {{{tripcode}}}+
{{message}}
+ + \ No newline at end of file diff --git a/contrib/templates/default/modpage.mustache b/contrib/templates/default/modpage.mustache new file mode 100644 index 0000000..2084838 --- /dev/null +++ b/contrib/templates/default/modpage.mustache @@ -0,0 +1,23 @@ + + + + + ++ + No. {{ShortHash}} + {{#OP}} + [reply] + {{/OP}} +
++ [[ {{Frontend}} ]] +
+post failed: {{reason}}
+ + \ No newline at end of file diff --git a/contrib/templates/default/post_success.mustache b/contrib/templates/default/post_success.mustache new file mode 100644 index 0000000..5f0718f --- /dev/null +++ b/contrib/templates/default/post_success.mustache @@ -0,0 +1,6 @@ + + + +posted as {{message_id}}
+
+
\ No newline at end of file
diff --git a/contrib/templates/default/postform.mustache b/contrib/templates/default/postform.mustache
new file mode 100644
index 0000000..cb27660
--- /dev/null
+++ b/contrib/templates/default/postform.mustache
@@ -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 )
+ }}
+ Posted on {{OP.Board}}
+New Tripcode:
+ secret: {{secret}}
+ public: {{public}}
+ tripcode: {{tripcode}}
+
+
+
\ No newline at end of file