Fix selector and check for > 1.20

This commit is contained in:
Sebastian Sauer 2023-07-25 21:50:57 +02:00
parent 06b64ad41f
commit 25047846fa

@ -144,17 +144,14 @@ const saveChanges = (element) => {
// Only add the interval if we're on the files diff page
// (as on all other pages there is no need for conventional comments)
const selector = '.page-content.repository.view.issue.pull.files.diff';
if (document.querySelector(selector) && editorTemplate) {
const templ = document.querySelector('#issue-comment-editor-template');
if (templ) {
setInterval(function() {
document
.querySelectorAll(`.field.comment-code-cloud:not([data-semantic-button-initialized])`)
.forEach(function(note) {
note.dataset.semanticButtonInitialized = 'true';
note.querySelector('.markup-info').remove();
addSemanticButton(note);
});
}, 1000);
}
if (document.querySelector(selector) && document.querySelector('#issue-comment-editor-template')) {
setInterval(function() {
document
.querySelectorAll(`.field.comment-code-cloud:not([data-semantic-button-initialized])`)
.forEach(function(note) {
note.dataset.semanticButtonInitialized = 'true';
note.querySelector('.markup-info').remove();
addSemanticButton(note);
});
}, 1000);
}