Subversion Repositories SmartDukaan

Rev

Rev 1736 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1729 varun.gupt 1
FB.init({
2
	appId  : '179519275432255',
3
	status : true, // check login status
4
	cookie : true, // enable cookies to allow the server to access the session
5
	xfbml  : true  // parse XFBML
6
});
2053 varun.gupt 7
 
8
function showFriendSelector()	{
9
	FB.ui({
10
		method: 'apprequests',
11
		title: 'Invite Friends to Phones I Own',
12
		message: 'This is a cool app to flaunt the phone you own to your friends.'
13
	});
14
}
15
 
1729 varun.gupt 16
function publishStream(productName, productURL, productImgURL, productDesc)	{
17
FB.ui({
18
		method: 'feed',
19
		name: productName,
20
		link: productURL,
21
		picture: productImgURL,
22
		caption: 'Phones I Own | Saholic.com',
23
		description: productDesc,
24
		message: 'Check out the phone I own!'
25
	},
26
	function(response) {
27
		if (response && response.post_id) {
2053 varun.gupt 28
			showFriendSelector();
1729 varun.gupt 29
		} else {
30
			// Post was not published
31
		}
32
	});
33
}
2053 varun.gupt 34
 
1729 varun.gupt 35
$(function(){
2053 varun.gupt 36
	$('#friendInviter').live('click', function()	{
37
		showFriendSelector();
38
	});
39
 
1729 varun.gupt 40
	$('input.publish-button').click(function()	{
41
		var id = $(this).attr('id').replace('post-badge-', '');
1736 varun.gupt 42
		var productName = $('#' + id).html();
1729 varun.gupt 43
		var productUrl = $('#url-' + id).html();
44
		var imageUrl = $('#img-' + id).attr('src');
45
		var desc = "";
46
 
47
		$('#desc-' + id).children().each(function(i, item){
48
			desc += $(item).html() + ', ';
49
		});
50
		desc = jQuery.trim(desc);
1736 varun.gupt 51
//		console.log(productName, productUrl, imageUrl, desc);
1729 varun.gupt 52
		publishStream(productName, productUrl, imageUrl, desc);
53
	});
54
});