Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
tianyazhichiC
algorithm-visualizer
提交
011cc7b3
A
algorithm-visualizer
项目概览
tianyazhichiC
/
algorithm-visualizer
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
algorithm-visualizer
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
011cc7b3
编写于
6月 01, 2016
作者:
J
Jason Park
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update core js to be consistent with the latest gh-pages
上级
942c0309
变更
30
展开全部
隐藏空白更改
内联
并排
Showing
30 changed file
with
646 addition
and
369 deletion
+646
-369
js/app/constructor.js
js/app/constructor.js
+12
-9
js/dom/add_categories.js
js/dom/add_categories.js
+8
-7
js/dom/add_files.js
js/dom/add_files.js
+32
-0
js/dom/index.js
js/dom/index.js
+7
-5
js/dom/setup/setup_dividers.js
js/dom/setup/setup_dividers.js
+3
-3
js/dom/setup/setup_document.js
js/dom/setup/setup_document.js
+2
-2
js/dom/setup/setup_interval.js
js/dom/setup/setup_interval.js
+2
-2
js/dom/setup/setup_module_container.js
js/dom/setup/setup_module_container.js
+4
-4
js/dom/setup/setup_scratch_paper.js
js/dom/setup/setup_scratch_paper.js
+3
-2
js/dom/setup/setup_side_menu.js
js/dom/setup/setup_side_menu.js
+2
-2
js/dom/setup/setup_top_menu.js
js/dom/setup/setup_top_menu.js
+9
-9
js/dom/setup/setup_window.js
js/dom/setup/setup_window.js
+2
-2
js/dom/show_algorithm.js
js/dom/show_algorithm.js
+11
-12
js/dom/show_requested_algorithm.js
js/dom/show_requested_algorithm.js
+11
-0
js/editor/index.js
js/editor/index.js
+5
-5
js/index.js
js/index.js
+27
-12
js/server/ajax/request.js
js/server/ajax/request.js
+4
-4
js/server/helpers.js
js/server/helpers.js
+75
-4
js/server/load_algorithm.js
js/server/load_algorithm.js
+5
-2
js/server/load_categories.js
js/server/load_categories.js
+0
-1
js/server/load_file.js
js/server/load_file.js
+20
-11
js/server/load_scratch_paper.js
js/server/load_scratch_paper.js
+10
-6
js/server/share_scratch_paper.js
js/server/share_scratch_paper.js
+11
-9
js/utils/index.js
js/utils/index.js
+3
-8
public/algorithm_visualizer.css
public/algorithm_visualizer.css
+2
-1
public/algorithm_visualizer.js
public/algorithm_visualizer.js
+370
-242
public/algorithm_visualizer.js.map
public/algorithm_visualizer.js.map
+1
-1
public/algorithm_visualizer.min.css
public/algorithm_visualizer.min.css
+1
-1
public/algorithm_visualizer.min.js
public/algorithm_visualizer.min.js
+3
-2
public/algorithm_visualizer.min.js.map
public/algorithm_visualizer.min.js.map
+1
-1
未找到文件。
js/app/constructor.js
浏览文件 @
011cc7b3
...
...
@@ -3,21 +3,15 @@
const
Editor
=
require
(
'
../editor
'
);
const
TracerManager
=
require
(
'
../tracer_manager
'
);
const
DOM
=
require
(
'
../dom/setup
'
);
const
{
getFileDir
}
=
require
(
'
../utils
'
);
const
Cache
=
require
(
'
./cache
'
);
const
{
each
}
=
$
;
const
state
=
{
isLoading
:
null
,
editor
:
null
,
tracerManager
:
null
,
categories
:
null
categories
:
null
,
loadedScratch
:
null
};
const
initState
=
(
tracerManager
)
=>
{
...
...
@@ -25,12 +19,13 @@ const initState = (tracerManager) => {
state
.
editor
=
new
Editor
(
tracerManager
);
state
.
tracerManager
=
tracerManager
;
state
.
categories
=
{};
state
.
loadedScratch
=
null
;
};
/**
* Global application singleton.
*/
const
App
=
function
()
{
const
App
=
function
()
{
this
.
getIsLoading
=
()
=>
{
return
state
.
isLoading
;
...
...
@@ -69,6 +64,14 @@ const App = function() {
return
state
.
tracerManager
;
};
this
.
getLoadedScratch
=
()
=>
{
return
state
.
loadedScratch
;
};
this
.
setLoadedScratch
=
(
loadedScratch
)
=>
{
state
.
loadedScratch
=
loadedScratch
;
};
const
tracerManager
=
TracerManager
.
init
();
initState
(
tracerManager
);
...
...
js/dom/
show
_categories.js
→
js/dom/
add
_categories.js
浏览文件 @
011cc7b3
'
use strict
'
;
const
app
Instance
=
require
(
'
../app
'
);
const
app
=
require
(
'
../app
'
);
const
Server
=
require
(
'
../server
'
);
const
showAlgorithm
=
require
(
'
./show_algorithm
'
);
...
...
@@ -13,7 +13,7 @@ const addAlgorithmToCategoryDOM = (category, subList, algorithm) => {
.
append
(
subList
[
algorithm
])
.
attr
(
'
data-algorithm
'
,
algorithm
)
.
attr
(
'
data-category
'
,
category
)
.
click
(
function
()
{
.
click
(
function
()
{
Server
.
loadAlgorithm
(
category
,
algorithm
).
then
((
data
)
=>
{
showAlgorithm
(
category
,
algorithm
,
data
);
});
...
...
@@ -27,14 +27,15 @@ const addCategoryToDOM = (category) => {
const
{
name
:
categoryName
,
list
:
categorySubList
}
=
app
Instance
.
getCategory
(
category
);
}
=
app
.
getCategory
(
category
);
const
$category
=
$
(
'
<button class="category">
'
)
.
append
(
'
<i class="fa fa-fw fa-caret-right">
'
)
.
append
(
categoryName
);
.
append
(
categoryName
)
.
attr
(
'
data-category
'
,
category
);
$category
.
click
(
function
()
{
$
(
`[data-category="
${
category
}
"]`
).
toggleClass
(
'
collapse
'
);
$category
.
click
(
function
()
{
$
(
`
.indent
[data-category="
${
category
}
"]`
).
toggleClass
(
'
collapse
'
);
$
(
this
).
find
(
'
i.fa
'
).
toggleClass
(
'
fa-caret-right fa-caret-down
'
);
});
...
...
@@ -46,5 +47,5 @@ const addCategoryToDOM = (category) => {
};
module
.
exports
=
()
=>
{
each
(
app
Instance
.
getCategories
(),
addCategoryToDOM
);
each
(
app
.
getCategories
(),
addCategoryToDOM
);
};
\ No newline at end of file
js/dom/
show
_files.js
→
js/dom/
add
_files.js
浏览文件 @
011cc7b3
...
...
@@ -7,21 +7,26 @@ const {
}
=
$
;
const
addFileToDOM
=
(
category
,
algorithm
,
file
,
explanation
)
=>
{
var
$file
=
$
(
'
<button>
'
).
append
(
file
).
click
(
function
()
{
Server
.
loadFile
(
category
,
algorithm
,
file
,
explanation
);
$
(
'
.files_bar > .wrapper > button
'
).
removeClass
(
'
active
'
);
$
(
this
).
addClass
(
'
active
'
);
});
var
$file
=
$
(
'
<button>
'
)
.
append
(
file
)
.
attr
(
'
data-file
'
,
file
)
.
click
(
function
()
{
Server
.
loadFile
(
category
,
algorithm
,
file
,
explanation
);
$
(
'
.files_bar > .wrapper > button
'
).
removeClass
(
'
active
'
);
$
(
this
).
addClass
(
'
active
'
);
});
$
(
'
.files_bar > .wrapper
'
).
append
(
$file
);
return
$file
;
};
module
.
exports
=
(
category
,
algorithm
,
files
)
=>
{
module
.
exports
=
(
category
,
algorithm
,
files
,
requestedFile
)
=>
{
$
(
'
.files_bar > .wrapper
'
).
empty
();
each
(
files
,
(
file
,
explanation
)
=>
{
addFileToDOM
(
category
,
algorithm
,
file
,
explanation
);
var
$file
=
addFileToDOM
(
category
,
algorithm
,
file
,
explanation
);
if
(
requestedFile
&&
requestedFile
==
file
)
$file
.
click
();
});
$
(
'
.files_bar > .wrapper > button
'
).
first
().
click
();
if
(
!
requestedFile
)
$
(
'
.files_bar > .wrapper > button
'
).
first
().
click
();
$
(
'
.files_bar > .wrapper
'
).
scroll
();
};
\ No newline at end of file
js/dom/index.js
浏览文件 @
011cc7b3
'
use strict
'
;
const
showAlgorithm
=
require
(
'
./show_algorithm
'
);
const
showCategories
=
require
(
'
./show
_categories
'
);
const
addCategories
=
require
(
'
./add
_categories
'
);
const
showDescription
=
require
(
'
./show_description
'
);
const
showFiles
=
require
(
'
./show
_files
'
);
const
addFiles
=
require
(
'
./add
_files
'
);
const
showFirstAlgorithm
=
require
(
'
./show_first_algorithm
'
);
const
showRequestedAlgorithm
=
require
(
'
./show_requested_algorithm
'
);
module
.
exports
=
{
showAlgorithm
,
show
Categories
,
add
Categories
,
showDescription
,
showFiles
,
showFirstAlgorithm
addFiles
,
showFirstAlgorithm
,
showRequestedAlgorithm
};
\ No newline at end of file
js/dom/setup/setup_dividers.js
浏览文件 @
011cc7b3
const
app
Instance
=
require
(
'
../../app
'
);
const
app
=
require
(
'
../../app
'
);
const
addDividerToDom
=
(
divider
)
=>
{
const
[
vertical
,
$first
,
$second
]
=
divider
;
...
...
@@ -37,7 +37,7 @@ const addDividerToDom = (divider) => {
$first
.
css
(
'
right
'
,
(
100
-
percent
)
+
'
%
'
);
$second
.
css
(
'
left
'
,
percent
+
'
%
'
);
x
=
pageX
;
app
Instance
.
getTracerManager
().
resize
();
app
.
getTracerManager
().
resize
();
$
(
'
.files_bar > .wrapper
'
).
scroll
();
}
});
...
...
@@ -75,7 +75,7 @@ const addDividerToDom = (divider) => {
$first
.
css
(
'
bottom
'
,
(
100
-
percent
)
+
'
%
'
);
$second
.
css
(
'
top
'
,
percent
+
'
%
'
);
y
=
pageY
;
app
Instance
.
getTracerManager
().
resize
();
app
.
getTracerManager
().
resize
();
}
});
...
...
js/dom/setup/setup_document.js
浏览文件 @
011cc7b3
const
app
Instance
=
require
(
'
../../app
'
);
const
app
=
require
(
'
../../app
'
);
module
.
exports
=
()
=>
{
$
(
document
).
on
(
'
click
'
,
'
a
'
,
(
e
)
=>
{
...
...
@@ -10,6 +10,6 @@ module.exports = () => {
});
$
(
document
).
mouseup
(
function
(
e
)
{
app
Instance
.
getTracerManager
().
command
(
'
mouseup
'
,
e
);
app
.
getTracerManager
().
command
(
'
mouseup
'
,
e
);
});
};
\ No newline at end of file
js/dom/setup/setup_interval.js
浏览文件 @
011cc7b3
const
app
Instance
=
require
(
'
../../app
'
);
const
app
=
require
(
'
../../app
'
);
const
Toast
=
require
(
'
../toast
'
);
const
{
...
...
@@ -40,7 +40,7 @@ module.exports = () => {
});
$
(
'
#interval
'
).
on
(
'
change
'
,
function
()
{
const
tracerManager
=
app
Instance
.
getTracerManager
();
const
tracerManager
=
app
.
getTracerManager
();
const
[
seconds
,
message
]
=
normalize
(
parseFloat
(
$
(
this
).
val
()));
$
(
this
).
val
(
seconds
);
...
...
js/dom/setup/setup_module_container.js
浏览文件 @
011cc7b3
const
app
Instance
=
require
(
'
../../app
'
);
const
app
=
require
(
'
../../app
'
);
module
.
exports
=
()
=>
{
const
$module_container
=
$
(
'
.module_container
'
);
$module_container
.
on
(
'
mousedown
'
,
'
.module_wrapper
'
,
function
(
e
)
{
app
Instance
.
getTracerManager
().
findOwner
(
this
).
mousedown
(
e
);
app
.
getTracerManager
().
findOwner
(
this
).
mousedown
(
e
);
});
$module_container
.
on
(
'
mousemove
'
,
'
.module_wrapper
'
,
function
(
e
)
{
app
Instance
.
getTracerManager
().
findOwner
(
this
).
mousemove
(
e
);
app
.
getTracerManager
().
findOwner
(
this
).
mousemove
(
e
);
});
$module_container
.
on
(
'
DOMMouseScroll mousewheel
'
,
'
.module_wrapper
'
,
function
(
e
)
{
app
Instance
.
getTracerManager
().
findOwner
(
this
).
mousewheel
(
e
);
app
.
getTracerManager
().
findOwner
(
this
).
mousewheel
(
e
);
});
}
\ No newline at end of file
js/dom/setup/setup_scratch_paper.js
浏览文件 @
011cc7b3
const
app
=
require
(
'
../../app
'
);
const
Server
=
require
(
'
../../server
'
);
const
showAlgorithm
=
require
(
'
../show_algorithm
'
);
module
.
exports
=
()
=>
{
$
(
'
#scratch-paper
'
).
click
(
function
()
{
const
category
=
null
;
const
algorithm
=
'
scratch_paper
'
;
const
category
=
'
scratch
'
;
const
algorithm
=
app
.
getLoadedScratch
()
;
Server
.
loadAlgorithm
(
category
,
algorithm
).
then
((
data
)
=>
{
showAlgorithm
(
category
,
algorithm
,
data
);
});
...
...
js/dom/setup/setup_side_menu.js
浏览文件 @
011cc7b3
const
app
Instance
=
require
(
'
../../app
'
);
const
app
=
require
(
'
../../app
'
);
let
sidemenu_percent
;
...
...
@@ -20,6 +20,6 @@ module.exports = () => {
$workspace
.
css
(
'
left
'
,
0
);
}
app
Instance
.
getTracerManager
().
resize
();
app
.
getTracerManager
().
resize
();
});
}
\ No newline at end of file
js/dom/setup/setup_top_menu.js
浏览文件 @
011cc7b3
const
app
Instance
=
require
(
'
../../app
'
);
const
app
=
require
(
'
../../app
'
);
const
Server
=
require
(
'
../../server
'
);
const
Toast
=
require
(
'
../toast
'
);
...
...
@@ -26,26 +26,26 @@ module.exports = () => {
$
(
'
#btn_run
'
).
click
(()
=>
{
$
(
'
#btn_trace
'
).
click
();
var
err
=
app
Instance
.
getEditor
().
execute
();
var
err
=
app
.
getEditor
().
execute
();
if
(
err
)
{
console
.
error
(
err
);
Toast
.
showErrorToast
(
err
);
}
});
$
(
'
#btn_pause
'
).
click
(
function
()
{
if
(
app
Instance
.
getTracerManager
().
isPause
())
{
app
Instance
.
getTracerManager
().
resumeStep
();
if
(
app
.
getTracerManager
().
isPause
())
{
app
.
getTracerManager
().
resumeStep
();
}
else
{
app
Instance
.
getTracerManager
().
pauseStep
();
app
.
getTracerManager
().
pauseStep
();
}
});
$
(
'
#btn_prev
'
).
click
(()
=>
{
app
Instance
.
getTracerManager
().
pauseStep
();
app
Instance
.
getTracerManager
().
prevStep
();
app
.
getTracerManager
().
pauseStep
();
app
.
getTracerManager
().
prevStep
();
});
$
(
'
#btn_next
'
).
click
(()
=>
{
app
Instance
.
getTracerManager
().
pauseStep
();
app
Instance
.
getTracerManager
().
nextStep
();
app
.
getTracerManager
().
pauseStep
();
app
.
getTracerManager
().
nextStep
();
});
// description & trace
...
...
js/dom/setup/setup_window.js
浏览文件 @
011cc7b3
const
app
Instance
=
require
(
'
../../app
'
);
const
app
=
require
(
'
../../app
'
);
module
.
exports
=
function
()
{
$
(
window
).
resize
(
function
()
{
app
Instance
.
getTracerManager
().
resize
();
app
.
getTracerManager
().
resize
();
});
};
\ No newline at end of file
js/dom/show_algorithm.js
浏览文件 @
011cc7b3
'
use strict
'
;
const
appInstance
=
require
(
'
../app
'
);
const
app
=
require
(
'
../app
'
);
const
{
isScratchPaper
}
=
require
(
'
../utils
'
);
const
showDescription
=
require
(
'
./show_description
'
);
const
showFiles
=
require
(
'
./show_files
'
);
const
addFiles
=
require
(
'
./add_files
'
);
module
.
exports
=
(
category
,
algorithm
,
data
)
=>
{
module
.
exports
=
(
category
,
algorithm
,
data
,
requestedFile
)
=>
{
let
$menu
;
let
category_name
;
let
algorithm_name
;
if
(
isScratchPaper
(
category
,
algorithm
))
{
if
(
isScratchPaper
(
category
))
{
$menu
=
$
(
'
#scratch-paper
'
);
category_name
=
''
;
algorithm_name
=
'
Scratch Paper
'
;
category_name
=
'
Scratch Paper
'
;
algorithm_name
=
algorithm
?
'
Shared
'
:
'
Temporary
'
;
}
else
{
$menu
=
$
(
`[data-category="
${
category
}
"][data-algorithm="
${
algorithm
}
"]`
);
const
categoryObj
=
app
Instance
.
getCategory
(
category
);
const
categoryObj
=
app
.
getCategory
(
category
);
category_name
=
categoryObj
.
name
;
algorithm_name
=
categoryObj
.
list
[
algorithm
];
}
$
(
'
.sidemenu button
'
).
removeClass
(
'
active
'
);
$menu
.
addClass
(
'
active
'
);
$
(
'
#btn_desc
'
).
click
();
$
(
'
#category
'
).
html
(
category_name
);
$
(
'
#algorithm
'
).
html
(
algorithm_name
);
...
...
@@ -35,8 +34,8 @@ module.exports = (category, algorithm, data) => {
$
(
'
.files_bar > .wrapper
'
).
empty
();
$
(
'
#explanation
'
).
html
(
''
);
app
Instance
.
setLastFileUsed
(
null
);
app
Instance
.
getEditor
().
clearContent
();
app
.
setLastFileUsed
(
null
);
app
.
getEditor
().
clearContent
();
const
{
files
...
...
@@ -45,5 +44,5 @@ module.exports = (category, algorithm, data) => {
delete
data
.
files
;
showDescription
(
data
);
showFiles
(
category
,
algorithm
,
files
);
addFiles
(
category
,
algorithm
,
files
,
requestedFile
);
};
\ No newline at end of file
js/dom/show_requested_algorithm.js
0 → 100644
浏览文件 @
011cc7b3
'
use strict
'
;
const
Server
=
require
(
'
../server
'
);
const
showAlgorithm
=
require
(
'
./show_algorithm
'
);
module
.
exports
=
(
category
,
algorithm
,
file
)
=>
{
$
(
`.category[data-category="
${
category
}
"]`
).
click
();
Server
.
loadAlgorithm
(
category
,
algorithm
).
then
((
data
)
=>
{
showAlgorithm
(
category
,
algorithm
,
data
,
file
);
});
};
js/editor/index.js
浏览文件 @
011cc7b3
'
use strict
'
;
const
app
Instance
=
require
(
'
../app
'
);
const
app
=
require
(
'
../app
'
);
const
createEditor
=
require
(
'
./create
'
);
const
Executor
=
require
(
'
./executor
'
);
...
...
@@ -57,9 +57,9 @@ function Editor(tracerManager) {
this
.
dataEditor
.
on
(
'
change
'
,
()
=>
{
const
data
=
this
.
dataEditor
.
getValue
();
const
lastFileUsed
=
app
Instance
.
getLastFileUsed
();
const
lastFileUsed
=
app
.
getLastFileUsed
();
if
(
lastFileUsed
)
{
app
Instance
.
updateCachedFile
(
lastFileUsed
,
{
app
.
updateCachedFile
(
lastFileUsed
,
{
data
});
}
...
...
@@ -68,9 +68,9 @@ function Editor(tracerManager) {
this
.
codeEditor
.
on
(
'
change
'
,
()
=>
{
const
code
=
this
.
codeEditor
.
getValue
();
const
lastFileUsed
=
app
Instance
.
getLastFileUsed
();
const
lastFileUsed
=
app
.
getLastFileUsed
();
if
(
lastFileUsed
)
{
app
Instance
.
updateCachedFile
(
lastFileUsed
,
{
app
.
updateCachedFile
(
lastFileUsed
,
{
code
});
}
...
...
js/index.js
浏览文件 @
011cc7b3
...
...
@@ -5,7 +5,6 @@ const appInstance = require('./app');
const
AppConstructor
=
require
(
'
./app/constructor
'
);
const
DOM
=
require
(
'
./dom
'
);
const
Server
=
require
(
'
./server
'
);
const
Helpers
=
require
(
'
./server/helpers
'
);
const
modules
=
require
(
'
./module
'
);
...
...
@@ -18,8 +17,16 @@ $.ajaxSetup({
dataType
:
'
text
'
});
const
{
isScratchPaper
}
=
require
(
'
./utils
'
);
const
{
getPath
}
=
require
(
'
./server/helpers
'
);
// set global promise error handler
RSVP
.
on
(
'
error
'
,
function
(
reason
)
{
RSVP
.
on
(
'
error
'
,
function
(
reason
)
{
console
.
assert
(
false
,
reason
);
});
...
...
@@ -34,19 +41,27 @@ $(() => {
Server
.
loadCategories
().
then
((
data
)
=>
{
appInstance
.
setCategories
(
data
);
DOM
.
show
Categories
();
DOM
.
add
Categories
();
// determine if the app is loading a pre-existing scratch-pad
// or the home page
const
gistID
=
Helpers
.
getParameterByName
(
'
scratch-paper
'
);
if
(
gistID
)
{
Server
.
loadScratchPaper
(
gistID
).
then
(({
category
,
algorithm
,
data
})
=>
{
DOM
.
showAlgorithm
(
category
,
algorithm
,
data
);
});
const
{
category
,
algorithm
,
file
}
=
getPath
();
if
(
isScratchPaper
(
category
))
{
if
(
algorithm
)
{
Server
.
loadScratchPaper
(
algorithm
).
then
(({
category
,
algorithm
,
data
})
=>
{
DOM
.
showAlgorithm
(
category
,
algorithm
,
data
);
});
}
else
{
Server
.
loadAlgorithm
(
category
).
then
((
data
)
=>
{
DOM
.
showAlgorithm
(
category
,
null
,
data
);
});
}
}
else
if
(
category
&&
algorithm
)
{
DOM
.
showRequestedAlgorithm
(
category
,
algorithm
,
file
);
}
else
{
DOM
.
showFirstAlgorithm
();
}
...
...
js/server/ajax/request.js
浏览文件 @
011cc7b3
'
use strict
'
;
const
RSVP
=
require
(
'
rsvp
'
);
const
app
Instance
=
require
(
'
../../app
'
);
const
app
=
require
(
'
../../app
'
);
const
{
ajax
,
...
...
@@ -13,16 +13,16 @@ const defaults = {
};
module
.
exports
=
function
(
url
,
options
=
{})
{
app
Instance
.
setIsLoading
(
true
);
app
.
setIsLoading
(
true
);
return
new
RSVP
.
Promise
((
resolve
,
reject
)
=>
{
const
callbacks
=
{
success
(
response
)
{
app
Instance
.
setIsLoading
(
false
);
app
.
setIsLoading
(
false
);
resolve
(
response
);
},
error
(
reason
)
{
app
Instance
.
setIsLoading
(
false
);
app
.
setIsLoading
(
false
);
reject
(
reason
);
}
};
...
...
js/server/helpers.js
浏览文件 @
011cc7b3
'
use strict
'
;
const
app
Instance
=
require
(
'
../app
'
);
const
app
=
require
(
'
../app
'
);
const
Toast
=
require
(
'
../dom/toast
'
);
const
checkLoading
=
()
=>
{
if
(
app
Instance
.
getIsLoading
())
{
if
(
app
.
getIsLoading
())
{
Toast
.
showErrorToast
(
'
Wait until it completes loading of previous file.
'
);
return
true
;
}
...
...
@@ -13,7 +13,6 @@ const checkLoading = () => {
const
getParameterByName
=
(
name
)
=>
{
const
url
=
window
.
location
.
href
;
const
cleanName
=
name
.
replace
(
/
[\[\]]
/g
,
'
\\
$&
'
);
const
regex
=
new
RegExp
(
`[?&]
${
name
}
(=([^&#]*)|&|#|$)`
);
const
results
=
regex
.
exec
(
url
);
...
...
@@ -27,7 +26,79 @@ const getParameterByName = (name) => {
return
id
;
};
const
getHashValue
=
(
key
)
=>
{
if
(
!
key
)
return
null
;
const
hash
=
window
.
location
.
hash
.
substr
(
1
);
const
params
=
hash
?
hash
.
split
(
'
&
'
)
:
[];
for
(
let
i
=
0
;
i
<
params
.
length
;
i
++
)
{
const
pair
=
params
[
i
].
split
(
'
=
'
);
if
(
pair
[
0
]
===
key
)
{
return
pair
[
1
];
}
}
return
null
;
};
const
setHashValue
=
(
key
,
value
)
=>
{
if
(
!
key
||
!
value
)
return
;
const
hash
=
window
.
location
.
hash
.
substr
(
1
);
const
params
=
hash
?
hash
.
split
(
'
&
'
)
:
[];
let
found
=
false
;
for
(
let
i
=
0
;
i
<
params
.
length
&&
!
found
;
i
++
)
{
const
pair
=
params
[
i
].
split
(
'
=
'
);
if
(
pair
[
0
]
===
key
)
{
pair
[
1
]
=
value
;
params
[
i
]
=
pair
.
join
(
'
=
'
);
found
=
true
;
}
}
if
(
!
found
)
{
params
.
push
([
key
,
value
].
join
(
'
=
'
));
}
const
newHash
=
params
.
join
(
'
&
'
);
window
.
location
.
hash
=
'
#
'
+
newHash
;
};
const
removeHashValue
=
(
key
)
=>
{
if
(
!
key
)
return
;
const
hash
=
window
.
location
.
hash
.
substr
(
1
);
const
params
=
hash
?
hash
.
split
(
'
&
'
)
:
[];
for
(
let
i
=
0
;
i
<
params
.
length
;
i
++
)
{
const
pair
=
params
[
i
].
split
(
'
=
'
);
if
(
pair
[
0
]
===
key
)
{
params
.
splice
(
i
,
1
);
break
;
}
}
const
newHash
=
params
.
join
(
'
&
'
);
window
.
location
.
hash
=
'
#
'
+
newHash
;
};
const
setPath
=
(
category
,
algorithm
,
file
)
=>
{
const
path
=
category
?
category
+
(
algorithm
?
'
/
'
+
algorithm
+
(
file
?
'
/
'
+
file
:
''
)
:
''
)
:
''
;
setHashValue
(
'
path
'
,
path
);
};
const
getPath
=
()
=>
{
const
hash
=
getHashValue
(
'
path
'
);
if
(
hash
)
{
const
parts
=
hash
.
split
(
'
/
'
);
return
{
category
:
parts
[
0
],
algorithm
:
parts
[
1
],
file
:
parts
[
2
]};
}
else
{
return
false
;
}
};
module
.
exports
=
{
checkLoading
,
getParameterByName
getParameterByName
,
getHashValue
,
setHashValue
,
removeHashValue
,
setPath
,
getPath
};
\ No newline at end of file
js/server/load_algorithm.js
浏览文件 @
011cc7b3
'
use strict
'
;
const
Utils
=
require
(
'
../utils
'
);
const
getJSON
=
require
(
'
./ajax/get_json
'
);
const
{
getAlgorithmDir
}
=
require
(
'
../utils
'
);
module
.
exports
=
(
category
,
algorithm
)
=>
{
const
dir
=
Utils
.
getAlgorithmDir
(
category
,
algorithm
);
const
dir
=
getAlgorithmDir
(
category
,
algorithm
);
return
getJSON
(
`
${
dir
}
desc.json`
);
};
\ No newline at end of file
js/server/load_categories.js
浏览文件 @
011cc7b3
'
use strict
'
;
const
appInstance
=
require
(
'
../app
'
);
const
getJSON
=
require
(
'
./ajax/get_json
'
);
module
.
exports
=
()
=>
{
...
...
js/server/load_file.js
浏览文件 @
011cc7b3
...
...
@@ -2,11 +2,16 @@
const
RSVP
=
require
(
'
rsvp
'
);
const
appInstance
=
require
(
'
../app
'
);
const
Utils
=
require
(
'
../utils
'
);
const
app
=
require
(
'
../app
'
);
const
{
checkLoading
getFileDir
,
isScratchPaper
}
=
require
(
'
../utils
'
);
const
{
checkLoading
,
setPath
}
=
require
(
'
./helpers
'
);
const
get
=
require
(
'
./ajax/get
'
);
...
...
@@ -19,11 +24,11 @@ const loadDataAndCode = (dir) => {
};
const
loadFileAndUpdateContent
=
(
dir
)
=>
{
app
Instance
.
getEditor
().
clearContent
();
app
.
getEditor
().
clearContent
();
return
loadDataAndCode
(
dir
).
then
((
content
)
=>
{
app
Instance
.
updateCachedFile
(
dir
,
content
);
app
Instance
.
getEditor
().
setContent
(
content
);
app
.
updateCachedFile
(
dir
,
content
);
app
.
getEditor
().
setContent
(
content
);
});
};
...
...
@@ -35,18 +40,22 @@ const cachedContentExists = (cachedFile) => {
module
.
exports
=
(
category
,
algorithm
,
file
,
explanation
)
=>
{
return
new
RSVP
.
Promise
((
resolve
,
reject
)
=>
{
if
(
checkLoading
())
{
reject
();
}
else
{
if
(
isScratchPaper
(
category
))
{
setPath
(
category
,
app
.
getLoadedScratch
());
}
else
{
setPath
(
category
,
algorithm
,
file
);
}
$
(
'
#explanation
'
).
html
(
explanation
);
let
dir
=
Utils
.
getFileDir
(
category
,
algorithm
,
file
);
app
Instance
.
setLastFileUsed
(
dir
);
const
cachedFile
=
app
Instance
.
getCachedFile
(
dir
);
let
dir
=
getFileDir
(
category
,
algorithm
,
file
);
app
.
setLastFileUsed
(
dir
);
const
cachedFile
=
app
.
getCachedFile
(
dir
);
if
(
cachedContentExists
(
cachedFile
))
{
app
Instance
.
getEditor
().
setContent
(
cachedFile
);
app
.
getEditor
().
setContent
(
cachedFile
);
resolve
();
}
else
{
loadFileAndUpdateContent
(
dir
).
then
(
resolve
,
reject
);
...
...
js/server/load_scratch_paper.js
浏览文件 @
011cc7b3
'
use strict
'
;
const
RSVP
=
require
(
'
rsvp
'
);
const
app
=
require
(
'
../app
'
);
const
Utils
=
require
(
'
../utils
'
);
const
appInstance
=
require
(
'
../app
'
);
const
{
getFileDir
}
=
require
(
'
../utils
'
);
const
getJSON
=
require
(
'
./ajax/get_json
'
);
const
loadAlgorithm
=
require
(
'
./load_algorithm
'
);
...
...
@@ -12,12 +14,14 @@ const extractGistCode = (files, name) => files[`${name}.js`].content;
module
.
exports
=
(
gistID
)
=>
{
return
new
RSVP
.
Promise
((
resolve
,
reject
)
=>
{
app
.
setLoadedScratch
(
gistID
);
getJSON
(
`https://api.github.com/gists/
${
gistID
}
`
).
then
(({
files
})
=>
{
const
algorithm
=
'
scratch_paper
'
;
const
category
=
null
;
const
category
=
'
scratch
'
;
const
algorithm
=
gistID
;
loadAlgorithm
(
category
,
algorithm
).
then
((
data
)
=>
{
...
...
@@ -25,8 +29,8 @@ module.exports = (gistID) => {
const
algoCode
=
extractGistCode
(
files
,
'
code
'
);
// update scratch paper algo code with the loaded gist code
const
dir
=
Utils
.
getFileDir
(
category
,
algorithm
,
'
scratch_paper
'
);
app
Instance
.
updateCachedFile
(
dir
,
{
const
dir
=
getFileDir
(
category
,
algorithm
,
'
scratch_paper
'
);
app
.
updateCachedFile
(
dir
,
{
data
:
algoData
,
code
:
algoCode
,
'
CREDIT.md
'
:
'
Shared by an anonymous user from http://parkjs814.github.io/AlgorithmVisualizer
'
...
...
js/server/share_scratch_paper.js
浏览文件 @
011cc7b3
'
use strict
'
;
const
RSVP
=
require
(
'
rsvp
'
);
const
app
Instance
=
require
(
'
../app
'
);
const
app
=
require
(
'
../app
'
);
const
postJSON
=
require
(
'
./ajax/post_json
'
);
const
{
setPath
}
=
require
(
'
./helpers
'
);
module
.
exports
=
()
=>
{
return
new
RSVP
.
Promise
((
resolve
,
reject
)
=>
{
const
{
dataEditor
,
codeEditor
}
=
app
Instance
.
getEditor
();
}
=
app
.
getEditor
();
const
gist
=
{
'
description
'
:
'
temp
'
,
...
...
@@ -29,15 +33,13 @@ module.exports = () => {
postJSON
(
'
https://api.github.com/gists
'
,
gist
).
then
(({
id
})
=>
{
app
.
setLoadedScratch
(
id
);
setPath
(
'
scratch
'
,
id
);
const
{
protocol
,
host
,
pathname
href
}
=
location
;
const
url
=
`
${
protocol
}
//
${
host
}${
pathname
}
?scratch-paper=
${
id
}
`
;
resolve
(
url
);
$
(
'
#algorithm
'
).
html
(
'
Shared
'
);
resolve
(
href
);
});
});
};
\ No newline at end of file
js/utils/index.js
浏览文件 @
011cc7b3
'
use strict
'
;
const
isScratchPaper
=
(
category
,
algorithm
)
=>
{
return
category
==
=
null
&&
algorithm
===
'
scratch_paper
'
;
return
category
==
'
scratch
'
;
};
const
getAlgorithmDir
=
(
category
,
algorithm
)
=>
{
if
(
isScratchPaper
(
category
,
algorithm
))
{
return
'
./algorithm/scratch_paper/
'
;
}
if
(
isScratchPaper
(
category
))
return
'
./algorithm/scratch_paper/
'
;
return
`./algorithm/
${
category
}
/
${
algorithm
}
/`
;
};
const
getFileDir
=
(
category
,
algorithm
,
file
)
=>
{
if
(
isScratchPaper
(
category
,
algorithm
))
{
return
'
./algorithm/scratch_paper/
'
;
}
if
(
isScratchPaper
(
category
))
return
'
./algorithm/scratch_paper/
'
;
return
`./algorithm/
${
category
}
/
${
algorithm
}
/
${
file
}
/`
;
};
...
...
public/algorithm_visualizer.css
浏览文件 @
011cc7b3
...
...
@@ -220,7 +220,7 @@ nav h3 {
padding
:
0
4px
;
}
#
category
:empty
+
.nav-arrow
{
#
navigation
span
:empty
+
.nav-arrow
{
display
:
none
;
}
...
...
@@ -324,6 +324,7 @@ section {
width
:
100%
;
height
:
100%
;
visibility
:
hidden
;
overflow
:
scroll
;
}
.tab
>
.wrapper
{
...
...
public/algorithm_visualizer.js
浏览文件 @
011cc7b3
此差异已折叠。
点击以展开。
public/algorithm_visualizer.js.map
浏览文件 @
011cc7b3
此差异已折叠。
点击以展开。
public/algorithm_visualizer.min.css
浏览文件 @
011cc7b3
...
...
@@ -13,4 +13,4 @@
* "Fork me on GitHub" CSS ribbon v0.2.0 | MIT License
* https://github.com/simonwhitaker/github-fork-ribbon-css
*/
.github-fork-ribbon
{
width
:
12.1em
;
height
:
12.1em
;
position
:
absolute
;
overflow
:
hidden
;
top
:
0
;
right
:
0
;
z-index
:
9999
;
pointer-events
:
none
;
font-size
:
13px
;
text-decoration
:
none
;
text-indent
:
-999999px
}
.github-fork-ribbon.fixed
{
position
:
fixed
}
.github-fork-ribbon
:after
,
.github-fork-ribbon
:before
{
position
:
absolute
;
display
:
block
;
width
:
15.38em
;
height
:
1.54em
;
top
:
3.23em
;
right
:
-3.23em
;
-webkit-transform
:
rotate
(
45deg
);
transform
:
rotate
(
45deg
)}
.github-fork-ribbon
:before
{
content
:
""
;
padding
:
.38em
0
;
background-color
:
#a00
;
background-image
:
-webkit-gradient
(
linear
,
left
top
,
left
bottom
,
from
(
rgba
(
0
,
0
,
0
,
0
)),
to
(
rgba
(
0
,
0
,
0
,
.15
)));
background-image
:
-webkit-linear-gradient
(
top
,
rgba
(
0
,
0
,
0
,
0
),
rgba
(
0
,
0
,
0
,
.15
));
background-image
:
linear-gradient
(
to
bottom
,
rgba
(
0
,
0
,
0
,
0
),
rgba
(
0
,
0
,
0
,
.15
));
box-shadow
:
0
.15em
.23em
0
rgba
(
0
,
0
,
0
,
.5
);
pointer-events
:
auto
}
.github-fork-ribbon
:after
{
content
:
attr
(
title
);
color
:
#fff
;
font
:
700
1em
"Helvetica Neue"
,
Helvetica
,
Arial
,
sans-serif
;
line-height
:
1.54em
;
text-decoration
:
none
;
text-shadow
:
0
-.08em
rgba
(
0
,
0
,
0
,
.5
);
text-align
:
center
;
text-indent
:
0
;
padding
:
.15em
0
;
margin
:
.15em
0
;
border-width
:
.08em
0
;
border-style
:
dotted
;
border-color
:
#fff
;
border-color
:
rgba
(
255
,
255
,
255
,
.7
)}
.github-fork-ribbon.left-bottom
,
.github-fork-ribbon.left-top
{
right
:
auto
;
left
:
0
}
.github-fork-ribbon.left-bottom
,
.github-fork-ribbon.right-bottom
{
top
:
auto
;
bottom
:
0
}
.github-fork-ribbon.left-bottom
:after
,
.github-fork-ribbon.left-bottom
:before
,
.github-fork-ribbon.left-top
:after
,
.github-fork-ribbon.left-top
:before
{
right
:
auto
;
left
:
-3.23em
}
.github-fork-ribbon.left-bottom
:after
,
.github-fork-ribbon.left-bottom
:before
,
.github-fork-ribbon.right-bottom
:after
,
.github-fork-ribbon.right-bottom
:before
{
top
:
auto
;
bottom
:
3.23em
}
.github-fork-ribbon.left-top
:after
,
.github-fork-ribbon.left-top
:before
,
.github-fork-ribbon.right-bottom
:after
,
.github-fork-ribbon.right-bottom
:before
{
-webkit-transform
:
rotate
(
-45deg
);
transform
:
rotate
(
-45deg
)}
#explanation
,
.btn
,
button
{
white-space
:
nowrap
;
text-overflow
:
ellipsis
}
.tab
>
.wrapper
,
nav
,
pre
,
section
{
box-sizing
:
border-box
}
.btn
,
button
,
pre
{
margin
:
0
;
outline
:
0
}
body
,
html
{
margin
:
0
;
padding
:
0
;
overflow
:
hidden
}
body
{
background
:
#3f3f3f
;
font-family
:
Roboto
,
sans-serif
;
color
:
#bbb
;
-webkit-font-smoothing
:
subpixel-antialiased
}
::-webkit-scrollbar
{
display
:
none
}
a
{
text-decoration
:
none
}
*
{
color
:
inherit
}
:not
(
input
)
{
-webkit-touch-callout
:
none
;
-webkit-user-select
:
none
;
-moz-user-select
:
none
;
-ms-user-select
:
none
;
-o-user-select
:
none
;
user-select
:
none
}
.btn
{
display
:
inline-table
}
.btn
>
.wrapper
{
display
:
table-cell
;
vertical-align
:
middle
}
.btn
,
button
{
vertical-align
:
top
;
border
:
none
;
height
:
100%
;
padding
:
0
12px
;
background
:
0
0
;
font-size
:
12px
;
overflow
:
hidden
}
.btn
:hover
,
button
:not
([
disabled
])
:hover
{
background
:
rgba
(
0
,
0
,
0
,
.15
)
!important
;
cursor
:
pointer
}
.btn.active
,
button
.active
{
background
:
#262626
}
.btn
input
,
button
input
{
outline
:
0
;
background
:
rgba
(
0
,
0
,
0
,
.3
);
padding
:
4px
;
border
:
none
}
.divider
{
position
:
absolute
!important
;
z-index
:
3
}
.tab
,
.workspace
{
position
:
absolute
}
.divider.vertical
{
cursor
:
ew-resize
}
.divider.horizontal
{
cursor
:
ns-resize
}
nav
{
height
:
30px
;
width
:
100%
;
padding
:
0
16px
}
nav
h3
{
display
:
inline
}
.nav-arrow
{
padding
:
0
4px
}
#category
:empty
+
.nav-arrow
{
display
:
none
}
.buttons
{
float
:
right
;
height
:
100%
}
#shared
{
width
:
128px
}
#shared
.collapse
{
display
:
none
}
#interval
{
width
:
24px
;
text-align
:
right
}
.sidemenu
{
top
:
30px
;
right
:
85%
;
visibility
:
hidden
;
overflow
:
scroll
;
padding-bottom
:
120px
}
.sidemenu.active
{
visibility
:
visible
}
.sidemenu
#footer
{
border-top
:
2px
solid
#262626
}
.sidemenu
button
{
display
:
block
;
width
:
100%
;
height
:
30px
;
text-align
:
left
}
button
.category
{
background
:
rgba
(
0
,
0
,
0
,
.1
)}
button
.indent
{
padding-left
:
28px
}
button
.collapse
{
display
:
none
}
.workspace
{
top
:
30px
;
bottom
:
0
;
left
:
15%
;
right
:
0
}
.editor_container
,
.viewer_container
,
nav
,
section
{
position
:
absolute
;
top
:
0
;
bottom
:
0
;
left
:
0
;
right
:
0
}
nav
,
section
{
border
:
1px
solid
#262626
}
.viewer_container
{
right
:
50%
}
.editor_container
{
left
:
50%
}
.module_container
{
overflow
:
hidden
;
border
:
none
}
.tab_container
{
top
:
30px
}
.tab
{
width
:
100%
;
height
:
100%
;
visibility
:
hidden
}
.tab
>
.wrapper
{
padding
:
16px
}
.tab.active
{
visibility
:
visible
}
.module_wrapper
{
overflow
:
scroll
}
.module_wrapper
.name
{
position
:
fixed
;
z-index
:
5
;
padding
:
4px
;
font-size
:
14px
;
background
:
rgba
(
0
,
0
,
0
,
.4
)}
.module_wrapper
>
.wrapper
{
padding
:
24px
16px
;
box-sizing
:
border-box
}
#tab_desc
h3
{
border-bottom
:
1px
solid
#515151
;
padding
:
5px
;
margin
:
2px
}
#tab_desc
>
.wrapper
a
{
text-decoration
:
underline
}
.files_bar
,
.tab_bar
{
height
:
30px
}
.files_bar
>*
{
position
:
absolute
;
height
:
100%
}
.files_bar
>
button
{
width
:
30px
}
.files_bar
>
button
:disabled
{
background
:
rgba
(
0
,
0
,
0
,
.15
)}
.files_bar
>
.btn-left
{
left
:
0
}
.files_bar
>
.btn-right
{
right
:
0
}
.files_bar
>
.wrapper
{
left
:
30px
;
right
:
30px
;
overflow
:
scroll
;
white-space
:
nowrap
}
.files_bar
>
.wrapper
>
button
{
max-width
:
80%
}
.files_bar
>
.wrapper.shadow-left
{
box-shadow
:
inset
16px
0
16px
-16px
rgba
(
0
,
0
,
0
,
.6
)}
.files_bar
>
.wrapper.shadow-right
{
box-shadow
:
inset
-16px
0
16px
-16px
rgba
(
0
,
0
,
0
,
.6
)}
.files_bar
>
.wrapper.shadow-left.shadow-right
{
box-shadow
:
inset
16px
0
16px
-16px
rgba
(
0
,
0
,
0
,
.6
),
inset
-16px
0
16px
-16px
rgba
(
0
,
0
,
0
,
.6
)}
.explanation_container
{
border
:
none
;
top
:
30px
;
height
:
30px
;
background
:
#262626
;
padding
:
8px
;
font-size
:
12px
}
#explanation
:before
{
font-family
:
FontAwesome
;
content
:
'\f05a\00a0\00a0'
}
#explanation
{
display
:
block
;
overflow
:
hidden
}
.explanation_container
:hover
{
z-index
:
5
;
height
:
auto
;
bottom
:
auto
;
box-shadow
:
0
8px
8px
-8px
rgba
(
0
,
0
,
0
,
.8
)}
.explanation_container
:hover
#explanation
{
white-space
:
normal
}
.data_container
{
top
:
60px
;
bottom
:
60%
}
.code_container
{
top
:
40%
}
pre
{
height
:
100%
;
width
:
100%
;
padding
:
0
;
border
:
1px
solid
#515151
;
background
:
#2b2b2b
;
resize
:
none
}
.toast_container
{
position
:
absolute
;
bottom
:
0
;
right
:
0
;
padding
:
12px
;
z-index
:
4
}
.toast
{
width
:
280px
;
border
:
1px
solid
;
border-radius
:
4px
;
padding
:
16px
;
margin
:
16px
}
.toast.error
{
border-color
:
#960000
;
background
:
rgba
(
120
,
0
,
0
,
.8
)}
.toast.info
{
border-color
:
#009600
;
background
:
rgba
(
0
,
120
,
0
,
.8
)}
.github-fork-ribbon
{
position
:
fixed
}
.github-fork-ribbon.left-bottom
:before
{
background-color
:
#333
}
.fa-spin-faster
{
-webkit-animation
:
fa-spin
1s
infinite
ease-in-out
;
animation
:
fa-spin
1s
infinite
ease-in-out
}
.mtbl-wrapper
{
width
:
100%
;
height
:
100%
}
.mtbl-table
{
display
:
inline-table
;
color
:
#fff
;
table-layout
:
fixed
}
.mtbl-row
{
display
:
table-row
}
.mtbl-col
{
display
:
table-cell
;
vertical-align
:
middle
;
text-align
:
center
;
background
:
#888
}
.mtbl-empty-row
{
display
:
table-row
;
background
:
#3f3f3f
;
height
:
2px
}
.mtbl-empty-col
{
display
:
table-cell
;
background
:
#3f3f3f
;
width
:
2px
}
#loading-slider
,
.line
{
width
:
100%
;
position
:
absolute
}
.mtbl-col.selected
{
background
:
#00f
}
.mtbl-col.notified
{
background
:
red
}
#loading-slider
{
height
:
2px
}
#loading-slider
.loaded
{
visibility
:
hidden
}
.line
{
background
:
#4a8df8
;
left
:
0
;
right
:
0
;
top
:
0
;
height
:
3px
}
.break
{
position
:
absolute
;
background
:
#222
;
width
:
6px
;
height
:
2px
}
.dot1
{
-webkit-animation
:
loading
2s
infinite
;
animation
:
loading
2s
infinite
}
.dot2
{
-webkit-animation
:
loading
2s
.5s
infinite
;
animation
:
loading
2s
.5s
infinite
}
.dot3
{
-webkit-animation
:
loading
2s
1s
infinite
;
animation
:
loading
2s
1s
infinite
}
@-webkit-keyframes
loading
{
from
{
left
:
0
}
to
{
left
:
100%
}}
@keyframes
loading
{
from
{
left
:
0
}
to
{
left
:
100%
}}
input
[
type
=
number
]
::-webkit-inner-spin-button
,
input
[
type
=
number
]
::-webkit-outer-spin-button
{
-webkit-appearance
:
none
;
margin
:
0
}
\ No newline at end of file
#explanation
,
.btn
,
button
{
white-space
:
nowrap
;
text-overflow
:
ellipsis
}
.tab
>
.wrapper
,
nav
,
pre
,
section
{
box-sizing
:
border-box
}
.btn
,
button
,
pre
{
margin
:
0
;
outline
:
0
}
body
,
html
{
margin
:
0
;
padding
:
0
;
overflow
:
hidden
}
body
{
background
:
#3f3f3f
;
font-family
:
Roboto
,
sans-serif
;
color
:
#bbb
;
-webkit-font-smoothing
:
subpixel-antialiased
}
::-webkit-scrollbar
{
display
:
none
}
a
{
text-decoration
:
none
}
*
{
color
:
inherit
}
:not
(
input
)
{
-webkit-touch-callout
:
none
;
-webkit-user-select
:
none
;
-moz-user-select
:
none
;
-ms-user-select
:
none
;
-o-user-select
:
none
;
user-select
:
none
}
.btn
{
display
:
inline-table
}
.btn
>
.wrapper
{
display
:
table-cell
;
vertical-align
:
middle
}
.btn
,
button
{
vertical-align
:
top
;
border
:
none
;
height
:
100%
;
padding
:
0
12px
;
background
:
0
0
;
font-size
:
12px
;
overflow
:
hidden
}
.btn
:hover
,
button
:not
([
disabled
])
:hover
{
background
:
rgba
(
0
,
0
,
0
,
.15
)
!important
;
cursor
:
pointer
}
.btn.active
,
button
.active
{
background
:
#262626
}
.btn
input
,
button
input
{
outline
:
0
;
background
:
rgba
(
0
,
0
,
0
,
.3
);
padding
:
4px
;
border
:
none
}
.divider
{
position
:
absolute
!important
;
z-index
:
3
}
.tab
,
.workspace
{
position
:
absolute
}
.divider.vertical
{
cursor
:
ew-resize
}
.divider.horizontal
{
cursor
:
ns-resize
}
nav
{
height
:
30px
;
width
:
100%
;
padding
:
0
16px
}
nav
h3
{
display
:
inline
}
.nav-arrow
{
padding
:
0
4px
}
#navigation
span
:empty
+
.nav-arrow
{
display
:
none
}
.buttons
{
float
:
right
;
height
:
100%
}
#shared
{
width
:
128px
}
#shared
.collapse
{
display
:
none
}
#interval
{
width
:
24px
;
text-align
:
right
}
.sidemenu
{
top
:
30px
;
right
:
85%
;
visibility
:
hidden
;
overflow
:
scroll
;
padding-bottom
:
120px
}
.sidemenu.active
{
visibility
:
visible
}
.sidemenu
#footer
{
border-top
:
2px
solid
#262626
}
.sidemenu
button
{
display
:
block
;
width
:
100%
;
height
:
30px
;
text-align
:
left
}
button
.category
{
background
:
rgba
(
0
,
0
,
0
,
.1
)}
button
.indent
{
padding-left
:
28px
}
button
.collapse
{
display
:
none
}
.workspace
{
top
:
30px
;
bottom
:
0
;
left
:
15%
;
right
:
0
}
.editor_container
,
.viewer_container
,
nav
,
section
{
position
:
absolute
;
top
:
0
;
bottom
:
0
;
left
:
0
;
right
:
0
}
nav
,
section
{
border
:
1px
solid
#262626
}
.viewer_container
{
right
:
50%
}
.editor_container
{
left
:
50%
}
.module_container
{
overflow
:
hidden
;
border
:
none
}
.module_wrapper
,
.tab
{
overflow
:
scroll
}
.tab_container
{
top
:
30px
}
.tab
{
width
:
100%
;
height
:
100%
;
visibility
:
hidden
}
.tab
>
.wrapper
{
padding
:
16px
}
.tab.active
{
visibility
:
visible
}
.module_wrapper
.name
{
position
:
fixed
;
z-index
:
5
;
padding
:
4px
;
font-size
:
14px
;
background
:
rgba
(
0
,
0
,
0
,
.4
)}
.module_wrapper
>
.wrapper
{
padding
:
24px
16px
;
box-sizing
:
border-box
}
#tab_desc
h3
{
border-bottom
:
1px
solid
#515151
;
padding
:
5px
;
margin
:
2px
}
#tab_desc
>
.wrapper
a
{
text-decoration
:
underline
}
.files_bar
,
.tab_bar
{
height
:
30px
}
.files_bar
>*
{
position
:
absolute
;
height
:
100%
}
.files_bar
>
button
{
width
:
30px
}
.files_bar
>
button
:disabled
{
background
:
rgba
(
0
,
0
,
0
,
.15
)}
.files_bar
>
.btn-left
{
left
:
0
}
.files_bar
>
.btn-right
{
right
:
0
}
.files_bar
>
.wrapper
{
left
:
30px
;
right
:
30px
;
overflow
:
scroll
;
white-space
:
nowrap
}
.files_bar
>
.wrapper
>
button
{
max-width
:
80%
}
.files_bar
>
.wrapper.shadow-left
{
box-shadow
:
inset
16px
0
16px
-16px
rgba
(
0
,
0
,
0
,
.6
)}
.files_bar
>
.wrapper.shadow-right
{
box-shadow
:
inset
-16px
0
16px
-16px
rgba
(
0
,
0
,
0
,
.6
)}
.files_bar
>
.wrapper.shadow-left.shadow-right
{
box-shadow
:
inset
16px
0
16px
-16px
rgba
(
0
,
0
,
0
,
.6
),
inset
-16px
0
16px
-16px
rgba
(
0
,
0
,
0
,
.6
)}
.explanation_container
{
border
:
none
;
top
:
30px
;
height
:
30px
;
background
:
#262626
;
padding
:
8px
;
font-size
:
12px
}
#explanation
:before
{
font-family
:
FontAwesome
;
content
:
'\f05a\00a0\00a0'
}
#explanation
{
display
:
block
;
overflow
:
hidden
}
.explanation_container
:hover
{
z-index
:
5
;
height
:
auto
;
bottom
:
auto
;
box-shadow
:
0
8px
8px
-8px
rgba
(
0
,
0
,
0
,
.8
)}
.explanation_container
:hover
#explanation
{
white-space
:
normal
}
.data_container
{
top
:
60px
;
bottom
:
60%
}
.code_container
{
top
:
40%
}
pre
{
height
:
100%
;
width
:
100%
;
padding
:
0
;
border
:
1px
solid
#515151
;
background
:
#2b2b2b
;
resize
:
none
}
.toast_container
{
position
:
absolute
;
bottom
:
0
;
right
:
0
;
padding
:
12px
;
z-index
:
4
}
.toast
{
width
:
280px
;
border
:
1px
solid
;
border-radius
:
4px
;
padding
:
16px
;
margin
:
16px
}
.toast.error
{
border-color
:
#960000
;
background
:
rgba
(
120
,
0
,
0
,
.8
)}
.toast.info
{
border-color
:
#009600
;
background
:
rgba
(
0
,
120
,
0
,
.8
)}
.github-fork-ribbon
{
position
:
fixed
}
.github-fork-ribbon.left-bottom
:before
{
background-color
:
#333
}
.fa-spin-faster
{
-webkit-animation
:
fa-spin
1s
infinite
ease-in-out
;
animation
:
fa-spin
1s
infinite
ease-in-out
}
.mtbl-wrapper
{
width
:
100%
;
height
:
100%
}
.mtbl-table
{
display
:
inline-table
;
color
:
#fff
;
table-layout
:
fixed
}
.mtbl-row
{
display
:
table-row
}
.mtbl-col
{
display
:
table-cell
;
vertical-align
:
middle
;
text-align
:
center
;
background
:
#888
}
.mtbl-empty-row
{
display
:
table-row
;
background
:
#3f3f3f
;
height
:
2px
}
.mtbl-empty-col
{
display
:
table-cell
;
background
:
#3f3f3f
;
width
:
2px
}
#loading-slider
,
.line
{
width
:
100%
;
position
:
absolute
}
.mtbl-col.selected
{
background
:
#00f
}
.mtbl-col.notified
{
background
:
red
}
#loading-slider
{
height
:
2px
}
#loading-slider
.loaded
{
visibility
:
hidden
}
.line
{
background
:
#4a8df8
;
left
:
0
;
right
:
0
;
top
:
0
;
height
:
3px
}
.break
{
position
:
absolute
;
background
:
#222
;
width
:
6px
;
height
:
2px
}
.dot1
{
-webkit-animation
:
loading
2s
infinite
;
animation
:
loading
2s
infinite
}
.dot2
{
-webkit-animation
:
loading
2s
.5s
infinite
;
animation
:
loading
2s
.5s
infinite
}
.dot3
{
-webkit-animation
:
loading
2s
1s
infinite
;
animation
:
loading
2s
1s
infinite
}
@-webkit-keyframes
loading
{
from
{
left
:
0
}
to
{
left
:
100%
}}
@keyframes
loading
{
from
{
left
:
0
}
to
{
left
:
100%
}}
input
[
type
=
number
]
::-webkit-inner-spin-button
,
input
[
type
=
number
]
::-webkit-outer-spin-button
{
-webkit-appearance
:
none
;
margin
:
0
}
\ No newline at end of file
public/algorithm_visualizer.min.js
浏览文件 @
011cc7b3
此差异已折叠。
点击以展开。
public/algorithm_visualizer.min.js.map
浏览文件 @
011cc7b3
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录