Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
c780cc1b
T
three.js
项目概览
车家大少爷
/
three.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
three.js
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c780cc1b
编写于
4月 20, 2020
作者:
M
munrocket@pm.me
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Examples: refactor index.html
上级
4a0dce9d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
109 addition
and
102 deletion
+109
-102
docs/index.html
docs/index.html
+2
-2
examples/index.html
examples/index.html
+105
-98
files/main.css
files/main.css
+2
-2
未找到文件。
docs/index.html
浏览文件 @
c780cc1b
...
...
@@ -27,7 +27,7 @@
<div
id=
"contentWrapper"
>
<div
id=
"inputWrapper"
>
<input
placeholder=
""
type=
"text"
id=
"filter"
autocorrect=
"off"
autocapitalize=
"off"
spellcheck=
"false"
/>
<input
placeholder=
""
type=
"text"
id=
"filter
Input
"
autocorrect=
"off"
autocapitalize=
"off"
spellcheck=
"false"
/>
<div
id=
"exitSearchButton"
></div>
<select
id=
"language"
>
<option
value=
"en"
>
en
</option>
...
...
@@ -94,7 +94,7 @@
var
expandButton
=
document
.
getElementById
(
'
expandButton
'
);
var
exitSearchButton
=
document
.
getElementById
(
'
exitSearchButton
'
);
var
panelScrim
=
document
.
getElementById
(
'
panelScrim
'
);
var
filterInput
=
document
.
getElementById
(
'
filter
'
);
var
filterInput
=
document
.
getElementById
(
'
filter
Input
'
);
var
iframe
=
document
.
querySelector
(
'
iframe
'
);
var
pageProperties
=
{};
...
...
examples/index.html
浏览文件 @
c780cc1b
...
...
@@ -32,7 +32,7 @@
<div
id=
"contentWrapper"
>
<div
id=
"inputWrapper"
>
<input
placeholder=
""
type=
"text"
id=
"filter"
autocorrect=
"off"
autocapitalize=
"off"
spellcheck=
"false"
/>
<input
placeholder=
""
type=
"text"
id=
"filter
Input
"
autocorrect=
"off"
autocapitalize=
"off"
spellcheck=
"false"
/>
<div
id=
"exitSearchButton"
></div>
</div>
...
...
@@ -49,103 +49,143 @@
<script>
function
extractQuery
()
{
var
panel
=
document
.
getElementById
(
'
panel
'
);
var
content
=
document
.
getElementById
(
'
content
'
);
var
viewer
=
document
.
getElementById
(
'
viewer
'
);
var
filterInput
=
document
.
getElementById
(
'
filterInput
'
);
var
exitSearchButton
=
document
.
getElementById
(
'
exitSearchButton
'
);
var
expandButton
=
document
.
getElementById
(
'
expandButton
'
);
var
viewSrcButton
=
document
.
getElementById
(
'
button
'
);
var
panelScrim
=
document
.
getElementById
(
'
panelScrim
'
);
var
p
=
window
.
location
.
search
.
indexOf
(
'
?q=
'
);
var
links
=
{};
var
selected
=
null
;
var
container
=
document
.
createElement
(
'
div
'
);
if
(
p
!==
-
1
)
{
init
();
return
window
.
location
.
search
.
substr
(
3
);
function
init
()
{
content
.
appendChild
(
container
);
viewSrcButton
.
style
.
display
=
'
none
'
;
for
(
var
key
in
files
)
{
var
section
=
files
[
key
];
var
header
=
document
.
createElement
(
'
h2
'
);
header
.
textContent
=
key
;
header
.
setAttribute
(
'
data-category
'
,
key
);
container
.
appendChild
(
header
);
for
(
var
i
=
0
;
i
<
section
.
length
;
i
++
)
{
var
file
=
section
[
i
];
var
link
=
createLink
(
file
);
container
.
appendChild
(
link
);
links
[
file
]
=
link
;
}
}
return
''
;
if
(
window
.
location
.
hash
!==
''
&&
links
[
window
.
location
.
hash
.
substring
(
1
)
]
)
{
}
loadFile
(
window
.
location
.
hash
.
substring
(
1
)
);
var
panel
=
document
.
getElementById
(
'
panel
'
);
var
content
=
document
.
getElementById
(
'
content
'
);
var
viewer
=
document
.
getElementById
(
'
viewer
'
);
}
var
filterInput
=
document
.
getElementById
(
'
filter
'
);
var
exitSearchButton
=
document
.
getElementById
(
'
exitSearchButton
'
);
filterInput
.
value
=
extractQuery
();
var
expandButton
=
document
.
getElementById
(
'
expandButton
'
);
expandButton
.
addEventListener
(
'
click
'
,
function
(
event
)
{
if
(
filterInput
.
value
!==
''
)
{
event
.
preventDefault
();
panel
.
classList
.
toggle
(
'
open
'
);
panel
.
classList
.
add
(
'
searchFocused
'
);
}
);
}
var
panelScrim
=
document
.
getElementById
(
'
panelScrim
'
);
panelScrim
.
onclick
=
function
(
event
)
{
updateFilter
();
event
.
preventDefault
();
panel
.
classList
.
toggle
(
'
open
'
);
// Events
};
filterInput
.
onfocus
=
function
(
event
)
{
// iOS iframe auto-resize workaround
panel
.
classList
.
add
(
'
searchFocused
'
);
if
(
/
(
iPad|iPhone|iPod
)
/g
.
test
(
navigator
.
userAgent
)
)
{
};
viewer
.
style
.
width
=
getComputedStyle
(
viewer
).
width
;
viewer
.
style
.
height
=
getComputedStyle
(
viewer
).
height
;
viewer
.
setAttribute
(
'
scrolling
'
,
'
no
'
);
filterInput
.
onblur
=
function
(
event
)
{
}
if
(
filterInput
.
value
===
''
)
{
var
container
=
document
.
createElement
(
'
div
'
);
content
.
appendChild
(
container
);
panel
.
classList
.
remove
(
'
searchFocused
'
);
var
viewSrcButton
=
document
.
getElementById
(
'
button
'
);
viewSrcButton
.
style
.
display
=
'
none
'
;
}
var
links
=
{};
var
selected
=
null
;
};
function
createLink
(
file
)
{
exitSearchButton
.
onclick
=
function
(
event
)
{
var
link
=
document
.
createElement
(
'
a
'
);
link
.
className
=
'
link
'
;
link
.
href
=
file
+
'
.html
'
;
link
.
textContent
=
getName
(
file
);
link
.
setAttribute
(
'
target
'
,
'
viewer
'
);
link
.
addEventListener
(
'
click
'
,
function
(
event
)
{
filterInput
.
value
=
''
;
updateFilter
();
panel
.
classList
.
remove
(
'
searchFocused
'
);
if
(
event
.
button
!==
0
||
event
.
ctrlKey
||
event
.
altKey
||
event
.
metaKey
)
return
;
}
;
selectFile
(
file
);
filterInput
.
addEventListener
(
'
input
'
,
function
()
{
updateFilter
();
}
);
return
link
;
}
expandButton
.
addEventListener
(
'
click
'
,
function
(
event
)
{
for
(
var
key
in
files
)
{
event
.
preventDefault
();
panel
.
classList
.
toggle
(
'
open
'
);
var
section
=
files
[
key
]
;
}
)
;
var
header
=
document
.
createElement
(
'
h2
'
);
header
.
textContent
=
key
;
header
.
setAttribute
(
'
data-category
'
,
key
);
container
.
appendChild
(
header
);
panelScrim
.
onclick
=
function
(
event
)
{
for
(
var
i
=
0
;
i
<
section
.
length
;
i
++
)
{
event
.
preventDefault
();
panel
.
classList
.
toggle
(
'
open
'
);
var
file
=
section
[
i
]
;
}
;
var
link
=
createLink
(
file
);
container
.
appendChild
(
link
);
// iOS iframe auto-resize workaround
links
[
file
]
=
link
;
if
(
/
(
iPad|iPhone|iPod
)
/g
.
test
(
navigator
.
userAgent
)
)
{
viewer
.
style
.
width
=
getComputedStyle
(
viewer
).
width
;
viewer
.
style
.
height
=
getComputedStyle
(
viewer
).
height
;
viewer
.
setAttribute
(
'
scrolling
'
,
'
no
'
);
}
}
function
createLink
(
file
)
{
var
link
=
document
.
createElement
(
'
a
'
);
link
.
className
=
'
link
'
;
link
.
href
=
file
+
'
.html
'
;
link
.
textContent
=
getName
(
file
);
link
.
setAttribute
(
'
target
'
,
'
viewer
'
);
link
.
addEventListener
(
'
click
'
,
function
(
event
)
{
if
(
event
.
button
!==
0
||
event
.
ctrlKey
||
event
.
altKey
||
event
.
metaKey
)
return
;
selectFile
(
file
);
}
);
return
link
;
}
function
loadFile
(
file
)
{
selectFile
(
file
);
...
...
@@ -173,43 +213,6 @@
}
if
(
window
.
location
.
hash
!==
''
&&
links
[
window
.
location
.
hash
.
substring
(
1
)
]
)
{
loadFile
(
window
.
location
.
hash
.
substring
(
1
)
);
}
// filter
filterInput
.
onfocus
=
function
(
event
)
{
panel
.
classList
.
add
(
'
searchFocused
'
);
};
filterInput
.
onblur
=
function
(
event
)
{
if
(
filterInput
.
value
===
''
)
{
panel
.
classList
.
remove
(
'
searchFocused
'
);
}
};
exitSearchButton
.
onclick
=
function
(
event
)
{
filterInput
.
value
=
''
;
updateFilter
();
panel
.
classList
.
remove
(
'
searchFocused
'
);
};
filterInput
.
addEventListener
(
'
input
'
,
function
()
{
updateFilter
();
}
);
function
updateFilter
()
{
var
v
=
filterInput
.
value
;
...
...
@@ -315,15 +318,19 @@
}
filterInput
.
value
=
extractQuery
();
function
extractQuery
()
{
var
p
=
window
.
location
.
search
.
indexOf
(
'
?q=
'
);
if
(
p
!==
-
1
)
{
if
(
filterInput
.
value
!==
''
)
{
return
window
.
location
.
search
.
substr
(
3
);
panel
.
classList
.
add
(
'
searchFocused
'
);
}
}
return
''
;
updateFilter
();
}
</script>
...
...
files/main.css
浏览文件 @
c780cc1b
...
...
@@ -157,7 +157,7 @@ h1 a {
display
:
none
;
}
#panel
.searchFocused
#filter
{
#panel
.searchFocused
#filter
Input
{
-webkit-mask-image
:
none
;
mask-image
:
none
;
background-color
:
inherit
;
...
...
@@ -232,7 +232,7 @@ h1 a {
content
:
""
;
}
#panel
#filter
{
#panel
#filter
Input
{
flex
:
1
;
width
:
100%
;
padding
:
0
36px
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录