MozillaZine

keyconfig 20110522

Announce and Discuss the Latest Theme and Extension Releases.
TBDTBD
 
Posts: 12
Joined: April 24th, 2015, 11:23 pm

Post Posted May 8th, 2015, 6:16 am

Hi,

when I get an email with references to remote content, ThunderBird displays a pop up on top of the message body that says "To protect your privacy, Thunderbird has blocked remote content in this message."

On the right on the pop up, there is an "Options" box.

What would be the code for keyconfig that would press the "Options" box and then choose the "Show remote content in message" option?

Thanks.

Patu
 
Posts: 31
Joined: September 24th, 2008, 2:20 am

Post Posted May 8th, 2015, 7:16 am

morat wrote:@Patu

Try this:

Code: Select all
var selectors = "#maincontent > DIV:nth-of-type(3) > FORM > TABLE > TBODY > TR:nth-of-type(4) > TD:nth-of-type(2) > A";
var element = content.document.querySelector(selectors);
element.click();

https://developer.mozilla.org/en-US/doc ... rySelector


Dear Morat,
That was very helpful. Firstly, it works great. Secondly, it enabled me to adjust other key commands based on your solution. Thank you.

morat
 
Posts: 3938
Joined: February 3rd, 2009, 6:29 pm

Post Posted May 8th, 2015, 8:49 am

@TBDTBD

Try this:

* toggle "Show remote content for this message"

Code: Select all
var kNoRemoteContentPolicy = 0;
var kBlockRemoteContent = 1;
var kAllowRemoteContent = 2;
var msgHdr = gMessageDisplay.displayedMessage;
if (msgHdr) {
  var remoteContentPolicy = msgHdr.getUint32Property("remoteContentPolicy");
  if (remoteContentPolicy == kBlockRemoteContent) {
    setMsgHdrPropertyAndReload("remoteContentPolicy", kAllowRemoteContent);
  } else if (remoteContentPolicy == kAllowRemoteContent) {
    setMsgHdrPropertyAndReload("remoteContentPolicy", kNoRemoteContentPolicy);
  }
  window.content.focus();
}

http://mxr.mozilla.org/comm-esr31/searc ... is+message
http://mxr.mozilla.org/comm-esr31/searc ... llowForMsg
http://mxr.mozilla.org/comm-esr31/searc ... oteContent

note: /mail/ is source for Thunderbird, /suite/ is source for SeaMonkey

Similar thread: viewtopic.php?f=39&t=2866097

TBDTBD
 
Posts: 12
Joined: April 24th, 2015, 11:23 pm

Post Posted May 8th, 2015, 11:42 pm

Thanks Morat! The code works perfectly well.

tom011
 
Posts: 2
Joined: May 13th, 2015, 8:10 am

Post Posted May 13th, 2015, 8:25 am

I'm trying to set a domain prefix in the location bar for a new tab, but I don't want firefox to load the url since it isn't complete. I'm using:

gBrowser.selectedTab = gBrowser.addTab("http://test.site/");

which opens a new tab and loads the url. Keyconfig is working perfectly, but I'm hoping that someone knows how to just set the text in a new tab without firefox trying to connect.

Thank you,
Tom

morat
 
Posts: 3938
Joined: February 3rd, 2009, 6:29 pm

Post Posted May 13th, 2015, 5:12 pm

@tom011

Try these:

Code: Select all
var url = "http://www.google.com/search?q=";
var flags = Components.interfaces.nsIWebNavigation.STOP_ALL;
var browser = gBrowser.getBrowserForTab(
  gBrowser.selectedTab = gBrowser.addTab(url));
browser.webNavigation.stop(flags);

Code: Select all
var url = "http://www.google.com/search?q=";
var browser = gBrowser.getBrowserForTab(
  gBrowser.selectedTab = gBrowser.addTab("about:blank"));
browser.addEventListener("load", function onload(event) {
  event.currentTarget.removeEventListener(event.type, onload, true);
  event.originalTarget.title = "Google Search";
  openLocation();
  gURLBar.value = url;
}, true);

tom011
 
Posts: 2
Joined: May 13th, 2015, 8:10 am

Post Posted May 13th, 2015, 7:17 pm

morat,

Thank you! Both code blocks do exactly what I need to do. Also, thank you for such a fast answer as well!

Tom

Springtime
 
Posts: 68
Joined: November 8th, 2013, 8:59 pm

Post Posted May 22nd, 2015, 8:20 am

