Aris-t2 / CustomJSforFx

custom scripts
GNU General Public License v3.0
238 stars 22 forks source link

[JavaScript] General JavaScript talk and custom userChrome.js scripts #4

Closed Aris-t2 closed 5 years ago

Aris-t2 commented 5 years ago

Lets discuss everything related to JavaScript here instead of opening new threads for questions or request.

Custom scripts https://github.com/Aris-t2/CustomJSforFx/tree/master/scripts

Other custom script collections - by ardiman - by Endor8

pro100Hub commented 5 years ago

@Aris-t2

There already is a "Bookmark Tab" entry in context menu

Thanks, but in FF 64 does not work browser.oldsearch.clearinput, so i stay on FF 63.

Aris-t2 commented 5 years ago

@pro100Hub

You can find a script to clear search bars input and to revert to first engine in list here: https://www.camp-firefox.de/forum/viewtopic.php?f=16&t=112673&start=2010#p1099758

Acid-Crash commented 5 years ago

@Aris-t2 I have a humble request Regarding another UndoClosedTab functionality (basically all those extensions out there have some flaws). Recently I've run to this script https://github.com/Endor8/userChrome.js/blob/master/Update 2018/UndoListInTabmenuToo.uc.js

UPD. This one here has a custom toolbar button with menu https://github.com/Endor8/userChrome.js/blob/master/Update 2018/extras_config_menu.uc.js

I'm just wondering is it possible to create a button based on this script that does the following: LeftClick (open Recently closed tabs in a drop-down menu) RightClick (open Recently closed windows in a drop-down menu)

THX in advance

Aris-t2 commented 5 years ago

Most likely it is.

LionWrathz commented 5 years ago

Try 'about:home' instead.

No idea why the page is white for you, but for me the same page opens for 'about:newtab' and 'about:home'. 'about:blank' is not used anywhere in the code.

If the add-on does the job for you, why would you use the script then?

i just want it transparency thats all, do you have a solution how to make about:newtab blank transparency? anyway thanks a lot bro.

knedel commented 5 years ago

Method 2 on Linux:

  1. Where to copy files from the _/method2/firefox/ folder and the config.js file. Is this path /usr/bin/ ?
  2. Where to copy the /scripts/ directory with *.uc.js files?
Aris-t2 commented 5 years ago
  1. Computer/usr/lib/firefox/ (might vary from distribution to distribution)
  2. Home/.mozilla/firefox/{profile name}/chrome/userChrome/ or look here
knedel commented 5 years ago

Hi, My paths:

tree -as --dirsfirst /home/username/.mozilla/firefox/22t6vtr5.default/chrome/
/home/username/.mozilla/firefox/22t6vtr5.default/chrome/
├── [       4096]  userChrome
│   ├── [     183083]  alternative_searchbar.uc.js
│   ├── [       1427]  userChromeJS.js
│   └── [       6490]  userChromeJSutilities.js
└── [        191]  userChrome.js

