Brush up hack for FireGestures based on latest codebase

This commit is contained in:
YUKI Hiroshi 2016-03-18 19:10:47 +09:00
parent ff3aed674f
commit 3ea008482b

View File

@ -677,44 +677,36 @@ TreeStyleTabWindowHelper.overrideExtensionsAfterBrowserInit = function TSTWH_ove
// https://addons.mozilla.org/firefox/addon/6366 // https://addons.mozilla.org/firefox/addon/6366
if ('FireGestures' in window && if ('FireGestures' in window &&
TreeStyleTabUtils.getTreePref('compatibility.FireGestures')) { TreeStyleTabUtils.getTreePref('compatibility.FireGestures')) {
eval('FireGestures.onExtraGesture = '+ FireGestures.__treestyletab__onExtraGesture = FireGestures.onExtraGesture;
FireGestures.onExtraGesture.toSource().replace( FireGestures.onExtraGesture = function(aEvent, aGesture, ...aArgs) {
'case "keypress-stop":', switch (aGesture)
'$&\n' + {
' TreeStyleTabService.readyToOpenChildTab(gBrowser, true);' case 'keypress-stop':
).replace( TreeStyleTabService.readyToOpenChildTab(gBrowser, true);
'break;case "gesture-timeout":', break;
' TreeStyleTabService.stopToOpenChildTab(gBrowser);\n' + case 'gesture-timeout':
'$&' TreeStyleTabService.stopToOpenChildTab(gBrowser);
) break;
); }
eval('FireGestures._performAction = '+ return FireGestures.__treestyletab__onExtraGesture.call(this, aEvent, aGesture, ...aArgs);
FireGestures._performAction.toSource().replace( };
'gBrowser.loadOneTab(', FireGestures.__treestyletab__performAction = FireGestures._performAction;
' TreeStyleTabService.readyToOpenChildTab(gBrowser);\n' + FireGestures._performAction = function(aEvent, aCommand, ...aArgs) {
'$&' switch (aCommand)
) {
); case 'FireGestures:OpenLinkInBgTab':
eval('FireGestures.openURLsInSelection = '+ case 'FireGestures:OpenLinkInFgTab':
FireGestures.openURLsInSelection.toSource().replace( TreeStyleTabService.readyToOpenChildTabNow(gBrowser);;
'var tab =', break;
' if (!TreeStyleTabService.checkToOpenChildTab(gBrowser))\n' + }
' TreeStyleTabService.readyToOpenChildTab(gBrowser, true);\n' + return FireGestures.__treestyletab__performAction.call(this, aEvent, aCommand, ...aArgs);
'$&' };
).replace( FireGestures.__treestyletab__handleEvent = FireGestures.handleEvent;
'if (!flag)', FireGestures.handleEvent = function(aEvent, ...aArgs) {
' if (TreeStyleTabService.checkToOpenChildTab(gBrowser))\n' + if (aEvent.type == 'command')
' TreeStyleTabService.stopToOpenChildTab(gBrowser);\n' + TreeStyleTabService.readyToOpenChildTabNow(gBrowser);
'$&' return FireGestures.__treestyletab__handleEvent.call(this, aEvent, ...aArgs);
) };
);
eval('FireGestures.handleEvent = '+
FireGestures.handleEvent.toSource().replace(
'gBrowser.loadOneTab(',
' TreeStyleTabService.readyToOpenChildTab(gBrowser);\n' +
'$&'
)
);
} }
// Mouse Gestures Redox // Mouse Gestures Redox