// Show image smaller than 2 MB
if (type.match(/^image\/(?!vnd).+$/) && size < max_size) {
$att.insertAdjacentHTML('beforeend', `
- <a href="${link}" class="outer lightbox"><img src="${link}" alt="${name}" itemprop="image"></a>`);
+ <a href="${link}" class="outer lightbox"><img src="${link}" alt="${name.htmlEncode()}" itemprop="image"></a>`);
// Add lightbox support
$att.querySelector('.outer.lightbox').addEventListener('click', event => {
const lang = is_patch ? 'diff' : type.match(/\w+$/)[0];
$att.insertAdjacentHTML('beforeend', `
- <button type="button" role="link" title="${name}" class="outer">
+ <button type="button" role="link" title="${name.htmlEncode()}" class="outer">
<pre class="language-${lang}" role="img" itemprop="text">${text.htmlEncode()}</pre></button>`);
// Make the button work as a link. It cannot be `<a>` because Prism Autolinker plugin may add links to `<pre>`
(att.is_patch || this.extra_patch_types.includes(att.content_type)));
if (others.length) {
- $fieldset.querySelector('tbody').insertAdjacentHTML('beforeend',
- '<tr class="other-patches"><th>Do you want to request approval of these patches as well?</th><td>' +
- `${others.map(patch =>
- `<div><label><input type="checkbox" checked data-id="${patch.id}"> ${patch.summary}</label></div>`
- ).join('')}` +
- '</td></tr>');
+ $fieldset.querySelector('tbody').insertAdjacentHTML('beforeend', `
+ <tr class="other-patches"><th>Do you want to request approval of these patches as well?</th><td>
+ ${others.map(patch => `
+ <div>
+ <label><input type="checkbox" checked data-id="${patch.id}"> ${patch.summary.htmlEncode()}</label>
+ </div>
+ `).join('')}
+ </td></tr>
+ `);
}
});
}