diff --git a/evennia/web/webclient/static/webclient/css/webclient.css b/evennia/web/webclient/static/webclient/css/webclient.css index 312f321595..0ce0997c56 100644 --- a/evennia/web/webclient/static/webclient/css/webclient.css +++ b/evennia/web/webclient/static/webclient/css/webclient.css @@ -88,6 +88,10 @@ div {margin:0px;} height: 100%; } +.card { + background-color: #333; +} + /* Container surrounding entire client */ #clientwrapper { height: 100%; diff --git a/evennia/web/webclient/static/webclient/fonts/DejaVuSansMono-webfont.woff b/evennia/web/webclient/static/webclient/fonts/DejaVuSansMono-webfont.woff new file mode 100644 index 0000000000..43b301c564 Binary files /dev/null and b/evennia/web/webclient/static/webclient/fonts/DejaVuSansMono-webfont.woff differ diff --git a/evennia/web/webclient/static/webclient/fonts/DejaVuSansMono.css b/evennia/web/webclient/static/webclient/fonts/DejaVuSansMono.css new file mode 100644 index 0000000000..5484c470fb --- /dev/null +++ b/evennia/web/webclient/static/webclient/fonts/DejaVuSansMono.css @@ -0,0 +1,6 @@ +@font-face { + font-family: 'DejaVu Sans Mono'; + src: url('/static/webclient/fonts/DejaVuSansMono-webfont.woff') format('woff'); + font-weight: normal; + font-style: normal; +} diff --git a/evennia/web/webclient/static/webclient/js/plugins/clienthelp.js b/evennia/web/webclient/static/webclient/js/plugins/clienthelp.js new file mode 100644 index 0000000000..f5f5545ab0 --- /dev/null +++ b/evennia/web/webclient/static/webclient/js/plugins/clienthelp.js @@ -0,0 +1,25 @@ +/* + * + * Evennia Webclient help plugin + * + */ +let clienthelp_plugin = (function () { + // + // + // + var onOptionsUI = function (parentdiv) { + var help_text = $( [ + "
", + "Evennia", + " Webclient Settings:", + "
" + ].join("")); + parentdiv.append(help_text); + } + + return { + init: function () {}, + onOptionsUI: onOptionsUI, + } +})(); +window.plugin_handler.add("clienthelp", clienthelp_plugin); diff --git a/evennia/web/webclient/static/webclient/js/plugins/font.js b/evennia/web/webclient/static/webclient/js/plugins/font.js new file mode 100644 index 0000000000..cf940fab40 --- /dev/null +++ b/evennia/web/webclient/static/webclient/js/plugins/font.js @@ -0,0 +1,79 @@ +/* + * + * Evennia Webclient default "send-text-on-enter-key" IO plugin + * + */ +let font_plugin = (function () { + + const font_urls = { + 'B612 Mono': 'https://fonts.googleapis.com/css?family=B612+Mono&display=swap', + 'Consolas': 'https://fonts.googleapis.com/css?family=Consolas&display=swap', + 'DejaVu Sans Mono': '/static/webclient/fonts/DejaVuSansMono.css', + 'Fira Mono': 'https://fonts.googleapis.com/css?family=Fira+Mono&display=swap', + 'Inconsolata': 'https://fonts.googleapis.com/css?family=Inconsolata&display=swap', + 'Monospace': '', + 'Roboto Mono': 'https://fonts.googleapis.com/css?family=Roboto+Mono&display=swap', + 'Source Code Pro': 'https://fonts.googleapis.com/css?family=Source+Code+Pro&display=swap', + 'Ubuntu Mono': 'https://fonts.googleapis.com/css?family=Ubuntu+Mono&display=swap', + }; + + // + // + // + var onOptionsUI = function (parentdiv) { + var fontselect = $(''); + + var fonts = Object.keys(font_urls); + for (var x = 0; x < fonts.length; x++) { + var option = $(''); + fontselect.append(option); + } + + for (var x = 4; x < 21; x++) { + var val = (x/10.0); + var option = $(''); + sizeselect.append(option); + } + + fontselect.val('DejaVu Sans Mono'); // default value + sizeselect.val('0.9'); // default scaling factor + + // font-family change callback + fontselect.on('change', function () { + $(document.body).css('font-family', $(this).val()); + }); + + // font size change callback + sizeselect.on('change', function () { + $(document.body).css('font-size', $(this).val()+"em"); + }); + + // add the font selection dialog control to our parentdiv + parentdiv.append('
Font Selection:
'); + parentdiv.append(fontselect); + parentdiv.append(sizeselect); + } + + // + // Font plugin init function (adds the urls for the webfonts to the page) + // + var init = function () { + var head = $(document.head); + + var fonts = Object.keys(font_urls); + for (var x = 0; x < fonts.length; x++) { + if ( fonts[x] != "Monospace" ) { + var url = font_urls[ fonts[x] ]; + var link = $(''); + head.append( link ); + } + } + } + + return { + init: init, + onOptionsUI: onOptionsUI, + } +})(); +window.plugin_handler.add("font", font_plugin); diff --git a/evennia/web/webclient/static/webclient/js/plugins/goldenlayout.js b/evennia/web/webclient/static/webclient/js/plugins/goldenlayout.js index d1409ab3f7..cbf5217730 100644 --- a/evennia/web/webclient/static/webclient/js/plugins/goldenlayout.js +++ b/evennia/web/webclient/static/webclient/js/plugins/goldenlayout.js @@ -383,6 +383,14 @@ let goldenlayout = (function () { // Public // + // + // helper accessor for other plugins to add new known-message types + var addKnownType = function (newtype) { + if( knownTypes.includes(newtype) == false ) { + knownTypes.push(newtype); + } + } + // // @@ -526,7 +534,7 @@ let goldenlayout = (function () { onKeydown: onKeydown, onText: onText, getGL: function () { return myLayout; }, - addKnownType: function (newtype) { knownTypes.push(newtype); }, + addKnownType: addKnownType, } }()); window.plugin_handler.add("goldenlayout", goldenlayout); diff --git a/evennia/web/webclient/static/webclient/js/plugins/iframe.js b/evennia/web/webclient/static/webclient/js/plugins/iframe.js new file mode 100644 index 0000000000..01d19a7993 --- /dev/null +++ b/evennia/web/webclient/static/webclient/js/plugins/iframe.js @@ -0,0 +1,68 @@ +/* + * IFrame plugin + * REQUIRES: goldenlayout.js + */ +let iframe = (function () { + + var url = window.location.origin; + + // + // Create iframe component + var createIframeComponent = function () { + var myLayout = window.plugins["goldenlayout"].getGL(); + + myLayout.registerComponent( "iframe", function (container, componentState) { + // build the iframe + var div = $('