Add a message to thanked posts

Go down

Solved Add a message to thanked posts

Post by smurfavr on January 19th 2017, 12:02 am

@Ange Tuteur
As a thank he pressed a button displays the name of the author of the topic. It can be done by pressing thank you to print the name of that which it is pressed?

https://help.forumotion.com/t142451-add-a-message-to-thanked-posts

Code:
$(function() {
  var message = function(child, parent) {
        var pseudo = $(child, parent).text(),
            icon = '<img src="http://i86.servimg.com/u/f86/16/34/78/03/fa_sta13.png" alt=""/>';
   
        return '<div id="fa_thanks_message">' + icon + ' Автора на темата благодари на ' + pseudo + '  ' + icon + '</div>';
      },
     
      version = $('.bodylinewidth')[0] ? 0 : document.getElementById('wrap') ? 1 : $('.pun')[0] ? 2 : document.getElementById('ipbwrapper') ? 3 : 'badapple', // version check
      node = document.createElement(version ? 'DIV' : 'TR'),
      post = $(version ? 'div.post' : 'tr.post'),
      j = post.length,
      i = 0;
 
  if (version == 'badapple') {
    if (window.console) console.error('This plugin is not optimized for your forum version. Please contact the support for further assistance.');
    return;
  }
 
  node.id = 'fa_thanks'; // id for style modifications
  if (!version) node.innerHTML = '<td colspan="2"></td>'; // phpbb2 must have a cell as the child node
 
  for (; i < j; i++) {
   
    if ((version ? post[i] : post[i].firstChild).style.backgroundColor) { // thanked posts have the backgroundColor style property
     
      post[i].className += ' thanked'; // mark the thanked post with a class
      (version ? node : node.firstChild).innerHTML = message(['.name', 'dl > dt > strong', '.username', '.popmenubutton'][version], post[i]); // thanks message
     
      switch (version) {
       
        case 0 : // phpbb2
          node.firstChild.style.backgroundColor = post[i].firstChild.style.backgroundColor;
          node.firstChild.className = post[i].firstChild.className;
          post[i].parentNode.insertBefore(node, post[i].nextSibling);
          break;
         
        case 1 : // phpbb3
          post[i].firstChild.insertBefore(node, post[i].firstChild.lastChild.previousSibling);
          break;
         
        case 2 : // punbb
          node.className = 'postfoot';
          node.style.margin = '0';
          post[i].appendChild(node);
          break;
         
        case 3 : // invision
          node.className = 'post-footer';
          node.style.backgroundColor = post[i].style.backgroundColor;
          post[i].appendChild(node);
          break;
       
      }
     
      break; // break out of the for loop when the thanked post is found
    }
   
  }
});

CSS
Code:
#fa_thanks_message {
  color:#280;
  font-size:13px;
  font-weight:bold;
  text-align:center;
  background-color:#5DF213;
  border:1px solid #2CE823;
  border-radius:6px;
  padding:6px;
  margin:6px 0;
  position:relative;
  left:calc( 50% - 150px );
  width: 400px;
}
 
#fa_thanks_message img { vertical-align:middle }
.marquee a {
  word-break:break-word;
}


Last edited by smurfavr on January 20th 2017, 12:04 am; edited 1 time in total
avatar
smurfavr
Active Poster

Male Posts : 1693
Reputation : 17
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: Add a message to thanked posts

Post by SLGray on January 19th 2017, 7:17 am

Sorry, but I do not understand your question.

Is it not working for you?


When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.

avatar
SLGray
Administrator
Administrator

Male Posts : 43672
Reputation : 3104
Language : English
Location : United States

http://fmthemesdesignteam.forumotion.com/

Back to top Go down

Solved Re: Add a message to thanked posts

Post by smurfavr on January 19th 2017, 12:15 pm

Everything works.

Can it change the caption when pressed some button thanks. Now it appears the name of the author of the topic. I want to appear the name of the one who pressed the button thank you.
avatar
smurfavr
Active Poster

Male Posts : 1693
Reputation : 17
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: Add a message to thanked posts

Post by SLGray on January 19th 2017, 9:34 pm

The author of the topic would be the only one who sees the thanks buttons in the replies of the topic.  Because of this, the code is already set up to display the person who clicks the thanks button.


When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.

avatar
SLGray
Administrator
Administrator

Male Posts : 43672
Reputation : 3104
Language : English
Location : United States

http://fmthemesdesignteam.forumotion.com/

Back to top Go down

Solved Re: Add a message to thanked posts

Post by APE on January 20th 2017, 8:51 pm

Problem solved & topic archived.
Please read our forum rules: ESF General Rules



avatar
APE
Administrator
Administrator

Male Posts : 12480
Reputation : 1305
Language : fluent in dork / mumbojumbo & English haha

http://chatworld.forumotion.co.uk/

Back to top Go down

Back to top


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