delete button

This commit is contained in:
James Campos 2012-06-09 19:15:50 -07:00
parent 59aa957d12
commit b6df3d60fc
3 changed files with 50 additions and 1 deletions

View File

@ -72,7 +72,7 @@
*/
(function() {
var $, $$, Anonymize, AutoGif, Conf, Config, ExpandComment, ExpandThread, Favicon, FileInfo, Filter, GetTitle, ImageExpand, ImageHover, Keybinds, Main, Nav, Options, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, Quotify, Redirect, ReplyHiding, ReportButton, RevealSpoilers, Sauce, StrikethroughQuotes, ThreadHiding, ThreadStats, Time, TitlePost, UI, Unread, Updater, Watcher, d, g, _base;
var $, $$, Anonymize, AutoGif, Conf, Config, DeleteButton, ExpandComment, ExpandThread, Favicon, FileInfo, Filter, GetTitle, ImageExpand, ImageHover, Keybinds, Main, Nav, Options, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, Quotify, Redirect, ReplyHiding, ReportButton, RevealSpoilers, Sauce, StrikethroughQuotes, ThreadHiding, ThreadStats, Time, TitlePost, UI, Unread, Updater, Watcher, d, g, _base;
Config = {
main: {
@ -82,6 +82,7 @@
'Time Formatting': [true, 'Arbitrarily formatted timestamps, using your local time'],
'File Info Formatting': [true, 'Reformats the file information'],
'Report Button': [true, 'Add report buttons'],
'Delete Button': [false, 'Add delete buttons'],
'Comment Expansion': [true, 'Expand too long comments'],
'Thread Expansion': [true, 'View all replies'],
'Index Navigation': [true, 'Navigate to previous / next thread'],
@ -3416,6 +3417,29 @@
}
};
DeleteButton = {
init: function() {
this.a = $.el('a', {
className: 'delete_button',
innerHTML: '[ X ]',
href: 'javascript:;'
});
return Main.callbacks.push(this.node);
},
node: function(post) {
var a;
if (!(a = $('.delete_button', post.el))) {
a = DeleteButton.a.cloneNode(true);
$.add($('.postInfo', post.el), a);
}
return $.on(a, 'click', DeleteButton["delete"]);
},
"delete": function() {
$.x('preceding-sibling::input', this).checked = true;
return $.id('delPassword').nextElementSibling.click();
}
};
ReportButton = {
init: function() {
this.a = $.el('a', {
@ -4053,6 +4077,9 @@
if (Conf['Report Button']) {
ReportButton.init();
}
if (Conf['Delete Button']) {
DeleteButton.init();
}
if (Conf['Resurrect Quotes']) {
Quotify.init();
}

View File

@ -1,4 +1,6 @@
master
- aeosynth
delete button
2.31.6
- Mayhem

View File

@ -6,6 +6,7 @@ Config =
'Time Formatting': [true, 'Arbitrarily formatted timestamps, using your local time']
'File Info Formatting': [true, 'Reformats the file information']
'Report Button': [true, 'Add report buttons']
'Delete Button': [false, 'Add delete buttons']
'Comment Expansion': [true, 'Expand too long comments']
'Thread Expansion': [true, 'View all replies']
'Index Navigation': [true, 'Navigate to previous / next thread']
@ -2605,6 +2606,22 @@ Quotify =
$.replace node, nodes
return
DeleteButton =
init: ->
@a = $.el 'a',
className: 'delete_button'
innerHTML: '[ X ]'
href: 'javascript:;'
Main.callbacks.push @node
node: (post) ->
unless a = $ '.delete_button', post.el
a = DeleteButton.a.cloneNode true
$.add $('.postInfo', post.el), a
$.on a, 'click', DeleteButton.delete
delete: ->
$.x('preceding-sibling::input', @).checked = true
$.id('delPassword').nextElementSibling.click()
ReportButton =
init: ->
@a = $.el 'a',
@ -3082,6 +3099,9 @@ Main =
if Conf['Report Button']
ReportButton.init()
if Conf['Delete Button']
DeleteButton.init()
if Conf['Resurrect Quotes']
Quotify.init()