S!p
07-17-2023, 11:24 AM
Hello,
i`m trying to install https://vborg.vbsupport.ru/showthread.php?t=322478 on 4.2.5
The button is visable in showthread, but after press on it, nothing happend.
My browser is showing error: Uncaught ReferenceError: jQuery is not defined
at bestAnswer.js:43:4
(function ($, window) {
var $btn;
var postId;
var threadid = ($("input[name='threadid']")[0] || $("input[name='searchthreadid']")[0]).value;
var baseUrl = window.getBaseUrl() + 'bestAnswer.php';
var onSelectSuccess = function () {
$bestAnswerContainer = $btn.closest('.bestAnswer_container');
$('.selectBestAnswer').hide();
$bestAnswerContainer
.find('.unselectBestAnswer')
.show();
}
var onUnselectSuccess = function () {
$bestAnswerContainer = $btn.closest('.bestAnswer_container');
$('.selectBestAnswer').show();
$('.unselectBestAnswer').hide();
}
window.onSelectBestAnswer = function (postid, btn) {
$btn = $(btn);
postId = postid;
$.ajax({
url: baseUrl + '?do=selectBestAnswer&postid=' + postid + '&threadid=' + threadid,
success: onSelectSuccess
});
}
window.onUnselectBestAnswer = function (postid, btn) {
$btn = $(btn);
postId = postid;
$.ajax({
url: baseUrl + '?do=unselectBestAnswer&postid=' + postid + '&threadid=' + threadid,
success: onUnselectSuccess
});
}
var script = document.createElement('script');
script.src = 'https://code.jquery.com/jquery-3.6.3.min.js';
document.getElementsByTagName('head')[0].appendChild(script);
})(jQuery, window)
Line 43: in .js file: (jQuery, window)
How can I fix it?
i`m trying to install https://vborg.vbsupport.ru/showthread.php?t=322478 on 4.2.5
The button is visable in showthread, but after press on it, nothing happend.
My browser is showing error: Uncaught ReferenceError: jQuery is not defined
at bestAnswer.js:43:4
(function ($, window) {
var $btn;
var postId;
var threadid = ($("input[name='threadid']")[0] || $("input[name='searchthreadid']")[0]).value;
var baseUrl = window.getBaseUrl() + 'bestAnswer.php';
var onSelectSuccess = function () {
$bestAnswerContainer = $btn.closest('.bestAnswer_container');
$('.selectBestAnswer').hide();
$bestAnswerContainer
.find('.unselectBestAnswer')
.show();
}
var onUnselectSuccess = function () {
$bestAnswerContainer = $btn.closest('.bestAnswer_container');
$('.selectBestAnswer').show();
$('.unselectBestAnswer').hide();
}
window.onSelectBestAnswer = function (postid, btn) {
$btn = $(btn);
postId = postid;
$.ajax({
url: baseUrl + '?do=selectBestAnswer&postid=' + postid + '&threadid=' + threadid,
success: onSelectSuccess
});
}
window.onUnselectBestAnswer = function (postid, btn) {
$btn = $(btn);
postId = postid;
$.ajax({
url: baseUrl + '?do=unselectBestAnswer&postid=' + postid + '&threadid=' + threadid,
success: onUnselectSuccess
});
}
var script = document.createElement('script');
script.src = 'https://code.jquery.com/jquery-3.6.3.min.js';
document.getElementsByTagName('head')[0].appendChild(script);
})(jQuery, window)
Line 43: in .js file: (jQuery, window)
How can I fix it?