1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-11-22 16:33:00 +00:00

Add Alt + Enter support to the main search box

This commit is contained in:
Starbeamrainbowlabs 2016-11-20 11:40:24 +00:00
parent 312de4b341
commit 9f6336b12d
2 changed files with 26 additions and 0 deletions

View file

@ -1415,10 +1415,23 @@ class page_renderer
} }
} }
// Math rendering support
if(!empty($settings->enable_math_rendering)) if(!empty($settings->enable_math_rendering))
{ {
page_renderer::AddJSLink("https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"); page_renderer::AddJSLink("https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML");
} }
// alt+enter suport in the search box
page_renderer::AddJSSnippet('// Alt + Enter support in the top search box
window.addEventListener("load", function(event) {
document.querySelector("input[type=search]").addEventListener("keyup", function(event) {
// Listen for Alt + Enter
if(event.keyCode == 13 && event.altKey) {
event.target.form.setAttribute("target", "_blank");
event.target.form.submit();
}
});
});
');
/// Finish setting up the environment object /// /// Finish setting up the environment object ///
$env->page = $_GET["page"]; $env->page = $_GET["page"];

View file

@ -1106,10 +1106,23 @@ class page_renderer
} }
} }
// Math rendering support
if(!empty($settings->enable_math_rendering)) if(!empty($settings->enable_math_rendering))
{ {
page_renderer::AddJSLink("https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"); page_renderer::AddJSLink("https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML");
} }
// alt+enter suport in the search box
page_renderer::AddJSSnippet('// Alt + Enter support in the top search box
window.addEventListener("load", function(event) {
document.querySelector("input[type=search]").addEventListener("keyup", function(event) {
// Listen for Alt + Enter
if(event.keyCode == 13 && event.altKey) {
event.target.form.setAttribute("target", "_blank");
event.target.form.submit();
}
});
});
');
/// Finish setting up the environment object /// /// Finish setting up the environment object ///
$env->page = $_GET["page"]; $env->page = $_GET["page"];