WordPress/wp-includes/js/wp-list-revisions.js
atimmer bde558be2f Docs: Add file doc @output annotations.
These annotations make it clear to the reader of a JavaScript source
where the build process outputs to. These annotations can later be
integrated in a webpack configuration. This way there is one source of
truth.

The `build` folder is omitted from the paths, because a single JS file
shouldn't not be responsible of knowing where outputs in general will
end up at. A file only knows its output location relative to the
project.

Props adamsilverstein, herregroen, omarreiss, pento.
Fixes #44361.

Built from https://develop.svn.wordpress.org/trunk@43347


git-svn-id: http://core.svn.wordpress.org/trunk@43175 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-06-28 02:30:15 +00:00

29 lines
970 B
JavaScript

/**
* @output wp-includes/js/wp-list-revisions.js
*/
(function(w) {
var init = function() {
var pr = document.getElementById('post-revisions'),
inputs = pr ? pr.getElementsByTagName('input') : [];
pr.onclick = function() {
var i, checkCount = 0, side;
for ( i = 0; i < inputs.length; i++ ) {
checkCount += inputs[i].checked ? 1 : 0;
side = inputs[i].getAttribute('name');
if ( ! inputs[i].checked &&
( 'left' == side && 1 > checkCount || 'right' == side && 1 < checkCount && ( ! inputs[i-1] || ! inputs[i-1].checked ) ) &&
! ( inputs[i+1] && inputs[i+1].checked && 'right' == inputs[i+1].getAttribute('name') ) )
inputs[i].style.visibility = 'hidden';
else if ( 'left' == side || 'right' == side )
inputs[i].style.visibility = 'visible';
}
};
pr.onclick();
};
if ( w && w.addEventListener )
w.addEventListener('load', init, false);
else if ( w && w.attachEvent )
w.attachEvent('onload', init);
})(window);