keyconfig 20110522

Announce and Discuss the Latest Theme and Extension Releases.
Post Reply
Oomingmak
Posts: 203
Joined: July 10th, 2004, 7:46 pm
Location: UK

Post by Oomingmak »

How do I use Keyconfig to open a bookmark in a new tab, focus to it, and also specify the name that's displayed on the tab?

I haven't got a clue about XUL, but after searching I found the following command and managed to get it working working, but it only opens in the current tab.

Code: Select all

if(window.loadURI) loadURI(getShortcutOrURI ('hist',{}));



I then found the following command which opened a new tab and focussed to it, but I can only get that to work if I use a full URL. If I use a bookmark keyword it doesn't work.

Code: Select all

gBrowser.selectedTab = gBrowser.addTab


My reason for wanting to use a bookmark keyword is that I am trying to crate a hotkey that opens my Firefox history in a new tab (rather than in the sidebar or a separate pop up window). The trouble is that whenever I open the following page chrome://browser/content/history/history-panel.xul it shows the url as the tab's title, and I would prefer it to just say "History".

I did try to find out how to specify a tab's display name, but because I don't really understand XUL syntax I'm having difficulty combining the renname commands with the command that opens the tab in the first place. None of the instructions I found gave full examples that included test names (it seems that you're just expected you to know how and where to specify the tab name once you've been given you the actual command). The closest I got was invoking the tab rename function of TabMixPlus (which I use anyway) but all that did was pop up a dialog asking you what you wanted to rename the tab to, rather than just immediately displaying your chosen name for the tab.

After getting nowhere with changing the tab display name by using code, I instead tried using the (now discontinued) TabRenamizer extension to take care of the renaming part. However, TabRenamizer won't show the name saved for the "History" tab when it's opened by Keyconfig using the url: chrome://browser/content/history/history-panel.xul even though the name has been saved as a rule in TabRenamizer. However, if the history tab is opened by pasting the url into the address / location bar (or if it's been opened by bookmark keyword) then the TabRenamizer rule does work and the tab gets renamed to "History".

This problem does not happen when doing the equivalent for Bookmarks (which I rename from "Library" to "Bookmarks"). TabRenamizer always successfully renames the "Library" tab to "Bookmarks" regardless of how the it has been opened.

It therefore seems that the best method would be to just get keyconfig to do the whole thing (i.e. open the history page in a new tab that is focussed and which has been renamed to "History").

Any help on the code to use to do this would be greatly appreciated.
morat
Posts: 6404
Joined: February 3rd, 2009, 6:29 pm

Re: keyconfig 20110522

Post by morat »

nigelle wrote:security paranoiac

The config2 source looks fine, but it is not unreasonable to only trust extensions that have been fully reviewed by Mozilla.

User Info for Zoolcar9
https://addons.mozilla.org/firefox/user/60697
morat
Posts: 6404
Joined: February 3rd, 2009, 6:29 pm

Re: keyconfig 20110522

Post by morat »

@Oomingmak

Try this:

Code: Select all

var url = "chrome://browser/content/history/history-panel.xul";
var browser = gBrowser.getBrowserForTab(
  gBrowser.selectedTab = gBrowser.addTab(url));
browser.addEventListener("load", function(event) {
  event.currentTarget.removeEventListener(event.type,
    arguments.callee, true);
  event.originalTarget.title = "History";
}, true);
User avatar
WildcatRay
Posts: 7484
Joined: October 18th, 2007, 7:03 pm
Location: Columbus, OH

Re: keyconfig 20110522

Post by WildcatRay »

morat wrote:
nigelle wrote:security paranoiac

The config2 source looks fine, but it is not unreasonable to only trust extensions that have been fully reviewed by Mozilla.

User Info for Zoolcar9
https://addons.mozilla.org/firefox/user/60697

FYI & AFAICT, keyconfig is not on addons.mozilla.org which probably means it has not been reviewed by mozilla either. :-"
Ray

OS'es: 4 computers with Win10 Pro 64-bit; Current Firefox, Beta, Nightly, Chrome, Vivaldi
morat
Posts: 6404
Joined: February 3rd, 2009, 6:29 pm

Re: keyconfig 20110522

Post by morat »

@mad.engineer

Try this:

Code: Select all

var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].
  getService(Components.interfaces.nsIPromptService);
var result = ps.confirmEx(window, "title", "description",
  ps.STD_YES_NO_BUTTONS, "", "", "", null, {});
if (result == 0) alert("Yes"); // press "Y" or "Enter"
if (result == 1) alert("No"); // press "N" or "Esc"

http://mxr.mozilla.org/comm-release/sou ... ervice.idl
nigelle
Posts: 117
Joined: June 9th, 2005, 8:30 am
Location: France

Re: keyconfig 20110522

Post by nigelle »

To close a Firefox screen, I know 2 methods : Alt+PF4 and click on the X in a red square in the right upper corner.
This is not sufficient in some cases when the application has programmed a confirm before closure of the screen.
Is there a coding to put in keyconfig short-cuts to :
1) unconditionaly close a screen ?
2) close all the screens and Firefox cleanly ?
without FF trying to reopen the screen(s) at the next occasion for both these cases !
nonameee
Posts: 2
Joined: April 6th, 2012, 1:23 am

Re: keyconfig 20110522

Post by nonameee »

Is there a shortcut or a way to create a shortcut to access backward/forward drop-down history list? I remember that I once found a code (but it was like 5 or six years ago) that you could combine with Keyconfig plug-in to achieve this functionality, but I can't seem to find it anywhere.

Thanks.
Zoolcar9
Posts: 2225
Joined: November 9th, 2004, 6:45 pm
Location: Jakarta, Indonesia (UTC+7)
Contact:

Re: keyconfig 20110522

Post by Zoolcar9 »

nigelle wrote:2) close all the screens and Firefox cleanly ?
without FF trying to reopen the screen(s) at the next occasion for both these cases !

Code: Select all

goQuitApplication()

nonameee wrote:Is there a shortcut or a way to create a shortcut to access backward/forward drop-down history list?

Code: Select all

var bf = document.getElementById("unified-back-forward-button");
var popup = document.getElementById("backForwardMenu");
var x = bf.boxObject.x;
var y = bf.boxObject.y + bf.boxObject.height;
popup.openPopup(null, "after_start", x, y, false, false);
My Firefox information | Add-ons | GitHub

"With great power, comes great desire to show it off."
nonameee
Posts: 2
Joined: April 6th, 2012, 1:23 am

Re: keyconfig 20110522

Post by nonameee »

Zoolcar9, thanks a lot!
mad.engineer
Posts: 314
Joined: August 8th, 2006, 4:08 pm

Re: keyconfig 20110522

Post by mad.engineer »

morat, Tried your code, unfortunately it did not helped. For now, I've reverted back to the original code. Like I said earlier, this worked fine when I was on W7 PC, but on OS X, unless I first hit the Tab key to toggle between Yes/No options and then press either Y/N, it does not work. Thanks
bege
Posts: 153
Joined: January 23rd, 2009, 9:14 pm
Location: Germany

Re: keyconfig 20110522

Post by bege »

nigelle wrote:Please urgent (1 or 2 days maximum) help needed see my post " Mar Mon 12th 2012 4:28pm"

I need to copy my Keyconfig short-cuts to a newly created Windows user and his FF profile.
I don't love the idea to do this manually but the import/export code given by Dorando does not work for me...
So I'll have to do it if you don't help me...


This works fine also:
http://softwarebychuck.com/opie/opie.html
rbfye14
Posts: 26
Joined: April 9th, 2012, 8:23 am

Re: keyconfig 20110522

Post by rbfye14 »

Hi all!
Is it possible to create codes for BBCode (bold, italics, url etc.)?
chirpy_7
Posts: 165
Joined: March 19th, 2007, 6:24 am

Re: keyconfig 20110522

Post by chirpy_7 »

hi Dorando & Co,

I'm trying to write a script to "collapse all day events" and "expand all day events" in google calendar.

I've honed in with Firebug, tried some stuff on Scratchpad, but no luck yet.

I tried

Code: Select all

a.setAttribute("aria-expanded","false");

and

Code: Select all

H.setAttribute("aria-expanded","false");


and am told that "a" & "H" are not defined, resp. So much for beginner's luck... :-k

Any clues to help me nudge further in the right direction would be much appreciated.

chirpy
Last edited by chirpy_7 on April 13th, 2012, 4:05 am, edited 1 time in total.
morat
Posts: 6404
Joined: February 3rd, 2009, 6:29 pm

Re: keyconfig 20110522

Post by morat »

rbfye14 wrote:possible to create codes for BBCode

Try this:

Code: Select all

var command = "cmd_insertText";
var controller = document.commandDispatcher.getControllerForCommand(command);
if (controller && controller.isCommandEnabled(command)) {
  var params = Components.classes["@mozilla.org/embedcomp/command-params;1"].
    createInstance(Components.interfaces.nsICommandParams);
  var win = document.commandDispatcher.focusedWindow;
  var textbox = win.document.activeElement;
  var selection = textbox.value.
    substring(textbox.selectionStart, textbox.selectionEnd);
  var text = "[b]" + selection + "[/b]";
  params.setStringValue("state_data", text);
  controller.QueryInterface(Components.interfaces.nsICommandController).
    doCommandWithParams(command, params);
}

http://en.wikipedia.org/wiki/BBCode
rbfye14
Posts: 26
Joined: April 9th, 2012, 8:23 am

Re: keyconfig 20110522

Post by rbfye14 »

morat wrote:Try this:

Yes it works! And I can change b to whatever tag I need.

Thanks a lot!
Post Reply