* JS build working * Css build working! * Uglify JS in production * fix codacy * Add frappe.commands.popen * FIx ESLint errors * Add socket.io to package.json * ignore subprocess warnings * Add babel-runtime * sleep 20 after bench start * remove set -e * [FIX] non-shell subprocess call * [FIX] use shell = False * split commands
52 lines
1.5 KiB
JavaScript
52 lines
1.5 KiB
JavaScript
// used in documenation site built via document generator
|
|
|
|
$(function() {
|
|
if(window.hljs) {
|
|
$('pre code').each(function(i, block) {
|
|
hljs.highlightBlock(block);
|
|
});
|
|
}
|
|
|
|
// search
|
|
$('.sidebar-navbar-items .octicon-search, .navbar .octicon-search').parent().on("click", function() {
|
|
var modal = frappe.get_modal("Search",
|
|
'<p><input class="search-input form-control" type="text" placeholder="Search text..." tabindex="1"></p>\
|
|
<p><a class="btn btn-sm btn-default btn-search" href="#" target="_blank" tabindex="2">Search via Google</a></p>');
|
|
modal.find(".search-input").on("keyup", function(e) {
|
|
if(e.which===13) {
|
|
modal.find(".btn-search").trigger("click");
|
|
}
|
|
if(e.which===9) {
|
|
e.preventDefault();
|
|
modal.find(".btn-search").focus();
|
|
return false;
|
|
}
|
|
var text = $(this).val();
|
|
modal.find(".btn-search").attr("href", "https://google.com/search?q="
|
|
+ text + "+site:" + (window.docs_base_url || ""));
|
|
});
|
|
modal.modal("show");
|
|
return false;
|
|
});
|
|
|
|
});
|
|
|
|
frappe = {
|
|
get_modal: function(title, body_html) {
|
|
var modal = $('<div class="modal" style="overflow: auto;" tabindex="-1">\
|
|
<div class="modal-dialog">\
|
|
<div class="modal-content">\
|
|
<div class="modal-header">\
|
|
<a type="button" class="close"\
|
|
data-dismiss="modal" aria-hidden="true">×</a>\
|
|
<h4 class="modal-title">'+title+'</h4>\
|
|
</div>\
|
|
<div class="modal-body ui-front">'+body_html+'\
|
|
</div>\
|
|
</div>\
|
|
</div>\
|
|
</div>').appendTo(document.body);
|
|
|
|
return modal;
|
|
},
|
|
};
|