1 directory, 4 files
cat /home/username/.mozilla/firefox/22t6vtr5.default/chrome/userChrome.js 
// userChrome.js
userChrome.ignoreCache = true;
userChrome.import("/userChrome/alternative_searchbar.uc.js", "UChrm");
tree -as --dirsfirst /usr/lib64/firefox/
/usr/lib64/firefox/
├── [       4096]  browser
│   ├── [       4096]  chrome
│   │   └── [       4096]  icons
│   │       └── [       4096]  default
│   │           ├── [      12667]  default128.png
│   │           ├── [        798]  default16.png
│   │           ├── [       2145]  default32.png
│   │           ├── [       3607]  default48.png
│   │           └── [       5168]  default64.png
│   ├── [       4096]  defaults
│   │   └── [       4096]  preferences
│   │       └── [       1820]  firefox-redhat-default-prefs.js
│   ├── [       4096]  features
│   │   ├── [     619610]  formautofill@mozilla.org.xpi
│   │   ├── [    1170884]  screenshots@mozilla.org.xpi
│   │   ├── [      17770]  webcompat@mozilla.org.xpi
│   │   └── [      25260]  webcompat-reporter@mozilla.org.xpi
│   ├── [     184548]  blocklist.xml
│   ├── [          0]  chrome.manifest
│   ├── [        787]  crashreporter-override.ini
│   └── [   40747933]  omni.ja
├── [       4096]  defaults
│   └── [       4096]  pref
│       ├── [        245]  channel-prefs.js
│       └── [        133]  config-prefs.js
├── [         18]  dictionaries -> /usr/share/myspell
├── [       4096]  distribution
│   └── [        159]  distribution.ini
├── [       4096]  fonts
│   ├── [    1057104]  TwemojiMozilla.ttf
│   └── [         36]  .uuid
├── [       4096]  gmp-clearkey
│   └── [       4096]  0.1
│       ├── [     102304]  libclearkey.so
│       └── [        223]  manifest.json
├── [       4096]  gtk2
│   └── [      25384]  libmozgtk.so
├── [      12288]  langpacks
│   ├── [     465919]  langpack-ach@firefox.mozilla.org.xpi
│   ├── [     441960]  langpack-af@firefox.mozilla.org.xpi
│   ├── [     483356]  langpack-an@firefox.mozilla.org.xpi
│   ├── [     523548]  langpack-ar@firefox.mozilla.org.xpi
│   ├── [     487673]  langpack-as@firefox.mozilla.org.xpi
│   ├── [     471989]  langpack-ast@firefox.mozilla.org.xpi
│   ├── [     500418]  langpack-az@firefox.mozilla.org.xpi
│   ├── [     563356]  langpack-be@firefox.mozilla.org.xpi
│   ├── [     533898]  langpack-bg@firefox.mozilla.org.xpi
│   ├── [     551535]  langpack-bn-BD@firefox.mozilla.org.xpi
│   ├── [         38]  langpack-bn@firefox.mozilla.org.xpi -> langpack-bn-IN@firefox.mozilla.org.xpi
│   ├── [     538815]  langpack-bn-IN@firefox.mozilla.org.xpi
│   ├── [     489651]  langpack-br@firefox.mozilla.org.xpi
│   ├── [     481524]  langpack-bs@firefox.mozilla.org.xpi
│   ├── [     479841]  langpack-ca@firefox.mozilla.org.xpi
│   ├── [     516514]  langpack-cak@firefox.mozilla.org.xpi
│   ├── [     504999]  langpack-cs@firefox.mozilla.org.xpi
│   ├── [     494580]  langpack-cy@firefox.mozilla.org.xpi
│   ├── [     497085]  langpack-da@firefox.mozilla.org.xpi
│   ├── [     505003]  langpack-de@firefox.mozilla.org.xpi
│   ├── [     514745]  langpack-dsb@firefox.mozilla.org.xpi
│   ├── [     568944]  langpack-el@firefox.mozilla.org.xpi
│   ├── [     465123]  langpack-en-CA@firefox.mozilla.org.xpi
│   ├── [     451629]  langpack-en-GB@firefox.mozilla.org.xpi
│   ├── [     435146]  langpack-en-ZA@firefox.mozilla.org.xpi
│   ├── [     492631]  langpack-eo@firefox.mozilla.org.xpi
│   ├── [     501366]  langpack-es-AR@firefox.mozilla.org.xpi
│   ├── [     501097]  langpack-es-CL@firefox.mozilla.org.xpi
│   ├── [     448915]  langpack-es-ES@firefox.mozilla.org.xpi
│   ├── [         38]  langpack-es@firefox.mozilla.org.xpi -> langpack-es-AR@firefox.mozilla.org.xpi
│   ├── [     503967]  langpack-es-MX@firefox.mozilla.org.xpi
│   ├── [     483850]  langpack-et@firefox.mozilla.org.xpi
│   ├── [     487501]  langpack-eu@firefox.mozilla.org.xpi
│   ├── [     540178]  langpack-fa@firefox.mozilla.org.xpi
│   ├── [     480665]  langpack-ff@firefox.mozilla.org.xpi
│   ├── [     480820]  langpack-fi@firefox.mozilla.org.xpi
│   ├── [     510189]  langpack-fr@firefox.mozilla.org.xpi
│   ├── [         38]  langpack-fy@firefox.mozilla.org.xpi -> langpack-fy-NL@firefox.mozilla.org.xpi
│   ├── [     499241]  langpack-fy-NL@firefox.mozilla.org.xpi
│   ├── [         38]  langpack-ga@firefox.mozilla.org.xpi -> langpack-ga-IE@firefox.mozilla.org.xpi
│   ├── [     485379]  langpack-ga-IE@firefox.mozilla.org.xpi
│   ├── [     501591]  langpack-gd@firefox.mozilla.org.xpi
│   ├── [     477283]  langpack-gl@firefox.mozilla.org.xpi
│   ├── [     507652]  langpack-gn@firefox.mozilla.org.xpi
│   ├── [         38]  langpack-gu@firefox.mozilla.org.xpi -> langpack-gu-IN@firefox.mozilla.org.xpi
│   ├── [     568953]  langpack-gu-IN@firefox.mozilla.org.xpi
│   ├── [     495384]  langpack-he@firefox.mozilla.org.xpi
│   ├── [         38]  langpack-hi@firefox.mozilla.org.xpi -> langpack-hi-IN@firefox.mozilla.org.xpi
│   ├── [     553932]  langpack-hi-IN@firefox.mozilla.org.xpi
│   ├── [     474782]  langpack-hr@firefox.mozilla.org.xpi
│   ├── [     514458]  langpack-hsb@firefox.mozilla.org.xpi
│   ├── [     511759]  langpack-hu@firefox.mozilla.org.xpi
│   ├── [     531308]  langpack-hy-AM@firefox.mozilla.org.xpi
│   ├── [         38]  langpack-hy@firefox.mozilla.org.xpi -> langpack-hy-AM@firefox.mozilla.org.xpi
│   ├── [     488898]  langpack-ia@firefox.mozilla.org.xpi
│   ├── [     481806]  langpack-id@firefox.mozilla.org.xpi
│   ├── [     480194]  langpack-is@firefox.mozilla.org.xpi
│   ├── [     366370]  langpack-it@firefox.mozilla.org.xpi
│   ├── [     517059]  langpack-ja@firefox.mozilla.org.xpi
│   ├── [     504029]  langpack-kab@firefox.mozilla.org.xpi
│   ├── [     530061]  langpack-ka@firefox.mozilla.org.xpi
│   ├── [     560516]  langpack-kk@firefox.mozilla.org.xpi
│   ├── [     544258]  langpack-km@firefox.mozilla.org.xpi
│   ├── [     547268]  langpack-kn@firefox.mozilla.org.xpi
│   ├── [     511527]  langpack-ko@firefox.mozilla.org.xpi
│   ├── [     486639]  langpack-lij@firefox.mozilla.org.xpi
│   ├── [     514812]  langpack-lt@firefox.mozilla.org.xpi
│   ├── [     500925]  langpack-lv@firefox.mozilla.org.xpi
│   ├── [     505637]  langpack-mai@firefox.mozilla.org.xpi
│   ├── [     467809]  langpack-mk@firefox.mozilla.org.xpi
│   ├── [     550899]  langpack-ml@firefox.mozilla.org.xpi
│   ├── [     549060]  langpack-mr@firefox.mozilla.org.xpi
│   ├── [     484173]  langpack-ms@firefox.mozilla.org.xpi
│   ├── [     527248]  langpack-my@firefox.mozilla.org.xpi
│   ├── [         38]  langpack-nb@firefox.mozilla.org.xpi -> langpack-nb-NO@firefox.mozilla.org.xpi
│   ├── [     484308]  langpack-nb-NO@firefox.mozilla.org.xpi
│   ├── [     515717]  langpack-ne-NP@firefox.mozilla.org.xpi
│   ├── [     475557]  langpack-nl@firefox.mozilla.org.xpi
│   ├── [         38]  langpack-nn@firefox.mozilla.org.xpi -> langpack-nn-NO@firefox.mozilla.org.xpi
│   ├── [     482953]  langpack-nn-NO@firefox.mozilla.org.xpi
│   ├── [     497053]  langpack-oc@firefox.mozilla.org.xpi
│   ├── [     495052]  langpack-or@firefox.mozilla.org.xpi
│   ├── [         38]  langpack-pa@firefox.mozilla.org.xpi -> langpack-pa-IN@firefox.mozilla.org.xpi
│   ├── [     515950]  langpack-pa-IN@firefox.mozilla.org.xpi
│   ├── [     394114]  langpack-pl@firefox.mozilla.org.xpi
│   ├── [     486637]  langpack-pt-BR@firefox.mozilla.org.xpi
│   ├── [         38]  langpack-pt@firefox.mozilla.org.xpi -> langpack-pt-PT@firefox.mozilla.org.xpi
│   ├── [     499543]  langpack-pt-PT@firefox.mozilla.org.xpi
│   ├── [     488832]  langpack-rm@firefox.mozilla.org.xpi
│   ├── [     490378]  langpack-ro@firefox.mozilla.org.xpi
│   ├── [     556604]  langpack-ru@firefox.mozilla.org.xpi
│   ├── [     499066]  langpack-si@firefox.mozilla.org.xpi
│   ├── [     514327]  langpack-sk@firefox.mozilla.org.xpi
│   ├── [     495074]  langpack-sl@firefox.mozilla.org.xpi
│   ├── [     459136]  langpack-son@firefox.mozilla.org.xpi
│   ├── [     502786]  langpack-sq@firefox.mozilla.org.xpi
│   ├── [     516332]  langpack-sr@firefox.mozilla.org.xpi
│   ├── [         38]  langpack-sv@firefox.mozilla.org.xpi -> langpack-sv-SE@firefox.mozilla.org.xpi
│   ├── [     495003]  langpack-sv-SE@firefox.mozilla.org.xpi
│   ├── [     539771]  langpack-ta@firefox.mozilla.org.xpi
│   ├── [     556728]  langpack-te@firefox.mozilla.org.xpi
│   ├── [     518295]  langpack-th@firefox.mozilla.org.xpi
│   ├── [     505068]  langpack-tr@firefox.mozilla.org.xpi
│   ├── [     531292]  langpack-uk@firefox.mozilla.org.xpi
│   ├── [     532096]  langpack-ur@firefox.mozilla.org.xpi
│   ├── [     476909]  langpack-uz@firefox.mozilla.org.xpi
│   ├── [     498638]  langpack-vi@firefox.mozilla.org.xpi
│   ├── [     473019]  langpack-xh@firefox.mozilla.org.xpi
│   ├── [     518841]  langpack-zh-CN@firefox.mozilla.org.xpi
│   ├── [         38]  langpack-zh@firefox.mozilla.org.xpi -> langpack-zh-TW@firefox.mozilla.org.xpi
│   └── [     521893]  langpack-zh-TW@firefox.mozilla.org.xpi
├── [        579]  application.ini
├── [          0]  chrome.manifest
├── [        379]  config.js
├── [     449560]  crashreporter
├── [       4003]  crashreporter.ini
├── [         89]  dependentlibs.list
├── [     337664]  firefox
├── [     337672]  firefox-bin
├── [      54416]  liblgpllibs.so
├── [    2032688]  libmozavcodec.so
├── [     265328]  libmozavutil.so
├── [      15720]  libmozgtk.so
├── [     232304]  libmozsandbox.so
├── [    1006376]  libmozsqlite3.so
├── [      21680]  libmozwayland.so
├── [  112922232]  libxul.so
├── [        389]  LICENSE
├── [    1592920]  minidump-analyzer
├── [   17086816]  omni.ja
├── [     337272]  pingsender
├── [         46]  platform.ini
├── [     325168]  plugin-container
├── [       8786]  run-mozilla.sh
└── [        825]  Throbber-small.gif

