summaryrefslogtreecommitdiff
path: root/addons/website/static/src/js/website.snippets.animation.js
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2016-02-24 13:13:12 +0100
committerqsm-odoo <qsm@odoo.com>2016-02-24 13:47:36 +0100
commit6610d05549e347fbb548e606fa66cfb113df9e67 (patch)
treefc750ca544b5caa135791c0eaeb10dfee17eefa3 /addons/website/static/src/js/website.snippets.animation.js
parent58c5ff1d4f64f16d43106e6b00f0b94fe63506c2 (diff)
[REF] web_editor,website,mass_mailing: JS/XML update
* Adapt DOM selectors * Refactore dialog XMLs to have odoo styling * New editor options (background-position, ...) * Various improvements
Diffstat (limited to 'addons/website/static/src/js/website.snippets.animation.js')
-rw-r--r--addons/website/static/src/js/website.snippets.animation.js63
1 files changed, 8 insertions, 55 deletions
diff --git a/addons/website/static/src/js/website.snippets.animation.js b/addons/website/static/src/js/website.snippets.animation.js
index 15311cb8dc8..87b7e6dce46 100644
--- a/addons/website/static/src/js/website.snippets.animation.js
+++ b/addons/website/static/src/js/website.snippets.animation.js
@@ -8,8 +8,6 @@ var animation = require('web_editor.snippets.animation');
var qweb = core.qweb;
-/*-------------------------------------------------------------------------*/
-
function load_called_template () {
var ids_or_xml_ids = _.uniq($("[data-oe-call]").map(function () {return $(this).data('oe-call');}).get());
if (ids_or_xml_ids.length) {
@@ -26,50 +24,6 @@ function load_called_template () {
}
}
-
-// Ripple animation
-animation.registry.ripple = animation.Class.extend({
- selector: ".wb_dropdown-toggle, #oe_systray .dropdown-toggle",
-
- start: function(){
-
- var timeout,
- btn = this.$target;
-
- btn
- .css({ position: 'relative', overflow: 'hidden'})
- .bind('mousedown', function(e) {
- var ripple;
- if (btn.find('.ripple').length === 0) {
- ripple = $('<span class="ripple"/>');
- btn.prepend(ripple);
- } else {
- ripple = btn.find('.ripple');
- }
- ripple.removeClass('animate');
-
- if (!ripple.height() && !ripple.width()) {
- var diameter = Math.max(btn.outerWidth(), btn.outerHeight());
- ripple.css({ height: diameter, width: diameter });
- }
-
- var x = e.pageX - btn.offset().left - ripple.width() / 2;
- var y = e.pageY - btn.offset().top - ripple.height() / 2;
-
- ripple
- .css({ top: y + 'px',left: x + 'px'})
- .addClass('animate');
-
- setTimeout(function() {
- //ripple.removeClass('animate');
- }, 700);
- });
- },
-}),
-
-
-/*-------------------------------------------------------------------------*/
-
base.ready().then(function () {
load_called_template();
if ($(".o_gallery:not(.oe_slideshow)").size()) {
@@ -78,8 +32,6 @@ base.ready().then(function () {
}
});
-/*-------------------------------------------------------------------------*/
-
animation.registry.slider = animation.Class.extend({
selector: ".carousel",
start: function () {
@@ -199,11 +151,11 @@ inside a gallery
-------------------------------------------------------------------------*/
animation.registry.gallery = animation.Class.extend({
selector: ".o_gallery:not(.o_slideshow)",
- start: function() {
+ start: function () {
var self = this;
this.$el.on("click", "img", this.click_handler);
},
- click_handler : function(event) {
+ click_handler : function (event) {
var self = this;
var $cur = $(event.currentTarget);
var edition_mode = ($cur.closest("[contenteditable='true']").size() !== 0);
@@ -225,7 +177,7 @@ animation.registry.gallery = animation.Class.extend({
height : Math.round( window.innerHeight * size)
};
- $images.each(function() {
+ $images.each(function () {
urls.push($(this).attr("src"));
});
var $img = ($cur.is("img") === true) ? $cur : $cur.closest("img");
@@ -244,7 +196,7 @@ animation.registry.gallery = animation.Class.extend({
keyboard : true,
backdrop : true
});
- $modal.on('hidden.bs.modal', function() {
+ $modal.on('hidden.bs.modal', function () {
$(this).hide();
$(this).siblings().filter(".modal-backdrop").remove(); // bootstrap leaves a modal-backdrop
$(this).remove();
@@ -257,9 +209,10 @@ animation.registry.gallery = animation.Class.extend({
}
} // click_handler
});
+
animation.registry.gallery_slider = animation.Class.extend({
selector: ".o_slideshow",
- start: function() {
+ start: function () {
var $carousel = this.$target.is(".carousel") ? this.$target : this.$target.find(".carousel");
var self = this;
var $indicator = $carousel.find('.carousel-indicators');
@@ -271,7 +224,7 @@ animation.registry.gallery_slider = animation.Class.extend({
var nb = Math.ceil($lis.length / 10);
// fix bootstrap use index insead of data-slide-to
- $carousel.on('slide.bs.carousel', function() {
+ $carousel.on('slide.bs.carousel', function () {
setTimeout(function () {
var $item = $carousel.find('.carousel-inner .prev, .carousel-inner .next');
var index = $item.index();
@@ -298,7 +251,7 @@ animation.registry.gallery_slider = animation.Class.extend({
});
hide();
- $carousel.on('slid.bs.carousel', function() {
+ $carousel.on('slid.bs.carousel', function () {
var index = ($lis.filter('.active').index() || 1) -1;
page = Math.floor(index / 10);
hide();