Deprecated: Assigning the return value of new by reference is deprecated in /home/play247/public_html/wp-includes/cache.php on line 99
Deprecated: Assigning the return value of new by reference is deprecated in /home/play247/public_html/wp-includes/query.php on line 21
Deprecated: Assigning the return value of new by reference is deprecated in /home/play247/public_html/wp-includes/theme.php on line 576
Warning: Cannot modify header information - headers already sent by (output started at /home/play247/public_html/wp-includes/cache.php:99) in /home/play247/public_html/wp-content/plugins/photoxhibit/photoxhibit.php on line 30
// Javascript for AJAX Comments Spy Widget
var ajax_comments_spy_widget = {
error_count: 0,
onload: function() {
var date = new Date();
var date_timestamp = date.getTime() - 60000;
// Initiate AJAX Request
jQuery.ajax({
type: 'GET',
url: 'http://play247.ro/wp-content/plugins/ajax-comments-spy/ajax-comments-spy-post.php?timestamp=' + date_timestamp,
dataType: 'json',
timeout: 60000,
success: function(responseText) {
// If there are no errors, prepend responseText to html
if(ajax_comments_spy_widget.error_count === 0) {
var list_items = jQuery('#ajax-comments-spy-widget').children();
var total_items = jQuery(list_items).length + 1;
if(total_items > 10) {
jQuery('#ajax-comments-spy-widget li:last').remove();
}
jQuery.each(responseText, function(key, comment) {
comment = '';
jQuery('#ajax-comments-spy-widget').prepend(comment);
jQuery('#spy-comment-' + key).hide();
jQuery('#spy-comment-' + key).fadeIn();
});
// Timeout to repeat AJAX
ajax_comments_spy_widget.timeout();
}
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
/**
* Increase error counter if there's an error.
* Until and unless, error_count is 0. No new comment will
* be prepended.
*/
ajax_comments_spy_widget.error_count++;
// Initialize error variable
var error = '';
if (typeof(XMLHttpRequest.responseText) === 'string' && XMLHttpRequest.responseText !== '') {
error = 'Unknown response: ' + XMLHttpRequest.responseText;
jQuery('#ajax-comments-spy-widget-error').html('RESPONSETEXT ERROR: ' + error);
}
else if (XMLHttpRequest.responseText == 'null' || XMLHttpRequest.responseText === '') {
// Timeout to recheck if there's a new comment available now.
ajax_comments_spy_widget.timeout();
}
else if (textStatus == 'timeout') {
// Timeout error
error = 'Please try again later.';
jQuery('#ajax-comments-spy-widget-error').html('TIMEOUT ERROR: ' + error);
}
else {
// When responseText is not what was expected.
error = 'Try again?';
jQuery('#ajax-comments-spy-widget-error').html('UNKNOWN ERROR: ' + error);
}
}
});
},
timeout: function() {
// Before timing out, set error counter to 0.
ajax_comments_spy_widget.error_count = 0;
/**
* Resent AJAX Request after the timeout time depending on spy
* interval settings.
*/
var timeInterval = 60000;
setTimeout('ajax_comments_spy_widget.onload()', timeInterval);
}
};
// When document is ready, execute javascript.
jQuery(document).ready(function() {
/* Check for the presence of widget */
var ajax_comments_spy_widget_present = jQuery("#ajax-comments-spy").length;
if(ajax_comments_spy_widget_present == 1) {
jQuery('.ajax_comments_spy_widget :first').after('');
jQuery('#ajax-comments-spy-widget').before('');
ajax_comments_spy_widget.onload();
}
});