From 9ffbb72d8c5dacd590e7d7831cee77d5f14ac3ec Mon Sep 17 00:00:00 2001 From: Brenden Tuck Date: Wed, 3 Apr 2019 17:18:27 -0400 Subject: [PATCH] Lint fixes --- .../static/webclient/js/plugins/default_in.js | 10 +- .../webclient/js/plugins/goldenlayout.js | 303 +++++++++--------- .../static/webclient/js/plugins/history.js | 14 +- .../static/webclient/js/plugins/hotbuttons.js | 113 +++---- 4 files changed, 221 insertions(+), 219 deletions(-) diff --git a/evennia/web/webclient/static/webclient/js/plugins/default_in.js b/evennia/web/webclient/static/webclient/js/plugins/default_in.js index 83aeb96a06..23e382019c 100644 --- a/evennia/web/webclient/static/webclient/js/plugins/default_in.js +++ b/evennia/web/webclient/static/webclient/js/plugins/default_in.js @@ -1,6 +1,6 @@ /* * - * Evennia Webclient default 'send-text-on-enter-key' IO plugin + * Evennia Webclient default "send-text-on-enter-key" IO plugin * */ let defaultin_plugin = (function () { @@ -32,7 +32,7 @@ let defaultin_plugin = (function () { for (var i = 0; i < lines.length; i++) { plugin_handler.onSend( lines[i].trim() ); } - inputfield.val(''); // Clear this inputfield + inputfield.val(""); // Clear this inputfield event.preventDefault(); } inputfield.blur(); @@ -44,7 +44,7 @@ let defaultin_plugin = (function () { if( inputfield.length < 1 ) { // Nope, focus the last .inputfield found in the DOM (or #inputfield) // :last only matters if multi-input plugins are in use - inputfield = $(".inputfield:last") + inputfield = $(".inputfield:last"); inputfield.focus(); if( inputfield.length < 1 ) { // non-goldenlayout backwards compatibility $("#inputfield").focus(); @@ -67,7 +67,7 @@ let defaultin_plugin = (function () { $("#inputfield").focus().trigger(e); }); - console.log('DefaultIn initialized'); + console.log("DefaultIn initialized"); } return { @@ -75,4 +75,4 @@ let defaultin_plugin = (function () { onKeydown: onKeydown, } })(); -plugin_handler.add('defaultin', defaultin_plugin); +window.plugin_handler.add("defaultin", defaultin_plugin); diff --git a/evennia/web/webclient/static/webclient/js/plugins/goldenlayout.js b/evennia/web/webclient/static/webclient/js/plugins/goldenlayout.js index 75a137ac0f..a867fff27f 100644 --- a/evennia/web/webclient/static/webclient/js/plugins/goldenlayout.js +++ b/evennia/web/webclient/static/webclient/js/plugins/goldenlayout.js @@ -3,64 +3,64 @@ * Golden Layout plugin * */ -plugin_handler.add('goldenlayout', (function () { +let goldenlayout = (function () { var myLayout; var input_component = null; - var known_types = ['all', 'untagged']; + var known_types = ["all", "untagged"]; var untagged = []; var config = { content: [{ - type: 'column', + type: "column", content: [{ - type: 'row', + type: "row", content: [{ - type: 'column', + type: "column", content: [{ - type: 'component', - componentName: 'Main', + type: "component", + componentName: "Main", isClosable: false, - tooltip: 'Main - drag to desird position.', + tooltip: "Main - drag to desird position.", componentState: { - types: 'untagged', - update_method: 'newlines', + types: "untagged", + update_method: "newlines", }, }] }], }, { - type: 'component', - componentName: 'input', - id: 'inputComponent', + type: "component", + componentName: "input", + id: "inputComponent", height: 12, - tooltip: 'Input - The last input in the layout is always the default.', + tooltip: "Input - The last input in the layout is always the default.", }, { - type: 'component', - componentName: 'input', - id: 'inputComponent', + type: "component", + componentName: "input", + id: "inputComponent", height: 12, isClosable: false, - tooltip: 'Input - The last input in the layout is always the default.', + tooltip: "Input - The last input in the layout is always the default.", }] }] }; var newTabConfig = { - title: 'Untitled', - type: 'component', - componentName: 'evennia', + title: "Untitled", + type: "component", + componentName: "evennia", componentState: { - types: 'all', - update_method: 'newlines', + types: "all", + update_method: "newlines", }, }; var newInputConfig = { - title: 'input', - type: 'component', - componentName: 'input', - id: 'inputComponent', + title: "input", + type: "component", + componentName: "input", + id: "inputComponent", }; // helper function: filter vals out of array @@ -77,16 +77,16 @@ plugin_handler.add('goldenlayout', (function () { // - // Calculate all known_types minus the 'all' type, + // Calculate all known_types minus the "all" type, // then filter out all types that have been mapped to a pane. var calculateUntaggedTypes = function () { // set initial untagged list - untagged = filter( ['all', 'untagged'], known_types); + untagged = filter( ["all", "untagged"], known_types); // for each .content pane - $('.content').each( function () { - let types = $(this).attr('types'); + $(".content").each( function () { + let types = $(this).attr("types"); if ( typeof types !== "undefined" ) { - untagged = filter( types.split(' '), untagged ); + untagged = filter( types.split(" "), untagged ); } }); } @@ -95,10 +95,10 @@ plugin_handler.add('goldenlayout', (function () { // // var closeRenameDropdown = function () { - let content = $('#renamebox').parent().parent().parent().parent()[0]; - let title = $('#renameboxin').val(); + let content = $("#renamebox").parent().parent().parent().parent()[0]; + let title = $("#renameboxin").val(); - let components = myLayout.root.getItemsByType('component'); + let components = myLayout.root.getItemsByType("component"); components.forEach( function (component) { let element = component.tab.header.parent.element[0]; @@ -107,8 +107,8 @@ plugin_handler.add('goldenlayout', (function () { } }); - myLayout.emit('stateChanged'); - $('#renamebox').remove(); + myLayout.emit("stateChanged"); + $("#renamebox").remove(); } @@ -116,22 +116,22 @@ plugin_handler.add('goldenlayout', (function () { // Handle the renameDropdown var renameDropdown = function (evnt) { let element = $(evnt.data.contentItem.element); - let content = element.find('.content'); + let content = element.find(".content"); let title = evnt.data.contentItem.config.title; - let renamebox = document.getElementById('renamebox'); + let renamebox = document.getElementById("renamebox"); // check that no other dropdown is open - if( document.getElementById('typelist') ) { + if( document.getElementById("typelist") ) { closeTypelistDropdown(); } - if( document.getElementById('updatelist') ) { + if( document.getElementById("updatelist") ) { closeUpdatelistDropdown(); } if( !renamebox ) { - renamebox = $('
'); - renamebox.append(''); + renamebox = $("
"); + renamebox.append(""); renamebox.insertBefore( content ); } else { closeRenameDropdown(); @@ -142,22 +142,22 @@ plugin_handler.add('goldenlayout', (function () { // // var closeTypelistDropdown = function () { - let content = $('#typelist').parent().find('.content'); - let checkboxes = $('#typelist :input'); + let content = $("#typelist").parent().find(".content"); + let checkboxes = $("#typelist :input"); let types = []; for (let i=0; i'); - let div = $('
'); + let content = element.find(".content"); + let selected_types = content.attr("types"); + let menu = $("
"); + let div = $("
"); if( selected_types ) { - selected_types = selected_types.split(' '); + selected_types = selected_types.split(" "); } for (let i=0; i'+type+''); + if( selected_types && selected_types.includes(itype) ) { + choice = $(""); } else { - choice = $(''); + choice = $(""); } choice.appendTo(div); } @@ -192,14 +192,14 @@ plugin_handler.add('goldenlayout', (function () { // // Handle the typeDropdown var typeDropdown = function (evnt) { - let typelist = document.getElementById('typelist'); + let typelist = document.getElementById("typelist"); // check that no other dropdown is open - if( document.getElementById('renamebox') ) { + if( document.getElementById("renamebox") ) { closeRenameDropdown(); } - if( document.getElementById('updatelist') ) { + if( document.getElementById("updatelist") ) { closeUpdatelistDropdown(); } @@ -214,12 +214,12 @@ plugin_handler.add('goldenlayout', (function () { // // var closeUpdatelistDropdown = function () { - let content = $('#updatelist').parent().find('.content'); - let value = $('input[name=upmethod]:checked').val(); + let content = $("#updatelist").parent().find(".content"); + let value = $("input[name=upmethod]:checked").val(); - content.attr('update_method', value ); - myLayout.emit('stateChanged'); - $('#updatelist').remove(); + content.attr("update_method", value ); + myLayout.emit("stateChanged"); + $("#updatelist").remove(); } @@ -227,18 +227,18 @@ plugin_handler.add('goldenlayout', (function () { // var onUpdateMethodClicked = function (evnt) { let element = $(evnt.data.contentItem.element); - let content = element.find('.content'); - let update_method = content.attr('update_method'); - let nlchecked = (update_method == 'newlines') ? 'checked="checked"' : ''; - let apchecked = (update_method == 'append') ? 'checked="checked"' : ''; - let rpchecked = (update_method == 'replace') ? 'checked="checked"' : ''; + let content = element.find(".content"); + let update_method = content.attr("update_method"); + let nlchecked = (update_method == "newlines") ? "checked="checked"" : ""; + let apchecked = (update_method == "append") ? "checked="checked"" : ""; + let rpchecked = (update_method == "replace") ? "checked="checked"" : ""; - let menu = $('
'); - let div = $('
'); + let menu = $("
"); + let div = $("
"); - let newlines = $(''); - let append = $(''); - let replace = $(''); + let newlines = $(""); + let append = $(""); + let replace = $(""); newlines.appendTo(div); append.appendTo(div); @@ -253,14 +253,14 @@ plugin_handler.add('goldenlayout', (function () { // // Handle the updateDropdown var updateDropdown = function (evnt) { - let updatelist = document.getElementById('updatelist'); + let updatelist = document.getElementById("updatelist"); // check that no other dropdown is open - if( document.getElementById('renamebox') ) { + if( document.getElementById("renamebox") ) { closeRenameDropdown(); } - if( document.getElementById('typelist') ) { + if( document.getElementById("typelist") ) { closeTypelistDropdown(); } @@ -275,9 +275,9 @@ plugin_handler.add('goldenlayout', (function () { // // var onActiveTabChange = function (tab) { - let renamebox = document.getElementById('renamebox'); - let typelist = document.getElementById('typelist'); - let updatelist = document.getElementById('updatelist'); + let renamebox = document.getElementById("renamebox"); + let typelist = document.getElementById("typelist"); + let updatelist = document.getElementById("updatelist"); if( renamebox ) { closeRenameDropdown(); @@ -296,18 +296,18 @@ plugin_handler.add('goldenlayout', (function () { // // Save the GoldenLayout state to localstorage whenever it changes. var onStateChanged = function () { - let components = myLayout.root.getItemsByType('component'); + let components = myLayout.root.getItemsByType("component"); components.forEach( function (component) { - if( component.hasId('inputComponent') ) { return; } // ignore input components + if( component.hasId("inputComponent") ) { return; } // ignore input components - let text_div = component.container.getElement().children('.content'); - let types = text_div.attr('types'); - let update_method = text_div.attr('update_method'); - component.container.extendState({ 'types': types, 'update_method': update_method }); + let text_div = component.container.getElement().children(".content"); + let types = text_div.attr("types"); + let update_method = text_div.attr("update_method"); + component.container.extendState({ "types": types, "update_method": update_method }); }); var state = JSON.stringify( myLayout.toConfig() ); - localStorage.setItem( 'evenniaGoldenLayoutSavedState', state ); + localStorage.setItem( "evenniaGoldenLayoutSavedState", state ); } @@ -315,10 +315,10 @@ plugin_handler.add('goldenlayout', (function () { // var onTabCreate = function (tab) { //HTML for the typeDropdown - let renameDropdownControl = $('\u2B57'); - let typeDropdownControl = $(''); - let updateDropdownControl = $(''); - let splitControl = $('+'); + let renameDropdownControl = $("\u2B57"); + let typeDropdownControl = $(""); + let updateDropdownControl = $(""); + let splitControl = $("+"); // track dropdowns when the associated control is clicked renameDropdownControl.click( tab, renameDropdown ); @@ -339,10 +339,10 @@ plugin_handler.add('goldenlayout', (function () { tab.element.append( splitControl ); if( tab.contentItem.config.componentName == "Main" ) { - tab.element.prepend( $('#optionsbutton').clone(true).addClass('lm_title') ); + tab.element.prepend( $("#optionsbutton").clone(true).addClass("lm_title") ); } - tab.header.parent.on( 'activeContentItemChanged', onActiveTabChange ); + tab.header.parent.on( "activeContentItemChanged", onActiveTabChange ); } @@ -350,7 +350,7 @@ plugin_handler.add('goldenlayout', (function () { // var onInputCreate = function (tab) { //HTML for the typeDropdown - let splitControl = $('+'); + let splitControl = $("+"); // track adding a new tab splitControl.click( tab, function (evnt) { @@ -360,19 +360,19 @@ plugin_handler.add('goldenlayout', (function () { // Add the typeDropdown to the header tab.element.append( splitControl ); - tab.header.parent.on( 'activeContentItemChanged', onActiveTabChange ); + tab.header.parent.on( "activeContentItemChanged", onActiveTabChange ); } // // var scrollAll = function () { - let components = myLayout.root.getItemsByType('component'); + let components = myLayout.root.getItemsByType("component"); components.forEach( function (component) { - if( component.hasId('inputComponent') ) { return; } // ignore input components + if( component.hasId("inputComponent") ) { return; } // ignore input components - let text_div = component.container.getElement().children('.content'); - let scrollHeight = text_div.prop('scrollHeight'); - let clientHeight = text_div.prop('clientHeight'); + let text_div = component.container.getElement().children(".content"); + let scrollHeight = text_div.prop("scrollHeight"); + let clientHeight = text_div.prop("clientHeight"); text_div.scrollTop( scrollHeight - clientHeight ); }); myLayout.updateSize(); @@ -382,15 +382,15 @@ plugin_handler.add('goldenlayout', (function () { // // var routeMsg = function (text_div, txt, update_method) { - if ( update_method == 'replace' ) { + if ( update_method == "replace" ) { text_div.html(txt) - } else if ( update_method == 'append' ) { + } else if ( update_method == "append" ) { text_div.append(txt); } else { // line feed - text_div.append('
' + txt + '
'); + text_div.append("
" + txt + "
"); } - let scrollHeight = text_div.prop('scrollHeight'); - let clientHeight = text_div.prop('clientHeight'); + let scrollHeight = text_div.prop("scrollHeight"); + let clientHeight = text_div.prop("clientHeight"); text_div.scrollTop( scrollHeight - clientHeight ); } @@ -398,16 +398,16 @@ plugin_handler.add('goldenlayout', (function () { // // var initComponent = function (div, container, state, default_types, update_method) { - // set this container's content div types attribute + // set this container"s content div types attribute if( state ) { - div.attr('types', state.types); - div.attr('update_method', state.update_method); + div.attr("types", state.types); + div.attr("update_method", state.update_method); } else { - div.attr('types', default_types); - div.attr('update_method', update_method); + div.attr("types", default_types); + div.attr("update_method", update_method); } div.appendTo( container.getElement() ); - container.on('tab', onTabCreate); + container.on("tab", onTabCreate); } @@ -419,7 +419,7 @@ plugin_handler.add('goldenlayout', (function () { // // var onKeydown = function(evnt) { - var renamebox = document.getElementById('renamebox'); + var renamebox = document.getElementById("renamebox"); if( renamebox ) { return true; } @@ -430,39 +430,39 @@ plugin_handler.add('goldenlayout', (function () { // // var onText = function (args, kwargs) { - // If the message is not itself tagged, we'll assume it - // should go into any panes with 'all' and 'untagged' set - var msgtype = 'untagged'; + // If the message is not itself tagged, we"ll assume it + // should go into any panes with "all" and "untagged" set + var msgtype = "untagged"; - if ( kwargs && 'type' in kwargs ) { - msgtype = kwargs['type']; + if ( kwargs && "type" in kwargs ) { + 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) + console.log("detected new output type: " + msgtype) known_types.push(msgtype); untagged.push(msgtype); } } let message_delivered = false; - let components = myLayout.root.getItemsByType('component'); + let components = myLayout.root.getItemsByType("component"); components.forEach( function (component) { - if( component.hasId('inputComponent') ) { return; } // ignore the input component + if( component.hasId("inputComponent") ) { return; } // ignore the input component - let text_div = component.container.getElement().children('.content'); - let attr_types = text_div.attr('types'); - let pane_types = attr_types ? attr_types.split(' ') : []; - let update_method = text_div.attr('update_method'); + let text_div = component.container.getElement().children(".content"); + let attr_types = text_div.attr("types"); + let pane_types = attr_types ? attr_types.split(" ") : []; + let update_method = text_div.attr("update_method"); let txt = args[0]; - // is this message type listed in this pane's types (or is this pane catching 'all') - if( pane_types.includes(msgtype) || pane_types.includes('all') ) { + // is this message type listed in this pane"s types (or is this pane catching "all") + if( pane_types.includes(msgtype) || pane_types.includes("all") ) { routeMsg( text_div, txt, update_method ); message_delivered = true; } - // is this pane catching 'upmapped' messages? + // is this pane catching "upmapped" messages? // And is this message type listed in the untagged types array? if( pane_types.includes("untagged") && untagged.includes(msgtype) ) { routeMsg( text_div, txt, update_method ); @@ -488,9 +488,9 @@ plugin_handler.add('goldenlayout', (function () { $(window).bind("resize", scrollAll); // Set Save State callback - myLayout.on( 'stateChanged', onStateChanged ); + myLayout.on( "stateChanged", onStateChanged ); - console.log('Golden Layout Plugin Initialized.'); + console.log("Golden Layout Plugin Initialized."); } @@ -498,8 +498,8 @@ plugin_handler.add('goldenlayout', (function () { // required Init me var init = function (options) { // Set up our GoldenLayout instance built off of the default main-sub div - var savedState = localStorage.getItem( 'evenniaGoldenLayoutSavedState' ); - var mainsub = document.getElementById('main-sub'); + var savedState = localStorage.getItem( "evenniaGoldenLayoutSavedState" ); + var mainsub = document.getElementById("main-sub"); if( savedState !== null ) { config = JSON.parse( savedState ); @@ -507,40 +507,40 @@ plugin_handler.add('goldenlayout', (function () { myLayout = new GoldenLayout( config, mainsub ); - $('#inputcontrol').remove(); // remove the cluttered, HTML-defined input divs + $("#inputcontrol").remove(); // remove the cluttered, HTML-defined input divs // register our component and replace the default messagewindow with the Main component - myLayout.registerComponent( 'Main', function (container, componentState) { - let main = $('#messagewindow').addClass('content'); - initComponent(main, container, componentState, 'untagged', 'newlines' ); + myLayout.registerComponent( "Main", function (container, componentState) { + let main = $("#messagewindow").addClass("content"); + initComponent(main, container, componentState, "untagged", "newlines" ); }); // register our new input component - myLayout.registerComponent( 'input', function (container, componentState) { - var inputfield = $(''); - var button = $(''); + myLayout.registerComponent( "input", function (container, componentState) { + var inputfield = $(""); + var button = $(""); - $('
') + $("
") .append( button ) .append( inputfield ) .appendTo( container.getElement() ); - button.bind('click', function (evnt) { + button.bind("click", function (evnt) { // focus our textarea - $( $(evnt.target).siblings('.inputfield')[0] ).focus(); + $( $(evnt.target).siblings(".inputfield")[0] ).focus(); // fake a carriage return event - var e = $.Event('keydown'); + var e = $.Event("keydown"); e.which = 13; - $( $(evnt.target).siblings('.inputfield')[0] ).trigger(e); + $( $(evnt.target).siblings(".inputfield")[0] ).trigger(e); }); - container.on('tab', onInputCreate); + container.on("tab", onInputCreate); }); - myLayout.registerComponent( 'evennia', function (container, componentState) { - let div = $('
'); - initComponent(div, container, componentState, 'all', 'newlines'); - container.on('destroy', calculateUntaggedTypes); + myLayout.registerComponent( "evennia", function (container, componentState) { + let div = $("
"); + initComponent(div, container, componentState, "all", "newlines"); + container.on("destroy", calculateUntaggedTypes); }); } @@ -555,4 +555,5 @@ plugin_handler.add('goldenlayout', (function () { setConfig: function (newconfig) { config = newconfig }, addKnownType: function (newtype) { known_types.push(newtype) }, } -})()); +})(); +window.plugin_handler.add("goldenlayout", goldenlayout); diff --git a/evennia/web/webclient/static/webclient/js/plugins/history.js b/evennia/web/webclient/static/webclient/js/plugins/history.js index 8afcec44f3..0b02b947a9 100644 --- a/evennia/web/webclient/static/webclient/js/plugins/history.js +++ b/evennia/web/webclient/static/webclient/js/plugins/history.js @@ -10,7 +10,7 @@ let history_plugin = (function () { var history = new Array(); var history_pos = 0; - history[0] = ''; // the very latest input is empty for new entry. + history[0] = ""; // the very latest input is empty for new entry. // // move back in the history @@ -37,7 +37,7 @@ let history_plugin = (function () { history.shift(); // kill oldest entry } history[history.length-1] = input; - history[history.length] = ''; + history[history.length] = ""; } history_pos = 0; } @@ -62,11 +62,11 @@ let history_plugin = (function () { if (history_entry !== null) { // Doing a history navigation; replace the text in the input and // move the cursor to the end of the new value - var inputfield = $('.inputfield:focus'); + var inputfield = $(".inputfield:focus"); if( inputfield.length < 1 ) { // pre-goldenlayout backwards compatibility - inputfield = $('#inputfield'); + inputfield = $("#inputfield"); } - inputfield.val(''); + inputfield.val(""); inputfield.blur().focus().val(history_entry); event.preventDefault(); return true; @@ -85,7 +85,7 @@ let history_plugin = (function () { // // Init function var init = function () { - console.log('History Plugin Initialized.'); + console.log("History Plugin Initialized."); } return { @@ -94,4 +94,4 @@ let history_plugin = (function () { onSend: onSend, } })() -plugin_handler.add('history', history_plugin); +plugin_handler.add("history", history_plugin); diff --git a/evennia/web/webclient/static/webclient/js/plugins/hotbuttons.js b/evennia/web/webclient/static/webclient/js/plugins/hotbuttons.js index 50cbcbbdc0..383f6d0055 100644 --- a/evennia/web/webclient/static/webclient/js/plugins/hotbuttons.js +++ b/evennia/web/webclient/static/webclient/js/plugins/hotbuttons.js @@ -1,6 +1,6 @@ /* * - * Assignable 'hot-buttons' Plugin + * Assignable "hot-buttons" Plugin * * This adds a bar of 9 buttons that can be shift-click assigned whatever is in the textinput buffer, so you can simply * click the button again and have it execute those commands, instead of having to type it all out again and again. @@ -18,10 +18,10 @@ * * after the other plugin tags. * - * Run: evennia collectstatic (say 'yes' to the overwrite prompt) + * Run: evennia collectstatic (say "yes" to the overwrite prompt) * Start Evennia */ -plugin_handler.add('hotbuttons', (function () { +let hotbuttons = (function () { var dependencies_met = true; // To start, assume either splithandler or goldenlayout plugin is enabled. var num_buttons = 9; @@ -29,41 +29,41 @@ plugin_handler.add('hotbuttons', (function () { var hotButtonConfig = { content: [{ - type: 'column', + type: "column", content: [{ - type: 'row', + type: "row", content: [{ - type: 'column', + type: "column", content: [{ - type: 'component', - componentName: 'Main', + type: "component", + componentName: "Main", isClosable: false, - tooltip: 'Main - drag to desird position.', + tooltip: "Main - drag to desird position.", componentState: { - types: 'untagged', - update_method: 'newlines', + types: "untagged", + update_method: "newlines", }, }] }], }, { - type: 'component', - componentName: 'hotbuttons', - id: 'inputComponent', + type: "component", + componentName: "hotbuttons", + id: "inputComponent", height: 12, - tooltip: 'Input - The last input in the layout is always the default.', + tooltip: "Input - The last input in the layout is always the default.", }, { - type: 'component', - componentName: 'input', - id: 'inputComponent', + type: "component", + componentName: "input", + id: "inputComponent", height: 12, - tooltip: 'Input - The last input in the layout is always the default.', + tooltip: "Input - The last input in the layout is always the default.", }, { - type: 'component', - componentName: 'input', - id: 'inputComponent', + type: "component", + componentName: "input", + id: "inputComponent", height: 12, isClosable: false, - tooltip: 'Input - The last input in the layout is always the default.', + tooltip: "Input - The last input in the layout is always the default.", }] }] }; @@ -72,29 +72,29 @@ plugin_handler.add('hotbuttons', (function () { // Add Buttons UI for SplitHandler var addButtonsUI = function () { var buttons = $( [ - '
', - '
', - '
', - ' ', - ' ', - ' ', - ' ', - ' ', - ' ', - ' ', - ' ', - ' ', - '
', - '
', - '
', + "
", + "
", + "
", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + "
", + "
", + "
", ].join("\n") ); // Add buttons in front of the existing #inputform - $('#input').prev().replaceWith(buttons); + $("#input").prev().replaceWith(buttons); - Split(['#main','#buttons','#input'], { + Split(["#main","#buttons","#input"], { sizes: [85,5,10], - direction: 'vertical', + direction: "vertical", gutterSize: 4, minSize: [150,20,50], }); @@ -150,9 +150,9 @@ plugin_handler.add('hotbuttons', (function () { console.log("button " + e.data + " clicked"); if( button.text() == "unassigned" ) { // Assign the button and send the full button state to the server using a Webclient_Options event - var input = $('.inputfield:last'); + var input = $(".inputfield:last"); if( input.length < 1 ) { - input = $('#inputfield'); + input = $("#inputfield"); } assignButton( e.data, input.val() ); Evennia.msg("webclient_options", [], { "HotButtons": command_cache }); @@ -171,20 +171,20 @@ plugin_handler.add('hotbuttons', (function () { // // Create and register the hotbuttons golden-layout component var buildComponent = function () { - var myLayout = plugins['goldenlayout'].getGL(); + var myLayout = plugins["goldenlayout"].getGL(); - myLayout.registerComponent( 'hotbuttons', function (container, componentState) { - console.log('hotbuttons'); + myLayout.registerComponent( "hotbuttons", function (container, componentState) { + console.log("hotbuttons"); // build the buttons - var div = $('
'); + var div = $("
"); var len = command_cache.length; for( var x=len; x < len + num_buttons; x++ ) { command_cache.push("unassigned"); // initialize button command cache and onClick handler - button = $('