-
-
Save jscher2000/1037c1e95015470289eb4241c3731fc5 to your computer and use it in GitHub Desktop.
I need to run this script every time I restart my firefox. How to make it permanent or run automatically when restarting firefox, please?
Hi Brian, if you start from the steps in the following thread --
https://www.reddit.com/r/firefox/comments/kilmm2/restore_ctrlshiftb_library_by_setting_configjs/
-- the code to put inside the ///// section is:
var myKeyChanges = [
{
id: 'context-copylink',
newkey: 'a',
newlabel: 'Copy Link Location'
},
{
id: 'context-copyemail',
newkey: 'A',
newlabel: 'Copy Email Address'
},
{
id: 'main-context-menu-open-link-new-window',
newkey: 'W',
newlabel: 'Open Link in New Window'
}
];
for (var i=0; i<myKeyChanges.length; i++){
var menuitem = window.document.getElementById(myKeyChanges[i].id);
if (menuitem){
if (myKeyChanges[i].newkey.length == 1){
menuitem.setAttribute('accesskey', myKeyChanges[i].newkey);
}
if (myKeyChanges[i].newlabel.length > 0){
menuitem.setAttribute('label', myKeyChanges[i].newlabel);
}
}
}
I've added a downloadable zip file to this section:
https://www.userchrome.org/what-is-userchrome-js.html#combinedloader
I guess this only works in Windows? any Linux user here can help me out? I'm getting this error when running from the console:
Uncaught ReferenceError: gBrowser is not defined
<anonymous> debugger eval code:17
<anonymous> debugger eval code:55
I also followed the steps and copied the scripts to config.js
(as well as created the config-pref.js
) which I placed in my user profile directory:
/home/<user>/.mozilla/firefox/<profile-name>/chrome/
but I still don't get the Copy Link Address
on my right-click menu even after restarting Firefox.
I'm getting this error when running from the console:
Uncaught ReferenceError: gBrowser is not defined <anonymous> debugger eval code:17 <anonymous> debugger eval code:55
Make sure you are using the Browser Console and not the in-tab Web Console. https://developer.mozilla.org/docs/Tools/Browser_Console
I also followed the steps and copied the scripts to
config.js
(as well as created theconfig-pref.js
) which I placed in my user profile directory:/home/<user>/.mozilla/firefox/<profile-name>/chrome/
but I still don't get the
Copy Link Address
on my right-click menu even after restarting Firefox.
You are using these files? https://www.userchrome.org/what-is-userchrome-js.html#combinedloader
The [program folder] referenced in the script is the directory where Firefox's program files are installed -- not profile specific. One way to discover that directory would be on the Troubleshooting Information page (about:support), in the first table, where the Application Binary is installed.
Make sure you are using the Browser Console and not the in-tab Web Console
I've been using Firefox since I started learning how to code (back in college?) but I just learned today that the Browser Console (CTRL+SHIFT+J
) is not the same as in-tab Web Console (CTRL+SHIFT+I
).
The [program folder] referenced in the script is the directory where Firefox's program files are installed -- not profile specific.
Thanks for clarifying. So what I found out, in Linux this path is located in /usr/lib/firefox
(added files in /usr/lib/firefox/defaults/pref
)
EDIT:
was getting parse error and i realized the config.js
was on the wrong folder. Fixed by following steps above:
config-prefs.js
is located in/usr/lib/firefox/defaults/pref/
config.js
is in/usr/lib/firefox/
Followed your steps and it's working correctly now for me
Cheers
Thanks! It works on Firefox 88!