Skip to content

Commit

Permalink
fixed eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
easylogic committed Nov 11, 2017
1 parent 5ed8eb8 commit ccd656d
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 32 deletions.
14 changes: 7 additions & 7 deletions src/js/lite/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@ const buttonGroup = renderer.create('<div class="note-btn-group">');
const button = renderer.create('<button type="button" class="note-btn">', function($node, options) {
// set button type
if (options && options.tooltip) {
new TooltipUI($node, {
$node.data('_lite_tooltip', new TooltipUI($node, {
title: options.tooltip,
container: options.container
});
}));
}
if (options.contents) {
$node.html(options.contents);
}

if (options && options.data && options.data.toggle === 'dropdown') {
new DropdownUI($node, {
$node.data('_lite_dropdown', new DropdownUI($node, {
container: options.container
});
}));
}
});

Expand Down Expand Up @@ -260,9 +260,9 @@ const palette = renderer.create('<div class="note-color-palette"/>', function($n
$node.html(contents.join(''));

$node.find('.note-color-btn').each(function() {
new TooltipUI($(this), {
$(this).data('_lite_tooltip', new TooltipUI($(this), {
container: options.container
});
}));
});
});

Expand Down Expand Up @@ -380,7 +380,7 @@ const dialog = renderer.create('<div class="note-modal" tabindex="-1"/>', functi
' </div>'
].join(''));

$node.data('modal', new ModalUI($node, options));
$node.data('modal', new ModalUI($node, options));
});

const videoDialog = function(opt) {
Expand Down
15 changes: 6 additions & 9 deletions src/js/lite/ui/DropdownUI.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
class DropdownUI {

constructor ($node, options) {
constructor($node, options) {
this.$button = $node;
this.options = $.extend({}, {
target: options.container
target: options.container
}, options);

this.setEvent();
}

setEvent () {
setEvent() {
const self = this;
this.$button.on('click', function() {
self.toggle();
Expand Down Expand Up @@ -39,10 +38,10 @@ class DropdownUI {
}
}

hide () {
hide() {
this.$button.removeClass('active');
this.$button.parent().removeClass('open');
};
}

toggle() {
var isOpened = this.$button.parent().hasClass('open');
Expand All @@ -57,7 +56,6 @@ class DropdownUI {
}
}


$(document).on('click', function(e) {
if (!$(e.target).closest('.note-btn-group').length) {
$('.note-btn-group.open').removeClass('open');
Expand All @@ -68,5 +66,4 @@ $(document).on('click.note-dropdown-menu', function(e) {
$(e.target).closest('.note-dropdown-menu').parent().removeClass('open');
});


export default DropdownUI;
export default DropdownUI;
6 changes: 3 additions & 3 deletions src/js/lite/ui/ModalUI.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ class ModalUI {
this.$backdrop = $('<div class="note-modal-backdrop" />');
}

show () {
const self = this;
show() {
const self = this;
if (this.options.target === 'body') {
this.$backdrop.css('position', 'fixed');
this.$modal.css('position', 'fixed');
Expand All @@ -27,7 +27,7 @@ class ModalUI {
});
}

hide () {
hide() {
this.$modal.removeClass('open').hide();
this.$backdrop.hide();
this.$modal.trigger('note.modal.hide');
Expand Down
11 changes: 5 additions & 6 deletions src/js/lite/ui/PopoverUI.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class PopoverUI {
constructor($node, options) {
const self = this;
this.$node = $node;
const self = this;
this.$node = $node;
this.options = $.extend({}, {
title: '',
content: '',
Expand All @@ -18,7 +18,6 @@ class PopoverUI {
'</div>'
].join(''));


// define event
if (this.options.trigger !== 'manual') {
this.options.trigger.split(' ').forEach(function(eventName) {
Expand Down Expand Up @@ -46,7 +45,7 @@ class PopoverUI {
}
}

show () {
show() {
const $node = this.$node;
const offset = $node.offset();
const $popover = this.$popover;
Expand Down Expand Up @@ -92,7 +91,7 @@ class PopoverUI {
this.$popover.remove();
}

toggle () {
toggle() {
if (this.$popover.hasClass('in')) {
this.hide();
} else {
Expand All @@ -101,4 +100,4 @@ class PopoverUI {
}
}

export default PopoverUI;
export default PopoverUI;
14 changes: 7 additions & 7 deletions src/js/lite/ui/TooltipUI.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class TooltipUI {
constructor ($node, options) {
const self = this;
this.$node = $node;
constructor($node, options) {
const self = this;
this.$node = $node;
this.options = $.extend({}, {
title: '',
target: options.container,
Expand Down Expand Up @@ -43,8 +43,8 @@ class TooltipUI {
}
}

show () {
const $node = this.$node;
show() {
const $node = this.$node;
const offset = $node.offset();

const $tooltip = this.$tooltip;
Expand Down Expand Up @@ -84,12 +84,12 @@ class TooltipUI {
}
}

hide () {
hide() {
this.$tooltip.removeClass('in');
this.$tooltip.remove();
}

toggle () {
toggle() {
if (this.$tooltip.hasClass('in')) {
this.hide();
} else {
Expand Down

0 comments on commit ccd656d

Please sign in to comment.