|
|
@@ -1,39 +1,37 @@ |
|
|
|
<div class="item-search text-muted pull-right"> |
|
|
|
<input type="text" class="item-search-input" |
|
|
|
placeholder="Search" autocomplete="off"> |
|
|
|
<i class="octicon octicon-search"></i> |
|
|
|
<i class="octicon octicon-search" style='cursor: pointer;'></i> |
|
|
|
</div> |
|
|
|
<div class="clearfix pull-right" style="width:300px;"> |
|
|
|
<h4 class="item-search-results pull-left"></h4> |
|
|
|
<p class="pull-right"> |
|
|
|
<a style="display: none; padding-left:5px;" href="javascript:history.back();" class="octicon octicon-x text-extra-muted clear" title="Clear Search" ></a> |
|
|
|
<h5 class="item-search-results text-muted text-right" style="margin-right: 30px;"></h5> |
|
|
|
<p class="pull-right" style="margin-top: -28px;"> |
|
|
|
<a style="display: none;" href="javascript:history.back();" class="octicon octicon-x text-extra-muted clear" title="Clear Search" ></a> |
|
|
|
</p> |
|
|
|
</div> |
|
|
|
|
|
|
|
<script> |
|
|
|
frappe.ready(function() { |
|
|
|
if(get_url_arg("search")){ |
|
|
|
var txt = get_url_arg("search"); |
|
|
|
$(".item-search-results").html("Search results for : " + txt); |
|
|
|
$(".item-search").toggle(false); |
|
|
|
$(".clear").toggle(true); |
|
|
|
if(get_url_arg("search")) { |
|
|
|
var txt = get_url_arg("search"); |
|
|
|
$(".item-search-results").html("{{ _('Search results for') }}: " + txt); |
|
|
|
$(".item-search").toggle(false); |
|
|
|
$(".clear").toggle(true); |
|
|
|
} |
|
|
|
var thread = null; |
|
|
|
function findResult(t) { |
|
|
|
if (window.location.href.indexOf("?") > -1) |
|
|
|
{ |
|
|
|
window.location.href=document.URL + "&search=" + t; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
window.location.href=document.URL + "?search=" + t; |
|
|
|
} |
|
|
|
function find_result(t) { |
|
|
|
var search_link = "{{ search_link or '' }}" || location.pathname; |
|
|
|
window.location.href=search_link + "?search=" + t; |
|
|
|
} |
|
|
|
|
|
|
|
$(".item-search-input").keyup(function() { |
|
|
|
clearTimeout(thread); |
|
|
|
var $this = $(this); thread = setTimeout(function(){findResult($this.val())}, 1000); |
|
|
|
$(".item-search-input").keyup(function(e) { |
|
|
|
if(e.which===13) { |
|
|
|
find_result($(this).val()); |
|
|
|
} |
|
|
|
}); |
|
|
|
$('.octicon-search').on('click', function() { |
|
|
|
find_result($(".item-search-input").val()); |
|
|
|
}) |
|
|
|
$(".form-search").on("submit", function() { return false; }); |
|
|
|
}); |
|
|
|
</script> |