The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Make auto solved

View previous topic View next topic Go down

Solved Make auto solved

Post by Luis Ferreira on November 14th 2015, 8:52 pm

Forum version : Phpbb2
Position : Administrator 
Concerned browser(s) : Google Chrome 
Who the problem concerns : all
Forum link : http://gamemunity.team-talk.net/




i have a button called "Mark solved" how i can do it to make auto solved when pressed like this forum ?



Code:
$(function() {
  var icon_id = 2,
        notice_msg = '<img src=http://oi65.tinypic.com/1051e8w.jpg height=20 style=vertical-align:middle> Help organize the forum if your question has been resolved click solved',
      button_icon = '<img src=http://oi65.tinypic.com/1051e8w.jpg>',
 
      postbody = $('.postbody')[0],
      edit, icon;
 
  if (postbody) {
    edit = $(postbody).closest('.post').find('.i_icon_edit')[0];
 
    if (edit) {
      $('#page-body').prepend('<div style="background:#000000;border:1px color:#545252;padding:5px;color:#FFFFFF;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();
    }
  }
});


Last edited by Luis Ferreira on November 23rd 2015, 3:09 pm; edited 1 time in total

Luis Ferreira
Forumember

Posts : 53
Reputation : 1
Language : Poruguese

http://gamemunity.team-talk.net/

Back to top Go down

Solved Re: Make auto solved

Post by SLGray on November 14th 2015, 10:33 pm

So that JavaScript is not working?


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


SLGray
Administrator
Administrator

Male Posts : 36697
Reputation : 2445
Language : English
Location : United States

http://ztwds.forumotion.com/

Back to top Go down

Solved Re: Make auto solved

Post by Luis Ferreira on November 14th 2015, 11:14 pm

it works but when i press the button goes to edit and i want to make it aproved by him self

Luis Ferreira
Forumember

Posts : 53
Reputation : 1
Language : Poruguese

http://gamemunity.team-talk.net/

Back to top Go down

Solved Re: Make auto solved

Post by SLGray on November 14th 2015, 11:29 pm

Where did you get the JavaScript?


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


SLGray
Administrator
Administrator

Male Posts : 36697
Reputation : 2445
Language : English
Location : United States

http://ztwds.forumotion.com/

Back to top Go down

Solved Re: Make auto solved

Post by Luis Ferreira on November 14th 2015, 11:31 pm

in a post here

Luis Ferreira
Forumember

Posts : 53
Reputation : 1
Language : Poruguese

http://gamemunity.team-talk.net/

Back to top Go down

Solved Re: Make auto solved

Post by SLGray on November 14th 2015, 11:40 pm

Could you please post the link to the topic?


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


SLGray
Administrator
Administrator

Male Posts : 36697
Reputation : 2445
Language : English
Location : United States

http://ztwds.forumotion.com/

Back to top Go down

Solved Re: Make auto solved

Post by Luis Ferreira on November 15th 2015, 12:39 am

i saw so many post ... idk men

Luis Ferreira
Forumember

Posts : 53
Reputation : 1
Language : Poruguese

http://gamemunity.team-talk.net/

Back to top Go down

Solved Re: Make auto solved

Post by Luis Ferreira on November 16th 2015, 10:59 am

Bump

Luis Ferreira
Forumember

Posts : 53
Reputation : 1
Language : Poruguese

http://gamemunity.team-talk.net/

Back to top Go down

Solved Re: Make auto solved

Post by Luis Ferreira on November 20th 2015, 12:08 pm

Can you say something ? like oh i dont know or im trying to fix or it is impossible

Luis Ferreira
Forumember

Posts : 53
Reputation : 1
Language : Poruguese

http://gamemunity.team-talk.net/

Back to top Go down

Solved Re: Make auto solved

Post by SLGray on November 20th 2015, 12:10 pm

Maybe @Ange Tuteur can help you.


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


SLGray
Administrator
Administrator

Male Posts : 36697
Reputation : 2445
Language : English
Location : United States

http://ztwds.forumotion.com/

Back to top Go down

Solved Re: Make auto solved

Post by Ange Tuteur on November 20th 2015, 1:19 pm

Hi,

Try adding the following script to your JavaScripts.
Modules > JavaScript codes management > New

Placement : In the topics
Code:
$(function() {
  window.$fa_solved = {
   
    icon : {
      id : 3
    },
   
    lang : {
      mark : '<i class="fa"></i> Mark Solved',
      mark_title : 'Marking your topic with the Solved icon will let staff know your problem has been resolved.',
      mark_title_mod : 'Mark this topic Solved',
      marking : '<i class="fa fa-spin"></i> Marking...',
      marked : '<i class="fa"></i> Solved !'
    },
   
    post_id : $('tr.post')[0].id.slice(1),
   
    encode : function(string) {
      return encodeURIComponent(escape(string).replace(/%u[A-F0-9]{4}/g, function(match) {
        return '&#' + parseInt(match.substr(2), 16) + ';';
      })).replace(/%25/g, '%');
    }
   
  };
 
  var main = document.getElementById('page-body'), post = $('tr.post', main)[0], author = $('.poster-profile a[href^="/u"]', post).text(), mod = $('.i_icon_ip', post)[0], button = document.createElement('A');
 
  if (!mod && author != _userdata.username) return;
 
  button.innerHTML = $fa_solved.lang.mark;
  button.title = mod ? $fa_solved.mark_title_mod : $fa_solved.mark_title;
  button.className = 'button1 markSolved';
  button.href = '#';
 
  button.onclick = function() {
    var t = this;
    t.innerHTML = $fa_solved.lang.marking;
    t.removeAttribute('title');
    t.onclick = function() { return false };
   
    $.get('/post?p=' + $fa_solved.post_id + '&mode=editpost', function(d) {
      var auth = $('input[name="auth[]"]', d);
      $.post('/post', 'subject=' + $fa_solved.encode($('input[name="subject"]', d)[0].value) + '&message=' + $fa_solved.encode($('#text_editor_textarea', d)[0].value) + '&p=' + $fa_solved.post_id + '&post_icon=' + $fa_solved.icon.id + '&mode=editpost&auth[]=' + auth[0].value + '&auth[]=' + auth[1].value + '&post=1', function() {
        t.innerHTML = $fa_solved.lang.marked;
        t.className += ' marked';
      });
    });
   
    return false;
  };
 
  main.insertBefore(button, main.firstChild);
  'par ange tuteur';
});

Make sure to replace the 3 in
Code:
id : 3
with the ID of your solved icon. Also, this script was originally meant for phpbb3, so if there are any problems let me know.

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Make auto solved

Post by Luis Ferreira on November 20th 2015, 4:06 pm

the name i gaved was done so de id is "done" ? or how i see it ?

Luis Ferreira
Forumember

Posts : 53
Reputation : 1
Language : Poruguese

http://gamemunity.team-talk.net/

Back to top Go down

Solved Re: Make auto solved

Post by Ange Tuteur on November 20th 2015, 4:09 pm

You can see the id by opening your Devtools ( F12 ) and going to the DOM inspector. Then proceed to select an element from the page and hover over your solved icon's radio button. The number will be at the end, "6" in this example :

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Make auto solved

Post by Luis Ferreira on November 21st 2015, 12:05 pm

Code:
$(function() {
  window.$fa_solved = {
  
    icon : {
      id : "post_icon_1"
    },
  
    lang : {
      mark : '<i class="fa"></i> Mark Solved',
      mark_title : 'Marking your topic with the Solved icon will let staff know your problem has been resolved.',
      mark_title_mod : 'Mark this topic Solved',
      marking : '<i class="fa fa-spin"></i> Marking...',
      marked : '<i class="fa"></i> Solved !'
    },
  
    post_id : $('tr.post')[0].id.slice(1),
  
    encode : function(string) {
      return encodeURIComponent(escape(string).replace(/%u[A-F0-9]{4}/g, function(match) {
        return '&#' + parseInt(match.substr(2), 16) + ';';
      })).replace(/%25/g, '%');
    }
  
  };
 
  var main = document.getElementById('page-body'), post = $('tr.post', main)[0], author = $('.poster-profile a[href^="/u"]', post).text(), mod = $('.i_icon_ip', post)[0], button = document.createElement('A');
 
  if (!mod && author != _userdata.username) return;
 
  button.innerHTML = $fa_solved.lang.mark;
  button.title = mod ? $fa_solved.mark_title_mod : $fa_solved.mark_title;
  button.className = 'button1 markSolved';
  button.href = '#';
 
  button.onclick = function() {
    var t = this;
    t.innerHTML = $fa_solved.lang.marking;
    t.removeAttribute('title');
    t.onclick = function() { return false };
  
    $.get('/post?p=' + $fa_solved.post_id + '&mode=editpost', function(d) {
      var auth = $('input[name="auth[]"]', d);
      $.post('/post', 'subject=' + $fa_solved.encode($('input[name="subject"]', d)[0].value) + '&message=' + $fa_solved.encode($('#text_editor_textarea', d)[0].value) + '&p=' + $fa_solved.post_id + '&post_icon=' + $fa_solved.icon.id + '&mode=editpost&auth[]=' + auth[0].value + '&auth[]=' + auth[1].value + '&post=1', function() {
        t.innerHTML = $fa_solved.lang.marked;
        t.className += ' marked';
      });
    });
  
    return false;
  };
 
  main.insertBefore(button, main.firstChild);
  'par ange tuteur';
});

so i have this but doesnt seems to work properly sorry Sad





as you can see it have a infinit "marking..." and sometimes it bugs all the post and then i refresh and its ok but it doestn work properly

Luis Ferreira
Forumember

Posts : 53
Reputation : 1
Language : Poruguese

http://gamemunity.team-talk.net/

Back to top Go down

Solved Re: Make auto solved

Post by Luis Ferreira on November 23rd 2015, 11:40 am

Now it say solved but no image appears on there or in the topics selection as you can see 



Luis Ferreira
Forumember

Posts : 53
Reputation : 1
Language : Poruguese

http://gamemunity.team-talk.net/

Back to top Go down

Solved Re: Make auto solved

Post by Ange Tuteur on November 23rd 2015, 1:49 pm

In your script, change
Code:
id : "post_icon_1"
to
Code:
id : 1
.

The id must be an integer, not a DOM id.

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Make auto solved

Post by Luis Ferreira on November 23rd 2015, 3:09 pm

thanks that worked Very Happy btw i made some changes to add a image instead of a text.

Code:
$(function() {
  window.$fa_solved = {
  
    icon : {
      id : 1
    },
  
    lang : {
      mark : '<i class="fa"></i> <img src=imageurl>',
      mark_title : 'Marking your topic with the Solved icon will let staff know your problem has been resolved.',
      mark_title_mod : 'Mark this topic Solved',
      marking : '<i class="fa fa-spin"></i> <img src=imageurl>,
      marked : '<i class="fa"></i><img src= imageurl>'
    },
  
    post_id : $('tr.post')[0].id.slice(1),
  
    encode : function(string) {
      return encodeURIComponent(escape(string).replace(/%u[A-F0-9]{4}/g, function(match) {
        return '&#' + parseInt(match.substr(2), 16) + ';';
      })).replace(/%25/g, '%');
    }
  
  };
 
  var main = document.getElementById('page-body'), post = $('tr.post', main)[0], author = $('.poster-profile a[href^="/u"]', post).text(), mod = $('.i_icon_ip', post)[0], button = document.createElement('A');
 
  if (!mod && author != _userdata.username) return;
 
  button.innerHTML = $fa_solved.lang.mark;
  button.title = mod ? $fa_solved.mark_title_mod : $fa_solved.mark_title;
  button.className = 'button1 markSolved';
  button.href = '#';
 
  button.onclick = function() {
    var t = this;
    t.innerHTML = $fa_solved.lang.marking;
    t.removeAttribute('title');
    t.onclick = function() { return false };
  
    $.get('/post?p=' + $fa_solved.post_id + '&mode=editpost', function(d) {
      var auth = $('input[name="auth[]"]', d);
      $.post('/post', 'subject=' + $fa_solved.encode($('input[name="subject"]', d)[0].value) + '&message=' + $fa_solved.encode($('#text_editor_textarea', d)[0].value) + '&p=' + $fa_solved.post_id + '&post_icon=' + $fa_solved.icon.id + '&mode=editpost&auth[]=' + auth[0].value + '&auth[]=' + auth[1].value + '&post=1', function() {
        t.innerHTML = $fa_solved.lang.marked;
        t.className += ' marked';
      });
    });
  
    return false;
  };
 
  main.insertBefore(button, main.firstChild);
  'par ange tuteur';
});

Luis Ferreira
Forumember

Posts : 53
Reputation : 1
Language : Poruguese

http://gamemunity.team-talk.net/

Back to top Go down

Solved Re: Make auto solved

Post by SLGray on November 23rd 2015, 9:03 pm

Is this solved?


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


SLGray
Administrator
Administrator

Male Posts : 36697
Reputation : 2445
Language : English
Location : United States

http://ztwds.forumotion.com/

Back to top Go down

Solved Re: Make auto solved

Post by Luis Ferreira on November 23rd 2015, 9:24 pm

yes it is

Luis Ferreira
Forumember

Posts : 53
Reputation : 1
Language : Poruguese

http://gamemunity.team-talk.net/

Back to top Go down

Solved Re: Make auto solved

Post by brandon_g on November 23rd 2015, 10:32 pm

Topic solved and archived ~ brandon_g


Remember to mark your topic when a solution is found.

brandon_g
Support Moderator
Support Moderator

Male Posts : 5355
Reputation : 489
Language : English
Location : USA

http://broadcastingduo.forumotion.com/

Back to top Go down

View previous topic View next topic Back to top


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