16 directories, 157 files

And my searchbar still don't work like old searchbar and looks like this: firefox-one-click-search

I just want to use 'Alternative Searchbar' script https://github.com/Aris-t2/CustomJSforFx/issues/11 What am I doing wrong? firefox-64.0-4.fc29.x86_64

krystian3w commented 5 years ago

Install Firefox 60 ESR or Firefox 63?

knedel commented 5 years ago

I had Firefox 63, but I wanted to have the latest version (security fixes, etc.). Did you manage to run the "Alternative Searchbar" on Firefox 64?

Speravir commented 5 years ago

@knedel:

cat /home/username/.mozilla/firefox/22t6vtr5.default/chrome/userChrome.js
// userChrome.js
userChrome.ignoreCache = true;
userChrome.import("/userChrome/alternative_searchbar.uc.js", "UChrm");

What happens, if you remove the starting slash in userChrome.import? Now it’s an absolute path I think, but you need it to be relative. @Aris-t2 if so userChrome.js must be fixed.

knedel commented 5 years ago

I tried:

userChrome.import("userChrome/alternative_searchbar.uc.js", "UChrm");
userChrome.import("./userChrome/alternative_searchbar.uc.js", "UChrm");
userChrome.import("/home/username/.mozilla/firefox/22t6vtr5.default/chrome/userChrome/alternative_searchbar.uc.js", "UChrm");

