Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
3298 varun.gupt 1
window.fbAsyncInit = function() {
2
	FB.init({
3307 varun.gupt 3
		appId  : '190793234325400',	//186498998073288
3298 varun.gupt 4
		status : true, // check login status
5
		cookie : true, // enable cookies to allow the server to access the session
6
		xfbml  : true  // parse XFBML
7
	});
3306 varun.gupt 8
	FB.Canvas.setSize({ width: 640, height: 800 });
3298 varun.gupt 9
};
10
 
11
function publishStream()	{
12
	FB.ui({
13
		method: 'feed',
3302 varun.gupt 14
		name: "BlackBerry Discounts on Saholic.com",
15
		link: "http://www.facebook.com/mysaholic?sk=app_190793234325400",
16
		picture: "http://static0.saholic.com/images/1000095/blackberry-curve-8520-icon-0.jpg",
17
		caption: 'Discounts on BlackBerry @ Saholic.com',
18
		description: 'Saholic.com is offering huge discounts on a range of popular Blackberry phones and tablets.',
19
		message: 'Massive Discounts on popular BlackBerry Devices!'
3298 varun.gupt 20
	},
21
	function(response) {
22
		if (response && response.post_id) {
23
		} else {
24
		}
25
	});
26
}
27
 
28
function shareThis(id, name, price)	{
29
	FB.ui({
30
		method: 'feed',
31
		name: name + ' available at heavyly discounted price, ' + price,
32
		picture: 'http://static1.saholic.com/images/' + id + '/icon.jpg',
3302 varun.gupt 33
		link: 'http://www.facebook.com/mysaholic?sk=app_190793234325400',
34
		caption: 'BlackBerry Discounts @ Saholic.com',
35
		description: 'Saholic.com is offering huge discounts on' + name + ' and a whole range of Blackberry handsets.'
3298 varun.gupt 36
	},
37
	function(response) {
38
		console.log(id, name, price);
39
		if (response && response.post_id) {
40
		} else {
41
		}
42
	});
43
}
44
 
45
$(function(){
46
    var e = document.createElement('script');
47
    e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
48
    e.async = true;
49
    document.getElementById('fb-root').appendChild(e);
50
	fbData = eval(json)
51
 
52
	if (fbData.page.liked)	{
53
    	$('#like').show();
54
    } else	{
55
    	$('#unlike').show();
56
    }
57
 
58
    $('.link-tell-a-friend').html('Tell a friend!')
59
    	.click(function(){
60
    		var descElement = $(this).parent().siblings('.desc');
61
    		var name = $(descElement).children('.name').html();
62
    		var price = $(descElement).children('.price').html();
63
    		var urlParts = $(descElement).children('.buynow').attr('href').split('-');
64
    		var entityId = urlParts[urlParts.length - 1];
65
    		shareThis(entityId, name, price);
66
    	});
67
 
68
	$('#share').click(function(){
69
		publishStream();
70
	});
71
 
72
	$('#select-friends').click(function(){
73
		FB.ui({
74
			method: 'apprequests',
3302 varun.gupt 75
			title: 'Invite Friends to avail discounts on BlackBerry',
76
			message: 'Check out BlackBerry phones on Saholic.com - Massive discounts on hot selling BlackBerry devices'
3298 varun.gupt 77
		});
78
	});
79
 
80
	$('.link-coupon').click(function(){
81
		$(this).hide().siblings('.coupon').show();
82
	});
83
});