fix some small problems
![]() ![]() |
This is a really good script, I like it very much. After reading the code carefully, howerver, I find some small problems, so I write here to share with all. oh.. my english is not well enough.. First, in the replaceSelect() function
in the if statement i add "value.charAt(i+1)!= """, so it will ignore continuous spaces between two search keywords, like "this is a test". if you do not adding this , when press "r" to switch into replace mode and use left or right allow to move between spaces, it will not work correctly when there are more than one spaces. 2. |
![]() ![]() |
oh no , I can't edit the post.. Second, that's using j or k to browser results.
if(activeResult==-1) {
activeResult=0;
} else if (activeResult==results.length){
return
}else{
activeResult++
}
activateResult();
the code is not right, when i browser to the last result, and I still press j, there is an error in the "Error Console" in firefox , which shows "results[activeResult] is undefined". If you look through these codes more carefully, you should find there is a problem in the if-else-if statement, when the variable activeResult is equal to "results.length-1", it will still do "activeResults++", and then activeResults is now "results.length", but the results array do not have results[results.length]; So i make some changes on the above code, and now it work correctory, and if you still press j when browser to the last result, it will go forhead to the first result, vice versa.
// select the next result
if(e.keyCode==40||e.keyCode==74) {//down / j
e.preventDefault()
e.stopPropagation()
//FIXME
if(activeResult==-1 || activeResult>=results.length-1) {
activeResult=0;
} else {
activeResult++;
}
activateResult();
}
// select the previous result
if(e.keyCode==38||e.keyCode==75) {//up / k
e.preventDefault()
e.stopPropagation()
//FIXME
if(activeResult<=0) {
activeResult=results.length-1;
} else {
activeResult--;
}
activateResult();
}
|
![]() ![]() |
Thirdly, the problem is about the "about" information in the top (near the navaigation)
about=window.document.createElement("div");
about.innerHTML="
The problem is , the "about" infomation is too wide , cover the other elements in the navigation.
The simplist solution is to remove the "about" information. Another way is to modify the about style, change about.style.left, and remove the about.style.width
|
![]() ![]() |
also , i use DOMContentLoaded event instead of load, and remove the border when you select a result. Where can i upload the modified script? here: |

