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.

Make auto solved

4 posters

Go down

Solved Make auto solved

Post by Luis Ferreira 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
avatar
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 November 14th 2015, 10:33 pm

So that JavaScript is not working?


Make auto solved  Slgray10

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

Male Posts : 51569
Reputation : 3525
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Solved Re: Make auto solved

Post by Luis Ferreira 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
avatar
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 November 14th 2015, 11:29 pm

Where did you get the JavaScript?


Make auto solved  Slgray10

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

Male Posts : 51569
Reputation : 3525
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Solved Re: Make auto solved

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

in a post here
avatar
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 November 14th 2015, 11:40 pm

Could you please post the link to the topic?


Make auto solved  Slgray10

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

Male Posts : 51569
Reputation : 3525
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Solved Re: Make auto solved

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

i saw so many post ... idk men
avatar
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 November 16th 2015, 10:59 am

Bump
avatar
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 November 20th 2015, 12:08 pm

Can you say something ? like oh i dont know or im trying to fix or it is impossible
avatar
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 November 20th 2015, 12:10 pm

Maybe @Ange Tuteur can help you.


Make auto solved  Slgray10

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

Male Posts : 51569
Reputation : 3525
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Solved Re: Make auto solved

Post by Ange Tuteur 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
Ange Tuteur
Forumaster

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

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Make auto solved

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

the name i gaved was done so de id is "done" ? or how i see it ?
avatar
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 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 :
Make auto solved  Captur14
Ange Tuteur
Ange Tuteur
Forumaster

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

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Make auto solved

Post by Luis Ferreira 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

Make auto solved  110

Make auto solved  211

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
avatar
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 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 


Make auto solved  Sem_ty12
avatar
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 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
Ange Tuteur
Forumaster

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

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Make auto solved

Post by Luis Ferreira 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';
});
avatar
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 November 23rd 2015, 9:03 pm

Is this solved?


Make auto solved  Slgray10

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

Male Posts : 51569
Reputation : 3525
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Solved Re: Make auto solved

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

yes it is
avatar
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 November 23rd 2015, 10:32 pm

Topic solved and archived ~ brandon_g


Make auto solved  Brando10
Remember to mark your topic Make auto solved  Solved15 when a solution is found.
General Rules | Tips & Tricks | FAQ | Forgot Founder Password?

Make auto solved  Scre1476
Team Leader
Review Section Rules | Request A Review | Sticker Points
brandon_g
brandon_g
Manager
Manager

Male Posts : 10113
Reputation : 923
Language : English
Location : USA

https://www.broadcastingduo.com

Back to top Go down

Back to top

- Similar topics

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