Commit 8796d17a authored by Mike Greiling's avatar Mike Greiling

remove IIFEs in preparation for ES module refactor

parent 1585608b
/* 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)
......@@ -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;
......@@ -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;
/* 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);
})();
/* 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;
/* 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);
})();
/* 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);
})();
/* 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;
/* 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);
});
/* 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);
})();
/* 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);
})();
(() => {
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;
/* 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);
})();
/* 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);
})();
/* 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);
})();
/* 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);
})();
/* 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);
})();
/* 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();
/* 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);
});
/* 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;
......@@ -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;
......@@ -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);
})();
......@@ -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;
......@@ -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);
};
......@@ -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;
......
/* 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);
})();
......@@ -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);
};
/* 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);
};
/* 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;
......@@ -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 global.GlFieldError({ input, formErrors: this }));
.map((input) => new window.gl.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;
......@@ -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;
/* 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);
})();
/* 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;
/* 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);
})();
/* 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);
});
})();
});
......@@ -206,21 +206,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);
......@@ -390,5 +389,4 @@ import './zen_mode';
new Aside();
gl.utils.initTimeagoTimeout();
});
}).call(window);
});
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