i have put this script to my blog, but it not working perfect because facebook need to confirm like first. ho do solve this?

<div class='widget-content'>
<script src="http://sinarhiburan.com/wp-content/plugins/afcl/js/jquery.js" type="text/javascript"></script>
    <script src="http://sinarhiburan.com/wp-content/plugins/afcl/js/jquery.simplemodal.js" type="text/javascript"></script>

    <script type="text/javascript">
    function createCookie(name,value,exp) {
        if (exp != 0) {
            var date = new Date();
            date.setTime(date.getTime()+(24*60*60*1000*exp));
            var expires = "; expires="+date.toGMTString();
        }
        else var expires = "";
        document.cookie = name+"="+value+expires+"; path=/";
    }

    function readCookie(name) {
        var nameEQ = name + "=";
        var ca = document.cookie.split(';');
        for(var i=0;i < ca.length;i++) {
            var c = ca[i];
            while (c.charAt(0)==' ') c = c.substring(1,c.length);
            if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
        }
        return null;
    }

    function wpliketounlock()
    {
        jQuery('#branding').css({'z-index':'1'});
        jQuery('#wpliketounlock').css({'height':'auto','width':'450','padding':'0px'});
        jQuery('#wpliketounlock').modal({
            opacity:100,
            escClose:false,
            overlayCss: {backgroundColor:"black"},
            onClose: function (dialog) {
                dialog.data.fadeOut('slow', function () {
                    dialog.container.slideUp('fast', function () {
                        dialog.overlay.fadeOut('slow', function () {
                            if ( 0 == 0 )
                            createCookie("wpliketounlock_liked_4",4,365);
                            jQuery.modal.close();
                        });
                    });
                });
            }
        });
        jQuery('#simplemodal-container').css({'background-color':'white'});
        jQuery('#simplemodal-container').css({'border':'4px solid #cc1f14'});

                    jQuery('#simplemodal-container').css({'border-radius':'10px','-webkit-border-radius':'10px','-moz-border-radius':'10px','behavior': 'url(http://sinarhiburan.com/wp-content/plugins/afcl/css/PIE.htc)'});
                jQuery('#likeboxdiv').css({'border-radius':'0px 0px 10px 10px','-webkit-border-radius':'0px 0px 10px 10px','-moz-border-radius':'0px 0px 10px 10px','behavior': 'url(http://sinarhiburan.com/wp-content/plugins/afcl/css/PIE.htc)'});
                jQuery('.popupTitle').css({'border-radius':'8px 8px 0px 0px','-webkit-border-radius':'8px 8px 0px 0px','-moz-border-radius':'8px 8px 0px 0px','behavior': 'url(http://sinarhiburan.com/wp-content/plugins/afcl/css/PIE.htc)'});
                jQuery('.simplemodal-wrap').css({'border-radius':'10px 10px 10px 10px','-webkit-border-radius':'10px 10px 10px 10px','-moz-border-radius':'10px 10px 10px 10px','behavior': 'url(http://sinarhiburan.com/wp-content/plugins/afcl/css/PIE.htc)','overflow':'hidden'});
            }


    var secs
    var timerID = null
    var timerRunning = false
    var delay = 1000

    function InitializeTimer()
    {
        secs = 7000        
        StopTheClock()
        StartTheTimer()
    }

    function StopTheClock()
    {
        if(timerRunning)
            clearTimeout(timerID)
        timerRunning = false
    }

    function StartTheTimer()
    {
        if (secs==0)
        {
            StopTheClock()
            jQuery.modal.close();  
        }
        else
        {
            self.status = secs
            secs = secs - 1
            timerRunning = true
            timerID = self.setTimeout("StartTheTimer()", delay)
            jQuery(".timetoclose").html(secs+"s")
        }
    }                       
    jQuery(function ($) {

                jQuery("div.popupTitle b").html(jQuery("title").html());
            jQuery(".timetoclose").html("7000");
        InitializeTimer();
        setTimeout("wpliketounlock()", 1*1000); 
        FB.Event.subscribe('edge.create',
        function(response) {
            //alert("Like Clicked");
            clicked = true;
            createCookie("wpliketounlock_liked_4",4,365);
            jQuery.modal.close();     
        }
    );
    });
    </script>
    <br />
<div id="wpliketounlock" style="display: none; z-index: 0;">
<div class="popupTitle" style="background-color: #e52a2c; color: white; padding: 5px 5px 5px 5px;">
<span class="CounterAndClose">

                    </span><br />
<div class="timetoclose" style="color: white; font-size: 18px; font-size: small; font-weight: bold; position: absolute; right: 16px; top: -37px;">
<span class="CounterAndClose">7000s
                    </span></div>
<span class="CounterAndClose">
                                                </span>
            <b>auto</b>
        </div>
<div style="background-color: white;">
<img alt="" class="aligncenter size-full wp-image-4" height="234" src="http://sinarhiburan.com/wp-content/uploads/2013/07/panas.gif" title="panas" width="400" />        </div>
<div id="likeboxdiv" style="background-color: white; height: 69px; padding: 2px 10px 2px 10px; text-align: center;">
<div id="fb-root">
</div>
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
          <fb:like colorscheme="light" href="https://www.facebook.com/blogizam.my" layout="box_count" send="false" show_faces="false" width="65"></fb:like>
        </div>
</div>
<script type="text/javascript">
    jQuery(document).ready( function($) {
            } );
    </script>
    <script src="http://sinarhiburan.com/wp-includes/js/hoverIntent.min.js?ver=r7" type="text/javascript"></script>
</div>

this is DEMO for this script on my blogspot http://mynewsdesigns.blogspot.com/
but, on this blogspot it work without confirm http://myartisfull.blogspot.com/

Recommended Answers

All 3 Replies

Very usefull one thanks for posting

Member Avatar for stbuchok

Are you just trying to get people to hit your facebook like button?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.