mirror of
https://github.com/python/cpython.git
synced 2025-10-21 06:02:21 +00:00
Merge changelog filtering fixes/improvements with 3.3.
This commit is contained in:
commit
f25dabe1ec
2 changed files with 53 additions and 21 deletions
|
@ -10,19 +10,59 @@
|
||||||
{% if not embedded %}<script type="text/javascript" src="{{ pathto('_static/copybutton.js', 1) }}"></script>{% endif %}
|
{% if not embedded %}<script type="text/javascript" src="{{ pathto('_static/copybutton.js', 1) }}"></script>{% endif %}
|
||||||
{% if pagename == 'whatsnew/changelog' %}
|
{% if pagename == 'whatsnew/changelog' %}
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function dofilter() {
|
$(document).ready(function() {
|
||||||
var el = document.getElementById('searchbox');
|
// add the search form and bind the events
|
||||||
var string = el.value.toLowerCase();
|
$('h1').after([
|
||||||
var litags = document.getElementsByTagName('li')
|
'<p>Filter entries by content:',
|
||||||
for (var idx = 0; idx < litags.length; idx++) {
|
'<input type="text" value="" id="searchbox" style="width: 50%">',
|
||||||
var li = litags[idx];
|
'<input type="submit" id="searchbox-submit" value="Filter"></p>'
|
||||||
if (li.innerHTML.toLowerCase().indexOf(string) >= 0) {
|
].join('\n'));
|
||||||
li.style.display = '';
|
|
||||||
} else {
|
function dofilter() {
|
||||||
li.style.display = 'none';
|
try {
|
||||||
|
var query = new RegExp($('#searchbox').val(), 'i');
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
return; // not a valid regex (yet)
|
||||||
|
}
|
||||||
|
// find headers for the versions (What's new in Python X.Y.Z?)
|
||||||
|
$('#changelog h2').each(function(index1, h2) {
|
||||||
|
var h2_parent = $(h2).parent();
|
||||||
|
var sections_found = 0;
|
||||||
|
// find headers for the sections (Core, Library, etc.)
|
||||||
|
h2_parent.find('h3').each(function(index2, h3) {
|
||||||
|
var h3_parent = $(h3).parent();
|
||||||
|
var entries_found = 0;
|
||||||
|
// find all the entries
|
||||||
|
h3_parent.find('li').each(function(index3, li) {
|
||||||
|
var li = $(li);
|
||||||
|
// check if the query matches the entry
|
||||||
|
if (query.test(li.text())) {
|
||||||
|
li.show();
|
||||||
|
entries_found++;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
li.hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// if there are entries, show the section, otherwise hide it
|
||||||
|
if (entries_found > 0) {
|
||||||
|
h3_parent.show();
|
||||||
|
sections_found++;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
h3_parent.hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (sections_found > 0)
|
||||||
|
h2_parent.show();
|
||||||
|
else
|
||||||
|
h2_parent.hide();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
$('#searchbox').keyup(dofilter);
|
||||||
}
|
$('#searchbox-submit').click(dofilter);
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
|
@ -31,7 +71,7 @@
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
© <a href="{{ pathto('copyright') }}">Copyright</a> {{ copyright|e }}.
|
© <a href="{{ pathto('copyright') }}">Copyright</a> {{ copyright|e }}.
|
||||||
<br />
|
<br />
|
||||||
The Python Software Foundation is a non-profit corporation.
|
The Python Software Foundation is a non-profit corporation.
|
||||||
<a href="http://www.python.org/psf/donations/">Please donate.</a>
|
<a href="http://www.python.org/psf/donations/">Please donate.</a>
|
||||||
<br />
|
<br />
|
||||||
Last updated on {{ last_updated|e }}.
|
Last updated on {{ last_updated|e }}.
|
||||||
|
|
|
@ -2,13 +2,5 @@
|
||||||
Changelog
|
Changelog
|
||||||
+++++++++
|
+++++++++
|
||||||
|
|
||||||
.. raw:: html
|
|
||||||
|
|
||||||
<p>
|
|
||||||
Filter entries by content:
|
|
||||||
<input type="text" value="" id="searchbox" style="width: 50%" onchange="dofilter()">
|
|
||||||
<input type="submit" value="Filter" onclick="dofilter()">
|
|
||||||
</p>
|
|
||||||
|
|
||||||
.. miscnews:: ../../Misc/NEWS
|
.. miscnews:: ../../Misc/NEWS
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue