The Arcive of vBulletin Modifications Site. |
|
Details »»
|
|||||||||||||||||||||||||
Yes...... its another javascript template hack!!!
This one is VERY useful in my opinion and I think will be very popular It places a search box on the thread page, that can search through all the words on the page and show them one by one First decide where you want to place it and in which template Once done, place this code into the relevant position where you want it. I suggest under the "Recieve updates from this thread" part Then you are done! Code:
<script language="JavaScript">
var NS4 = (document.layers);
var IE4 = (document.all);
var win = window;
var n = 0;
function findInPage(str) {
var txt, i, found;
if (str == "")
return false;
if (NS4) {
if (!win.find(str))
while(win.find(str, false, true))
n++;
else
n++;
if (n == 0)
alert("Not found.");
}
if (IE4) {
txt = win.document.body.createTextRange();
for (i = 0; i <= n && (found = txt.findText(str)) != false; i++) {
txt.moveStart("character", 1);
txt.moveEnd("textedit");
}
if (found) {
txt.moveStart("character", -1);
txt.findText(str);
txt.select();
txt.scrollIntoView();
n++;
}
else {
if (n > 0) {
n = 0;
findInPage(str);
}
else
alert("Not found on this page");
}
}
return false;
}
</script>
<form name="search" onSubmit="return findInPage(this.string.value);">
<font size=3><input name="string" type="text" size=15 onChange="n = 0;"></font>
<input type="submit" value="Find in this thread">
</form>
And give me feedback on my javascript hacks! Note - this only search the page that you are reading and not all the thread if it is more than one page Also, this could be a nice keyword finder in a forum, because it doesn't involve going to another page. Show Your Support
|
|||||||||||||||||||||||||
| Comments |
|
#2
|
|||
|
|||
|
No to diss your hack or anything man, I really think you did a great job and all, but wouldn't is just be easier to click CTRL+F on Internet Explorer?
|
![]() |
|
|