").addClass("alert alert-info").css({position:"absolute",top:$("#newCommentTextBox").offset().top,width:$("#newCommentTextBox").width()+"px","z-index":1e3}).html(replaceNewLineWithBrTag(f.newMessage())).appendTo(".comment-form-box").animate({opacity:"toggle",top:"+=500"},1e3,"swing",function(){$(this).remove()})},y=function(){c=setInterval(function(){return e===o.length?(window.clearInterval(c),o=[],e=0,!1):(f.comments.push(o[e]),e++,!1)},1)},l=function(n,t){n.isVoting(!0);$.post(f.configs.voteUrl,{id:n.id,isLiked:t}).done(function(t){if(!t.isSucceed||!t.model.isVoted){n.emptyResponseMessages();n.handleResultResponse(t);return}n.positive(t.model.positiveCount);n.negative(t.model.negativeCount);n.canVote(!0)}).fail(function(){n.resultResponseFailed()}).always(function(){n.isVoting(!1)})},a=function(){t(f.configs.timeBetweenAddComments);h=setInterval(function(){if(t()<=0){clearInterval(h);return}t(t()-1)},1e3);setTimeout(function(){isSendLocked(!1)},f.configs.timeBetweenAddComments*1e3)};f.showFade=function(n){$(n).fadeIn()};f.addCommentButtonText=ko.pureComputed(function(){return f.isAdding()?f.configs.workingMessage:isSendLocked()?t()+" ثانیه تا ارسال بعدی":"ارسال دیدگاه"});f.remainingCharacters=ko.pureComputed(function(){return f.commentLength()-f.newMessage().length});f.canSendComment=ko.pureComputed(function(){return f.newMessage().length>0});f.handleResultResponse=function(n){n!=null&&n&&(f.emptyResponseMessages(),$.each(n.messages,function(n,t){f.responseMessages.push({message:t.message,type:r(t.type)})}),showAlert(f.responseMessages()))};f.resultResponseFailed=function(){f.responseMessages([{message:f.configs.errorMessage,type:"alert-danger"}])};f.setResponseMessage=function(n,t){f.responseMessages([{message:n,type:t}])};f.emptyResponseMessages=function(){f.responseMessages([])};f.checkIfUserIsLogedIn=function(){return f.isUserAuthenticated()?!0:(f.configs.onUnAuthorizedUser(),!1)};f.loadComments=function(){f.isCommentsLoaded(!1);f.loadCommentButtonText("لطفا کمی صبر کنید...");var n=f.configs.loadUrl+f.selectedSortOption().value+"/page/"+f.pageNumber+"/";return $.getJSON(n).done(function(n){f.loadCommentButtonText("نمایش دیدگاه های بیشتر");f.totalCommentsCount(n.totalCount);f.hasMorePages(n.hasMorePages);f.commentLevelCount=n.commentLevelCount;var t=ko.utils.arrayMap(n.comments,function(n){return new i(n)});o=t;y();f.pageNumber++}).fail(function(){f.resultResponseFailed()}).always(function(){f.isCommentsLoaded(!0)}),!1};f.like=function(n){return f.checkIfUserIsLogedIn()?n.isWaitingToConfirm?!1:(l(n,!0),n.emptyResponseMessages(),!1):!1};f.dislike=function(n){return f.checkIfUserIsLogedIn()?n.isWaitingToConfirm?!1:(l(n,!1),n.emptyResponseMessages(),!1):!1};f.blockUser=function(n){return f.checkIfUserIsLogedIn()?(n.setResponseMessage(f.configs.workingMessage,"alert-info"),$.post(f.configs.blockUserUrl,{id:n.id}).done(function(t){n.emptyResponseMessages();n.handleResultResponse(t)}).fail(function(){n.resultResponseFailed()}).always(function(){}),!1):!1};f.blockIp=function(n){return f.checkIfUserIsLogedIn()?(n.setResponseMessage(f.configs.workingMessage,"alert-info"),$.post(f.configs.blockIpUrl,{id:n.id}).done(function(t){n.emptyResponseMessages();n.handleResultResponse(t)}).fail(function(){n.resultResponseFailed()}).always(function(){}),!1):!1};f.addComment=function(){if(!f.checkIfUserIsLogedIn())return!1;if(f.isAdding(!0),f.emptyResponseMessages(),f.isAdmin()||isSendLocked(!0),f.isUserAuthenticated()==="false"){popupQuickLoginRegister();return}return $.post(f.configs.addUrl,{productRef:f.configs.productId,message:f.newMessage()}).done(function(n){if(!n.isSucceed){isSendLocked(!1);f.handleResultResponse(n);return}f.isAdmin()||a();v();f.newMessage("");var t=new i(n.model);f.comments.push(t);u(t,500)}).fail(function(){f.resultResponseFailed()}).always(function(){f.isAdding(!1)}),!1};f.reply=function(n){return f.checkIfUserIsLogedIn()?n.isWaitingToConfirm?!1:(s(f.comments()),n.isEditMode(!1),n.showInlineMessage(!n.showInlineMessage()),n.hasFocus(!0),n.inlineMessage("@"+n.name+"\n"),n.emptyResponseMessages(),!1):!1};f.edit=function(n){if(!f.checkIfUserIsLogedIn()||n.isWaitingToConfirm)return!1;s(f.comments());n.isEditMode(!0);n.showInlineMessage(!n.showInlineMessage());n.hasFocus(!0);var t=decodeHtml(replaceBrTagWithNewLine(n.message()));return n.inlineMessage(t),n.emptyResponseMessages(),!1};f.sendInlineComment=function(n){if(!f.checkIfUserIsLogedIn()||n.isWaitingToConfirm)return!1;if(f.isUserAuthenticated()==="false"){popupQuickLoginRegister();return}return n.isSendingMessage(!0),n.emptyResponseMessages(),n.isEditMode()?$.post(f.configs.editUrl,{productRef:f.configs.productId,id:n.id,message:n.inlineMessage()}).done(function(t){if(!t.isSucceed){n.handleResultResponse(t);return}n.message(replaceNewLineWithBrTag(n.inlineMessage()));n.showInlineMessage(!1)}).fail(function(){n.resultResponseFailed()}).always(function(){n.isSendingMessage(!1)}):(f.isAdmin()||isSendLocked(!0),$.post(f.configs.replyUrl,{productRef:f.configs.productId,commentId:n.id,message:n.inlineMessage()}).done(function(t){if(!t.isSucceed){isSendLocked(!1);n.handleResultResponse(t);return}f.isAdmin()||a();n.showInlineMessage(!1);var r=new i(t.model);n.comments.push(r);u(r)}).fail(function(){n.resultResponseFailed()}).always(function(){n.isSendingMessage(!1)})),!1};f.report=function(n,t){return f.checkIfUserIsLogedIn()?n.isWaitingToConfirm?!1:($(t.target).prop("disabled",!0),n.setResponseMessage(f.configs.workingMessage,"alert-info"),$.post(f.configs.reportUrl,{id:n.id}).done(function(t){n.emptyResponseMessages();n.handleResultResponse(t)}).fail(function(){n.resultResponseFailed();$(t.target).prop("disabled",!1)}),!1):!1};f.delete=function(n,t){return f.checkIfUserIsLogedIn()?(n.isChangingStatus(!0),$.post(f.configs.deleteUrl,{id:n.id}).done(function(i){i.isSucceed&&$(t.target).closest(".comment").hide("slow",function(){f.comments.remove(n)})}).fail(function(){n.resultResponseFailed();n.isChangingStatus(!1)}),!1):!1};f.unpublish=function(n,t){return f.checkIfUserIsLogedIn()?(n.isChangingStatus(!0),$.post(f.configs.unPublishUrl,{id:n.id}).done(function(i){i.isSucceed&&$(t.target).closest(".comment").hide("slow",function(){f.comments.remove(n)})}).fail(function(){n.resultResponseFailed();n.isChangingStatus(!1)}),!1):!1};f.changeSortOption=function(n){f.comments([]);for(var t=0;t
=100};f.setFullHeight=function(){f.fullHeight(!f.fullHeight())};f.remainingCharacters=ko.pureComputed(function(){return n.commentLength()-f.inlineMessage().length});f.isInlineSendButtonEnabled=ko.pureComputed(function(){if(f.isEditMode()){if(f.inlineMessage().length>0)return!0}else return isSendLocked()?!1:f.inlineMessage().length>0});f.sendInlineCommentButtonText=ko.pureComputed(function(){return f.isSendingMessage()?n.workingMessage:f.isEditMode()?"ویرایش":isSendLocked()?t()+" ثانیه تا ارسال بعدی":"ارسال"});f.handleResultResponse=function(n){n!=null&&n&&($.each(n.messages,function(n,t){f.responseMessages.push({message:t.message,type:t.type})}),showAlert(f.responseMessages()))};f.resultResponseFailed=function(){f.responseMessages([{message:n.errorMessage,type:"alert-danger"}])};f.setResponseMessage=function(n,t){f.responseMessages([{message:n,type:t}])};f.emptyResponseMessages=function(){f.responseMessages([])};f.persianDateTime=ko.pureComputed(function(){return f.stringCreateDate});f.hasComment=ko.pureComputed(function(){return f.comments().length>0});f.canEdit=ko.pureComputed(function(){return n.isAdmin()||n.isAuthor()||c()});l()};this.CommentViewModel=function(){var a,s=0,h=[],v,r=this,e,o,l;r.configs={topicId:0,pageSize:20,workingMessage:"لطفا کمی صبر کنید...",errorMessage:"متأسفانه خطایی رخ داده است",commentLength:500,timeBetweenAddComments:5,remainingTimeToEditComment:15,defaultAvatarPath:"",prefixAvatarPath:"",loadUrl:"",addUrl:"",editUrl:"",replyUrl:"",voteUrl:"",toggleVoteUrl:"",reportUrl:"",unPublishUrl:"",deleteUrl:"",blockIpUrl:"",blockUserUrl:"",infoMessageType:0,warningMessageType:0,successMessageType:0,errorMessageType:0,isReadOnlyEnabled:!1,onUnAuthorizedUser:function(){popupQuickLoginRegister()}};r.commentLength=ko.observable(r.configs.commentLength);r.isUserAuthenticated=ko.observable(!1);r.isReadOnlyEnabled=ko.observable(!1);r.currentUserName="";r.isAuthor=ko.observable(!1);r.isAdmin=ko.observable(!1);r.currentUserLiked=ko.observable(!1);r.comments=ko.observableArray([]).extend({deferred:!0});r.isCommentsLoaded=ko.observable(!0);r.isAdding=ko.observable(!1);r.responseMessages=ko.observableArray([]);r.newMessage=ko.observable("");r.hasMorePages=ko.observable(!0);r.commentLevelCount=2;r.loadCommentButtonText=ko.observable("نمایش دیدگاه ها");r.totalCommentsCount=ko.observable(0);r.pageNumber=1;r.sortOptions=ko.observableArray([new SortOption("لایک",4,!0),new SortOption("قدیمی",1,!1),new SortOption("جدید",2,!1)]);r.selectedSortOption=ko.observable(r.sortOptions()[0]);var c=function(n){$.each(n,function(n,t){t.inlineMessage("");t.showInlineMessage(!1);t.hasFocus(!1);t.hasComment()&&c(t.comments())})},w=function(){$("").addClass("alert alert-info").css({position:"absolute",top:$("#newCommentTextBox").offset().top,width:$("#newCommentTextBox").width()+"px","z-index":1e3}).html(replaceNewLineWithBrTag(r.newMessage())).appendTo(".comment-form-box").animate({opacity:"toggle",top:"+=500"},1e3,"swing",function(){$(this).remove()})},b=function(){v=setInterval(function(){return s===h.length?(window.clearInterval(v),h=[],s=0,!1):(r.comments.push(h[s]),s++,!1)},1)},y=function(n,t){n.isVoting(!0);$.post(r.configs.voteUrl,{id:n.id,isLiked:t}).done(function(t){if(!t.isSucceed||!t.model.isVoted){n.emptyResponseMessages();n.handleResultResponse(t);return}n.positive(t.model.positiveCount);n.negative(t.model.negativeCount);n.canVote(!0)}).fail(function(){n.resultResponseFailed()}).always(function(){n.isVoting(!1)})},k=function(n){n.isVoting(!0);$.post(r.configs.toggleVoteUrl,{id:n.id}).done(function(t){n.emptyResponseMessages();n.positive(t.model.positiveCount);n.negative(t.model.negativeCount);n.currentUserLiked(t.model.isVoted);n.canVote(!0)}).fail(function(){n.resultResponseFailed()}).always(function(){n.isVoting(!1)})},p=function(){t(r.configs.timeBetweenAddComments);a=setInterval(function(){if(t()<=0){clearInterval(a);return}t(t()-1)},1e3);setTimeout(function(){isSendLocked(!1)},r.configs.timeBetweenAddComments*1e3)},d=function(){$("#btn-showcomments").parent().hide();$("#comments_Div").show()};r.showFade=function(n){$(n).fadeIn()};r.addCommentButtonText=ko.pureComputed(function(){return r.isAdding()?r.configs.workingMessage:isSendLocked()?t()+" ثانیه تا ارسال بعدی":"ارسال دیدگاه"});r.remainingCharacters=ko.pureComputed(function(){return r.commentLength()-r.newMessage().length});r.canSendComment=ko.pureComputed(function(){return r.newMessage().length>0});r.handleResultResponse=function(n){n!=null&&n&&(r.emptyResponseMessages(),$.each(n.messages,function(n,t){r.responseMessages.push({message:t.message,type:f(t.type)})}),showAlert(r.responseMessages()))};r.resultResponseFailed=function(){r.responseMessages([{message:r.configs.errorMessage,type:"alert-danger"}])};r.setResponseMessage=function(n,t){r.responseMessages([{message:n,type:t}])};r.emptyResponseMessages=function(){r.responseMessages([])};r.checkIfUserIsLogedIn=function(){return r.isUserAuthenticated()?!0:(r.configs.onUnAuthorizedUser(),!1)};r.loadComments=function(){r.isCommentsLoaded(!1);r.loadCommentButtonText("لطفا کمی صبر کنید...");var n=r.configs.loadUrl+r.selectedSortOption().value+"/page/"+r.pageNumber+"/";return $.getJSON(n).done(function(n){r.loadCommentButtonText("نمایش دیدگاه های بیشتر");r.totalCommentsCount(n.totalCount);r.hasMorePages(n.hasMorePages);r.commentLevelCount=n.commentLevelCount;var t=ko.utils.arrayMap(n.comments,function(n){return new i(n)});h=t;t.forEach(function(n){n.message(r.spoilReplace(n.message()))});b();r.pageNumber++}).fail(function(){r.resultResponseFailed()}).always(function(){r.isCommentsLoaded(!0)}),!1};r.like=function(n){return r.checkIfUserIsLogedIn()?n.isWaitingToConfirm?!1:(y(n,!0),n.emptyResponseMessages(),!1):!1};r.toggleLike=function(n){return r.checkIfUserIsLogedIn()?n.isWaitingToConfirm?!1:(k(n),n.emptyResponseMessages(),!1):!1};r.visibleComments=function(n){n.isVisibleComments(!n.isVisibleComments())};r.widthWords=function(n){var t=n.message(),i;return t=t.replace(/(^\s*)|(\s*$)/gi,""),t=t.replace(/[ ]{2,}/gi," "),t=t.replace(/\n /,"\n"),i=t.split(" ").length,console.log(i>=100?!0:!1),i>=100?!0:!1};r.dislike=function(n){return r.checkIfUserIsLogedIn()?n.isWaitingToConfirm?!1:(y(n,!1),n.emptyResponseMessages(),!1):!1};r.blockUser=function(n){return r.checkIfUserIsLogedIn()?(n.setResponseMessage(r.configs.workingMessage,"alert-info"),$.post(r.configs.blockUserUrl,{id:n.id}).done(function(t){n.emptyResponseMessages();n.handleResultResponse(t)}).fail(function(){n.resultResponseFailed()}).always(function(){}),!1):!1};r.blockIp=function(n){return r.checkIfUserIsLogedIn()?(n.setResponseMessage(r.configs.workingMessage,"alert-info"),$.post(r.configs.blockIpUrl,{id:n.id}).done(function(t){n.emptyResponseMessages();n.handleResultResponse(t)}).fail(function(){n.resultResponseFailed()}).always(function(){}),!1):!1};r.addComment=function(){return r.checkIfUserIsLogedIn()?(r.isAdding(!0),r.emptyResponseMessages(),r.isAdmin()||isSendLocked(!0),$.post(r.configs.addUrl,{topicId:r.configs.topicId,message:r.newMessage()}).done(function(n){if(!n.isSucceed){isSendLocked(!1);r.handleResultResponse(n);return}r.isAdmin()||p();d();w();r.newMessage("");var t=new i(n.model);t.message(r.spoilReplace(t.message()));r.comments.push(t);u(t,500)}).fail(function(){r.resultResponseFailed()}).always(function(){r.isAdding(!1)}),!1):!1};r.reply=function(n){return r.checkIfUserIsLogedIn()?n.isWaitingToConfirm?!1:(c(r.comments()),n.isEditMode(!1),n.showInlineMessage(!n.showInlineMessage()),n.hasFocus(!0),n.emptyResponseMessages(),!1):!1};r.edit=function(n){if(!r.checkIfUserIsLogedIn()||n.isWaitingToConfirm)return!1;c(r.comments());n.isEditMode(!0);n.showInlineMessage(!n.showInlineMessage());n.hasFocus(!0);var t=decodeHtml(replaceBrTagWithNewLine(r.unSpoilReplace(n.message())));return n.inlineMessage(t),n.emptyResponseMessages(),!1};e="";o="<\/span>";r.spoilReplace=function(n){return n.replace("(*",e).replace("*)",o).replace("(*",e).replace("*)",o).replace("(*",e).replace("*)",o).replace("(*",e).replace("*)",o)};r.unSpoilReplace=function(n){return n.replace(e,"(*").replace(o,"*)").replace(e,"(*").replace(o,"*)").replace(e,"(*").replace(o,"*)").replace(e,"(*").replace(o,"*)")};r.sendInlineComment=function(n){if(!r.checkIfUserIsLogedIn()||n.isWaitingToConfirm)return!1;n.isSendingMessage(!0);n.emptyResponseMessages();var t=n.inlineMessage();return n.isEditMode()||t.includes("@"+n.name+"\n")||(t="@"+n.name+"\n"+t,n.inlineMessage(t)),n.inlineMessage(n.inlineMessage()),n.isEditMode()?$.post(r.configs.editUrl,{topicRef:r.configs.topicId,id:n.id,message:n.inlineMessage()}).done(function(t){if(!t.isSucceed){n.handleResultResponse(t);return}n.message(r.spoilReplace(n.message()));n.inlineMessage(r.spoilReplace(n.inlineMessage()));n.message(replaceNewLineWithBrTag(n.inlineMessage()));n.showInlineMessage(!1)}).fail(function(){n.resultResponseFailed()}).always(function(){n.isSendingMessage(!1)}):(r.isAdmin()||isSendLocked(!0),$.post(r.configs.replyUrl,{topicId:r.configs.topicId,commentId:n.id,message:n.inlineMessage()}).done(function(t){if(!t.isSucceed){isSendLocked(!1);n.handleResultResponse(t);return}r.isAdmin()||p();n.showInlineMessage(!1);var f=new i(t.model);f.message(r.spoilReplace(f.message()));n.comments.push(f);u(f)}).fail(function(){n.resultResponseFailed()}).always(function(){n.isSendingMessage(!1)})),!1};r.report=function(n,t){return r.checkIfUserIsLogedIn()?n.isWaitingToConfirm?!1:($(t.target).prop("disabled",!0),n.setResponseMessage(r.configs.workingMessage,"alert-info"),$.post(r.configs.reportUrl,{id:n.id}).done(function(t){n.emptyResponseMessages();n.handleResultResponse(t)}).fail(function(){n.resultResponseFailed();$(t.target).prop("disabled",!1)}),!1):!1};r.delete=function(n,t){return r.checkIfUserIsLogedIn()?(n.isChangingStatus(!0),$.post(r.configs.deleteUrl,{id:n.id}).done(function(i){i.isSucceed&&$(t.target).closest(".comment").hide("slow",function(){r.comments.remove(n)})}).fail(function(){n.resultResponseFailed();n.isChangingStatus(!1)}),!1):!1};r.unpublish=function(n,t){return r.checkIfUserIsLogedIn()?(n.isChangingStatus(!0),$.post(r.configs.unPublishUrl,{id:n.id}).done(function(i){i.isSucceed&&$(t.target).closest(".comment").hide("slow",function(){r.comments.remove(n)})}).fail(function(){n.resultResponseFailed();n.isChangingStatus(!1)}),!1):!1};r.changeSortOption=function(n){r.comments([]);for(var t=0;t0&&!u.isMultipleSelect&&$(r.children()).each(function(){this.id!==u.id&&(this.isSelected=ko.observable(!1),this.isSelected.subscribe(s))});o()},u.showAll=function(n,t){$(t.target).animate({opacity:0},500);var i=0;$(t.target).closest(".optionList").find("ul>li").each(function(){i+=$(this).outerHeight(!0)});$(t.target).closest(".optionList").find(".hide_Items").each(function(){$(this).delay(200).fadeIn(500,function(){$(this).removeClass("hide_Items")});$(this).prev(".customizeScroll").animate({scrollTop:i},10)});i>95&&($(t.target).prev(".customizeScroll").addClass("moreHeight"),$(t.target).prev(".customizeScroll").scrollbar());$(".filterInnerBox").attr("data-showAll","true");$(t.target).closest(".dropdown").addClass("all-is-shown");$(t.target).remove()},u.value.subscribe(function(){o()}),u.maximumValue.subscribe(function(){o()}),u.isSelected.subscribe(s),u.isListFilter=ko.pureComputed(function(){return u.showType.toLowerCase()==="list"}),u.isRangeFilter=ko.pureComputed(function(){return u.showType.toLowerCase()==="range"}),u.isNumberRange=ko.pureComputed(function(){return u.minimum!=null&&u.maximum!=null&&!isNaN(u.minimum)&&!isNaN(u.maximum)}),u.isRateRange=ko.pureComputed(function(){return u.minimum!=null&&!isNaN(u.minimum)&&u.showType==="range"&&u.type==="rate"}),u.onMinimumMaximumChange=function(n,t){var i=$(t.target).val().split(",");u.minimumValue(i[0]);u.maximumValue(i[1])},u.onValueChanged=function(n,t){var i=$(t.target)[0].value.split(","),r=0,f=0;i.length===2&&(r=i[0],f=i[1]);u.maximumValue(f);u.minimumValue(r)},u.setChildren=function(t){var r=ko.utils.arrayMap(t,function(t){return new n(t,i,u)});u.children([]);u.children.push.apply(u.children,r)},t.children&&t.children.length>0){for(var h=[],f=0,e={},f=0;f0)for(t=0;t0)for(t=0;t0&&r(i.options.items)};i.sendReview=function(){if(e()){i.isSendingReview(!0);o();var n=f();$.post(i.options.requestUrl,n).done(function(n){n?n.isSucceed?(r(n.model),s(n.messages)):h(n.messages):u()}).fail(function(){u()}).always(function(){i.isSendingReview(!1)})}};c()}}(),function(){this.ProductHaveIt=function(n){var t=this;t.options=$.extend({productId:0,iHaveItRequestUrl:"",iWantItRequestUrl:"",iHadItRequestUrl:"",haveItCount:0,wantItCount:0,hadItCount:0,onBeforeSend:function(){},onSendingRequest:function(){},onRequestSucceed:function(){},onRequestFailed:function(){},onError:function(){}},n);t.isSendingRequest=ko.observable(!1);t.haveItCount=ko.observable(0);t.wantItCount=ko.observable(0);t.hadItCount=ko.observable(0);var f=function(){return t.options.onBeforeSend&&typeof t.options.onBeforeSend=="function"?t.options.onBeforeSend():!0},e=function(){t.options.onSendingRequest&&typeof t.options.onSendingRequest=="function"&&t.options.onSendingRequest()},o=function(n){if(t.options.onRequestSucceed&&typeof t.options.onRequestSucceed=="function")t.options.onRequestSucceed(n)},s=function(n){if(t.options.onRequestFailed&&typeof t.options.onRequestFailed=="function")t.options.onRequestFailed(n)},r=function(){t.options.onError&&typeof t.options.onError=="function"&&t.options.onError()},u=function(n){t.haveItCount(n.haveItCount);t.wantItCount(n.wantItCount);t.hadItCount(n.hadItCount)},h=function(){if(isNullOrWhiteSpace(t.options.iHaveItRequestUrl)){alert("iHaveItUrl is not set. set it in initialize.");return}if(isNullOrWhiteSpace(t.options.iWantItRequestUrl)){alert("iWantItUrl is not set. set it in initialize.");return}if(isNullOrWhiteSpace(t.options.iHadItRequestUrl)){alert("iHadItUrl is not set. set it in initialize.");return}if(t.options.productId<=0){alert("productId is not set. set it in initialize.");return}u({haveItCount:t.options.haveItCount,wantItCount:t.options.wantItCount,hadItCount:t.options.hadItCount})},c=function(){return JSON.parse(ko.toJSON({productId:t.options.productId}))},i=function(n){if(f()){e();t.isSendingRequest(!0);var i=c();$.post(n,i).done(function(n){n?n.isSucceed?(u(n.model),o(n.messages)):s(n.messages):r()}).fail(function(){r()}).always(function(){t.isSendingRequest(!1)})}};t.iHaveIt=function(){i(t.options.iHaveItRequestUrl)};t.iWantIt=function(){i(t.options.iWantItRequestUrl)};t.iHadIt=function(){i(t.options.iHadItRequestUrl)};h()}}();settings={"async":!0,url:"https://affiliateservices.adro.co/api/Products",method:"POST",headers:{token:"5f8bb000-d650-4549-b415-c9ddbd319ad2","Content-Type":"application/json"},data:'{\r\n"url":"https://affstat.adro.co/click/d585700b-0f87-4e35-b1a2-fa32fa3b357d"\r\n}'},function(){this.MasterViewModel=function(){var n=this;ko.setTemplateEngine(new ko.nativeTemplateEngine);n.advertisementManagerViewModel=new AdvertisementManagerViewModel;n.commentViewModel=new CommentViewModel;n.previewViewModel=new PreviewViewModel;n.AffiliateDigikala=new AffiliateDigikala};MasterViewModel.prototype.loadBanners=function(n){this.advertisementManagerViewModel.load(n)};MasterViewModel.prototype.start=function(){ko.applyBindings(this)}}();masterViewModel=new MasterViewModel;$(document).delegate(".ipa-message-box","click",function(){var n=$(this).closest(".ipa-message-item");n.toggle(500);setTimeout(function(){n.remove()},400)});$(document).ready(function(){$("body").append("