-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: make script working on Chromium #1
base: master
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 почему-то ссылка не нажимается.