R
R
Ruslan Absalyamov2018-08-01 14:16:34
1C-Bitrix
Ruslan Absalyamov, 2018-08-01 14:16:34

How to hide smart filter first?

As I understand it, this code always works when the page has just loaded

JCSmartFilter.prototype.postHandler = function (result, fromCache)
{
   var hrefFILTER, url, curProp;
   var modef = BX('modef');
   var modef_num = BX('modef_num');

   if (!!result && !!result.ITEMS)
   {
      for(var popupId in this.popups)
      {
         if (this.popups.hasOwnProperty(popupId))
         {
            this.popups[popupId].destroy();
         }
      }
      this.popups = [];

      for(var PID in result.ITEMS)
      {
         if (result.ITEMS.hasOwnProperty(PID))
         {
            this.updateItem(PID, result.ITEMS[PID]);
         }
      }

      if (!!modef && !!modef_num)
      {
         modef_num.innerHTML = result.ELEMENT_COUNT;
         hrefFILTER = BX.findChildren(modef, {tag: 'A'}, true);

         if (result.FILTER_URL && hrefFILTER)
         {
            hrefFILTER[0].href = BX.util.htmlspecialcharsback(result.FILTER_URL);
         }

         if (result.FILTER_AJAX_URL && result.COMPONENT_CONTAINER_ID)
         {
            BX.unbindAll(hrefFILTER[0]);
            BX.bind(hrefFILTER[0], 'click', function(e)
            {
               url = BX.util.htmlspecialcharsback(result.FILTER_AJAX_URL);
               BX.ajax.insertToNode(url, result.COMPONENT_CONTAINER_ID);
               return BX.PreventDefault(e);
            });
         }

         if (result.INSTANT_RELOAD && result.COMPONENT_CONTAINER_ID)
         {
            url = BX.util.htmlspecialcharsback(result.FILTER_AJAX_URL);
            BX.ajax.insertToNode(url, result.COMPONENT_CONTAINER_ID);
         }
         else
         {
            if (modef.style.display === 'none')
            {
               modef.style.display = 'inline-block';
            }

            if (this.viewMode == "VERTICAL")
            {
               curProp = BX.findChild(BX.findParent(this.curFilterinput, {'class':'bx-filter-parameters-box'}), {'class':'bx-filter-container-modef'}, true, false);
               curProp.appendChild(modef);
            }

            if (result.SEF_SET_FILTER_URL)
            {
               this.bindUrlToButton('set_filter', result.SEF_SET_FILTER_URL);
            }
         }
      }
   }

   if (this.sef)
   {
      var set_filter = BX('set_filter');
      set_filter.disabled = false;
   }

   if (!fromCache && this.cacheKey !== '')
   {
      this.cache[this.cacheKey] = result;
   }
   this.cacheKey = '';
};

Where is this code
if (modef.style.display === 'none')
            {
               modef.style.display = 'inline-block';
            }

It bothers me, but I don't understand how to remove it first. If you completely remove these lines, then the popup where to show the result does not work and even remove its style in the same way

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question