Could someone tell me how to toggle the Web Inspector panel using keyconfig? Tried using some modified code someone here provided a while ago for toggling the Find in page panel, but it merely opened the Inspector panel rather than toggling it on/off.

Any ideas? Cheers.

morat
 
Posts: 3938
Joined: February 3rd, 2009, 6:29 pm

Post Posted May 23rd, 2015, 2:46 am

Springtime wrote:set 'Toggle Bookmarks Toolbar' to a hotkey and noticed that if I toggle it via the hotkey the bookmarks don't appear

viewtopic.php?p=13858103#p13858103

Try this:

Code: Select all
// Toggle, View > Toolbars > Bookmarks Toolbar
var toolbar = document.getElementById("PersonalToolbar");
setToolbarVisibility(toolbar, toolbar.collapsed);

Springtime wrote:toggle the Web Inspector panel

Try the second code snippet:

Code: Select all
// Open, Tools > Web Developer > Inspector
gDevToolsBrowser.selectToolCommand(gBrowser, "inspector");

Code: Select all
// Toggle, Tools > Web Developer > Inspector
Services.prefs.setCharPref("devtools.toolbox.selectedTool", "inspector");
gDevToolsBrowser.toggleToolboxCommand(gBrowser);

http://mxr.mozilla.org/mozilla-esr31/se ... oolCommand
http://mxr.mozilla.org/mozilla-esr31/se ... boxCommand
Last edited by morat on May 23rd, 2015, 10:46 am, edited 1 time in total.

Springtime
 
Posts: 68
Joined: November 8th, 2013, 8:59 pm

Post Posted May 23rd, 2015, 5:29 am

morat wrote:
Springtime wrote:set 'Toggle Bookmarks Toolbar' to a hotkey and noticed that if I toggle it via the hotkey the bookmarks don't appear


Try this:

*snip*


Ahhh, thank you so much! And for remembering the previous post, too! Didn't think I'd find a solution to that :) Both toggle commands work flawlessly.

fefrie
 
Posts: 5
Joined: May 31st, 2015, 8:39 pm

Post Posted June 2nd, 2015, 7:11 pm

Hello everybody and thanks for a great addon!

Is there a keyboard shortcut to "SEND" a message once it's composed?

What would the syntax for that be? Just a simple "Send" in the code?

bege
 
Posts: 128
Joined: January 23rd, 2009, 9:14 pm
Location: Germany

Post Posted June 3rd, 2015, 4:47 am

tonymec wrote:There is a rumor that (I don't know exactly when) all add-ons will have to be signed, uploaded to AMO and reviewed by AMO editors including extensions not hosted at AMO, otherwise they'll be disabled by the add-ons manager. Dorando, if this rumour is true it will doubtlessly affect keyconfig. I've been told the matter is being discussed at mozilla.addons.user-experience (a list I don't follow). Any thoughts?


I read in a post in camp-firefox.de that this will come with Firefox 40 or 41. Dorando, will you have keyconfig (and menumanipulator) signed till then?
Thank you very much.

ar11x
 
Posts: 90
Joined: January 6th, 2015, 4:45 am

Post Posted June 4th, 2015, 1:46 am

Hi !
Is any possible edit the location bar by keyconfig !?
editLocationBar("google.com");


i did find out how to implement it ! :D
Last edited by ar11x on June 4th, 2015, 5:39 pm, edited 1 time in total.

bege
 
Posts: 128
Joined: January 23rd, 2009, 9:14 pm
Location: Germany

Post Posted June 4th, 2015, 2:34 am

fefrie wrote:Hello everybody and thanks for a great addon!

Is there a keyboard shortcut to "SEND" a message once it's composed?

What would the syntax for that be? Just a simple "Send" in the code?


As far as I know there is a standard shortcut in Thunderbird for this command: Ctrl+return

WCityMike
 
Posts: 63
Joined: February 29th, 2004, 10:28 am
Location: Chicago, Illinois

Post Posted June 13th, 2015, 3:13 pm

Can anyone let me know if there's a built-in keystroke for saving the current page to Firefox's newly-integrated Pocket?

If not, I got as far as here ...

https://hg.mozilla.org/mozilla-central/ ... et/main.js

... but could not take it any further. Would anyone be willing or able to work out the appropriate keyconfig code?

Return to Extension/Theme Releases


Who is online

Users browsing this forum: Google Adsense [Bot] and 3 guests