From 69ef732caf9fc5db9d1d41a7da2b560809331d6f Mon Sep 17 00:00:00 2001 From: friarzen Date: Tue, 27 Nov 2018 03:42:37 +0000 Subject: [PATCH] whitespace cleanup --- .../webclient/js/plugins/splithandler.js | 137 +++++++++--------- 1 file changed, 68 insertions(+), 69 deletions(-) diff --git a/evennia/web/webclient/static/webclient/js/plugins/splithandler.js b/evennia/web/webclient/static/webclient/js/plugins/splithandler.js index 4667065856..ec08b862a3 100644 --- a/evennia/web/webclient/static/webclient/js/plugins/splithandler.js +++ b/evennia/web/webclient/static/webclient/js/plugins/splithandler.js @@ -183,12 +183,12 @@ let splithandler_plugin = (function () { var dialog = $("#splitdialogcontent"); dialog.empty(); - var selection = ''; for ( var pane in split_panes ) { - selection = selection + ''; + selection = selection + ''; } - selection = "Pane to split: " + selection + " "; - dialog.append(selection); + selection = "Pane to split: " + selection + " "; + dialog.append(selection); dialog.append('top/bottom '); dialog.append('side-by-side
'); @@ -203,7 +203,7 @@ let splithandler_plugin = (function () { dialog.append('replace '); dialog.append('append
'); - dialog.append('
Split
'); + dialog.append('
Split
'); $("#splitclose").bind("click", onSplitDialogClose); @@ -251,21 +251,21 @@ let splithandler_plugin = (function () { var dialog = $("#panedialogcontent"); dialog.empty(); - var selection = ''; for ( var pane in split_panes ) { - selection = selection + ''; + selection = selection + ''; } - selection = "Assign to pane: " + selection + "
"; - dialog.append(selection); + selection = "Assign to pane: " + selection + "
"; + dialog.append(selection); - var multiple = ''; for ( var type in known_types ) { - multiple = multiple + ''; + multiple = multiple + ''; } - multiple = "Content types: " + multiple + "
"; - dialog.append(multiple); + multiple = "Content types: " + multiple + "
"; + dialog.append(multiple); - dialog.append('
Assign
'); + dialog.append('
Assign
'); $("#paneclose").bind("click", onPaneControlDialogClose); @@ -276,9 +276,9 @@ let splithandler_plugin = (function () { // Close "Pane Controls" dialog var onPaneControlDialogClose = function () { var pane = $("select[name=assign-pane]").val(); - var types = $("select[name=assign-type]").val(); + var types = $("select[name=assign-type]").val(); - // var types = new Array; + // var types = new Array; // $('#splitdialogcontent input[type=checkbox]:checked').each(function() { // types.push( $(this).attr('value') ); // }); @@ -287,24 +287,24 @@ let splithandler_plugin = (function () { plugins['popups'].closePopup("#panedialog"); } + // // helper function sending text to a pane var txtToPane = function (panekey, txt) { - var pane = split_panes[panekey]; - var text_div = $('#' + panekey + '-sub'); + var pane = split_panes[panekey]; + var text_div = $('#' + panekey + '-sub'); - if ( pane['update_method'] == 'replace' ) { - text_div.html(txt) - } else if ( pane['update_method'] == 'append' ) { - text_div.append(txt); - var scrollHeight = text_div.parent().prop("scrollHeight"); - text_div.parent().animate({ scrollTop: scrollHeight }, 0); - } else { // line feed - text_div.append("
" + txt + "
"); - var scrollHeight = text_div.parent().prop("scrollHeight"); - text_div.parent().animate({ scrollTop: scrollHeight }, 0); - } - + if ( pane['update_method'] == 'replace' ) { + text_div.html(txt) + } else if ( pane['update_method'] == 'append' ) { + text_div.append(txt); + var scrollHeight = text_div.parent().prop("scrollHeight"); + text_div.parent().animate({ scrollTop: scrollHeight }, 0); + } else { // line feed + text_div.append("
" + txt + "
"); + var scrollHeight = text_div.parent().prop("scrollHeight"); + text_div.parent().animate({ scrollTop: scrollHeight }, 0); + } } @@ -316,53 +316,52 @@ let splithandler_plugin = (function () { // // Accept plugin onText events var onText = function (args, kwargs) { - - // If the message is not itself tagged, we'll assume it - // should go into any panes with 'all' or 'rest' set + // If the message is not itself tagged, we'll assume it + // should go into any panes with 'all' or 'rest' set var msgtype = "rest"; if ( kwargs && 'type' in kwargs ) { - msgtype = kwargs['type']; + msgtype = kwargs['type']; if ( ! known_types.includes(msgtype) ) { // this is a new output type that can be mapped to panes console.log('detected new output type: ' + msgtype) known_types.push(msgtype); } - } - var target_panes = []; - var rest_panes = []; - - for (var key in split_panes) { - var pane = split_panes[key]; - // is this message type mapped to this pane (or does the pane has an 'all' type)? - if (pane['types'].length > 0) { - if (pane['types'].includes(msgtype) || pane['types'].includes('all')) { - target_panes.push(key); - } else if (pane['types'].includes('rest')) { - // store rest-panes in case we have no explicit to send to - rest_panes.push(key); - } - } else { - // unassigned panes are assumed to be rest-panes too - rest_panes.push(key); - } - } - var ntargets = target_panes.length; - var nrests = rest_panes.length; - if (ntargets > 0) { - // we have explicit target panes to send to - for (var i=0; i 0) { - // no targets, send remainder to rest-panes/unassigned - for (var i=0; i 0) { + if (pane['types'].includes(msgtype) || pane['types'].includes('all')) { + target_panes.push(key); + } else if (pane['types'].includes('rest')) { + // store rest-panes in case we have no explicit to send to + rest_panes.push(key); + } + } else { + // unassigned panes are assumed to be rest-panes too + rest_panes.push(key); + } + } + var ntargets = target_panes.length; + var nrests = rest_panes.length; + if (ntargets > 0) { + // we have explicit target panes to send to + for (var i=0; i 0) { + // no targets, send remainder to rest-panes/unassigned + for (var i=0; i