nextpage - firefox addon use SPC key to goto next page when at the bottom of a page * install this addon at https://addons.mozilla.org/en-US/firefox/addon/53484/ * Report BUGS to https://github.com/sylecn/ff-nextpage/issues * addon comments is here https://addons.mozilla.org/en-US/firefox/addon/53484#reviews * addon statistics is here https://addons.mozilla.org/en-US/statistics/addon/53484 * addon xpi file source is here https://addons.mozilla.org/en-US/firefox/files/browse/118464 * project homepage http://code.google.com/p/ff-nextpage/ * project source code http://github.com/sylecn/ff_nextpage/ * found a script that did the same thing http://board.mozest.com/thread-23048-1-1 * changelog ** release branch removed unimplemented prefwindow. * implementation ** UI design *** preferences window option: rebind SPC (on) usage tab: describe what's added to firefox and how to use nextpage. *** add to View Menu menuitem: next page ** recognize these links > >> next(Next) "next page" 下一页 ** decide whether we are at bottom of a page when document.height = window.pageYOffset + window.innerHeight, we are at bottom of the page. * xpi pack ** change chrome.manifest to use jar content nextpage content/ becomes: content nextpage jar:chrome/nextpage.jar!/content/ notice the !/ is a bit like absolute path. don't use !content/. ** structure chrome/nextpage.jar chrome.manifest install.rdf *** nextpage.jar content/ locale/ skin/ * XUL tips ** the key element must be placed inside a keyset element. ** here is how you modify chrome XUL element in the console: // disable n // var mainWindow = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor) .getInterface(Components.interfaces.nsIWebNavigation) .QueryInterface(Components.interfaces.nsIDocShellTreeItem) .rootTreeItem .QueryInterface(Components.interfaces.nsIInterfaceRequestor) .getInterface(Components.interfaces.nsIDOMWindow); a=mainWindow.document.getElementById('nextpage-key-n'); a.setAttribute('disabled', true); a.getAttribute('disabled') // enable n // var mainWindow = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor) .getInterface(Components.interfaces.nsIWebNavigation) .QueryInterface(Components.interfaces.nsIDocShellTreeItem) .rootTreeItem .QueryInterface(Components.interfaces.nsIInterfaceRequestor) .getInterface(Components.interfaces.nsIDOMWindow); a=mainWindow.document.getElementById('nextpage-key-n'); a.setAttribute('disabled', false); a.getAttribute('disabled') * js tips ** js regexp tester http://www.regular-expressions.info/javascriptexample.html ** window.back() can go back in history. content.back() go back for current page. ** load a new page in current window content.location = url; *** same as above, but replace current page, no history. content.location.replace(url); ** open a new window window.open(url); ** content is a Window object for the primary content window. use content and content.document to do anything you want to the document being displayed in firefox. ** dump() ref: https://developer.mozilla.org/en/Debugging_JavaScript Allows you to print text on the native console. ** DOM reference https://developer.mozilla.org/en/DOM http://www.w3schools.com/jsref/ w3schools is evil. https://developer.mozilla.org/en/XUL_Tutorial/Document_Object_Model ** get scroll pos window.pageYOffset document.body.scrollTop ** get document height/width document.height ** disable space pagedown in firefox ref: http://www.webmasterworld.com/javascript/3224261.htm window.addEventListener('keydown', function(e) { if (e.keyCode == 32) { e.preventDefault(); } }, true); ** disable space pagedown in firefox. no 2 window.onkeydown = function(e) { if(e.keyCode==32){ return false; } }; * this can also be done outside firefox. use a two frame page, layout just like google image, at the top frame, there is url box and a next/prev button/link, which can be used to control page at bottom frame. only need to use js to extract info from bottom frame. * I need to know how to: define a function that return a URL access all <a> tag in current page define a function to load a URL in current page bind a hotkey to a function * add functions for viewing documents in firefox :firefox:programming: goal: press SPC twice can go to next page, when we are at bottom. press <right><left> can go to previous/next page implementation: parse links the link text is usually > >> next "next page" 下一页 etc usually the previous/next link looks like the current link. this may require local js. some online book reading site, discuz BBS, web ppt, google reader/gmail already use JS to parse keyboard command extensively. see what links look like for: info generated docs tex generated docs ** selected testing pages: IFRAMEs (should not catch p/n/SPC on these pages) http://mail.google.com document.designMode=off http://mail.qq.com document.designMode=off http://mail.yahoo.com http://blogs.utexas.edu A tag with onclick http://image.baidu.com/i?tn=baiduimage&ct=201326592&lm=-1&cl=2&word=%CC%EC%D6%AE%BA%DB http://comment5.comic.qq.com/comment.htm?site=comic&id=28175373 google, A tag, innerHTML with span. http://www.google.com/search?q=dict&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:unofficial&client=iceweasel-a A tag, has both href and onclick action, both being javascript: http://www.bestbuy.com/site/olstemplatemapper.jsp?id=pcat17071&type=page&initialize=false&sp=&nrp=15&iht=y&list=n&sc=Global&st=ac+adapter&usc=All+Categories&ks=960&prids=&cp=2&qp=&_requestid=133557 INPUT tag, button, onclick action. http://www.disneyhome.cc/products.asp?productSort=186 mailing lists http://lists.gnu.org/archive/html/emacs-devel/2009-12/msg00835.html http://lists.mplayerhq.hu/pipermail/mplayer-users/2005-March/051882.html A tag, title http://www.mail-archive.com/debian-user@lists.debian.org/msg535462.html one German testing page: http://www.amazon.de/b/ref=amb_link_157473167_36?ie=UTF8&node=427954031&pf_rd_m=A3JWKAKR8XB7XF&pf_rd_s=center-4&pf_rd_r=1CH1PP7HYH2BHAM3A0NT&pf_rd_t=101&pf_rd_p=233563287&pf_rd_i=514699031#/ref=sr_pg_3?rh=n%3A340843031%2Cn%3A!340844031%2Cn%3A427954031&page=3&ie=UTF8&qid=1301216915 ** testing page: an online ebook: http://www.tianyabook.com/wangluo2005/changanluan/004.htm debian install manual: http://www.debian.org/releases/stable/i386/ emacs manual: http://www.gnu.org/software/emacs/manual/html_node/emacs/Commands.html#Commands fedora doc: http://docs.fedoraproject.org/install-guide/f12/en-US/html/ http://docs.fedoraproject.org/user-guide/f12/en-US/html/ boost library: http://www.boost.org/doc/libs/1_41_0/doc/html/array.html 天涯.明月.刀 http://www.tianyabook.com/hyzpj/hyzpj/wx/gulong/tymyd/00.htm ** tested pages http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18 http://search.yahoo.com/search;_ylt=A0oG7hM1TJBNBl0AOwal87UF;_ylc=X1MDUCM5NTgxMDQ2OQRfcgMyBGFvAzEEZnIDc2ZwBGZyMgNzYnRuBGhvc3RwdmlkA1VmaU1xa29HN3Y3OU9NQUFUVU5UMHcwZFJuRFR3MDJRVERVQUIwMFIEbl9ncHMDMTAEb3JpZ2luA3NycARxdWVyeQN5YWhvbyBzZWFyY2gEc2FvAzEEdnRlc3RpZAM-?p=yahoo+search&fr=sfp&fr2=&iscqry= http://www.verycd.com/sto/movie/~cn/ http://tieba.baidu.com/f?z=677280116&ct=335544320&lm=0&sc=0&rn=30&tn=baiduPostBrowser&word=%CB%C0%C9%F1&pn=0 http://www.gnu.org/software/emacs/manual/html_node/emacs/Advanced-C_002dx-v-v.html#Advanced-C_002dx-v-v http://www.google.com http://lw.3edu.net/zgwx/lw_99242_2.html http://bbs.linyichen.com/thread-73919-2-1.html http://onlamp.com/pub/a/onlamp/2006/04/06/boostregex.html?page=1 http://images.google.com/images?hl=en&um=1&q=dub&sa=N&start=40&ndsp=20 http://userscripts.org/scripts http://lists.mplayerhq.hu/pipermail/mplayer-users/2005-March/051882.html http://mail.python.org/pipermail/python-3000/2008-September/014713.html ** sites doesn't have right value for content.document.height (content.document.height <= content.pageYOffset + content.innerHeight) is always true. because content.document.height is wrong on these pages. *** but have right value for content.scrollMaxY and content.scrollY (content.scrollMaxY <= content.scrollY) http://userscripts.org/ http://userscripts.org/about/installing http://www.qiushibaike.com/groups/2/hottest/day/page/1 http://www.youtube.com/results?search_query=emacs&search_type=&aq=f http://planet.mysql.com/entry/?id=11940 http://www.makeuseof.com/tag/5-great-alternative-linux-music-players/
sylecn/ff_nextpage
firefox addon, nextpage, SPC key should goto next page when at bottom of a page
JavaScript