-
Notifications
You must be signed in to change notification settings - Fork 0
/
finder.js
41 lines (40 loc) · 1.15 KB
/
finder.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
var meshkiUtil = {
TRange: null,
search: function(el) {
if (event.keyCode == 13 || el == true){
var str = document.getElementById('searchbox').value;
if (parseInt(navigator.appVersion) < 4)
return;
var strFound;
if (window.find) {
strFound = self.find(str);
if (!strFound) {
strFound = self.find(str,0,1);
while (self.find(str,0,1))
continue;
}
}
else if (navigator.appName.indexOf("Microsoft") != -1) {
if (meshki.TRange != null) {
meshki.TRange.collapse(false);
strFound = meshki.TRange.findText(str);
if (strFound)
meshki.TRange.select();
}
if (meshki.TRange == null || strFound == 0) {
meshki.TRange = self.document.body.createTextRange();
strFound = meshki.TRange.findText(str);
if (strFound)
meshki.TRange.select();
}
}
else if (navigator.appName == "Opera") {
alert ("Opera browsers not supported, sorry...")
return;
}
if (!strFound)
alert ("String '"+str+"' not found!")
return;
}
}
};