whitespace cleanup

This commit is contained in:
friarzen 2018-11-27 03:42:37 +00:00
parent b529072d0b
commit 69ef732caf

View file

@ -183,12 +183,12 @@ let splithandler_plugin = (function () {
var dialog = $("#splitdialogcontent"); var dialog = $("#splitdialogcontent");
dialog.empty(); dialog.empty();
var selection = '<select name="pane">'; var selection = '<select name="pane">';
for ( var pane in split_panes ) { for ( var pane in split_panes ) {
selection = selection + '<option value="' + pane + '">' + pane + '</option>'; selection = selection + '<option value="' + pane + '">' + pane + '</option>';
} }
selection = "Pane to split: " + selection + "</select> "; selection = "Pane to split: " + selection + "</select> ";
dialog.append(selection); dialog.append(selection);
dialog.append('<input type="radio" name="direction" value="vertical" checked>top/bottom </>'); dialog.append('<input type="radio" name="direction" value="vertical" checked>top/bottom </>');
dialog.append('<input type="radio" name="direction" value="horizontal">side-by-side <hr />'); dialog.append('<input type="radio" name="direction" value="horizontal">side-by-side <hr />');
@ -203,7 +203,7 @@ let splithandler_plugin = (function () {
dialog.append('<input type="radio" name="flow2" value="replace">replace </>'); dialog.append('<input type="radio" name="flow2" value="replace">replace </>');
dialog.append('<input type="radio" name="flow2" value="append">append <hr />'); dialog.append('<input type="radio" name="flow2" value="append">append <hr />');
dialog.append('<div id="splitclose" class="btn btn-large btn-outline-primary float-right">Split</div>'); dialog.append('<div id="splitclose" class="btn btn-large btn-outline-primary float-right">Split</div>');
$("#splitclose").bind("click", onSplitDialogClose); $("#splitclose").bind("click", onSplitDialogClose);
@ -251,21 +251,21 @@ let splithandler_plugin = (function () {
var dialog = $("#panedialogcontent"); var dialog = $("#panedialogcontent");
dialog.empty(); dialog.empty();
var selection = '<select name="assign-pane">'; var selection = '<select name="assign-pane">';
for ( var pane in split_panes ) { for ( var pane in split_panes ) {
selection = selection + '<option value="' + pane + '">' + pane + '</option>'; selection = selection + '<option value="' + pane + '">' + pane + '</option>';
} }
selection = "Assign to pane: " + selection + "</select> <hr />"; selection = "Assign to pane: " + selection + "</select> <hr />";
dialog.append(selection); dialog.append(selection);
var multiple = '<select multiple name="assign-type">'; var multiple = '<select multiple name="assign-type">';
for ( var type in known_types ) { for ( var type in known_types ) {
multiple = multiple + '<option value="' + known_types[type] + '">' + known_types[type] + '</option>'; multiple = multiple + '<option value="' + known_types[type] + '">' + known_types[type] + '</option>';
} }
multiple = "Content types: " + multiple + "</select> <hr />"; multiple = "Content types: " + multiple + "</select> <hr />";
dialog.append(multiple); dialog.append(multiple);
dialog.append('<div id="paneclose" class="btn btn-large btn-outline-primary float-right">Assign</div>'); dialog.append('<div id="paneclose" class="btn btn-large btn-outline-primary float-right">Assign</div>');
$("#paneclose").bind("click", onPaneControlDialogClose); $("#paneclose").bind("click", onPaneControlDialogClose);
@ -276,9 +276,9 @@ let splithandler_plugin = (function () {
// Close "Pane Controls" dialog // Close "Pane Controls" dialog
var onPaneControlDialogClose = function () { var onPaneControlDialogClose = function () {
var pane = $("select[name=assign-pane]").val(); 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() { // $('#splitdialogcontent input[type=checkbox]:checked').each(function() {
// types.push( $(this).attr('value') ); // types.push( $(this).attr('value') );
// }); // });
@ -287,24 +287,24 @@ let splithandler_plugin = (function () {
plugins['popups'].closePopup("#panedialog"); plugins['popups'].closePopup("#panedialog");
} }
// //
// helper function sending text to a pane // helper function sending text to a pane
var txtToPane = function (panekey, txt) { var txtToPane = function (panekey, txt) {
var pane = split_panes[panekey]; var pane = split_panes[panekey];
var text_div = $('#' + panekey + '-sub'); var text_div = $('#' + panekey + '-sub');
if ( pane['update_method'] == 'replace' ) { if ( pane['update_method'] == 'replace' ) {
text_div.html(txt) text_div.html(txt)
} else if ( pane['update_method'] == 'append' ) { } else if ( pane['update_method'] == 'append' ) {
text_div.append(txt); text_div.append(txt);
var scrollHeight = text_div.parent().prop("scrollHeight"); var scrollHeight = text_div.parent().prop("scrollHeight");
text_div.parent().animate({ scrollTop: scrollHeight }, 0); text_div.parent().animate({ scrollTop: scrollHeight }, 0);
} else { // line feed } else { // line feed
text_div.append("<div class='out'>" + txt + "</div>"); text_div.append("<div class='out'>" + txt + "</div>");
var scrollHeight = text_div.parent().prop("scrollHeight"); var scrollHeight = text_div.parent().prop("scrollHeight");
text_div.parent().animate({ scrollTop: scrollHeight }, 0); text_div.parent().animate({ scrollTop: scrollHeight }, 0);
} }
} }
@ -316,53 +316,52 @@ let splithandler_plugin = (function () {
// //
// Accept plugin onText events // Accept plugin onText events
var onText = function (args, kwargs) { var onText = function (args, kwargs) {
// If the message is not itself tagged, we'll assume it
// If the message is not itself tagged, we'll assume it // should go into any panes with 'all' or 'rest' set
// should go into any panes with 'all' or 'rest' set
var msgtype = "rest"; var msgtype = "rest";
if ( kwargs && 'type' in kwargs ) { if ( kwargs && 'type' in kwargs ) {
msgtype = kwargs['type']; msgtype = kwargs['type'];
if ( ! known_types.includes(msgtype) ) { if ( ! known_types.includes(msgtype) ) {
// this is a new output type that can be mapped to panes // this is a new output type that can be mapped to panes
console.log('detected new output type: ' + msgtype) console.log('detected new output type: ' + msgtype)
known_types.push(msgtype); known_types.push(msgtype);
} }
} }
var target_panes = []; var target_panes = [];
var rest_panes = []; var rest_panes = [];
for (var key in split_panes) { for (var key in split_panes) {
var pane = split_panes[key]; var pane = split_panes[key];
// is this message type mapped to this pane (or does the pane has an 'all' type)? // is this message type mapped to this pane (or does the pane has an 'all' type)?
if (pane['types'].length > 0) { if (pane['types'].length > 0) {
if (pane['types'].includes(msgtype) || pane['types'].includes('all')) { if (pane['types'].includes(msgtype) || pane['types'].includes('all')) {
target_panes.push(key); target_panes.push(key);
} else if (pane['types'].includes('rest')) { } else if (pane['types'].includes('rest')) {
// store rest-panes in case we have no explicit to send to // store rest-panes in case we have no explicit to send to
rest_panes.push(key); rest_panes.push(key);
} }
} else { } else {
// unassigned panes are assumed to be rest-panes too // unassigned panes are assumed to be rest-panes too
rest_panes.push(key); rest_panes.push(key);
} }
} }
var ntargets = target_panes.length; var ntargets = target_panes.length;
var nrests = rest_panes.length; var nrests = rest_panes.length;
if (ntargets > 0) { if (ntargets > 0) {
// we have explicit target panes to send to // we have explicit target panes to send to
for (var i=0; i<ntargets; i++) { for (var i=0; i<ntargets; i++) {
txtToPane(target_panes[i], args[0]); txtToPane(target_panes[i], args[0]);
} }
return true; return true;
} else if (nrests > 0) { } else if (nrests > 0) {
// no targets, send remainder to rest-panes/unassigned // no targets, send remainder to rest-panes/unassigned
for (var i=0; i<nrests; i++) { for (var i=0; i<nrests; i++) {
txtToPane(rest_panes[i], args[0]); txtToPane(rest_panes[i], args[0]);
} }
return true; return true;
} }
// unhandled message // unhandled message
return false; return false;
} }