document.write('
'); jQuery(function() { var el = jQuery("#commentsWriter_19361038_1714221712776_HtG5kEfW"); el.addClass("commentsWriter"); function makeLoginBox(el) { el.html(""); var loginDiv = jQuery("
"); loginDiv.css("padding", "10px"); loginDiv.addClass("loginHint"); loginDiv.append("Du måste logga in för att kunna kommentera
"); loginDiv.append('Logga in med Facebook'); el.append(loginDiv); FB.XFBML.parse(); } function updateWriterBox(el, uid) { console.log("commentswriter 2"); el.html(""); var img = ''; var name = '$wr.cup.getAdminInfo($wr.user).name.name (admin)'; if (uid) { // img = ''; img = ''; name = ''; } var table = jQuery('
'); table.find("td:first").html(img); table.find("td:first").addClass("profilePic"); table.find("td:last").html(name); table.find("td:last").append("
"); var body = jQuery(""); body.height(16); body.autoResize({ // Quite slow animation: animateDuration : 300, // More extra space: extraSpace : 16 }); table.find("td:last").append(body); var facebookPublish = null; var fbCheck = null; /* var facebookPublish = jQuery("
"); var fbCheck = jQuery(''); fbCheck.attr("checked", "checked"); var fbLabel = jQuery(""); fbLabel.attr("for", "fbpublish_19361038_1714221712776_HtG5kEfW"); facebookPublish.append(fbCheck); facebookPublish.append(fbLabel); facebookPublish.css("float", "left"); */ var button = jQuery(''); button.html("Kommentera"); button.css("margin-top","3px"); button.css("margin-right","4px"); button.click(function() { var data = { body: body.val(), contextId: 19361038 }; CupMan.callService("website.PostCommentService", { data: data, success: function(response) { jQuery(".commentContext_19361038").each(function() { // var func = jQuery(this).data("refreshGuestbook"); // func(); var buildComment = jQuery(this).data("buildComment"); var comment = response.comment; var commentDiv = buildComment(comment.id, comment.body, comment.name, comment.pic, comment.creationTime, {url: comment.contextUrl, title: comment.contextTitle}, comment.uid, comment.parentId); jQuery(this).find(".commentsList").prepend(commentDiv); FB.XFBML.parse(commentDiv[0]); //=============================================\\ if (fbCheck && fbCheck[0].checked) { // Publish to Facebook var caption = "{*actor*} skrev en kommentar på World Cup Women's hemsida om SUBJECT"; caption = caption.replace("SUBJECT", jQuery("#cupman .paddedContent h1:first").text()); var fbData = { 'message': body.val(), 'name': document.title, 'link': window.location.href, 'actions': { 'name': "Visit page", 'link': window.location.href }, 'caption': caption }; if (facebookPictureSrc) { fbData.picture = facebookPictureSrc; } if (facebookPictureCaption) { fbData.description = facebookPictureCaption; } FB.api('/me/feed', 'post', fbData, function(response) { }); /* FB.Connect.streamPublish(body.val(), attachment, [{ text: "Visit page", href: window.location.href }], null, '', null, true); */ } body.val("").blur(); CupMan.Tracker.Default.trackEvent( "Comments", "WriteComment", 19361038 ); }); } }); }); button.css("display", "block"); // button.wrap("
").parent().attr("align", "right"); button.css("float", "right"); button.hide(); if (facebookPublish) facebookPublish.hide(); var focusFunc = function() { clearTimeout(blurTimeoutHandle); button.show(); if (facebookPublish) facebookPublish.show(); }; var blurFunc = function() { clearTimeout(blurTimeoutHandle); if (body.val() == "") { button.hide(); body.height(16); if (facebookPublish) facebookPublish.hide(); } }; var blurTimerFunc = function() { clearTimeout(blurTimeoutHandle); blurTimeoutHandle = setTimeout(blurFunc, 200); }; var blurTimeoutHandle = null; body.focus(focusFunc); body.blur(blurTimerFunc); if (fbCheck) { fbCheck.focus(focusFunc); fbCheck.blur(blurTimerFunc); } button.focus(focusFunc); button.blur(blurTimerFunc); if (facebookPublish) table.find("td:last").append(facebookPublish); table.find("td:last").append(button); table.find("td:last").append('
'); el.append(table); FB.XFBML.parse(); } if (!CupMan.ie6) { ensureFacebookInit(function() { console.log("commentswriter 3"); FB.Event.subscribe('auth.login', function(response) { console.log("Logged in: ", response); updateWriterBox(el, response.authResponse.userID); }); FB.Event.subscribe('auth.logout', function(response) { console.log("Logged out: ", response); makeLoginBox(el); }); FB.getLoginStatus(function(response) { console.log("commentswriter 4", response); if (response.authResponse) { updateWriterBox(el, response.authResponse.userID); } else { makeLoginBox(el); } }); }); } else { el.append("Du använder en för gammal webbläsare. För att kunna skriva kommentarer ber vi dig att uppgradera till en nyare version.
"); } });