Jquery class

Hi, I want to write a jquery function that I will use to share status on facebook and twitter. How can I write the function?

Thanks

Facebook status jQuery plugin

For Twitter, there is Tweet! along with a wide range of [url=“http://www.noupe.com/tutorial/twitter-status-design-tutorials-icons-wp-plugins.html”]other twitter status plugins

Hi thanks for the reply. I downloadded the file from github but honestly I want able to paste it on the jquery file I have. Im not sure how to incorporate the fbshare function on my actual jquery file.

Below are some of the functions I have on my jquery:

function stream_publish() {
global $client, $config;
if (!$client[‘id’]) die(‘please login first’);
limit_posting(0,1);
if (strlen($_POST[‘message’])<4) die(‘failed! message too short’);
$_POST[‘message’] = utf8_substr($_POST[‘message’],200);
$_POST[‘message’] = parseurl($_POST[‘message’]);
$url_search = array(
“/\www.([^'\”])\[\/url]/iU",
“/\([^'\”]
)\[\/url]/iU",
“/\url=www.([^'\"\s]*)\[\/url]/iU”,
“/\url=([^'\"\s]*)\[\/url]/iU”,
);
$url_replace = array(
“<a href=\“http://www.\\1\” target=\”_blank\" rel=\“nofollow\”>www.\\1</a>“,
“<a href=\”\\1\” target=\“_blank\” rel=\“nofollow\”>\\1</a>“,
“<a href=\“http://www.\\1\” target=\”_blank\” rel=\“nofollow\”>\\2</a>“,
“<a href=\”\\1\” target=\“_blank\” rel=\“nofollow\”>\\2</a>"
);
$stream_id = stream_publish(preg_replace($url_search,$url_replace, h($_POST[‘message’]) ),$attachment,$app,$client[‘id’],$_POST[‘page_id’]);
$arr = array(
‘id’=>$stream_id,‘fullname’=>$client[‘fullname’],‘avatar’=>$client[‘avatar’],‘message’=>decode_bb(h(stripslashes($_POST[‘message’]))),‘attachment’=>$attachment,‘username’=>$client[‘uname’],‘created’=>time()
);
echo stream_display($arr,‘’,1);
ss_update();

	exit;
}

function stream_delete($storyid) {
	global $client, $config;
	if (!$client['id']) die('please login first');
	$res = sql_query("select * from ".tb()."streams where id='$storyid'");
	$stream = sql_fetch_array($res);
	if (!$stream['id']) die('wrong sid');
	if ($stream['uid'] == $client['id'] || in_array('3',$client['roles']) ) {
		sql_query("update ".tb()."streams set hide=1 where id='{$stream['id']}'");
		echo 'ok';
	}
	else {
		echo 'access denied';
	}
	exit;
}

function comment_publish() {

global $client, $config;
if (!$client[‘id’]) die(‘<div class=“ferror”>please login first</div>’);
if ( !eregi(“[1]+$”,$_POST[‘target_id’]) ) die(‘no target id’);
if (strlen($_POST[‘message’])<4) die(‘<div class=“ferror”>failed! message too short</div>’);
limit_posting(0,1);

comment_publish($_POST[‘target_id’],$_POST[‘message’]);
record_this_posting($_POST[‘message’]);
$arr = array(
‘avatar’=>$client[‘avatar’],‘message’=>stripslashes($_POST[‘message’]),‘username’=>$client[‘uname’],‘fullname’=>$client[‘fullname’],‘created’=>time()
);
echo comment_display($arr);
ss_update();
exit;
}

function dolike() {
	sleep(1);
	global $client, $config;
	if (!$client['id']) die('&lt;div class="ferror"&gt;please login first&lt;/div&gt;');
	if ( !eregi("^[0-9a-z]+$",$_POST['target_id']) ) die('no target id');
	limit_posting(0,1);
	if (!is_numeric($_POST['target_id'])) {
		die('wrong target id');
	}
	$res = sql_query("select * from ".tb()."liked where stream_id='{$_POST['target_id']}' and uid='{$client['id']}' limit 1");
	if (sql_counts($res)) {
		sql_query("delete from ".tb()."liked where stream_id='{$_POST['target_id']}' and uid='{$client['id']}'");
		sql_query("update ".tb()."streams set likes=likes-1 where id='{$_POST['target_id']}'");
		echo t('Unliked').'&lt;br /&gt;';
	}
	else {
		$like = array('uid'=&gt;$client['id'],'stream_id'=&gt;$_POST['target_id']);
		sql_insert($like,tb().'liked');
		sql_query("update ".tb()."streams set likes=likes+1 where id='{$_POST['target_id']}'");
		echo t('Liked').'&lt;br /&gt;';
	}

	exit;
}

function dodislike() {
	global $client, $config;
	if (!$client['id']) die('&lt;div class="ferror"&gt;please login first&lt;/div&gt;');
	if ( !eregi("^[0-9a-z]+$",$_POST['target_id']) ) die('no target id');
	limit_posting(0,1);
	if (!is_numeric($_POST['target_id'])) {
		die('wrong target id');
	}
	$res = sql_query("select * from ".tb()."disliked where stream_id='{$_POST['target_id']}' and uid='{$client['id']}' limit 1");
	if (sql_counts($res)) {
		sql_query("delete from ".tb()."disliked where stream_id='{$_POST['target_id']}' and uid='{$client['id']}'");
		sql_query("update ".tb()."streams set dislikes=dislikes-1 where id='{$_POST['target_id']}'");
		echo t('Un-disliked').'&lt;br /&gt;';
	}
	else {
		$like = array('uid'=&gt;$client['id'],'stream_id'=&gt;$_POST['target_id']);
		sql_insert($like,tb().'disliked');
		sql_query("update ".tb()."streams set dislikes=dislikes+1 where id='{$_POST['target_id']}'");
		echo t('Disliked').'&lt;br /&gt;';
	}

	exit;
}

function wholike($stream_id=0,$offset=0) {
	if (!is_numeric($stream_id)) die();
	if (!$offset) $offset = 0;
	$num = 8;
	$res = sql_query("select u.* from ".tb()."liked as l left join ".tb()."accounts as u on u.id=l.uid where stream_id='$stream_id' limit $offset,".($num+1));
	$i=1;
	while ($user = sql_fetch_array($res)) {
		if ($i&gt;$num) {
			$got_more = 1;
		}
		else {
			$users[] = $user;
		}
		$i++;
	}
	echo $this-&gt;display_users($users);
	if ($got_more) {
		$offset = $offset + $num;
		echo '&lt;hr /&gt;
		&lt;a href="#" onclick="jQuery.facebox({ ajax: \\''.url('jquery/wholike/'.$stream_id.'/'.$offset).'\\' });return false;" &gt;'.t('More..').'&lt;/a&gt;';
	}
	exit;
}

function whodislike($stream_id=0,$offset=0) {
	if (!is_numeric($stream_id)) die();
	if (!$offset) $offset = 0;
	$num = 8;
	$res = sql_query("select u.* from ".tb()."disliked as l left join ".tb()."accounts as u on u.id=l.uid where stream_id='$stream_id' limit $offset,".($num+1));
	$i=1;
	while ($user = sql_fetch_array($res)) {
		if ($i&gt;$num) {
			$got_more = 1;
		}
		else {
			$users[] = $user;
		}
		$i++;
	}
	echo $this-&gt;display_users($users);
	if ($got_more) {
		$offset = $offset + $num;
		echo '&lt;hr /&gt;
		&lt;a href="#" onclick="jQuery.facebox({ ajax: \\''.url('jquery/whodislike/'.$stream_id.'/'.$offset).'\\' });return false;" rel="facebox"&gt;'.t('More..').'&lt;/a&gt;';
	}
	exit;
}

	private function display_users($users) {
	if (is_array($users)) {
		foreach ($users as $user) {
			if (!strlen($user['fullname'])) $user['fullname'] = $user['username'];
			$output .= '&lt;li&gt;'.avatar($user).'&lt;br /&gt;'.url('u/'.$user['username'],h($user['fullname'])).'&lt;/li&gt;';
		}
	}
	return '
	&lt;ul class="small_avatars"&gt;'.$output.'&lt;/ul&gt;';
}

  1. 0-9a-z ↩︎

I keep a long distance away from Facebook so I’m not sure how to deal with their stuff either.

All the best.

The script im using is Jcow Community software and not facebook but thought I could use the share button on the site

You might be able to, but as I said, I keep a long distance away from Facebook.
Yes I heard, you’re web site is not on Facebook, but bear in mind that I do not have any content on Facebook so I can not even start to implement or test anything relating to Facebook. Capiche?

Thanks for your time mate