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
Boxiang Sun
gitlab-ce
Commits
302d0453
Commit
302d0453
authored
Mar 13, 2017
by
Alfredo Sumaran
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'remove-iifes-1' into 'master'
Remove IIFEs for several JS files - Part 1 See merge request !9884
parents
18a688ff
c8f986fe
Changes
35
Show whitespace changes
Inline
Side-by-side
Showing
35 changed files
with
3683 additions
and
3748 deletions
+3683
-3748
app/assets/javascripts/abuse_reports.js
app/assets/javascripts/abuse_reports.js
+30
-33
app/assets/javascripts/activities.js
app/assets/javascripts/activities.js
+25
-26
app/assets/javascripts/admin.js
app/assets/javascripts/admin.js
+59
-61
app/assets/javascripts/api.js
app/assets/javascripts/api.js
+144
-146
app/assets/javascripts/aside.js
app/assets/javascripts/aside.js
+22
-23
app/assets/javascripts/autosave.js
app/assets/javascripts/autosave.js
+54
-55
app/assets/javascripts/breakpoints.js
app/assets/javascripts/breakpoints.js
+51
-57
app/assets/javascripts/broadcast_message.js
app/assets/javascripts/broadcast_message.js
+30
-31
app/assets/javascripts/build.js
app/assets/javascripts/build.js
+264
-266
app/assets/javascripts/build_artifacts.js
app/assets/javascripts/build_artifacts.js
+21
-22
app/assets/javascripts/ci_lint_editor.js
app/assets/javascripts/ci_lint_editor.js
+13
-14
app/assets/javascripts/commit.js
app/assets/javascripts/commit.js
+8
-10
app/assets/javascripts/commits.js
app/assets/javascripts/commits.js
+58
-60
app/assets/javascripts/compare.js
app/assets/javascripts/compare.js
+82
-83
app/assets/javascripts/compare_autocomplete.js
app/assets/javascripts/compare_autocomplete.js
+59
-61
app/assets/javascripts/confirm_danger_modal.js
app/assets/javascripts/confirm_danger_modal.js
+28
-29
app/assets/javascripts/copy_as_gfm.js
app/assets/javascripts/copy_as_gfm.js
+317
-320
app/assets/javascripts/copy_to_clipboard.js
app/assets/javascripts/copy_to_clipboard.js
+45
-48
app/assets/javascripts/create_label.js
app/assets/javascripts/create_label.js
+101
-106
app/assets/javascripts/diff.js
app/assets/javascripts/diff.js
+102
-104
app/assets/javascripts/dropzone_input.js
app/assets/javascripts/dropzone_input.js
+202
-204
app/assets/javascripts/due_date_select.js
app/assets/javascripts/due_date_select.js
+168
-169
app/assets/javascripts/files_comment_button.js
app/assets/javascripts/files_comment_button.js
+109
-111
app/assets/javascripts/filterable_list.js
app/assets/javascripts/filterable_list.js
+1
-0
app/assets/javascripts/flash.js
app/assets/javascripts/flash.js
+36
-37
app/assets/javascripts/gfm_auto_complete.js
app/assets/javascripts/gfm_auto_complete.js
+357
-361
app/assets/javascripts/gl_dropdown.js
app/assets/javascripts/gl_dropdown.js
+743
-745
app/assets/javascripts/gl_field_error.js
app/assets/javascripts/gl_field_error.js
+143
-145
app/assets/javascripts/gl_field_errors.js
app/assets/javascripts/gl_field_errors.js
+34
-35
app/assets/javascripts/gl_form.js
app/assets/javascripts/gl_form.js
+71
-73
app/assets/javascripts/group_avatar.js
app/assets/javascripts/group_avatar.js
+17
-18
app/assets/javascripts/group_label_subscription.js
app/assets/javascripts/group_label_subscription.js
+48
-49
app/assets/javascripts/groups_select.js
app/assets/javascripts/groups_select.js
+61
-63
app/assets/javascripts/header.js
app/assets/javascripts/header.js
+7
-8
app/assets/javascripts/main.js
app/assets/javascripts/main.js
+173
-175
No files found.
app/assets/javascripts/abuse_reports.js
View file @
302d0453
/* eslint-disable no-param-reassign */
const
MAX_MESSAGE_LENGTH
=
500
;
const
MESSAGE_CELL_SELECTOR
=
'
.abuse-reports .message
'
;
((
global
)
=>
{
const
MAX_MESSAGE_LENGTH
=
500
;
const
MESSAGE_CELL_SELECTOR
=
'
.abuse-reports .message
'
;
class
AbuseReports
{
class
AbuseReports
{
constructor
()
{
$
(
MESSAGE_CELL_SELECTOR
).
each
(
this
.
truncateLongMessage
);
$
(
document
)
...
...
@@ -18,7 +15,7 @@
if
(
reportMessage
.
length
>
MAX_MESSAGE_LENGTH
)
{
$messageCellElement
.
data
(
'
original-message
'
,
reportMessage
);
$messageCellElement
.
data
(
'
message-truncated
'
,
'
true
'
);
$messageCellElement
.
text
(
globa
l
.
text
.
truncate
(
reportMessage
,
MAX_MESSAGE_LENGTH
));
$messageCellElement
.
text
(
window
.
g
l
.
text
.
truncate
(
reportMessage
,
MAX_MESSAGE_LENGTH
));
}
}
...
...
@@ -34,7 +31,7 @@
$messageCellElement
.
text
(
`
${
originalMessage
.
substr
(
0
,
(
MAX_MESSAGE_LENGTH
-
3
))}
...`
);
}
}
}
}
global
.
AbuseReports
=
AbuseReports
;
})(
window
.
gl
||
(
window
.
gl
=
{}))
;
window
.
gl
=
window
.
gl
||
{}
;
window
.
gl
.
AbuseReports
=
AbuseReports
;
app/assets/javascripts/activities.js
View file @
302d0453
...
...
@@ -2,8 +2,7 @@
/* global Pager */
/* global Cookies */
((
global
)
=>
{
class
Activities
{
class
Activities
{
constructor
()
{
Pager
.
init
(
20
,
true
,
false
,
this
.
updateTooltips
);
$
(
'
.event-filter-link
'
).
on
(
'
click
'
,
(
e
)
=>
{
...
...
@@ -31,7 +30,7 @@
$sender
.
closest
(
'
li
'
).
toggleClass
(
'
active
'
);
}
}
}
global
.
Activities
=
Activities
;
})(
window
.
gl
||
(
window
.
gl
=
{}))
;
window
.
gl
=
window
.
gl
||
{}
;
window
.
gl
.
Activities
=
Activities
;
app/assets/javascripts/admin.js
View file @
302d0453
/* eslint-disable func-names, space-before-function-paren, wrap-iife, one-var, no-var, one-var-declaration-per-line, no-unused-vars, no-else-return, prefer-arrow-callback, camelcase, quotes, comma-dangle, max-len */
(
function
()
{
this
.
Admin
=
(
function
()
{
window
.
Admin
=
(
function
()
{
function
Admin
()
{
var
modal
,
showBlacklistType
;
$
(
'
input#user_force_random_password
'
).
on
(
'
change
'
,
function
(
elem
)
{
...
...
@@ -60,5 +59,4 @@
}
return
Admin
;
})();
}).
call
(
window
);
})();
app/assets/javascripts/api.js
View file @
302d0453
/* eslint-disable func-names, space-before-function-paren, quotes, object-shorthand, camelcase, no-var, comma-dangle, prefer-arrow-callback, quote-props, no-param-reassign, max-len */
(
function
()
{
var
Api
=
{
var
Api
=
{
groupsPath
:
"
/api/:version/groups.json
"
,
groupPath
:
"
/api/:version/groups/:id.json
"
,
namespacesPath
:
"
/api/:version/namespaces.json
"
,
...
...
@@ -144,7 +143,6 @@
}
return
url
.
replace
(
'
:version
'
,
gon
.
api_version
);
}
};
};
window
.
Api
=
Api
;
}).
call
(
window
);
window
.
Api
=
Api
;
app/assets/javascripts/aside.js
View file @
302d0453
/* eslint-disable func-names, space-before-function-paren, wrap-iife, quotes, prefer-arrow-callback, no-var, one-var, one-var-declaration-per-line, no-else-return, max-len */
(
function
()
{
this
.
Aside
=
(
function
()
{
window
.
Aside
=
(
function
()
{
function
Aside
()
{
$
(
document
).
off
(
"
click
"
,
"
a.show-aside
"
);
$
(
document
).
on
(
"
click
"
,
'
a.show-aside
'
,
function
(
e
)
{
...
...
@@ -21,5 +21,4 @@
}
return
Aside
;
})();
}).
call
(
window
);
})();
app/assets/javascripts/autosave.js
View file @
302d0453
/* eslint-disable func-names, space-before-function-paren, wrap-iife, no-param-reassign, quotes, prefer-template, no-var, one-var, no-unused-vars, one-var-declaration-per-line, no-void, consistent-return, no-empty, max-len */
(
function
()
{
this
.
Autosave
=
(
function
()
{
window
.
Autosave
=
(
function
()
{
function
Autosave
(
field
,
key
)
{
this
.
field
=
field
;
if
(
key
.
join
!=
null
)
{
...
...
@@ -58,5 +58,4 @@
};
return
Autosave
;
})();
}).
call
(
window
);
})();
app/assets/javascripts/breakpoints.js
View file @
302d0453
/* eslint-disable func-names, space-before-function-paren, wrap-iife, one-var, no-var, one-var-declaration-per-line, quotes, no-shadow, prefer-arrow-callback, prefer-template, consistent-return, no-return-assign, new-parens, no-param-reassign, max-len */
(
function
()
{
var
Breakpoints
=
(
function
()
{
var
Breakpoints
=
(
function
()
{
var
BreakpointInstance
,
instance
;
function
Breakpoints
()
{}
...
...
@@ -60,13 +59,8 @@
};
return
Breakpoints
;
})();
})();
$
((
function
(
_this
)
{
return
function
()
{
return
_this
.
bp
=
Breakpoints
.
get
();
};
})(
this
));
$
(()
=>
{
window
.
bp
=
Breakpoints
.
get
();
});
window
.
Breakpoints
=
Breakpoints
;
}).
call
(
window
);
window
.
Breakpoints
=
Breakpoints
;
app/assets/javascripts/broadcast_message.js
View file @
302d0453
/* eslint-disable func-names, space-before-function-paren, prefer-arrow-callback, no-var, quotes, no-else-return, object-shorthand, comma-dangle, max-len */
(
function
()
{
$
(
function
()
{
$
(
function
()
{
var
previewPath
;
$
(
'
input#broadcast_message_color
'
).
on
(
'
input
'
,
function
()
{
var
previewColor
;
...
...
@@ -30,5 +30,4 @@
});
}
});
});
}).
call
(
window
);
});
app/assets/javascripts/build.js
View file @
302d0453
/* eslint-disable func-names, space-before-function-paren, no-var, prefer-rest-params, wrap-iife, no-use-before-define, no-param-reassign, quotes, yoda, no-else-return, consistent-return, comma-dangle, object-shorthand, prefer-template, one-var, one-var-declaration-per-line, no-unused-vars, max-len, vars-on-top */
/* global Breakpoints */
(
function
()
{
var
bind
=
function
(
fn
,
me
)
{
return
function
()
{
return
fn
.
apply
(
me
,
arguments
);
};
};
var
AUTO_SCROLL_OFFSET
=
75
;
var
DOWN_BUILD_TRACE
=
'
#down-build-trace
'
;
var
bind
=
function
(
fn
,
me
)
{
return
function
()
{
return
fn
.
apply
(
me
,
arguments
);
};
};
var
AUTO_SCROLL_OFFSET
=
75
;
var
DOWN_BUILD_TRACE
=
'
#down-build-trace
'
;
this
.
Build
=
(
function
()
{
window
.
Build
=
(
function
()
{
Build
.
timeout
=
null
;
Build
.
state
=
null
;
...
...
@@ -281,5 +280,4 @@
};
return
Build
;
})();
}).
call
(
window
);
})();
app/assets/javascripts/build_artifacts.js
View file @
302d0453
/* eslint-disable func-names, space-before-function-paren, wrap-iife, prefer-arrow-callback, no-unused-vars, no-return-assign, max-len */
(
function
()
{
this
.
BuildArtifacts
=
(
function
()
{
window
.
BuildArtifacts
=
(
function
()
{
function
BuildArtifacts
()
{
this
.
disablePropagation
();
this
.
setupEntryClick
();
...
...
@@ -22,5 +22,4 @@
};
return
BuildArtifacts
;
})();
}).
call
(
window
);
})();
app/assets/javascripts/ci_lint_editor.js
View file @
302d0453
(()
=>
{
window
.
gl
=
window
.
gl
||
{};
class
CILintEditor
{
window
.
gl
=
window
.
gl
||
{};
class
CILintEditor
{
constructor
()
{
this
.
editor
=
window
.
ace
.
edit
(
'
ci-editor
'
);
this
.
textarea
=
document
.
querySelector
(
'
#content
'
);
...
...
@@ -12,7 +12,6 @@
this
.
textarea
.
value
=
content
;
});
}
}
}
gl
.
CILintEditor
=
CILintEditor
;
})();
gl
.
CILintEditor
=
CILintEditor
;
app/assets/javascripts/commit.js
View file @
302d0453
/* eslint-disable func-names, space-before-function-paren, wrap-iife */
/* global CommitFile */
(
function
()
{
this
.
Commit
=
(
function
()
{
window
.
Commit
=
(
function
()
{
function
Commit
()
{
$
(
'
.files .diff-file
'
).
each
(
function
()
{
return
new
CommitFile
(
this
);
...
...
@@ -10,5 +9,4 @@
}
return
Commit
;
})();
}).
call
(
window
);
})();
app/assets/javascripts/commits.js
View file @
302d0453
/* eslint-disable func-names, space-before-function-paren, wrap-iife, quotes, consistent-return, no-return-assign, no-param-reassign, one-var, no-var, one-var-declaration-per-line, no-unused-vars, prefer-template, object-shorthand, comma-dangle, max-len, prefer-arrow-callback */
/* global Pager */
(
function
()
{
this
.
CommitsList
=
(
function
()
{
window
.
CommitsList
=
(
function
()
{
var
CommitsList
=
{};
CommitsList
.
timer
=
null
;
...
...
@@ -64,5 +63,4 @@
};
return
CommitsList
;
})();
}).
call
(
window
);
})();
app/assets/javascripts/compare.js
View file @
302d0453
/* eslint-disable func-names, space-before-function-paren, wrap-iife, quotes, no-var, object-shorthand, consistent-return, no-unused-vars, comma-dangle, vars-on-top, prefer-template, max-len */
(
function
()
{
this
.
Compare
=
(
function
()
{
window
.
Compare
=
(
function
()
{
function
Compare
(
opts
)
{
this
.
opts
=
opts
;
this
.
source_loading
=
$
(
"
.js-source-loading
"
);
...
...
@@ -87,5 +87,4 @@
};
return
Compare
;
})();
}).
call
(
window
);
})();
app/assets/javascripts/compare_autocomplete.js
View file @
302d0453
/* eslint-disable func-names, space-before-function-paren, one-var, no-var, one-var-declaration-per-line, object-shorthand, comma-dangle, prefer-arrow-callback, no-else-return, newline-per-chained-call, wrap-iife, max-len */
(
function
()
{
this
.
CompareAutocomplete
=
(
function
()
{
window
.
CompareAutocomplete
=
(
function
()
{
function
CompareAutocomplete
()
{
this
.
initDropdown
();
}
...
...
@@ -65,5 +64,4 @@
};
return
CompareAutocomplete
;
})();
}).
call
(
window
);
})();
app/assets/javascripts/confirm_danger_modal.js
View file @
302d0453
/* eslint-disable func-names, space-before-function-paren, wrap-iife, one-var, no-var, camelcase, one-var-declaration-per-line, no-else-return, max-len */
(
function
()
{
this
.
ConfirmDangerModal
=
(
function
()
{
window
.
ConfirmDangerModal
=
(
function
()
{
function
ConfirmDangerModal
(
form
,
text
)
{
var
project_path
,
submit
;
this
.
form
=
form
;
...
...
@@ -27,5 +27,4 @@
}
return
ConfirmDangerModal
;
})();
}).
call
(
window
);
})();
app/assets/javascripts/copy_as_gfm.js
View file @
302d0453
/* eslint-disable class-methods-use-this, object-shorthand, no-unused-vars, no-use-before-define, no-new, max-len, no-restricted-syntax, guard-for-in, no-continue */
/* jshint esversion: 6 */
require
(
'
./lib/utils/common_utils
'
);
(()
=>
{
const
gfmRules
=
{
const
gfmRules
=
{
// The filters referenced in lib/banzai/pipeline/gfm_pipeline.rb convert
// GitLab Flavored Markdown (GFM) to HTML.
// These handlers consequently convert that same HTML to GFM to be copied to the clipboard.
...
...
@@ -271,9 +269,9 @@ require('./lib/utils/common_utils');
return
`|
${
cells
.
join
(
'
|
'
)}
|`
;
},
},
};
};
class
CopyAsGFM
{
class
CopyAsGFM
{
constructor
()
{
$
(
document
).
on
(
'
copy
'
,
'
.md, .wiki
'
,
this
.
handleCopy
);
$
(
document
).
on
(
'
paste
'
,
'
.js-gfm-input
'
,
this
.
handlePaste
);
...
...
@@ -355,10 +353,9 @@ require('./lib/utils/common_utils');
return
clonedParentNode
.
innerText
||
clonedParentNode
.
textContent
;
}
}
}
window
.
gl
=
window
.
gl
||
{};
window
.
gl
.
CopyAsGFM
=
CopyAsGFM
;
window
.
gl
=
window
.
gl
||
{};
window
.
gl
.
CopyAsGFM
=
CopyAsGFM
;
new
CopyAsGFM
();
})();
new
CopyAsGFM
();
app/assets/javascripts/copy_to_clipboard.js
View file @
302d0453
/* eslint-disable func-names, space-before-function-paren, one-var, no-var, one-var-declaration-per-line, prefer-template, quotes, no-unused-vars, prefer-arrow-callback, max-len */
/* global Clipboard */
window
.
Clipboard
=
require
(
'
vendor/clipboard
'
)
;
import
Clipboard
from
'
vendor/clipboard
'
;
(
function
()
{
var
genericError
,
genericSuccess
,
showTooltip
;
var
genericError
,
genericSuccess
,
showTooltip
;
genericSuccess
=
function
(
e
)
{
genericSuccess
=
function
(
e
)
{
showTooltip
(
e
.
trigger
,
'
Copied
'
);
// Clear the selection and blur the trigger so it loses its border
e
.
clearSelection
();
return
$
(
e
.
trigger
).
blur
();
};
};
// Safari doesn't support `execCommand`, so instead we inform the user to
// copy manually.
//
// See http://clipboardjs.com/#browser-support
genericError
=
function
(
e
)
{
// Safari doesn't support `execCommand`, so instead we inform the user to
// copy manually.
//
// See http://clipboardjs.com/#browser-support
genericError
=
function
(
e
)
{
var
key
;
if
(
/Mac/i
.
test
(
navigator
.
userAgent
))
{
key
=
'
⌘
'
;
// Command
...
...
@@ -25,9 +23,9 @@ window.Clipboard = require('vendor/clipboard');
key
=
'
Ctrl
'
;
}
return
showTooltip
(
e
.
trigger
,
"
Press
"
+
key
+
"
-C to copy
"
);
};
};
showTooltip
=
function
(
target
,
title
)
{
showTooltip
=
function
(
target
,
title
)
{
var
$target
=
$
(
target
);
var
originalTitle
=
$target
.
data
(
'
original-title
'
);
...
...
@@ -37,13 +35,12 @@ window.Clipboard = require('vendor/clipboard');
.
tooltip
(
'
show
'
)
.
attr
(
'
title
'
,
originalTitle
)
.
tooltip
(
'
fixTitle
'
);
};
};
$
(
function
()
{
$
(
function
()
{
var
clipboard
;
clipboard
=
new
Clipboard
(
'
[data-clipboard-target], [data-clipboard-text]
'
);
clipboard
.
on
(
'
success
'
,
genericSuccess
);
return
clipboard
.
on
(
'
error
'
,
genericError
);
});
}).
call
(
window
);
});
app/assets/javascripts/create_label.js
View file @
302d0453
/* eslint-disable func-names, space-before-function-paren, prefer-arrow-callback, comma-dangle, prefer-template, quotes, no-param-reassign, wrap-iife, max-len */
/* global Api */
(
function
(
w
)
{
class
CreateLabelDropdown
{
class
CreateLabelDropdown
{
constructor
(
$el
,
namespacePath
,
projectPath
)
{
this
.
$el
=
$el
;
this
.
namespacePath
=
namespacePath
;
...
...
@@ -122,11 +121,7 @@
}
});
}
}
if
(
!
w
.
gl
)
{
w
.
gl
=
{};
}
}
gl
.
CreateLabelDropdown
=
CreateLabelDropdown
;
})(
window
)
;
window
.
gl
=
window
.
gl
||
{}
;
gl
.
CreateLabelDropdown
=
CreateLabelDropdown
;
app/assets/javascripts/diff.js
View file @
302d0453
...
...
@@ -2,11 +2,10 @@
require
(
'
./lib/utils/url_utility
'
);
(()
=>
{
const
UNFOLD_COUNT
=
20
;
let
isBound
=
false
;
const
UNFOLD_COUNT
=
20
;
let
isBound
=
false
;
class
Diff
{
class
Diff
{
constructor
()
{
const
$diffFile
=
$
(
'
.files .diff-file
'
);
$diffFile
.
singleFileDiff
();
...
...
@@ -123,8 +122,7 @@ require('./lib/utils/url_utility');
.
addClass
(
'
hll
'
);
}
}
}
}
window
.
gl
=
window
.
gl
||
{};
window
.
gl
.
Diff
=
Diff
;
})();
window
.
gl
=
window
.
gl
||
{};
window
.
gl
.
Diff
=
Diff
;
app/assets/javascripts/dropzone_input.js
View file @
302d0453
...
...
@@ -3,8 +3,7 @@
require
(
'
./preview_markdown
'
);
(
function
()
{
this
.
DropzoneInput
=
(
function
()
{
window
.
DropzoneInput
=
(
function
()
{
function
DropzoneInput
(
form
)
{
var
$mdArea
,
alertAttr
,
alertClass
,
appendToTextArea
,
btnAlert
,
child
,
closeAlertMessage
,
closeSpinner
,
divAlert
,
divHover
,
divSpinner
,
dropzone
,
form_dropzone
,
form_textarea
,
getFilename
,
handlePaste
,
iconPaperclip
,
iconSpinner
,
insertToTextArea
,
isImage
,
max_file_size
,
pasteText
,
project_uploads_path
,
showError
,
showSpinner
,
uploadFile
,
uploadProgress
;
Dropzone
.
autoDiscover
=
false
;
...
...
@@ -216,5 +215,4 @@ require('./preview_markdown');
}
return
DropzoneInput
;
})();
}).
call
(
window
);
})();
app/assets/javascripts/due_date_select.js
View file @
302d0453
...
...
@@ -2,8 +2,7 @@
/* global dateFormat */
/* global Pikaday */
(
function
(
global
)
{
class
DueDateSelect
{
class
DueDateSelect
{
constructor
({
$dropdown
,
$loading
}
=
{})
{
const
$dropdownParent
=
$dropdown
.
closest
(
'
.dropdown
'
);
const
$block
=
$dropdown
.
closest
(
'
.block
'
);
...
...
@@ -156,9 +155,9 @@
return
this
.
$loading
.
fadeOut
();
});
}
}
}
class
DueDateSelectors
{
class
DueDateSelectors
{
constructor
()
{
this
.
initMilestoneDatePicker
();
this
.
initIssuableSelect
();
...
...
@@ -198,7 +197,7 @@
});
});
}
}
}
global
.
DueDateSelectors
=
DueDateSelectors
;
})(
window
.
gl
||
(
window
.
gl
=
{}))
;
window
.
gl
=
window
.
gl
||
{}
;
window
.
gl
.
DueDateSelectors
=
DueDateSelectors
;
app/assets/javascripts/files_comment_button.js
View file @
302d0453
...
...
@@ -2,11 +2,10 @@
/* global FilesCommentButton */
/* global notes */
(
function
()
{
let
$commentButtonTemplate
;
var
bind
=
function
(
fn
,
me
)
{
return
function
()
{
return
fn
.
apply
(
me
,
arguments
);
};
};
let
$commentButtonTemplate
;
var
bind
=
function
(
fn
,
me
)
{
return
function
()
{
return
fn
.
apply
(
me
,
arguments
);
};
};
this
.
FilesCommentButton
=
(
function
()
{
window
.
FilesCommentButton
=
(
function
()
{
var
COMMENT_BUTTON_CLASS
,
EMPTY_CELL_CLASS
,
LINE_COLUMN_CLASSES
,
LINE_CONTENT_CLASS
,
LINE_HOLDER_CLASS
,
LINE_NUMBER_CLASS
,
OLD_LINE_CLASS
,
TEXT_FILE_SELECTOR
,
UNFOLDABLE_LINE_CLASS
;
COMMENT_BUTTON_CLASS
=
'
.add-diff-note
'
;
...
...
@@ -126,9 +125,9 @@
};
return
FilesCommentButton
;
})();
})();
$
.
fn
.
filesCommentButton
=
function
()
{
$
.
fn
.
filesCommentButton
=
function
()
{
$commentButtonTemplate
=
$
(
'
<button name="button" type="submit" class="add-diff-note js-add-diff-note-button" title="Add a comment to this line"><i class="fa fa-comment-o"></i></button>
'
);
if
(
!
(
this
&&
(
this
.
parent
().
data
(
'
can-create-note
'
)
!=
null
)))
{
...
...
@@ -139,5 +138,4 @@
return
$
.
data
(
this
,
'
filesCommentButton
'
,
new
FilesCommentButton
(
$
(
this
)));
}
});
};
}).
call
(
window
);
};
app/assets/javascripts/filterable_list.js
View file @
302d0453
...
...
@@ -2,6 +2,7 @@
* Makes search request for content when user types a value in the search input.
* Updates the html content of the page with the received one.
*/
export
default
class
FilterableList
{
constructor
(
form
,
filter
,
holder
)
{
this
.
filterForm
=
form
;
...
...
app/assets/javascripts/flash.js
View file @
302d0453
/* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, one-var, one-var-declaration-per-line, no-param-reassign, quotes, quote-props, prefer-template, comma-dangle, max-len */
(
function
()
{
this
.
Flash
=
(
function
()
{
window
.
Flash
=
(
function
()
{
var
hideFlash
;
hideFlash
=
function
()
{
...
...
@@ -38,5 +38,4 @@
}
return
Flash
;
})();
}).
call
(
window
);
})();
app/assets/javascripts/gfm_auto_complete.js
View file @
302d0453
...
...
@@ -5,16 +5,13 @@ import emojiAliases from 'emojis/aliases.json';
import
{
glEmojiTag
}
from
'
~/behaviors/gl_emoji
'
;
// Creates the variables for setting up GFM auto-completion
(
function
()
{
if
(
window
.
gl
==
null
)
{
window
.
gl
=
{};
}
window
.
gl
=
window
.
gl
||
{};
function
sanitize
(
str
)
{
function
sanitize
(
str
)
{
return
str
.
replace
(
/<
(?:
.|
\n)
*
?
>/gm
,
''
);
}
}
window
.
gl
.
GfmAutoComplete
=
{
window
.
gl
.
GfmAutoComplete
=
{
dataSources
:
{},
defaultLoadingData
:
[
'
loading
'
],
cachedData
:
{},
...
...
@@ -390,5 +387,4 @@ import { glEmojiTag } from '~/behaviors/gl_emoji';
return
dataToInspect
&&
(
dataToInspect
===
loadingState
||
dataToInspect
.
name
===
loadingState
);
}
};
}).
call
(
window
);
};
app/assets/javascripts/gl_dropdown.js
View file @
302d0453
/* eslint-disable func-names, space-before-function-paren, no-var, one-var, one-var-declaration-per-line, prefer-rest-params, max-len, vars-on-top, wrap-iife, no-unused-vars, quotes, no-shadow, no-cond-assign, prefer-arrow-callback, no-return-assign, no-else-return, camelcase, comma-dangle, no-lonely-if, guard-for-in, no-restricted-syntax, consistent-return, prefer-template, no-param-reassign, no-loop-func, no-mixed-operators */
/* global fuzzaldrinPlus */
(
function
()
{
var
GitLabDropdown
,
GitLabDropdownFilter
,
GitLabDropdownRemote
,
var
GitLabDropdown
,
GitLabDropdownFilter
,
GitLabDropdownRemote
,
bind
=
function
(
fn
,
me
)
{
return
function
()
{
return
fn
.
apply
(
me
,
arguments
);
};
},
indexOf
=
[].
indexOf
||
function
(
item
)
{
for
(
var
i
=
0
,
l
=
this
.
length
;
i
<
l
;
i
+=
1
)
{
if
(
i
in
this
&&
this
[
i
]
===
item
)
return
i
;
}
return
-
1
;
};
GitLabDropdownFilter
=
(
function
()
{
GitLabDropdownFilter
=
(
function
()
{
var
ARROW_KEY_CODES
,
BLUR_KEYCODES
,
HAS_VALUE_CLASS
;
BLUR_KEYCODES
=
[
27
,
40
];
...
...
@@ -135,9 +134,9 @@
};
return
GitLabDropdownFilter
;
})();
})();
GitLabDropdownRemote
=
(
function
()
{
GitLabDropdownRemote
=
(
function
()
{
function
GitLabDropdownRemote
(
dataEndpoint
,
options
)
{
this
.
dataEndpoint
=
dataEndpoint
;
this
.
options
=
options
;
...
...
@@ -187,9 +186,9 @@
};
return
GitLabDropdownRemote
;
})();
})();
GitLabDropdown
=
(
function
()
{
GitLabDropdown
=
(
function
()
{
var
ACTIVE_CLASS
,
FILTER_INPUT
,
INDETERMINATE_CLASS
,
LOADING_CLASS
,
PAGE_TWO_CLASS
,
NON_SELECTABLE_CLASSES
,
SELECTABLE_CLASSES
,
CURSOR_SELECT_SCROLL_PADDING
,
currentIndex
;
LOADING_CLASS
=
"
is-loading
"
;
...
...
@@ -838,13 +837,12 @@
};
return
GitLabDropdown
;
})();
})();
$
.
fn
.
glDropdown
=
function
(
opts
)
{
$
.
fn
.
glDropdown
=
function
(
opts
)
{
return
this
.
each
(
function
()
{
if
(
!
$
.
data
(
this
,
'
glDropdown
'
))
{
return
$
.
data
(
this
,
'
glDropdown
'
,
new
GitLabDropdown
(
this
,
opts
));
}
});
};
}).
call
(
window
);
};
app/assets/javascripts/gl_field_error.js
View file @
302d0453
/* eslint-disable no-param-reassign */
((
global
)
=>
{
/*
/**
* This class overrides the browser's validation error bubbles, displaying custom
* error messages for invalid fields instead. To begin validating any form, add the
* class `gl-show-field-errors` to the form element, and ensure error messages are
...
...
@@ -41,22 +39,22 @@
* // Error message now injected here
* </form>
*
*
*/
*/
/
*
/*
*
* Regex Patterns in use:
*
* Only alphanumeric: : "[a-zA-Z0-9]+"
* No special characters : "[a-zA-Z0-9-_]+",
*
*
*/
*/
const
errorMessageClass
=
'
gl-field-error
'
;
const
inputErrorClass
=
'
gl-field-error-outline
'
;
const
errorAnchorSelector
=
'
.gl-field-error-anchor
'
;
const
ignoreInputSelector
=
'
.gl-field-error-ignore
'
;
const
errorMessageClass
=
'
gl-field-error
'
;
const
inputErrorClass
=
'
gl-field-error-outline
'
;
const
errorAnchorSelector
=
'
.gl-field-error-anchor
'
;
const
ignoreInputSelector
=
'
.gl-field-error-ignore
'
;
class
GlFieldError
{
class
GlFieldError
{
constructor
({
input
,
formErrors
})
{
this
.
inputElement
=
$
(
input
);
this
.
inputDomElement
=
this
.
inputElement
.
get
(
0
);
...
...
@@ -158,7 +156,7 @@
this
.
scopedSiblings
.
hide
();
this
.
fieldErrorElement
.
hide
();
}
}
}
global
.
GlFieldError
=
GlFieldError
;
})(
window
.
gl
||
(
window
.
gl
=
{}))
;
window
.
gl
=
window
.
gl
||
{}
;
window
.
gl
.
GlFieldError
=
GlFieldError
;
app/assets/javascripts/gl_field_errors.js
View file @
302d0453
...
...
@@ -2,10 +2,9 @@
require
(
'
./gl_field_error
'
);
((
global
)
=>
{
const
customValidationFlag
=
'
gl-field-error-ignore
'
;
const
customValidationFlag
=
'
gl-field-error-ignore
'
;
class
GlFieldErrors
{
class
GlFieldErrors
{
constructor
(
form
)
{
this
.
form
=
$
(
form
);
this
.
state
=
{
...
...
@@ -22,7 +21,7 @@ require('./gl_field_error');
this
.
state
.
inputs
=
this
.
form
.
find
(
validateSelectors
).
toArray
()
.
filter
((
input
)
=>
!
input
.
classList
.
contains
(
customValidationFlag
))
.
map
((
input
)
=>
new
globa
l
.
GlFieldError
({
input
,
formErrors
:
this
}));
.
map
((
input
)
=>
new
window
.
g
l
.
GlFieldError
({
input
,
formErrors
:
this
}));
this
.
form
.
on
(
'
submit
'
,
this
.
catchInvalidFormSubmit
);
}
...
...
@@ -42,7 +41,7 @@ require('./gl_field_error');
const
firstInvalid
=
this
.
state
.
inputs
.
filter
((
input
)
=>
!
input
.
inputDomElement
.
validity
.
valid
)[
0
];
firstInvalid
.
inputElement
.
focus
();
}
}
}
global
.
GlFieldErrors
=
GlFieldErrors
;
})(
window
.
gl
||
(
window
.
gl
=
{}))
;
window
.
gl
=
window
.
gl
||
{}
;
window
.
gl
.
GlFieldErrors
=
GlFieldErrors
;
app/assets/javascripts/gl_form.js
View file @
302d0453
...
...
@@ -3,10 +3,9 @@
/* global DropzoneInput */
/* global autosize */
(()
=>
{
const
global
=
window
.
gl
||
(
window
.
gl
=
{});
window
.
gl
=
window
.
gl
||
{};
function
GLForm
(
form
)
{
function
GLForm
(
form
)
{
this
.
form
=
form
;
this
.
textarea
=
this
.
form
.
find
(
'
textarea.js-gfm-input
'
);
// Before we start, we should clean up any previous data for this form
...
...
@@ -14,15 +13,15 @@
// Setup the form
this
.
setupForm
();
this
.
form
.
data
(
'
gl-form
'
,
this
);
}
}
GLForm
.
prototype
.
destroy
=
function
()
{
GLForm
.
prototype
.
destroy
=
function
()
{
// Clean form listeners
this
.
clearEventListeners
();
return
this
.
form
.
data
(
'
gl-form
'
,
null
);
};
};
GLForm
.
prototype
.
setupForm
=
function
()
{
GLForm
.
prototype
.
setupForm
=
function
()
{
var
isNewForm
;
isNewForm
=
this
.
form
.
is
(
'
:not(.gfm-form)
'
);
this
.
form
.
removeClass
(
'
js-new-note-form
'
);
...
...
@@ -42,9 +41,9 @@
this
.
form
.
find
(
'
.js-note-discard
'
).
hide
();
this
.
form
.
show
();
if
(
this
.
isAutosizeable
)
this
.
setupAutosize
();
};
};
GLForm
.
prototype
.
setupAutosize
=
function
()
{
GLForm
.
prototype
.
setupAutosize
=
function
()
{
this
.
textarea
.
off
(
'
autosize:resized
'
)
.
on
(
'
autosize:resized
'
,
this
.
setHeightData
.
bind
(
this
));
...
...
@@ -55,13 +54,13 @@
autosize
(
this
.
textarea
);
this
.
textarea
.
css
(
'
resize
'
,
'
vertical
'
);
},
0
);
};
};
GLForm
.
prototype
.
setHeightData
=
function
()
{
GLForm
.
prototype
.
setHeightData
=
function
()
{
this
.
textarea
.
data
(
'
height
'
,
this
.
textarea
.
outerHeight
());
};
};
GLForm
.
prototype
.
destroyAutosize
=
function
()
{
GLForm
.
prototype
.
destroyAutosize
=
function
()
{
const
outerHeight
=
this
.
textarea
.
outerHeight
();
if
(
this
.
textarea
.
data
(
'
height
'
)
===
outerHeight
)
return
;
...
...
@@ -71,22 +70,21 @@
this
.
textarea
.
data
(
'
height
'
,
outerHeight
);
this
.
textarea
.
outerHeight
(
outerHeight
);
this
.
textarea
.
css
(
'
max-height
'
,
window
.
outerHeight
);
};
};
GLForm
.
prototype
.
clearEventListeners
=
function
()
{
GLForm
.
prototype
.
clearEventListeners
=
function
()
{
this
.
textarea
.
off
(
'
focus
'
);
this
.
textarea
.
off
(
'
blur
'
);
return
gl
.
text
.
removeListeners
(
this
.
form
);
};
};
GLForm
.
prototype
.
addEventListeners
=
function
()
{
GLForm
.
prototype
.
addEventListeners
=
function
()
{
this
.
textarea
.
on
(
'
focus
'
,
function
()
{
return
$
(
this
).
closest
(
'
.md-area
'
).
addClass
(
'
is-focused
'
);
});
return
this
.
textarea
.
on
(
'
blur
'
,
function
()
{
return
$
(
this
).
closest
(
'
.md-area
'
).
removeClass
(
'
is-focused
'
);
});
};
};
global
.
GLForm
=
GLForm
;
})();
window
.
gl
.
GLForm
=
GLForm
;
app/assets/javascripts/group_avatar.js
View file @
302d0453
/* eslint-disable func-names, space-before-function-paren, wrap-iife, quotes, no-var, one-var, one-var-declaration-per-line, no-useless-escape, max-len */
(
function
()
{
this
.
GroupAvatar
=
(
function
()
{
window
.
GroupAvatar
=
(
function
()
{
function
GroupAvatar
()
{
$
(
'
.js-choose-group-avatar-button
'
).
on
(
"
click
"
,
function
()
{
var
form
;
...
...
@@ -16,5 +16,4 @@
}
return
GroupAvatar
;
})();
}).
call
(
window
);
})();
app/assets/javascripts/group_label_subscription.js
View file @
302d0453
/* eslint-disable func-names, object-shorthand, comma-dangle, wrap-iife, space-before-function-paren, no-param-reassign, max-len */
(
function
(
global
)
{
class
GroupLabelSubscription
{
class
GroupLabelSubscription
{
constructor
(
container
)
{
const
$container
=
$
(
container
);
this
.
$dropdown
=
$container
.
find
(
'
.dropdown
'
);
...
...
@@ -47,7 +46,7 @@
this
.
$subscribeButtons
.
toggleClass
(
'
hidden
'
);
this
.
$unsubscribeButtons
.
toggleClass
(
'
hidden
'
);
}
}
}
global
.
GroupLabelSubscription
=
GroupLabelSubscription
;
})(
window
.
gl
||
(
window
.
gl
=
{}))
;
window
.
gl
=
window
.
gl
||
{}
;
window
.
gl
.
GroupLabelSubscription
=
GroupLabelSubscription
;
app/assets/javascripts/groups_select.js
View file @
302d0453
/* eslint-disable func-names, space-before-function-paren, no-var, wrap-iife, one-var, camelcase, one-var-declaration-per-line, quotes, object-shorthand, prefer-arrow-callback, comma-dangle, consistent-return, yoda, prefer-rest-params, prefer-spread, no-unused-vars, prefer-template, max-len */
/* global Api */
(
function
()
{
var
slice
=
[].
slice
;
var
slice
=
[].
slice
;
this
.
GroupsSelect
=
(
function
()
{
window
.
GroupsSelect
=
(
function
()
{
function
GroupsSelect
()
{
$
(
'
.ajax-groups-select
'
).
each
((
function
(
_this
)
{
return
function
(
i
,
select
)
{
...
...
@@ -67,5 +66,4 @@
};
return
GroupsSelect
;
})();
}).
call
(
window
);
})();
app/assets/javascripts/header.js
View file @
302d0453
/* eslint-disable
wrap-iife, func-names, space-before-function-paren, prefer-arrow-callback, no-var, max-len
*/
(
function
()
{
$
(
document
).
on
(
'
todo:toggle
'
,
function
(
e
,
count
)
{
/* eslint-disable
func-names, space-before-function-paren, prefer-arrow-callback, no-var
*/
$
(
document
).
on
(
'
todo:toggle
'
,
function
(
e
,
count
)
{
var
$todoPendingCount
=
$
(
'
.todos-pending-count
'
);
$todoPendingCount
.
text
(
gl
.
text
.
highCountTrim
(
count
));
$todoPendingCount
.
toggleClass
(
'
hidden
'
,
count
===
0
);
});
})();
});
app/assets/javascripts/main.js
View file @
302d0453
...
...
@@ -198,21 +198,20 @@ import './visibility_select';
import
'
./wikis
'
;
import
'
./zen_mode
'
;
(
function
()
{
document
.
addEventListener
(
'
beforeunload
'
,
function
()
{
document
.
addEventListener
(
'
beforeunload
'
,
function
()
{
// Unbind scroll events
$
(
document
).
off
(
'
scroll
'
);
// Close any open tooltips
$
(
'
.has-tooltip, [data-toggle="tooltip"]
'
).
tooltip
(
'
destroy
'
);
});
});
window
.
addEventListener
(
'
hashchange
'
,
gl
.
utils
.
handleLocationHash
);
window
.
addEventListener
(
'
load
'
,
function
onLoad
()
{
window
.
addEventListener
(
'
hashchange
'
,
gl
.
utils
.
handleLocationHash
);
window
.
addEventListener
(
'
load
'
,
function
onLoad
()
{
window
.
removeEventListener
(
'
load
'
,
onLoad
,
false
);
gl
.
utils
.
handleLocationHash
();
},
false
);
},
false
);
$
(
function
()
{
$
(
function
()
{
var
$body
=
$
(
'
body
'
);
var
$document
=
$
(
document
);
var
$window
=
$
(
window
);
...
...
@@ -382,5 +381,4 @@ import './zen_mode';
new
Aside
();
gl
.
utils
.
initTimeagoTimeout
();
});
}).
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