Skip to content

Commit

Permalink
Fix select filter for skinnable tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
mervick committed Sep 7, 2016
1 parent fb7b1bc commit b73b061
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 10 deletions.
27 changes: 19 additions & 8 deletions dist/emojionearea.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* https://github.com/mervick/emojionearea
* Copyright Andrey Izman and other contributors
* Released under the MIT license
* Date: 2016-09-07T14:24Z
* Date: 2016-09-07T18:57Z
*/
(function(document, window, $) {
'use strict';
Expand Down Expand Up @@ -501,8 +501,13 @@
var emojis = getRecent();
if (!self.recent || self.recent !== emojis) {
if (emojis.length) {
var scrollTop = self.scrollArea.scrollTop(),
height = self.recentCategory.is(":visible") ? self.recentCategory.height() : 0
var skinnable = self.scrollArea.is(".skinnable"),
scrollTop, height;

if (!skinnable) {
scrollTop = self.scrollArea.scrollTop();
height = self.recentCategory.is(":visible") ? self.recentCategory.height() : 0;
}

var items = shortnameTo(emojis, self.emojiBtnTemplate, true).split('|').join('');
self.recentCategory.children(".emojibtn").remove();
Expand All @@ -512,15 +517,17 @@
self.recentCategory.children(".emojibtn").on("click", function() {
self.trigger("emojibtn.click", $(this));
});
// attach(self, , { click: "emojibtn.click" });

self.recentCategory.show();
self.recentFilter.show();

var height2 = self.recentCategory.height();
if (!skinnable) {
self.recentCategory.show();

var height2 = self.recentCategory.height();

if (height !== height2) {
self.scrollArea.scrollTop(scrollTop + height2 - height);
if (height !== height2) {
self.scrollArea.scrollTop(scrollTop + height2 - height);
}
}
} else {
if (self.recentFilter.hasClass("active")) {
Expand Down Expand Up @@ -770,9 +777,13 @@
if (skin) {
scrollArea.addClass("skinnable");
categories.hide().filter("[data-tone=" + skin + "]").show();
if (filtersBtns.eq(0).is('.active[data-filter="recent"]')) {
filtersBtns.eq(0).removeClass("active").next().addClass("active");
}
} else {
scrollArea.removeClass("skinnable");
categories.hide().filter("[data-tone=0]").show();
filtersBtns.eq(0).click();
}
lazyLoading.call(self);
})
Expand Down
Loading

0 comments on commit b73b061

Please sign in to comment.