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
Léo-Paul Géneau
gitlab-ce
Commits
c06dad62
Commit
c06dad62
authored
Jul 05, 2017
by
Mike Greiling
Committed by
Clement Ho
Jul 05, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove IIFEs around several javascript classes
parent
11e03bf4
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
763 additions
and
785 deletions
+763
-785
app/assets/javascripts/signin_tabs_memoizer.js
app/assets/javascripts/signin_tabs_memoizer.js
+40
-42
app/assets/javascripts/single_file_diff.js
app/assets/javascripts/single_file_diff.js
+78
-80
app/assets/javascripts/smart_interval.js
app/assets/javascripts/smart_interval.js
+126
-127
app/assets/javascripts/snippets_list.js
app/assets/javascripts/snippets_list.js
+6
-10
app/assets/javascripts/star.js
app/assets/javascripts/star.js
+24
-26
app/assets/javascripts/subscription.js
app/assets/javascripts/subscription.js
+36
-38
app/assets/javascripts/subscription_select.js
app/assets/javascripts/subscription_select.js
+30
-31
app/assets/javascripts/syntax_highlight.js
app/assets/javascripts/syntax_highlight.js
+13
-14
app/assets/javascripts/tree.js
app/assets/javascripts/tree.js
+58
-60
app/assets/javascripts/user.js
app/assets/javascripts/user.js
+29
-28
app/assets/javascripts/user_tabs.js
app/assets/javascripts/user_tabs.js
+94
-93
app/assets/javascripts/username_validator.js
app/assets/javascripts/username_validator.js
+107
-109
app/assets/javascripts/visibility_select.js
app/assets/javascripts/visibility_select.js
+19
-22
app/assets/javascripts/wikis.js
app/assets/javascripts/wikis.js
+47
-48
app/assets/javascripts/zen_mode.js
app/assets/javascripts/zen_mode.js
+56
-57
No files found.
app/assets/javascripts/signin_tabs_memoizer.js
View file @
c06dad62
...
@@ -2,12 +2,11 @@
...
@@ -2,12 +2,11 @@
/* eslint no-new: "off" */
/* eslint no-new: "off" */
import
AccessorUtilities
from
'
./lib/utils/accessor
'
;
import
AccessorUtilities
from
'
./lib/utils/accessor
'
;
((
global
)
=>
{
/**
/**
* Memorize the last selected tab after reloading a page.
* Memorize the last selected tab after reloading a page.
* Does that setting the current selected tab in the localStorage
* Does that setting the current selected tab in the localStorage
*/
*/
class
ActiveTabMemoizer
{
class
ActiveTabMemoizer
{
constructor
({
currentTabKey
=
'
current_signin_tab
'
,
tabSelector
=
'
ul.nav-tabs
'
}
=
{})
{
constructor
({
currentTabKey
=
'
current_signin_tab
'
,
tabSelector
=
'
ul.nav-tabs
'
}
=
{})
{
this
.
currentTabKey
=
currentTabKey
;
this
.
currentTabKey
=
currentTabKey
;
this
.
tabSelector
=
tabSelector
;
this
.
tabSelector
=
tabSelector
;
...
@@ -51,7 +50,6 @@ import AccessorUtilities from './lib/utils/accessor';
...
@@ -51,7 +50,6 @@ import AccessorUtilities from './lib/utils/accessor';
return
window
.
localStorage
.
getItem
(
this
.
currentTabKey
);
return
window
.
localStorage
.
getItem
(
this
.
currentTabKey
);
}
}
}
}
global
.
ActiveTabMemoizer
=
ActiveTabMemoizer
;
window
.
ActiveTabMemoizer
=
ActiveTabMemoizer
;
})(
window
);
app/assets/javascripts/single_file_diff.js
View file @
c06dad62
...
@@ -2,8 +2,7 @@
...
@@ -2,8 +2,7 @@
import
FilesCommentButton
from
'
./files_comment_button
'
;
import
FilesCommentButton
from
'
./files_comment_button
'
;
(
function
()
{
window
.
SingleFileDiff
=
(
function
()
{
window
.
SingleFileDiff
=
(
function
()
{
var
COLLAPSED_HTML
,
ERROR_HTML
,
LOADING_HTML
,
WRAPPER
;
var
COLLAPSED_HTML
,
ERROR_HTML
,
LOADING_HTML
,
WRAPPER
;
WRAPPER
=
'
<div class="diff-content"></div>
'
;
WRAPPER
=
'
<div class="diff-content"></div>
'
;
...
@@ -88,13 +87,12 @@ import FilesCommentButton from './files_comment_button';
...
@@ -88,13 +87,12 @@ import FilesCommentButton from './files_comment_button';
};
};
return
SingleFileDiff
;
return
SingleFileDiff
;
})();
})();
$
.
fn
.
singleFileDiff
=
function
()
{
$
.
fn
.
singleFileDiff
=
function
()
{
return
this
.
each
(
function
()
{
return
this
.
each
(
function
()
{
if
(
!
$
.
data
(
this
,
'
singleFileDiff
'
))
{
if
(
!
$
.
data
(
this
,
'
singleFileDiff
'
))
{
return
$
.
data
(
this
,
'
singleFileDiff
'
,
new
window
.
SingleFileDiff
(
this
));
return
$
.
data
(
this
,
'
singleFileDiff
'
,
new
window
.
SingleFileDiff
(
this
));
}
}
});
});
};
};
}).
call
(
window
);
app/assets/javascripts/smart_interval.js
View file @
c06dad62
/*
/**
* Instances of SmartInterval extend the functionality of `setInterval`, make it configurable
* Instances of SmartInterval extend the functionality of `setInterval`, make it configurable
* and controllable by a public API.
* and controllable by a public API.
*
*/
* */
class
SmartInterval
{
(()
=>
{
class
SmartInterval
{
/**
/**
* @param { function } opts.callback Function to be called on each iteration (required)
* @param { function } opts.callback Function to be called on each iteration (required)
* @param { milliseconds } opts.startingInterval `currentInterval` is set to this initially
* @param { milliseconds } opts.startingInterval `currentInterval` is set to this initially
...
@@ -37,6 +35,7 @@
...
@@ -37,6 +35,7 @@
this
.
initInterval
();
this
.
initInterval
();
}
}
/* public */
/* public */
start
()
{
start
()
{
...
@@ -153,6 +152,6 @@
...
@@ -153,6 +152,6 @@
state
.
intervalId
=
window
.
clearInterval
(
state
.
intervalId
);
state
.
intervalId
=
window
.
clearInterval
(
state
.
intervalId
);
}
}
}
}
gl
.
SmartInterval
=
SmartInterval
;
})(
window
.
gl
||
(
window
.
gl
=
{}))
;
window
.
gl
.
SmartInterval
=
SmartInterval
;
app/assets/javascripts/snippets_list.js
View file @
c06dad62
/* eslint-disable arrow-parens, no-param-reassign, space-before-function-paren, func-names, no-var, max-len */
/* eslint-disable arrow-parens, no-param-reassign, space-before-function-paren, func-names, no-var, max-len */
(
global
=>
{
window
.
gl
.
SnippetsList
=
function
()
{
global
.
gl
=
global
.
gl
||
{};
gl
.
SnippetsList
=
function
()
{
var
$holder
=
$
(
'
.snippets-list-holder
'
);
var
$holder
=
$
(
'
.snippets-list-holder
'
);
$holder
.
find
(
'
.pagination
'
).
on
(
'
ajax:success
'
,
(
e
,
data
)
=>
{
$holder
.
find
(
'
.pagination
'
).
on
(
'
ajax:success
'
,
(
e
,
data
)
=>
{
$holder
.
replaceWith
(
data
.
html
);
$holder
.
replaceWith
(
data
.
html
);
});
});
};
};
})(
window
);
app/assets/javascripts/star.js
View file @
c06dad62
/* eslint-disable func-names, space-before-function-paren, wrap-iife, no-unused-vars, one-var, no-var, one-var-declaration-per-line, prefer-arrow-callback, no-new, max-len */
/* eslint-disable func-names, space-before-function-paren, wrap-iife, no-unused-vars, one-var, no-var, one-var-declaration-per-line, prefer-arrow-callback, no-new, max-len */
/* global Flash */
/* global Flash */
(
function
()
{
window
.
Star
=
(
function
()
{
this
.
Star
=
(
function
()
{
function
Star
()
{
function
Star
()
{
$
(
'
.project-home-panel .toggle-star
'
).
on
(
'
ajax:success
'
,
function
(
e
,
data
,
status
,
xhr
)
{
$
(
'
.project-home-panel .toggle-star
'
).
on
(
'
ajax:success
'
,
function
(
e
,
data
,
status
,
xhr
)
{
var
$starIcon
,
$starSpan
,
$this
,
toggleStar
;
var
$starIcon
,
$starSpan
,
$this
,
toggleStar
;
...
@@ -26,5 +25,4 @@
...
@@ -26,5 +25,4 @@
}
}
return
Star
;
return
Star
;
})();
})();
}).
call
(
window
);
app/assets/javascripts/subscription.js
View file @
c06dad62
(()
=>
{
class
Subscription
{
class
Subscription
{
constructor
(
containerElm
)
{
constructor
(
containerElm
)
{
this
.
containerElm
=
containerElm
;
this
.
containerElm
=
containerElm
;
...
@@ -40,8 +39,7 @@
...
@@ -40,8 +39,7 @@
static
bindAll
(
selector
)
{
static
bindAll
(
selector
)
{
[].
forEach
.
call
(
document
.
querySelectorAll
(
selector
),
elm
=>
new
Subscription
(
elm
));
[].
forEach
.
call
(
document
.
querySelectorAll
(
selector
),
elm
=>
new
Subscription
(
elm
));
}
}
}
}
window
.
gl
=
window
.
gl
||
{};
window
.
gl
=
window
.
gl
||
{};
window
.
gl
.
Subscription
=
Subscription
;
window
.
gl
.
Subscription
=
Subscription
;
})();
app/assets/javascripts/subscription_select.js
View file @
c06dad62
/* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, quotes, object-shorthand, no-unused-vars, no-shadow, one-var, one-var-declaration-per-line, comma-dangle, max-len */
/* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, quotes, object-shorthand, no-unused-vars, no-shadow, one-var, one-var-declaration-per-line, comma-dangle, max-len */
(
function
()
{
this
.
SubscriptionSelect
=
(
function
()
{
window
.
SubscriptionSelect
=
(
function
()
{
function
SubscriptionSelect
()
{
function
SubscriptionSelect
()
{
$
(
'
.js-subscription-event
'
).
each
(
function
(
i
,
el
)
{
$
(
'
.js-subscription-event
'
).
each
(
function
(
i
,
el
)
{
var
fieldName
;
var
fieldName
;
...
@@ -30,5 +30,4 @@
...
@@ -30,5 +30,4 @@
}
}
return
SubscriptionSelect
;
return
SubscriptionSelect
;
})();
})();
}).
call
(
window
);
app/assets/javascripts/syntax_highlight.js
View file @
c06dad62
...
@@ -9,8 +9,8 @@
...
@@ -9,8 +9,8 @@
//
//
// <div class="js-syntax-highlight"></div>
// <div class="js-syntax-highlight"></div>
//
//
(
function
()
{
$
.
fn
.
syntaxHighlight
=
function
()
{
$
.
fn
.
syntaxHighlight
=
function
()
{
var
$children
;
var
$children
;
if
(
$
(
this
).
hasClass
(
'
js-syntax-highlight
'
))
{
if
(
$
(
this
).
hasClass
(
'
js-syntax-highlight
'
))
{
...
@@ -23,5 +23,4 @@
...
@@ -23,5 +23,4 @@
return
$children
.
syntaxHighlight
();
return
$children
.
syntaxHighlight
();
}
}
}
}
};
};
}).
call
(
window
);
app/assets/javascripts/tree.js
View file @
c06dad62
/* eslint-disable func-names, space-before-function-paren, wrap-iife, max-len, quotes, consistent-return, no-var, one-var, one-var-declaration-per-line, no-else-return, prefer-arrow-callback, max-len */
/* eslint-disable func-names, space-before-function-paren, wrap-iife, max-len, quotes, consistent-return, no-var, one-var, one-var-declaration-per-line, no-else-return, prefer-arrow-callback, max-len */
(
function
()
{
window
.
TreeView
=
(
function
()
{
this
.
TreeView
=
(
function
()
{
function
TreeView
()
{
function
TreeView
()
{
this
.
initKeyNav
();
this
.
initKeyNav
();
// Code browser tree slider
// Code browser tree slider
...
@@ -64,5 +63,4 @@
...
@@ -64,5 +63,4 @@
};
};
return
TreeView
;
return
TreeView
;
})();
})();
}).
call
(
window
);
app/assets/javascripts/user.js
View file @
c06dad62
...
@@ -2,8 +2,7 @@
...
@@ -2,8 +2,7 @@
import
Cookies
from
'
js-cookie
'
;
import
Cookies
from
'
js-cookie
'
;
((
global
)
=>
{
class
User
{
global
.
User
=
class
{
constructor
({
action
})
{
constructor
({
action
})
{
this
.
action
=
action
;
this
.
action
=
action
;
this
.
placeProfileAvatarsToTop
();
this
.
placeProfileAvatarsToTop
();
...
@@ -18,7 +17,7 @@ import Cookies from 'js-cookie';
...
@@ -18,7 +17,7 @@ import Cookies from 'js-cookie';
}
}
initTabs
()
{
initTabs
()
{
return
new
globa
l
.
UserTabs
({
return
new
window
.
g
l
.
UserTabs
({
parentEl
:
'
.user-profile
'
,
parentEl
:
'
.user-profile
'
,
action
:
this
.
action
action
:
this
.
action
});
});
...
@@ -31,5 +30,7 @@ import Cookies from 'js-cookie';
...
@@ -31,5 +30,7 @@ import Cookies from 'js-cookie';
$
(
this
).
parents
(
'
.project-limit-message
'
).
remove
();
$
(
this
).
parents
(
'
.project-limit-message
'
).
remove
();
});
});
}
}
};
}
})(
window
.
gl
||
(
window
.
gl
=
{}));
window
.
gl
=
window
.
gl
||
{};
window
.
gl
.
User
=
User
;
app/assets/javascripts/user_tabs.js
View file @
c06dad62
...
@@ -59,8 +59,8 @@ content on the Users#show page.
...
@@ -59,8 +59,8 @@ content on the Users#show page.
</div>
</div>
</div>
</div>
*/
*/
((
global
)
=>
{
class
UserTabs
{
class
UserTabs
{
constructor
({
defaultAction
,
action
,
parentEl
})
{
constructor
({
defaultAction
,
action
,
parentEl
})
{
this
.
loaded
=
{};
this
.
loaded
=
{};
this
.
defaultAction
=
defaultAction
||
'
activity
'
;
this
.
defaultAction
=
defaultAction
||
'
activity
'
;
...
@@ -170,6 +170,7 @@ content on the Users#show page.
...
@@ -170,6 +170,7 @@ content on the Users#show page.
getCurrentAction
()
{
getCurrentAction
()
{
return
this
.
$parentEl
.
find
(
'
.nav-links .active a
'
).
data
(
'
action
'
);
return
this
.
$parentEl
.
find
(
'
.nav-links .active a
'
).
data
(
'
action
'
);
}
}
}
}
global
.
UserTabs
=
UserTabs
;
})(
window
.
gl
||
(
window
.
gl
=
{}));
window
.
gl
=
window
.
gl
||
{};
window
.
gl
.
UserTabs
=
UserTabs
;
app/assets/javascripts/username_validator.js
View file @
c06dad62
/* eslint-disable comma-dangle, consistent-return, class-methods-use-this, arrow-parens, no-param-reassign, max-len */
/* eslint-disable comma-dangle, consistent-return, class-methods-use-this, arrow-parens, no-param-reassign, max-len */
((
global
)
=>
{
const
debounceTimeoutDuration
=
1000
;
const
debounceTimeoutDuration
=
1000
;
const
invalidInputClass
=
'
gl-field-error-outline
'
;
const
invalidInputClass
=
'
gl-field-error-outline
'
;
const
successInputClass
=
'
gl-field-success-outline
'
;
const
successInputClass
=
'
gl-field-success-outline
'
;
const
unavailableMessageSelector
=
'
.username .validation-error
'
;
const
unavailableMessageSelector
=
'
.username .validation-error
'
;
const
successMessageSelector
=
'
.username .validation-success
'
;
const
successMessageSelector
=
'
.username .validation-success
'
;
const
pendingMessageSelector
=
'
.username .validation-pending
'
;
const
pendingMessageSelector
=
'
.username .validation-pending
'
;
const
invalidMessageSelector
=
'
.username .gl-field-error
'
;
const
invalidMessageSelector
=
'
.username .gl-field-error
'
;
class
UsernameValidator
{
class
UsernameValidator
{
constructor
()
{
constructor
()
{
this
.
inputElement
=
$
(
'
#new_user_username
'
);
this
.
inputElement
=
$
(
'
#new_user_username
'
);
this
.
inputDomElement
=
this
.
inputElement
.
get
(
0
);
this
.
inputDomElement
=
this
.
inputElement
.
get
(
0
);
...
@@ -129,7 +128,6 @@
...
@@ -129,7 +128,6 @@
this
.
inputElement
.
addClass
(
invalidInputClass
).
removeClass
(
successInputClass
);
this
.
inputElement
.
addClass
(
invalidInputClass
).
removeClass
(
successInputClass
);
$inputErrorMessage
.
show
();
$inputErrorMessage
.
show
();
}
}
}
}
global
.
UsernameValidator
=
UsernameValidator
;
window
.
UsernameValidator
=
UsernameValidator
;
})(
window
);
app/assets/javascripts/visibility_select.js
View file @
c06dad62
(()
=>
{
class
VisibilitySelect
{
const
gl
=
window
.
gl
||
(
window
.
gl
=
{});
class
VisibilitySelect
{
constructor
(
container
)
{
constructor
(
container
)
{
if
(
!
container
)
throw
new
Error
(
'
VisibilitySelect requires a container element as argument 1
'
);
if
(
!
container
)
throw
new
Error
(
'
VisibilitySelect requires a container element as argument 1
'
);
this
.
container
=
container
;
this
.
container
=
container
;
...
@@ -21,7 +18,7 @@
...
@@ -21,7 +18,7 @@
updateHelpText
()
{
updateHelpText
()
{
this
.
helpBlock
.
textContent
=
this
.
select
.
querySelector
(
'
option:checked
'
).
dataset
.
description
;
this
.
helpBlock
.
textContent
=
this
.
select
.
querySelector
(
'
option:checked
'
).
dataset
.
description
;
}
}
}
}
gl
.
VisibilitySelect
=
VisibilitySelect
;
window
.
gl
=
window
.
gl
||
{}
;
})()
;
window
.
gl
.
VisibilitySelect
=
VisibilitySelect
;
app/assets/javascripts/wikis.js
View file @
c06dad62
...
@@ -4,8 +4,7 @@
...
@@ -4,8 +4,7 @@
import
'
vendor/jquery.nicescroll
'
;
import
'
vendor/jquery.nicescroll
'
;
import
'
./breakpoints
'
;
import
'
./breakpoints
'
;
((
global
)
=>
{
class
Wikis
{
class
Wikis
{
constructor
()
{
constructor
()
{
this
.
bp
=
Breakpoints
.
get
();
this
.
bp
=
Breakpoints
.
get
();
this
.
sidebarEl
=
document
.
querySelector
(
'
.js-wiki-sidebar
'
);
this
.
sidebarEl
=
document
.
querySelector
(
'
.js-wiki-sidebar
'
);
...
@@ -63,7 +62,7 @@ import './breakpoints';
...
@@ -63,7 +62,7 @@ import './breakpoints';
classList
.
remove
(
'
right-sidebar-expanded
'
);
classList
.
remove
(
'
right-sidebar-expanded
'
);
}
}
}
}
}
}
global
.
Wikis
=
Wikis
;
window
.
gl
=
window
.
gl
||
{}
;
})(
window
.
gl
||
(
window
.
gl
=
{}))
;
window
.
gl
.
Wikis
=
Wikis
;
app/assets/javascripts/zen_mode.js
View file @
c06dad62
...
@@ -34,8 +34,8 @@ window.Dropzone = Dropzone;
...
@@ -34,8 +34,8 @@ window.Dropzone = Dropzone;
// **Cancelable** No
// **Cancelable** No
// **Target** a.js-zen-leave
// **Target** a.js-zen-leave
//
//
(
function
()
{
this
.
ZenMode
=
(
function
()
{
window
.
ZenMode
=
(
function
()
{
function
ZenMode
()
{
function
ZenMode
()
{
this
.
active_backdrop
=
null
;
this
.
active_backdrop
=
null
;
this
.
active_textarea
=
null
;
this
.
active_textarea
=
null
;
...
@@ -94,5 +94,4 @@ window.Dropzone = Dropzone;
...
@@ -94,5 +94,4 @@ window.Dropzone = Dropzone;
};
};
return
ZenMode
;
return
ZenMode
;
})();
})();
}).
call
(
window
);
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