MozillaZine

[Ext] userChrome.js

Announce and Discuss the Latest Theme and Extension Releases.
aronin
 
Posts: 243
Joined: November 9th, 2005, 7:31 pm

Post Posted September 17th, 2006, 8:21 pm

SevenSeven wrote:Another fantastic snippet that adds some functions to the tab context menu, tested only with 2.0 branch 20060917:

Close All Tabs
Close Left Tabs
Close Right Tabs
Purge Tab History

<a href="data:application/x-javascript;charset=utf-8;base64,Lyo9PT09PT09IEFkZCBmdW5jdGlvbihzKSB0byB0YWIgY29udGV4dCBtZW51ID09PT09PT0qLw0KDQp2YXIgbW9yZUZ1bmNzRm9yVGFiQ29udGV4dG1lbnUgPSB7DQoJaW5pdDogZnVuY3Rpb24oKSB7DQoJCXZhciB0YWJNZW51ID0gZG9jdW1lbnQuZ2V0QW5vbnltb3VzRWxlbWVudEJ5QXR0cmlidXRlKGdCcm93c2VyLCAiYW5vbmlkIiwgInRhYkNvbnRleHRNZW51Iik7DQoJCXZhciBmdW5jcyA9IFtdOw0KCQl2YXIgbSA9ICJtb3JlRnVuY3NGb3JUYWJDb250ZXh0bWVudS4iOw0KCQlmdW5jcy5wdXNoKHsgbGFiZWw6ICJQdXJnZSBUYWIgSGlzdG9yeSIsIGNvbW1hbmQ6IG0rInB1cmdlVGFiSGlzdG9yeSgpOyIgfSk7DQoJCWZ1bmNzLnB1c2goeyBsYWJlbDogIkNsb3NlIFJpZ2h0IFRhYnMiLCBjb21tYW5kOiAiZ0Jyb3dzZXIuY2xvc2VSaWdodFRhYnMoZ0Jyb3dzZXIubUNvbnRleHRUYWIpOyIgfSk7DQoJCWZ1bmNzLnB1c2goeyBsYWJlbDogIkNsb3NlIExlZnQgVGFicyIsIGNvbW1hbmQ6ICJnQnJvd3Nlci5jbG9zZUxlZnRUYWJzKGdCcm93c2VyLm1Db250ZXh0VGFiKTsiIH0pOw0KCQlmdW5jcy5wdXNoKHsgbGFiZWw6ICJDbG9zZSBBbGwgVGFicyIsIGNvbW1hbmQ6ICJnQnJvd3Nlci5jbG9zZUFsbFR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m9kZXMubGVuZ3RoIC0gMTsgaSA%2BPSAwOyAtLWkpIHsNCgkJaWYgKGNoaWxkTm9kZXNbaV0gIT0gdGhpcy5tQ3VycmVudFRhYikNCgkJdGhpcy5yZW1vdmVUYWIoY2hpbGROb2Rlc1tpXSk7DQoJfQ0KCXRoaXMucmVtb3ZlVGFiKHRoaXMubUN1cnJlbnRUYWIpOw0KfQ%3D%3D">code</a>


I don't see much use for 'Purge Tab History'. What will this code look like without this particular function?

Also in your previous snippet of opening in New Tab, a few things:
- Can we have History Items opening a New Tab

Also, when I Ctrl+Click a bookmark, the bookmark opens the bookmark in a new tab + a blank tab
Similarly when I Alt+Enter from addressbar, it opens the url in a new tab + a blank tab

I know I would never do any of these since thats the whole purpose of adding this code (i.e. not to use ctrl+click or alt+enter), just thought of bringing it to your attention.

SevenSeven
 
Posts: 33
Joined: February 8th, 2004, 1:05 pm

Post Posted September 17th, 2006, 10:10 pm

Fixed ctrl, shift, alt key issues:

<a href="data:application/x-javascript;charset=utf-8;base64,Lyo9PT09PT09IE9wZW4gdXJsYmFyJ3MvYm9va21hcmtzIGluIG5ldyBmZyB0YWIgb3IgaW4gY3VycmVudCB0YWIgaWYgaXQncyBibGFuayA9PT09PT09Ki8NCg0KZXZhbCgiQnJvd3NlckxvYWRVUkwgPSAiICsgQnJvd3NlckxvYWRVUkwudG9TdHJpbmcoKS5yZXBsYWNlKCJlOyIsICIkJiBpZiAoKGdCcm93c2VyLmN1cnJlbnRVUkkuc3BlYyAhPSAnYWJvdXQ6YmxhbmsnIHx8IGdCcm93c2VyLndlYlByb2dyZXNzLmlzTG9hZGluZ0RvY3VtZW50KSAmJiAoIWFUcmlnZ2VyaW5nRXZlbnQuY3RybEtleSAmJiAhYVRyaWdnZXJpbmdFdmVudC5zaGlmdEtleSAmJiAhYVRyaWdnZXJpbmdFdmVudC5hbHRLZXkpKSB7IHZhciB0YWIgPSBnQnJvd3Nlci5hZGRUYWIoKTsgZ0Jyb3dzZXIuc2VsZWN0ZWRUYWIgPSB0YWI7IH0iKSk7DQpldmFsKCJCb29rbWFya3NDb21tYW5kLm9wZW5PbmVCb29rbWFyayA9ICIgKyBCb29rbWFya3NDb21tYW5kLm9wZW5PbmVCb29rbWFyay50b1N0cmluZygpLnJlcGxhY2UoIm9wZW4iLCAiaWYgKChnQnJvd3Nlci5jdXJyZW50VVJJLnNwZWMgIT0gJ2Fib3V0OmJsYW5rJyB8fCBnQnJvd3Nlci53ZWJQcm9ncmVzcy5pc0xvYWRpbmdEb2N1bWVudCkgJiYgKGFUYXJnZXRCcm93c2VyICE9ICd3aW5kb3cnICYmIGFUYXJnZXRCcm93c2VyICE9ICd0YWInICYmIGFUYXJnZXRCcm93c2VyICE9ICd0YWJzaGlmdGVkJykpIHsgdmFyIHRhYiA9IGdCcm93c2VyLmFkZFRhYigpOyBnQnJvd3Nlci5zZWxlY3RlZFRhYiA9IHRhYjsgfSAkJiIpKTs%3D">Open urlbar URL's and bookmarks in new foreground tab or in current tab if it's blank</a>

aronin
 
Posts: 243
Joined: November 9th, 2005, 7:31 pm

Post Posted September 18th, 2006, 12:57 am

SevenSeven wrote:Fixed ctrl, shift, alt key issues:

<a href="data:application/x-javascript;charset=utf-8;base64,Lyo9PT09PT09IE9wZW4gdXJsYmFyJ3MvYm9va21hcmtzIGluIG5ldyBmZyB0YWIgb3IgaW4gY3VycmVudCB0YWIgaWYgaXQncyBibGFuayA9PT09PT09Ki8NCg0KZXZhbCgiQnJvd3NlckxvYWRVUkwgPSAiICsgQnJvd3NlckxvYWRVUkwudG9TdHJpbmcoKS5yZXBsYWNlKCJlOyIsICIkJiBpZiAoKGdCcm93c2VyLmN1cnJlbnRVUkkuc3BlYyAhPSAnYWJvdXQ6YmxhbmsnIHx8IGdCcm93c2VyLndlYlByb2dyZXNzLmlzTG9hZGluZ0RvY3VtZW50KSAmJiAoIWFUcmlnZ2VyaW5nRXZlbnQuY3RybEtleSAmJiAhYVRyaWdnZXJpbmdFdmVudC5zaGlmdEtleSAmJiAhYVRyaWdnZXJpbmdFdmVudC5hbHRLZXkpKSB7IHZhciB0YWIgPSBnQnJvd3Nlci5hZGRUYWIoKTsgZ0Jyb3dzZXIuc2VsZWN0ZWRUYWIgPSB0YWI7IH0iKSk7DQpldmFsKCJCb29rbWFya3NDb21tYW5kLm9wZW5PbmVCb29rbWFyayA9ICIgKyBCb29rbWFya3NDb21tYW5kLm9wZW5PbmVCb29rbWFyay50b1N0cmluZygpLnJlcGxhY2UoIm9wZW4iLCAiaWYgKChnQnJvd3Nlci5jdXJyZW50VVJJLnNwZWMgIT0gJ2Fib3V0OmJsYW5rJyB8fCBnQnJvd3Nlci53ZWJQcm9ncmVzcy5pc0xvYWRpbmdEb2N1bWVudCkgJiYgKGFUYXJnZXRCcm93c2VyICE9ICd3aW5kb3cnICYmIGFUYXJnZXRCcm93c2VyICE9ICd0YWInICYmIGFUYXJnZXRCcm93c2VyICE9ICd0YWJzaGlmdGVkJykpIHsgdmFyIHRhYiA9IGdCcm93c2VyLmFkZFRhYigpOyBnQnJvd3Nlci5zZWxlY3RlZFRhYiA9IHRhYjsgfSAkJiIpKTs%3D">Open urlbar URL's and bookmarks in new foreground tab or in current tab if it's blank</a>


/*======= Open urlbar's/bookmarks in new fg tab or in current tab if it's blank =======*/

eval("BrowserLoadURL = " + BrowserLoadURL.toString().replace("e;", "$& if ((gBrowser.currentURI.spec != 'about:blank' || gBrowser.webProgress.isLoadingDocument) && (!aTriggeringEvent.altKey)) { var tab = gBrowser.addTab(); gBrowser.selectedTab = tab; }"));
eval("BookmarksCommand.openOneBookmark = " +
BookmarksCommand.openOneBookmark.toString().replace("open", "if ((gBrowser.currentURI.spec != 'about:blank' || gBrowser.webProgress.isLoadingDocument) && (aTargetBrowser != 'window' && aTargetBrowser != 'tab' && aTargetBrowser != 'tabshifted')) { var tab = gBrowser.addTab(); gBrowser.selectedTab = tab; } $&"));


I removed the following:

!aTriggeringEvent.ctrlKey && !aTriggeringEvent.shiftKey

Otherwise it was over-writing the current tab if Shift+Clicked or Ctrl+Clicked. After removing these two, its resolved.

PS: How do you create a link to the Code? to paste in this thread.

aronin
 
Posts: 243
Joined: November 9th, 2005, 7:31 pm

Post Posted September 18th, 2006, 6:20 am

SevenSeven wrote:Sharing more snippets, tested only with 2.0 branch 20060915.

<a href="data:application/x-javascript;charset=utf-8;base64,Lyo9PT09PT09IE9wZW4gdXJsYmFyJ3MvYm9va21hcmtzIGluIG5ldyBmZyB0YWIgb3IgaW4gY3VycmVudCB0YWIgaWYgaXQncyBibGFuayA9PT09PT09Ki8NCg0KZXZhbCgiQnJvd3NlckxvYWRVUkwgPSAiICsgQnJvd3NlckxvYWRVUkwudG9TdHJpbmcoKS5yZXBsYWNlKCJlOyIsICIkJiBpZiAoZ0Jyb3dzZXIuY3VycmVudFVSSS5zcGVjICE9ICdhYm91dDpibGFuaycgfHwgZ0Jyb3dzZXIud2ViUHJvZ3Jlc3MuaXNMb2FkaW5nRG9jdW1lbnQpIHsgdmFyIHRhYiA9IGdCcm93c2VyLmFkZFRhYigpOyBnQnJvd3Nlci5zZWxlY3RlZFRhYiA9IHRhYjsgfSIpKQ0KZXZhbCgiQm9va21hcmtzQ29tbWFuZC5vcGVuT25lQm9va21hcmsgPSAiICsgQm9va21hcmtzQ29tbWFuZC5vcGVuT25lQm9va21hcmsudG9TdHJpbmcoKS5yZXBsYWNlKCJvcGVuIiwgImlmIChnQnJvd3Nlci5jdXJyZW50VVJJLnNwZWMgIT0gJ2Fib3V0OmJsYW5rJyB8fCBnQnJvd3Nlci53ZWJQcm9ncmVzcy5pc0xvYWRpbmdEb2N1bWVudCkgeyB2YXIgdGFiID0gZ0Jyb3dzZXIuYWRkVGFiKCk7IGdCcm93c2VyLnNlbGVjdGVkVGFiID0gdGFiOyB9ICQmIikpDQo%3D">Open urlbar URL's and bookmarks in new foreground tab or in current tab if it's blank</a>


