Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-05-17 14:20:55 +0300
committerRémy Coutable <remy@rymai.me>2017-06-09 18:21:39 +0300
commitd39ecf1ca7e9455abcdeb17c251a2d248a47d471 (patch)
tree51c448694d2e5a29083555a1d78b34f17fd57ef7 /app/assets/javascripts/shortcuts.js
parent320590180703c620cedd6eb6023548dca2d026cf (diff)
New performance bar that can be enabled with the `p b` shortcut
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'app/assets/javascripts/shortcuts.js')
-rw-r--r--app/assets/javascripts/shortcuts.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/assets/javascripts/shortcuts.js b/app/assets/javascripts/shortcuts.js
index 8ac71797c14..2c7698eb174 100644
--- a/app/assets/javascripts/shortcuts.js
+++ b/app/assets/javascripts/shortcuts.js
@@ -1,6 +1,8 @@
/* eslint-disable func-names, space-before-function-paren, no-var, prefer-rest-params, wrap-iife, quotes, prefer-arrow-callback, consistent-return, object-shorthand, no-unused-vars, one-var, one-var-declaration-per-line, no-else-return, comma-dangle, max-len */
/* global Mousetrap */
/* global findFileURL */
+import Cookies from 'js-cookie';
+
import findAndFollowLink from './shortcuts_dashboard_navigation';
(function() {
@@ -14,6 +16,7 @@ import findAndFollowLink from './shortcuts_dashboard_navigation';
Mousetrap.bind('?', this.onToggleHelp);
Mousetrap.bind('s', Shortcuts.focusSearch);
Mousetrap.bind('f', (e => this.focusFilter(e)));
+ Mousetrap.bind('p b', this.onTogglePerfBar);
const $globalDropdownMenu = $('.global-dropdown-menu');
const $globalDropdownToggle = $('.global-dropdown-toggle');
@@ -53,6 +56,17 @@ import findAndFollowLink from './shortcuts_dashboard_navigation';
return Shortcuts.toggleHelp(this.enabledHelp);
};
+ Shortcuts.prototype.onTogglePerfBar = function(e) {
+ e.preventDefault();
+ if (Cookies.get('perf_bar_enabled') === 'true') {
+ Cookies.remove('perf_bar_enabled', { path: '/' });
+ }
+ else {
+ Cookies.set('perf_bar_enabled', true, { path: '/' });
+ }
+ return gl.utils.refreshCurrentPage();
+ };
+
Shortcuts.prototype.toggleMarkdownPreview = function(e) {
// Check if short-cut was triggered while in Write Mode
const $target = $(e.target);