Focus Last Selected Tab 0.9.5.x ( http://www.gozer.org/mozilla/extensions/ ) と組み合わせて利用できるようにした

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@4765 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2009-07-21 04:03:33 +00:00
parent d472c30de5
commit c66a6570f5
3 changed files with 122 additions and 1 deletions

View File

@ -563,13 +563,23 @@ TreeStyleTabService.overrideExtensionsOnInitAfter = function() {
window.addEventListener('unload', listener, false); window.addEventListener('unload', listener, false);
} }
// FLST // FLST (Focus Last Selected Tab)
// https://addons.mozilla.org/ja/firefox/addon/32
if ('flst' in window) { if ('flst' in window) {
TreeStyleTabService.registerTabFocusAllowance(function(aTabBrowser) { TreeStyleTabService.registerTabFocusAllowance(function(aTabBrowser) {
return !aTabBrowser.treeStyleTab.getPref('extensions.flst.enabled'); return !aTabBrowser.treeStyleTab.getPref('extensions.flst.enabled');
}); });
} }
// Focus Last Selected Tab 0.9.5.x
// http://www.gozer.org/mozilla/extensions/
if (window['piro.sakura.ne.jp'].extensions.isInstalled('focuslastselectedtab@gozer.org') &&
window['piro.sakura.ne.jp'].extensions.isEnabled('focuslastselectedtab@gozer.org')) {
TreeStyleTabService.registerTabFocusAllowance(function(aTabBrowser) {
return !aTabBrowser.selectedTab.hasAttribute('lastselected');
});
}
// FireGestures // FireGestures
if ('FireGestures' in window) { if ('FireGestures' in window) {
eval('FireGestures.onExtraGesture = '+ eval('FireGestures.onExtraGesture = '+

View File

@ -0,0 +1,110 @@
/*
Extensions Compatibility Library
Usage:
if (window['piro.sakura.ne.jp'].extensions.isInstalled('my.extension.id@example.com') &&
window['piro.sakura.ne.jp'].extensions.isEnabled('my.extension.id@example.com'))
window['piro.sakura.ne.jp'].extensions.goToOptions('my.extension.id@example.com');
lisence: The MIT License, Copyright (c) 2009 SHIMODA "Piro" Hiroshi
http://www.cozmixng.org/repos/piro/fx3-compatibility-lib/trunk/license.txt
original:
http://www.cozmixng.org/repos/piro/fx3-compatibility-lib/trunk/extensions.js
*/
(function() {
const currentRevision = 1;
if (!('piro.sakura.ne.jp' in window)) window['piro.sakura.ne.jp'] = {};
var loadedRevision = 'extensions' in window['piro.sakura.ne.jp'] ?
window['piro.sakura.ne.jp'].extensions.revision :
0 ;
if (loadedRevision && loadedRevision > currentRevision) {
return;
}
window['piro.sakura.ne.jp'].extensions = {
revision : currentRevision,
ExtensionManager : Components.classes['@mozilla.org/extensions/manager;1']
.getService(Components.interfaces.nsIExtensionManager),
RDF : Components.classes['@mozilla.org/rdf/rdf-service;1']
.getService(Components.interfaces.nsIRDFService),
WindowMediator : Components.classes['@mozilla.org/appshell/window-mediator;1']
.getService(Components.interfaces.nsIWindowMediator),
Prefs : Components.classes['@mozilla.org/preferences;1']
.getService(Components.interfaces.nsIPrefBranch),
isInstalled : function(aId)
{
return this.ExtensionManager.getInstallLocation(aId);
},
isEnabled : function(aId)
{
var res = this.RDF.GetResource('urn:mozilla:item:'+aId);
var appDisabled = false;
try {
appDisabled = this.ExtensionManager.datasource.GetTarget(
res,
this.RDF.GetResource('http://www.mozilla.org/2004/em-rdf#appDisabled'),
true
).QueryInterface(Components.interfaces.nsIRDFLiteral)
.Value == 'true';
}
catch(e) {
}
var userDisabled = false;
try {
userDisabled = this.ExtensionManager.datasource.GetTarget(
res,
this.RDF.GetResource('http://www.mozilla.org/2004/em-rdf#userDisabled'),
true
).QueryInterface(Components.interfaces.nsIRDFLiteral)
.Value == 'true';
}
catch(e) {
}
return !appDisabled && !userDisabled;
},
goToOptions : function(aId)
{
var res = this.RDF.GetResource('urn:mozilla:item:'+aId);
var uri;
try {
uri = this.ExtensionManager.datasource.GetTarget(
res,
this.RDF.GetResource('http://www.mozilla.org/2004/em-rdf#optionsURL'),
true
).QueryInterface(Components.interfaces.nsIRDFLiteral)
.Value;
}
catch(e) {
}
if (!uri) return;
var windows = this.WindowMediator.getEnumerator(null);
while (windows.hasMoreElements())
{
let win = windows.getNext();
if (win.location.href == uri) {
win.focus();
return;
}
}
var instantApply = false;
try {
instantApply = this.Prefs.getBoolPref('browser.preferences.instantApply');
}
catch(e) {
}
window.openDialog(
uri,
'',
'chrome,titlebar,toolbar,centerscreen,' + (instantApply ? 'dialog=no' : 'modal' )
);
}
};
})();

View File

@ -12,6 +12,7 @@
<script src="res/boxObject.js" type="application/x-javascript; version=1.7"/> <script src="res/boxObject.js" type="application/x-javascript; version=1.7"/>
<script src="res/autoScroll.js" type="application/x-javascript; version=1.7"/> <script src="res/autoScroll.js" type="application/x-javascript; version=1.7"/>
<script src="res/animationManager.js" type="application/x-javascript; version=1.7"/> <script src="res/animationManager.js" type="application/x-javascript; version=1.7"/>
<script src="res/extensions.js" type="application/x-javascript; version=1.7"/>
<script src="treestyletab.js" type="application/x-javascript; version=1.7"/> <script src="treestyletab.js" type="application/x-javascript; version=1.7"/>
<script src="treestyletabbrowser.js" type="application/x-javascript; version=1.7"/> <script src="treestyletabbrowser.js" type="application/x-javascript; version=1.7"/>
<script src="preloadImages.js" type="application/x-javascript; version=1.7"/> <script src="preloadImages.js" type="application/x-javascript; version=1.7"/>