Commit ff5bd7a9 authored by Filipa Lacerda's avatar Filipa Lacerda

Merge branch 'remove-needless-bind-polyfills' into 'master'

Remove needless bind and indexOf polyfills

See merge request !11187
parents 914a0bbd f6d214e1
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
/* global notes */ /* global notes */
let $commentButtonTemplate; let $commentButtonTemplate;
var bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; };
window.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; 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;
...@@ -27,8 +26,8 @@ window.FilesCommentButton = (function() { ...@@ -27,8 +26,8 @@ window.FilesCommentButton = (function() {
TEXT_FILE_SELECTOR = '.text-file'; TEXT_FILE_SELECTOR = '.text-file';
function FilesCommentButton(filesContainerElement) { function FilesCommentButton(filesContainerElement) {
this.render = bind(this.render, this); this.render = this.render.bind(this);
this.hideButton = bind(this.hideButton, this); this.hideButton = this.hideButton.bind(this);
this.isParallelView = notes.isParallelView(); this.isParallelView = notes.isParallelView();
filesContainerElement.on('mouseover', LINE_COLUMN_CLASSES, this.render) filesContainerElement.on('mouseover', LINE_COLUMN_CLASSES, this.render)
.on('mouseleave', LINE_COLUMN_CLASSES, this.hideButton); .on('mouseleave', LINE_COLUMN_CLASSES, this.hideButton);
......
/* 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 */ /* 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 */ /* global fuzzaldrinPlus */
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; var ARROW_KEY_CODES, BLUR_KEYCODES, HAS_VALUE_CLASS;
...@@ -213,10 +211,10 @@ GitLabDropdown = (function() { ...@@ -213,10 +211,10 @@ GitLabDropdown = (function() {
var searchFields, selector, self; var searchFields, selector, self;
this.el = el1; this.el = el1;
this.options = options; this.options = options;
this.updateLabel = bind(this.updateLabel, this); this.updateLabel = this.updateLabel.bind(this);
this.hidden = bind(this.hidden, this); this.hidden = this.hidden.bind(this);
this.opened = bind(this.opened, this); this.opened = this.opened.bind(this);
this.shouldPropagate = bind(this.shouldPropagate, this); this.shouldPropagate = this.shouldPropagate.bind(this);
self = this; self = this;
selector = $(this.el).data("target"); selector = $(this.el).data("target");
this.dropdown = selector != null ? $(selector) : $(this.el).parent(); this.dropdown = selector != null ? $(selector) : $(this.el).parent();
...@@ -627,8 +625,8 @@ GitLabDropdown = (function() { ...@@ -627,8 +625,8 @@ GitLabDropdown = (function() {
}; };
GitLabDropdown.prototype.highlightTextMatches = function(text, term) { GitLabDropdown.prototype.highlightTextMatches = function(text, term) {
var occurrences; const occurrences = fuzzaldrinPlus.match(text, term);
occurrences = fuzzaldrinPlus.match(text, term); const indexOf = [].indexOf;
return text.split('').map(function(character, i) { return text.split('').map(function(character, i) {
if (indexOf.call(occurrences, i) !== -1) { if (indexOf.call(occurrences, i) !== -1) {
return "<b>" + character + "</b>"; return "<b>" + character + "</b>";
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
import d3 from 'd3'; import d3 from 'd3';
const bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; };
const extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; const extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
const hasProp = {}.hasOwnProperty; const hasProp = {}.hasOwnProperty;
...@@ -95,7 +94,7 @@ export const ContributorsMasterGraph = (function(superClass) { ...@@ -95,7 +94,7 @@ export const ContributorsMasterGraph = (function(superClass) {
function ContributorsMasterGraph(data1) { function ContributorsMasterGraph(data1) {
this.data = data1; this.data = data1;
this.update_content = bind(this.update_content, this); this.update_content = this.update_content.bind(this);
this.width = $('.content').width() - 70; this.width = $('.content').width() - 70;
this.height = 200; this.height = 200;
this.x = null; this.x = null;
......
...@@ -7,8 +7,6 @@ ...@@ -7,8 +7,6 @@
/* global Pikaday */ /* global Pikaday */
(function() { (function() {
var bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; };
this.IssuableForm = (function() { this.IssuableForm = (function() {
IssuableForm.prototype.issueMoveConfirmMsg = 'Are you sure you want to move this issue to another project?'; IssuableForm.prototype.issueMoveConfirmMsg = 'Are you sure you want to move this issue to another project?';
...@@ -17,10 +15,10 @@ ...@@ -17,10 +15,10 @@
function IssuableForm(form) { function IssuableForm(form) {
var $issuableDueDate, calendar; var $issuableDueDate, calendar;
this.form = form; this.form = form;
this.toggleWip = bind(this.toggleWip, this); this.toggleWip = this.toggleWip.bind(this);
this.renderWipExplanation = bind(this.renderWipExplanation, this); this.renderWipExplanation = this.renderWipExplanation.bind(this);
this.resetAutosave = bind(this.resetAutosave, this); this.resetAutosave = this.resetAutosave.bind(this);
this.handleSubmit = bind(this.handleSubmit, this); this.handleSubmit = this.handleSubmit.bind(this);
gl.GfmAutoComplete.setup(); gl.GfmAutoComplete.setup();
new UsersSelect(); new UsersSelect();
new ZenMode(); new ZenMode();
......
/* eslint-disable func-names, space-before-function-paren, no-var, prefer-rest-params, wrap-iife, vars-on-top, no-unused-vars, max-len */ /* eslint-disable func-names, space-before-function-paren, no-var, prefer-rest-params, wrap-iife, vars-on-top, no-unused-vars, max-len */
(function() { (function() {
var bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; };
this.Labels = (function() { this.Labels = (function() {
function Labels() { function Labels() {
this.setSuggestedColor = bind(this.setSuggestedColor, this); this.setSuggestedColor = this.setSuggestedColor.bind(this);
this.updateColorPreview = bind(this.updateColorPreview, this); this.updateColorPreview = this.updateColorPreview.bind(this);
var form; var form;
form = $('.label-form'); form = $('.label-form');
this.cleanBinding(); this.cleanBinding();
......
...@@ -31,8 +31,6 @@ require('vendor/jquery.scrollTo'); ...@@ -31,8 +31,6 @@ require('vendor/jquery.scrollTo');
// </div> // </div>
// //
(function() { (function() {
var bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; };
this.LineHighlighter = (function() { this.LineHighlighter = (function() {
// CSS class applied to highlighted lines // CSS class applied to highlighted lines
LineHighlighter.prototype.highlightClass = 'hll'; LineHighlighter.prototype.highlightClass = 'hll';
...@@ -47,9 +45,9 @@ require('vendor/jquery.scrollTo'); ...@@ -47,9 +45,9 @@ require('vendor/jquery.scrollTo');
// hash - String URL hash for dependency injection in tests // hash - String URL hash for dependency injection in tests
hash = location.hash; hash = location.hash;
} }
this.setHash = bind(this.setHash, this); this.setHash = this.setHash.bind(this);
this.highlightLine = bind(this.highlightLine, this); this.highlightLine = this.highlightLine.bind(this);
this.clickHandler = bind(this.clickHandler, this); this.clickHandler = this.clickHandler.bind(this);
this.highlightHash = this.highlightHash.bind(this); this.highlightHash = this.highlightHash.bind(this);
this._hash = hash; this._hash = hash;
this.bindEvents(); this.bindEvents();
......
...@@ -6,8 +6,6 @@ require('./task_list'); ...@@ -6,8 +6,6 @@ require('./task_list');
require('./merge_request_tabs'); require('./merge_request_tabs');
(function() { (function() {
var bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; };
this.MergeRequest = (function() { this.MergeRequest = (function() {
function MergeRequest(opts) { function MergeRequest(opts) {
// Initialize MergeRequest behavior // Initialize MergeRequest behavior
...@@ -16,7 +14,7 @@ require('./merge_request_tabs'); ...@@ -16,7 +14,7 @@ require('./merge_request_tabs');
// action - String, current controller action // action - String, current controller action
// //
this.opts = opts != null ? opts : {}; this.opts = opts != null ? opts : {};
this.submitNoteForm = bind(this.submitNoteForm, this); this.submitNoteForm = this.submitNoteForm.bind(this);
this.$el = $('.merge-request'); this.$el = $('.merge-request');
this.$('.show-all-commits').on('click', (function(_this) { this.$('.show-all-commits').on('click', (function(_this) {
return function() { return function() {
......
...@@ -7,8 +7,6 @@ import './smart_interval'; ...@@ -7,8 +7,6 @@ import './smart_interval';
import MiniPipelineGraph from './mini_pipeline_graph_dropdown'; import MiniPipelineGraph from './mini_pipeline_graph_dropdown';
((global) => { ((global) => {
var 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; };
const DEPLOYMENT_TEMPLATE = `<div class="mr-widget-heading" id="<%- id %>"> const DEPLOYMENT_TEMPLATE = `<div class="mr-widget-heading" id="<%- id %>">
<div class="ci_widget ci-success"> <div class="ci_widget ci-success">
<%= ci_success_icon %> <%= ci_success_icon %>
...@@ -258,7 +256,7 @@ import MiniPipelineGraph from './mini_pipeline_graph_dropdown'; ...@@ -258,7 +256,7 @@ import MiniPipelineGraph from './mini_pipeline_graph_dropdown';
let stateClass = 'btn-danger'; let stateClass = 'btn-danger';
if (!hasCi) { if (!hasCi) {
stateClass = 'btn-create'; stateClass = 'btn-create';
} else if (indexOf.call(allowed_states, state) !== -1) { } else if (allowed_states.indexOf(state) !== -1) {
switch (state) { switch (state) {
case "failed": case "failed":
case "canceled": case "canceled":
......
...@@ -2,11 +2,9 @@ ...@@ -2,11 +2,9 @@
/* global Api */ /* global Api */
(function() { (function() {
var bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; };
window.NamespaceSelect = (function() { window.NamespaceSelect = (function() {
function NamespaceSelect(opts) { function NamespaceSelect(opts) {
this.onSelectItem = bind(this.onSelectItem, this); this.onSelectItem = this.onSelectItem.bind(this);
var fieldName, showAny; var fieldName, showAny;
this.dropdown = opts.dropdown; this.dropdown = opts.dropdown;
showAny = true; showAny = true;
......
/* eslint-disable func-names, space-before-function-paren, no-var, one-var, prefer-rest-params, max-len, vars-on-top, wrap-iife, consistent-return, comma-dangle, one-var-declaration-per-line, quotes, no-return-assign, prefer-arrow-callback, prefer-template, no-shadow, no-else-return, max-len, object-shorthand */ /* eslint-disable func-names, space-before-function-paren, no-var, one-var, prefer-rest-params, max-len, vars-on-top, wrap-iife, consistent-return, comma-dangle, one-var-declaration-per-line, quotes, no-return-assign, prefer-arrow-callback, prefer-template, no-shadow, no-else-return, max-len, object-shorthand */
(function() { (function() {
var 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; };
this.NewBranchForm = (function() { this.NewBranchForm = (function() {
function NewBranchForm(form, availableRefs) { function NewBranchForm(form, availableRefs) {
this.validate = bind(this.validate, this); this.validate = this.validate.bind(this);
this.branchNameError = form.find('.js-branch-name-error'); this.branchNameError = form.find('.js-branch-name-error');
this.name = form.find('.js-branch-name'); this.name = form.find('.js-branch-name');
this.ref = form.find('#ref'); this.ref = form.find('#ref');
...@@ -95,6 +92,8 @@ ...@@ -95,6 +92,8 @@
NewBranchForm.prototype.validate = function() { NewBranchForm.prototype.validate = function() {
var errorMessage, errors, formatter, unique, validator; var errorMessage, errors, formatter, unique, validator;
const indexOf = [].indexOf;
this.branchNameError.empty(); this.branchNameError.empty();
unique = function(values, value) { unique = function(values, value) {
if (indexOf.call(values, value) === -1) { if (indexOf.call(values, value) === -1) {
......
/* eslint-disable func-names, space-before-function-paren, no-var, prefer-rest-params, wrap-iife, no-return-assign, max-len */ /* eslint-disable func-names, space-before-function-paren, no-var, prefer-rest-params, wrap-iife, no-return-assign, max-len */
(function() { (function() {
var bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; };
this.NewCommitForm = (function() { this.NewCommitForm = (function() {
function NewCommitForm(form, targetBranchName = 'target_branch') { function NewCommitForm(form, targetBranchName = 'target_branch') {
this.form = form; this.form = form;
this.targetBranchName = targetBranchName; this.targetBranchName = targetBranchName;
this.renderDestination = bind(this.renderDestination, this); this.renderDestination = this.renderDestination.bind(this);
this.targetBranchDropdown = form.find('button.js-target-branch'); this.targetBranchDropdown = form.find('button.js-target-branch');
this.originalBranch = form.find('.js-original-branch'); this.originalBranch = form.find('.js-original-branch');
this.createMergeRequest = form.find('.js-create-merge-request'); this.createMergeRequest = form.find('.js-create-merge-request');
......
...@@ -22,8 +22,6 @@ const normalizeNewlines = function(str) { ...@@ -22,8 +22,6 @@ const normalizeNewlines = function(str) {
}; };
(function() { (function() {
var bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; };
this.Notes = (function() { this.Notes = (function() {
const MAX_VISIBLE_COMMIT_LIST_COUNT = 3; const MAX_VISIBLE_COMMIT_LIST_COUNT = 3;
const REGEX_SLASH_COMMANDS = /\/\w+/g; const REGEX_SLASH_COMMANDS = /\/\w+/g;
...@@ -31,24 +29,24 @@ const normalizeNewlines = function(str) { ...@@ -31,24 +29,24 @@ const normalizeNewlines = function(str) {
Notes.interval = null; Notes.interval = null;
function Notes(notes_url, note_ids, last_fetched_at, view) { function Notes(notes_url, note_ids, last_fetched_at, view) {
this.updateTargetButtons = bind(this.updateTargetButtons, this); this.updateTargetButtons = this.updateTargetButtons.bind(this);
this.updateComment = bind(this.updateComment, this); this.updateComment = this.updateComment.bind(this);
this.visibilityChange = bind(this.visibilityChange, this); this.visibilityChange = this.visibilityChange.bind(this);
this.cancelDiscussionForm = bind(this.cancelDiscussionForm, this); this.cancelDiscussionForm = this.cancelDiscussionForm.bind(this);
this.addDiffNote = bind(this.addDiffNote, this); this.addDiffNote = this.addDiffNote.bind(this);
this.setupDiscussionNoteForm = bind(this.setupDiscussionNoteForm, this); this.setupDiscussionNoteForm = this.setupDiscussionNoteForm.bind(this);
this.replyToDiscussionNote = bind(this.replyToDiscussionNote, this); this.replyToDiscussionNote = this.replyToDiscussionNote.bind(this);
this.removeNote = bind(this.removeNote, this); this.removeNote = this.removeNote.bind(this);
this.cancelEdit = bind(this.cancelEdit, this); this.cancelEdit = this.cancelEdit.bind(this);
this.updateNote = bind(this.updateNote, this); this.updateNote = this.updateNote.bind(this);
this.addDiscussionNote = bind(this.addDiscussionNote, this); this.addDiscussionNote = this.addDiscussionNote.bind(this);
this.addNoteError = bind(this.addNoteError, this); this.addNoteError = this.addNoteError.bind(this);
this.addNote = bind(this.addNote, this); this.addNote = this.addNote.bind(this);
this.resetMainTargetForm = bind(this.resetMainTargetForm, this); this.resetMainTargetForm = this.resetMainTargetForm.bind(this);
this.refresh = bind(this.refresh, this); this.refresh = this.refresh.bind(this);
this.keydownNoteText = bind(this.keydownNoteText, this); this.keydownNoteText = this.keydownNoteText.bind(this);
this.toggleCommitList = bind(this.toggleCommitList, this); this.toggleCommitList = this.toggleCommitList.bind(this);
this.postComment = bind(this.postComment, this); this.postComment = this.postComment.bind(this);
this.notes_url = notes_url; this.notes_url = notes_url;
this.note_ids = note_ids; this.note_ids = note_ids;
......
/* eslint-disable func-names, space-before-function-paren, no-var, prefer-rest-params, wrap-iife, one-var, one-var-declaration-per-line, newline-per-chained-call, comma-dangle, consistent-return, prefer-arrow-callback, max-len */ /* eslint-disable func-names, space-before-function-paren, no-var, prefer-rest-params, wrap-iife, one-var, one-var-declaration-per-line, newline-per-chained-call, comma-dangle, consistent-return, prefer-arrow-callback, max-len */
(function() { (function() {
var bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; };
this.NotificationsForm = (function() { this.NotificationsForm = (function() {
function NotificationsForm() { function NotificationsForm() {
this.toggleCheckbox = bind(this.toggleCheckbox, this); this.toggleCheckbox = this.toggleCheckbox.bind(this);
this.removeEventListeners(); this.removeEventListeners();
this.initEventListeners(); this.initEventListeners();
} }
......
...@@ -2,18 +2,16 @@ ...@@ -2,18 +2,16 @@
/* global fuzzaldrinPlus */ /* global fuzzaldrinPlus */
(function() { (function() {
var bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; };
this.ProjectFindFile = (function() { this.ProjectFindFile = (function() {
var highlighter; var highlighter;
function ProjectFindFile(element1, options) { function ProjectFindFile(element1, options) {
this.element = element1; this.element = element1;
this.options = options; this.options = options;
this.goToBlob = bind(this.goToBlob, this); this.goToBlob = this.goToBlob.bind(this);
this.goToTree = bind(this.goToTree, this); this.goToTree = this.goToTree.bind(this);
this.selectRowDown = bind(this.selectRowDown, this); this.selectRowDown = this.selectRowDown.bind(this);
this.selectRowUp = bind(this.selectRowUp, this); this.selectRowUp = this.selectRowUp.bind(this);
this.filePaths = {}; this.filePaths = {};
this.inputElement = this.element.find(".file-finder-input"); this.inputElement = this.element.find(".file-finder-input");
// init event // init event
......
/* eslint-disable func-names, space-before-function-paren, no-var, prefer-rest-params, wrap-iife, no-unused-vars, one-var, no-underscore-dangle, prefer-template, no-else-return, prefer-arrow-callback, max-len */ /* eslint-disable func-names, space-before-function-paren, no-var, prefer-rest-params, wrap-iife, no-unused-vars, one-var, no-underscore-dangle, prefer-template, no-else-return, prefer-arrow-callback, max-len */
(function() { (function() {
var bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; };
this.ProjectNew = (function() { this.ProjectNew = (function() {
function ProjectNew() { function ProjectNew() {
this.toggleSettings = bind(this.toggleSettings, this); this.toggleSettings = this.toggleSettings.bind(this);
this.$selects = $('.features select'); this.$selects = $('.features select');
this.$repoSelects = this.$selects.filter('.js-repo-select'); this.$repoSelects = this.$selects.filter('.js-repo-select');
......
...@@ -3,11 +3,9 @@ ...@@ -3,11 +3,9 @@
import Cookies from 'js-cookie'; import Cookies from 'js-cookie';
(function() { (function() {
var bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; };
this.Sidebar = (function() { this.Sidebar = (function() {
function Sidebar(currentUser) { function Sidebar(currentUser) {
this.toggleTodo = bind(this.toggleTodo, this); this.toggleTodo = this.toggleTodo.bind(this);
this.sidebar = $('aside'); this.sidebar = $('aside');
this.removeListeners(); this.removeListeners();
this.addEventListeners(); this.addEventListeners();
......
...@@ -4,11 +4,9 @@ ...@@ -4,11 +4,9 @@
import findAndFollowLink from './shortcuts_dashboard_navigation'; import findAndFollowLink from './shortcuts_dashboard_navigation';
(function() { (function() {
var bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; };
this.Shortcuts = (function() { this.Shortcuts = (function() {
function Shortcuts(skipResetBindings) { function Shortcuts(skipResetBindings) {
this.onToggleHelp = bind(this.onToggleHelp, this); this.onToggleHelp = this.onToggleHelp.bind(this);
this.enabledHelp = []; this.enabledHelp = [];
if (!skipResetBindings) { if (!skipResetBindings) {
Mousetrap.reset(); Mousetrap.reset();
......
/* eslint-disable func-names, prefer-arrow-callback, space-before-function-paren, no-var, prefer-rest-params, wrap-iife, one-var, one-var-declaration-per-line, consistent-return, no-param-reassign, max-len */ /* eslint-disable func-names, prefer-arrow-callback, space-before-function-paren, no-var, prefer-rest-params, wrap-iife, one-var, one-var-declaration-per-line, consistent-return, no-param-reassign, max-len */
(function() { (function() {
var bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; };
window.SingleFileDiff = (function() { window.SingleFileDiff = (function() {
var COLLAPSED_HTML, ERROR_HTML, LOADING_HTML, WRAPPER; var COLLAPSED_HTML, ERROR_HTML, LOADING_HTML, WRAPPER;
...@@ -16,7 +14,7 @@ ...@@ -16,7 +14,7 @@
function SingleFileDiff(file) { function SingleFileDiff(file) {
this.file = file; this.file = file;
this.toggleDiff = bind(this.toggleDiff, this); this.toggleDiff = this.toggleDiff.bind(this);
this.content = $('.diff-content', this.file); this.content = $('.diff-content', this.file);
this.$toggleIcon = $('.diff-toggle-caret', this.file); this.$toggleIcon = $('.diff-toggle-caret', this.file);
this.diffForPath = this.content.find('[data-diff-for-path]').data('diff-for-path'); this.diffForPath = this.content.find('[data-diff-for-path]').data('diff-for-path');
......
...@@ -10,18 +10,16 @@ ...@@ -10,18 +10,16 @@
(function() { (function() {
const global = window.gl || (window.gl = {}); const global = window.gl || (window.gl = {});
var bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; };
global.U2FAuthenticate = (function() { global.U2FAuthenticate = (function() {
function U2FAuthenticate(container, form, u2fParams, fallbackButton, fallbackUI) { function U2FAuthenticate(container, form, u2fParams, fallbackButton, fallbackUI) {
this.container = container; this.container = container;
this.renderNotSupported = bind(this.renderNotSupported, this); this.renderNotSupported = this.renderNotSupported.bind(this);
this.renderAuthenticated = bind(this.renderAuthenticated, this); this.renderAuthenticated = this.renderAuthenticated.bind(this);
this.renderError = bind(this.renderError, this); this.renderError = this.renderError.bind(this);
this.renderInProgress = bind(this.renderInProgress, this); this.renderInProgress = this.renderInProgress.bind(this);
this.renderTemplate = bind(this.renderTemplate, this); this.renderTemplate = this.renderTemplate.bind(this);
this.authenticate = bind(this.authenticate, this); this.authenticate = this.authenticate.bind(this);
this.start = bind(this.start, this); this.start = this.start.bind(this);
this.appId = u2fParams.app_id; this.appId = u2fParams.app_id;
this.challenge = u2fParams.challenge; this.challenge = u2fParams.challenge;
this.form = form; this.form = form;
......
...@@ -2,12 +2,10 @@ ...@@ -2,12 +2,10 @@
/* global u2f */ /* global u2f */
(function() { (function() {
var bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; };
this.U2FError = (function() { this.U2FError = (function() {
function U2FError(errorCode, u2fFlowType) { function U2FError(errorCode, u2fFlowType) {
this.errorCode = errorCode; this.errorCode = errorCode;
this.message = bind(this.message, this); this.message = this.message.bind(this);
this.httpsDisabled = window.location.protocol !== 'https:'; this.httpsDisabled = window.location.protocol !== 'https:';
this.u2fFlowType = u2fFlowType; this.u2fFlowType = u2fFlowType;
} }
......
...@@ -8,19 +8,17 @@ ...@@ -8,19 +8,17 @@
// State Flow #1: setup -> in_progress -> registered -> POST to server // State Flow #1: setup -> in_progress -> registered -> POST to server
// State Flow #2: setup -> in_progress -> error -> setup // State Flow #2: setup -> in_progress -> error -> setup
(function() { (function() {
var bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; };
this.U2FRegister = (function() { this.U2FRegister = (function() {
function U2FRegister(container, u2fParams) { function U2FRegister(container, u2fParams) {
this.container = container; this.container = container;
this.renderNotSupported = bind(this.renderNotSupported, this); this.renderNotSupported = this.renderNotSupported.bind(this);
this.renderRegistered = bind(this.renderRegistered, this); this.renderRegistered = this.renderRegistered.bind(this);
this.renderError = bind(this.renderError, this); this.renderError = this.renderError.bind(this);
this.renderInProgress = bind(this.renderInProgress, this); this.renderInProgress = this.renderInProgress.bind(this);
this.renderSetup = bind(this.renderSetup, this); this.renderSetup = this.renderSetup.bind(this);
this.renderTemplate = bind(this.renderTemplate, this); this.renderTemplate = this.renderTemplate.bind(this);
this.register = bind(this.register, this); this.register = this.register.bind(this);
this.start = bind(this.start, this); this.start = this.start.bind(this);
this.appId = u2fParams.app_id; this.appId = u2fParams.app_id;
this.registerRequests = u2fParams.register_requests; this.registerRequests = u2fParams.register_requests;
this.signRequests = u2fParams.sign_requests; this.signRequests = u2fParams.sign_requests;
......
...@@ -3,12 +3,10 @@ ...@@ -3,12 +3,10 @@
import d3 from 'd3'; import d3 from 'd3';
(function() { (function() {
var bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; };
this.Calendar = (function() { this.Calendar = (function() {
function Calendar(timestamps, calendar_activities_path) { function Calendar(timestamps, calendar_activities_path) {
this.calendar_activities_path = calendar_activities_path; this.calendar_activities_path = calendar_activities_path;
this.clickDay = bind(this.clickDay, this); this.clickDay = this.clickDay.bind(this);
this.currentSelectedDate = ''; this.currentSelectedDate = '';
this.daySpace = 1; this.daySpace = 1;
this.daySize = 15; this.daySize = 15;
......
...@@ -6,14 +6,13 @@ ...@@ -6,14 +6,13 @@
window.emitSidebarEvent = window.emitSidebarEvent || $.noop; window.emitSidebarEvent = window.emitSidebarEvent || $.noop;
(function() { (function() {
var bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; }, const slice = [].slice;
slice = [].slice;
this.UsersSelect = (function() { this.UsersSelect = (function() {
function UsersSelect(currentUser, els) { function UsersSelect(currentUser, els) {
var $els; var $els;
this.users = bind(this.users, this); this.users = this.users.bind(this);
this.user = bind(this.user, this); this.user = this.user.bind(this);
this.usersPath = "/autocomplete/users.json"; this.usersPath = "/autocomplete/users.json";
this.userPath = "/autocomplete/users/:id.json"; this.userPath = "/autocomplete/users/:id.json";
if (currentUser != null) { if (currentUser != null) {
......
/* eslint-disable space-before-function-paren, no-var, prefer-rest-params, wrap-iife, no-unused-expressions, no-return-assign, no-param-reassign, max-len */ /* eslint-disable space-before-function-paren, no-var, prefer-rest-params, wrap-iife, no-unused-expressions, no-return-assign, no-param-reassign, max-len */
(function() { (function() {
var bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; };
this.MockU2FDevice = (function() { this.MockU2FDevice = (function() {
function MockU2FDevice() { function MockU2FDevice() {
this.respondToAuthenticateRequest = bind(this.respondToAuthenticateRequest, this); this.respondToAuthenticateRequest = this.respondToAuthenticateRequest.bind(this);
this.respondToRegisterRequest = bind(this.respondToRegisterRequest, this); this.respondToRegisterRequest = this.respondToRegisterRequest.bind(this);
window.u2f || (window.u2f = {}); window.u2f || (window.u2f = {});
window.u2f.register = (function(_this) { window.u2f.register = (function(_this) {
return function(appId, registerRequests, signRequests, callback) { return function(appId, registerRequests, signRequests, callback) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment