inherit
217348
0
Jul 27, 2022 7:26:44 GMT -8
Lynx
5,768
January 2015
msg
|
Post by Lynx on Aug 1, 2019 15:28:23 GMT -8
Hey, Retread. I used a combination of Scott's code and elli's code and made a quick, open-build plugin - so you could take a look at how the JS would work (slightly modified from the codes here) that enables it to handle a LOT of threads, regardless of board. If you got any questions, feel free to shoot them at me. I'll be happy to explain any line you're not sure of. Remove MP on First Post.pbp (751 B) It uses autoforms and a for loop to handle multiple thread ID's entered.
|
|
#e61919
Support Staff
224482
0
1
Mar 28, 2024 16:54:21 GMT -8
Scott
23,131
August 2015
socalso
|
Post by Scott on Aug 1, 2019 15:39:40 GMT -8
Hey, Retread . I used a combination of Scott 's code and elli 's code and made a quick, open-build plugin - so you could take a look at how the JS would work (slightly modified from the codes here) that enables it to handle a LOT of threads, regardless of board. If you got any questions, feel free to shoot them at me. I'll be happy to explain any line you're not sure of. It uses autoforms and a for loop to handle multiple thread ID's entered. How cool!
|
|
inherit
217348
0
Jul 27, 2022 7:26:44 GMT -8
Lynx
5,768
January 2015
msg
|
Post by Lynx on Aug 1, 2019 15:42:42 GMT -8
Hey, Retread . I used a combination of Scott 's code and elli 's code and made a quick, open-build plugin - so you could take a look at how the JS would work (slightly modified from the codes here) that enables it to handle a LOT of threads, regardless of board. If you got any questions, feel free to shoot them at me. I'll be happy to explain any line you're not sure of. It uses autoforms and a for loop to handle multiple thread ID's entered. How cool! Well, he did say that it could expand out to more threads and possibly other boards - so I figured I'd just throw that together so he can take a look at it. I believe he said he wanted to learn JS, so there's a short plugin for him to dissect. I may not be the best person to learn from, but hey - the code works.
|
|
inherit
252032
0
Sept 18, 2023 9:07:51 GMT -8
Retread
Tribbial Pursuit.
5,014
January 2018
retread
|
Post by Retread on Aug 1, 2019 15:56:06 GMT -8
MSG, that plugin is perfect in more ways than one. I had planned on doing something like this when I eventually learn enough about JS to write a plugin. This is compact and simple enough that I should be able to learn how the Components and User Interface tabs work together. That will get me at least a foothold in the process.
iirc, you helped me on one of my early projects (Posting Guidance). I still owe you a debt of gratitude for getting me started there.
|
|
inherit
217348
0
Jul 27, 2022 7:26:44 GMT -8
Lynx
5,768
January 2015
msg
|
Post by Lynx on Aug 1, 2019 16:01:09 GMT -8
MSG, that plugin is perfect in more ways than one. I had planned on doing something like this when I eventually learn enough about JS to write a plugin. This is compact and simple enough that I should be able to learn how the Components and User Interface tabs work together. That will get me at least a foothold in the process. iirc, you helped me on one of my early projects (Posting Guidance). I still owe you a debt of gratitude for getting me started there. If you've got any questions about that plugin, feel free to ask. Yeah, I thought I remembered you saying something about wanting to learn how to do plugins - and this turned out to be "bite-sized", so hopefully it'll help you get on your way.
|
|
inherit
223590
0
May 17, 2023 9:13:21 GMT -8
Kitty Katt
My Username is @kittykatt (with 2 t's in katt)
819
July 2015
kittykatt
|
Post by Kitty Katt on Sept 2, 2019 5:37:02 GMT -8
Hello, Retread. I am curious as to whether or not this plugin was ever added to the library, as I cannot seem to find it. Thank you.
|
|
inherit
252032
0
Sept 18, 2023 9:07:51 GMT -8
Retread
Tribbial Pursuit.
5,014
January 2018
retread
|
Post by Retread on Sept 2, 2019 5:54:58 GMT -8
Hello, Retread. I am curious as to whether or not this plugin was ever added to the library, as I cannot seem to find it. Thank you. I think it would be improper for me to add this to the library as the initial work was done by Lynx, not me. I've been making some changes to it, some are complete, others are still in progress. I reckon it will be a while before I get back to this and discuss some of the options and present them to Lynx. He's likely to see a better way of accomplishing the additional goals.
|
|
inherit
223590
0
May 17, 2023 9:13:21 GMT -8
Kitty Katt
My Username is @kittykatt (with 2 t's in katt)
819
July 2015
kittykatt
|
Post by Kitty Katt on Sept 2, 2019 7:04:05 GMT -8
Hello, Retread. I am curious as to whether or not this plugin was ever added to the library, as I cannot seem to find it. Thank you. I think it would be improper for me to add this to the library as the initial work was done by Lynx, not me. I've been making some changes to it, some are complete, others are still in progress. I reckon it will be a while before I get back to this and discuss some of the options and present them to Lynx. He's likely to see a better way of accomplishing the additional goals. Retread, May I send you a PM, please?
|
|
inherit
252032
0
Sept 18, 2023 9:07:51 GMT -8
Retread
Tribbial Pursuit.
5,014
January 2018
retread
|
Post by Retread on Sept 2, 2019 7:06:59 GMT -8
Retread, May I send you a PM, please? You can send me a PM any time you feel the need, Kitty Katt.
|
|
inherit
223590
0
May 17, 2023 9:13:21 GMT -8
Kitty Katt
My Username is @kittykatt (with 2 t's in katt)
819
July 2015
kittykatt
|
Post by Kitty Katt on Sept 2, 2019 7:28:30 GMT -8
Retread, May I send you a PM, please? You can send me a PM any time you feel the need, Kitty Katt. PM sent. Thank you, Retread.
|
|
inherit
217348
0
Jul 27, 2022 7:26:44 GMT -8
Lynx
5,768
January 2015
msg
|
Post by Lynx on Sept 5, 2019 16:17:55 GMT -8
Hello, Retread. I am curious as to whether or not this plugin was ever added to the library, as I cannot seem to find it. Thank you. I think it would be improper for me to add this to the library as the initial work was done by Lynx, not me.I've been making some changes to it, some are complete, others are still in progress. I reckon it will be a while before I get back to this and discuss some of the options and present them to Lynx. He's likely to see a better way of accomplishing the additional goals. Retread, If Scott and elli don't object, since the coding was theirs initially, by all means - add it to the library under your name. You can do what you want with that plugin, as I'm not making any claims on it - which is why I didn't submit it to the library myself.
|
|
inherit
252032
0
Sept 18, 2023 9:07:51 GMT -8
Retread
Tribbial Pursuit.
5,014
January 2018
retread
|
Post by Retread on Sept 8, 2019 13:47:30 GMT -8
Retread , If Scott and elli don't object, since the coding was theirs initially, by all means - add it to the library under your name. You can do what you want with that plugin, as I'm not making any claims on it - which is why I didn't submit it to the library myself. I contacted elli and Scott by PM and they both are giving me the nod to upload this. I've submitted it to the Library and I'm waiting for approval. To keep you abreast of what I've added, here's the latest version of the autoform: And here's the JS component: $(document).ready(function() { if (pb.plugin.get('remove_mp_on_first_post').settings.thread_id_numbers.length) { for (var z = 0; z < pb.plugin.get('remove_mp_on_first_post').settings.thread_id_numbers.length; z++) { if (proboards.data('thread_id') == parseInt(pb.plugin.get('remove_mp_on_first_post').settings.thread_id_numbers[z].thread_id)) { $('.posts .post.first .left-panel').css('display', 'none'); if (pb.plugin.get('remove_mp_on_first_post').settings.thread_id_numbers[z].xsig == 1){ $('.posts .post.first .foot .signature').css('display', 'none'); } if (pb.plugin.get('remove_mp_on_first_post').settings.thread_id_numbers[z].xedit == 1){ $('.posts .post.first .foot .edited_by').css('display', 'none'); } if (pb.plugin.get('remove_mp_on_first_post').settings.thread_id_numbers[z].xquot == 1){ $('.posts .post.first .button.quote-button').css('display', 'none'); } }}; } });
I'm also working on adding another settings tab to specify boards where all threads will have the MP removed.
|
|
inherit
217348
0
Jul 27, 2022 7:26:44 GMT -8
Lynx
5,768
January 2015
msg
|
Post by Lynx on Sept 8, 2019 17:13:52 GMT -8
Retread , If Scott and elli don't object, since the coding was theirs initially, by all means - add it to the library under your name. You can do what you want with that plugin, as I'm not making any claims on it - which is why I didn't submit it to the library myself. I contacted elli and Scott by PM and they both are giving me the nod to upload this. I've submitted it to the Library and I'm waiting for approval. To keep you abreast of what I've added, here's the latest version of the autoform: And here's the JS component: $(document).ready(function() { if (pb.plugin.get('remove_mp_on_first_post').settings.thread_id_numbers.length) { for (var z = 0; z < pb.plugin.get('remove_mp_on_first_post').settings.thread_id_numbers.length; z++) { if (proboards.data('thread_id') == parseInt(pb.plugin.get('remove_mp_on_first_post').settings.thread_id_numbers[z].thread_id)) { $('.posts .post.first .left-panel').css('display', 'none'); if (pb.plugin.get('remove_mp_on_first_post').settings.thread_id_numbers[z].xsig == 1){ $('.posts .post.first .foot .signature').css('display', 'none'); } if (pb.plugin.get('remove_mp_on_first_post').settings.thread_id_numbers[z].xedit == 1){ $('.posts .post.first .foot .edited_by').css('display', 'none'); } if (pb.plugin.get('remove_mp_on_first_post').settings.thread_id_numbers[z].xquot == 1){ $('.posts .post.first .button.quote-button').css('display', 'none'); } }}; } });
I'm also working on adding another settings tab to specify boards where all threads will have the MP removed. Very nice! How do you plan on having the boards added? I'd suggest using the Forum Search tool and set it for Boards. The popup where the user selects the boards gets saved into an array - to which you can then use a for loop to see if it's a board in the list that gets the first post's MP affected. Since you're adding another tab, might I suggest you take the code you've already got above (except for the document.ready part) and put it into its own function, then make a new function for testing through the board list. There's a couple ways you can do this (probably more, but 2 that I know of): /* Checks to see if we're on a page that contains board info and set the boardID variable to the current board's ID */
var boardID = 0;
if (pb.data('page') && pb.data('page').board && pb.data('page').board.id) { boardID = parseInt(pb.data('page').board.id, 10); }
or /* Conditional for basically testing the same thing as above */
var boardID = (pb.data('page') && pb.data('page').board && pb.data('page').board.id) ? parseInt(pb.data('page').board.id, 10) : 0;
You may need Peter, Chris or Todge to confirm the conditional though - I'm not the best at those. In either case, if your boardID variable returns a 0, then you're not on a page that contains board info - which also means the user isn't looking at a thread, so no need for the plugin to do anything.
|
|
inherit
252032
0
Sept 18, 2023 9:07:51 GMT -8
Retread
Tribbial Pursuit.
5,014
January 2018
retread
|
Post by Retread on Sept 8, 2019 18:09:15 GMT -8
How do you plan on having the boards added? It's remarkably similar to what you three created and I added to. Since you're adding another tab, might I suggest you take the code you've already got above (except for the document.ready part) and put it into its own function, then make a new function for testing through the board list. It's probably considered inelegant, but I created a duplicate from head to toe, (including the document.ready part), then changed the plugin variables and the proboards.data('thread_id') in the conditional. Here's the JS component (with the new part at the beginning). $(document).ready(function() { if (pb.plugin.get('remove_mp_on_first_post').settings.board_id_numbers.length) { for (var z = 0; z < pb.plugin.get('remove_mp_on_first_post').settings.board_id_numbers.length; z++) { if (proboards.data('board_id') == parseInt(pb.plugin.get('remove_mp_on_first_post').settings.board_id_numbers[z].board_id)) { $('.posts .post.first .left-panel').css('display', 'none'); if (pb.plugin.get('remove_mp_on_first_post').settings.board_id_numbers[z].xsig == 1){ $('.posts .post.first .foot .signature').css('display', 'none'); } if (pb.plugin.get('remove_mp_on_first_post').settings.board_id_numbers[z].xedit == 1){ $('.posts .post.first .foot .edited_by').css('display', 'none'); } if (pb.plugin.get('remove_mp_on_first_post').settings.board_id_numbers[z].xquote == 1){ $('.posts .post.first .button.quote-button').css('display', 'none'); } }}; } });
$(document).ready(function() { if (pb.plugin.get('remove_mp_on_first_post').settings.thread_id_numbers.length) { for (var z = 0; z < pb.plugin.get('remove_mp_on_first_post').settings.thread_id_numbers.length; z++) { if (proboards.data('thread_id') == parseInt(pb.plugin.get('remove_mp_on_first_post').settings.thread_id_numbers[z].thread_id)) { $('.posts .post.first .left-panel').css('display', 'none'); if (pb.plugin.get('remove_mp_on_first_post').settings.thread_id_numbers[z].xsig == 1){ $('.posts .post.first .foot .signature').css('display', 'none'); } if (pb.plugin.get('remove_mp_on_first_post').settings.thread_id_numbers[z].xedit == 1){ $('.posts .post.first .foot .edited_by').css('display', 'none'); } if (pb.plugin.get('remove_mp_on_first_post').settings.thread_id_numbers[z].xquot == 1){ $('.posts .post.first .button.quote-button').css('display', 'none'); } }}; } });
I struggled quite a while with this, because I made some syntax errors. But that's on me for being a n00b, not because it was difficult.
|
|
inherit
217348
0
Jul 27, 2022 7:26:44 GMT -8
Lynx
5,768
January 2015
msg
|
Post by Lynx on Sept 8, 2019 21:35:17 GMT -8
I would not recommend having 2 $(document).ready calls - which is why I suggested making them into functions, like so: function boardchk() { if (pb.plugin.get('remove_mp_on_first_post').settings.board_id_numbers.length) { for (var z = 0; z < pb.plugin.get('remove_mp_on_first_post').settings.board_id_numbers.length; z++) { if (proboards.data('board_id') == parseInt(pb.plugin.get('remove_mp_on_first_post').settings.board_id_numbers[z].board_id)) { $('.posts .post.first .left-panel').css('display', 'none'); if (pb.plugin.get('remove_mp_on_first_post').settings.board_id_numbers[z].xsig == 1){ $('.posts .post.first .foot .signature').css('display', 'none'); } if (pb.plugin.get('remove_mp_on_first_post').settings.board_id_numbers[z].xedit == 1){ $('.posts .post.first .foot .edited_by').css('display', 'none'); } if (pb.plugin.get('remove_mp_on_first_post').settings.board_id_numbers[z].xquote == 1){ $('.posts .post.first .button.quote-button').css('display', 'none'); } }}; } });
function threadchk() { if (pb.plugin.get('remove_mp_on_first_post').settings.thread_id_numbers.length) { for (var z = 0; z < pb.plugin.get('remove_mp_on_first_post').settings.thread_id_numbers.length; z++) { if (proboards.data('thread_id') == parseInt(pb.plugin.get('remove_mp_on_first_post').settings.thread_id_numbers[z].thread_id)) { $('.posts .post.first .left-panel').css('display', 'none'); if (pb.plugin.get('remove_mp_on_first_post').settings.thread_id_numbers[z].xsig == 1){ $('.posts .post.first .foot .signature').css('display', 'none'); } if (pb.plugin.get('remove_mp_on_first_post').settings.thread_id_numbers[z].xedit == 1){ $('.posts .post.first .foot .edited_by').css('display', 'none'); } if (pb.plugin.get('remove_mp_on_first_post').settings.thread_id_numbers[z].xquot == 1){ $('.posts .post.first .button.quote-button').css('display', 'none'); } }}; } });
$(document).ready(function() { boardchk(); threadchk(); });
|
|