Fix: make script working on Chromium#1
Fix: make script working on Chromium#1kirill9000 wants to merge 1 commit intoKOLANICH-userscripts:masterfrom
Conversation
| const downloadUriTemplate="https://clients2.google.com/service/update2/crx?response=redirect&prodversion=38.0&x=id%3D$ID$%26installsource%3Dondemand%26uc "; | ||
| const downloadUriTemplate="https://clients2.google.com/service/update2/crx?response=redirect&prodversion=$VER$&x=id%3D$ID$%26installsource%3Dondemand%26uc "; | ||
| function getBrowserVersion() { | ||
| return window.navigator.userAgent.match(/Chrome\/([0-9.]+)/)[1]; |
There was a problem hiding this comment.
This will be broken in the browsers other than Chrome. The script is targeted for Firefox users, because chrome users already have the mean to download crxes.
There was a problem hiding this comment.
Hardcoded version number was kinda strange, but now I understand. Well, fallback could be added for the case if no match was found.
|
Thank you for a PR, it is not usable, because it breaks the script working in Firefox (its main target target audience is FF users, because for chrome there are addons doing the same), but I'll try to make it work in other browsers too. And please write in English on GitHub, because GH is an international website and everyone should be able to understand what is going on. |
|
see 24ada31 |
|
Unlike Firefox, there is no |
|
We can detect the correct element either by class name or by its position in DOM tree. It is very unlikely that the button is drawn by the browser, it also may be possible to make the store work by mocking 'chrome.webstorePrivate' (it is the API to install addons, but I haven't managed to find calls for them during page initialization by setting breakpoints on the lines with them, so I don't know why the buttons are not shown). |
На самом Хромиуме (собранном без плагина для магазина расширений) скрипт не работал, ругался на неправильный заголовок и let без strict mode. Кнопки из getButton там тоже похоже уже нет. Ну и заодно пускай версию браузера сам определяет. Ах да, с атрибутом download почему-то ссылка не нажимается.