From b9ef37ac26bcbaa6174f5d03e2b1fc13f967464e Mon Sep 17 00:00:00 2001 From: Paul Ivanov Date: Tue, 18 Mar 2014 10:31:51 -0700 Subject: [PATCH] semicolon fixes buttress half of my js commits --- IPython/html/static/base/js/keyboard.js | 60 ++++++++++---------- IPython/html/static/notebook/js/quickhelp.js | 20 +++---- 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/IPython/html/static/base/js/keyboard.js b/IPython/html/static/base/js/keyboard.js index d3039ee7d..84d063163 100644 --- a/IPython/html/static/base/js/keyboard.js +++ b/IPython/html/static/base/js/keyboard.js @@ -44,12 +44,12 @@ IPython.keyboard = (function (IPython) { // These apply to Firefox and Opera var _mozilla_keycodes = { '; :': 59, '= +': 61, '- _': 173, 'meta': 224 - } + }; // This apply to Webkit and IE var _ie_keycodes = { '; :': 186, '= +': 187, '- _': 189, - } + }; var browser = IPython.utils.browser[0]; var platform = IPython.utils.platform; @@ -65,21 +65,21 @@ IPython.keyboard = (function (IPython) { for (var name in _keycodes) { var names = name.split(' '); if (names.length === 1) { - var n = names[0] - keycodes[n] = _keycodes[n] - inv_keycodes[_keycodes[n]] = n + var n = names[0]; + keycodes[n] = _keycodes[n]; + inv_keycodes[_keycodes[n]] = n; } else { var primary = names[0]; var secondary = names[1]; - keycodes[primary] = _keycodes[name] - keycodes[secondary] = _keycodes[name] - inv_keycodes[_keycodes[name]] = primary + keycodes[primary] = _keycodes[name]; + keycodes[secondary] = _keycodes[name]; + inv_keycodes[_keycodes[name]] = primary; } } var normalize_key = function (key) { return inv_keycodes[keycodes[key]]; - } + }; var normalize_shortcut = function (shortcut) { // Put a shortcut into normalized form: @@ -90,14 +90,14 @@ IPython.keyboard = (function (IPython) { shortcut = shortcut.toLowerCase().replace('cmd', 'meta'); var values = shortcut.split("+"); if (values.length === 1) { - return normalize_key(values[0]) + return normalize_key(values[0]); } else { var modifiers = values.slice(0,-1); var key = normalize_key(values[values.length-1]); modifiers.sort(); return modifiers.join('+') + '+' + key; } - } + }; var shortcut_to_event = function (shortcut, type) { // Convert a shortcut (shift+r) to a jQuery Event object @@ -112,19 +112,19 @@ IPython.keyboard = (function (IPython) { if (modifiers.indexOf('meta') !== -1) {opts.metaKey = true;} if (modifiers.indexOf('shift') !== -1) {opts.shiftKey = true;} return $.Event(type, opts); - } + }; var event_to_shortcut = function (event) { // Convert a jQuery Event object to a shortcut (shift+r) var shortcut = ''; - var key = inv_keycodes[event.which] + var key = inv_keycodes[event.which]; if (event.altKey && key !== 'alt') {shortcut += 'alt+';} if (event.ctrlKey && key !== 'ctrl') {shortcut += 'ctrl+';} if (event.metaKey && key !== 'meta') {shortcut += 'meta+';} if (event.shiftKey && key !== 'shift') {shortcut += 'shift+';} shortcut += key; - return shortcut - } + return shortcut; + }; var trigger_keydown = function (shortcut, element) { // Trigger shortcut keydown on an element @@ -132,17 +132,17 @@ IPython.keyboard = (function (IPython) { element = $(element); var event = shortcut_to_event(shortcut, 'keydown'); element.trigger(event); - } + }; // Shortcut manager class var ShortcutManager = function (delay) { - this._shortcuts = {} - this._counts = {} - this._timers = {} + this._shortcuts = {}; + this._counts = {}; + this._timers = {}; this.delay = delay || 800; // delay in milliseconds - } + }; ShortcutManager.prototype.help = function () { var help = []; @@ -168,15 +168,15 @@ IPython.keyboard = (function (IPython) { return 0; }); return help; - } + }; ShortcutManager.prototype.clear_shortcuts = function () { this._shortcuts = {}; - } + }; ShortcutManager.prototype.add_shortcut = function (shortcut, data, suppress_help_update) { if (typeof(data) === 'function') { - data = {help: '', help_index: '', handler: data} + data = {help: '', help_index: '', handler: data}; } data.help_index = data.help_index || ''; data.help = data.help || ''; @@ -189,9 +189,9 @@ IPython.keyboard = (function (IPython) { this._shortcuts[shortcut] = data; if (!suppress_help_update) { // update the keyboard shortcuts notebook help - $([IPython.events]).trigger('rebuild.QuickHelp') + $([IPython.events]).trigger('rebuild.QuickHelp'); } - } + }; ShortcutManager.prototype.add_shortcuts = function (data) { for (var shortcut in data) { @@ -199,7 +199,7 @@ IPython.keyboard = (function (IPython) { } // update the keyboard shortcuts notebook help $([IPython.events]).trigger('rebuild.QuickHelp'); - } + }; ShortcutManager.prototype.remove_shortcut = function (shortcut, suppress_help_update) { shortcut = normalize_shortcut(shortcut); @@ -209,7 +209,7 @@ IPython.keyboard = (function (IPython) { // update the keyboard shortcuts notebook help $([IPython.events]).trigger('rebuild.QuickHelp'); } - } + }; ShortcutManager.prototype.count_handler = function (shortcut, event, data) { var that = this; @@ -229,7 +229,7 @@ IPython.keyboard = (function (IPython) { t[shortcut] = timer; } return false; - } + }; ShortcutManager.prototype.call_handler = function (event) { var shortcut = event_to_shortcut(event); @@ -245,7 +245,7 @@ IPython.keyboard = (function (IPython) { } } return true; - } + }; return { keycodes : keycodes, @@ -256,6 +256,6 @@ IPython.keyboard = (function (IPython) { shortcut_to_event : shortcut_to_event, event_to_shortcut : event_to_shortcut, trigger_keydown : trigger_keydown - } + }; }(IPython)); diff --git a/IPython/html/static/notebook/js/quickhelp.js b/IPython/html/static/notebook/js/quickhelp.js index c96031063..65a421ccd 100644 --- a/IPython/html/static/notebook/js/quickhelp.js +++ b/IPython/html/static/notebook/js/quickhelp.js @@ -42,7 +42,7 @@ var IPython = (function (IPython) { 'allows you to type code/text into a cell and is indicated by a green cell '+ 'border. Command mode binds the keyboard to notebook level actions '+ 'and is indicated by a grey cell border.' - ) + ); element.append(doc); // Command mode @@ -68,7 +68,7 @@ var IPython = (function (IPython) { QuickHelp.prototype.build_command_help = function () { var command_shortcuts = IPython.keyboard_manager.command_shortcuts.help(); return build_div('

Command Mode (press Esc to enable)

', command_shortcuts); - } + }; var special_case = { pageup: "PageUp", pagedown: "Page Down" }; var prettify = function (s) { @@ -92,16 +92,16 @@ var IPython = (function (IPython) { var edit_shortcuts = IPython.keyboard_manager.edit_shortcuts.help(); // Edit mode return build_div('

Edit Mode (press Enter to enable)

', edit_shortcuts); - } + }; var build_one = function (s) { - var help = s['help']; - var shortcut = prettify(s['shortcut']); + var help = s.help; + var shortcut = prettify(s.shortcut); return $('
').addClass('quickhelp'). append($('').addClass('shortcut_key').append($(shortcut))). - append($('').addClass('shortcut_descr').text(' : ' + help)) + append($('').addClass('shortcut_descr').text(' : ' + help)); - } + }; var build_div = function (title, shortcuts) { var i, half, n; @@ -111,12 +111,12 @@ var IPython = (function (IPython) { var col2 = $('
').addClass('box-flex0'); n = shortcuts.length; half = ~~(n/2); // Truncate :) - for (i=0; i