Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
a9e18196
提交
a9e18196
authored
6月 22, 2016
作者:
Francesco Visin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use RTD version switcher
上级
44904a39
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
34 行增加
和
41 行删除
+34
-41
version_switch.js
doc/.static/version_switch.js
+34
-41
没有找到文件。
doc/.static/version_switch.js
浏览文件 @
a9e18196
// Create version selector for documentation top bar.
// Create version selector for documentation top bar.
(
function
()
{
(
function
()
{
var
url
=
window
.
location
.
href
;
var
url
=
window
.
location
.
href
;
...
@@ -28,53 +27,49 @@
...
@@ -28,53 +27,49 @@
versions_dir
[
ver
]
=
current_version
versions_dir
[
ver
]
=
current_version
}
}
function
build_select
()
{
function
build_vswitch
()
{
// Build HTML string for version selector combo box and
// Build HTML string for version selector, based on ReadTheDocs theme's versions.html
// select current version by iterating versions_dir.
var
vswitch
=
[
'<div class="rst-versions" data-toggle="rst-versions" role="note" aria-label="versions" align=left>'
];
vswitch
.
push
(
'<span class="rst-current-version" data-toggle="rst-current-version">'
);
vswitch
.
push
(
'<span class="fa fa-book"></span>'
);
vswitch
.
push
(
'v:'
+
current_version
);
vswitch
.
push
(
'<span class="fa fa-caret-down"></span>'
);
vswitch
.
push
(
'</span>'
);
vswitch
.
push
(
'<div class="rst-other-versions">'
);
var
style
=
'"padding:0px 4px 0px 0px; background-color:transparent; '
vswitch
.
push
(
'<dl>'
);
style
=
style
+
'box-shadow:none; border:none; color:#27AA5E"'
;
vswitch
.
push
(
'<dt>Versions</dt>'
);
var
select
=
[
'<select style='
+
style
+
'>'
];
$
.
each
(
versions_dir
,
function
(
version
,
dir
){
$
.
each
(
versions_dir
,
function
(
version
,
dir
){
select
.
push
(
'<option style="padding:2px" value="'
+
version
+
'"'
);
var
new_url
=
url
.
replace
(
url
.
match
(
version_regex
)[
0
],
if
(
dir
==
current_version
)
'/'
+
versions_dir
[
version
]
+
'/'
);
select
.
push
(
' selected="selected">'
+
version
+
'</option>'
);
vswitch
.
push
(
'<dd><a href='
+
new_url
+
'>'
+
version
+
'</a></dd>'
);
else
select
.
push
(
'>'
+
version
+
'</option>'
);
});
});
vswitch
.
push
(
'</dl>'
);
return
select
.
join
(
''
);
vswitch
.
push
(
'<dl>'
);
}
vswitch
.
push
(
'<dt>Downloads</dt>'
);
var
pdf_url
=
"http://deeplearning.net/software/theano/theano.pdf"
vswitch
.
push
(
'<dd><a href='
+
pdf_url
+
'>'
+
'PDF'
+
'</a></dd>'
);
vswitch
.
push
(
'</dl>'
);
function
on_switch
()
{
vswitch
.
push
(
'<dl>'
);
// Method triggered when an option is selected in combo box.
vswitch
.
push
(
'<dt>On GitHub</dt>'
);
var
selected
=
$
(
this
).
children
(
'option:selected'
).
attr
(
'value'
);
var
git_master
=
"https://github.com/Theano/Theano"
vswitch
.
push
(
'<dd><a href='
+
git_master
+
'>'
+
'Fork me'
+
'</a></dd>'
);
vswitch
.
push
(
'</dl>'
);
// Insert selected version in URL.
vswitch
.
push
(
'</div>'
);
var
new_url
=
url
.
replace
(
url
.
match
(
version_regex
)[
0
],
vswitch
.
push
(
'</div>'
);
'/'
+
versions_dir
[
selected
]
+
'/'
);
if
(
url
!=
new_url
)
{
return
vswitch
.
join
(
''
);
$
.
ajax
({
success
:
function
()
{
window
.
location
.
href
=
new_url
;
},
// If page not in version, go to root of documentation.
error
:
function
()
{
window
.
location
.
href
=
root_url
+
versions_dir
[
selected
]
+
'/'
;
}
});
}
}
}
// Create combobox HTML, assign to placeholder in layout.html and
// Create HTML for version switcher and assign to placeholder in layout.html.
// bind selection method.
$
(
document
).
ready
(
function
()
{
$
(
document
).
ready
(
function
()
{
// Get theano version.
// var current_version = DOCUMENTATION_OPTIONS.VERSION;
// Build default switcher
// Build default switcher
$
(
'.version_switcher_placeholder'
).
html
(
build_select
());
$
(
'.version_switcher_placeholder'
).
html
(
build_vswitch
());
$
(
'.version_switcher_placeholder select'
).
bind
(
'change'
,
on_switch
)
// Check server for other doc versions and update switcher.
// Check server for other doc versions and update switcher.
if
(
url
.
startsWith
(
'http'
))
{
if
(
url
.
startsWith
(
'http'
))
{
...
@@ -82,9 +77,7 @@
...
@@ -82,9 +77,7 @@
$
.
each
(
data
,
function
(
version
,
dir
)
{
$
.
each
(
data
,
function
(
version
,
dir
)
{
versions_dir
[
version
]
=
dir
;
versions_dir
[
version
]
=
dir
;
});
});
$
(
'.version_switcher_placeholder'
).
html
(
build_vswitch
());
$
(
'.version_switcher_placeholder'
).
html
(
build_select
());
$
(
'.version_switcher_placeholder select'
).
bind
(
'change'
,
on_switch
)
});
});
}
}
});
});
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论