拡張機能アイコンまたは「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を、それが(バックグラウンドで)アクティブでない新しいタブを開きます
http://club.pchome.net/thread_1_15_6865723__.html
クロームタブのURLが一致した場合、次の操作を実行するために
{
"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
}]
}
この拡張機能です次のような新しいURLで番号6865723はページによって異なります。その他は修正されています。
http://wap.kdslife.com/t/1/15/6865723/?u=0&sc=235&rnd=0359251496
(https://github.com/guiwuu/guiwuu/tree/master/chrome/linkmv)
このスクリプトの目的は何ですか?ブラウザのハイジャックのように聞こえる。 –
最初のページはデスクトップ用のHTML形式で、2番目のページはフォーラム用のモバイル形式です。私は自動的に携帯電話で読み取ることができ、私の友人に送信することができるURLにデスクトップのHTMLバージョンを変換します。それはです:-) – user1225183