diff --git a/core/fse.js b/core/fse.js index 4d012f60..ccff0275 100644 --- a/core/fse.js +++ b/core/fse.js @@ -550,26 +550,26 @@ function FullScreenEditorModule(options) { function setInitialData(callback) { switch(self.editorMode) { - case 'view' : - if(self.message) { - self.initHeaderViewMode(); - self.initFooterViewMode(); + case 'view' : + if(self.message) { + self.initHeaderViewMode(); + self.initFooterViewMode(); - var bodyMessageView = self.viewControllers.body.getView(1); - if(bodyMessageView && _.has(self, 'message.message')) { - //self.setBodyMessageViewText(); - bodyMessageView.setText(cleanControlCodes(self.message.message)); + var bodyMessageView = self.viewControllers.body.getView(1); + if(bodyMessageView && _.has(self, 'message.message')) { + //self.setBodyMessageViewText(); + bodyMessageView.setText(cleanControlCodes(self.message.message)); + } } - } - break; - - case 'edit' : - self.viewControllers.header.getView(1).setText(self.client.user.username); // from + break; + + case 'edit' : + self.viewControllers.header.getView(1).setText(self.client.user.username); // from - if(self.replyToMessage) { - self.initHeaderReplyEditMode(); - } - break; + if(self.replyToMessage) { + self.initHeaderReplyEditMode(); + } + break; } callback(null); @@ -577,14 +577,14 @@ function FullScreenEditorModule(options) { function setInitialFocus(callback) { switch(self.editorMode) { - case 'edit' : - self.switchToHeader(); - break; + case 'edit' : + self.switchToHeader(); + break; - case 'view' : - self.switchToFooter(); - //self.observeViewPosition(); - break; + case 'view' : + self.switchToFooter(); + //self.observeViewPosition(); + break; } callback(null); @@ -885,21 +885,21 @@ function FullScreenEditorModule(options) { console.log(err) } else { switch(self.footerMode) { - case 'editor' : - if(!_.isUndefined(self.viewControllers.footerEditorMenu)) { - //self.viewControllers.footerEditorMenu.setFocus(false); - self.viewControllers.footerEditorMenu.detachClientEvents(); - } - self.viewControllers.body.switchFocus(1); - self.observeEditorEvents(); - break; + case 'editor' : + if(!_.isUndefined(self.viewControllers.footerEditorMenu)) { + //self.viewControllers.footerEditorMenu.setFocus(false); + self.viewControllers.footerEditorMenu.detachClientEvents(); + } + self.viewControllers.body.switchFocus(1); + self.observeEditorEvents(); + break; - case 'editorMenu' : - self.viewControllers.body.setFocus(false); - self.viewControllers.footerEditorMenu.switchFocus(1); - break; + case 'editorMenu' : + self.viewControllers.body.setFocus(false); + self.viewControllers.footerEditorMenu.switchFocus(1); + break; - default : throw new Error('Unexpected mode'); + default : throw new Error('Unexpected mode'); } } diff --git a/core/key_entry_view.js b/core/key_entry_view.js index 828e7264..fa48e877 100644 --- a/core/key_entry_view.js +++ b/core/key_entry_view.js @@ -43,17 +43,17 @@ module.exports = class KeyEntryView extends View { setPropertyValue(propName, propValue) { switch(propName) { - case 'eatTabKey' : - if(_.isBoolean(propValue)) { - this.eatTabKey = propValue; - } - break; + case 'eatTabKey' : + if(_.isBoolean(propValue)) { + this.eatTabKey = propValue; + } + break; - case 'caseInsensitive' : - if(_.isBoolean(propValue)) { - this.caseInsensitive = propValue; - } - break; + case 'caseInsensitive' : + if(_.isBoolean(propValue)) { + this.caseInsensitive = propValue; + } + break; } super.setPropertyValue(propName, propValue); diff --git a/core/menu_util.js b/core/menu_util.js index 76068d04..a532899a 100644 --- a/core/menu_util.js +++ b/core/menu_util.js @@ -175,40 +175,40 @@ function handleAction(client, formData, conf, cb) { assert(_.isObject(actionAsset)); switch(actionAsset.type) { - case 'method' : - case 'systemMethod' : - if(_.isString(actionAsset.location)) { - return callModuleMenuMethod( - client, - actionAsset, - paths.join(Config.paths.mods, actionAsset.location), - formData, - conf.extraArgs, - cb); - } else if('systemMethod' === actionAsset.type) { - // :TODO: Need to pass optional args here -- conf.extraArgs and args between e.g. () - // :TODO: Probably better as system_method.js - return callModuleMenuMethod( - client, - actionAsset, - paths.join(__dirname, 'system_menu_method.js'), - formData, - conf.extraArgs, - cb); - } else { - // local to current module - const currentModule = client.currentMenuModule; - if(_.isFunction(currentModule.menuMethods[actionAsset.asset])) { - return currentModule.menuMethods[actionAsset.asset](formData, conf.extraArgs, cb); + case 'method' : + case 'systemMethod' : + if(_.isString(actionAsset.location)) { + return callModuleMenuMethod( + client, + actionAsset, + paths.join(Config.paths.mods, actionAsset.location), + formData, + conf.extraArgs, + cb); + } else if('systemMethod' === actionAsset.type) { + // :TODO: Need to pass optional args here -- conf.extraArgs and args between e.g. () + // :TODO: Probably better as system_method.js + return callModuleMenuMethod( + client, + actionAsset, + paths.join(__dirname, 'system_menu_method.js'), + formData, + conf.extraArgs, + cb); + } else { + // local to current module + const currentModule = client.currentMenuModule; + if(_.isFunction(currentModule.menuMethods[actionAsset.asset])) { + return currentModule.menuMethods[actionAsset.asset](formData, conf.extraArgs, cb); + } + + const err = new Error('Method does not exist'); + client.log.warn( { method : actionAsset.asset }, err.message); + return cb(err); } - - const err = new Error('Method does not exist'); - client.log.warn( { method : actionAsset.asset }, err.message); - return cb(err); - } - case 'menu' : - return client.currentMenuModule.gotoMenu(actionAsset.asset, { formData : formData, extraArgs : conf.extraArgs }, cb ); + case 'menu' : + return client.currentMenuModule.gotoMenu(actionAsset.asset, { formData : formData, extraArgs : conf.extraArgs }, cb ); } } @@ -227,28 +227,28 @@ function handleNext(client, nextSpec, conf, cb) { // :TODO: DRY this with handleAction() switch(nextAsset.type) { - case 'method' : - case 'systemMethod' : - if(_.isString(nextAsset.location)) { - return callModuleMenuMethod(client, nextAsset, paths.join(Config.paths.mods, nextAsset.location), {}, extraArgs, cb); - } else if('systemMethod' === nextAsset.type) { - // :TODO: see other notes about system_menu_method.js here - return callModuleMenuMethod(client, nextAsset, paths.join(__dirname, 'system_menu_method.js'), {}, extraArgs, cb); - } else { - // local to current module - const currentModule = client.currentMenuModule; - if(_.isFunction(currentModule.menuMethods[nextAsset.asset])) { - const formData = {}; // we don't have any - return currentModule.menuMethods[nextAsset.asset]( formData, extraArgs, cb ); + case 'method' : + case 'systemMethod' : + if(_.isString(nextAsset.location)) { + return callModuleMenuMethod(client, nextAsset, paths.join(Config.paths.mods, nextAsset.location), {}, extraArgs, cb); + } else if('systemMethod' === nextAsset.type) { + // :TODO: see other notes about system_menu_method.js here + return callModuleMenuMethod(client, nextAsset, paths.join(__dirname, 'system_menu_method.js'), {}, extraArgs, cb); + } else { + // local to current module + const currentModule = client.currentMenuModule; + if(_.isFunction(currentModule.menuMethods[nextAsset.asset])) { + const formData = {}; // we don't have any + return currentModule.menuMethods[nextAsset.asset]( formData, extraArgs, cb ); + } + + const err = new Error('Method does not exist'); + client.log.warn( { method : nextAsset.asset }, err.message); + return cb(err); } - const err = new Error('Method does not exist'); - client.log.warn( { method : nextAsset.asset }, err.message); - return cb(err); - } - - case 'menu' : - return client.currentMenuModule.gotoMenu(nextAsset.asset, { extraArgs : extraArgs }, cb ); + case 'menu' : + return client.currentMenuModule.gotoMenu(nextAsset.asset, { extraArgs : extraArgs }, cb ); } const err = new Error('Invalid asset type for "next"'); diff --git a/core/menu_view.js b/core/menu_view.js index 3c0524b9..dc33aeaf 100644 --- a/core/menu_view.js +++ b/core/menu_view.js @@ -128,11 +128,12 @@ MenuView.prototype.setItemSpacing = function(itemSpacing) { MenuView.prototype.setPropertyValue = function(propName, value) { switch(propName) { - case 'itemSpacing' : this.setItemSpacing(value); break; - case 'items' : this.setItems(value); break; - case 'focusItems' : this.setFocusItems(value); break; - case 'hotKeys' : this.setHotKeys(value); break; - case 'hotKeySubmit' : this.hotKeySubmit = value; break; + case 'itemSpacing' : this.setItemSpacing(value); break; + case 'items' : this.setItems(value); break; + case 'focusItems' : this.setFocusItems(value); break; + case 'hotKeys' : this.setHotKeys(value); break; + case 'hotKeySubmit' : this.hotKeySubmit = value; break; + case 'justify' : this.justify = value; break; } MenuView.super_.prototype.setPropertyValue.call(this, propName, value); diff --git a/core/message_area.js b/core/message_area.js index f91b7d08..1a272a58 100644 --- a/core/message_area.js +++ b/core/message_area.js @@ -564,7 +564,7 @@ function persistMessage(message, cb) { }, function recordToMessageNetworks(callback) { msgNetRecord(message, callback); - } + } ], cb ); diff --git a/core/multi_line_edit_text_view.js b/core/multi_line_edit_text_view.js index c9c5ceb2..d731e4e0 100644 --- a/core/multi_line_edit_text_view.js +++ b/core/multi_line_edit_text_view.js @@ -1024,8 +1024,8 @@ MultiLineEditTextView.prototype.getData = function() { MultiLineEditTextView.prototype.setPropertyValue = function(propName, value) { switch(propName) { - case 'mode' : this.mode = value; break; - case 'autoScroll' : this.autoScroll = value; break; + case 'mode' : this.mode = value; break; + case 'autoScroll' : this.autoScroll = value; break; } MultiLineEditTextView.super_.prototype.setPropertyValue.call(this, propName, value); diff --git a/core/string_util.js b/core/string_util.js index a373a822..5c9d0371 100644 --- a/core/string_util.js +++ b/core/string_util.js @@ -35,86 +35,86 @@ function stylizeString(s, style) { var stylized = ''; switch(style) { - // None/normal - case 'normal' : - case 'N' : - return s; + // None/normal + case 'normal' : + case 'N' : + return s; - // UPPERCASE - case 'upper' : - case 'U' : - return s.toUpperCase(); + // UPPERCASE + case 'upper' : + case 'U' : + return s.toUpperCase(); - // lowercase - case 'lower' : - case 'l' : - return s.toLowerCase(); + // lowercase + case 'lower' : + case 'l' : + return s.toLowerCase(); - // Title Case - case 'title' : - case 'T' : - return s.replace(/\w\S*/g, function onProperCaseChar(t) { - return t.charAt(0).toUpperCase() + t.substr(1).toLowerCase(); - }); + // Title Case + case 'title' : + case 'T' : + return s.replace(/\w\S*/g, function onProperCaseChar(t) { + return t.charAt(0).toUpperCase() + t.substr(1).toLowerCase(); + }); - // fIRST lOWER - case 'first lower' : - case 'f' : - return s.replace(/\w\S*/g, function onFirstLowerChar(t) { - return t.charAt(0).toLowerCase() + t.substr(1).toUpperCase(); - }); + // fIRST lOWER + case 'first lower' : + case 'f' : + return s.replace(/\w\S*/g, function onFirstLowerChar(t) { + return t.charAt(0).toLowerCase() + t.substr(1).toUpperCase(); + }); - // SMaLL VoWeLS - case 'small vowels' : - case 'v' : - for(i = 0; i < len; ++i) { - c = s[i]; - if(-1 !== VOWELS.indexOf(c)) { - stylized += c.toLowerCase(); - } else { - stylized += c.toUpperCase(); + // SMaLL VoWeLS + case 'small vowels' : + case 'v' : + for(i = 0; i < len; ++i) { + c = s[i]; + if(-1 !== VOWELS.indexOf(c)) { + stylized += c.toLowerCase(); + } else { + stylized += c.toUpperCase(); + } } - } - return stylized; + return stylized; - // bIg vOwELS - case 'big vowels' : - case 'V' : - for(i = 0; i < len; ++i) { - c = s[i]; - if(-1 !== VOWELS.indexOf(c)) { - stylized += c.toUpperCase(); - } else { - stylized += c.toLowerCase(); + // bIg vOwELS + case 'big vowels' : + case 'V' : + for(i = 0; i < len; ++i) { + c = s[i]; + if(-1 !== VOWELS.indexOf(c)) { + stylized += c.toUpperCase(); + } else { + stylized += c.toLowerCase(); + } } - } - return stylized; + return stylized; - // Small i's: DEMENTiA - case 'small i' : - case 'i' : - return s.toUpperCase().replace(/I/g, 'i'); + // Small i's: DEMENTiA + case 'small i' : + case 'i' : + return s.toUpperCase().replace(/I/g, 'i'); - // mIxeD CaSE (random upper/lower) - case 'mixed' : - case 'M' : - for(i = 0; i < len; i++) { - if(Math.random() < 0.5) { - stylized += s[i].toUpperCase(); - } else { - stylized += s[i].toLowerCase(); + // mIxeD CaSE (random upper/lower) + case 'mixed' : + case 'M' : + for(i = 0; i < len; i++) { + if(Math.random() < 0.5) { + stylized += s[i].toUpperCase(); + } else { + stylized += s[i].toLowerCase(); + } } - } - return stylized; + return stylized; - // l337 5p34k - case 'l33t' : - case '3' : - for(i = 0; i < len; ++i) { - c = SIMPLE_ELITE_MAP[s[i].toLowerCase()]; - stylized += c || s[i]; - } - return stylized; + // l337 5p34k + case 'l33t' : + case '3' : + for(i = 0; i < len; ++i) { + c = SIMPLE_ELITE_MAP[s[i].toLowerCase()]; + stylized += c || s[i]; + } + return stylized; } return s; @@ -134,27 +134,27 @@ function pad(s, len, padChar, dir, stringSGR, padSGR, useRenderLen) { const padlen = len >= renderLen ? len - renderLen : 0; switch(dir) { - case 'L' : - case 'left' : - s = padSGR + new Array(padlen).join(padChar) + stringSGR + s; - break; + case 'L' : + case 'left' : + s = padSGR + new Array(padlen).join(padChar) + stringSGR + s; + break; - case 'C' : - case 'center' : - case 'both' : - { - const right = Math.ceil(padlen / 2); - const left = padlen - right; - s = padSGR + new Array(left + 1).join(padChar) + stringSGR + s + padSGR + new Array(right + 1).join(padChar); - } - break; + case 'C' : + case 'center' : + case 'both' : + { + const right = Math.ceil(padlen / 2); + const left = padlen - right; + s = padSGR + new Array(left + 1).join(padChar) + stringSGR + s + padSGR + new Array(right + 1).join(padChar); + } + break; - case 'R' : - case 'right' : - s = stringSGR + s + padSGR + new Array(padlen).join(padChar); - break; + case 'R' : + case 'right' : + s = stringSGR + s + padSGR + new Array(padlen).join(padChar); + break; - default : break; + default : break; } return stringSGR + s; diff --git a/core/text_view.js b/core/text_view.js index e26b61e9..7b876335 100644 --- a/core/text_view.js +++ b/core/text_view.js @@ -238,14 +238,14 @@ TextView.prototype.clearText = function() { TextView.prototype.setPropertyValue = function(propName, value) { switch(propName) { - case 'textMaskChar' : this.textMaskChar = value.substr(0, 1); break; - case 'textOverflow' : this.textOverflow = value; break; - case 'maxLength' : this.maxLength = parseInt(value, 10); break; - case 'password' : - if(true === value) { - this.textMaskChar = this.client.currentTheme.helpers.getPasswordChar(); - } - break; + case 'textMaskChar' : this.textMaskChar = value.substr(0, 1); break; + case 'textOverflow' : this.textOverflow = value; break; + case 'maxLength' : this.maxLength = parseInt(value, 10); break; + case 'password' : + if(true === value) { + this.textMaskChar = this.client.currentTheme.helpers.getPasswordChar(); + } + break; } diff --git a/core/theme.js b/core/theme.js index 6f4b56f9..5e65a453 100644 --- a/core/theme.js +++ b/core/theme.js @@ -599,23 +599,23 @@ function displayThemedAsset(assetSpec, client, options, cb) { }; switch(artAsset.type) { - case 'art' : - displayThemeArt(dispOpts, function displayed(err, artData) { - return cb(err, err ? null : { mciMap : artData.mciMap, height : artData.extraInfo.height } ); - }); - break; + case 'art' : + displayThemeArt(dispOpts, function displayed(err, artData) { + return cb(err, err ? null : { mciMap : artData.mciMap, height : artData.extraInfo.height } ); + }); + break; - case 'method' : - // :TODO: fetch & render via method - break; + case 'method' : + // :TODO: fetch & render via method + break; - case 'inline ' : - // :TODO: think about this more in relation to themes, etc. How can this come - // from a theme (with override from menu.json) ??? - // look @ client.currentTheme.inlineArt[name] -> menu/prompt[name] - break; + case 'inline ' : + // :TODO: think about this more in relation to themes, etc. How can this come + // from a theme (with override from menu.json) ??? + // look @ client.currentTheme.inlineArt[name] -> menu/prompt[name] + break; - default : - return cb(new Error('Unsupported art asset type: ' + artAsset.type)); + default : + return cb(new Error('Unsupported art asset type: ' + artAsset.type)); } } \ No newline at end of file diff --git a/core/word_wrap.js b/core/word_wrap.js index dbe3d471..d859b08d 100644 --- a/core/word_wrap.js +++ b/core/word_wrap.js @@ -205,7 +205,7 @@ function wordWrapText(text, options) { switch(m[0].charAt(0)) { case ' ' : word += m[0]; - break; + break; case '\t' : // @@ -218,7 +218,7 @@ function wordWrapText(text, options) { } else { word += m[0]; } - break; + break; } addWord(); diff --git a/mods/msg_area_view_fse.js b/mods/msg_area_view_fse.js index 38b806e0..f857589f 100644 --- a/mods/msg_area_view_fse.js +++ b/mods/msg_area_view_fse.js @@ -58,10 +58,10 @@ function AreaViewFSEModule(options) { // :TODO: Create methods for up/down vs using keyPressXXXXX switch(formData.key.name) { - case 'down arrow' : bodyView.scrollDocumentUp(); break; - case 'up arrow' : bodyView.scrollDocumentDown(); break; - case 'page up' : bodyView.keyPressPageUp(); break; - case 'page down' : bodyView.keyPressPageDown(); break; + case 'down arrow' : bodyView.scrollDocumentUp(); break; + case 'up arrow' : bodyView.scrollDocumentDown(); break; + case 'page up' : bodyView.keyPressPageUp(); break; + case 'page down' : bodyView.keyPressPageDown(); break; } // :TODO: need to stop down/page down if doing so would push the last