How do I stop it from opening New Tabs for 'Bookmarklets'? Javascript should be executed on the current tab and it should not open a new tab.

SevenSeven
 
Posts: 33
Joined: February 8th, 2004, 1:05 pm

Post Posted September 18th, 2006, 2:31 pm

aronin,

after this part:

Code: Select all
isLoadingDocument) && (


insert this:

Code: Select all
!/^j/.test(url) &&

aronin
 
Posts: 243
Joined: November 9th, 2005, 7:31 pm

Post Posted September 18th, 2006, 6:38 pm

SevenSeven wrote:aronin,

after this part:

Code: Select all
isLoadingDocument) && (


insert this:

Code: Select all
!/^j/.test(url) &&


That worked. Thanks a ton.

aronin
 
Posts: 243
Joined: November 9th, 2005, 7:31 pm

Post Posted September 19th, 2006, 1:33 am

SevenSeven wrote:Fixed ctrl, shift, alt key issues:

<a href="data:application/x-javascript;charset=utf-8;base64,Lyo9PT09PT09IE9wZW4gdXJsYmFyJ3MvYm9va21hcmtzIGluIG5ldyBmZyB0YWIgb3IgaW4gY3VycmVudCB0YWIgaWYgaXQncyBibGFuayA9PT09PT09Ki8NCg0KZXZhbCgiQnJvd3NlckxvYWRVUkwgPSAiICsgQnJvd3NlckxvYWRVUkwudG9TdHJpbmcoKS5yZXBsYWNlKCJlOyIsICIkJiBpZiAoKGdCcm93c2VyLmN1cnJlbnRVUkkuc3BlYyAhPSAnYWJvdXQ6YmxhbmsnIHx8IGdCcm93c2VyLndlYlByb2dyZXNzLmlzTG9hZGluZ0RvY3VtZW50KSAmJiAoIWFUcmlnZ2VyaW5nRXZlbnQuY3RybEtleSAmJiAhYVRyaWdnZXJpbmdFdmVudC5zaGlmdEtleSAmJiAhYVRyaWdnZXJpbmdFdmVudC5hbHRLZXkpKSB7IHZhciB0YWIgPSBnQnJvd3Nlci5hZGRUYWIoKTsgZ0Jyb3dzZXIuc2VsZWN0ZWRUYWIgPSB0YWI7IH0iKSk7DQpldmFsKCJCb29rbWFya3NDb21tYW5kLm9wZW5PbmVCb29rbWFyayA9ICIgKyBCb29rbWFya3NDb21tYW5kLm9wZW5PbmVCb29rbWFyay50b1N0cmluZygpLnJlcGxhY2UoIm9wZW4iLCAiaWYgKChnQnJvd3Nlci5jdXJyZW50VVJJLnNwZWMgIT0gJ2Fib3V0OmJsYW5rJyB8fCBnQnJvd3Nlci53ZWJQcm9ncmVzcy5pc0xvYWRpbmdEb2N1bWVudCkgJiYgKGFUYXJnZXRCcm93c2VyICE9ICd3aW5kb3cnICYmIGFUYXJnZXRCcm93c2VyICE9ICd0YWInICYmIGFUYXJnZXRCcm93c2VyICE9ICd0YWJzaGlmdGVkJykpIHsgdmFyIHRhYiA9IGdCcm93c2VyLmFkZFRhYigpOyBnQnJvd3Nlci5zZWxlY3RlZFRhYiA9IHRhYjsgfSAkJiIpKTs%3D">Open urlbar URL's and bookmarks in new foreground tab or in current tab if it's blank</a>


Is the behavior of Bookmarks different when opened from Sidebar (Ctrl+B)? Coz it doesn't open a New Tab from there. Don't really need this. Just curious.

Tatsfield

User avatar
 
Posts: 127
Joined: February 6th, 2006, 5:58 am
Location: Poole, UK

Post Posted September 22nd, 2006, 2:17 am

I'm not a code writer but I want to alter the default for the Print Dialogue which controls Print Frames. The current default is nearly alWays what I don't want and I cannot find a way of making "As laid out on the screen" the default setting.

Can anyone offer me an idiots guide of how to do this? (And when I say idots guide, I mean instructions for the really dim!)
Win7 - Firefox 29.0.1 Thunderbird 24.5.0

Tatsfield

User avatar
 
Posts: 127
Joined: February 6th, 2006, 5:58 am
Location: Poole, UK

Post Posted September 29th, 2006, 7:09 am

Sorry for the bump but I feel my posting is sinking from view.
Win7 - Firefox 29.0.1 Thunderbird 24.5.0

Ria

User avatar
 
Posts: 3550
Joined: March 21st, 2004, 3:25 am
Location: Netherlands

Post Posted September 29th, 2006, 3:15 pm

SevenSeven wrote:Another fantastic snippet that adds some functions to the tab context menu, tested only with 2.0 branch 20060917:

Close All Tabs
Close Left Tabs
Close Right Tabs
Purge Tab History

<a href="data:application/x-javascript;charset=utf-8;base64,Lyo9PT09PT09IE1vcmUgZnVuY3Rpb25zIGZvciB0YWIgY29udGV4dCBtZW51ID09PT09PT0qLw0KDQp2YXIgdGhpc19tRkZUQzsNCg0KdmFyIG1vcmVGdW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ldKTsNCn0NCg0KZ0Jyb3dzZXIuY2xvc2VBbGxUYWJzID0gZnVuY3Rpb24gKCkNCnsNCgl2YXIgY2hpbGROb2RlcyA9IHRoaXMubVRhYkNvbnRhaW5lci5jaGlsZE5vZGVzOw0KDQoJZm9yICh2YXIgaSA9IGNoaWxkTm9kZXMubGVuZ3RoIC0gMTsgaSA%2BPSAwOyAtLWkpIHsNCgkJaWYgKGNoaWxkTm9kZXNbaV0gIT0gdGhpcy5tQ3VycmVudFRhYikNCgkJdGhpcy5yZW1vdmVUYWIoY2hpbGROb2Rlc1tpXSk7DQoJfQ0KCXRoaXMucmVtb3ZlVGFiKHRoaXMubUN1cnJlbnRUYWIpOw0KfQ%3D%3D">code</a>


I see an error in the console:

Error: menuitem has no properties
Source File: file:///C:/profile/chrome/userChrome.js
Line: 485

and that is this line:

if (webNav.canGoBack || webNav.canGoForward) menuitem.setAttribute("disabled", false);

I see also an error in another snippet that I've never seen before so maybe it's just my trunk build.

Leedsfan
 
Posts: 106
Joined: December 18th, 2004, 4:26 pm
Location: New Zealand

Post Posted September 30th, 2006, 12:23 am

Is there some code to put in userchrome.js or elsewhere to remove the "Add-on compatibility checking has been disabled....." bar the EM of in FF2RC1?

Thanks

old nicholas.alipaz
 
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post Posted September 30th, 2006, 3:48 pm

I have two requests if anybody finds time or finds interest...

Open searchbar in new tab on pressing enter
^SevenSeven made one for addressbar, I would like the searchbar to do the same.

Open "View Page Source" in new tab on middle-click
^Zoolcar9 made one for view selection source, but when I don't select anything the option for "View Page Source" doesn't operate the same.

Zoolcar9

User avatar
 
Posts: 2225
Joined: November 9th, 2004, 6:45 pm
Location: Jakarta, Indonesia (UTC+7)

Post Posted October 1st, 2006, 9:26 am

m435tr0d wrote:Open "View Page Source" in new tab on middle-click

I already made one for that.

My Firefox information | Add-ons | GitHub

"With great power, comes great desire to show it off."

old nicholas.alipaz
 
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post Posted October 1st, 2006, 10:56 am

Zoolcar9 wrote:
m435tr0d wrote:Open "View Page Source" in new tab on middle-click

I already made one for that.

Thanks I guess I didn't see that one when looking through the almost 30 pages of posts ;)

Tatsfield

User avatar
 
Posts: 127
Joined: February 6th, 2006, 5:58 am
Location: Poole, UK

Post Posted October 1st, 2006, 11:07 am

You didn't do one for the Print Frames options default?
Win7 - Firefox 29.0.1 Thunderbird 24.5.0

Return to Extension/Theme Releases


Who is online

Users browsing this forum: Bing [Bot] and 4 guests