Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
30ea58da
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
30ea58da
编写于
12月 19, 2017
作者:
P
Phil Hughes
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Changed layout_nav to ES module
上级
888ed309
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
33 addition
and
42 deletion
+33
-42
app/assets/javascripts/layout_nav.js
app/assets/javascripts/layout_nav.js
+31
-39
app/assets/javascripts/main.js
app/assets/javascripts/main.js
+2
-3
未找到文件。
app/assets/javascripts/layout_nav.js
浏览文件 @
30ea58da
/* eslint-disable func-names, space-before-function-paren, no-var, prefer-arrow-callback, no-unused-vars, one-var, one-var-declaration-per-line, vars-on-top, max-len */
import
_
from
'
underscore
'
;
import
Cookies
from
'
js-cookie
'
;
import
ContextualSidebar
from
'
./contextual_sidebar
'
;
import
ContextualSidebar
from
'
./contextual_sidebar
'
;
import
initFlyOutNav
from
'
./fly_out_nav
'
;
import
initFlyOutNav
from
'
./fly_out_nav
'
;
(
function
()
{
function
hideEndFade
(
$scrollingTabs
)
{
var
hideEndFade
;
$scrollingTabs
.
each
(
function
scrollTabsLoop
()
{
const
$this
=
$
(
this
);
$this
.
siblings
(
'
.fade-right
'
).
toggleClass
(
'
scrolling
'
,
$this
.
width
()
<
$this
.
prop
(
'
scrollWidth
'
));
});
}
hideEndFade
=
function
(
$scrollingTabs
)
{
export
default
function
initLayoutNav
()
{
return
$scrollingTabs
.
each
(
function
()
{
const
contextualSidebar
=
new
ContextualSidebar
();
var
$this
;
contextualSidebar
.
bindEvents
();
$this
=
$
(
this
);
return
$this
.
siblings
(
'
.fade-right
'
).
toggleClass
(
'
scrolling
'
,
$this
.
width
()
<
$this
.
prop
(
'
scrollWidth
'
));
initFlyOutNav
();
});
};
$
(
document
).
on
(
'
init.scrolling-tabs
'
,
()
=>
{
$
(
document
).
on
(
'
init.scrolling-tabs
'
,
()
=>
{
const
$scrollingTabs
=
$
(
'
.scrolling-tabs
'
).
not
(
'
.is-initialized
'
);
const
$scrollingTabs
=
$
(
'
.scrolling-tabs
'
).
not
(
'
.is-initialized
'
);
$scrollingTabs
.
addClass
(
'
is-initialized
'
);
$scrollingTabs
.
addClass
(
'
is-initialized
'
);
hideEndFade
(
$scrollingTabs
);
$
(
window
).
on
(
'
resize.nav
'
,
()
=>
{
$
(
window
).
off
(
'
resize.nav
'
).
on
(
'
resize.nav
'
,
function
()
{
hideEndFade
(
$scrollingTabs
);
return
hideEndFade
(
$scrollingTabs
);
}).
trigger
(
'
resize.nav
'
);
});
$scrollingTabs
.
o
ff
(
'
scroll
'
).
on
(
'
scroll
'
,
function
(
event
)
{
$scrollingTabs
.
o
n
(
'
scroll
'
,
function
tabsScrollEvent
(
)
{
var
$this
,
currentPosition
,
maxPosition
;
const
$this
=
$
(
this
)
;
$this
=
$
(
this
);
const
currentPosition
=
$this
.
scrollLeft
(
);
c
urrentPosition
=
$this
.
scrollLeft
();
c
onst
maxPosition
=
$this
.
prop
(
'
scrollWidth
'
)
-
$this
.
outerWidth
();
maxPosition
=
$this
.
prop
(
'
scrollWidth
'
)
-
$this
.
outerWidth
();
$this
.
siblings
(
'
.fade-left
'
).
toggleClass
(
'
scrolling
'
,
currentPosition
>
0
);
$this
.
siblings
(
'
.fade-left
'
).
toggleClass
(
'
scrolling
'
,
currentPosition
>
0
);
return
$this
.
siblings
(
'
.fade-right
'
).
toggleClass
(
'
scrolling
'
,
currentPosition
<
maxPosition
-
1
);
$this
.
siblings
(
'
.fade-right
'
).
toggleClass
(
'
scrolling
'
,
currentPosition
<
maxPosition
-
1
);
});
});
$scrollingTabs
.
each
(
function
()
{
$scrollingTabs
.
each
(
function
scrollTabsEachLoop
()
{
var
$this
=
$
(
this
);
const
$this
=
$
(
this
);
var
scrollingTabWidth
=
$this
.
width
();
const
scrollingTabWidth
=
$this
.
width
();
var
$active
=
$this
.
find
(
'
.active
'
);
const
$active
=
$this
.
find
(
'
.active
'
);
var
activeWidth
=
$active
.
width
();
const
activeWidth
=
$active
.
width
();
if
(
$active
.
length
)
{
if
(
$active
.
length
)
{
var
offset
=
$active
.
offset
().
left
+
activeWidth
;
const
offset
=
$active
.
offset
().
left
+
activeWidth
;
if
(
offset
>
scrollingTabWidth
-
30
)
{
if
(
offset
>
scrollingTabWidth
-
30
)
{
var
scrollLeft
=
scrollingTabWidth
/
2
;
const
scrollLeft
=
(
offset
-
(
scrollingTabWidth
/
2
))
-
(
activeWidth
/
2
)
;
scrollLeft
=
(
offset
-
scrollLeft
)
-
(
activeWidth
/
2
);
$this
.
scrollLeft
(
scrollLeft
);
$this
.
scrollLeft
(
scrollLeft
);
}
}
}
}
});
});
});
}).
trigger
(
'
init.scrolling-tabs
'
);
}
$
(()
=>
{
const
contextualSidebar
=
new
ContextualSidebar
();
contextualSidebar
.
bindEvents
();
initFlyOutNav
();
});
}).
call
(
window
);
app/assets/javascripts/main.js
浏览文件 @
30ea58da
...
@@ -41,7 +41,7 @@ import Flash, { removeFlashClickListener } from './flash';
...
@@ -41,7 +41,7 @@ import Flash, { removeFlashClickListener } from './flash';
import
'
./gl_dropdown
'
;
import
'
./gl_dropdown
'
;
import
initTodoToggle
from
'
./header
'
;
import
initTodoToggle
from
'
./header
'
;
import
initImporterStatus
from
'
./importer_status
'
;
import
initImporterStatus
from
'
./importer_status
'
;
import
'
./layout_nav
'
;
import
initLayoutNav
from
'
./layout_nav
'
;
import
LazyLoader
from
'
./lazy_loader
'
;
import
LazyLoader
from
'
./lazy_loader
'
;
import
'
./line_highlighter
'
;
import
'
./line_highlighter
'
;
import
initLogoAnimation
from
'
./logo
'
;
import
initLogoAnimation
from
'
./logo
'
;
...
@@ -89,6 +89,7 @@ $(function () {
...
@@ -89,6 +89,7 @@ $(function () {
var
fitSidebarForSize
;
var
fitSidebarForSize
;
initBreadcrumbs
();
initBreadcrumbs
();
initLayoutNav
();
initImporterStatus
();
initImporterStatus
();
initTodoToggle
();
initTodoToggle
();
initLogoAnimation
();
initLogoAnimation
();
...
@@ -261,8 +262,6 @@ $(function () {
...
@@ -261,8 +262,6 @@ $(function () {
renderTimeago
();
renderTimeago
();
$
(
document
).
trigger
(
'
init.scrolling-tabs
'
);
$
(
'
form.filter-form
'
).
on
(
'
submit
'
,
function
(
event
)
{
$
(
'
form.filter-form
'
).
on
(
'
submit
'
,
function
(
event
)
{
const
link
=
document
.
createElement
(
'
a
'
);
const
link
=
document
.
createElement
(
'
a
'
);
link
.
href
=
this
.
action
;
link
.
href
=
this
.
action
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录