MozillaZine

keyconfig 20110522

Announce and Discuss the Latest Theme and Extension Releases.
sashabe
 
Posts: 7
Joined: September 5th, 2007, 5:30 am

Post Posted June 4th, 2014, 6:36 am

Hello everybody! I'm trying to figure out how to move all the tabs to the right of the current one to new window. Stuck here:
Code: Select all
gBrowser.duplicateInWindow(gBrowser.mCurrentTab, true);

Cannot find documentation on duplicateInWindow. Would it require some kind of loop?

dorando
 
Posts: 1203
Joined: January 9th, 2004, 9:57 am

Post Posted June 7th, 2014, 6:32 am

ventainais wrote:The code copies all the mail content, but I need it to copy the last reply.
Try
Code: Select all
var messageId = gFolderDisplay.selectedMessage.messageId;
var replyMessage = null;

var allFolders = MailServices.accounts.allFolders.enumerate();
var folders = [];
while(allFolders.hasMoreElements()) {
 var folder = allFolders.getNext().QueryInterface(Components.interfaces.nsIMsgFolder);

 if(!folder.canFileMessages)
  continue;

 var messages = folder.messages;
 while(messages.hasMoreElements()) {
  var message = messages.getNext().QueryInterface(Components.interfaces.nsIMsgDBHdr);

  if(message.numReferences > 0 && message.getStringReference(message.numReferences-1) == messageId) {
   if(!replyMessage || message.date > replyMessage.date)
    replyMessage = message;
  }
 }
}

if(replyMessage) {
 MsgHdrToMimeMessage(replyMessage, null, function (aMsgHdr, aMimeMessage) {
  Components.classes["@mozilla.org/widget/clipboardhelper;1"].getService(Components.interfaces.nsIClipboardHelper)
  .copyString([
   (aMsgHdr.flags & Components.interfaces.nsMsgMessageFlags.HasRe ? "Re: " : "") + aMsgHdr.mime2DecodedSubject,
   new Date(aMsgHdr.dateInSeconds * 1000),
   aMsgHdr.mime2DecodedAuthor,
   aMsgHdr.mime2DecodedRecipients,
   "",
   aMimeMessage.coerceBodyToPlaintext(gFolderDisplay.displayedFolder).replace(/^\s+/,"").replace(/\s+$/g,"").replace(/\n/g,"\r\n")
  ].join("\r\n"));
  alert("Reply copied");
 }, true);
} else {
 alert("No reply found");
}
for copying the newest reply to the selected message (might take a bit).

raindog wrote:Please, am I missing something, or how to add a keyboard combo (something like Alt-1 on Windows and Option-1 on Mac) to open a bookmark from a bookmarks' toolbar?
Try Adding a new key containing
Code: Select all
var position 1;

