xiaoxiaoflood / firefox-scripts

userChromeJS / autoconfig.js and extensions
Mozilla Public License 2.0
989 stars 85 forks source link

How can you edit mouseGestures_uc.js? #47

Closed akaSM closed 4 years ago

akaSM commented 4 years ago

TL;DR: How can I edit the script to use my own gestures?

I recently installed FF DE and found about this project that allows (among other things) the use of mouse gestures that aren't limited by what web extensions can do, however, the default gestures aren't exactly what I was looking for.

Inside of the script, there's a URL (https://www.cnblogs.com/ziyunfei/archive/2011/12/15/2289504.html) that seems to be a script generator but, it's not working (I tried it with whatever the latest releases of FF DE, Vivaldi, and Waterfox Classic are; as well as FF 40 and even went back as far as 3).

I also tried editing the script itself in Notepad ++ (with 0 knowledge of JS) but whatever I edited stopped working, like this in line 157:

  'L>M': {
    name: 'Duplicate tab',
    cmd: function () {
      gBrowser.selectedTab = gBrowser.duplicateTab(gBrowser.selectedTab);
    }
  },

That I changed to this:

  'L>M': {
    name: 'Add tab',
    cmd: function () {
      gBrowser.addTab("http://www.google.com/");
    }
  },

It didn't work, that gesture stopped working but the rest of them were fine.

I also tried other scripts, like gomita's from xuldev, but they wouldn't load at all.

ganego commented 4 years ago

gBrowser.loadOneTab()

xiaoxiaoflood commented 4 years ago

You need to know JS so that you understand the code and be able to edit it.

Your addTab code is wrong, you need something like

gBrowser.addTab("http://www.google.com/", { triggeringPrincipal: gBrowser.selectedBrowser.contentPrincipal });

But sorry, I don't have time to help you beyond that