Browse Source

Skip jQuery when it adds nothing (#445)

master
Federico Brigante 8 years ago
committed by Sindre Sorhus
parent
commit
9bc77638e3
  1. 10
      extension/linkify-urls-in-code.js
  2. 4
      extension/mark-unread.js

10
extension/linkify-urls-in-code.js

@ -14,11 +14,10 @@ window.linkifyURLsInCode = (() => {
if ($(`.${linkifiedURLClass}`).length > 0) {
return;
}
const codeBlobs = $('.blob-code-inner');
const commentCodeBlobs = $('.blob-code-inner span.pl-c');
const codeBlobs = document.querySelectorAll('.blob-code-inner');
const commentCodeBlobs = document.querySelectorAll('.blob-code-inner span.pl-c');
$(codeBlobs)
.toArray()
codeBlobs
.forEach(blob => {
for (let match of findURLs(blob.innerHTML)) {
// Remove < or > from beginning or end of an URL
@ -27,8 +26,7 @@ window.linkifyURLsInCode = (() => {
}
});
$(commentCodeBlobs)
.toArray()
commentCodeBlobs
.forEach(blob => {
const blobHTML = blob.innerHTML;
if (hasIssue(blobHTML)) {

4
extension/mark-unread.js

@ -24,8 +24,8 @@ window.markUnread = (() => {
}
function markUnread() {
$(this).attr('disabled', 'disabled');
$(this).text('Marked as unread');
this.setAttribute('disabled', 'disabled');
this.textContent = 'Marked as unread';
const participants = $('.participant-avatar').toArray().map(el => {
const $el = $(el);

Loading…
Cancel
Save