var 
nodes document.getElementById("PlacesToolbarItems").children;
if(
nodes[position-1].childElementCount) {
 
nodes[position-1].open true;
} else {
 
nodes[position-1].click();
, and assign a shortcut to it (adjust position as needed).

sashabe wrote:Hello everybody! I'm trying to figure out how to move all the tabs to the right of the current one to new window.
Try
Code: Select all
var tabs gBrowser.getTabsToTheEndFrom(gBrowser.selectedTab);
if(!
tabs.length) return;
gBrowser.replaceTabWithWindow(tabs.shift()).addEventListener("load", function tempFunction(event) {
 
this.removeEventListener("load"tempFunctiontrue);
 for(var 
tab of tabs) {
  var 
newTab this.gBrowser.addTab("about:blank", {skipAnimationtrue});
  
newTab.linkedBrowser.stop();
  
newTab.linkedBrowser.docShell;
  
this.gBrowser.swapBrowsersAndCloseOther(newTabtab);
 }
}, 
true); 
Support mozilla.dorando.at through donations/contributions.

saganama
 
Posts: 2
Joined: June 8th, 2014, 8:44 am

Post Posted June 8th, 2014, 8:50 am

I have been a longtime Keyfixer user but since I updated to Firefox 29.0.1, it is not working. I use it only while composing email (Yahoo primarily) to make the Home and End keys take me to the beginning and end of the line. Now it's taking me to the top and bottom of the email. So it looks like it's not working as it always has.

What do I need to do to make it work again? THANKS!!
--Dana

dorando
 
Posts: 1203
Joined: January 9th, 2004, 9:57 am

Post Posted June 9th, 2014, 6:21 am

saganama wrote:I have been a longtime Keyfixer user but since I updated to Firefox 29.0.1, it is not working. I use it only while composing email (Yahoo primarily) to make the Home and End keys take me to the beginning and end of the line. Now it's taking me to the top and bottom of the email. So it looks like it's not working as it always has.

What do I need to do to make it work again? THANKS!!
--Dana
The author of Keyfixer is aware, and the keyfixer github homepage contains (possibly incomplete) changes for Firefox 29.

You could try to build a new .xpi or modify Profile/extensions/keyfixer@mavaball.net.xpi (.xpi/.jar is the same as .zip) while the application is closed and replace the install.rdf and chrome.manifest files, and add platformHTMLBindings_new_29.xml to chrome/keyfixer.jar/content/ .
Support mozilla.dorando.at through donations/contributions.

saganama
 
Posts: 2
Joined: June 8th, 2014, 8:44 am

Post Posted June 9th, 2014, 2:55 pm

dorando wrote:The author of Keyfixer is aware, and the keyfixer github homepage contains (possibly incomplete) changes for Firefox 29.

You could try to build a new .xpi or modify Profile/extensions/keyfixer@mavaball.net.xpi (.xpi/.jar is the same as .zip) while the application is closed and replace the install.rdf and chrome.manifest files, and add platformHTMLBindings_new_29.xml to chrome/keyfixer.jar/content/ .


Without step-by-step instructions, building a new .xpi is out of my abilities. Are you able to provide those instructions or do you know if/when the developer will issue a new release of Keyfixer that is simply plug & play?

THANK YOU EVER SO MUCH!

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

Post Posted June 9th, 2014, 6:13 pm

Does anyone knows how I could use Keyconfig to assign the Tools > Sync Now command to a keystroke?

EDIT: Kinda proud of myself, I figured it out on my own. The code is:

Code: Select all
gSyncUI.doSync(event);
Last edited by WCityMike on June 12th, 2014, 3:36 pm, edited 1 time in total.

ventainais
 
Posts: 9
Joined: May 29th, 2014, 12:43 am

Post Posted June 11th, 2014, 3:22 am

dorando wrote:
ventainais wrote:The code copies all the mail content, but I need it to copy the last reply.
Try
Code: Select all
var messageId = gFolderDisplay.selectedMessage.messageId;
var replyMessage = null;

var allFolders = MailServices.accounts.allFolders.enumerate();
var folders = [];
while(allFolders.hasMoreElements()) {
 var folder = allFolders.getNext().QueryInterface(Components.interfaces.nsIMsgFolder);

 if(!folder.canFileMessages)
  continue;

 var messages = folder.messages;
 while(messages.hasMoreElements()) {
  var message = messages.getNext().QueryInterface(Components.interfaces.nsIMsgDBHdr);

  if(message.numReferences > 0 && message.getStringReference(message.numReferences-1) == messageId) {
   if(!replyMessage || message.date > replyMessage.date)
    replyMessage = message;
  }
 }
}

if(replyMessage) {
 MsgHdrToMimeMessage(replyMessage, null, function (aMsgHdr, aMimeMessage) {
  Components.classes["@mozilla.org/widget/clipboardhelper;1"].getService(Components.interfaces.nsIClipboardHelper)
  .copyString([
   (aMsgHdr.flags & Components.interfaces.nsMsgMessageFlags.HasRe ? "Re: " : "") + aMsgHdr.mime2DecodedSubject,
   new Date(aMsgHdr.dateInSeconds * 1000),
   aMsgHdr.mime2DecodedAuthor,
   aMsgHdr.mime2DecodedRecipients,
   "",
   aMimeMessage.coerceBodyToPlaintext(gFolderDisplay.displayedFolder).replace(/^\s+/,"").replace(/\s+$/g,"").replace(/\n/g,"\r\n")
  ].join("\r\n"));
  alert("Reply copied");
 }, true);
} else {
 alert("No reply found");
}
for copying the newest reply to the selected message (might take a bit).


Thank you for the reply, but the code wont copy anything, just the message appears "No reply found", but there is a reply.

sashabe
 
Posts: 7
Joined: September 5th, 2007, 5:30 am

Post Posted June 13th, 2014, 3:19 pm

Thank you dorando! Honestly, keyconfig is the first I think of when people ask me why I use Firefox.

dorando
 
Posts: 1203
Joined: January 9th, 2004, 9:57 am

Post Posted June 15th, 2014, 12:12 pm

saganama wrote:
dorando wrote:The author of Keyfixer is aware, and the keyfixer github homepage contains (possibly incomplete) changes for Firefox 29.

You could try to build a new .xpi or modify Profile/extensions/keyfixer@mavaball.net.xpi (.xpi/.jar is the same as .zip) while the application is closed and replace the install.rdf and chrome.manifest files, and add platformHTMLBindings_new_29.xml to chrome/keyfixer.jar/content/ .
Without step-by-step instructions, building a new .xpi is out of my abilities. Are you able to provide those instructions or do you know if/when the developer will issue a new release of Keyfixer that is simply plug & play?
Download the linked files, extract or open the .xpi/.jar (while Firefox is closed), replace/add the files, and save/repack the .xpi.

ventainais wrote:Thank you for the reply, but the code wont copy anything, just the message appears "No reply found", but there is a reply.
Hmm, has the reply a References header (View > Message Source) or any other header identifying the main message? Also try removing
Code: Select all
 if(!folder.canFileMessages)
  continue

Alternatively try (just comparing the subject):
Code: Select all
var messageId = gFolderDisplay.selectedMessage.messageId;
var messageSubject = gFolderDisplay.selectedMessage.mime2DecodedSubject;
var replyMessage = null;

var allFolders = MailServices.accounts.allFolders.enumerate();
var folders = [];
while(allFolders.hasMoreElements()) {
 var folder = allFolders.getNext().QueryInterface(Components.interfaces.nsIMsgFolder);

 if(!folder.canFileMessages)
  continue;

 var messages = folder.messages;
 while(messages.hasMoreElements()) {
  var message = messages.getNext().QueryInterface(Components.interfaces.nsIMsgDBHdr);

  if(message.mime2DecodedSubject == messageSubject)
   if(!replyMessage || message.date > replyMessage.date)
    replyMessage = message;
 }
}

if(replyMessage && replyMessage.messageId != messageId) {
 MsgHdrToMimeMessage(replyMessage, null, function (aMsgHdr, aMimeMessage) {
  Components.classes["@mozilla.org/widget/clipboardhelper;1"].getService(Components.interfaces.nsIClipboardHelper)
  .copyString([
   (aMsgHdr.flags & Components.interfaces.nsMsgMessageFlags.HasRe ? "Re: " : "") + aMsgHdr.mime2DecodedSubject,
   new Date(aMsgHdr.dateInSeconds * 1000),
   aMsgHdr.mime2DecodedAuthor,
   aMsgHdr.mime2DecodedRecipients,
   "",
   aMimeMessage.coerceBodyToPlaintext(gFolderDisplay.displayedFolder).replace(/^\s+/,"").replace(/\s+$/g,"").replace(/\n/g,"\r\n")
  ].join("\r\n"));
  alert("Reply copied");
 }, true);
} else {
 alert("No reply found");
}
Support mozilla.dorando.at through donations/contributions.

ventainais
 
Posts: 9
Joined: May 29th, 2014, 12:43 am

Post Posted June 19th, 2014, 12:09 am

ventainais wrote:Thank you for the reply, but the code wont copy anything, just the message appears "No reply found", but there is a reply.
Hmm, has the reply a References header (View > Message Source) or any other header identifying the main message? Also try removing
Code: Select all
 if(!folder.canFileMessages)
  continue;  

Alternatively try (just comparing the subject):
Code: Select all
var messageId = gFolderDisplay.selectedMessage.messageId;
var messageSubject = gFolderDisplay.selectedMessage.mime2DecodedSubject;
var replyMessage = null;

var allFolders = MailServices.accounts.allFolders.enumerate();
var folders = [];
while(allFolders.hasMoreElements()) {
 var folder = allFolders.getNext().QueryInterface(Components.interfaces.nsIMsgFolder);

 if(!folder.canFileMessages)
  continue;

 var messages = folder.messages;
 while(messages.hasMoreElements()) {
  var message = messages.getNext().QueryInterface(Components.interfaces.nsIMsgDBHdr);

  if(message.mime2DecodedSubject == messageSubject)
   if(!replyMessage || message.date > replyMessage.date)
    replyMessage = message;
 }
}

if(replyMessage && replyMessage.messageId != messageId) {
 MsgHdrToMimeMessage(replyMessage, null, function (aMsgHdr, aMimeMessage) {
  Components.classes["@mozilla.org/widget/clipboardhelper;1"].getService(Components.interfaces.nsIClipboardHelper)
  .copyString([
   (aMsgHdr.flags & Components.interfaces.nsMsgMessageFlags.HasRe ? "Re: " : "") + aMsgHdr.mime2DecodedSubject,
   new Date(aMsgHdr.dateInSeconds * 1000),
   aMsgHdr.mime2DecodedAuthor,
   aMsgHdr.mime2DecodedRecipients,
   "",
   aMimeMessage.coerceBodyToPlaintext(gFolderDisplay.displayedFolder).replace(/^\s+/,"").replace(/\s+$/g,"").replace(/\n/g,"\r\n")
  ].join("\r\n"));
  alert("Reply copied");
 }, true);
} else {
 alert("No reply found");
}


I am using IMAP server and I don't know where to find the References header in the source
There is a Message-ID: <1482295362.93038.1403161307842.JavaMail.zimbra@test.eu>

Removing the one code line wont help.

The alternative gives the same error.

dorando
 
Posts: 1203
Joined: January 9th, 2004, 9:57 am

Post Posted June 19th, 2014, 12:04 pm

ventainais wrote:[…] I don't know where to find the References header in the source
Edit > Find.
Support mozilla.dorando.at through donations/contributions.

raindog
 
Posts: 70
Joined: December 16th, 2002, 3:55 am

Post Posted June 20th, 2014, 10:31 pm

dorando, thanks!

ventainais
 
Posts: 9
Joined: May 29th, 2014, 12:43 am

Post Posted June 25th, 2014, 1:34 am

dorando wrote:
ventainais wrote:[…] I don't know where to find the References header in the source
Edit > Find.


Sorry, didn't thought like that :)
Yes there is a Reference header, example: References: <53A443FD.7030203@mail.ee>

blackwind

User avatar
 
Posts: 115
Joined: May 12th, 2007, 3:07 pm
Location: Canada

Post Posted July 2nd, 2014, 3:06 pm

I'd like a hotkey for the Developer Toolbar's (Shift+F2) command "screenshot --fullpage", but can't figure out how to access it via JS. Thoughts?
/bw (Author of Reload Plus)

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

Post Posted July 6th, 2014, 1:09 pm

@blackwind

I got the tilt toggle command to execute.

http://gist.githubusercontent.com/Gozala/6126308/raw
http://gist.github.com/Gozala/6126308/

Edit:

Code: Select all
gcliExec({
  command: "screenshot",
  args: {filename: " " /* FILENAME_DEFAULT_VALUE */, fullpage: true}
})

http://mxr.mozilla.org/mozilla-esr24/se ... AULT_VALUE
Last edited by morat on July 6th, 2014, 3:58 pm, edited 1 time in total.

Return to Extension/Theme Releases


Who is online

Users browsing this forum: No registered users and 2 guests