From 8f154afcd2e6f16b0bc8332bb3d22ee8bc689d96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20Can=20Alt=C4=B1n?= Date: Sun, 4 Dec 2022 02:55:45 +0300 Subject: [PATCH 1/3] code refactoring added code comments line --- src/typeahead/default_menu.js | 38 +++++++++-------------------------- 1 file changed, 10 insertions(+), 28 deletions(-) diff --git a/src/typeahead/default_menu.js b/src/typeahead/default_menu.js index 799dfffb..d0ea5699 100644 --- a/src/typeahead/default_menu.js +++ b/src/typeahead/default_menu.js @@ -1,69 +1,51 @@ -/* - * typeahead.js - * https://github.com/twitter/typeahead.js - * Copyright 2013-2014 Twitter, Inc. and other contributors; Licensed MIT - */ - var DefaultMenu = (function() { 'use strict'; var s = Menu.prototype; + // constructor function DefaultMenu() { Menu.apply(this, [].slice.call(arguments, 0)); } + // instance methods _.mixin(DefaultMenu.prototype, Menu.prototype, { // overrides - // --------- - open: function open() { - // only display the menu when there's something to be shown - !this._allDatasetsEmpty() && this._show(); + if (!this._allDatasetsEmpty()) { + this._show(); + } return s.open.apply(this, [].slice.call(arguments, 0)); }, - close: function close() { this._hide(); return s.close.apply(this, [].slice.call(arguments, 0)); }, - _onRendered: function onRendered() { if (this._allDatasetsEmpty()) { this._hide(); + } else if (this.isOpen()) { + this._show(); } - - else { - this.isOpen() && this._show(); - } - return s._onRendered.apply(this, [].slice.call(arguments, 0)); }, - _onCleared: function onCleared() { if (this._allDatasetsEmpty()) { this._hide(); + } else if (this.isOpen()) { + this._show(); } - - else { - this.isOpen() && this._show(); - } - return s._onCleared.apply(this, [].slice.call(arguments, 0)); }, - setLanguageDirection: function setLanguageDirection(dir) { this.$node.css(dir === 'ltr' ? this.css.ltr : this.css.rtl); return s.setLanguageDirection.apply(this, [].slice.call(arguments, 0)); }, - // private - // --------- - + // private methods _hide: function hide() { this.$node.hide(); }, - _show: function show() { // can't use jQuery#show because $node is a span element we want // display: block; not dislay: inline; From 72e6bd08cba60127cdbbdb44314ab21e5a6bf5f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20Can=20Alt=C4=B1n?= Date: Sun, 4 Dec 2022 02:58:42 +0300 Subject: [PATCH 2/3] added comment title --- src/typeahead/default_menu.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/typeahead/default_menu.js b/src/typeahead/default_menu.js index d0ea5699..05a33f8b 100644 --- a/src/typeahead/default_menu.js +++ b/src/typeahead/default_menu.js @@ -1,3 +1,9 @@ +/* +* typeahead.js +* https://github.com/twitter/typeahead.js +* Telif hakkı 2013-2014 Twitter, Inc. ve diğer katkıda bulunanlar; Lisanslı MİT +*/ + var DefaultMenu = (function() { 'use strict'; From e9453be20140e3cb2df5b0faef21e733764ea667 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20Can=20Alt=C4=B1n?= Date: Sun, 4 Dec 2022 02:59:37 +0300 Subject: [PATCH 3/3] translate revert --- src/typeahead/default_menu.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/typeahead/default_menu.js b/src/typeahead/default_menu.js index 05a33f8b..4f5e2744 100644 --- a/src/typeahead/default_menu.js +++ b/src/typeahead/default_menu.js @@ -1,8 +1,8 @@ /* -* typeahead.js -* https://github.com/twitter/typeahead.js -* Telif hakkı 2013-2014 Twitter, Inc. ve diğer katkıda bulunanlar; Lisanslı MİT -*/ + * typeahead.js + * https://github.com/twitter/typeahead.js + * Copyright 2013-2014 Twitter, Inc. and other contributors; Licensed MIT + */ var DefaultMenu = (function() { 'use strict';