documentation/extensions/odoo_theme/static/js/layout.js
Elisabeth Dickinson 343decf192 [IMP] design: add an icon behind external links
The external links' target attribute is now also updated to open the
link in a new tab. In addition, the "[source]" link of autodoc's models
is moved right next to the name of the model to correctly position the
icon.

task-2790244

closes odoo/documentation#2167

Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
Co-authored-by: Antoine Vandevenne (anv) <anv@odoo.com>
2022-06-14 11:42:13 +02:00

18 lines
569 B
JavaScript

(function ($) {
document.addEventListener('DOMContentLoaded', function () {
const content = document.getElementById('o_content');
// Enforce the presence of the `img-fluid` class on all images in the body.
content.querySelectorAll('img').forEach(image => {
image.classList.add('img-fluid');
});
// Make all external links open in a new tab by default.
content.querySelectorAll('a.external').forEach(externalLink => {
externalLink.setAttribute('target', '_blank');
})
});
})();