The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Add the button solved message header

2 posters

Go down

Solved Add the button solved message header

Post by Milouze14 September 10th 2015, 5:54 pm

Hi to you all,
I greet in passing Ange Tuteur Wink .
sorry for my English, I'm French and I wanted to know if we could put this script found on the forum for Portuguese version Punbb end Phpbb3 in order to have "Solved" button at the message header, and when clicking it get alone resolved.


I wish I had this script for phpbb2 Version please.


http://ajuda.forumeiros.com/t74425-tutorial-adicionar-botao-resolvido-phpbb3-e-punbb

Code:
jQuery(document).ready(function(){if(jQuery('.post:eq(0) .i_icon_edit').length){jQuery('#main-content h1.page-title:eq(0)').before('<div style="background:#2C5787;border:1px solid green;padding:5px;color:#C8E2B7;text-align:center;font-family:Verdana;font-size:11px"><img src=http://i.imgur.com/EFz6C.gif height=48 style=vertical-align:middle> Help organize the forum if your question has been resolved click solved</div>')}});

jQuery(document).ready(function(){var r='.post:eq(0) .i_icon_edit';if(jQuery(r).length){jQuery('.buttons').append('&nbsp&nbsp&nbsp<a href="'+jQuery(r).parent().attr('href')+'&solved=true"><img src=http://i.imgur.com/h6ZWU.png></a>')};if(location.href.match(/&solved=true/)){jQuery('form[name="post"]').append('<input type=hidden name=post_icon value=2>');p=document.getElementById('post_icon_2');if(p){p.checked=true};jQuery('.submit-buttons input[name="post"]').click()}});


Thank you in advance

a++


Last edited by Milouze14 on September 10th 2015, 8:13 pm; edited 1 time in total
Milouze14
Milouze14
Forumember

Male Posts : 59
Reputation : 18
Language : French
Location : Vendée

http://www.milouze14.com/

Back to top Go down

Solved Re: Add the button solved message header

Post by Ange Tuteur September 10th 2015, 7:12 pm

Hi @Milouze14,

Good to see you. Mr. Green

I updated the script to work with phpbb2, and so it's easier to edit. Here you are :

Placement : In all the pages
Code:
$(function() {
  var icon_id = 2,
      notice_msg = '<img src=http://i.imgur.com/EFz6C.gif height=48 style=vertical-align:middle> Help organize the forum if your question has been resolved click solved',
      button_icon = 'Mark Solved',

      postbody = $('.postbody')[0],
      edit, icon;

  if (postbody) {
    edit = $(postbody).closest('.post').find('.i_icon_edit')[0];

    if (edit) {
      $('#page-body').prepend('<div style="background:#2C5787;border:1px solid green;padding:5px;color:#C8E2B7;text-align:center;font-family:Verdana;font-size:11px">' + notice_msg + '</div>');
      $('.nav:has(> a[href*="mode=reply"])').append('&nbsp&nbsp&nbsp<a href="' + edit.parentNode.href + '&solved=true">' + button_icon + '</a>');
    }
  }

  if (location.href.match(/&solved=true/)) {
    icon = document.getElementById('post_icon_' + icon_id);
    if (icon) {
      icon.checked = true;
      document.post && document.post.post.click();
    }
  }
});

Here are the three fields you can edit :

icon_id : This should be the id of your solved icon. You can see the id via the DOM inspector :
Add the button solved message header Captur28

post_icon_2 ^^


notice_msg : The message displayed at the top of the page

button_icon : The solved button. You can use the html <img> tag to make it an image. I just put text because the original image was broken. Wink


If you need to edit anything else, it can be found below the start up variables where it's more technical. Smile


See you bye


Last edited by Ange Tuteur on September 10th 2015, 8:32 pm; edited 1 time in total
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13246
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Add the button solved message header

Post by Milouze14 September 10th 2015, 7:42 pm

Hi Ange Tuteur Hello ,

I wonder how to tell you this too easy to find, a huge thank you my friend.

Good night.

a++

Milouze14
Milouze14
Forumember

Male Posts : 59
Reputation : 18
Language : French
Location : Vendée

http://www.milouze14.com/

Back to top Go down

Solved Re: Add the button solved message header

Post by Milouze14 September 10th 2015, 7:59 pm

Oups,

I'm sorry but Ange Tuteur I do not see the background and the image Ange Tuteur
a++


Edict, you had to testify here

Code:
$('#content-container')

Code:
  $('#page-body')



Milouze14
Milouze14
Forumember

Male Posts : 59
Reputation : 18
Language : French
Location : Vendée

http://www.milouze14.com/

Back to top Go down

Solved Re: Add the button solved message header

Post by Ange Tuteur September 10th 2015, 8:33 pm

Oh yes, I forgot page-body is better to use on phpbb2. Thanks, and you're welcome. ^^

Topic archived

Have a good day. Smile
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13246
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum