summaryrefslogtreecommitdiff
path: root/doc/source/theme/static/version_switch.js
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2015-02-07 20:54:20 +0100
committermathieui <mathieui@mathieui.net>2015-02-07 21:14:48 +0100
commit61f28d7ffeae0b6a8fd8ca0617e082e2196df622 (patch)
tree293bb9830aa215e415f34bb24c8846cb8d13b3b7 /doc/source/theme/static/version_switch.js
parentcc91486f8a3619a61e803d990284b040797a1944 (diff)
downloadpoezio-61f28d7ffeae0b6a8fd8ca0617e082e2196df622.tar.gz
poezio-61f28d7ffeae0b6a8fd8ca0617e082e2196df622.tar.bz2
poezio-61f28d7ffeae0b6a8fd8ca0617e082e2196df622.tar.xz
poezio-61f28d7ffeae0b6a8fd8ca0617e082e2196df622.zip
Change the sphinx theme to one derived from readthedocs
(without stuff like the unicode codepoint agressions and external resources) This should be cleaner and look good on mobile devices too.
Diffstat (limited to 'doc/source/theme/static/version_switch.js')
-rw-r--r--doc/source/theme/static/version_switch.js66
1 files changed, 0 insertions, 66 deletions
diff --git a/doc/source/theme/static/version_switch.js b/doc/source/theme/static/version_switch.js
deleted file mode 100644
index cc7be1c5..00000000
--- a/doc/source/theme/static/version_switch.js
+++ /dev/null
@@ -1,66 +0,0 @@
-(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);
- });
-})();