Wednesday, November 30, 2011

Great cookbooks for the holidays: Serious Eats

'); } var url = "/gyrobase/blogs/Post"; var myStart = jQuery(this).attr("id") == "sortSelect" ? "1" : jQuery(this).attr("rel"); var showAllComments = jQuery(this).attr("id") == "showAllComments" ? "yes" : "no"; var params = { oid: "1956217", sort: jQuery("#sortSelect").val(), ajaxComponent: componentId, startIndex: myStart, showAll: showAllComments }; jQuery.ajax({ url: url, data: (params), dataType: "html", success: function (data) { jQuery("#"+componentId+"_PaginationBottom").remove(); if (myStart == "1") jQuery("#"+componentId+"_commentContent").html(data); else jQuery("#"+componentId+"_commentContent").append(data); } }); }; function doLikeComment(e){ e.preventDefault(); if (!this.clicked){ this.clicked = true; var oid = jQuery(this).attr("data-commentOid"); jQuery(this).addClass("dimmed").css("opacity","0.4"); var thisRating = jQuery(this).attr("rel"); var myCurrentRating = jQuery("#"+oid+"_rating_current").html() || 0; var myCurrentTotal = jQuery("#"+oid+"_rating_total").html() || 0; myCurrentTotal = parseFloat(myCurrentTotal)+1; if (thisRating == "Like"){ myCurrentRating = parseFloat(myCurrentRating)+1; jQuery("#BlogComments #"+oid+"_likeLinks a.dislike").removeClass("dimmed").css("opacity","1").each(function(){this.clicked = false;}); } else { jQuery("#BlogComments #"+oid+"_likeLinks a.like").removeClass("dimmed").css("opacity","1").each(function(){this.clicked = false;});; } jQuery("#"+oid+"_rating_current").html(myCurrentRating); jQuery("#"+oid+"_rating_total").html(myCurrentTotal); jQuery("#"+oid+"_rating_sub").show(); var params = { oid: oid, rating: thisRating }; jQuery.ajax({ url: "/gyrobase/Tools/AjaxLike", data: (params), success: function (data) { jQuery("#"+oid+"_rating").html(data); } }); } } function reportComment(e){ e.preventDefault(); e.stopPropagation(); var oid = jQuery(this).attr("rel"); var elem = jQuery("#"+oid+"_report"); elem.click(function(e){e.stopPropagation();}) if (!elem.is(":visible")){ jQuery("#BlogComments .reportCommentContainer").hide(); if (elem.is(":empty")){ var params = { oid: oid, ajaxComponent: "ReportComment" }; jQuery.ajax({ url: "/gyrobase/Tools/ReportComment", data: (params), success: function (data) { elem.html(data); elem.fadeIn("fast"); } }); } else { elem.fadeIn("fast"); } } // attach close event handler to the html jQuery("html").one("click", function(){ jQuery("#BlogComments .reportCommentContainer:visible").hide(); }); } function closeReport(obj){ jQuery(obj).closest(".reportCommentContainer").fadeOut("fast"); } function submitReport(e){ var params = jQuery(e).closest("form").serialize()+"&ajaxComponent=ReportComment"; jQuery.ajax({ url: "/gyrobase/Tools/ReportComment", data: (params), success: function (data) { jQuery(e).closest(".reportCommentContainer").html(data); } }); } jQuery(document).ready(function($){ $("#BlogComments").on('click', '#showMoreComments,#showAllComments', getMoreComments); $("#BlogComments #sortSelect").change(getMoreComments); $("#BlogComments").on('click', 'a.likeLink', doLikeComment); $("#BlogComments").on('click', 'a.reportCommentLink', reportComment); });

Source: http://www.arktimes.com

No comments:

Post a Comment