but the above three variants didn't help.

Aris-t2 commented 5 years ago

1

This is the minimal configuration. Don't remove the // .... line or the file won't be loaded.

However, I can only test method 1 on Linux and macOS, because I don't have the patience to go through the admin/rights/permissions nonsense for system/program folders I want to change.

So I use "method 1" there and it works fine for me. Just tested on Ubuntu.

22 333

knedel commented 5 years ago

@Aris-t2 , please show me the output of the commands on your Ubuntu:

cat ./chrome/userChrome.css
cat ./chrome/userChrome/userChrome.xml
tree -as --dirsfirst ./chrome

I'm starting to be confused.

Aris-t2 commented 5 years ago

I don't see how this might help you. I really just used the files from here and added the used script names to the xml. I hope you have not forgotten to clear the cache after every change: https://github.com/Aris-t2/CustomJSforFx#scriptstartup-cache-must-be-deleted-after-every-change

dummyuser@dummyuser:~/.mozilla/firefox/6uegelun.default$ cat ./chrome/userChrome.css

toolbarbutton#alltabs-button { -moz-binding: url("./userChrome/userChrome.xml#execute_javascript_code"); } dummyuser@dummyuser:~/.mozilla/firefox/6uegelun.default$ cat ./chrome/userChrome/userChrome.xml <?xml version="1.0"?>

<bindings id="generalBindings" xmlns="http://www.mozilla.org/xbl" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:xbl="http://www.mozilla.org/xbl">

dummyuser@dummyuser:~/.mozilla/firefox/6uegelun.default$ tree -as --dirsfirst ./chrome

Command 'tree' not found, but can be installed with:

sudo snap install tree # version 3.5, or sudo apt install tree

See 'snap info tree' for additional versions.

knedel commented 5 years ago

Maybe I'm crazy, but I can't run the Alternative Searchbar script. I tried both Method 1 and Method 2 on Fedora Linux 29 and Windows 10 (fresh Firefox 64 install). I think the instructions you posted are too poor or you have not written about a plugin, patch or something like this. Yes, I cleaned the contents of the startupCache directory. Still, thanks for your willingness to help. I still need to set up this add-on at https://addons.mozilla.org/en-US/firefox/addon/classical-search-bar

Method 1 on my Fedora:

tree -as --dirsfirst ./chrome
./chrome
├── [       4096]  userChrome
│   ├── [     183083]  alternative_searchbar.uc.js
│   └── [        786]  userChrome.xml
└── [        106]  userChrome.css

1 directory, 3 files
cat ./chrome/userChrome/userChrome.xml 
<?xml version="1.0"?>

<bindings id="generalBindings"
  xmlns="http://www.mozilla.org/xbl"
  xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
  xmlns:xbl="http://www.mozilla.org/xbl">

  <binding id="execute_javascript_code" extends="chrome://global/content/bindings/toolbarbutton.xml#menu">
        <implementation>
          <constructor>
                <![CDATA[

                  function load_js_script(js_file_name) {
                    Services.scriptloader.loadSubScript(Components.stack.filename.substring(0,
                                Components.stack.filename.lastIndexOf("/") + 1) + js_file_name, window);
                  }

                  load_js_script("alternative_searchbar.uc.js");

                  // load other scripts
                  // load_js_script("my_other_script_name.uc.js");

                ]]>
          </constructor>
        </implementation>
  </binding>
</bindings>

By the way - why you can't install tree package on your Ubuntu?

krystian3w commented 5 years ago

try edit values in alternative_searchbar.uc.js:

// Configuration area - start
var clear_searchbar_after_search = true; // clear input after search (true) or not (false)
var revert_to_first_engine_after_search = true; // revert to first engine (true) or not (false)
var old_search_engine_selection_popup_fx64 = true; // show old search engine selection popup (true) or not (false)
var select_engine_by_scrolling_over_button = false; // select search engine by scrolling mouse wheel over search bars button (true) or not (false)
var hide_oneoff_search_engines = true; // hide 'one off' search engines (true) or not (false)
var hide_addengines_plus_indicator = false; // hide add engines '+' sign (true) or not (false)
var hide_placeholder = false; // hide placeholder (true) or not (false)
var show_search_engine_names = false; // show search engine names (true) or not (false)
var show_search_engine_names_with_scrollbar = false; // show search engine names with scrollbars (true) or not (false)
var show_search_engine_names_with_scrollbar_height = '170px'; // higher values show more search engines
var searchsettingslabel = "Search settings";
var hide_popup_when_selecting_engine_with_hotkeys = true; // hide popup when using 'CTRL or MOUSE WHEEL + UP&DOWN keys' to switch engine (true) or not (false)
image
knedel commented 5 years ago

Cześć Krystian, czy mógłbyś mi pomóc po polsku? Niekoniecznie tutaj, może na skype czat by tu nie zaśmiecać, albo na maila? Hi Krystian, could you help me in Polish? Not necessarily here, maybe chat on skype would not clutter here or email?

krystian3w commented 5 years ago

I do not know if I will help with this Fedora, only so I noticed that in my case the default values in the file alternative_searchbar.uc.js do not change the appearance of the retractable search list (and rather it is not a javascript cache error).

knedel commented 5 years ago

I gave up, I still have it: przechwycenie obrazu ekranu_2019-01-14_16-30-47

Aris-t2 commented 5 years ago

@knedel

I think the instructions you posted are too poor or you have not written about a plugin, patch or something like this.

I'm sorry, if the instructions are not clear enough for you, but there is nothing I can do to improve your situation. Hundreds of other users don't have the issue and the scripts work fine for them. I've tested scripts in Firefox 60-66 on different Windows systems and Linux and it worked everywhere.

By the way - why you can't install tree package on your Ubuntu? Because I don't need it. I'm using Linux in a VM for testing code inside Mozilla applications, nothing more. Neither Linux nor macOS are part of my main systems.

@krystian3w Editing values won't help, if the scripts can not be loaded

Aris-t2 commented 5 years ago

@knedel I just created a new VM (KUbuntu this time). I pasted method 1 files into profiles chrome folder, added alternative_searchbar.uc.js and restart_button.uc.js scripts to method 1s userChrome folder and added both file names to userChrome.xml file.

Started Firefox and both scripts were enabled. No idea why this does not work for you, but just to be sure, backup your profile folder and start with a new clean one.

krystian3w commented 5 years ago

Fedora ≈ Red Hat ≠ Ubuntu.

knedel commented 5 years ago

I know that Fedora is a derivative of Redhat, and Ubuntu - Debian. I checked the newly created other user account - it does not work either. Is the restart_button.uc.js script necessary for the alternative_searchbar.uc.js script to work?

krystian3w commented 5 years ago

Is the restart_button.uc.js script necessary for the alternative_searchbar.uc.js script to work?

Nope.

Aris-t2 commented 5 years ago

No idea why some Linux variations allow custom scripts and other don't. However when I saw it right, knedel even has this issue on Windows 10. Unfortunately I can't offer any other kind of support for this, sorry.

knedel commented 5 years ago

Nevertheless, thank you for your willingness to help me.

krystian3w commented 5 years ago

You tried remove files from startupCache your Firefox profile?

knedel commented 5 years ago

Yes, after each change in files:

  1. I'm turning off firefox.
  2. I'm cleaning the startupCache directory.
  3. I'm turning on firefox.

Despite this Alternative Search Bar doesn't work. I added Restart Button script, but it doesn't work too. I've no idea why.

krystian3w commented 5 years ago

Maybe no property added files from method 1? https://github.com/Aris-t2/CustomJSforFx/issues/2

Speravir commented 5 years ago

Because it is seen in a screenshot I provided in Aris-t2/CustomCSSforFx, issue #163 I thought of adding the script here. In fact, I have very short script code from 2 sources in Camp Firefox (German forum) merged into one script file I named ToggleFindbarMenubar.uc.js, but I will present them here separated.

/* Original: EffPeh in

niceboy76 commented 5 years ago

Hello Aris,

I'm using 21 userChrome.js scripts in FX but 1 don't work anymore (from 2 or 3 versions). This is : https://github.com/ardiman/userChrome.js/blob/master/backtothefavicon/BackToTheFavicon.uc.js (It replace the "i" in adressbar with the favicon of the visited site). Can anyboby try this script if it work ? Anybody have a solution to correct the script ? I really miss this function ! Thanks in advance for your answer. Have a nice weekend !

Acid-Crash commented 5 years ago

Hi @Aris-t2. Is it possible to replace AppButton (#PanelUI-button .toolbarbutton-icon) icon with profile avatar (#appMenu-fxa-avatar) when Firefox sync is enabled?

tortious commented 5 years ago

Hi all, Is anyone else having problems with the movable_urlbar.uc.js & movable_menu_button scripts?

The menubutton script no longer works for me whatsoever and also removes it from my browser unless I open a new window.

The urlbar script works, but it reverts back to its original place in the nav-bar regardless where I put it.

Any and all help is sincerely appreciated. Thanks in advance, ya'll!

krystian3w commented 5 years ago

Maybe: Script/startup cache must be deleted after every change!

Aris-t2 commented 5 years ago

@niceboy76 Any chance the script by ardiman got already updated?

@Acid-Crash Replacing the icon should be possible, but I don't how, because I never used any sync stuff.

@tortious Those scripts don't work anymore. Firefox overrides positions on startup. The only way to still achieve this is forcing a predefined toolbar position for those items like done in this example: https://github.com/Aris-t2/CustomJSforFx/issues/1

Acid-Crash commented 5 years ago

Hi @Aris-t2 Recently I have noticed that BrowserToolbox > Style Editor shows multiple entries of Styles that seem to be coming from JS. I do understand that they need to be there, however it is not clear why some of them are shown multiple times (typically it's from appMenu-restart-button JS). image

Do you have any insights on this matter? I'm on Win10x64, Release FF and Method 2 for JS

krystian3w commented 5 years ago

Try move turned/used scripts to other localization as \chrome\userChrome? Example: move to \chrome\userChrome\scripts.

For me this is remove duplicated CSS.

Aris-t2 commented 5 years ago

@Acid-Crash My guess they are present multiple times, because they get registered for every window you open.

krystian3w commented 5 years ago

because they get registered for every window you open.

Many opened tabs (no windows) no create dupilicates?

Acid-Crash commented 5 years ago

@krystian3w Hi right now I have the following structure: chrome/userChrome.js chrome/userChrome/separate scripts. @Aris-t2, indeed, made some tests and it seems to be the source. Can this behavior affect browser performance? Maybe it would me better to move CSS from JS to a separate CSS?

Aris-t2 commented 5 years ago

I don't think it can affect browser performance.

You can of course move CSS code to userChrome.css and userContent.css respectively, but only, if it does not contain any variables based on the JS code inside script file.

yogthot commented 5 years ago

I made two scripts to make the PanelUI and addon overflow buttons movable. This technique currently works in ff66-68, I haven't tested anything in between so let me know if there's any problem. Feel free to include them here if you want.

https://github.com/Patchonn/firefox-theme/blob/master/userChrome/movable_menu_button.uc.js https://github.com/Patchonn/firefox-theme/blob/master/userChrome/movable_overflow_button.uc.js

Aris-t2 commented 5 years ago

How about I add links to your project/collection on main page instead? ;-)

yogthot commented 5 years ago

Sure, I don't mind. But that's just my personal theme.

Acid-Crash commented 5 years ago

Hi @Aris-t2, just wondering could you please make a slim version of alternative_searchbar.uc.js that will only replace glass icon with the icon of a default search engine?

Aris-t2 commented 5 years ago
// 'Alternative search bar icon' script for Firefox 60+ by Aris
//
// Feature: search button shows current search engines icon (like with old search)

setTimeout(function(){
  try {
    var searchbar = document.getElementById("searchbar");

    updateStyleSheet();

    // setIcon function taken from browsers internal 'searchbar.js' file and added modifications
    searchbar.setIcon = function(element, uri) {
      element.setAttribute("src", uri);
      updateStyleSheet();
    };

    // main style sheet
    function updateStyleSheet() {
      var sss = Components.classes["@mozilla.org/content/style-sheet-service;1"].getService(Components.interfaces.nsIStyleSheetService);

      var uri = Services.io.newURI("data:text/css;charset=utf-8," + encodeURIComponent(' \
        .searchbar-search-button .searchbar-search-icon { \
          list-style-image: url('+document.getElementById("searchbar").currentEngine.iconURI.spec+') !important; \
        } \
        \
      '), null, null);

      // remove old style sheet
      if (sss.sheetRegistered(uri,sss.AGENT_SHEET)) {
        sss.unregisterSheet(uri,sss.AGENT_SHEET);
      }

      sss.loadAndRegisterSheet(uri, sss.AGENT_SHEET);

    };

  } catch(e) {}

},1000);
Acid-Crash commented 5 years ago

Great, works like a charm. Is this section deals with the multiple style sheet load that we were discussing earlier?

      // remove old style sheet
      if (sss.sheetRegistered(uri,sss.AGENT_SHEET)) {
        sss.unregisterSheet(uri,sss.AGENT_SHEET);
      }

      sss.loadAndRegisterSheet(uri, sss.AGENT_SHEET);
Aris-t2 commented 5 years ago

It is the general way to apply custom stylesheets within JS files.

It removes the old one with the old icon, if you switch search engines, instead of just overriding the old code. Last line would also work without removing old code.

BoomerangAide commented 5 years ago

Hi,

Before Quantum, I was using an extension to get a download window. The small weird unusable thing that appear when clicking the download button and the download tabs not being satisfying for me, I made this code:

var DownloadWindow = null;

(function() {

    try {

        var download_button = document.getElementById('downloads-button');

        download_button.onmousedown =
            function() {
                if(DownloadWindow == null || DownloadWindow.closed) {
                    DownloadWindow = window.open("about:downloads","DownloadsWindow","chrome,dialog=no,all,width=640,height=480,centerscreen,scrollbars=yes,resizable=yes,dependent=yes");
                }
                else {
                    DownloadWindow.focus();
                }
            };

    }
    catch(e) {}

})();

Worked for me on Firefox Quantum 65.0.2 Feel free to use it if you want.

Also, one tip: when you have lots of changes to do in Javascript, you can create a shortcut to Firefox, then in the path to the .exe, add "-purgecaches", so that it clear the caches automatically without having to open their folder and delete them manually every time. Example of content of target field of shortcut: "C:\Firefox\firefox.exe" -purgecaches