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
Here's the code Ange provided:
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
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