"; $("#commnetsListsCommentSystem").show("slow").prepend(ele); $("#commentsListingBox").css("display", "block"); $("#commentspinnerparent").fadeOut("slow"); $("#commentspinnerparent").attr("src", ""); }, error: function (er) { alert("Error"); } }); return false; } function PostParent2() { return false; } function readURL(input) { if (input.files && input.files[0]) { var reader = new FileReader(); var k = document.getElementById("fpParentImage").files[0].name; reader.onload = function (e) { $("#parentloadcommentimage").html(" "); CommentParentFileName = e.target.result; }; $("#parentloadcommentimage").show(); reader.readAsDataURL(input.files[0]); } ValidateParentComments(); } function CommentSpinnerShow() { $("#commentspinner").attr("src", CommentSpinnerImage); $("#commentspinner").fadeIn("slow"); } function CommentSpinnerHide() { $("#commentspinner").fadeOut("slow"); //$("#commentspinner").attr("src", ""); } function HideLoadButton() { $("#loadmoreComments").fadeOut("slow"); } function ShowLoadButton() { $("#loadmoreComments").fadeIn("slow"); } var CommentSystemRow = 0; function RefreshCommentRecords() { CommentSystemRow = -1; $("#commnetsListsCommentSystem").html(""); ShowMoreComments(); } function ChangeOrderType() { RefreshCommentRecords(); } function ShowMoreComments() { var OrderType = 1; HideLoadButton(); CommentSpinnerShow(); CommentSystemRow = CommentSystemRow + 1; OrderType = parseInt($("#SelectCommentsOrder option:selected").val()); var Url = $("#CommentSystemPageUrl").val(); $.ajax({ type: "POST", datatype: "application/json", contentType: "application/json", data: "{'Row' : '" + CommentSystemRow + " ','Url':'" + Url + "','OrderType':'" + OrderType + "'}", processData: false, url: "/Services/Comments.asmx/ShowMoreComments", success: function (json) { if (json.d != "") { CommentSpinnerHide(); setTimeout(function () { $("#commnetsListsCommentSystem").append(json.d); ShowLoadButton(); }, 500); } else { CommentSpinnerHide(); } }, error: function (er) { alert("Error"); } }) } function likeComment(chk) { var ClassStatus = $(chk).hasClass("liked"); var LikesTotal = parseInt($(chk).children("input").val()); var txt = ""; var del = 0; if (ClassStatus == true) { $(chk).removeClass("liked"); txt = "Like"; del = 1; LikesTotal = LikesTotal - 1; } else { $(chk).addClass("liked"); txt = "Liked"; del = 0; LikesTotal = LikesTotal + 1; } if (LikesTotal > 0) { txt = txt + " (" + LikesTotal.toString() + ")"; } else { LikesTotal = 0; } $(chk).children("span").text(txt); $(chk).children("input").val(LikesTotal.toString()) var dataobjectLike = { isChild: false, CommentID: parseInt($(chk).attr("comment-id")), DeleteRecord: del }; $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", dataType: "json", data: JSON.stringify({ 'o': dataobjectLike }), url: '/Services/Comments.asmx/CommentLike', success: function (j) { }, error: function (err) { console.log(err); } }); return false; } function likeCommentChild(chk) { var ClassStatus = $(chk).hasClass("liked"); var LikesTotal = parseInt($(chk).children("input").val()); var txt = ""; var del = 0; if (ClassStatus == true) { $(chk).removeClass("liked"); txt = "Like"; del = 1; LikesTotal = LikesTotal - 1; } else { $(chk).addClass("liked"); txt = "Liked"; del = 0; LikesTotal = LikesTotal + 1; } if (LikesTotal > 0) { txt = txt + " (" + LikesTotal.toString() + ")"; } else { LikesTotal = 0; } $(chk).children("span").text(txt); $(chk).children("input").val(LikesTotal.toString()) var dataobjectLike = { isChild: true, CommentID: parseInt($(chk).attr("comment-id")), DeleteRecord: del }; $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", dataType: "json", data: JSON.stringify({ 'o': dataobjectLike }), url: '/Services/Comments.asmx/CommentLike', success: function (j) { }, error: function (err) { console.log(err); } }); return false; } /////////////// Child Comments //////////////// var ChildCommentTypeID = 1; var ParentCommentIDForChildComment = 0; var CommentChildFileName = ""; var ChildElementComment; var ChildCommentsCounter = 0; var ReplyBackDiv = ""; function ReplyBackComment(chk) { ChildElementComment = ""; ReplyBackDiv = ""; $("#ikdCommentsSectionModal").slideDown("slow"); ParentCommentIDForChildComment = $(chk).children("input#parentcommentid").val(); ReplyBackDiv = $(chk); ChildCommentsCounter = parseInt($(chk).children("input#commentcounter").val()); ChildElementComment = $(chk).parent("div.commentAction").parent("div.desc").parent("div.single-commnet").parent("li"); } function CloseChildCommentPopUp() { $("#ikdCommentsSectionModal").slideUp("slow"); RemoveCaptcha(); ClearChildFields(); } function TabsChild(chk) { $("#ulChildComments").children("li").removeClass("active"); $(chk).addClass("active"); var ID = parseInt($(chk).children("input").val()); //// var o = $("#ChildCommentMsg").val(); ClearChildFields(); $("#ChildCommentMsg").val(o); RemoveChildValidationVideoImage(); //// CommentChildFileName = ""; if (ID == 2) { $("#imgChildcomment").show(); $("#videoChildcomment").hide(); $("#livevideochildcomment").hide(); ChildCommentTypeID = 2; } else if (ID == 3) { $("#imgChildcomment").hide(); $("#videoChildcomment").show(); $("#livevideochildcomment").hide(); ChildCommentTypeID = 3; } else if (ID == 4) { $("#imgChildcomment").hide(); $("#videoChildcomment").hide(); $("#livevideochildcomment").show(); Start("vchild"); $("#vchild").fadeIn("slow"); $("#startrecordchild").show(); ChildCommentTypeID = 4; } else { $("#livevideochildcomment").hide(); $("#imgChildcomment").hide(); $("#videoChildcomment").hide(); ChildCommentTypeID = 1; } } function readURL2(input) { if (input.files && input.files[0]) { var reader = new FileReader(); var k = document.getElementById("fpChildImage").files[0].name; reader.onload = function (e) { $("#Childloadcommentimage").html(" "); CommentParentFileName = e.target.result; }; $("#Childloadcommentimage").show(); reader.readAsDataURL(input.files[0]); } ValidateChildComments(); } function ClearChildFields() { $("#videolinkChild").val(""); document.getElementById("fpChildImage").value = ""; $("#Childloadcommentimage").html(""); $("#ChildCommentMsg").val(""); $("#videoChild").val(""); $("#embededVideoChild").html(""); $("#vchild").removeAttr("controls"); $("#vchild").removeAttr("src", ""); $("#vchild").fadeOut("slow"); ChilRecordRC = ""; ChildRecordError = 1; try { StopChildStream(); } catch (err) { } } function ValidateChildComments() { var i = 0; var UserName = $("#ChildCommentName").val(); var UserEmail = $("#ChildCommentEmail").val(); var UserComments = $("#ChildCommentMsg").val(); if (UserName == "") { $("#ChildCommentName").addClass("inputError"); i++; } else { $("#ChildCommentName").removeClass("inputError"); } if (UserEmail == "") { $("#ChildCommentEmail").addClass("inputError"); i++; } else { var EmailResult = ValidateCommentEmail(UserEmail); if (EmailResult == 1) { $("#ChildCommentEmail").addClass("inputError"); i++; } else { $("#ChildCommentEmail").removeClass("inputError"); } } if (UserComments == "") { $("#ChildCommentMsg").addClass("inputError"); i++; } else { $("#ChildCommentMsg").removeClass("inputError"); } var Captcha = $("#CommentCaptcha").val().toString(); var UserCaptcha = $("#txtChildCaptcha").val().toString(); if (UserCaptcha != Captcha) { $("#txtChildCaptcha").addClass("inputError"); i++; } else { $("#txtChildCaptcha").removeClass("inputError"); } if (ChildCommentTypeID == 2)///Images// { var FileExists = document.getElementById("fpChildImage").files[0]; if (FileExists == null) { $("#lblChildFile").addClass("errorfile"); i++; } else { $("#lblChildFile").removeClass("errorfile"); } } else if (ChildCommentTypeID == 3)///Videos/// { var LinkVideo = $("#videoChild").val(); if (LinkVideo == "") { $("#videoChild").addClass("inputError"); i++; } else { $("#videoChild").removeClass("inputError"); } } else if (ChildCommentTypeID == 4)/// Live Records { if (ChildRecordError == 1) { i++; $("#vchilderror").html(RecordingErrorMsg); } else { $("#vchilderror").html(""); } } if (i <= 0) { return 0;///All ok } else { return 1;///Error } } function PostChild() { var Result = ValidateChildComments(); if (Result == 1) { return false; } $('#btnPostCommentChild').prop('disabled', true); $('#btnPostCommentChild').addClass('notallowedComment'); $("#commentspinnerchild").attr("src", CommentSpinnerImage); $("#commentspinnerchild").show(); var file = ""; if (ChildCommentTypeID == 4) { var blob = ChildRecordRC.getBlob(); file = new File([blob], 'filename.webm', { type: 'video/webm' }); } var formData = new FormData(); formData.append("fpChildImage", document.getElementById("fpChildImage").files[0]); formData.append("Name", $("#ChildCommentName").val()); formData.append("CommentID", ParentCommentIDForChildComment); formData.append("CommentType", ChildCommentTypeID); formData.append("Email", $("#ChildCommentEmail").val()); formData.append("Comments", $("#ChildCommentMsg").val()); formData.append("Youtube", $("#videoChild").val()); formData.append("fpvideo", file); $.ajax({ type: "POST", datatype: false, contentType: false, data: formData, processData: false, url: "/Services/Comments.asmx/PostChildComments", success: function (resultchild) { var ele = resultchild.getElementsByTagName("string")[0].childNodes[0].nodeValue; ChildElementComment.children("ul.ulchildcomment").prepend(ele); ChildElementComment.children("ul.ulchildcomment").addClass("haschild"); ChildElementComment.children("ul.ulchildcomment").parent("li").addClass("hasUl"); $("#commentspinnerchild").hide(); $('#btnPostCommentChild').prop('disabled', false); $('#btnPostCommentChild').removeClass('notallowedComment'); CloseChildCommentPopUp(); $("#commentspinnerchild").attr("src", ""); var totalchildcomments = ChildCommentsCounter + 1; var counterhtml = "Reply (" + totalchildcomments.toString() + ")"; $(ReplyBackDiv).children("input#commentcounter").val(totalchildcomments.toString()); $(ReplyBackDiv).children("span").html(counterhtml); }, error: function (er) { alert("Error"); } }); return false; } function PostChild2() { return false; } ////////////////////////// function CloseImagePopupComments() { $("#ikdCommentsImageModel").slideUp("slow"); //$("#ShowImageComments").attr("src", ""); } var CommentChildShowImage = ""; var izoom = 0; function OpenImageComments(chk) { CommentChildShowImage = ""; var n = $(chk).siblings('input').val(); $("#ShowImageComments").attr("src", n); $("#ShowImageComments").removeAttr("style"); $("#ShowImageComments").removeClass("wdimg").addClass("wdimg"); CommentChildShowImage = n; $("#ShowImageComments").load(function () { $("#ShowImageComments").attr("src", CommentChildShowImage); }); $("#ShowImageComments").attr("src", CommentSpinnerImage); $("#ikdCommentsImageModel").slideDown("show"); $("#ShowImageComments").css("cursor", "zoom-in"); $("#ShowImageComments").click(function () { if (izoom == 0) { $(this).removeClass("wdimg"); $(this).css("cursor", "zoom-out"); $(this).animate({ width: window.screen.availWidth }, 'slow'); izoom = 1; } else { $(this).css("cursor", "zoom-in"); $(this).removeAttr("style"); $(this).addClass("wdimg"); izoom = 0; } }); }