Quote:
Originally Posted by ddr
i've installed this hack, but... can you optimize code to use 1 predefined js function depending on the post id, instead of using
Code:
<script type="text/javascript">
<!--
function post_thanks_give_57255()
{
fetch_object('post_thanks_button_57255').style.display = 'none'
do_thanks_add = new vB_AJAX_Handler(true)
do_thanks_add.onreadystatechange(thanks_add_Done_57255)
do_thanks_add.send('showthread.php?do=post_thanks_add_ajax&p=57255')
}
function thanks_add_Done_57255()
{
if (do_thanks_add.handler.readyState == 4 && do_thanks_add.handler.status == 200)
{
fetch_object('post_thanks_box_57255').innerHTML = do_thanks_add.handler.responseText
}
}
function post_thanks_remove_all_57255()
{
do_thanks_remove_all = new vB_AJAX_Handler(true)
do_thanks_remove_all.onreadystatechange(thanks_remove_all_Done_57255)
do_thanks_remove_all.send('showthread.php?do=post_thanks_remove_all_ajax&p=57255')
fetch_object('post_thanks_button_57255').style.display = ''
}
function thanks_remove_all_Done_57255()
{
if (do_thanks_remove_all.handler.readyState == 4 && do_thanks_remove_all.handler.status == 200)
{
fetch_object('post_thanks_box_57255').innerHTML = do_thanks_remove_all.handler.responseText
}
}
function post_thanks_remove_user_57255()
{
do_thanks_remove_user = new vB_AJAX_Handler(true)
do_thanks_remove_user.onreadystatechange(thanks_remove_user_Done_57255)
do_thanks_remove_user.send('showthread.php?do=post_thanks_remove_user_ajax&p=57255')
fetch_object('post_thanks_button_57255').style.display = ''
}
function thanks_remove_user_Done_57255()
{
if (do_thanks_remove_user.handler.readyState == 4 && do_thanks_remove_user.handler.status == 200)
{
fetch_object('post_thanks_box_57255').innerHTML = do_thanks_remove_user.handler.responseText
}
}
//-->
</script>
for EVERY post?
|
I need to learn how to use prototype first. I've tried but failed so far.