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.

Script RESOLVED problems

4 posters

Go down

Solved Script RESOLVED problems

Post by Avedo March 28th 2016, 1:22 pm

Hi,

Thanks to this code @Ange Tuteur provided, we were just wondering if there's anyway to change the script so instead of it adding an icon next the topic icon it will change the topic title to [RESOLVED] Topic title text.

How do i restrict it so it's only available for one category, for example, it only appears in the "Ask questions" section of the forum and nowhere else. & As soon as the button has been pressed it disappears and they can't click it again?

Here's a picture of an example
Script RESOLVED problems 2016-013

Here's the code Ange provided:

Code:
$(function() {
  window.$fa_solved = {
 
    icon : {
      id : 2
    },
 
    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 : $('div.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('main-content'), post = $('div.post', main)[0], author = $('.postprofile 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';
});


Last edited by Avedo on April 2nd 2016, 7:45 pm; edited 2 times in total
Avedo
Avedo
Forumember

Posts : 39
Reputation : 1
Language : English

http://forum.avedoofficial.com

Back to top Go down

Solved Re: Script RESOLVED problems

Post by Avedo March 29th 2016, 2:18 pm

Bump


Last edited by Avedo on March 30th 2016, 9:27 pm; edited 1 time in total
Avedo
Avedo
Forumember

Posts : 39
Reputation : 1
Language : English

http://forum.avedoofficial.com

Back to top Go down

Solved Re: Script RESOLVED problems

Post by Avedo March 30th 2016, 9:27 pm

Bump
Avedo
Avedo
Forumember

Posts : 39
Reputation : 1
Language : English

http://forum.avedoofficial.com

Back to top Go down

Solved Re: Script RESOLVED problems

Post by SLGray March 30th 2016, 10:22 pm

Is this solved?


Script RESOLVED problems 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 : 51482
Reputation : 3519
Language : English
Location : United States

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

Back to top Go down

Solved Re: Script RESOLVED problems

Post by Avedo March 30th 2016, 10:26 pm

No it's not.

Edit: We've changed the topic title to stop confusion.
Avedo
Avedo
Forumember

Posts : 39
Reputation : 1
Language : English

http://forum.avedoofficial.com

Back to top Go down

Solved Re: Script RESOLVED problems

Post by SLGray March 30th 2016, 10:34 pm

AP > General > Messages & Emails > Configuration
Topics Section
Allow the modification of the topic title: Yes
Display button [solved]: Yes


Script RESOLVED problems 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 : 51482
Reputation : 3519
Language : English
Location : United States

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

Back to top Go down

Solved Re: Script RESOLVED problems

Post by Avedo March 30th 2016, 10:37 pm

I already knew how to do that, I was wondering if it was possible to re code the script so when you press the "Mark solved" button it adds the [SOLVED] text to the topic title.

Like on the photo.
Avedo
Avedo
Forumember

Posts : 39
Reputation : 1
Language : English

http://forum.avedoofficial.com

Back to top Go down

Solved Re: Script RESOLVED problems

Post by Ange Tuteur April 1st 2016, 5:18 pm

Hi,

Try replacing the script with this :
Code:
$(function() {
  if (!/43/.test($('.topic-actions:first .pathname-box a:last', main).attr('href'))) return;

  window.$fa_solved = {
 
    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 : $('div.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('main-content'), post = $('div.post', main)[0], author = $('.postprofile 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('[RESOLVED]' + $('input[name="subject"]', d)[0].value) + '&message=' + $fa_solved.encode($('#text_editor_textarea', d)[0].value) + '&p=' + $fa_solved.post_id + '&mode=editpost&auth[]=' + auth[0].value + '&auth[]=' + auth[1].value + '&post=1', function() {
        t.innerHTML = $fa_solved.lang.marked;
        t.className += ' marked';
        $('.topic-title a').each(function() {
          this.innerHTML = '[RESOLVED]' + this.innerHTML;
        })
      });
    });
 
    return false;
  };
 
  main.insertBefore(button, main.firstChild);
  'par ange tuteur';
});

At the top you'll see this snippet :
Code:
if (!/43/.test($('.topic-actions:first .pathname-box a:last', main).attr('href'))) return;
Replace the number "43" with the id of the forum you want this script to work in. You can see the forum id via the URL : https://help.forumotion.com/f43-scripts-coding-problems
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: Script RESOLVED problems

Post by Avedo April 2nd 2016, 6:29 pm

Hello @Ange Tuteur How would we make the [RESOLVED] text green like the image we provided?
Avedo
Avedo
Forumember

Posts : 39
Reputation : 1
Language : English

http://forum.avedoofficial.com

Back to top Go down

Solved Re: Script RESOLVED problems

Post by Ange Tuteur April 2nd 2016, 6:44 pm

You would need a script which finds all links that contain the texts "[RESOLVED]" and replace the html content to wrap it with tags. See this topic :
https://help.forumotion.com/t133869-style-topic-title-keywords
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: Script RESOLVED problems

Post by Avedo April 2nd 2016, 7:44 pm

This seems rather difficult, so we're going to leave that one out xD Thank you kindly for the help Ange! Smile
Avedo
Avedo
Forumember

Posts : 39
Reputation : 1
Language : English

http://forum.avedoofficial.com

Back to top Go down

Solved Re: Script RESOLVED problems

Post by Ape April 2nd 2016, 8:40 pm

Topic solved and archived


Script RESOLVED problems Left1212Script RESOLVED problems Center11Script RESOLVED problems Right112
Script RESOLVED problems Ape_b110
Script RESOLVED problems Ape1010
Ape
Ape
Administrator
Administrator

Male Posts : 19109
Reputation : 1991
Language : fluent in dork / mumbojumbo & English haha

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

Back to top Go down

Back to top

- Similar topics

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