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,23 +398,30 @@ 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
source = source.replace(
'{', '{ var nextTab;' '{', '{ var nextTab;'
).replace( ).replace(
'tabPos < this.browsers.length - 1', 'tabPos < this.browsers.length - 1',
'nextTab = this.treeStyleTab.getNextSiblingTab(this.mCurrentTab)' 'nextTab = this.treeStyleTab.getNextSiblingTab(this.mCurrentTab)'
).replace( ).replace(
'tabPos + 1', 'nextTab._tPos' 'tabPos + 1', 'nextTab._tPos'
).replace( );
'this.moveTabTo(', }
eval('b.moveTabForward = '+
source.replace(
/(this.moveTabTo\([^;]+\);)/,
'(function() {\n' +
' var descendant = this.treeStyleTab.getDescendantTabs(nextTab);\n' + ' var descendant = this.treeStyleTab.getDescendantTabs(nextTab);\n' +
' if (descendant.length) {\n' + ' if (descendant.length) {\n' +
' nextTab = descendant[descendant.length-1];\n' + ' nextTab = descendant[descendant.length-1];\n' +
' }\n' + ' }\n' +
'$&' ' $1\n' +
'}).call(this);'
).replace( ).replace(
'this.moveTabToStart();', 'this.moveTabToStart();',
'(function() {\n' +
' this.treeStyleTab.internallyTabMovingCount++;\n' + ' this.treeStyleTab.internallyTabMovingCount++;\n' +
' var parentTab = this.treeStyleTab.getParentTab(this.mCurrentTab);\n' + ' var parentTab = this.treeStyleTab.getParentTab(this.mCurrentTab);\n' +
' if (parentTab) {\n' + ' if (parentTab) {\n' +
@ -424,20 +431,27 @@ var TreeStyleTabWindowHelper = {
' else {\n' + ' else {\n' +
' $&\n' + ' $&\n' +
' }\n' + ' }\n' +
'this.treeStyleTab.internallyTabMovingCount--;' ' 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
source = source.replace(
'{', '{ var prevTab;' '{', '{ var prevTab;'
).replace( ).replace(
'tabPos > 0', 'tabPos > 0',
'prevTab = this.treeStyleTab.getPreviousSiblingTab(this.mCurrentTab)' 'prevTab = this.treeStyleTab.getPreviousSiblingTab(this.mCurrentTab)'
).replace( ).replace(
'tabPos - 1', 'prevTab._tPos' 'tabPos - 1', 'prevTab._tPos'
).replace( );
}
eval('b.moveTabBackward = '+
source.replace(
'this.moveTabToEnd();', 'this.moveTabToEnd();',
'(function() {\n' +
' this.treeStyleTab.internallyTabMovingCount++;\n' + ' this.treeStyleTab.internallyTabMovingCount++;\n' +
' var parentTab = this.treeStyleTab.getParentTab(this.mCurrentTab);\n' + ' var parentTab = this.treeStyleTab.getParentTab(this.mCurrentTab);\n' +
' if (parentTab) {\n' + ' if (parentTab) {\n' +
@ -447,9 +461,11 @@ var TreeStyleTabWindowHelper = {
' else {\n' + ' else {\n' +
' $&\n' + ' $&\n' +
' }\n' + ' }\n' +
'this.treeStyleTab.internallyTabMovingCount--;' ' this.treeStyleTab.internallyTabMovingCount--;\n' +
'}).call(this);'
) )
); );
}
eval('b.loadTabs = '+ eval('b.loadTabs = '+
b.loadTabs.toSource().replace( b.loadTabs.toSource().replace(