Patch by Lars to improve quicksearch usability
This commit is contained in:
@@ -3,6 +3,12 @@
|
|||||||
Version 1.2 ()
|
Version 1.2 ()
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
|
* Improve Livesearch-Plugin to abort search on outside-of-box
|
||||||
|
click, fetch proper "not found" message on zero results
|
||||||
|
(Lars Strojny)
|
||||||
|
|
||||||
|
* Change bbCode plugin to use "white-space: pre". Thanks to jtb!
|
||||||
|
|
||||||
* Moved drag+drop and YahooUI library into templates/default/ to
|
* Moved drag+drop and YahooUI library into templates/default/ to
|
||||||
be used in shared installation environments (garvinhicking)
|
be used in shared installation environments (garvinhicking)
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,8 @@ function liveSearchInit() {
|
|||||||
document.getElementById('searchform').setAttribute('autocomplete','off');
|
document.getElementById('searchform').setAttribute('autocomplete','off');
|
||||||
document.getElementById('serendipityQuickSearchTermField').setAttribute('autocomplete','off');
|
document.getElementById('serendipityQuickSearchTermField').setAttribute('autocomplete','off');
|
||||||
}
|
}
|
||||||
document.getElementById('serendipityQuickSearchTermField').style.border = '1px solid green';
|
|
||||||
|
document.onclick = liveSearchKeyPress
|
||||||
}
|
}
|
||||||
|
|
||||||
function liveSearchKeyPress(event) {
|
function liveSearchKeyPress(event) {
|
||||||
@@ -87,14 +88,14 @@ function liveSearchKeyPress(event) {
|
|||||||
}
|
}
|
||||||
if (!isIE) { event.preventDefault(); }
|
if (!isIE) { event.preventDefault(); }
|
||||||
}
|
}
|
||||||
//ESC
|
//ESC or mouse click
|
||||||
else if (event.keyCode == 27) {
|
else if (event.keyCode == 27 || (event.clientX)) {
|
||||||
highlight = document.getElementById("LSHighlight");
|
highlight = document.getElementById("LSHighlight");
|
||||||
if (highlight) {
|
if (highlight) {
|
||||||
highlight.removeAttribute("id");
|
highlight.removeAttribute("id");
|
||||||
}
|
}
|
||||||
document.getElementById("LSResult").style.display = "none";
|
document.getElementById("LSResult").style.display = "none";
|
||||||
} else {
|
} else {
|
||||||
liveSearchStart();
|
liveSearchStart();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -108,7 +109,7 @@ function liveSearchStart() {
|
|||||||
function liveSearchDoSearch() {
|
function liveSearchDoSearch() {
|
||||||
v = document.getElementById('serendipityQuickSearchTermField').value;
|
v = document.getElementById('serendipityQuickSearchTermField').value;
|
||||||
if (liveSearchLast != v && v.length > 3) {
|
if (liveSearchLast != v && v.length > 3) {
|
||||||
if (liveSearchReq && liveSearchReq.readyState < 4) {
|
if (liveSearchReq && liveSearchReq.readyState < 3) {
|
||||||
liveSearchReq.abort();
|
liveSearchReq.abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,7 +143,12 @@ function liveSearchProcessReqChange() {
|
|||||||
if (liveSearchReq.readyState == 4) {
|
if (liveSearchReq.readyState == 4) {
|
||||||
var res = document.getElementById("LSResult");
|
var res = document.getElementById("LSResult");
|
||||||
res.style.display = "block";
|
res.style.display = "block";
|
||||||
res.firstChild.innerHTML = liveSearchReq.responseText;
|
rawResult = liveSearchReq.responseText.replace(/<[^>]+>/g, '')
|
||||||
|
if (parseInt(rawResult) == 1) {
|
||||||
|
res.firstChild.innerHTML = notfoundtext
|
||||||
|
} else {
|
||||||
|
res.firstChild.innerHTML = liveSearchReq.responseText;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ class serendipity_event_livesearch extends serendipity_event
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
margin-left: 4px;
|
margin-left: 4px;
|
||||||
margin-top: 4px;
|
margin-top: 4px;
|
||||||
|
background-color: #fff7e8;
|
||||||
}
|
}
|
||||||
|
|
||||||
#LSShadow {
|
#LSShadow {
|
||||||
@@ -73,26 +74,25 @@ class serendipity_event_livesearch extends serendipity_event
|
|||||||
}
|
}
|
||||||
|
|
||||||
#LSHighlight {
|
#LSHighlight {
|
||||||
background-color: #80FF80;
|
background-color: #bdd2ec;
|
||||||
color: black;
|
color: black;
|
||||||
}
|
}
|
||||||
|
|
||||||
.serendipity_livesearch_row {
|
.serendipity_livesearch_row {
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
line-height: 1.2em;
|
padding-top: 0.5em;
|
||||||
padding-top: 0.2em;
|
padding-bottom: 0.5em;
|
||||||
padding-bottom: 0.2em;
|
padding-left: 1.5em;
|
||||||
|
padding-right: 1.5em;
|
||||||
text-indent: -1em;
|
text-indent: -1em;
|
||||||
padding-left: 1em;
|
line-height: 1.4em;
|
||||||
line-height: 1.2em;
|
|
||||||
padding-right: 1em;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.serendipity_livesearch_result {
|
.serendipity_livesearch_result {
|
||||||
position: relative;
|
position: relative;
|
||||||
bottom: 2px;
|
bottom: 2px;
|
||||||
right: 2px;
|
|
||||||
border: 1px solid black;
|
border: 1px solid black;
|
||||||
|
right: 2px;
|
||||||
padding: 2px;
|
padding: 2px;
|
||||||
}
|
}
|
||||||
<?php
|
<?php
|
||||||
@@ -108,6 +108,7 @@ class serendipity_event_livesearch extends serendipity_event
|
|||||||
echo '<script type="text/javascript">
|
echo '<script type="text/javascript">
|
||||||
lsbase = "' . $serendipity['baseURL'] . ($serendipity['rewrite'] == 'none' ? $serendipity['indexFile'] . '?/' : '') . 'plugin/ls' . ($serendipity['rewrite'] == 'none' ? '_&' : '?') . '";
|
lsbase = "' . $serendipity['baseURL'] . ($serendipity['rewrite'] == 'none' ? $serendipity['indexFile'] . '?/' : '') . 'plugin/ls' . ($serendipity['rewrite'] == 'none' ? '_&' : '?') . '";
|
||||||
waittext = "' . PLUGIN_EVENT_LIVESEARCH_WAIT . '";
|
waittext = "' . PLUGIN_EVENT_LIVESEARCH_WAIT . '";
|
||||||
|
notfoundtext = "' . PLUGIN_EVENT_LIVESEARCH_NOTFOUND . '";
|
||||||
addLoadEvent(liveSearchInit);
|
addLoadEvent(liveSearchInit);
|
||||||
</script>';
|
</script>';
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user