Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
4786a978
Commit
4786a978
authored
Dec 13, 2016
by
Clement Ho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix es6 errors
parent
3d18319e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
68 additions
and
37 deletions
+68
-37
app/assets/javascripts/droplab/droplab.js
app/assets/javascripts/droplab/droplab.js
+66
-35
app/assets/javascripts/droplab/droplab_ajax_filter.js
app/assets/javascripts/droplab/droplab_ajax_filter.js
+1
-1
app/assets/javascripts/lib/utils/common_utils.js.es6
app/assets/javascripts/lib/utils/common_utils.js.es6
+1
-1
No files found.
app/assets/javascripts/droplab/droplab.js
View file @
4786a978
// Determine where to place this
if
(
typeof
Object
.
assign
!=
'
function
'
)
{
Object
.
assign
=
function
(
target
,
varArgs
)
{
// .length of function is 2
'
use strict
'
;
if
(
target
==
null
)
{
// TypeError if undefined or null
throw
new
TypeError
(
'
Cannot convert undefined or null to object
'
);
}
var
to
=
Object
(
target
);
for
(
var
index
=
1
;
index
<
arguments
.
length
;
index
++
)
{
var
nextSource
=
arguments
[
index
];
if
(
nextSource
!=
null
)
{
// Skip over if undefined or null
for
(
var
nextKey
in
nextSource
)
{
// Avoid bugs when hasOwnProperty is shadowed
if
(
Object
.
prototype
.
hasOwnProperty
.
call
(
nextSource
,
nextKey
))
{
to
[
nextKey
]
=
nextSource
[
nextKey
];
}
}
}
}
return
to
;
};
}
/* eslint-disable */
/* eslint-disable */
(
function
(
f
){
if
(
typeof
exports
===
"
object
"
&&
typeof
module
!==
"
undefined
"
){
module
.
exports
=
f
()}
else
if
(
typeof
define
===
"
function
"
&&
define
.
amd
){
define
([],
f
)}
else
{
var
g
;
if
(
typeof
window
!==
"
undefined
"
){
g
=
window
}
else
if
(
typeof
global
!==
"
undefined
"
){
g
=
global
}
else
if
(
typeof
self
!==
"
undefined
"
){
g
=
self
}
else
{
g
=
this
}
g
.
droplab
=
f
()}})(
function
(){
var
define
,
module
,
exports
;
return
(
function
e
(
t
,
n
,
r
){
function
s
(
o
,
u
){
if
(
!
n
[
o
]){
if
(
!
t
[
o
]){
var
a
=
typeof
require
==
"
function
"
&&
require
;
if
(
!
u
&&
a
)
return
a
(
o
,
!
0
);
if
(
i
)
return
i
(
o
,
!
0
);
var
f
=
new
Error
(
"
Cannot find module '
"
+
o
+
"
'
"
);
throw
f
.
code
=
"
MODULE_NOT_FOUND
"
,
f
}
var
l
=
n
[
o
]
=
{
exports
:{}};
t
[
o
][
0
].
call
(
l
.
exports
,
function
(
e
){
var
n
=
t
[
o
][
1
][
e
];
return
s
(
n
?
n
:
e
)},
l
,
l
.
exports
,
e
,
t
,
n
,
r
)}
return
n
[
o
].
exports
}
var
i
=
typeof
require
==
"
function
"
&&
require
;
for
(
var
o
=
0
;
o
<
r
.
length
;
o
++
)
s
(
r
[
o
]);
return
s
})({
1
:[
function
(
require
,
module
,
exports
){
(
function
(
f
){
if
(
typeof
exports
===
"
object
"
&&
typeof
module
!==
"
undefined
"
){
module
.
exports
=
f
()}
else
if
(
typeof
define
===
"
function
"
&&
define
.
amd
){
define
([],
f
)}
else
{
var
g
;
if
(
typeof
window
!==
"
undefined
"
){
g
=
window
}
else
if
(
typeof
global
!==
"
undefined
"
){
g
=
global
}
else
if
(
typeof
self
!==
"
undefined
"
){
g
=
self
}
else
{
g
=
this
}
g
.
droplab
=
f
()}})(
function
(){
var
define
,
module
,
exports
;
return
(
function
e
(
t
,
n
,
r
){
function
s
(
o
,
u
){
if
(
!
n
[
o
]){
if
(
!
t
[
o
]){
var
a
=
typeof
require
==
"
function
"
&&
require
;
if
(
!
u
&&
a
)
return
a
(
o
,
!
0
);
if
(
i
)
return
i
(
o
,
!
0
);
var
f
=
new
Error
(
"
Cannot find module '
"
+
o
+
"
'
"
);
throw
f
.
code
=
"
MODULE_NOT_FOUND
"
,
f
}
var
l
=
n
[
o
]
=
{
exports
:{}};
t
[
o
][
0
].
call
(
l
.
exports
,
function
(
e
){
var
n
=
t
[
o
][
1
][
e
];
return
s
(
n
?
n
:
e
)},
l
,
l
.
exports
,
e
,
t
,
n
,
r
)}
return
n
[
o
].
exports
}
var
i
=
typeof
require
==
"
function
"
&&
require
;
for
(
var
o
=
0
;
o
<
r
.
length
;
o
++
)
s
(
r
[
o
]);
return
s
})({
1
:[
function
(
require
,
module
,
exports
){
var
DATA_TRIGGER
=
'
data-dropdown-trigger
'
;
var
DATA_TRIGGER
=
'
data-dropdown-trigger
'
;
...
@@ -96,20 +122,23 @@ Object.assign(DropDown.prototype, {
...
@@ -96,20 +122,23 @@ Object.assign(DropDown.prototype, {
var
newChildren
=
[];
var
newChildren
=
[];
var
toAppend
;
var
toAppend
;
this
.
items
.
forEach
(
function
(
item
)
{
for
(
var
i
=
0
;
i
<
this
.
items
.
length
;
i
++
)
{
var
item
=
this
.
items
[
i
];
sampleItem
=
item
;
sampleItem
=
item
;
if
(
item
.
parentNode
&&
item
.
parentNode
.
dataset
.
hasOwnProperty
(
'
dynamic
'
))
{
if
(
item
.
parentNode
&&
item
.
parentNode
.
dataset
.
hasOwnProperty
(
'
dynamic
'
))
{
item
.
parentNode
.
removeChild
(
item
);
item
.
parentNode
.
removeChild
(
item
);
}
}
}
);
}
newChildren
=
this
.
data
.
map
(
function
(
dat
){
newChildren
=
this
.
data
.
map
(
function
(
dat
){
var
html
=
utils
.
t
(
sampleItem
.
outerHTML
,
dat
);
var
html
=
utils
.
t
(
sampleItem
.
outerHTML
,
dat
);
var
template
=
document
.
createElement
(
'
template
'
);
var
template
=
document
.
createElement
(
'
div
'
);
template
.
innerHTML
=
html
;
template
.
innerHTML
=
html
;
// console.log(template.content)
// Help set the image src template
// Help set the image src template
var
imageTags
=
template
.
content
.
querySelectorAll
(
'
img[data-src]
'
);
var
imageTags
=
template
.
querySelectorAll
(
'
img[data-src]
'
);
// debugger
for
(
var
i
=
0
;
i
<
imageTags
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
imageTags
.
length
;
i
++
)
{
var
imageTag
=
imageTags
[
i
];
var
imageTag
=
imageTags
[
i
];
imageTag
.
src
=
imageTag
.
getAttribute
(
'
data-src
'
);
imageTag
.
src
=
imageTag
.
getAttribute
(
'
data-src
'
);
...
@@ -117,11 +146,11 @@ Object.assign(DropDown.prototype, {
...
@@ -117,11 +146,11 @@ Object.assign(DropDown.prototype, {
}
}
if
(
dat
.
hasOwnProperty
(
'
droplab_hidden
'
)
&&
dat
.
droplab_hidden
){
if
(
dat
.
hasOwnProperty
(
'
droplab_hidden
'
)
&&
dat
.
droplab_hidden
){
template
.
content
.
firstChild
.
style
.
display
=
'
none
'
template
.
firstChild
.
style
.
display
=
'
none
'
}
else
{
}
else
{
template
.
content
.
firstChild
.
style
.
display
=
'
block
'
;
template
.
firstChild
.
style
.
display
=
'
block
'
;
}
}
return
template
.
content
.
firstChild
.
outerHTML
;
return
template
.
firstChild
.
outerHTML
;
});
});
toAppend
=
this
.
list
.
querySelector
(
'
ul[data-dynamic]
'
);
toAppend
=
this
.
list
.
querySelector
(
'
ul[data-dynamic]
'
);
if
(
toAppend
)
{
if
(
toAppend
)
{
...
@@ -200,9 +229,9 @@ require('./window')(function(w){
...
@@ -200,9 +229,9 @@ require('./window')(function(w){
},
},
destroy
:
function
()
{
destroy
:
function
()
{
this
.
hooks
.
forEach
(
function
(
h
)
{
for
(
var
i
=
0
;
i
<
this
.
hooks
.
length
;
i
++
)
{
h
.
destroy
();
this
.
hooks
[
i
]
.
destroy
();
}
);
}
this
.
hooks
=
[];
this
.
hooks
=
[];
this
.
removeEvents
();
this
.
removeEvents
();
},
},
...
@@ -225,13 +254,14 @@ require('./window')(function(w){
...
@@ -225,13 +254,14 @@ require('./window')(function(w){
},
},
_processData
:
function
(
trigger
,
data
,
methodName
)
{
_processData
:
function
(
trigger
,
data
,
methodName
)
{
this
.
hooks
.
forEach
(
function
(
hook
)
{
for
(
var
i
=
0
;
i
<
this
.
hooks
.
length
;
i
++
)
{
var
hook
=
this
.
hooks
[
i
];
if
(
hook
.
trigger
.
dataset
.
hasOwnProperty
(
'
id
'
))
{
if
(
hook
.
trigger
.
dataset
.
hasOwnProperty
(
'
id
'
))
{
if
(
hook
.
trigger
.
dataset
.
id
===
trigger
)
{
if
(
hook
.
trigger
.
dataset
.
id
===
trigger
)
{
hook
.
list
[
methodName
](
data
);
hook
.
list
[
methodName
](
data
);
}
}
}
}
}
);
}
},
},
addEvents
:
function
()
{
addEvents
:
function
()
{
...
@@ -244,9 +274,9 @@ require('./window')(function(w){
...
@@ -244,9 +274,9 @@ require('./window')(function(w){
}
}
if
(
utils
.
isDropDownParts
(
thisTag
)){
return
}
if
(
utils
.
isDropDownParts
(
thisTag
)){
return
}
if
(
utils
.
isDropDownParts
(
e
.
target
)){
return
}
if
(
utils
.
isDropDownParts
(
e
.
target
)){
return
}
self
.
hooks
.
forEach
(
function
(
hook
)
{
for
(
var
i
=
0
;
i
<
self
.
hooks
.
length
;
i
++
)
{
hook
.
list
.
hide
();
self
.
hooks
[
i
]
.
list
.
hide
();
}
);
}
}.
bind
(
this
);
}.
bind
(
this
);
w
.
addEventListener
(
'
click
'
,
this
.
windowClickedWrapper
);
w
.
addEventListener
(
'
click
'
,
this
.
windowClickedWrapper
);
},
},
...
@@ -289,9 +319,10 @@ require('./window')(function(w){
...
@@ -289,9 +319,10 @@ require('./window')(function(w){
},
},
addHooks
:
function
(
hooks
,
plugins
,
config
)
{
addHooks
:
function
(
hooks
,
plugins
,
config
)
{
hooks
.
forEach
(
function
(
hook
)
{
for
(
var
i
=
0
;
i
<
hooks
.
length
;
i
++
)
{
var
hook
=
hooks
[
i
];
this
.
addHook
(
hook
,
null
,
plugins
,
config
);
this
.
addHook
(
hook
,
null
,
plugins
,
config
);
}
.
bind
(
this
));
}
return
this
;
return
this
;
},
},
...
@@ -308,9 +339,9 @@ require('./window')(function(w){
...
@@ -308,9 +339,9 @@ require('./window')(function(w){
});
});
window
.
dispatchEvent
(
readyEvent
);
window
.
dispatchEvent
(
readyEvent
);
this
.
ready
=
true
;
this
.
ready
=
true
;
this
.
queuedData
.
forEach
(
function
(
args
)
{
for
(
var
i
=
0
;
i
<
this
.
queuedData
.
length
;
i
++
)
{
this
.
addData
.
apply
(
this
,
args
);
this
.
addData
.
apply
(
this
,
this
.
queuedData
[
i
]
);
}
.
bind
(
this
));
}
this
.
queuedData
=
[];
this
.
queuedData
=
[];
return
this
;
return
this
;
},
},
...
@@ -358,9 +389,9 @@ HookButton.prototype = Object.create(Hook.prototype);
...
@@ -358,9 +389,9 @@ HookButton.prototype = Object.create(Hook.prototype);
Object
.
assign
(
HookButton
.
prototype
,
{
Object
.
assign
(
HookButton
.
prototype
,
{
addPlugins
:
function
()
{
addPlugins
:
function
()
{
this
.
plugins
.
forEach
(
function
(
plugin
)
{
for
(
var
i
=
0
;
i
<
this
.
plugins
.
length
;
i
++
)
{
plugin
.
init
(
this
);
this
.
plugins
[
i
]
.
init
(
this
);
}
);
}
},
},
clicked
:
function
(
e
){
clicked
:
function
(
e
){
...
@@ -389,9 +420,9 @@ Object.assign(HookButton.prototype, {
...
@@ -389,9 +420,9 @@ Object.assign(HookButton.prototype, {
},
},
removePlugins
:
function
()
{
removePlugins
:
function
()
{
this
.
plugins
.
forEach
(
function
(
plugin
)
{
for
(
var
i
=
0
;
i
<
this
.
plugins
.
length
;
i
++
)
{
plugin
.
destroy
();
this
.
plugins
[
i
]
.
destroy
();
}
);
}
},
},
destroy
:
function
()
{
destroy
:
function
()
{
...
@@ -422,9 +453,9 @@ var HookInput = function(trigger, list, plugins, config) {
...
@@ -422,9 +453,9 @@ var HookInput = function(trigger, list, plugins, config) {
Object
.
assign
(
HookInput
.
prototype
,
{
Object
.
assign
(
HookInput
.
prototype
,
{
addPlugins
:
function
()
{
addPlugins
:
function
()
{
var
self
=
this
;
var
self
=
this
;
this
.
plugins
.
forEach
(
function
(
plugin
)
{
for
(
var
i
=
0
;
i
<
this
.
plugins
.
length
;
i
++
)
{
plugin
.
init
(
self
);
this
.
plugins
[
i
]
.
init
(
self
);
}
);
}
},
},
addEvents
:
function
(){
addEvents
:
function
(){
...
@@ -501,9 +532,9 @@ Object.assign(HookInput.prototype, {
...
@@ -501,9 +532,9 @@ Object.assign(HookInput.prototype, {
},
},
removePlugins
:
function
()
{
removePlugins
:
function
()
{
this
.
plugins
.
forEach
(
function
(
plugin
)
{
for
(
var
i
=
0
;
i
<
this
.
plugins
.
length
;
i
++
)
{
plugin
.
destroy
();
this
.
plugins
[
i
]
.
destroy
();
}
);
}
},
},
destroy
:
function
()
{
destroy
:
function
()
{
...
@@ -537,9 +568,9 @@ require('./window')(function(w){
...
@@ -537,9 +568,9 @@ require('./window')(function(w){
var
isDownArrow
=
false
;
var
isDownArrow
=
false
;
var
removeHighlight
=
function
removeHighlight
(
list
)
{
var
removeHighlight
=
function
removeHighlight
(
list
)
{
var
listItems
=
list
.
list
.
querySelectorAll
(
'
li
'
);
var
listItems
=
list
.
list
.
querySelectorAll
(
'
li
'
);
listItems
.
forEach
(
function
(
li
)
{
for
(
var
i
=
0
;
i
<
listItems
.
length
;
i
++
)
{
li
.
classList
.
remove
(
'
dropdown-active
'
);
li
stItems
[
i
]
.
classList
.
remove
(
'
dropdown-active
'
);
}
);
}
return
listItems
;
return
listItems
;
};
};
...
...
app/assets/javascripts/droplab/droplab_ajax_filter.js
View file @
4786a978
...
@@ -38,7 +38,7 @@ require('../window')(function(w){
...
@@ -38,7 +38,7 @@ require('../window')(function(w){
this
.
timeout
=
setTimeout
(
this
.
trigger
.
bind
(
this
,
focusEvent
),
200
);
this
.
timeout
=
setTimeout
(
this
.
trigger
.
bind
(
this
,
focusEvent
),
200
);
},
},
trigger
:
function
trigger
(
getEntireList
=
false
)
{
trigger
:
function
trigger
(
getEntireList
)
{
var
config
=
this
.
hook
.
config
.
droplabAjaxFilter
;
var
config
=
this
.
hook
.
config
.
droplabAjaxFilter
;
var
searchValue
=
this
.
trigger
.
value
;
var
searchValue
=
this
.
trigger
.
value
;
...
...
app/assets/javascripts/lib/utils/common_utils.js.es6
View file @
4786a978
...
@@ -133,7 +133,7 @@
...
@@ -133,7 +133,7 @@
gl.utils.getParameterByName = function(name) {
gl.utils.getParameterByName = function(name) {
var url = window.location.href;
var url = window.location.href;
var param = name.replace(/[[\]]/g, '\\$&');
var param = name.replace(/[[\]]/g, '\\$&');
var regex = new RegExp(
`[?&]${param}(=([^&#]*)|&|#|$)`
);
var regex = new RegExp(
'[?&]' + param + '(=([^&#]*)|&|#|$)'
);
var results = regex.exec(url);
var results = regex.exec(url);
if (!results) {
if (!results) {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment