﻿var mouseHoverID; var controlPosition; function ShowUserProfileSummery(b) { var a = $(b).attr("id"); a = a.substring(9, a.length); mouseHoverID = a; var c = $(b).offset(); if ($("#ProfileView_" + a).length) { if ($("#ProfileView_" + a).css("display") == "none") { setTimeout(function () { if (mouseHoverID == a) { var d = c.left - $("#ProfileView_" + a).width(); $("#ProfileView_" + a).css({ left: (d - 15) + "px", top: (c.top - 35) + "px" }).show() } }, 500); return } else { setTimeout(function () { if (mouseHoverID == a) { var d = c.left - $("#ProfileView_" + a).width(); $("#ProfileView_" + a).css({ left: (d - 15) + "px", top: (c.top - 35) + "px" }) } }, 100) } } else { $.ajax({ url: "/Profile/SmallProfileView?customerID=" + a + "&X-Requested-With=XMLHttpRequest", cache: false, success: function (d) { d = d + $("#profileSummery").html(); $("#profileSummery").html(d); if (mouseHoverID == a) { var e = c.left - $("#ProfileView_" + a).width(); $("#ProfileView_" + a).css({ left: (e - 15) + "px", top: (c.top - 35) + "px" }).show() } else { var e = c.left - $("#ProfileView_" + a).width(); $("#ProfileView_" + a).css({ left: (e - 15) + "px", top: (c.top - 35) + "px" }).hide() } } }) } } function HideSmallProfileView(a) { mouseHoverID = ""; $("#profileSummery").children().hide() } function SharedSuccess(a) { if (a.message) { RequestComplete(a) } } $(document).click(function (a) { HideSmallProfileView() }); function CallAjaxRequest(d, b, c, a, e, f) { if (e) { $("#" + e).css("display", "block") } $.ajax({ url: d, type: b, cache: false, success: function (g) { if (g.message) { RequestComplete(g) } else { if (e) { $("#" + e).css("display", "none") } if (a == 0) { $("#" + c).html(g) } else { if (a == 1) { var h = $("#" + c).html(); h = g + h; $("#" + c).html(h) } else { if (a == 2) { var h = $("#" + c).html(); h = h + h; $("#" + c).html(h) } } } $("#" + c).slideDown("slow"); if ($("#ListTranslations_" + f).length > 0 && c != "ListTranslations_" + f) { $("#ListTranslations_" + f).slideUp("slow") } if ($("#ListComments_" + f).length > 0 && c != "ListComments_" + f) { $("#ListComments_" + f).slideUp("slow") } if ($("#Comment_" + f).length > 0 && c != "Comment_" + f) { $("#Comment_" + f).slideUp("slow") } if ($("#AddTranslation_" + f).length > 0 && c != "Translation_" + f) { $("#AddTranslation_" + f).slideUp("slow") } } } }) } function GetImageFromServer(c, a, b, d, e) { if ($("#" + b).attr("alt") == undefined) { $("#" + e + " #" + b).attr("src", $("#" + b).attr("src")); return } $.ajax({ url: c, type: a, cache: false, success: function (f) { $("#" + b).parent().find("script").remove(); $("#" + e + " #" + b).attr("src", f); $("#" + e + " #" + b).removeAttr("alt") } }) } function RequestComplete(a) { if (a.message) { window.location = "http://www.benego.com" } } function RequestCommentAdded(b) { $("#CommentIndex_" + b).val("1"); if ($("#ListCommentsWrapper_" + b).length > 0) { $("#ListCommentsWrapper_" + b).slideDown("slow") } else { var a = $("#ListComments_" + b); a.addClass("max_height_250 listcomments"); a.slimscroll({ alwaysVisible: true, railVisible: false, wrapperClass: "slimScrollDiv active_req_comment_scroll", pointerClass: "activereqcomment" }); a.parent().attr("id", "ListCommentsWrapper_" + b); a.parent().append(showMoreHtml); a.slideDown("slow") } } function CommentAdded(b) { $("#CommentIndex_" + b).val("1"); if ($("#ListCommentsWrapper_" + b).length > 0) { $("#ListCommentsWrapper_" + b).slideDown("slow") } else { var a = $("#ListComments_" + b); a.addClass("max_height_250 listcomments"); a.slimscroll({ alwaysVisible: true, railVisible: false, wrapperClass: "slimScrollDiv active_comment_scroll", pointerClass: "activecomment" }); a.parent().attr("id", "ListCommentsWrapper_" + b); a.parent().append(showMoreHtml); a.slideDown("slow") } } function IncrementSuggestionCount(d) { TranslationAdded(d); $("#TranslationIndex_" + d).val("1"); $("#SubmitSuggestion_" + d).removeAttr("disabled"); var c = $("#sugCount_" + d).html(); var a = c.split(":"); var b = parseInt(c); if (b == 0) { $("#sugText_" + d).hide(); $("#sugLink_" + d).show() } b = b + 1; $("#sugCount_" + d).html(b); ShowTranslationsList(d); return true } function IncrementCommentCount(d, a) { $("#SubmitComment_" + d).removeAttr("disabled"); var c = $("#commCount_" + d).html(); var b = parseInt(c); if (b == 0) { $("#commText_" + d).hide(); $("#commLink_" + d).show() } b = b + 1; $("#commCount_" + d).html(b); if (a == "True") { RequestCommentAdded(d) } else { CommentAdded(d) } ShowCommentsList(d); return true } function Cancel(a, b) { $("#" + a).slideUp("slow"); $("#Phrase_" + b).addClass("borderbottom"); $("#Translation_" + b).addClass("borderbottom") } function IncrementVoteUpCount(c) { if ($("#VoteUpCount_" + c).length) { var b = parseInt($("#VoteUpCount_" + c).html()); var a = parseInt($("#VoteDownCount_" + c).html()); if ($("#VoteUpDisabled_" + c).css("display") == "none") { b = b + 1; if ($("#VoteDownDisabled_" + c).css("display") != "none") { if (a != 0) { a = a - 1 } $("#VoteDownDisabled_" + c).hide(); $("#VoteDownEnabled_" + c).show() } $("#VoteUpDisabled_" + c).show(); $("#VoteUpEnabled_" + c).hide() } else { b = b - 1; $("#VoteUpDisabled_" + c).hide(); $("#VoteUpEnabled_" + c).show() } $("#VoteUpCount_" + c).html(b.toString()); $("#VoteDownCount_" + c).html(a.toString()) } } function IncrementVoteDownCount(c) { if ($("#VoteDownCount_" + c).length) { var a = parseInt($("#VoteDownCount_" + c).html()); var b = parseInt($("#VoteUpCount_" + c).html()); if ($("#VoteDownDisabled_" + c).css("display") == "none") { a = a + 1; if ($("#VoteUpDisabled_" + c).css("display") != "none") { if (b != 0) { b = b - 1 } $("#VoteUpDisabled_" + c).hide(); $("#VoteUpEnabled_" + c).show() } $("#VoteDownDisabled_" + c).show(); $("#VoteDownEnabled_" + c).hide() } else { a = a - 1; $("#VoteDownDisabled_" + c).hide(); $("#VoteDownEnabled_" + c).show() } $("#VoteDownCount_" + c).html(a.toString()); $("#VoteUpCount_" + c).html(b.toString()) } } function ShowHidePanel(a) { if ($("#" + a).css("display") == "none") { $("#" + a).slideDown("slow") } else { $("#" + a).slideUp("slow") } } var showMoreHtml = undefined; function DisableTranslationSubmitButton(a) { $("#SubmitSuggestion_" + a).attr("disabled", "disabled"); showMoreHtml = $("#ListTranslations_" + a).html() } function DisableCommentSubmitButton(a) { $("#SubmitComment_" + a).attr("disabled", "disabled"); showMoreHtml = $("#ListComments_" + a).html() } function ShowCommentBox(a) { if ($("#Comment_" + a).css("display") != "none") { HideAllTabs(a) } else { $("#txtComment_" + a).val(""); $("#ListTranslationsWrapper_" + a).parent().find(".activetrans").hide(); $("#ListTranslationsWrapper_" + a).slideUp("slow"); $("#ListCommentsWrapper_" + a).parent().find(".activecomment").hide(); $("#ListCommentsWrapper_" + a).parent().find(".activereqcomment").hide(); $("#ListCommentsWrapper_" + a).slideUp("slow"); $("#AddTranslation_" + a).slideUp("slow"); $("#Comment_" + a).slideDown("slow"); $("#Phrase_" + a).removeClass(); $("#Translation_" + a).removeClass() } } function ShowTranslationBox(a) { if ($("#AddTranslation_" + a).css("display") != "none") { HideAllTabs(a) } else { $("#txtTranslation_" + a).val(""); $("#ListTranslationsWrapper_" + a).parent().find(".activetrans").hide(); $("#ListTranslationsWrapper_" + a).parent().find(".activereqtrans").hide(); $("#ListTranslationsWrapper_" + a).slideUp("slow"); $("#ListCommentsWrapper_" + a).parent().find(".activecomment").hide(); $("#ListCommentsWrapper_" + a).slideUp("slow"); $("#Comment_" + a).slideUp("slow"); $("#AddTranslation_" + a).slideDown("slow"); $("#Phrase_" + a).removeClass() } } function ShowTranslationsList(b) { var a = parseInt($("#sugCount_" + b).html()); if (a <= 5) { $("#ShowMore_" + b).hide() } else { $("#ShowMore_" + b).show(); $("#ShowMoreLink_" + b).show(); $("#NoMoreData_" + b).hide() } $("#ListTranslationsWrapper_" + b).slideDown("slow"); $("#ListTranslationsWrapper_" + b).parent().find(".activetrans").show(); $("#ListCommentsWrapper_" + b).parent().find(".activecomment").hide(); $("#ListCommentsWrapper_" + b).parent().find(".activereqcomment").hide(); $("#ListCommentsWrapper_" + b).slideUp("slow"); $("#Comment_" + b).slideUp("slow"); $("#AddTranslation_" + b).slideUp("slow"); $("#Phrase_" + b).removeClass() } function HideAllTabs(a) { $("#ListTranslationsWrapper_" + a).parent().find(".activetrans").hide(); $("#ListTranslationsWrapper_" + a).slideUp("slow"); $("#ListCommentsWrapper_" + a).parent().find(".activecomment").hide(); $("#ListCommentsWrapper_" + a).parent().find(".activereqcomment").hide(); $("#ListCommentsWrapper_" + a).slideUp("slow"); $("#Comment_" + a).slideUp("slow"); $("#AddTranslation_" + a).slideUp("slow"); $("#Phrase_" + a).addClass("borderbottom"); $("#Translation_" + a).addClass("borderbottom") } function ShowCommentsList(b) { var a = parseInt($("#commCount_" + b).html()); if (a <= 4) { $("#ShowMoreComments_" + b).hide() } else { $("#ShowMoreComments_" + b).show(); $("#ShowMoreCommentsLink_" + b).show(); $("#NoMoreComments_" + b).hide() } $("#ListCommentsWrapper_" + b).parent().find(".activecomment").show(); $("#ListCommentsWrapper_" + b).parent().find(".activereqcomment").show(); $("#ListCommentsWrapper_" + b).slideDown("slow"); $("#ListTranslationsWrapper_" + b).parent().find(".activetrans").hide(); $("#ListTranslationsWrapper_" + b).slideUp("slow"); $("#Comment_" + b).slideUp("slow"); $("#AddTranslation_" + b).slideUp("slow"); $("#Phrase_" + b).removeClass(); $("#Translation_" + b).removeClass() } $(function () { $(".Scrollable").slimscroll({ alwaysVisible: false, railVisible: false }) }); function clearForm(b) { AddPhraseToList(); RequestComplete(b); var a = parseInt($("#PhrasesAskedCount").html()); a = a + 1; $("#PhrasesAskedCount").html(a); var c = parseInt($("#GoGoPoints").html()); c = c + 1; $("#GoGoPoints").html(c); SetPhraseText(); $("#ShowOnFacebook").attr("checked", false); $("#submit").removeAttr("disabled"); return true } function TranslationAdded(d) { $("#TranslationIndex_" + d).val("1"); var a = parseInt($("#PhrasesTranslatedCount").html()); a = a + 1; $("#PhrasesTranslatedCount").html(a); var c = parseInt($("#GoGoPoints").html()); c = c + 2; $("#GoGoPoints").html(c); if ($("#ListTranslationsWrapper_" + d).length > 0) { $("#ListTranslationsWrapper_" + d).slideDown("slow") } else { var b = $("#ListTranslations_" + d); b.addClass("max_height_300"); b.slimscroll({ alwaysVisible: true, railVisible: false, wrapperClass: "slimScrollDiv activescroll", pointerClass: "activetrans" }); b.parent().attr("id", "ListTranslationsWrapper_" + d); b.parent().append(showMoreHtml); b.slideDown("slow") } } function AddPhraseToList() { var b = ""; var a; if ($("#allLangLink").css("display") == "none") { $("#allLanguagesPanel :checked").each(function () { var c = $(this).attr("id"); var d = parseInt(c.charAt(c.toString().length - 1)); if (b.length > 0) { b = b + "," } b = b + d }) } else { $("#myLanguagesPanel :checked").each(function () { var c = $(this).attr("id"); var d = parseInt(c.charAt(c.toString().length - 1)); if (b.length > 0) { b = b + "," } b = b + d }) } $.ajax({ url: "/Feed/ListPhrases?module=" + $("#Module").val() + "&pageIndex=1&pageSize=1&CustID=&strLangIDs=" + b, cache: false, success: function (c) { $("#mainPanel").prepend(c).slideDown("slow") } }) } function SetVoteUp(a) { $("#SuggLoading_" + a).show(); $.ajax({ url: "/Home/SubmitLike?LikeFor=suggestion&ObjectID=" + a, cache: false, complete: function () { $("#SuggLoading_" + a).hide() }, success: function (b) { IncrementVoteUpCount(a) } }) } function SetVoteDown(a) { $("#SuggLoading_" + a).show(); $.ajax({ url: "/Home/SubmitVoteDown?VoteFor=suggestion&ObjectID=" + a, cache: false, complete: function () { $("#SuggLoading_" + a).hide() }, success: function (b) { IncrementVoteDownCount(a) } }) } function DisplayTranslations(a) { if ($("#ListTranslationsWrapper_" + a).length > 0 && $("#ListTranslationsWrapper_" + a).css("display") != "none") { HideAllTabs(a) } else { $("#TranslationIndex_" + a).val("1"); $("#ReqLoading_" + a).show(); $.ajax({ url: "/Feed/Listsuggestions?requestID=" + a, cache: false, complete: function () { $("#ReqLoading_" + a).hide() }, success: function (b) { if ($("#ListTranslationsWrapper_" + a).length > 0) { if ($("#ListTranslationsWrapper_" + a).attr("class") != "slimScrollDiv activescroll") { var c = $("#ListTranslations_" + a); c.html(b); c.show() } else { $("#ListTranslations_" + a).html(b); $("#ListTranslationsWrapper_" + a).slideDown("slow") } } else { var c = $("#ListTranslations_" + a); var d = c.html(); c.addClass("max_height_300"); c.html(b); c.slimscroll({ id: a, alwaysVisible: true, railVisible: false, wrapperClass: "slimScrollDiv activescroll", pointerClass: "activetrans" }); c.parent().attr("id", "ListTranslationsWrapper_" + a); c.parent().append(d); c.slideDown("slow") } ShowTranslationsList(a) } }) } } function DisplayRequestComments(b, a) { if ($("#ListCommentsWrapper_" + b).length > 0 && $("#ListCommentsWrapper_" + b).css("display") != "none") { HideAllTabs(b) } else { $("#CommentIndex_" + b).val("1"); $("#ReqLoading_" + b).show(); $.ajax({ url: "/Feed/ListRequestComments?requestID=" + b, cache: false, complete: function () { $("#ReqLoading_" + b).hide() }, success: function (c) { if ($("#ListCommentsWrapper_" + b).length > 0) { if ($("#ListCommentsWrapper_" + b).attr("class") != "slimScrollDiv active_req_comment_scroll") { var d = $("#ListComments_" + b); d.html(c); d.show() } else { $("#ListComments_" + b).html(c); $("#ListCommentsWrapper_" + b).slideDown("slow") } } else { var d = $("#ListComments_" + b); var e = d.html(); if (a == undefined || a == false) { d.addClass("max_height_250 listcomments") } else { d.addClass("listcomments") } d.html(c); d.slimscroll({ alwaysVisible: true, railVisible: false, wrapperClass: "slimScrollDiv active_req_comment_scroll", pointerClass: "activereqcomment" }); d.parent().attr("id", "ListCommentsWrapper_" + b); d.parent().append(e); d.slideDown("slow") } ShowCommentsList(b) } }) } } function DisplayComments(a) { if ($("#ListCommentsWrapper_" + a).length > 0 && $("#ListCommentsWrapper_" + a).css("display") != "none") { HideAllTabs(a) } else { $("#CommentIndex_" + a).val("1"); $("#SuggLoading_" + a).show(); $.ajax({ url: "/Feed/ListComments?suggestionID=" + a, cache: false, complete: function () { $("#SuggLoading_" + a).hide() }, success: function (b) { if ($("#ListCommentsWrapper_" + a).length > 0) { if ($("#ListCommentsWrapper_" + a).attr("class") != "slimScrollDiv active_comment_scroll") { var c = $("#ListComments_" + a); c.html(b); c.show() } else { $("#ListComments_" + a).html(b); $("#ListCommentsWrapper_" + a).slideDown("slow") } } else { var c = $("#ListComments_" + a); var d = c.html(); c.addClass("max_height_250 "); c.html(b); c.slimscroll({ alwaysVisible: true, railVisible: false, width: "555px", distance: "12px", wrapperClass: "slimScrollDiv active_comment_scroll", pointerClass: "activecomment" }); c.parent().attr("id", "ListCommentsWrapper_" + a); c.parent().append(d); c.slideDown("slow") } ShowCommentsList(a) } }) } } function redirectToLink(a) { window.location = a } function clearAllNotifications(a) { $("#progressNotifications").show(); $.ajax({ url: "/Notification/ClearAllnotifications?CustomerID=" + a, cache: false, complete: function (b) { if (true) { $("#notificationCount").html("0"); alert(NotificationsCleared); $("#ClearNotifications").slideUp("slow") } else { alert(errorOccuredClearingNotifications) } $("#progressNotifications").hide() } }) } function cellMouseOver(e, f) { $(e).addClass("selected"); description = $("#Description_" + f).val(); if ($("#FBLike_" + f).html() == "") { var a = description.split(" "); description = ""; for (var d = 0; d < a.length; d++) { if (d == 0) { description = description + a[d] } else { description = description + "-" + a[d] } } var b = "http://www.benego.com/Phrase/View?phrase=" + description + "&id=" + f; var c = "<span class='fl'><div style='width:45px' class='fb-like' data-href='" + b + "' data-send='false' data-layout='button_count' data-width='450' data-show-faces='false'></div></span><div class='clrBoth'></div>"; $("#FBLike_" + f).append(c); FB.XFBML.parse() } $("#FBLike_" + f).show() } function cellMouseOut(a, b) { $(a).removeClass("selected"); $("#FBLike_" + b).hide() } function translationMouseOver(f) { $("#FBLike_" + f).show(); var e = $("#Description_" + f).html(); if ($("#FBLike_" + f).html() == "") { var a = e.split(" "); e = ""; for (var d = 0; d < a.length; d++) { if (d == 0) { e = e + a[d] } else { e = e + "-" + a[d] } } var b = "http://www.benego.com/Phrase/Translation?id=" + e + "&id=" + f; var c = "<span class='fl'><div style='width:45px' class='fb-like' data-href='" + b + "' data-send='false' data-layout='button_count' data-width='450' data-show-faces='false'></div></span><div class='clrBoth'></div>"; $("#FBLike_" + f).append(c); FB.XFBML.parse() } $("#FBLike_" + f).show() } function translationMouseOut(a) { $("#FBLike_" + a).hide() } var alreadyFetchingTranlsations = false; var alreadyFetchingComments = false; function ShowMoreTranslations(d) { if ($("#NoMoreData_" + d).css("display") != "none") { return } var c = $("#ListTranslations_" + d); $("#ShowMoreLink_" + d).hide(); $("#ShowMoreLoading_" + d).show(); alreadyFetchingTranlsations = true; var b = $("#TranslationIndex_" + d).val(); var a = parseInt(b); a = a + 1; $("#TranslationIndex_" + d).val(a); $.ajax({ url: "/Feed/Listsuggestions?requestID=" + d + "&pageIndex=" + a, cache: false, complete: function () { alreadyFetchingTranlsations = false; var e = c.find("#ReachedEnd").val(); if (e == "True") { $("#NoMoreData_" + d).show(); $("#ShowMoreLink_" + d).hide(); $("#ShowMoreLoading_" + d).hide() } else { $("#ShowMoreLink_" + d).show(); $("#ShowMoreLoading_" + d).hide() } }, success: function (e) { c.append(e) } }) } function ShowMoreRequestComments(d) { if ($("#NoMoreComments_" + d).css("display") != "none") { return } var c = $("#ListComments_" + d); $("#ShowMoreCommentsLink_" + d).hide(); $("#ShowMoreCommentsLoading_" + d).show(); alreadyFetchingComments = true; var b = $("#CommentIndex_" + d).val(); var a = parseInt(b); a = a + 1; $("#CommentIndex_" + d).val(a); $.ajax({ url: "/Feed/ListRequestComments?requestID=" + d + "&pageIndex=" + a, cache: false, complete: function () { alreadyFetchingComments = false; var e = c.find("#ReachedEnd").val(); if (e == "True") { $("#NoMoreComments_" + d).show(); $("#ShowMoreCommentsLink_" + d).hide(); $("#ShowMoreCommentsLoading_" + d).hide() } else { $("#ShowMoreCommentsLink_" + d).show(); $("#ShowMoreCommentsLoading_" + d).hide() } }, success: function (e) { c.append(e) } }) } function ShowMoreComments(d) { if ($("#NoMoreComments_" + d).css("display") != "none") { return } var c = $("#ListComments_" + d); $("#ShowMoreCommentsLink_" + d).hide(); $("#ShowMoreCommentsLoading_" + d).show(); alreadyFetchingComments = true; var b = $("#CommentIndex_" + d).val(); var a = parseInt(b); a = a + 1; $("#CommentIndex_" + d).val(a); $.ajax({ url: "/Feed/ListComments?suggestionID=" + d + "&pageIndex=" + a, cache: false, complete: function () { alreadyFetchingComments = false; var e = c.find("#ReachedEnd").val(); if (e == "True") { $("#NoMoreComments_" + d).show(); $("#ShowMoreCommentsLink_" + d).hide(); $("#ShowMoreCommentsLoading_" + d).hide() } else { $("#ShowMoreCommentsLink_" + d).show(); $("#ShowMoreCommentsLoading_" + d).hide() } }, success: function (e) { c.append(e) } }) } function ShowCloseButton() { $("#closeButton").show() } function HideCloseButton() { $("#closeButton").hide() } function CloseNotificationPanel() { $("#notificationPanel").hide() };
