From 0d9e84cdc77f8348753ddad6d950935bd528f646 Mon Sep 17 00:00:00 2001 From: Bohung Date: Thu, 20 May 2021 13:40:14 +0800 Subject: [PATCH] Fix bug. --- app/assets/javascripts/bulletin/wpex.min.js | 13 ++++++++++--- app/controllers/announcements_controller.rb | 1 + 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/bulletin/wpex.min.js b/app/assets/javascripts/bulletin/wpex.min.js index b78ed34..3240925 100644 --- a/app/assets/javascripts/bulletin/wpex.min.js +++ b/app/assets/javascripts/bulletin/wpex.min.js @@ -2452,10 +2452,16 @@ var wpex = {}; } return filter_constraint; } + var container_text_arr = window.wpexAnimsition.container_block.split(","); + if(window.already_changes == undefined) + window.already_changes = container_text_arr.map(function(){return false}); $(containers).each(function (i,v) { var $container = $(v); - if($(v).find(window.wpexAnimsition.linkElement).length != 1){ - if(!window.already_change){ + if(container_text_arr[i] == undefined){ + return; + } + if($(container_text_arr[i]).parents(window.wpexAnimsition.need_fix_containers).length != 0){ + if(!window.already_changes[i]){ var $filter = $container.parent().find(window.wpexAnimsition.filter_bar); var $filterLinks = $filter.find(window.wpexAnimsition.filter_option); var $divs = []; @@ -2545,6 +2551,8 @@ var wpex = {}; }) } } + window.already_changes[i] = true; + console.log("changed") return; } $container.imagesLoaded(function () { @@ -2577,7 +2585,6 @@ var wpex = {}; }); }) }) - window.already_change = true; }, customHovers: function () { }, responsiveCSS: function () { var headCSS = ''; var mediaObj = {}; var bkPoints = {}; $('.wpex-vc-rcss').remove(); bkPoints.d = ''; bkPoints = $.extend(bkPoints, wpexLocalize.responsiveDataBreakpoints); $.each(bkPoints, function (key) { mediaObj[key] = '' }); $('[data-wpex-rcss]').each(function (index, value) { var $this = $(this); var uniqueClass = 'wpex-rcss-' + index; var data = $this.data('wpex-rcss'); $this.addClass(uniqueClass); $.each(data, function (key, val) { var thisVal = val; var target = key; $.each(bkPoints, function (key) { if (thisVal[key]) { mediaObj[key] += '.' + uniqueClass + '{' + target + ':' + thisVal[key] + '!important;}' } }) }) }); $.each(mediaObj, function (key, val) { if ('d' == key) { headCSS += val } else { if (val) { headCSS += '@media (max-width: ' + bkPoints[key] + ') { ' + val + ' }' } } }); if (headCSS) { headCSS = ''; this.config.$head.append(headCSS) } }, vcexFilterNav: function ($context) { diff --git a/app/controllers/announcements_controller.rb b/app/controllers/announcements_controller.rb index 57a0723..c23e2b3 100644 --- a/app/controllers/announcements_controller.rb +++ b/app/controllers/announcements_controller.rb @@ -241,6 +241,7 @@ class AnnouncementsController < ApplicationController "outDuration":"400", "inClass":"fade-in", "outClass":"fade-out", + "need_fix_containers":".widget-announcement-4,.widget-announcement-15", "linkElement": "[data-list=\"announcements\"] > *", "children_text_block": ".w-annc__content-wrap", "container_block": "[data-subpart-id=\"'+subpart.id.to_s+'\"] [data-list=\"announcements\"]:not(tbody)",