当我点击扩展图标或“Shift + Ctrl + K”键时,该如何使该功能运行?如何使用Chrome中的现有链接自动创建新标签页?
$(document).bind('keydown', 'shift+ctrl+k', function replaceWeiboLink()
{
这个content.js似乎不起作用。
$(document).bind('keydown', 'shift+ctrl+k', function replaceWeiboLink()
{
var url = document.location.href;
if (url != undefined && url.indexOf("club.pchome.net/thread_1_15_")!=-1)
{
url = url.replace("club.pchome.net/thread_1_15_","wap.kdslife.com/t/1/15/");
url = url.replace("__.html","/?u=0&sc=235&rnd=0359251496");
window.open(url);
window.focus(); //send back the focus to the current window
}
window.setTimeout(replaceWeiboLink, 100);
});
只关注新的页面,而不是打开制表符作为背景。这个字符串不工作,有什么想法?
window.focus(); //send back the focus to the current window
我的manifest.json是
{
"name": "linkmv",
"version": "0.1",
"description": "linkmv",
"icons": {
"48": "icon.png"
},
"browser_action": {
"default_icon": "icon.png"
},
"permissions": [
"tabs",
"http://*/*"
],
"content_scripts": [ {
"matches": ["http://*.club.pchome.net/*"],
"js": ["content.js"],
"all_frames": true
}]
}
这个扩展做以下,如果Chrome标签页的URL匹配
http://club.pchome.net/thread_1_15_6865723__.html
它会打开一个新标签不活跃(背景)与新的网址如下。号码6865723在不同的页面中有所不同。其他人是固定的。而不是
http://wap.kdslife.com/t/1/15/6865723/?u=0&sc=235&rnd=0359251496
原剧本来自(https://github.com/guiwuu/guiwuu/tree/master/chrome/linkmv)
这个脚本的目的是什么?听起来有点像浏览器劫持。 – 2012-02-22 09:21:34
第一页是桌面HTML格式,第二页是论坛的移动格式。我想自动将桌面html版本转换为可以通过手机阅读并发送给我的朋友的网址。那就是:-) – user1225183 2012-02-22 09:30:49