Skip to content
Snippets Groups Projects
Unverified Commit c559bcca authored by Mike Greiling's avatar Mike Greiling
Browse files

Prettify additional modules (I through Z)

parent aeaf6686
No related branches found
No related tags found
1 merge request!10495Merge Requests - Assignee
Loading
Loading
@@ -12,7 +12,7 @@ export default function simulateInput(target, text) {
}
 
if (text.length > 0) {
Array.prototype.forEach.call(text, (char) => {
Array.prototype.forEach.call(text, char => {
input.value += char;
triggerEvents(input);
});
Loading
Loading
Loading
Loading
@@ -49,7 +49,7 @@ function onToggleClicked(toggle, input, clickCallback) {
export default function setupToggleButtons(container, clickCallback = () => {}) {
const toggles = container.querySelectorAll('.js-project-feature-toggle');
 
toggles.forEach((toggle) => {
toggles.forEach(toggle => {
const input = toggle.querySelector('.js-project-feature-toggle-input');
const isOn = convertPermissionToBoolean(input.value);
 
Loading
Loading
Loading
Loading
@@ -8,7 +8,7 @@ export default class TreeView {
this.initKeyNav();
// Code browser tree slider
// Make the entire tree-item row clickable, but not if clicking another link (like a commit message)
$(".tree-content-holder .tree-item").on('click', function(e) {
$('.tree-content-holder .tree-item').on('click', function(e) {
var $clickedEl, path;
$clickedEl = $(e.target);
path = $('.tree-item-file-name a', this).attr('href');
Loading
Loading
@@ -27,33 +27,33 @@ export default class TreeView {
 
initKeyNav() {
var li, liSelected;
li = $("tr.tree-item");
li = $('tr.tree-item');
liSelected = null;
return $('body').keydown(function(e) {
var next, path;
if ($("input:focus").length > 0 && (e.which === 38 || e.which === 40)) {
if ($('input:focus').length > 0 && (e.which === 38 || e.which === 40)) {
return false;
}
if (e.which === 40) {
if (liSelected) {
next = liSelected.next();
if (next.length > 0) {
liSelected.removeClass("selected");
liSelected = next.addClass("selected");
liSelected.removeClass('selected');
liSelected = next.addClass('selected');
}
} else {
liSelected = li.eq(0).addClass("selected");
liSelected = li.eq(0).addClass('selected');
}
return $(liSelected).focus();
} else if (e.which === 38) {
if (liSelected) {
next = liSelected.prev();
if (next.length > 0) {
liSelected.removeClass("selected");
liSelected = next.addClass("selected");
liSelected.removeClass('selected');
liSelected = next.addClass('selected');
}
} else {
liSelected = li.last().addClass("selected");
liSelected = li.last().addClass('selected');
}
return $(liSelected).focus();
} else if (e.which === 13) {
Loading
Loading
Loading
Loading
@@ -49,7 +49,7 @@ export default class U2FAuthenticate {
 
start() {
return importU2FLibrary()
.then((utils) => {
.then(utils => {
this.u2fUtils = utils;
this.renderInProgress();
})
Loading
Loading
@@ -57,14 +57,19 @@ export default class U2FAuthenticate {
}
 
authenticate() {
return this.u2fUtils.sign(this.appId, this.challenge, this.signRequests,
(response) => {
return this.u2fUtils.sign(
this.appId,
this.challenge,
this.signRequests,
response => {
if (response.errorCode) {
const error = new U2FError(response.errorCode, 'authenticate');
return this.renderError(error);
}
return this.renderAuthenticated(JSON.stringify(response));
}, 10);
},
10,
);
}
 
renderTemplate(name, params) {
Loading
Loading
@@ -99,5 +104,4 @@ export default class U2FAuthenticate {
this.container[0].classList.add('hidden');
this.fallbackUI.classList.remove('hidden');
}
}
Loading
Loading
@@ -34,7 +34,7 @@ export default class U2FRegister {
 
start() {
return importU2FLibrary()
.then((utils) => {
.then(utils => {
this.u2fUtils = utils;
this.renderSetup();
})
Loading
Loading
@@ -42,14 +42,19 @@ export default class U2FRegister {
}
 
register() {
return this.u2fUtils.register(this.appId, this.registerRequests, this.signRequests,
(response) => {
return this.u2fUtils.register(
this.appId,
this.registerRequests,
this.signRequests,
response => {
if (response.errorCode) {
const error = new U2FError(response.errorCode, 'register');
return this.renderError(error);
}
return this.renderRegistered(JSON.stringify(response));
}, 10);
},
10,
);
}
 
renderTemplate(name, params) {
Loading
Loading
Loading
Loading
@@ -19,11 +19,10 @@ function getChromeVersion(userAgent) {
export function canInjectU2fApi(userAgent) {
const isSupportedChrome = isChrome(userAgent) && getChromeVersion(userAgent) >= 41;
const isSupportedOpera = isOpera(userAgent) && getOperaVersion(userAgent) >= 40;
const isMobile = (
const isMobile =
userAgent.indexOf('droid') >= 0 ||
userAgent.indexOf('CriOS') >= 0 ||
/\b(iPad|iPhone|iPod)(?=;)/.test(userAgent)
);
/\b(iPad|iPhone|iPod)(?=;)/.test(userAgent);
return (isSupportedChrome || isSupportedOpera) && !isMobile;
}
 
Loading
Loading
Loading
Loading
@@ -4,13 +4,17 @@ import Api from './api';
export default () => {
$('#js-project-dropdown').glDropdown({
data: (term, callback) => {
Api.projects(term, {
order_by: 'last_activity_at',
}, (data) => {
callback(data);
});
Api.projects(
term,
{
order_by: 'last_activity_at',
},
data => {
callback(data);
},
);
},
text: project => (project.name_with_namespace || project.name),
text: project => project.name_with_namespace || project.name,
selectable: true,
fieldName: 'author_id',
filterable: true,
Loading
Loading
@@ -18,6 +22,6 @@ export default () => {
fields: ['name_with_namespace'],
},
id: data => data.id,
isSelected: data => (data.id === 2),
isSelected: data => data.id === 2,
});
};
Loading
Loading
@@ -4,7 +4,7 @@ import Flash, { hideFlash } from './flash';
import { convertPermissionToBoolean } from './lib/utils/common_utils';
 
export default () => {
$('body').on('click', '.js-usage-consent-action', (e) => {
$('body').on('click', '.js-usage-consent-action', e => {
e.preventDefault();
e.stopImmediatePropagation(); // overwrite rails listener
 
Loading
Loading
@@ -18,7 +18,8 @@ export default () => {
 
const hideConsentMessage = () => hideFlash(document.querySelector('.ping-consent-message'));
 
axios.put(url, data)
axios
.put(url, data)
.then(() => {
hideConsentMessage();
})
Loading
Loading
This diff is collapsed.
Loading
Loading
@@ -47,16 +47,26 @@ export default class ZenMode {
e.preventDefault();
return $(e.currentTarget).trigger('zen_mode:leave');
});
$(document).on('zen_mode:enter', (function(_this) {
return function(e) {
return _this.enter($(e.target).closest('.md-area').find('.zen-backdrop'));
};
})(this));
$(document).on('zen_mode:leave', (function(_this) {
return function(e) {
return _this.exit();
};
})(this));
$(document).on(
'zen_mode:enter',
(function(_this) {
return function(e) {
return _this.enter(
$(e.target)
.closest('.md-area')
.find('.zen-backdrop'),
);
};
})(this),
);
$(document).on(
'zen_mode:leave',
(function(_this) {
return function(e) {
return _this.exit();
};
})(this),
);
$(document).on('keydown', function(e) {
// Esc
if (e.keyCode === 27) {
Loading
Loading
@@ -93,7 +103,7 @@ export default class ZenMode {
 
scrollTo(zen_area) {
return $.scrollTo(zen_area, 0, {
offset: -150
offset: -150,
});
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment