Announce and Discuss the Latest Theme and Extension Releases.
dorando
Posts: 1203 Joined: January 9th, 2004, 9:57 am
Contact:
Post
by dorando » May 8th, 2013, 11:43 am
chirpy_7 wrote: A couple of hours ago (at most a few days ago) I noticed a change on GOOGLE: the following (for opening individual GOOGLE search results in a new (and/or the current) tab) doesn't seem to work anymore, the "nodes" must have changed slightly:
Code: Select all
if( window . content . location . href . match (/^ http ( s )?:// www . google .( com | fr )/ search /)) { var nodes = content . document . evaluate ( '//h3/a[@class]' , content . document , null , 7 , null ); gBrowser . addTab ( nodes . snapshotItem ( 0 )); }
The (10 standard) links (in GOOGLE) seem to have this
Code: Select all
< h3 class= "r" style = "display: inline;" >
around them, but simply (naively) replacing "a" with "r" (in the keyconfig code above) didn't do the trick...
Any pointers how to fix the code?
Try
Code: Select all
var nodes = content . document . querySelectorAll ( "h3.r a, h3 a.l" ); gBrowser . addTab ( nodes [ 0 ]);
Amsuke wrote: Arrow Up:
Code: Select all
if( commandDispatcher . focusedWindow . document . designMode == "on" ) goDoCommand ( "cmd_lineNext" ); var target = commandDispatcher . focusedElement ; if(!( target instanceof HTMLInputElement && ( target . type == "text" || target . type == "password" ))) commandDispatcher . focusedWindow . scrollByLines (- 4 );
The problem is that certain webmail interfaces are having problems with this - whereby the up arrow key acts like the down arrow key.
Try
Code: Select all
if( commandDispatcher . focusedWindow . document . designMode == "on" ) goDoCommand ( "cmd_linePrevious" ); var target = commandDispatcher . focusedElement ; if(!( target instanceof HTMLInputElement && ( target . type == "text" || target . type == "password" ))) commandDispatcher . focusedWindow . scrollByLines (- 4 );
Amsuke
Posts: 60 Joined: April 3rd, 2010, 8:23 am
Post
by Amsuke » May 8th, 2013, 9:00 pm
Thanks, Dorando! That fixed it perfectly!
Rava
Posts: 18 Joined: May 9th, 2008, 1:26 am
Post
by Rava » May 9th, 2013, 5:59 pm
dorando, trying to install keyconfig for Linux Thunderbird 17.x using the build in mechanism fails:
Any idea why that might be?
yours
Rava
Zoolcar9
Posts: 2225 Joined: November 9th, 2004, 6:45 pm
Location: Jakarta, Indonesia (UTC+7)
Contact:
Post
by Zoolcar9 » May 11th, 2013, 4:38 am
@Rava, here's how to install keyconfig on Thunderbird.
dorando wrote: In the Browser: Context Menu > Save Link As… In Thunderbird: Tools > Add-ons > Button next to the Search box > Install Add-on From File…
Zoolcar9 wrote: You can also drag
keyconfig.xpi link from Firefox window onto Add-ons Manager in Thunderbird window.
viewtopic.php?p=12693017#p12693017
firefoxuse
Posts: 1086 Joined: November 8th, 2011, 12:06 pm
Post
by firefoxuse » May 11th, 2013, 4:08 pm
can you tell me please the code for 'open link in background tab' ? I need to click on a link with CTRL+SHIFT held down and open that link in the background
Ander
Posts: 74 Joined: February 3rd, 2004, 12:02 am
Location: Canada
Post
by Ander » May 11th, 2013, 5:14 pm
I just wanted to thank you for this fabulous add-on, which still works impressively well with Firefox 20! It's hard to believe FF includes no native way to enable-disable its built-in keyboard shortcuts (which are often presumptuously inconvenient, such as using the traditional text-editing keys Ctrl+I and Ctrl+B for Bookmark-related tasks). It's also hard to believe that FF's add-on site doesn't seem to host any third-party code that lets you do it, including Keyconfig. (Have you submitted it there? Did they turn you down for some reason? Go figure.) Anyway, a grateful sigh of relief here. Cheers, Ander
dorando
Posts: 1203 Joined: January 9th, 2004, 9:57 am
Contact:
Post
by dorando » May 22nd, 2013, 10:13 am
firefoxuse wrote: can you tell me please the code for 'open link in background tab' ? I need to click on a link with CTRL+SHIFT held down and open that link in the background
For focused links try
Code: Select all
if( commandDispatcher . focusedElement && commandDispatcher . focusedElement . href ) openLinkIn ( commandDispatcher . focusedElement . href , "tab" , { inBackground : true });
, for hovered links try
Code: Select all
if( XULBrowserWindow . overLink ) openLinkIn ( XULBrowserWindow . overLink , "tab" , { inBackground : true });
Ander wrote: Have you submitted it there?
No.
rbfye14
Posts: 26 Joined: April 9th, 2012, 8:23 am
Post
by rbfye14 » May 25th, 2013, 2:05 am
Is it possible to get the size of the image (in kb, not dimensions) by it's ID?
morat
Posts: 6432 Joined: February 3rd, 2009, 6:29 pm
Post
by morat » May 25th, 2013, 4:46 am
rbfye14 wrote: Is it possible to get the size of the image (in kb, not dimensions) by it's ID?
Try this:
Code: Select all
function formatNumber(number) { return (+number).toLocaleString(); } var cacheService = Components.classes["@mozilla.org/network/cache-service;1"]. getService(Components.interfaces.nsICacheService); var httpCacheSession = cacheService.createSession("HTTP", 0, true); httpCacheSession.doomEntriesIfExpired = false; var image = content.document.getElementsByTagName("img")[0]; // var image = content.document.getElementById("thingamajig"); var url = image.src; var cacheKey = url.replace(/#.*$/, ""); try { var cacheEntryDescriptor = httpCacheSession.openCacheEntry(cacheKey, Components.interfaces.nsICache.ACCESS_READ, false); var imageSize = cacheEntryDescriptor.dataSize; var kbSize = Math.round(imageSize / 1024 * 100) / 100; alert(formatNumber(kbSize) + " KB (" + formatNumber(imageSize) + " bytes)"); } catch (e) { alert("Unknown (not cached)"); }
rbfye14
Posts: 26 Joined: April 9th, 2012, 8:23 am
Post
by rbfye14 » May 25th, 2013, 7:19 am
morat wrote: rbfye14 wrote: Is it possible to get the size of the image (in kb, not dimensions) by it's ID?
Try this:
Code: Select all
function formatNumber(number) ....... .......
morat ,
It doesn't work for me... I persistently get an alert "Unknown (not cached)"
morat
Posts: 6432 Joined: February 3rd, 2009, 6:29 pm
Post
by morat » May 25th, 2013, 9:39 am
@rbfye14
The openCacheEntry method now fails if it is called on the main thread.
Code: Select all
function openCacheEntry(key, cb) { var tries = 0; var listener = { onCacheEntryAvailable: function (entry, access, status) { if (entry || tries == 1) { cb(entry); } else { tries++; ftpCacheSession.asyncOpenCacheEntry(key, ACCESS_READ, this, true); } } } httpCacheSession.asyncOpenCacheEntry(key, ACCESS_READ, listener, true); } function formatNumber(number) { return (+number).toLocaleString(); } var ACCESS_READ = Components.interfaces.nsICache.ACCESS_READ; var cacheService = Components.classes["@mozilla.org/network/cache-service;1"]. getService(Components.interfaces.nsICacheService); var httpCacheSession = cacheService.createSession("HTTP", 0, true); httpCacheSession.doomEntriesIfExpired = false; var ftpCacheSession = cacheService.createSession("FTP", 0, true); ftpCacheSession.doomEntriesIfExpired = false; var image = content.document.getElementsByTagName("img")[0]; // var image = content.document.getElementById("thingamajig"); var url = image.src; var cacheKey = url.replace(/#.*$/, ""); openCacheEntry(cacheKey, function (cacheEntry) { if (cacheEntry) { var imageSize = cacheEntry.dataSize; var kbSize = Math.round(imageSize / 1024 * 100) / 100; alert(formatNumber(kbSize) + " KB (" + formatNumber(imageSize) + " bytes)"); } else { alert("Unknown (not cached)"); } });
reference:
http://mxr.mozilla.org/mozilla-release/ ... ageInfo.js
Zoolcar9
Posts: 2225 Joined: November 9th, 2004, 6:45 pm
Location: Jakarta, Indonesia (UTC+7)
Contact:
Post
by Zoolcar9 » May 25th, 2013, 6:57 pm
Ander wrote: It's also hard to believe that FF's add-on site doesn't seem to host any third-party code that lets you do it
Almost ALL add-ons on addons.mozilla.org ARE third party.
rbfye14
Posts: 26 Joined: April 9th, 2012, 8:23 am
Post
by rbfye14 » May 26th, 2013, 3:40 am
morat wrote: The openCacheEntry method now fails if it is called on the main thread.
Code: Select all
function openCacheEntry(key, cb) { var tries = 0; var listener = .................
morat This works like a charm
Thanks a lot!
Cattleya
Posts: 57 Joined: October 7th, 2010, 11:14 pm
Post
by Cattleya » June 11th, 2013, 9:00 am
Hi dorando
Can you help me ? I want a hotkey to subscrible current page to RSS Feed, like Menu -> Bookmark -> Subscrible to This Page did
Hope you can help me, many thank