Update hacks about moveTabForward/moveTabBackward for Firefox 20

This commit is contained in:
Piro / YUKI Hiroshi 2013-01-04 02:03:01 +09:00
parent d7d988ee96
commit 318ad0ee52

View File

@ -398,58 +398,74 @@ var TreeStyleTabWindowHelper = {
{ {
var b = aTabBrowser; var b = aTabBrowser;
eval('b.moveTabForward = '+ let (source = b.moveTabForward.toSource()) {
b.moveTabForward.toSource().replace( if (source.indexOf('nextTab.hidden') < 0) { // Firefox 19 or olders
'{', '{ var nextTab;' source = source.replace(
).replace( '{', '{ var nextTab;'
'tabPos < this.browsers.length - 1', ).replace(
'nextTab = this.treeStyleTab.getNextSiblingTab(this.mCurrentTab)' 'tabPos < this.browsers.length - 1',
).replace( 'nextTab = this.treeStyleTab.getNextSiblingTab(this.mCurrentTab)'
'tabPos + 1', 'nextTab._tPos' ).replace(
).replace( 'tabPos + 1', 'nextTab._tPos'
'this.moveTabTo(', );
'var descendant = this.treeStyleTab.getDescendantTabs(nextTab);\n' + }
'if (descendant.length) {\n' + eval('b.moveTabForward = '+
' nextTab = descendant[descendant.length-1];\n' + source.replace(
'}\n' + /(this.moveTabTo\([^;]+\);)/,
'$&' '(function() {\n' +
).replace( ' var descendant = this.treeStyleTab.getDescendantTabs(nextTab);\n' +
'this.moveTabToStart();', ' if (descendant.length) {\n' +
'this.treeStyleTab.internallyTabMovingCount++;\n' + ' nextTab = descendant[descendant.length-1];\n' +
'var parentTab = this.treeStyleTab.getParentTab(this.mCurrentTab);\n' + ' }\n' +
'if (parentTab) {\n' + ' $1\n' +
' this.moveTabTo(this.mCurrentTab, this.treeStyleTab.getFirstChildTab(parentTab)._tPos);\n' + '}).call(this);'
' this.mCurrentTab.focus();\n' + ).replace(
'}\n' + 'this.moveTabToStart();',
'else {\n' + '(function() {\n' +
' $&\n' + ' this.treeStyleTab.internallyTabMovingCount++;\n' +
'}\n' + ' var parentTab = this.treeStyleTab.getParentTab(this.mCurrentTab);\n' +
'this.treeStyleTab.internallyTabMovingCount--;' ' if (parentTab) {\n' +
) ' this.moveTabTo(this.mCurrentTab, this.treeStyleTab.getFirstChildTab(parentTab)._tPos);\n' +
); ' this.mCurrentTab.focus();\n' +
' }\n' +
' else {\n' +
' $&\n' +
' }\n' +
' this.treeStyleTab.internallyTabMovingCount--;\n' +
'}).call(this);'
)
);
}
eval('b.moveTabBackward = '+ let (source = b.moveTabBackward.toSource()) {
b.moveTabBackward.toSource().replace( if (source.indexOf('prevTab.hidden') < 0) { // Firefox 19 or olders
'{', '{ var prevTab;' source = source.replace(
).replace( '{', '{ var prevTab;'
'tabPos > 0', ).replace(
'prevTab = this.treeStyleTab.getPreviousSiblingTab(this.mCurrentTab)' 'tabPos > 0',
).replace( 'prevTab = this.treeStyleTab.getPreviousSiblingTab(this.mCurrentTab)'
'tabPos - 1', 'prevTab._tPos' ).replace(
).replace( 'tabPos - 1', 'prevTab._tPos'
'this.moveTabToEnd();', );
'this.treeStyleTab.internallyTabMovingCount++;\n' + }
'var parentTab = this.treeStyleTab.getParentTab(this.mCurrentTab);\n' + eval('b.moveTabBackward = '+
'if (parentTab) {\n' + source.replace(
' this.moveTabTo(this.mCurrentTab, this.treeStyleTab.getLastChildTab(parentTab)._tPos);\n' + 'this.moveTabToEnd();',
' this.mCurrentTab.focus();\n' + '(function() {\n' +
'}\n' + ' this.treeStyleTab.internallyTabMovingCount++;\n' +
'else {\n' + ' var parentTab = this.treeStyleTab.getParentTab(this.mCurrentTab);\n' +
' $&\n' + ' if (parentTab) {\n' +
'}\n' + ' this.moveTabTo(this.mCurrentTab, this.treeStyleTab.getLastChildTab(parentTab)._tPos);\n' +
'this.treeStyleTab.internallyTabMovingCount--;' ' this.mCurrentTab.focus();\n' +
) ' }\n' +
); ' else {\n' +
' $&\n' +
' }\n' +
' this.treeStyleTab.internallyTabMovingCount--;\n' +
'}).call(this);'
)
);
}
eval('b.loadTabs = '+ eval('b.loadTabs = '+
b.loadTabs.toSource().replace( b.loadTabs.toSource().replace(