/** * * Thanks Plugin * Developed by SaeedGH (SaeedGhMail@Gmail.com) * www.mybbhelp.ir * Fixed code for MyBB 1.8 by Glover (http://cqpolska.pl) * */ var pid=-1; var spinner=null; var my_spinner = { content: '
', show: function (){ $("body").append(my_spinner.content); return true; }, destroy: function (){ $("#my_spinner").remove(); return false;} }; function thx_common(xml) { // xml=$.parseXML(xml); <-- jeśli dane nie są przesłane w formacie xml, to należy użyć tej linii try { remove=xml.getElementsByTagName('del').item(0).firstChild.data=="1"; lin=document.getElementById('a'+pid); if (remove) { table = document.getElementById('thx' + pid); table.style.display = xml.getElementsByTagName('display').item(0).firstChild.data != 0 ? '' : 'none'; list = document.getElementById('thx_list' + pid); list.innerHTML = xml.getElementsByTagName('list').item(0).firstChild.data; img = document.getElementById('i' + pid); img.src = xml.getElementsByTagName('image').item(0).firstChild.data; } else { lin.innerHTML=""; lin.onclick=null; lin.href=""; lin = null; } } catch(err) { alert("an Error had occured please contact administrator") alert(err); } finally { spinner=my_spinner.destroy(); return lin; } } function thx_action(response) { lin=thx_common(response) if(lin!=null) { lin.onclick= new Function("","return rthx("+pid+");"); lin.href='showthread.php?action=remove_thank&pid='+pid; } } function rthx_action(response) { lin=thx_common(response) if (lin!=null) { lin.onclick = new Function("", "return thx(" + pid + ");"); lin.href = 'showthread.php?action=thank&pid=' + pid; } } function thx(id) { if(spinner) return false; my_spinner.show(); pid=id; pb="pid="+pid; $.ajax('xmlhttp.php?action=thankyou',{type: 'post',data:pb, success: thx_action}); return false; } function rthx(id) { if(spinner) return false; my_spinner.show(); pid=id; b="pid="+pid; $.ajax('xmlhttp.php?action=remove_thankyou',{type: 'post',data:b, success: rthx_action}); return false; }