[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/js/ -> wp-list-revisions.js (source)

   1  /**
   2   * @output wp-includes/js/wp-list-revisions.js
   3   */
   4  
   5  (function(w) {
   6      var init = function() {
   7          var pr = document.getElementById('post-revisions'),
   8          inputs = pr ? pr.getElementsByTagName('input') : [];
   9          pr.onclick = function() {
  10              var i, checkCount = 0, side;
  11              for ( i = 0; i < inputs.length; i++ ) {
  12                  checkCount += inputs[i].checked ? 1 : 0;
  13                  side = inputs[i].getAttribute('name');
  14                  if ( ! inputs[i].checked &&
  15                  ( 'left' == side && 1 > checkCount || 'right' == side && 1 < checkCount && ( ! inputs[i-1] || ! inputs[i-1].checked ) ) &&
  16                  ! ( inputs[i+1] && inputs[i+1].checked && 'right' == inputs[i+1].getAttribute('name') ) )
  17                      inputs[i].style.visibility = 'hidden';
  18                  else if ( 'left' == side || 'right' == side )
  19                      inputs[i].style.visibility = 'visible';
  20              }
  21          };
  22          pr.onclick();
  23      };
  24      if ( w && w.addEventListener )
  25          w.addEventListener('load', init, false);
  26      else if ( w && w.attachEvent )
  27          w.attachEvent('onload', init);
  28  })(window);


Generated : Tue Dec 17 08:20:01 2024 Cross-referenced by PHPXref