(function() { 'use strict'; var all_versions = { '3.4': 'dev (3.4)', '3.3': '3.3', '3.2': '3.2', '2.7': '2.7', '2.6': '2.6' }; function build_select(current_version, current_release) { var buf = ['<select>']; $.each(all_versions, function(version, title) { buf.push('<option value="' + version + '"'); if (version == current_version) buf.push(' selected="selected">' + current_release + '</option>'); else buf.push('>' + title + '</option>'); }); buf.push('</select>'); return buf.join(''); } function patch_url(url, new_version) { var url_re = /\.org\/(\d|py3k|dev|((release\/)?\d\.\d[\w\d\.]*))\//, new_url = url.replace(url_re, '.org/' + new_version + '/'); if (new_url == url && !new_url.match(url_re)) { // python 2 url without version? new_url = url.replace(/\.org\//, '.org/' + new_version + '/'); } return new_url; } function on_switch() { var selected = $(this).children('option:selected').attr('value'); var url = window.location.href, new_url = patch_url(url, selected); if (new_url != url) { // check beforehand if url exists, else redirect to version's start page $.ajax({ url: new_url, success: function() { window.location.href = new_url; }, error: function() { window.location.href = 'http://docs.python.org/' + selected; } }); } } $(document).ready(function() { var release = DOCUMENTATION_OPTIONS.VERSION; var version = release.substr(0, 3); var select = build_select(version, release); $('.version_switcher_placeholder').html(select); $('.version_switcher_placeholder select').bind('change', on_switch); }); })();
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
ajax-loader.gif | File | 673 B | 0644 |
|
basic.css | File | 6.77 KB | 0644 |
|
comment-bright.png | File | 3.42 KB | 0644 |
|
comment-close.png | File | 3.49 KB | 0644 |
|
comment.png | File | 3.36 KB | 0644 |
|
copybutton.js | File | 2.4 KB | 0644 |
|
default.css | File | 4.03 KB | 0644 |
|
doctools.js | File | 6.68 KB | 0644 |
|
down-pressed.png | File | 368 B | 0644 |
|
down.png | File | 363 B | 0644 |
|
file.png | File | 392 B | 0644 |
|
jquery.js | File | 70.48 KB | 0644 |
|
minus.png | File | 199 B | 0644 |
|
opensearch.xml | File | 569 B | 0644 |
|
plus.png | File | 199 B | 0644 |
|
py.png | File | 695 B | 0644 |
|
pygments.css | File | 3.84 KB | 0644 |
|
searchtools.js | File | 15.67 KB | 0644 |
|
sidebar.js | File | 4.63 KB | 0644 |
|
underscore.js | File | 8.37 KB | 0644 |
|
up-pressed.png | File | 372 B | 0644 |
|
up.png | File | 363 B | 0644 |
|
version_switch.js | File | 1.76 KB | 0644 |
|
websupport.js | File | 24.65 KB | 0644 |
|