hexo-theme-amane/layout/search/baidu.ejs

29 lines
1.2 KiB
Plaintext
Raw Normal View History

<%- _css('css/search') %>
2018-10-16 05:28:42 +00:00
<div class="searchbox">
<div class="searchbox-container">
<div class="searchbox-input-wrapper">
<form class="search-form">
<input name="wd" type="text" class="searchbox-input" placeholder="<%= __('search.hint') %>" />
<span class="searchbox-close searchbox-selectable"><i class="fa fa-times-circle"></i></span>
</form>
</div>
</div>
</div>
2016-02-02 16:19:44 +00:00
<script>
2018-10-16 05:28:42 +00:00
(function ($) {
$('.search-form').on('submit', function (e) {
var keyword = $('.searchbox-input[name="wd"]').val();
window.location = 'https://www.baidu.com/s?wd=site:<%= config.url.replace(/http(s)*:\/\//, "") %> ' + keyword;
return false;
});
})(jQuery);
(function (document, $) {
$(document).on('click', '.navbar-main .search', function () {
$('.searchbox').toggleClass('show');
}).on('click', '.searchbox .searchbox-mask', function () {
$('.searchbox').removeClass('show');
}).on('click', '.searchbox-close', function () {
$('.searchbox').removeClass('show');
});
})(document, jQuery);
2016-02-02 16:19:44 +00:00
</script>