TreeStyleTabCommon => TreeStyleTabUtils
git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@5624 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
parent
16f8cc66bf
commit
641d9ffc9f
@ -455,16 +455,16 @@ var TreeStyleTabService = {
|
|||||||
|
|
||||||
get currentTabbarPosition() /* PUBLIC API */
|
get currentTabbarPosition() /* PUBLIC API */
|
||||||
{
|
{
|
||||||
return this.common.currentTabbarPosition;
|
return this.utils.currentTabbarPosition;
|
||||||
},
|
},
|
||||||
set currentTabbarPosition(aValue)
|
set currentTabbarPosition(aValue)
|
||||||
{
|
{
|
||||||
return this.common.currentTabbarPosition = aValue;
|
return this.utils.currentTabbarPosition = aValue;
|
||||||
},
|
},
|
||||||
|
|
||||||
rollbackTabbarPosition : function TSTService_rollbackTabbarPosition() /* PUBLIC API */
|
rollbackTabbarPosition : function TSTService_rollbackTabbarPosition() /* PUBLIC API */
|
||||||
{
|
{
|
||||||
return this.common.rollbackTabbarPosition();
|
return this.utils.rollbackTabbarPosition();
|
||||||
},
|
},
|
||||||
|
|
||||||
/* backward compatibility */
|
/* backward compatibility */
|
||||||
@ -2913,40 +2913,17 @@ catch(e) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/* Save/Load Prefs */
|
|
||||||
|
|
||||||
getTreePref : function TSTService_getTreePref(aPrefstring)
|
|
||||||
{
|
|
||||||
return this.getPref('extensions.treestyletab.'+aPrefstring);
|
|
||||||
},
|
|
||||||
|
|
||||||
setTreePref : function TSTService_setTreePref(aPrefstring, aNewValue)
|
|
||||||
{
|
|
||||||
return this.setPref('extensions.treestyletab.'+aPrefstring, aNewValue);
|
|
||||||
},
|
|
||||||
|
|
||||||
clearTreePref : function TSTService_clearTreePref(aPrefstring)
|
|
||||||
{
|
|
||||||
return this.clearPref('extensions.treestyletab.'+aPrefstring);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
var namespace = {};
|
var namespace = {};
|
||||||
Components.utils.import(
|
Components.utils.import(
|
||||||
'resource://treestyletab-modules/prefs.js',
|
'resource://treestyletab-modules/utils.js',
|
||||||
namespace
|
namespace
|
||||||
);
|
);
|
||||||
TreeStyleTabService.__proto__ = namespace.window['piro.sakura.ne.jp'].prefs;
|
TreeStyleTabService.__proto__ = TreeStyleTabService.utils = namespace.TreeStyleTabUtils;
|
||||||
|
TreeStyleTabService.utils.init();
|
||||||
Components.utils.import(
|
|
||||||
'resource://treestyletab-modules/common.jsm',
|
|
||||||
namespace
|
|
||||||
);
|
|
||||||
TreeStyleTabService.common = namespace.TreeStyleTabCommon;
|
|
||||||
TreeStyleTabService.common.init();
|
|
||||||
})();
|
})();
|
||||||
window.addEventListener('DOMContentLoaded', TreeStyleTabService, true);
|
window.addEventListener('DOMContentLoaded', TreeStyleTabService, true);
|
||||||
window.addEventListener('load', TreeStyleTabService, false);
|
window.addEventListener('load', TreeStyleTabService, false);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* ***** BEGIN LICENSE BLOCK *****
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the Mozilla Public License Version
|
* The contents of this file are subject to the Mozilla Public License Version
|
||||||
@ -32,12 +32,12 @@
|
|||||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||||
*
|
*
|
||||||
* ***** END LICENSE BLOCK ******/
|
* ***** END LICENSE BLOCK ******/
|
||||||
|
|
||||||
var EXPORTED_SYMBOLS = ['TreeStyleTabCommon'];
|
var EXPORTED_SYMBOLS = ['TreeStyleTabUtils'];
|
||||||
|
|
||||||
var TreeStyleTabCommon = {
|
var TreeStyleTabUtils = {
|
||||||
|
|
||||||
init : function TSTCommon_init()
|
init : function TSTUtils_init()
|
||||||
{
|
{
|
||||||
if (this._initialized) return;
|
if (this._initialized) return;
|
||||||
|
|
||||||
@ -45,9 +45,14 @@ var TreeStyleTabCommon = {
|
|||||||
this._tabbarPositionHistory.push(this.currentTabbarPosition);
|
this._tabbarPositionHistory.push(this.currentTabbarPosition);
|
||||||
},
|
},
|
||||||
_initialized : false,
|
_initialized : false,
|
||||||
|
|
||||||
|
// pref listener
|
||||||
observe : function TSTCommon_observe(aSubject, aTopic, aData)
|
|
||||||
|
domains : [
|
||||||
|
'extensions.treestyletab.tabbar.position'
|
||||||
|
],
|
||||||
|
|
||||||
|
observe : function TSTUtils_observe(aSubject, aTopic, aData)
|
||||||
{
|
{
|
||||||
switch (aTopic)
|
switch (aTopic)
|
||||||
{
|
{
|
||||||
@ -56,12 +61,8 @@ var TreeStyleTabCommon = {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
domains : [
|
onPrefChange : function TSTUtils_onPrefChange(aPrefName)
|
||||||
'extensions.treestyletab.tabbar.position'
|
|
||||||
],
|
|
||||||
|
|
||||||
onPrefChange : function TSTCommon_onPrefChange(aPrefName)
|
|
||||||
{
|
{
|
||||||
var value = this.getPref(aPrefName);
|
var value = this.getPref(aPrefName);
|
||||||
switch (aPrefName)
|
switch (aPrefName)
|
||||||
@ -74,12 +75,10 @@ var TreeStyleTabCommon = {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// tabbar position
|
||||||
// tabbar position API
|
|
||||||
|
get currentTabbarPosition() /* PUBLIC API */
|
||||||
/* PUBLIC API */
|
|
||||||
get currentTabbarPosition()
|
|
||||||
{
|
{
|
||||||
return this.getPref('extensions.treestyletab.tabbar.position') || 'top';
|
return this.getPref('extensions.treestyletab.tabbar.position') || 'top';
|
||||||
},
|
},
|
||||||
@ -94,9 +93,8 @@ var TreeStyleTabCommon = {
|
|||||||
|
|
||||||
return aValue;
|
return aValue;
|
||||||
},
|
},
|
||||||
|
|
||||||
/* PUBLIC API */
|
rollbackTabbarPosition : function TSTUtils_rollbackTabbarPosition() /* PUBLIC API */
|
||||||
rollbackTabbarPosition : function TSTCommon_rollbackTabbarPosition()
|
|
||||||
{
|
{
|
||||||
if (!this._tabbarPositionHistory.length)
|
if (!this._tabbarPositionHistory.length)
|
||||||
return false;
|
return false;
|
||||||
@ -107,16 +105,34 @@ var TreeStyleTabCommon = {
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
onChangeTabbarPosition : function TSTCommon_onChangeTabbarPosition(aPosition)
|
onChangeTabbarPosition : function TSTUtils_onChangeTabbarPosition(aPosition)
|
||||||
{
|
{
|
||||||
if (this._inRollbackTabbarPosition) return;
|
if (this._inRollbackTabbarPosition) return;
|
||||||
this._tabbarPositionHistory.push(aPosition);
|
this._tabbarPositionHistory.push(aPosition);
|
||||||
},
|
},
|
||||||
|
|
||||||
_tabbarPositionHistory : []
|
_tabbarPositionHistory : [],
|
||||||
|
|
||||||
};
|
/* Save/Load Prefs */
|
||||||
|
|
||||||
Components.utils.import('resource://treestyletab-modules/prefs.js');
|
getTreePref : function TSTUtils_getTreePref(aPrefstring)
|
||||||
TreeStyleTabCommon.__proto__ = window['piro.sakura.ne.jp'].prefs;
|
{
|
||||||
|
return this.getPref('extensions.treestyletab.'+aPrefstring);
|
||||||
|
},
|
||||||
|
|
||||||
|
setTreePref : function TSTUtils_setTreePref(aPrefstring, aNewValue)
|
||||||
|
{
|
||||||
|
return this.setPref('extensions.treestyletab.'+aPrefstring, aNewValue);
|
||||||
|
},
|
||||||
|
|
||||||
|
clearTreePref : function TSTUtils_clearTreePref(aPrefstring)
|
||||||
|
{
|
||||||
|
return this.clearPref('extensions.treestyletab.'+aPrefstring);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
Components.utils.import('resource://treestyletab-modules/prefs.js');
|
||||||
|
TreeStyleTabUtils.__proto__ = window['piro.sakura.ne.jp'].prefs;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user