'; $("#SiteLoginDiv").html(statusLoginStr); $("#CommonLoginDiv").hide(); $("#SiteLoginDiv").show(); } else { $("#CommonLoginDiv").show(); $("#SiteLoginDiv").hide(); } function getFacebookLogin(){ $.closeOverlay(); try { FB.login(function(response) { if (response.authResponse) { //var loginusertypeid = response.authResponse.userID; update_user_box(); } else { //console.log('User cancelled login or did not fully authorize.'); } }); } catch (e) { //console.log(e.message); } } function update_user_box() { //----------To Hide login div and the comment box $("#logindiv").hide(); $("#showerrorComment").hide(); $("#commentBoxRes").hide(); FB.api('/me', function(data) { var loginusertypeid = data.id; var first_name = data.first_name; var last_name = data.last_name; var useremail = data.email; var screenName = data.name; var profileImage = data.pic_big_with_logo; var profile_url = data.profile_url; //-------------Set Value in the Hidden variable $("#first_name").val(first_name); $("#second_name").val(last_name); $("#Useremail").val(useremail); $("#Username").val(screenName); $("#userscreenname").val(screenName); $("#userprofilelink").val(profile_url); $("#userprofileimage").val(profileImage); $("#loginusertypeid").val(loginusertypeid); if(profileImage==''){ profileImage = "http://idiva.com/images/50X50_User.jpg"; } //For Top Details when user Logins statusLoginStr = '
'; $("#SiteLoginDiv").html(statusLoginStr); $("#logindiv").hide(); $("#usernamepassworddiv").hide(); //$("#facebooktwitteruserdetails").show(); //$("#facebooktwitteruserdetails").html(embededlogeddetails); $("#facebooktwitteruserdetails").show(); $("#whichusertype").val('1'); $("#CommonLoginDiv").hide(); $("#SiteLoginDiv").show(); $("#anonymousDiv").show(); $("#sociallogin").hide(); $("#commentSubmit").show(); }); } function fblogout(){ FB.logout(); $("#logindiv").show(); $("#whichusertype").val('0'); $("#facebooktwitteruserdetails").hide(); $("#usernamepassworddiv").show(); $("#CommonLoginDiv").show(); $("#anonymousDiv").hide(); $("#SiteLoginDiv").hide(); $("#userscreenname").val(''); $("#Username").val(''); $("#Useremail").val(''); $("#first_name").val(''); $("#last_name").val(''); $("#screenName").val(''); $("#sociallogin").show(); $("#commentSubmit").hide(); $("#commentBoxRes").hide(); del_cook('UID'); del_cook('USEREMAIL'); del_cook('USERSCREENNAME'); del_cook('USER_TYPE'); del_cook('UI'); //$("#FacebookLoginDiv").hide(); } function del_cook(name) { //alert('deleted'); //var expdate = new Date(); //expdate.setTime(expdate.getTime() - (24*60*60*1000)); document.cookie = name + "=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/"; } //stream publish method function streamPublish(name, hrefTitle, hrefLink, userPrompt) { FB.ui( { method: 'stream.publish', message: '', attachment: name, action_links: [ { text: hrefTitle, href: hrefLink } ], user_prompt_message: userPrompt }, function(response) { }); }
'; //----------To Hide login div and the comment box $("#logindiv").hide(); $("#maincommentdiv").hide(); // $("#facebooktwitteruserdetails").html(embededlogeddetails12); $("#SiteLoginDiv").html(embededlogeddetails); $("#CommonLoginDiv").hide(); $("#SiteLoginDiv").show(); //-To Show the Twitter Post Box T("#maincommentdivfortweeter").tweetBox({ height: 100, width: 600, defaultContent: "http://toi.in/-Os4xb", onTweet : function (data){ //--------------Function to Post data to the insert2dbfile var whihcflag = $("#whichcontype").val(); var first_name = $("#first_name").val(); var last_name = $("#second_name").val(); var screenName = $("#userscreenname").val(); var profile_url = $("#userprofilelink").val(); var profileImage = $("#userprofileimage").val(); var loginusertypeid = $("#loginusertypeid").val(); var comment_text = data.replace("http://toi.in/-Os4xb",""); var comment_parentid = $("#comment_parentid").val(); var content_id = $("#content_id").val(); $.post("http://idiva.com/2db/comment2db.php",{'login_type':'twitter', 'whihcflag':whihcflag, 'first_name':first_name, 'last_name':last_name, 'screenName':screenName, 'profile_url':profile_url, 'profileImage':profileImage, 'loginusertypeid':loginusertypeid, 'comment_text':comment_text, 'content_id':content_id, 'comment_parentid':comment_parentid},function(data){ //alert(data); if(jQuery.trim(data)=='error'){ $("#showerrorComment").html('User and password did not match.'); document.getElementById('showerrorComment').style.display="block"; }else if(jQuery.trim(data)=='BadName'){ $("#comment_text").focus(); $("#commentBoxRes").html('Please enter a valid name.'); document.getElementById('commentBoxRes').style.display="block"; }else if(trim(data)=='BadWord'){ $("#comment_text").focus(); $("#commentBoxRes").html('Whoa... STOP right there! Pls feed us love, not spam, links or abusive words :) Help us keep iDiva a happy place!'); document.getElementById('commentBoxRes').style.display="block"; }else{ //alert('here'); $("#commentBoxRes").show(); $.post("http://idiva.com/tpl/tplGetcommentadded.php",{"content_id":content_id,"pageval":"1","whichflag":whihcflag},function(data){ //alert(data); $("#showcommentcontent").html(data); var nocomments = $('#nocomments_'+17890).val(); //console.debug(nocomments); if( nocomments > 0){ $('#comment_'+17890).html(''); $('#comment_'+17890).html(''+nocomments +' Comments ' ); } }); } }); } }); //$("#login-logout").append('Sign out of Twitter'); $("#signout").bind("click", function () { twttr.anywhere.signOut(); $("#first_name").val(''); $("#userscreenname").val(''); $("#userprofilelink").val(''); $("#userprofileimage").val(''); $("#loginusertypeid").val(''); window.location.reload(); }); }else{ T("#twitter-connect-placeholder").connectButton({ authComplete: function(user) { // triggered when auth completed successfully window.location.reload(); } }); $("#maincommentdiv").show(); $("#maincommentdivfortweeter").hide(); }; }); });//------------Document Ready //-------------------FAcebook User Starts var badword=0; function postthecomment1() { var comment_text = ($("#comment_text").val()); var comment_text_fb = ($("#comment_text").val()); var comment_parentid = ($("#comment_parentid").val()); var content_id = ($("#content_id").val()); var whihcflag = $("#whichcontype").val(); $("#showerrorComment").hide(); $("#commentBoxRes").hide(); if($("#whichusertype").val()=='1') { if(comment_text==""){ errmsg = "Please Enter Your Comment"; $("#comment_text").val('') $('#comment_text').focus(); $("#showerrorComment").html(errmsg); document.getElementById('showerrorComment').style.display="block"; }else{ var first_name = $("#first_name").val(); var last_name = $("#second_name").val(); if($('#UsernameSelector').attr('checked') == true){ var screenName = 'Anonymous'; } else{ var screenName = $("#userscreenname").val(); } var profile_url = $("#userprofilelink").val(); var profileImage = $("#userprofileimage").val(); var loginusertypeid = $("#loginusertypeid").val(); $('#commentSubmit').attr('disabled','disabled'); $.post("http://idiva.com/2db/comment2db.php",{'login_type':'facebook','whihcflag':whihcflag,'first_name':first_name,'last_name':last_name,'screenName':screenName,'profile_url':profile_url,'profileImage':profileImage,'loginusertypeid':loginusertypeid,'comment_text':comment_text,"content_id":content_id,"comment_parentid":comment_parentid},function(data){ data=jQuery.trim(data); if(data=='error'){ $("#showerrorComment").html('User and password did not match.'); document.getElementById('showerrorComment').style.display="block"; } else if(data=='BadName'){ $("#Username").focus(); $("#showerrorComment").html('Please enter a valid name.'); $("#showerrorComment").show(); } else if(data=='BadWord'){ badword=1; $("#comment_text").focus(); $("#showerrorComment").show(); $("#showerrorComment").html('Whoa... STOP right there! Pls feed us love, not spam, links or abusive words :) Help us keep iDiva a happy place!'); }else{ $("#commentBoxRes").show(); $.post("http://idiva.com/tpl/tplGetcommentadded.php",{"content_id":content_id,"pageval":"1","whichflag":whihcflag},function(data){ //alert(data); $("#showcommentcontent").html(data); $("#commentBoxRes").show(); //$("#Username").val(''); //$("#Useremail").val(''); $("#comment_text").val(''); var nocomments = $('#nocomments_'+17890).val(); //console.debug(nocomments); if( nocomments > 0){ $('#comment_'+17890).html(''); $('#comment_'+17890).html(''+nocomments +' Comments ' ); } var message = comment_text_fb; //alert(message); var article_title = "Homemade Treats For Your Pet Dog"; var article_page_link = "http://idiva.com/news-work-life/homemade-treats-for-your-pet-dog/17890"; var story_section ="News"; var story_section_url ="http://idiva.com/work-life"; var author_name = "Meghna Mukherjee"; var author_name_url = "http://idiva.com/author/meghna-mukherjee/735"; var posteddate = "Nov 29th 2012 at 7:00AM" var article_image_path ="http://images.idiva.com/media/content/2012/Nov/homemade_trats_for_your_dog_100x75.jpg"; var attachment = { 'name': article_title, 'href': article_page_link ,'properties' : { 'Filed under': {'text': story_section, 'href': story_section_url}, 'Author ' : {'text': author_name, 'href':author_name_url}, 'Posted On': posteddate, 'caption': '' } ,'media': [{ 'type': 'image', 'src': article_image_path, 'href': article_page_link }] }; var action_links = [{'text':'Idiva', 'href':'http://www.idiva.com/'}]; //FB.Connect.streamPublish(message, attachment, action_links); streamPublish(attachment, 'Idiva', 'http://www.idiva.com/', 'Share idiva.com'); $('#commentSubmit').attr('disabled',''); }); } }); } } else { if($('#UsernameSelector').attr('checked') == true){ var username = 'Anonymous'; } else { var username = jQuery.trim($("#Username").val()); } var useremailid = jQuery.trim($("#Useremail").val()); var comment_parentid = ($("#comment_parentid").val()); var userpassword = ($("#Password").val()); var content_id = ($("#content_id").val()); var whihcflag = ($("#whichcontype").val()); var flag = 0; //alert(username); //alert(useremailid); if (comment_text==""){ errmsg = "Please Enter Your Comment"; $("#comment_text").val('') $('#comment_text').focus(); flag=1; }else if (username=="" || useremailid==""){ errmsg = "Please login to comment."; flag=1; }else if (userpassword == "" || userpassword == "Password"){ errmsg = "Please Enter Password"; $('#Password').focus(); flag=1; } if(flag==0) { //alert("asda"); $('#commentSubmit').attr('disabled','disabled'); $.post("http://idiva.com/2db/comment2db.php",{'login_type':'normaluser','EmailId':useremailid,'whihcflag':whihcflag,'Username':username,"userpassword":userpassword,"content_id":content_id,"comment_parentid":comment_parentid,'comment_text':comment_text},function(data){ data=jQuery.trim(data); if(data=='error'){ $("#showerrorComment").html('User and password did not match.'); $("#showerrorComment").show(); } else if(data=='BadName'){ $("#Username").focus(); $("#showerrorComment").html('Please enter a valid name.'); $("#showerrorComment").show(); } else if(data=='BadWord'){ $("#comment_text").focus(); $("#showerrorComment").html('Whoa... STOP right there! Pls feed us love, not spam, links or abusive words :) Help us keep iDiva a happy place!'); $("#showerrorComment").show(); } else if(data=='0'){ $("#comment_text").focus(); $("#showerrorComment").html('Name is either empty or invalid.'); $("#showerrorComment").show(); } else{ $("#commentBoxRes").show(); $.post("http://idiva.com/tpl/tplGetcommentadded.php",{"content_id":content_id,"pageval":"1","whichflag":whihcflag},function(data){ //alert(data); $("#showcommentcontent").html(data); var nocomments = $('#nocomments_'+17890).val(); //console.debug(nocomments); if( nocomments > 0){ $('#comment_'+17890).html(''); $('#comment_'+17890).html(''+nocomments +' Comments ' ); } $("#commentBoxRes").html('Thanks for posting the comments.'); document.getElementById('commentBoxRes').style.display="block"; //$("#Username").val(''); //$("#Useremail").val(''); $("#comment_text").val(''); }); } $('#commentSubmit').attr('disabled',''); del_cook('keepComment'); }); }else { $("#showerrorComment").html(errmsg); document.getElementById('showerrorComment').style.display="block"; } } } function clearText(field){ if (field.defaultValue == field.value) field.value = ''; else if (field.value == '') field.value = field.defaultValue; } function edittoAnonymous( val ){ if($('#'+val).val() == 'Anonymous' || $('#UsernameSelector').attr('checked') == false){ $('#'+val).val(readCookie("USERSCREENNAME") ); $('#emailuser').show(); }else{ $('#'+val).val('Anonymous'); $('#emailuser').hide(); } } function edittotext(val){ //console.debug($(val).attr("readonly")); $('#UsernameSelector').attr('checked',false); //$(val).attr("readonly",false); } function getCookie(c_name) { var i, x, y, ARRcookies = document.cookie.split(";"); for (i=0; iSource: http://idiva.com/news-work-life/homemade-treats-for-your-pet-dog/17890
marion barber syracuse ohio state girl with the dragon tattoo ohio state basketball collateral dick cheney heart
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.