diff --git a/addons/website/static/src/js/website.snippets.animation.js b/addons/website/static/src/js/website.snippets.animation.js
index c3382d565bd..ad3ad611199 100644
--- a/addons/website/static/src/js/website.snippets.animation.js
+++ b/addons/website/static/src/js/website.snippets.animation.js
@@ -133,14 +133,35 @@ animation.registry.media_video = animation.Class.extend({
start: function () {
// TODO: this code should be refactored to make more sense and be better
// integrated with Odoo (this refactoring should be done in master).
- this.$target.find('iframe').remove();
- if (!this.$target.has('.media_iframe_video_size').length) {
- var editor = '
';
- var size = '
';
- this.$target.html(editor+size);
+ var def = this._super.apply(this, arguments);
+ if (this.$target.children('iframe').length) {
+ // There already is an , do nothing
+ return def;
}
- this.$target.html(this.$target.html()+'');
+
+ // Bug fix / compatibility: empty the element as all information
+ // to rebuild the iframe should have been saved on the element
+ this.$target.empty();
+
+ // Add extra content for size / edition
+ this.$target.append(
+ '
' +
+ '
'
+ );
+
+ // Rebuild the iframe. Depending on version / compatibility / instance,
+ // the src is saved in the 'data-src' attribute or the
+ // 'data-oe-expression' one (the latter is used as a workaround in 10.0
+ // system but should obviously be reviewed in master).
+ this.$target.append($('', {
+ src: _.escape(this.$target.data('oe-expression') || this.$target.data('src')),
+ frameborder: '0',
+ allowfullscreen: 'allowfullscreen',
+ sandbox: 'allow-scripts allow-same-origin', // https://www.html5rocks.com/en/tutorials/security/sandboxed-iframes/
+ }));
+
+ return def;
},
});