|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
×
就是调用搜索的代码,可以换成3种语言来搜索 当用英文和法文搜索时没什么问题,可用中文的baidu和google搜索时就会出现
"拒绝访问"或者"没有权限"
演示在http://sx8.net.ru/so/
//**********************************************************************
// Default Values
//**********************************************************************
Search.defaults = {};
Search.defaults.langCode = "en-us";
Search.defaults.category = "prefered";
Search.defaults.saveHistory = true;
Search.defaults.loadAll = false;
Search.defaults.Keyword = 15;
Search.defaults.preferedList = {};
Search.defaults.preferedList["en-us"] = [
{c: "web", n: "google"},
{c: "web", n: "yahoo"},
{c: "web", n: "ask"},
{c: "forum", n: "google"},
{c: "image", n: "google"}
]
Search.defaults.preferedList["zh-cn"] = [
{c: "web", n: "google"},
{c: "web", n: "baidu"},
{c: "web", n: "yahoo"},
{c: "image", n: "google"},
{c: "image", n: "baidu"},
{c: "music", n: "baidu"}
]
Search.defaults.preferedList["fr-fr"] = [
{c: "web", n: "google"},
{c: "web", n: "yahoo"},
{c: "web", n: "ask"},
{c: "forum", n: "google"},
{c: "image", n: "google"}
]
Search.localeList = {};
//**********************************************************************
// 简体中文
//**********************************************************************
Search.localeList["zh-cn"] = {};
Search.localeList["zh-cn"]["web"] = {
"title": "网页",
"items": {
"google": { title: "Google",
url: "http://www.google.cn/search?client=aff-&forid=1&ie=utf-8&oe=utf-8&hl=zh-CN&q={keyword}" },
"baidu": { title: "百度",
url: "http://www.baidu.com/s?tn=00769&ie=utf-8&wd={keyword}" },
"yahoo": { title: "雅虎",
url: "http://search.union.yahoo.com.cn/click/search.htm?m=419221&ei=utf-8&fw=union&st=0&p=1006&name={keyword}" },
"iask": { title: "新浪爱问",
url: "http://iask.com/s?ie=utf-8&k={keyword}" },
"live": { title: "Live 搜索",
url: "http://search.live.com/results.aspx?q={keyword}" },
"sogou": { title: "搜狗",
url: "http://www.sogou.com/web?query={keyword:gb2312}" },
"zhongshou": { title: "中搜",
url: "http://p.zhongsou.com/p?dt=1&pt=1&w={keyword:gb2312}" }
}
}
Search.localeList["zh-cn"]["image"] = {
"title": "图像",
"items": {
"baidu": { title: "百度", subtitle: "图像",
url: "http://image.baidu.com/i?ct=201326592&lm=-1&word={keyword:gb2312}" },
"google": { title: "Google", subtitle: " 图像",
url: "http://images.google.cn/images?q={keyword}" },
"yahoo": { title: "雅虎", subtitle: "图像",
url: "http://image.cn.yahoo.com/search?p={keyword:gb2312}" },
"bababian": { title: "巴巴变",
url: "http://www.bababian.com/seallphoto.sl?type=tag&all=0&search={keyword}" },
"yupoo": { title: "又拍",
url: "http://www.yupoo.com/search/?s=everyone&q={keyword}" },
"iask": { title: "新浪爱问", subtitle: "图像",
url: "http://p.iask.com/p?k={keyword:gb2312}" },
"sogou": { title: "搜狗", subtitle: "图像",
url: "http://pic.sogou.com/pics?query={keyword:gb2312}" },
"zhongshou": { title: "中搜", subtitle: "图像",
url: "http://img.zhongsou.com/i?w={keyword:gb2312}" },
"live": { title: "Live 搜索", subtitle: " (图像)",
url: "http://search.live.com/images/results.aspx?q={keyword}" }
}
}
Search.localeList["zh-cn"]["news"] = {
"title": "新闻",
"items": {
"baidu": { title: "百度", subtitle: "新闻",
url: "http://news.baidu.com/ns?word={keyword:gb2312}" },
"google": { title: "Google", subtitle: " 新闻",
url: "http://news.google.cn/news?ie=utf-8&oe=utf-8&q={keyword}" },
"yahoo": { title: "雅虎", subtitle: "新闻",
url: "http://cn.news.yahoo.com/search1.html?ei=utf-8&p={keyword}" },
"iask": { title: "新浪爱问", subtitle: "新闻",
url: "http://www.iask.com/n?k={keyword:gb2312}" },
"sogou": { title: "搜狗", subtitle: "新闻",
url: "http://news.sogou.com/news?query={keyword:gb2312}" },
"qihoo": { title: "奇虎", subtitle: "新闻",
url: "http://so.news.qihoo.com/?kw={keyword:gb2312}" },
"zhongshou": { title: "中搜", subtitle: "新闻",
url: "http://z.zhongsou.com/n?w={keyword:gb2312}" }
}
}
Search.localeList["zh-cn"]["music"] = {
"title": "音乐",
"items": {
"baidu": { title: "百度", subtitle: " MP3",
url: "http://mp3.baidu.com/m?f=ms&&ct=134217728&lm=-1&word={keyword:gb2312}" },
"sogua": { title: "SoGua",
url: "http://search.sogua.com/search.asp?key={keyword:gb2312}" },
"yahoo": { title: "雅虎", subtitle: "音乐",
url: "http://music.cn.yahoo.com/search.html?p={keyword:gb2312}" },
"sogou": { title: "搜狗", subtitle: "音乐",
url: "http://d.sogou.com/music?class=1&query={keyword:gb2312}" },
"qihoo": { title: "奇虎", subtitle: " MP3",
url: "http://so.mp3.qihoo.com/index.html?kw={keyword}" },
"zhongshou": { title: "中搜", subtitle: " MP3",
url: "http://mp3.zhongsou.com/m?w={keyword:gb2312}" }
}
}
Search.localeList["zh-cn"]["video"] = {
"title": "视频",
"items": {
"youku": { title: "优酷",
url: "http://www.youku.com/search_video/q_{keyword}" },
"tudou": { title: "土豆",
url: "http://www.tudou.com/search/programs/?posto=%2Fsearch%2Fprograms%2F&kw={keyword:gb2312}" },
"yahoo": { title: "雅虎", subtitle: "视频",
url: "http://video.cn.yahoo.com/search.html?p={keyword:gb2312}" },
"iask": { title: "新浪爱问", subtitle: "视频",
url: "http://v.iask.com/v?k={keyword}" },
"qihoo": { title: "奇虎", subtitle: "视频",
url: "http://search.v.qihoo.com/index.html?kw={keyword:gb2312}" }
}
}
Search.localeList["zh-cn"]["forum"] = {
"title": "论坛",
"items": {
"google": { title: "Google", subtitle: " 论坛",
url: "http://groups.google.com/groups?q={keyword}" },
"qihoo": { title: "奇虎", subtitle: "论坛",
url: "http://so.bbs.qihoo.com/?kw={keyword:gb2312}" },
"daqi": { title: "大旗",
url: "http://search.daqi.com/cgi-bin/search?keyword={keyword:gb2312}" },
"yahoo": { title: "雅虎", subtitle: "酷帖",
url: "http://misc.yahoo.com.cn/psearch.html?p={keyword:gb2312}" },
"zhongshou": { title: "中搜", subtitle: "论坛",
url: "http://bbs.zhongsou.com/b?w={keyword:gb2312}" }
}
}
Search.localeList["zh-cn"]["blog"] = {
"title": "博客",
"items": {
"baidu": { title: "百度", subtitle: "博客",
url: "http://blogsearch.baidu.com/s?wd={keyword:gb2312}" },
"souyo": { title: "SouYo",
url: "http://www.souyo.com/search?q={keyword}" },
"yodao": { title: "有道", subtitle: "博客",
url: "http://blog.yodao.com/search?q={keyword}" },
"qihoo": { title: "奇虎", subtitle: "博客",
url: "http://so.blog.qihoo.com/index.html?kw={keyword:gb2312}" }
}
}
Search.localeList["zh-cn"]["dict"] = {
"title": "词典",
"items": {
"iciba": { title: "爱词霸",
url: "http://www.iciba.com/search?s={keyword}" },
"dictcn": { title: "Dict.cn",
url: "http://www.dict.cn/search/?q={keyword:gb2312}" },
"yodao": { title: "有道", subtitle: "海量词典",
url: "http://dict.yodao.com/search?q={keyword}" },
"zdic": { title: "汉典",
url: "http://www.zdic.net/zd/search/?q={keyword}" }
}
}
省略~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|