/usr/lib/python2.7/dist-packages/patchqueue/static/patchqueue.js is in python-sphinx-patchqueue 0.5.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | function makeRadios(code) {
var fragment = document.createDocumentFragment();
['section', 'diff', 'file'].forEach(function (section, _, a) {
var radio = document.createElement('input')
radio.setAttribute('type', 'radio');
radio.setAttribute('name', 'pq-radio-' + code);
radio.setAttribute('data-section', section);
if (section === 'section') {
radio.checked = true;
}
var label = document.createElement('label');
label.appendChild(radio);
label.appendChild(document.createTextNode(' ' + section));
fragment.appendChild(label);
fragment.appendChild(document.createTextNode(' '));
});
return fragment;
}
document.addEventListener('DOMContentLoaded', function () {
var patches = document.querySelectorAll('.pq-needs-toggle');
for(var i=0; i<patches.length; ++i) {
var block = document.createElement('div');
block.appendChild(makeRadios(i));
var patch = patches[i];
patch.insertBefore(block, patch.childNodes[0]);
patch.addEventListener('click', function (event) {
var el = event.target;
if (el.nodeName.toUpperCase() !== 'INPUT'
|| !el.hasAttribute('data-section')) {
return;
}
// input < label < div[block] < div.pq-patch
var patch = el.parentNode.parentNode.parentNode;
var classes = patch.className.split(/\s+/)
.filter(function (cls, index, names) {
return !/^pq-show-\w+/.test(cls);
});
classes.push('pq-show-' + el.getAttribute('data-section'));
patch.className = classes.join(' ');
});
}
}, false);
|