阅读:6122回复:14
怎样修改这个opera用户脚本让他可以用在GreaseMonkey上
这个是修复淘宝的脚本,我主要就是希望用它来把淘宝旺旺的按钮修正为wangwang:协议,这个可以直接调用旺旺聊天而不是打开web旺旺
在opera下面测试是好用的,不过用GreaseMonkey 导入后不能用,请问修要怎样修改呢? 还请高手们帮下忙,真的很需要这个东西,在IE下面上taobao是在太慢了,动不动CPU就狂飙到100%而在firefox下又不能调用旺旺,愁死人了 |
|
|
1楼#
发布于:2008-05-01 16:28
对opera的脚本不熟悉,不知道该怎么改。
不过看了一下淘宝的页面代码,好像有支持Gecko的部分。 于是跟踪线索,找到了下面的东西http://www.taobao.com/download/firefox_ww_plugins.zip,里面有安装说明。 因为我不用taobao,所以做不了实验, 也不知道行不行。 |
|
2楼#
发布于:2008-05-01 16:28
那个淘宝旺旺的插件只能支持1.5的firefox 在2.0 3.0的firefox上无法正常使用
|
|
3楼#
发布于:2008-05-01 16:28
谢谢wushi777能看一下,Opera和GreaseMonkey的脚本区别大吗?本想自己琢磨琢磨,无奈翻阅资料后,发现明显超出我这个非专业人士的能力,所以还请高手看看
|
|
4楼#
发布于:2008-05-01 16:28
以前有看到opera很多脚本都是从greasemonkey里面的小改一下,脚本的代码只要不涉及到gecko专用的变量什么的,就一般可以通用吧!
|
|
|
5楼#
发布于:2008-05-01 16:28
首先, 我不用taobao,所以压根不知道你说的按钮在哪里。
第二,这个东西要调用系统下的东西,我不知道firefox不通过插件或者扩展是不是可以直接调用。 第三,搞不清在opera下的工作原理是什么, 比如:是不是opera支持ActiveX,所以修改也就无从谈起。 |
|
6楼#
发布于:2008-05-01 16:28
粗略看了下,应该能行。
|
|
7楼#
发布于:2008-05-01 16:28
|
|
8楼#
发布于:2008-05-01 16:28
OK, Just have fun!
// ==UserScript== // @name Taobao WangWang // @namespace www.firefox.net.cn // @description Focus to use WangWang IM Client // @include http://*.taobao.com/* // ==/UserScript== function main() { var es = document.evaluate("//span[@class='ww:token']", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); for(var i=0;i<es.snapshotLength;i++){ thisItem = es.snapshotItem(i); if(thisItem.firstChild.href && !thisItem.wwtoken){ o=thisItem.getAttribute("ww:params"); href="wangwang:SendIM?"; pattern = /nick=(.*?)&/; if(pattern.test(o)) { match = pattern.exec(o); nick = match[1]; href+=nick; } pattern = /item=(.*?)&/; if(pattern.test(o)) { match = pattern.exec(o); item = match[1]; href+="&gid=" + item; } //GM_log(href); //console.log(href); thisItem.firstChild.href = href; thisItem.firstChild.setAttribute("onclick","location=this.href;"); thisItem.wwtoken = true; } } } addEventListener("load", main, true) |
|
9楼#
发布于:2008-05-01 16:28
觉得Opera的脚本很接近IE,而且还有些AJAX frame的影子。
|
|
10楼#
发布于:2008-05-01 16:28
Re: OK, Just have fun!
fiag:// ==UserScript== // @name Taobao WangWang // @namespace www.firefox.net.cn // @description Focus to use WangWang IM Client // @include http://*.taobao.com/* // ==/UserScript== function main() { var es = document.evaluate("//span[@class='ww:token']", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); for(var i=0;i<es.snapshotLength;i++){ thisItem = es.snapshotItem(i); if(thisItem.firstChild.href && !thisItem.wwtoken){ o=thisItem.getAttribute("ww:params"); href="wangwang:SendIM?"; pattern = /nick=(.*?)&/; if(pattern.test(o)) { match = pattern.exec(o); nick = match[1]; href+=nick; } pattern = /item=(.*?)&/; if(pattern.test(o)) { match = pattern.exec(o); item = match[1]; href+="&gid=" + item; } //GM_log(href); //console.log(href); thisItem.firstChild.href = href; thisItem.firstChild.setAttribute("onclick","location=this.href;"); thisItem.wwtoken = true; } } } addEventListener("load", main, true) 马上试用 |
|
11楼#
发布于:2008-05-01 16:28
Re: OK, Just have fun!
fiag:// ==UserScript== // @name Taobao WangWang // @namespace www.firefox.net.cn // @description Focus to use WangWang IM Client // @include http://*.taobao.com/* // ==/UserScript== function main() { var es = document.evaluate("//span[@class='ww:token']", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); for(var i=0;i<es.snapshotLength;i++){ thisItem = es.snapshotItem(i); if(thisItem.firstChild.href && !thisItem.wwtoken){ o=thisItem.getAttribute("ww:params"); href="wangwang:SendIM?"; pattern = /nick=(.*?)&/; if(pattern.test(o)) { match = pattern.exec(o); nick = match[1]; href+=nick; } pattern = /item=(.*?)&/; if(pattern.test(o)) { match = pattern.exec(o); item = match[1]; href+="&gid=" + item; } //GM_log(href); //console.log(href); thisItem.firstChild.href = href; thisItem.firstChild.setAttribute("onclick","location=this.href;"); thisItem.wwtoken = true; } } } addEventListener("load", main, true) 好用很好用,就是少了一个校点参数gid,太感谢了 wangwang:SendIM?%E5%A4%A7%E6%AD%A3%E5%9B%BD&gid=fd7e16ba18221d64e1e8e085b67de4d4 |
|
12楼#
发布于:2008-05-01 16:28
为什么每次都会弹出两个窗口?
|
|
13楼#
发布于:2008-05-01 16:28
ringz能发个完整修改好的脚本吗?需要这个。
|
|
14楼#
发布于:2008-05-01 16:28
改一下吧,认它不弹出网页
|
|