diff --git a/evennia/web/webclient/static/webclient/js/plugins/goldenlayout.js b/evennia/web/webclient/static/webclient/js/plugins/goldenlayout.js index a867fff27f..b9c2cf2e68 100644 --- a/evennia/web/webclient/static/webclient/js/plugins/goldenlayout.js +++ b/evennia/web/webclient/static/webclient/js/plugins/goldenlayout.js @@ -6,46 +6,9 @@ let goldenlayout = (function () { var myLayout; - var input_component = null; var known_types = ["all", "untagged"]; var untagged = []; - var config = { - content: [{ - type: "column", - content: [{ - type: "row", - content: [{ - type: "column", - content: [{ - type: "component", - componentName: "Main", - isClosable: false, - tooltip: "Main - drag to desird position.", - componentState: { - types: "untagged", - update_method: "newlines", - }, - }] - }], - }, { - type: "component", - componentName: "input", - id: "inputComponent", - height: 12, - tooltip: "Input - The last input in the layout is always the default.", - }, { - type: "component", - componentName: "input", - id: "inputComponent", - height: 12, - isClosable: false, - tooltip: "Input - The last input in the layout is always the default.", - }] - }] - }; - - var newTabConfig = { title: "Untitled", type: "component", @@ -112,6 +75,40 @@ let goldenlayout = (function () { } + // + // + var closeTypelistDropdown = function () { + let content = $("#typelist").parent().find(".content"); + let checkboxes = $("#typelist :input"); + + let types = []; + for (let i=0; i"); let div = $("
"); @@ -383,7 +346,7 @@ let goldenlayout = (function () { // var routeMsg = function (text_div, txt, update_method) { if ( update_method == "replace" ) { - text_div.html(txt) + text_div.html(txt); } else if ( update_method == "append" ) { text_div.append(txt); } else { // line feed @@ -438,7 +401,7 @@ let goldenlayout = (function () { 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); } @@ -502,10 +465,11 @@ let goldenlayout = (function () { var mainsub = document.getElementById("main-sub"); if( savedState !== null ) { - config = JSON.parse( savedState ); + // Overwrite the global-variable configuration with the version from localstorage + window.goldenlayout_config = JSON.parse( savedState ); } - myLayout = new GoldenLayout( config, mainsub ); + myLayout = new GoldenLayout( window.goldenlayout_config, mainsub ); $("#inputcontrol").remove(); // remove the cluttered, HTML-defined input divs @@ -551,8 +515,6 @@ let goldenlayout = (function () { onKeydown: onKeydown, onText: onText, getGL: function () { return myLayout }, - getConfig: function () { return config }, - setConfig: function (newconfig) { config = newconfig }, addKnownType: function (newtype) { known_types.push(newtype) }, } })(); diff --git a/evennia/web/webclient/static/webclient/js/plugins/goldenlayout_default_config.js b/evennia/web/webclient/static/webclient/js/plugins/goldenlayout_default_config.js new file mode 100644 index 0000000000..7b4ba53c27 --- /dev/null +++ b/evennia/web/webclient/static/webclient/js/plugins/goldenlayout_default_config.js @@ -0,0 +1,55 @@ +/* + * Define the default GoldenLayout-based config + * + * The layout defined here will need to be customized based on which plugins + * you are using and what layout you want players to see by default. + * + * This needs to be loaded in the HTML before the goldenlayout.js plugin + * + * The contents of the global variable will be overwritten by what is in the + * browser's localstorage after visiting this site. + * + * For full documentation on all of the keywords see: + * http://golden-layout.com/docs/Config.html + * + */ +var goldenlayout_config = { // Global Variable used in goldenlayout.js init() + content: [{ + type: "column", + content: [{ + type: "row", + content: [{ + type: "column", + content: [{ + type: "component", + componentName: "Main", + isClosable: false, // remove the 'x' control to close this + tooltip: "Main - drag to desird position.", + componentState: { + types: "untagged", + update_method: "newlines", + }, + }] + }], +// }, { // Uncomment the following to add a default hotbuttons component +// type: "component", +// componentName: "hotbuttons", +// id: "inputComponent", // mark 'ignore this component during output message processing' +// height: 6, +// isClosable: false, + }, { + type: "component", + componentName: "input", + id: "inputComponent", // mark for ignore + height: 12, // percentage + tooltip: "Input - The last input in the layout is always the default.", + }, { + type: "component", + componentName: "input", + id: "inputComponent", // mark for ignore + height: 12, // percentage + isClosable: false, // remove the 'x' control to close this + tooltip: "Input - The last input in the layout is always the default.", + }] + }] +}; diff --git a/evennia/web/webclient/static/webclient/js/plugins/history.js b/evennia/web/webclient/static/webclient/js/plugins/history.js index 0b02b947a9..9d1c94662e 100644 --- a/evennia/web/webclient/static/webclient/js/plugins/history.js +++ b/evennia/web/webclient/static/webclient/js/plugins/history.js @@ -94,4 +94,4 @@ let history_plugin = (function () { onSend: onSend, } })() -plugin_handler.add("history", history_plugin); +window.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 383f6d0055..fcd7df1739 100644 --- a/evennia/web/webclient/static/webclient/js/plugins/hotbuttons.js +++ b/evennia/web/webclient/static/webclient/js/plugins/hotbuttons.js @@ -2,8 +2,9 @@ * * 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. + * This adds a bar of 9 buttons that can be shift-click assigned, + * whatever text is in the bottom textinput buffer will be copied. + * Once assigned, clicking the button again and have it execute those commands. * * It stores these commands as server side options. * @@ -12,100 +13,27 @@ * Stop Evennia * * Copy this file to mygame/web/static_overrides/webclient/js/plugins/hotbuttons.js - * Copy evennia/web/webclient/templates/webclient/base.html to mygame/web/template_overrides/webclient/base.html + * + * Copy evennia/web/webclient/templates/webclient/base.html to + * mygame/web/template_overrides/webclient/base.html * * Edit mygame/web/template_overrides/webclient/base.html to add: - * - * after the other plugin tags. + * + * before the goldenlayout.js plugin tags or after the splithandler.js plugin tags + * + * If you are using goldenlayout.js, uncomment the hotbuttons component in goldenlayout_default_config.js * * Run: evennia collectstatic (say "yes" to the overwrite prompt) * Start Evennia + * + * REQUIRES: goldenlayout.js OR splithandler.js */ let hotbuttons = (function () { - var dependencies_met = true; // To start, assume either splithandler or goldenlayout plugin is enabled. + var dependencies_met = false; var num_buttons = 9; var command_cache = new Array; - var hotButtonConfig = { - content: [{ - type: "column", - content: [{ - type: "row", - content: [{ - type: "column", - content: [{ - type: "component", - componentName: "Main", - isClosable: false, - tooltip: "Main - drag to desird position.", - componentState: { - types: "untagged", - update_method: "newlines", - }, - }] - }], - }, { - type: "component", - componentName: "hotbuttons", - id: "inputComponent", - height: 12, - tooltip: "Input - The last input in the layout is always the default.", - }, { - type: "component", - componentName: "input", - id: "inputComponent", - height: 12, - tooltip: "Input - The last input in the layout is always the default.", - }, { - type: "component", - componentName: "input", - id: "inputComponent", - height: 12, - isClosable: false, - tooltip: "Input - The last input in the layout is always the default.", - }] - }] - }; - - // - // Add Buttons UI for SplitHandler - var addButtonsUI = function () { - var buttons = $( [ - "
", - "
", - "
", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - "
", - "
", - "
", - ].join("\n") ); - - // Add buttons in front of the existing #inputform - $("#input").prev().replaceWith(buttons); - - Split(["#main","#buttons","#input"], { - sizes: [85,5,10], - direction: "vertical", - gutterSize: 4, - minSize: [150,20,50], - }); - - for( var n=0; n", + "
", + "
", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + "
", + "
", + "
", + ].join("\n") ); + + // Add buttons in front of the existing #inputform + $("#input").prev().replaceWith(buttons); + + Split(["#main","#buttons","#input"], { + sizes: [85,5,10], + direction: "vertical", + gutterSize: 4, + minSize: [150,20,50], + }); + + for( var n=0; n"); + var button = $("