27 lines
627 B
JavaScript
27 lines
627 B
JavaScript
//
|
|
// nntpchan.js -- frontend ui niceness
|
|
//
|
|
|
|
|
|
// insert a backlink for a post given its short hash
|
|
function nntpchan_backlink(shorthash)
|
|
{
|
|
var elem = document.getElementById("postform_message");
|
|
if ( elem )
|
|
{
|
|
elem.value += ">>" + shorthash.substr(0,10) + "\n";
|
|
}
|
|
}
|
|
|
|
var banner_count = 3;
|
|
|
|
// inject a banner into an element
|
|
function nntpchan_inject_banners(elem, prefix) {
|
|
var n = Math.floor(Math.random() * banner_count);
|
|
var banner = prefix + "static/banners/banner_"+n+".jpg";
|
|
var e = document.createElement("img");
|
|
e.src = banner;
|
|
e.setAttribute("class", "nntpchan_banner");
|
|
elem.appendChild(e);
|
|
}
|