Skip to content

Instantly share code, notes, and snippets.

@ngs
Created January 21, 2011 02:20
Show Gist options
  • Select an option

  • Save ngs/789139 to your computer and use it in GitHub Desktop.

Select an option

Save ngs/789139 to your computer and use it in GitHub Desktop.
Firegestures-GoogleReader | LRのコマンドをカスタマイズ
const LR = "L"; //R
// Adapted from Google Reader Auto-Read
// http://userscripts.org/scripts/show/2035
function simulateClick(node) {
if(!node) return;
var event = node.ownerDocument.createEvent("MouseEvents");
event.initMouseEvent("click",
true, // can bubble
true, // cancellable
node.ownerDocument.defaultView,
1, // clicks
50, 50, // screen coordinates
50, 50, // client coordinates
false, false, false, false, // control/alt/shift/meta
0, // button,
node
);
node.dispatchEvent(event);
}
var loc = window.content.document.location.toString();
if(loc.match(/http(s?):\/\/(www?)\.google.co(m|\.\w{2})\/reader.*/i)!=null) {
//Google Readerの記事を移動
simulateClick(window.content.document.getElementById(LR=="L"?"entries-up":"entries-down"));
return;
} else if(loc.match(/http(s?):\/\/mail\.google.co(m|\.\w{2}).*/i)!=null) {
// GmailのMouse gesturesを使っているので。
return;
} else {
// 履歴を進む/戻る
document.getElementById(LR=="L"?"Browser:Back":"Browser:Forward").doCommand();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment