add js delete function
This commit is contained in:
parent
91ced83c3a
commit
e72a37f928
@ -9,6 +9,35 @@ var ready = function() {
|
||||
for(var idx = 0; idx < _onreadyfuncs.length; idx++) _onreadyfuncs[idx]();
|
||||
};
|
||||
|
||||
var nntpchan_mod_delete = function(lonhash) {
|
||||
var elem = document.getElementById(longhash);
|
||||
var ajax = new XMLHttpRequest();
|
||||
ajax.onreadystatechange = function() {
|
||||
if(ajax.readyState == 4)
|
||||
{
|
||||
if(ajax.status == 200)
|
||||
{
|
||||
// success (?)
|
||||
var j = JSON.parse(ajax.responseText);
|
||||
if(j.deleted)
|
||||
{
|
||||
elem.appendChild(document.createTextNode(j.deleted));
|
||||
}
|
||||
else (j.error)
|
||||
{
|
||||
elem.innerHTML = "an error occured: " + j.error ;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
elem.innerHTML = "post not deleted from server: "+ ajax.statusText;
|
||||
}
|
||||
}
|
||||
};
|
||||
ajax.open("GET", "/mod/del/"+longhash);
|
||||
ajax.send();
|
||||
elem.innerHTML = "";
|
||||
};
|
||||
|
||||
var quickreply = function(shorthash, longhash, url) {
|
||||
if (!window.location.pathname.startsWith("/t/"))
|
||||
|
@ -30,6 +30,7 @@
|
||||
{{#post.Attachments}}
|
||||
<a href="{{Source}}" class="image_link" target="_blank" title="{{Filename}}"><img src="{{Thumbnail}}" class="image" /></a>
|
||||
{{/post.Attachments}}
|
||||
<a href="#" onclick="nntpchan_mod_delete('{{post.PostHash}}');">[Delete]</a>
|
||||
<a name="{{post.PostHash}}"></a><span class="topicline"><b data-subject="{{post.Subject}}" class="subject">{{post.Subject}}</b> {{post.Name}} <span class="published">{{post.Frontend}} || {{post.Date}}</span> {{{post.Pubkey}}} <a href="{{post.PostURL}}">№</a>
|
||||
<a href="#" onclick="return quickreply('{{post.ShortHash}}', '{{post.PostHash}}', '{{post.PostURL}}');"> {{post.ShortHash}}</a>
|
||||
</span>
|
||||
|
Reference in New Issue
Block a user