shortcut for facebook (UserScript)

// ==UserScript==
// @name Facebook recently activity shortcut
// @namespace Kjwon15
// @description Facebook recently activity shortcut
// @include http://*.facebook.com/*
// @include https://*.facebook.com/*
// ==/UserScript==

var isInfoOpened=false;
document.onkeypress=function(e) {
	if(e.target.tagName.toLowerCase() == 'input' || e.target.tagName.toLowerCase() == 'textarea') {
		return;
	}
	
	//go to home
	if(e.charCode == 0x68) { // h
		document.getElementById("pageLogo").children[0].click();
	}
	//open recently activity
	else if(e.charCode == 0x6f) { // o
		isInfoOpened=true;
		document.getElementsByClassName("jewelButton")[2].click();
	}
	else if(e.charCode == 0x71) { // q
		var lst=document.getElementsByClassName("beeper_x");
		for(i=0;i<lst.length;i++) {
			lst[i].click();
		}
	}
	else if(0x30 <= e.charCode && e.charCode <= 0x39) { // 0~9
		if(isInfoOpened == false) return;
		isInfoOpened = false;
		index=e.charCode-0x30;
		if(index == 0) index=10;
		index-=1;
		document.getElementsByClassName("info")[index].click();
	}
	else {
		isInfoOpened=false;
	}
}
document.onmousedown=function(e) { isInfoOpened=false; }

kjwon15

I'm a hacker, I want to improve life.

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.