inherit
King Oligochaete
126470
0
Feb 24, 2021 12:23:15 GMT -8
Wormopolis
Stop rating plugins with 1 star that dont deserve it.
20,002
June 2008
tbserialkillers
Wormo's Mini-Profile
|
Post by Wormopolis on Jun 9, 2014 23:22:06 GMT -8
Can Tim Camara or someone explain how the handler for deletePost works? I was looking at the js for it, and it seems like its using the class associated with the li tag that it is on, but when I tried to manually change it to be a different id number, it disabled the delete function completely. It looks as if its checking listManager for all selected posts, but when you do a delete on a single post you dont manually select the post first - it just knows its going to do the one. does simply opening the options menu somehow select that post first?
|
|
inherit
The Dream Crusher (Ret.)
164921
0
Apr 1, 2014 11:00:25 GMT -8
Tim Camara
Teach a man to fish, etc., etc.
1,721
March 2011
tcamara
|
Post by Tim Camara on Jun 10, 2014 8:17:03 GMT -8
Here's the code:
else if(value == post_id+'-deletePost') { var selected_posts = []; for(var i = 0; i < self.selected_posts.length; i++) { if(self.selected_posts[i] != post_id && ($('#post-'+self.selected_posts[i]).length == 0 || $('#post-'+self.selected_posts[i]).hasClass('deletable'))) selected_posts.push(self.selected_posts[i]); } selected_posts.push(post_id); proboards.confirm_dialog('posts', 'delete', selected_posts, function(data) { // If a redirect_url is set, then that means the thread was deleted if(typeof data['redirect_url'] != 'undefined') { // Redirect to that url window.location = data['redirect_url']; } // Else refresh the list else { self.unselect_all();
// clear search cache and trigger re-search listMan.research();
// Update selection listMan.selected_ids = []; listMan.selected_items = {}; } }); } So what it's doing is first looping through all of the selected posts to grab their ids, then it manually adds the current post's id so that it doesn't have to be selected before deletion. As for trying to override it, you could probably manipulate the class on the post that they're clicking delete from or manipulate listManager's internal selected_post array, or it might be even easier to just add a new button that when clicked directly calls the confirm_dialog function with a custom array of ids passed in.
|
|