Update jQuery plugins

This commit is contained in:
Sebastian Serth
2021-11-06 02:00:16 +01:00
parent 75d0d28e8b
commit d26947f724
2 changed files with 4 additions and 9 deletions

View File

@ -20,17 +20,10 @@ $.fn.isPresent = function() {
$.fn.scrollTo = function(selector) {
$(this).animate({
scrollTop: $(selector).offset().top - $(this).offset().top + $(this).scrollTop()
scrollTop: $(document.querySelector(selector)).offset().top - $(this).offset().top + $(this).scrollTop()
}, ANIMATION_DURATION);
};
// Same as $.replaceWith, just returns the new element instead of the deleted one
$.fn.replaceWithAndReturnNewElement = function(a) {
const $a = $(a);
this.replaceWith($a);
return $a;
};
// Disable the use of web workers for JStree due to JS error
// See https://github.com/vakata/jstree/issues/1717 for details
$.jstree.defaults.core.worker = false;

View File

@ -42,7 +42,9 @@ $(document).on('turbolinks:load', function() {
if ($row.length === 0) {
$row = $($('#posted_rfcs')[0].insertRow(0));
}
$row = $row.replaceWithAndReturnNewElement(data.html);
const $html = $(data.html);
$row.replaceWith($html);
$row = $html;
$row.find('time').timeago();
addClickEventToRfCEntry($row);
}