daily pastebin goal
71%
SHARE
TWEET

Untitled

a guest Mar 14th, 2018 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. pulse.overview.OverviewController.prototype.insertExpandedGroupsContent = function (items, data) {
  2.     var expandedTopLevels = _.filter(items, function (level) { return level.isExpanded; });
  3.     _.each(expandedTopLevels, function (expandedLevel) {
  4.         var indexInData = _.indexOf(data, expandedLevel) + 1;
  5.         var indexInOrderedItems = _.indexOf(items, expandedLevel) + 1;
  6.         var array = [];
  7.         while (data[indexInData].level != 0) {
  8.             array.push(data[indexInData++]);
  9.             if (indexInData > data.length - 1) {
  10.                 break;
  11.             }
  12.         }
  13.         var i = 0;
  14.         while (i < array.length) {
  15.             var item = array[i++];
  16.             items.splice(indexInOrderedItems++, 0, item);
  17.             if (!item.isExpanded && i < array.length) {
  18.                 if (item.isGroup) {
  19.                     while (!_.has(array[i], "level") || item.level != array[i].level) {
  20.                         i++;
  21.                         if (i > array.length) {
  22.                             break;
  23.                         }
  24.                     };
  25.                 }
  26.             }
  27.         }
  28.     });
  29. };
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top