function AdvanceSearch(t) { var e = CheckSpecialCharacters($("input#all").val()), a = CheckSpecialCharacters($("input#exact").val()), n = CheckSpecialCharacters($("input#contains").val()), i = CheckSpecialCharacters($("input#notContain").val()); if ("false" == e && "false" == a && "false" == n && "false" == i) { var l = $("#hdnSort").val(); if (ValidateAllInputs()) { var o = $("select#sections").children(":selected").attr("id"); o || (o = ""), "" == $("input#all").val().replace(/ /g, "") && $("input#all").val(""), "" == $("input#exact").val().replace(/ /g, "") && $("input#exact").val(""), "" == $("input#contains").val().replace(/ /g, "") && $("input#contains").val(""), "" == $("input#notContain").val().replace(/ /g, "") && $("input#notContain").val(""); var r = "/advancedsearch?all=" + encodeURIComponent($("input#all").val()) + "&exact=" + encodeURIComponent($("input#exact").val()) + "&contains=" + encodeURIComponent($("input#contains").val()) + "¬Contain=" + encodeURIComponent($("input#notContain").val()) + "§ionId=" + o + "&from=" + $("input#fromDt").val() + "&to=" + $("input#toDt").val() + "&pageNo=" + t + "&sort=" + l; window.location.href = r } else { $(".errorInfo").css({ display: "block" }), $(".advancedTextBox")[0].focus(); var c = 0; $(".advancedTextBox").each(function () { var t = $(this); setTimeout(function () { t.addClass("redBordered", 500) }, c += 100), setTimeout(function () { t.removeClass("redBordered", 500) }, c += 50) }) } } else "false" != e ? alert(e) : "false" != a ? alert(a) : "false" != n ? alert(n) : "false" != i && alert(i) } function SearchTextBoxOnfocus(t) { var e = $(t), a = e.val(); a = $.trim(a), IsIEVersionLessThan_10(t) ? "" != a && null != a && "الرجاء ادخال كلمة بحث" != a && "أدخل كلمة للبحث .." != a || (e.val(""), e.css({ color: "#333333" })) : 0 == a.length && e.attr("placeholder", "أدخل كلمة للبحث ..") } function CheckSpecialCharacters(t) { for (var e = t, a = 0; a < e.length; a++) if (-1 != "*|,\":<>[]{}`';()@&$#%^".indexOf(e.charAt(a))) { var n = "الرجاء عدم ادخال الرموز التالية "; return n += e.charAt(a) } return "false" } function ValidateAllInputs() { return "" != $("input#all").val() || "" != $("input#exact").val() || "" != $("input#contains").val() || "" != $("input#notContain").val() } function PopulateSearchFields() { var t = $("#hiddnKeywordSearch")[0].innerHTML; if ("true" == $("#hdnIsAdvanceSearch").val()) { var e = t.split("~"); $("input#all").val(e[0]), $("input#exact").val(e[1]), $("input#contains").val(e[2]), $("input#notContain").val(e[3]), "" != e[4] && $("select#sections").val($('select#sections option[id="' + e[4] + '"]').val()), $("input#fromDt").val(e[5]), $("input#toDt").val(e[6]), $("#SearchTextBox").val("") } else $("#SearchTextBox").val(t); if ("" != e[0].replace(/ /g, "")) { var a = e[0].split(" "); for (i = 0; i < a.length; i++) if ("" != a[i].replace(/ /g, "")) { var n = $(".searchResult").html(), l = a[i]; l = l.replace(/(\s+)/, "(<[^>]+>)*$1(<[^>]+>)*"); var o = new RegExp("(" + l + ")", "gi"); n = (n = n.replace(o, "$1")).replace(/([^<>]*)((<[^>]+>)+)([^<>]*<\/mark>)/, "$1$2$4"), $(".searchResult").html(n) } } for (i = 0; i < $(".searchResult").find(".itemTitle").length; i++) { var r = $(".searchResult").find(".itemTitle").eq(i).find("a").attr("href").replace(RegExp("", "g"), "").replace(RegExp("", "g"), ""); $(".searchResult").find(".itemTitle").eq(i).find("a").attr("href", r) } } function HighlightSortOption(t) { t || (t = 1), $("#hdnSort").val(t) } function ActivateDeactivateSort(t) { $("#hdnSort").val(t), AdvanceSearch(1) } $(document).ready(function () { "" != $("input#all").val() && $(".search-desc .search-word").text("“ " + $("input#all").val() + " ”"), 1 == $("input#hdnSort").val() ? ($("select#sortOptions").val("حسب التاريخ"), $("select#sortOptions").css("opacity", "1")) : ($("select#sortOptions").val("حسب الصلة"), $("select#sortOptions").css("opacity", "1")), $("input#fromDt").datepicker({ numberOfMonths: 1, dateFormat: "yy-mm-dd", onSelect: function (t) { $("input#fromDt").val(t), $("input#toDt").datepicker("option", "minDate", t) } }), $("input#toDt").datepicker({ numberOfMonths: 1, dateFormat: "yy-mm-dd", onSelect: function (t) { $("input#toDt").val(t), $("input#fromDt").datepicker("option", "maxDate", t) } }), $(".advancedTextBox").keyup(function (t) { 13 == t.keyCode && $(".advancedBtn").click() }) }), $("select#sortOptions").on("change", function () { ActivateDeactivateSort($(this).children(":selected").data("sortoption")) });