Automatic Solved Button working incorrectly
2 posters
Page 1 of 1
Automatic Solved Button working incorrectly
I have the below code for my phpBB2 forum:
The issues are that firstly, when I hover over the Mark as Solved image it states 'undefined', despite the above coding demanding that it says "Marking your topic with the Solved icon will let staff know your problem has been resolved.". Can anyone tell me why that is not working as it should?
Secondly, once I marked a topic as solved, I may leave and then come back to the topic to find that it will show the original 'Mark as Solved' image again, rather than the 'Marked as Solved' image. In other words, it appears as if you can then remark it as solved, whereas in this forum I believe the image simply disappears altogether or remains another image. It does not revert back to the original option.
Finally, can anyone provide a code that could move this entire function to beside the Post Reply button. It looks rather odd hovering up there just under the navbar, as it does at the moment.
Specifically, in this topic I have been testing the javascript.
- Code:
$(function() {
window.$fa_solved = {
icon : {
id : 1
},
lang : {
mark : '<i class="fa"></i><img src=https://i11.servimg.com/u/f11/19/75/78/74/rsz_1111.png>',
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"></i><img src=https://i11.servimg.com/u/f11/19/75/78/74/rsz_1111.png>',
marked : '<i class="fa"></i><img src=https://i11.servimg.com/u/f11/19/75/78/74/rsz_1311.png>'
},
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';
});
The issues are that firstly, when I hover over the Mark as Solved image it states 'undefined', despite the above coding demanding that it says "Marking your topic with the Solved icon will let staff know your problem has been resolved.". Can anyone tell me why that is not working as it should?
Secondly, once I marked a topic as solved, I may leave and then come back to the topic to find that it will show the original 'Mark as Solved' image again, rather than the 'Marked as Solved' image. In other words, it appears as if you can then remark it as solved, whereas in this forum I believe the image simply disappears altogether or remains another image. It does not revert back to the original option.
Finally, can anyone provide a code that could move this entire function to beside the Post Reply button. It looks rather odd hovering up there just under the navbar, as it does at the moment.
Specifically, in this topic I have been testing the javascript.
Re: Automatic Solved Button working incorrectly
Never mind, there is something wrong with the code and I think it's cause you are using phpbb2 when the code is made for phpbb3. I know it says it should work for phpbb2, which theory it does, it's just not going to work fully.
Re: Automatic Solved Button working incorrectly
Just to update whoever may be interesting in helping on the issue. Draxion kindly attempted to fix the code but for some reason, it didn't change much; the image of the button keeps reverting back to the original 'Mark As Solved' image, rather than keeping the 'Marked as Solved' image, or disappearing altogether which would be preferred.
Furthermore, if anyone has a code which can move it down to beside the Post Reply button that would be great.
The hover wording has been fixed.
Furthermore, if anyone has a code which can move it down to beside the Post Reply button that would be great.
The hover wording has been fixed.
Similar topics
» Solved button isnt working
» Solved button in English forum is not working?
» Automatic Form Code Not Working
» Post an automatic message on click of a "thanks" button
» How do I add a solved Button like on here?
» Solved button in English forum is not working?
» Automatic Form Code Not Working
» Post an automatic message on click of a "thanks" button
» How do I add a solved Button like on here?
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum