Thread: Show Thread Enhancements - [AJAX] Post Thank You Hack
View Single Post
  #2771  
Old 07-18-2012, 07:32 AM
Sarteck's Avatar
Sarteck Sarteck is offline
 
Join Date: Mar 2008
Posts: 304
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ForceHSS View Post
Why not have it on the one domain like all other forums. Well the problem could be because of ur setup. I am sure with a bit of recoding you can fix
...because it's how I have my forum set up...? O.o

You do realize that vBulletin 4.1+ allows for subdomains to separate blogs, forums, and CMS, yeah?





ANYways, back to the issue.

I altered the post_thanks.js to have the following function changed:
Code:
var post_thanks_handleFailure = function(o)
{
	if(o.responseText !== undefined)
	{
		alert(o.responseText);
	}
	else {console.debug("Here is the request object (failed): %o", o);}
}
When debugging, the response I get is:

Code:
Here is the request object (failed): Object { tId=1, status=0, statusText="communication failure"}






Ah, fixed it.





That new post_thanks.php that I put up in my forums stub directory, I put that back in, and THEN I prefixed the "sUrl" in each of the three functions with PATHS.forum+'/'. (Full code will follow at the end of this post.)

Thanks is now working just fine.










Code:
/*======================================*\
|| #################################### ||
|| # Post Thank You Hack version 7.84 # ||
|| # Original version by Abe1         # ||
|| # Updated by Forcehss              # ||
|| #################################### ||
\*======================================*/
var post_thanks_base_url = PATHS.forum+'/';
var post_thanks_handleSuccess = function(o)
{
	if(o.responseText !== undefined)
	{
		if (post_thanks_callback.object_name[o.tId] !== undefined)
		{
			fetch_object(post_thanks_callback.object_name[o.tId]).innerHTML = o.responseText;
		}
	}
}
var post_thanks_handleFailure = function(o)
{
	if(o.responseText !== undefined)
	{
		alert(o.responseText);
	}
	else {console.debug("Here is the request object (failed): %o", o);}
}
var post_thanks_callback =
{
	success: post_thanks_handleSuccess,
	failure: post_thanks_handleFailure,
	timeout: vB_Default_Timeout,
	cache: false,
	object_name: new Array()
};
function post_thanks_give(postid, integrate)
{
	fetch_object('post_thanks_button_' + postid).style.display = 'none';
	fetch_object('post_thanks_separator_' + postid).style.display = 'none';

	if (integrate == true)
	{
		fetch_object('post_groans_button_' + postid).style.display = 'none';
	}

	var sUrl = post_thanks_base_url + 'post_thanks.php';
	var postData = 'do=post_thanks_add&using_ajax=1&p=' + postid + '&securitytoken=' + SECURITYTOKEN;

	var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, post_thanks_callback, postData);

	post_thanks_callback.object_name[request.tId] = 'post_thanks_box_' + postid;

	fetch_object('post_thanks_box_' + postid).style.display = '';

	return false;
}
function post_thanks_remove_all(postid, integrate)
{
	var sUrl = post_thanks_base_url + 'post_thanks.php';
	var postData = 'do=post_thanks_remove_all&using_ajax=1&p=' + postid + '&securitytoken=' + SECURITYTOKEN;

	var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, post_thanks_callback, postData);

	post_thanks_callback.object_name[request.tId] = 'post_thanks_box_' + postid;

	fetch_object('post_thanks_button_' + postid).style.display = ''
	fetch_object('post_thanks_separator_' + postid).style.display = '';

	if (integrate == true)
	{
		fetch_object('post_groans_button_' + postid).style.display = '';
	}

	fetch_object('post_thanks_box_' + postid).style.display = 'none';

	return false;
}
function post_thanks_remove_user(postid, integrate)
{
	var sUrl = post_thanks_base_url + 'post_thanks.php';
	var postData = 'do=post_thanks_remove_user&using_ajax=1&p=' + postid + '&securitytoken=' + SECURITYTOKEN;

	var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, post_thanks_callback, postData);

	post_thanks_callback.object_name[request.tId] = 'post_thanks_box_' + postid;

	fetch_object('post_thanks_button_' + postid).style.display = ''
	fetch_object('post_thanks_separator_' + postid).style.display = '';

	if (integrate == true)
	{
		fetch_object('post_groans_button_' + postid).style.display = '';
	}

	fetch_object('post_thanks_box_' + postid).style.display = 'none';

	return false;	
}
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01085 seconds
  • Memory Usage 1,796KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete