Answer the question
In order to leave comments, you need to log in
`
How to access variables from html page from userscript`a for the same page?
I am writing userscript for one site.
Есть кнопка:
<button id="withdrawbtn" class="full_btn" ng-click="market.checkout()">Withdraw</button>
Answer the question
In order to leave comments, you need to log in
1. This is a directive for Angular js, in this case, market is not a global variable, but a property of the controller scope that is used by this button. You can get a scope, if you're lucky, like this . And if you're not lucky - if the developer turned off the debug mode - then I see only a completely steamy way, for example, create a user script that runs on document-start, which will install the angular field change interceptor in window and correct its code. For example, it will replace the .contoller() method so that it will wrap the passed function into another one that saves the scope to some global array.
2. What rights have you given to the userscript? By default, at least in firefox, global variables are available. If any grant is enabled, they can still be obtained through the unsafeWindow properties.
Мне подошел способ под названием "если повезёт".
Могу ли я поинтересоваться чем я обязан такому везению?
В смысле по каким причинам у меня это сработало и почему оно могло не сработать?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question