- UID
- 1696
- 帖子
- 1132
- 精华
- 2
- 贡献
- 0
- 推广
- 0
- 有效BUG
- 0
- 注册时间
- 2005-7-12
|
我把GB的一个插件Search_in_Site直接粘贴进了TW的plugin里面,结果打开浏览器的时候,点击工具栏上面的图标,可以正常弹出搜索框,但输入要查找的文字后点击“确定”,不能出结果。正常的结果是新开一个google搜索页面。
下面是相关的资料:
〔plugin.ini〕
[General]
Name=站内搜索
Author=Sammy
Version=1.0
ModuleType=SCRIPT
FileName=script.html
Comments=Google站内搜索
Type=BUTTON
HotIcon=SiS.ico
〔script.html〕
<script language="JavaScript">
//Script written by Sammy
var p;
//若想使用中弹出窗口,去除下一行的注释--删去“//”
//p='gb';
var sel;
var site=document.location.hostname;
var enc;
var c;
frame_sel(top);
if (!sel) {
c=document.charset;
switch (p) {
case 'gb': sel=prompt('请输入你想在 “http://'+site+'” 搜索的关键词:','');break;
default: sel=prompt('Enter the keyword to search at "http://'+site+'":','');
}
}
if (sel) {
if (c!="utf-8")
sel=urlencode(sel);
else
sel=window.encodeURIComponent(sel);
sel='http://www.google.com/search?q='+sel+'+site%3A'+site+'&ie='+c;
window.open(sel,'_blank');
} else {
top.status='No keyword to search!';
setTimeout("top.status='';",3000);
}
function frame_sel(win) {
var doc=win.document;
var frms=win.frames;
sel=doc.selection.createRange().text;
c=doc.charset;
if (!sel && frms.length>0) {
for (var i=0;i<frms.length;i++) {
try{
var doc_frame=frms;
frame_sel(doc_frame);
} catch(e) {}
}
}
}
function urlencode (sel) {
//see "HttpUtility.UrlEncode Method" in MSDN
sel=sel.replace(/\s/g,'%20');
sel=sel.replace(/\n/g,'%0A');
sel=sel.replace(/:/g,'%3A');
sel=sel.replace(/\+/g,'%2B');
sel=sel.replace(/\//g,'%2F');
sel=sel.replace(/\\/,'%5C');
sel=sel.replace(/\#/,'%23');
sel=sel.replace(/\&/,'%26');
return sel;
}
</script>
请高手帮忙看看,应该怎么改才能在TW上正常使用?
站内搜索的功能对我太重要了,我天天都用得着。
谢谢。
[ Last edited by 掸子 on 2005-8-6 at 05:08 AM ] |
|