Subversion Repositories SmartDukaan

Rev

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

window.fbAsyncInit = function() {
        FB.init({
                appId  : '190793234325400',     //186498998073288
                status : true, // check login status
                cookie : true, // enable cookies to allow the server to access the session
                xfbml  : true  // parse XFBML
        });
        FB.Canvas.setSize({ width: 640, height: 800 });
};

function publishStream()        {
        FB.ui({
                method: 'feed',
                name: "BlackBerry Discounts on Saholic.com",
                link: "http://www.facebook.com/mysaholic?sk=app_190793234325400",
                picture: "http://static0.saholic.com/images/1000095/blackberry-curve-8520-icon-0.jpg",
                caption: 'Discounts on BlackBerry @ Saholic.com',
                description: 'Saholic.com is offering huge discounts on a range of popular Blackberry phones and tablets.',
                message: 'Massive Discounts on popular BlackBerry Devices!'
        },
        function(response) {
                if (response && response.post_id) {
                } else {
                }
        });
}

function shareThis(id, name, price)     {
        FB.ui({
                method: 'feed',
                name: name + ' available at heavyly discounted price, ' + price,
                picture: 'http://static1.saholic.com/images/' + id + '/icon.jpg',
                link: 'http://www.facebook.com/mysaholic?sk=app_190793234325400',
                caption: 'BlackBerry Discounts @ Saholic.com',
                description: 'Saholic.com is offering huge discounts on' + name + ' and a whole range of Blackberry handsets.'
        },
        function(response) {
                console.log(id, name, price);
                if (response && response.post_id) {
                } else {
                }
        });
}

$(function(){
    var e = document.createElement('script');
    e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
    e.async = true;
    document.getElementById('fb-root').appendChild(e);
        fbData = eval(json)

        if (fbData.page.liked)  {
        $('#like').show();
    } else      {
        $('#unlike').show();
    }
    
    $('.link-tell-a-friend').html('Tell a friend!')
        .click(function(){
                var descElement = $(this).parent().siblings('.desc');
                var name = $(descElement).children('.name').html();
                var price = $(descElement).children('.price').html();
                var urlParts = $(descElement).children('.buynow').attr('href').split('-');
                var entityId = urlParts[urlParts.length - 1];
                shareThis(entityId, name, price);
        });
    
        $('#share').click(function(){
                publishStream();
        });
        
        $('#select-friends').click(function(){
                FB.ui({
                        method: 'apprequests',
                        title: 'Invite Friends to avail discounts on BlackBerry',
                        message: 'Check out BlackBerry phones on Saholic.com - Massive discounts on hot selling BlackBerry devices'
                });
        });
        
        $('.link-coupon').click(function(){
                $(this).hide().siblings('.coupon').show();
        });
});