* * {@link CKEDITOR#SHRINK_TEXT} - Shrink the range boudaries to anchor by the side of enclosed text
* node, range remains if there's no text nodes on boundaries at all.
*
- * @param {Boolean} selectContents Whether result range anchors at the inner OR outer boundary of the node.
+ * @param {Boolean} [selectContents] Whether result range anchors at the inner OR outer boundary of the node.
*/
shrink: function( mode, selectContents, shrinkOnBlockBoundary ) {
// Unable to shrink a collapsed range.
*
* @method
* @member CKEDITOR.editor
- * @param {Boolean} forceRealSelection Return real selection, instead of saved or fake one.
+ * @param {Boolean} [forceRealSelection] Return real selection, instead of saved or fake one.
* @returns {CKEDITOR.dom.selection} A selection object or null if not available for the moment.
*/
CKEDITOR.editor.prototype.getSelection = function( forceRealSelection ) {
//noinspection JSValidateTypes
editor.addCommand('link', {
- exec: function (editor, data) {
+ exec: function (editor) {
link_dialog(editor);
return true;
},
});
//noinspection JSValidateTypes
editor.addCommand('image', {
- exec: function (editor, data) {
+ exec: function (editor) {
image_dialog(editor);
return true;
},
var view_id = $(event.currentTarget).data('view-id');
openerp.jsonRpc('/website/customize_template_toggle', 'call', {
'view_id': view_id
- }).then( function(result) {
+ }).then( function() {
window.location.reload();
});
});
);
},
edit: function () {
- var self = this;
this.$buttons.edit.prop('disabled', true);
this.$('#website-top-view').hide();
this.$('#website-top-edit').show();
return true;
},
- start_edition: function ($elements) {
+ start_edition: function () {
var self = this;
// create a single editor for the whole page
var root = document.getElementById('wrapwrap');
.filter(function () {
var $this = $(this);
// keep view sections and fields which are *not* in
- // view sections for toplevel editables
+ // view sections for top-level editables
return $this.data('oe-model') === 'ir.ui.view'
|| !$this.closest('[data-oe-model = "ir.ui.view"]').length;
});
this.preview_image();
},
- file_selection: function (e) {
+ file_selection: function () {
this.$('button.filepicker').removeClass('btn-danger btn-success');
var self = this;
templates.push(template);
};
website.load_templates = function(templates) {
- var def = $.Deferred();
- var count = templates.length;
-
var dones = _(templates).map(function (t) {
return new $.Deferred(function (d) {
openerp.qweb.add_template(t, function(err) {
});
});
- $(document).on('click', '.js_publish_management .js_publish_btn', function (e) {
+ $(document).on('click', '.js_publish_management .js_publish_btn', function () {
var $data = $(this).parents(".js_publish_management:first");
var $btn = $data.find('.btn:first');
var publish = $btn.hasClass("btn-success");
}
self.make_active($target);
});
- $("[data-oe-model]").on('click', function (ev) {
+ $("[data-oe-model]").on('click', function () {
if (!snipped_event_flag && self.$active_snipped_id && !self.$active_snipped_id.parents("[data-snippet-id]:first")) {
self.make_active(false);
}
},
clean_for_save: function () {
for (var k in this.snippets) {
+ if (!this.snippets.hasOwnProperty(k)) { continue; }
var editor = $(this.snippets[k]).data("snippet-editor");
if (editor) {
editor.clean_for_save();
},
stop: function(ev, ui){
if (action === 'insert' && ! dropped) {
- var el = $('.oe_drop_zone').nearest({x: ui.position.left, y: ui.position.top}).first()
- if (el) {
- el.after($toInsert)
+ var $el = $('.oe_drop_zone').nearest({x: ui.position.left, y: ui.position.top}).first();
+ if ($el) {
+ $el.after($toInsert);
dropped = true;
}
}
// count += $zones.length;
// $zones.remove();
- $zones = $('.oe_drop_zone > .oe_drop_zone:not(.oe_vertical)').remove(); // no recusrive zones
+ $zones = $('.oe_drop_zone > .oe_drop_zone:not(.oe_vertical)').remove(); // no recursive zones
count += $zones.length;
$zones.remove();
} while (count > 0);
var zone = $(this);
var prev = zone.prev();
var next = zone.next();
- var float_prev = zone.prev().css('float') || 'none';
- var float_next = zone.next().css('float') || 'none';
- var disp_prev = zone.prev().css('display') || null;
- var disp_next = zone.next().css('display') || null;
+ var float_prev = prev.css('float') || 'none';
+ var float_next = next.css('float') || 'none';
+ var disp_prev = prev.css('display') || null;
+ var disp_next = next.css('display') || null;
if( (float_prev === 'left' || float_prev === 'right')
&& (float_next === 'left' || float_next === 'right') ){
zone.remove();
- return;
}else if( !( disp_prev === null
|| disp_next === null
|| disp_prev === 'block'
var self = this;
var $styles = this.$overlay.find('.oe_options');
var $ul = $styles.find('ul:first');
- _.each(this.parent.style_templates, function (val, key) {
+ _.each(this.parent.style_templates, function (val) {
if (!self.parent.dom_filter(val.selector).is(self.$target)) {
return;
}
/*
* build_snippet
- * This method is called just after that a thumbnail is drag and droped into a drop zone
+ * This method is called just after that a thumbnail is drag and dropped into a drop zone
* (after the insertion of this.$body, if this.$body exists)
*/
build_snippet: function ($target) {
},
/* onFocus
- * This method is called when the user click outide the snippet in the dom, after a focus
+ * This method is called when the user click outside the snippet in the dom, after a focus
*/
onBlur : function () {
this.$overlay.removeClass('oe_active');
var $ul = this.$editor.find(ul_options);
var bg_value = (typeof bg === 'string' ? this.$target.find(bg) : $(bg)).css("background-image").replace(/url\(['"]*|['"]*\)/g, "");
- // bind envent on options
+ // bind event on options
var $li = $ul.find("li");
$li.on('click', function (event) {
if ($(this).data("value")) {
var regClass = new RegExp("\\s*" + resize[0][begin].replace(/[-]*[0-9]+/, '[-]*[0-9]+'), 'g');
var cursor = $handle.css("cursor")+'-important';
- $("body").addClass(cursor);
+ var $body = $(document.body);
+ $body.addClass(cursor);
var body_mousemove = function (event){
event.preventDefault();
self.parent.cover_target(self.$overlay, self.$target);
}
};
- $('body').mousemove(body_mousemove);
var body_mouseup = function(){
- $('body').unbind('mousemove', body_mousemove);
- $('body').unbind('mouseup', body_mouseup);
- $("body").removeClass(cursor);
+ $body.unbind('mousemove', body_mousemove);
+ $body.unbind('mouseup', body_mouseup);
+ $body.removeClass(cursor);
self.parent.editor_busy = false;
};
- $('body').mouseup(body_mouseup);
+ $body.mousemove(body_mousemove);
+ $body.mouseup(body_mouseup);
});
},
getSize: function () {
if (compass !== 'w')
return;
- // don't change the rigth border position when we change the offset (replace col size)
+ // don't change the right border position when we change the offset (replace col size)
var beginCol = Number(beginClass.match(/col-md-([0-9]+)|$/)[1] || 0);
var beginOffset = Number(beginClass.match(/col-md-offset-([0-9-]+)|$/)[1] || beginClass.match(/col-lg-offset-([0-9-]+)|$/)[1] || 0);
var offset = Number(this.grid.w[0][current].match(/col-md-offset-([0-9-]+)|$/)[1] || 0);
var style = false;
var $el = this.$inner.find('.item.active');
var $ul = this.$editor.find('ul[name="carousel-style"]');
- var $li = $ul.find("li");
if ($el.hasClass('text_only'))
style = 'text_only';
});
},
change_size: function () {
- var self = this;
var $el = this.$target;
var size = 'oe_big';
this.change_size();
},
scroll: function(){
- var self = this;
var $ul = this.$editor.find('ul[name="parallax-scroll"]');
var $li = $ul.find("li");
var $parallax = this.$target.find('.parallax');
$li.on('click', function (event) {
$li.removeClass("active");
$(this).addClass("active");
- var speed = $(this).data('value')
+ var speed = $(this).data('value');
$parallax.attr('data-stellar-background-ratio', speed);
});
name: "Insert a banner",
init: function (editor) {
var self = this;
+ var $body = $(document.body);
self.steps = [
{
stepId: 'welcome',
onShow: function () {
function beginDrag () {
$('.popover.tour').remove();
- $('body').off('mousedown', beginDrag);
function goToNextStep () {
$('#oe_snippets').hide();
self.movetoStep('edit-title');
- $('body').off('mouseup', goToNextStep);
+ $body.off('mouseup', goToNextStep);
}
- $('body').on('mouseup', goToNextStep);
+ $body.off('mousedown', beginDrag);
+ $body.on('mouseup', goToNextStep);
}
- $('body').on('mousedown', beginDrag);
+
+ $body.on('mousedown', beginDrag);
},
},
{
title: "Help is always available",
content: "But you can always click here if you want more tutorials.",
template: render('website.tour_popover', { end: "Close" }),
- },
+ }
];
return this._super();
},
},
});
-}());
\ No newline at end of file
+}());
dialog.on('activate', this, function () {
localStorage[nodialog] = dialog.$('input[name=do_not_show]').prop('checked') || '';
dialog.$el.modal('hide');
- this.translate().then(function () {
+ self.translate().then(function () {
mysuper.call(self);
});
});
if (node.attributes['data-oe-translate'].value == '1') {
node.className += ' oe_translatable_field';
}
- return;
} else if (node.childNodes.length === 1
&& this.isTextNode(node.childNodes[0])
&& !node.getAttribute('data-oe-model')) {
$(document).ready(function () {
- $form = $('.js_nav_year a:first').on('click', function (e) {
+ $('.js_nav_year a:first').on('click', function (e) {
e.preventDefault();
$(this).next("ul").toggle();
});
- $form = $('.js_nav_month a:first').on('click', function (e) {
+ $('.js_nav_month a:first').on('click', function (e) {
e.preventDefault();
var $ul = $(this).next("ul");
if (!$ul.find('li').length) {
$.post('/blog/nav', {'domain': $(this).data("domain")}, function (result) {
- var result = JSON.parse(result);
var blog_id = +window.location.pathname.split("/").pop();
- $(result).each(function () {
+ $(JSON.parse(result)).each(function () {
var $a = $('<a href="/blog/' + this.category_id + '/' + this.id + '"/>').text(this.name);
var $li = $("<li/>").append($a);
if (blog_id == this.id)
}
});
- $form = $('.js_website_blog form#comment');
+ var $form = $('.js_website_blog form#comment');
$form.submit(function (e) {
e.preventDefault();
var error = $form.find("textarea").val().length < 3;
});
}
});
-});
\ No newline at end of file
+});
$(".oe_website_sale .js_shipping").toggle();
});
- $payment = $(".oe_website_sale .js_payment");
- $("input[name='payment_type']", $payment).click(function (ev) {
+ var $payment = $(".oe_website_sale .js_payment");
+ $payment.find("input[name='payment_type']").click(function (ev) {
var payment_id = $(ev.currentTarget).val();
$("div[data-id]", $payment).addClass("hidden");
$("a.btn:last, div[data-id='"+payment_id+"']", $payment).removeClass("hidden");