Make auto solved  Hitskin_logo Hitskin.com

This is a Hitskin.com skin preview
Install the skinReturn to the skin page

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.
4 posters

    Make auto solved

    avatar
    Luis Ferreira
    Forumember


    Posts : 53
    Reputation : 1
    Language : Poruguese

    Solved Make auto solved

    Post by Luis Ferreira Sat 14 Nov - 21:52

    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 Mon 23 Nov - 16:09; edited 1 time in total
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51498
    Reputation : 3523
    Language : English
    Location : United States

    Solved Re: Make auto solved

    Post by SLGray Sat 14 Nov - 23:33

    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.
    avatar
    Luis Ferreira
    Forumember


    Posts : 53
    Reputation : 1
    Language : Poruguese

    Solved Re: Make auto solved

    Post by Luis Ferreira Sun 15 Nov - 0:14

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


    Male Posts : 51498
    Reputation : 3523
    Language : English
    Location : United States

    Solved Re: Make auto solved

    Post by SLGray Sun 15 Nov - 0:29

    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.
    avatar
    Luis Ferreira
    Forumember


    Posts : 53
    Reputation : 1
    Language : Poruguese

    Solved Re: Make auto solved

    Post by Luis Ferreira Sun 15 Nov - 0:31

    in a post here
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51498
    Reputation : 3523
    Language : English
    Location : United States

    Solved Re: Make auto solved

    Post by SLGray Sun 15 Nov - 0:40

    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.
    avatar
    Luis Ferreira
    Forumember


    Posts : 53
    Reputation : 1
    Language : Poruguese

    Solved Re: Make auto solved

    Post by Luis Ferreira Sun 15 Nov - 1:39

    i saw so many post ... idk men
    avatar
    Luis Ferreira
    Forumember


    Posts : 53
    Reputation : 1
    Language : Poruguese

    Solved Re: Make auto solved

    Post by Luis Ferreira Mon 16 Nov - 11:59

    Bump
    avatar
    Luis Ferreira
    Forumember


    Posts : 53
    Reputation : 1
    Language : Poruguese

    Solved Re: Make auto solved

    Post by Luis Ferreira Fri 20 Nov - 13:08

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


    Male Posts : 51498
    Reputation : 3523
    Language : English
    Location : United States

    Solved Re: Make auto solved

    Post by SLGray Fri 20 Nov - 13:10

    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.
    Ange Tuteur
    Ange Tuteur
    Forumaster


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

    Solved Re: Make auto solved

    Post by Ange Tuteur Fri 20 Nov - 14:19

    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.
    avatar
    Luis Ferreira
    Forumember


    Posts : 53
    Reputation : 1
    Language : Poruguese

    Solved Re: Make auto solved

    Post by Luis Ferreira Fri 20 Nov - 17:06

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


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

    Solved Re: Make auto solved

    Post by Ange Tuteur Fri 20 Nov - 17:09

    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
    avatar
    Luis Ferreira
    Forumember


    Posts : 53
    Reputation : 1
    Language : Poruguese

    Solved Re: Make auto solved

    Post by Luis Ferreira Sat 21 Nov - 13:05

    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

    Solved Re: Make auto solved

    Post by Luis Ferreira Mon 23 Nov - 12:40

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


    Make auto solved  Sem_ty12
    Ange Tuteur
    Ange Tuteur
    Forumaster


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

    Solved Re: Make auto solved

    Post by Ange Tuteur Mon 23 Nov - 14:49

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

    The id must be an integer, not a DOM id.
    avatar
    Luis Ferreira
    Forumember


    Posts : 53
    Reputation : 1
    Language : Poruguese

    Solved Re: Make auto solved

    Post by Luis Ferreira Mon 23 Nov - 16:09

    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';
    });
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51498
    Reputation : 3523
    Language : English
    Location : United States

    Solved Re: Make auto solved

    Post by SLGray Mon 23 Nov - 22:03

    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.
    avatar
    Luis Ferreira
    Forumember


    Posts : 53
    Reputation : 1
    Language : Poruguese

    Solved Re: Make auto solved

    Post by Luis Ferreira Mon 23 Nov - 22:24

    yes it is
    brandon_g
    brandon_g
    Manager
    Manager


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

    Solved Re: Make auto solved

    Post by brandon_g Mon 23 Nov - 23:32

    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