This script is not from my website, I would like to call crocodile()
because now I have to wait 20 seconds before it is called.
I would like to achieve it via browser console or UserJS or Selenium.
However I suspect it is not possible as explained in:
Access and modify variable in anonymous function as parameter in other function JS/Angular
Is it right? I am not sure, because I have little experience with js
$.fn.countdown = function (callback, duration, message) {
var countdown = setInterval(
....
callback.call(...);
...
, 1000);
};
$(document).ready(function () {
var link = 'https://example.com/c?p=1';
var userId = parseInt(2);
if (isNaN(userId)) {
....
} else {
/* counts down 20 seconds before call */
$(".countdown").countdown(crocodile, 20, "");
}
function crocodile() {
var _l = 'https://example.com/c?p=1';
var _sID = parseInt(1);
var _uID = parseInt(2);
$.ajax({
type: "GET",
cashe: false,
url: '/example',
data: {
idS: _sID,
userId: _uID,
link: _l
},
dataType: "json",
traditional: true,
success: function (data) {
$(location).prop('href', data.url);
}
});
}
});