Browse Source

[FIX][11.0] website_img_dimension travis warnings

pull/481/head
tbaden 4 months ago
parent
commit
2b45786624
1 changed files with 14 additions and 12 deletions
  1. 14
    12
      website_img_dimension/static/src/js/website_img_dimension.tooltip.js

+ 14
- 12
website_img_dimension/static/src/js/website_img_dimension.tooltip.js View File

@@ -1,40 +1,42 @@
odoo.define('website_img_dimension.tooltip', function(require) {
odoo.define('website_img_dimension.tooltip', function (require) {
"use strict";
var Class = require('web.Class');
var web_editor_base = require('web_editor.base');

var TooltipManager = Class.extend({
init: function() {
init: function () {
var self = this;
web_editor_base.ready().done(function() {
$('#wrap').on('mouseenter', 'img', function() {
web_editor_base.ready().done(function () {
$('#wrap').on('mouseenter', 'img', function () {
self.show_tooltip($(this));
});

$('#wrap').on('mouseleave', 'img', function() {
$('#wrap').on('mouseleave', 'img', function () {
self.hide_tooltip($(this));
});
});
},
get_title: function($img) {
return $img.width() + ' x ' + $img.height() + ' (' + $img[0].naturalWidth + ' x ' + $img[0].naturalHeight + ')';
get_title: function ($img) {
return $img.width() +
' x ' + $img.height() + ' (' + $img[0].naturalWidth +
' x ' + $img[0].naturalHeight + ')';
},
show_tooltip: function($img) {
show_tooltip: function ($img) {
$img.tooltip({
title: this.get_title($img),
trigger: 'manual',
container: 'body'
container: 'body',
}).tooltip('show');
},
hide_tooltip: function($img) {
hide_tooltip: function ($img) {
$img.tooltip('destroy');
}
},
});

var tooltip_manager = new TooltipManager();

return {
tooltip_manager: tooltip_manager,
TooltipManager: TooltipManager
TooltipManager: TooltipManager,
};
});

Loading…
Cancel
Save