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