Advertisement
artemsemkin

Untitled

Aug 24th, 2020
1,403
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* ======================================================================== */
  2. /* 25. PJAX Update Nodes */
  3. /* ======================================================================== */
  4. function PJAXUpdateNodes(data) {
  5.   return new Promise((resolve) => {
  6.     const
  7.       $nextContainer = $($.parseHTML(data.next.html)),
  8.       $currentHeader = $('#page-header'),
  9.       $nextHeader = $nextContainer.find('#page-header'),
  10.       nodesToUpdate = [
  11.         '#page-header',
  12.         '#page-footer',
  13.         '#js-audio-background__options',
  14.         '#js-page-transition-curtain', // <----- add comma
  15.         '#page-header .logo__img-primary', // <----- add this
  16.         '#page-header .logo__img-secondary', // <----- add this
  17.       ]; // selectors of elements that needed to update
  18.  
  19.     $.each(nodesToUpdate, function () {
  20.       const
  21.         $item = $(this),
  22.         $nextItem = $nextContainer.find(this);
  23.  
  24.       // sync attributes if element exist in the new container
  25.       if ($nextItem.length) {
  26.         syncAttributes($nextItem, $item);
  27.       }
  28.     });
  29.  
  30.     resolve(true);
  31.   });
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement