');
+ regex.on('change', onAlterRegex );
+ regex.on('focusin', onFocusIn );
+ regex.on('focusout', onFocusOut );
+ tag.on('change', onAlterTag );
+ tag.on('focusin', onFocusIn );
+ tag.on('focusout', onFocusOut );
+ div.append(regex);
+ div.append(tag);
+ formdiv.append(div);
+ }
+
+ // Public
+
+ //
+ // onOptionsUI -- create an expandable/deletable row of regex/tag mapping pairs
+ //
+ // If there isn't a window with that tag mapped already, open a new one
+ //
+ var onOptionsUI = function (parentdiv) {
+ var div = $('
');
+ var button= $('
');
+ button.on('click', function () { onNewRegexRow(div, '', ''); });
+ div.append(button);
+
+ for( regex in spawnmap ) {
+ onNewRegexRow(div, regex, spawnmap[regex] );
+ }
+
+ parentdiv.append('
Message Routing:
');
+ parentdiv.append(div);
+ }
+
+ //
+ // onText -- catch Text before it is routed by the goldenlayout router
+ // then test our list of regexes on the given text to see if it matches.
+ // If it does, rewrite the Text Type to be our tag value instead.
+ //
+ var onText = function (args, kwargs) {
+ var txt = args[0];
+
+ for( regex in spawnmap ) {
+ if ( txt.match(regex) != null ) {
+ kwargs['type'] = spawnmap[regex];
+ }
+ }
+ }
+
+
+ //
+ // OnKeydown -- if the Options window is open, capture focus
+ //
+ var onKeydown = function(evnt) {
+ return ignoreDefaultKeydown;
+ }
+
+
+ //
+ // init
+ //
+ var init = function () {
+ var ls_spawnmap = localStorage.getItem( "evenniaMessageRoutingSavedState" );
+ if( ls_spawnmap ) {
+ spawnmap = JSON.parse(ls_spawnmap);
+ for( regex in spawnmap ) {
+ window.plugins["goldenlayout"].addKnownType( spawnmap[regex] );
+ }
+ }
+
+ console.log('Client-Side Message Routing plugin initialized');
+ }
+
+ return {
+ init: init,
+ onOptionsUI: onOptionsUI,
+ onText: onText,
+ onKeydown: onKeydown,
+ }
+})();
+window.plugin_handler.add("spawns", spawns);
diff --git a/evennia/web/webclient/static/webclient/js/plugins/options2.js b/evennia/web/webclient/static/webclient/js/plugins/options2.js
new file mode 100644
index 0000000000..7c87b46e69
--- /dev/null
+++ b/evennia/web/webclient/static/webclient/js/plugins/options2.js
@@ -0,0 +1,103 @@
+/*
+ * Options 2.0
+ * REQUIRES: goldenlayout.js
+ */
+let options2 = (function () {
+
+ var onGagPrompt = function () { console.log('gagprompt') }
+ var onNotifyPopup = function () { console.log('notifypopup') }
+ var onNotifySound = function () { console.log('notifysound') }
+
+ var onOptionsUI = function (parentdiv) {
+ var gagprompt = $('
');
+ var notifypopup = $('
');
+ var notifysound = $('
');
+
+ gagprompt.on("change", onGagPrompt);
+ notifypopup.on("change", onNotifyPopup);
+ notifysound.on("change", onNotifySound);
+
+ parentdiv.append(gagprompt);
+ parentdiv.append(notifypopup);
+ parentdiv.append(notifysound);
+ }
+
+
+ //
+ // Create and register the "options" golden-layout component
+ var createOptionsComponent = function () {
+ var myLayout = window.plugins["goldenlayout"].getGL();
+
+ myLayout.registerComponent( "options", function (container, componentState) {
+ var plugins = window.plugins;
+
+ // build the buttons
+ var div = $("
");
+
+ for( let plugin in plugins ) {
+ if( 'onOptionsUI' in plugins[plugin] ) {
+ var card = $("
");
+ var body = $("
");
+
+ plugins[plugin].onOptionsUI( body );
+
+ card.append(body);
+ card.appendTo( div );
+ }
+ }
+
+ div.appendTo( container.getElement() );
+ });
+ }
+
+
+ // handler for the "Options" button
+ var onOpenOptions = function () {
+ var optionsComponent = {
+ title: "Options",
+ type: "component",
+ componentName: "options",
+ componentState: {
+ },
+ };
+
+ // Create a new GoldenLayout tab filled with the optionsComponent above
+ var myLayout = window.plugins["goldenlayout"].getGL();
+ var main = myLayout.root.getItemsByType("stack")[0].getActiveContentItem();
+ main.parent.addChild( optionsComponent );
+ }
+
+ // Public
+
+ //
+ // Handle the Webclient_Options event
+ var onGotOptions = function(args, kwargs) {
+ // Pressing the settings button
+ }
+
+ var init = function() {
+ var optionsbutton = $('');
+ $('#toolbar').append( optionsbutton );
+ // Pressing the settings button
+ }
+
+ //
+ //
+ var postInit = function() {
+ // Are we using GoldenLayout?
+ if( window.plugins["goldenlayout"] ) {
+ createOptionsComponent();
+
+ $("#optionsbutton").bind("click", onOpenOptions);
+ }
+ console.log('Options2 Loaded');
+ }
+
+ return {
+ init: init,
+ postInit: postInit,
+ onGotOptions: onGotOptions,
+ onOptionsUI: onOptionsUI,
+ }
+})();
+window.plugin_handler.add("options2", options2);
diff --git a/evennia/web/webclient/templates/webclient/base.html b/evennia/web/webclient/templates/webclient/base.html
index 399389f15e..46353b18ad 100644
--- a/evennia/web/webclient/templates/webclient/base.html
+++ b/evennia/web/webclient/templates/webclient/base.html
@@ -76,9 +76,16 @@ JQuery available.
{% block guilib_import %}
+
-
+
+
+
+
+