YOUAREtehSCENE Posted March 26, 2010 Share Posted March 26, 2010 <!-- AJAX Thanks --> <script type="text/javascript"> <!-- /** * Initialize Variables */ var thanks_postid = 0; var thanks_pending = false; /** * Fetch AJAX'ed Thanks */ function thanks_fetch() { if (typeof vb_disable_ajax != 'undefined' && vb_disable_ajax == 2) { // disable all ajax features return false; } if (thanks_ajax.handler.readyState == 4 && thanks_ajax.handler.status == 200 && thanks_ajax.handler.responseXML) { if (fetch_object('thanks_progress_' + thanks_postid)) { fetch_object('thanks_progress_' + thanks_postid).style.display = 'none'; } // undo pending thanks_pending = false; // fetch status var status = fetch_tags(thanks_ajax.handler.responseXML, 'status')[0].firstChild.nodeValue; // generate html if (status == 'ok') { // ###### wrapper ###### var wrapper_dat = fetch_tags(thanks_ajax.handler.responseXML, 'wrapper')[0].firstChild.nodeValue; var wrapper_obj = fetch_object('thanks_wrapper.' + thanks_postid); wrapper_obj.innerHTML = wrapper_dat; wrapper_obj.style.display = (wrapper_dat.indexOf('::blank::') != -1 ? 'none' : 'block'); // ###### message ###### var message_dat = fetch_tags(thanks_ajax.handler.responseXML, 'message')[0].firstChild.nodeValue; var message_obj = fetch_object('post_message_' + thanks_postid); message_obj.innerHTML = message_dat; // ###### postbit ###### var postbit_dat = fetch_tags(thanks_ajax.handler.responseXML, 'postbit')[0].firstChild.nodeValue; var postbit_obj = fetch_object('thanks_postbit.' + thanks_postid); postbit_obj.innerHTML = postbit_dat; // ###### postbtn ###### var postbtn_dat = fetch_tags(thanks_ajax.handler.responseXML, 'postbtn')[0].firstChild.nodeValue; var postbtn_obj = fetch_object('thanks_postbtn.' + thanks_postid); postbtn_obj.innerHTML = postbtn_dat; } else if (status == 'unregistered') { alert('You must either register or log in before using that function!'); } if (is_ie) { thanks_ajax.handler.abort(); } } } /** * Insert Thanks * * @ param integer id of the post */ function thanks_do(postid) { if (typeof vb_disable_ajax != 'undefined' && vb_disable_ajax == 2) { // disable all ajax features return false; } if (!thanks_pending) { if (fetch_object('thanks_progress_' + postid)) { fetch_object('thanks_progress_' + postid).style.display = ''; } thanks_pending = true; thanks_postid = postid; thanks_ajax = new vB_AJAX_Handler(true); thanks_ajax.onreadystatechange(thanks_fetch); thanks_ajax.send('ajax.php', 'do=thanks&postid=' + postid); } return true; } /** * Insert Thanks * * @ param integer id of the post * @ param integer id of the user to remove (-1 = remove all, permissions are handled on php side) */ function thanks_undo(postid, userid) { if (typeof vb_disable_ajax != 'undefined' && vb_disable_ajax == 2) { // disable all ajax features return false; } if (!thanks_pending) { if (fetch_object('thanks_progress_' + postid)) { fetch_object('thanks_progress_' + postid).style.display = ''; } thanks_pending = true; thanks_postid = postid; thanks_ajax = new vB_AJAX_Handler(true); thanks_ajax.onreadystatechange(thanks_fetch); thanks_ajax.send('ajax.php', 'do=removethanks&postid=' + postid + '&userid=' + userid); } return true; } //--> </script> <!-- / AJAX Thanks --> now, where would I want to insert this code into my site? like in one of my wordpress theme files? if so what one would you suggest, I'd like it so when people click on thanks content would be exposed to them, but if they don't nothing shows and is there any way, where I can have it show what users said thank you. cause I did code my shoutmix chatbox so people wouldn't be called GUEST anymore. code I use the shoutmix code to retrieve usernames from datebase? thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.