more
This commit is contained in:
parent
e35adda727
commit
536b1161c9
24
contrib/js/neochan/board_init.js
Normal file
24
contrib/js/neochan/board_init.js
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief initialize a board page
|
||||||
|
*/
|
||||||
|
function neochan_board_init(root, board) {
|
||||||
|
|
||||||
|
var thread_init = function (j) {
|
||||||
|
var elem = document.createElement("div");
|
||||||
|
for(var idx = 0; idx < j.length; idx ++) {
|
||||||
|
var post = j[idx];
|
||||||
|
neochan_post_fadein(elem, post);
|
||||||
|
}
|
||||||
|
return elem;
|
||||||
|
}
|
||||||
|
// inject threads
|
||||||
|
onready(function() {
|
||||||
|
for (var idx = 0; idx < board.posts.length; idx ++) {
|
||||||
|
var posts = board.posts[idx];
|
||||||
|
var elem = thread_init(posts);
|
||||||
|
root.appendChild(elem);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
@ -1,5 +0,0 @@
|
|||||||
// Generated by CoffeeScript 1.11.1
|
|
||||||
(function() {
|
|
||||||
|
|
||||||
|
|
||||||
}).call(this);
|
|
23
contrib/js/neochan/post.js
Normal file
23
contrib/js/neochan/post.js
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
|
||||||
|
|
||||||
|
function neochan_post_new(j) {
|
||||||
|
var post = document.createElement("div");
|
||||||
|
post.id = j.PostHash;
|
||||||
|
post.setAttribute("class", "neochan-post-wrapper");
|
||||||
|
var header = document.createElement("div");
|
||||||
|
header.setAttribute("class", "neochan-post-header");
|
||||||
|
post.appendChild(header);
|
||||||
|
|
||||||
|
var body = document.createElement("div");
|
||||||
|
body.setAttribute("class", "neochan-post-body");
|
||||||
|
|
||||||
|
neochan_postify(body, j.Message);
|
||||||
|
|
||||||
|
return post;
|
||||||
|
}
|
||||||
|
|
||||||
|
function neochan_post_fadein(elem, j) {
|
||||||
|
var post = neochan_post_new(j);
|
||||||
|
$(post).fadein();
|
||||||
|
elem.appendChild(post);
|
||||||
|
}
|
37
contrib/js/neochan/postify.js
Normal file
37
contrib/js/neochan/postify.js
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
|
||||||
|
|
||||||
|
function _neochan_filter_boardlink(match) {
|
||||||
|
match = match.toLowerCase();
|
||||||
|
var a = document.createElement("a");
|
||||||
|
a.href = "/" + match + "-0.html";
|
||||||
|
match = ">>>/" + match + "/";
|
||||||
|
a.appendChild(document.createTextNode(match));
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _neochan_filter_postlink(match) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
var _neochan_post_filters = [
|
||||||
|
[/>>>\/(overchan\\.[a-zA-z0-9\\.]+[a-zA-Z0-9])\//g, _neochan_filter_boardlink],
|
||||||
|
[/>>? ([a-fA-F0-9])/g, _neochan_filter_postlink],
|
||||||
|
[/==(.+)==/g, _neochan_filter_redtext],
|
||||||
|
[/@@(.+)@@/g, _neochan_filter_psytext],
|
||||||
|
[/^>/g, _neochan_filter_greentext],
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief create post body from raw text
|
||||||
|
*/
|
||||||
|
function neochan_postify(elem, text) {
|
||||||
|
$.each(_neochan_post_filters, function(idx, ent) {
|
||||||
|
var re = ent[0];
|
||||||
|
var func = ent[1];
|
||||||
|
text = text.replace(re, function(m) {
|
||||||
|
var e = func(m);
|
||||||
|
|
||||||
|
return "";
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
@ -1,3 +1 @@
|
|||||||
# neochan javascript directory
|
# neochan javascript directory
|
||||||
|
|
||||||
sass files for neochan templates
|
|
||||||
|
@ -29,37 +29,18 @@
|
|||||||
<div id="nntpchan_banner">
|
<div id="nntpchan_banner">
|
||||||
</div>
|
</div>
|
||||||
</center>
|
</center>
|
||||||
<div class="board_header">{{board.Board}}</div>
|
<div id="board">
|
||||||
<div class="board_header_catalog"><a href="{{board.Prefix}}catalog-{{board.Name}}.html"> {{#i18n.Translations}}{{catalog_label}}{{/i18n.Translations}} </a></div>
|
|
||||||
<!-- postform -->
|
|
||||||
<div id="postform_container">
|
|
||||||
{{{form}}}
|
|
||||||
</div>
|
|
||||||
<hr />
|
|
||||||
<div id="threads_container">
|
|
||||||
{{#board.Threads}}
|
|
||||||
<div class="thread" id="thread_{{OP.PostHash}}">
|
|
||||||
<div class="thread_header">
|
|
||||||
</div>
|
|
||||||
{{{OP.Truncate.RenderPost}}}
|
|
||||||
{{#Truncate.Replies}}
|
|
||||||
{{{Truncate.RenderPost}}}
|
|
||||||
{{/Truncate.Replies}}
|
|
||||||
<hr />
|
|
||||||
</div>
|
|
||||||
{{/board.Threads}}
|
|
||||||
</div>
|
|
||||||
<div class="pagelist">{{# board.PageList }}[<a href="{{LinkURL}}"> {{Text}} </a>] {{/ board.PageList }}
|
|
||||||
<span class="navbar-sep">
|
|
||||||
|
|
|
||||||
</span>
|
|
||||||
<a href="{{board.Prefix}}catalog-{{board.Name}}.html"> {{#i18n.Translations}}{{catalog_label}}{{/i18n.Translations}} </a>
|
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
var board = {{{board.JSON}}};
|
||||||
var prefix = "{{board.Prefix}}";
|
var prefix = "{{board.Prefix}}";
|
||||||
var e = document.getElementById("nntpchan_banner");
|
var e = document.getElementById("nntpchan_banner");
|
||||||
nntpchan_inject_banners(e, prefix);
|
nntpchan_inject_banners(e, prefix);
|
||||||
init(prefix);
|
init(prefix);
|
||||||
|
|
||||||
|
var root = document.getElementById("board");
|
||||||
|
if(neochan_board_init) neochan_board_init(root, board);
|
||||||
|
|
||||||
ready();
|
ready();
|
||||||
</script>
|
</script>
|
||||||
<hr/>
|
<hr/>
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
data-origin="clearnet"
|
data-origin="clearnet"
|
||||||
{{/post.IsClearnet}}
|
{{/post.IsClearnet}}
|
||||||
data-posturl="{{post.PostURL}}">
|
data-posturl="{{post.PostURL}}">
|
||||||
<legend class="postheader">
|
<div class="postheader">
|
||||||
<span class="origin">
|
<span class="origin">
|
||||||
{{#post.IsI2P}}
|
{{#post.IsI2P}}
|
||||||
<img src="{{post.Prefix}}static/i2p.png" title="{{#i18n.Translations}}{{from_i2p}}{{/i18n.Translations}}" />
|
<img src="{{post.Prefix}}static/i2p.png" title="{{#i18n.Translations}}{{from_i2p}}{{/i18n.Translations}}" />
|
||||||
@ -46,17 +46,19 @@
|
|||||||
<div>
|
<div>
|
||||||
Date: <time datetime="{{post.DateRFC}}">{{post.Date}}</time>
|
Date: <time datetime="{{post.DateRFC}}">{{post.Date}}</time>
|
||||||
</div>
|
</div>
|
||||||
</legend>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
<div class="attachments">
|
<div class="attachments">
|
||||||
{{#post.Attachments}}
|
{{#post.Attachments}}
|
||||||
<figure data-sha512="{{Hash}}">
|
<div data-sha512="{{Hash}}">
|
||||||
<figcaption>
|
<div>
|
||||||
<a class="download_link" href="{{Source}}" download="{{Filename}}">{{#i18n.Translations}}{{download_prompt}}{{/i18n.Translations}}</a>
|
<a class="download_link" href="{{Source}}" <download></download>Translations}}</a>
|
||||||
<a class="file" href="{{Source}}" title="{{Filename}}" target="_blank"><img src="{{Thumbnail}}" alt="{{Filename}}" class="thumbnail"/></a>
|
<a class="file" href="{{Source}}" title="{{Filename}}" target="_blank">
|
||||||
|
<img src="{{Thumbnail}}" alt={{Filename}}" class="thumbnail"></img>
|
||||||
|
</a>
|
||||||
<a class="fname_link" title="{{Filename}}" href="{{Source}}">{{Filename}}</a>
|
<a class="fname_link" title="{{Filename}}" href="{{Source}}">{{Filename}}</a>
|
||||||
</figcaption>
|
</div>
|
||||||
</figure>
|
</div>
|
||||||
{{/post.Attachments}}
|
{{/post.Attachments}}
|
||||||
</div>
|
</div>
|
||||||
<div class="post_body">
|
<div class="post_body">
|
||||||
|
Reference in New Issue
Block a user