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

Have a bash at getting alt + enter support in the ssearch box working in firefox

....aparently it's some weirdness surrounging the way firefox handles
forms with only one input. Perhaps we should switch this out for JS
then? It would make it not work in some terminal browsers though that
don't have JS, so I'm not sure.
This commit is contained in:
Starbeamrainbowlabs 2017-07-25 19:57:34 +01:00
parent 30c25e27b7
commit 0fd9ba7d61
3 changed files with 7 additions and 1 deletions

View file

@ -1651,6 +1651,9 @@ window.addEventListener("load", function(event) {
document.querySelector("input[type=search]").addEventListener("keyup", function(event) { document.querySelector("input[type=search]").addEventListener("keyup", function(event) {
// Listen for Alt + Enter // Listen for Alt + Enter
if(event.keyCode == 13 && event.altKey) { if(event.keyCode == 13 && event.altKey) {
event.stopPropagation();
event.preventDefault();
event.cancelBubble = true;
event.target.form.setAttribute("target", "_blank"); event.target.form.setAttribute("target", "_blank");
event.target.form.submit(); event.target.form.submit();
event.target.form.removeAttribute("target"); event.target.form.removeAttribute("target");

View file

@ -1290,6 +1290,9 @@ window.addEventListener("load", function(event) {
document.querySelector("input[type=search]").addEventListener("keyup", function(event) { document.querySelector("input[type=search]").addEventListener("keyup", function(event) {
// Listen for Alt + Enter // Listen for Alt + Enter
if(event.keyCode == 13 && event.altKey) { if(event.keyCode == 13 && event.altKey) {
event.stopPropagation();
event.preventDefault();
event.cancelBubble = true;
event.target.form.setAttribute("target", "_blank"); event.target.form.setAttribute("target", "_blank");
event.target.form.submit(); event.target.form.submit();
event.target.form.removeAttribute("target"); event.target.form.removeAttribute("target");

View file

@ -104,7 +104,7 @@
"author": "Starbeamrainbowlabs", "author": "Starbeamrainbowlabs",
"description": "Adds proper search functionality to Pepperminty Wiki using an inverted index to provide a full text search engine. If pages don't show up, then you might have hit a stop word. If not, try requesting the `invindex-rebuild` action to rebuild the inverted index from scratch.", "description": "Adds proper search functionality to Pepperminty Wiki using an inverted index to provide a full text search engine. If pages don't show up, then you might have hit a stop word. If not, try requesting the `invindex-rebuild` action to rebuild the inverted index from scratch.",
"id": "feature-search", "id": "feature-search",
"lastupdate": 1500197043, "lastupdate": 1500311231,
"optional": false "optional": false
}, },
{ {