Lint fixes
This commit is contained in:
parent
ea8ed1b903
commit
cf746fe04b
4 changed files with 221 additions and 219 deletions
|
|
@ -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 () {
|
let defaultin_plugin = (function () {
|
||||||
|
|
@ -32,7 +32,7 @@ let defaultin_plugin = (function () {
|
||||||
for (var i = 0; i < lines.length; i++) {
|
for (var i = 0; i < lines.length; i++) {
|
||||||
plugin_handler.onSend( lines[i].trim() );
|
plugin_handler.onSend( lines[i].trim() );
|
||||||
}
|
}
|
||||||
inputfield.val(''); // Clear this inputfield
|
inputfield.val(""); // Clear this inputfield
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
inputfield.blur();
|
inputfield.blur();
|
||||||
|
|
@ -44,7 +44,7 @@ let defaultin_plugin = (function () {
|
||||||
if( inputfield.length < 1 ) {
|
if( inputfield.length < 1 ) {
|
||||||
// Nope, focus the last .inputfield found in the DOM (or #inputfield)
|
// Nope, focus the last .inputfield found in the DOM (or #inputfield)
|
||||||
// :last only matters if multi-input plugins are in use
|
// :last only matters if multi-input plugins are in use
|
||||||
inputfield = $(".inputfield:last")
|
inputfield = $(".inputfield:last");
|
||||||
inputfield.focus();
|
inputfield.focus();
|
||||||
if( inputfield.length < 1 ) { // non-goldenlayout backwards compatibility
|
if( inputfield.length < 1 ) { // non-goldenlayout backwards compatibility
|
||||||
$("#inputfield").focus();
|
$("#inputfield").focus();
|
||||||
|
|
@ -67,7 +67,7 @@ let defaultin_plugin = (function () {
|
||||||
$("#inputfield").focus().trigger(e);
|
$("#inputfield").focus().trigger(e);
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log('DefaultIn initialized');
|
console.log("DefaultIn initialized");
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
@ -75,4 +75,4 @@ let defaultin_plugin = (function () {
|
||||||
onKeydown: onKeydown,
|
onKeydown: onKeydown,
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
plugin_handler.add('defaultin', defaultin_plugin);
|
window.plugin_handler.add("defaultin", defaultin_plugin);
|
||||||
|
|
|
||||||
|
|
@ -3,64 +3,64 @@
|
||||||
* Golden Layout plugin
|
* Golden Layout plugin
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
plugin_handler.add('goldenlayout', (function () {
|
let goldenlayout = (function () {
|
||||||
|
|
||||||
var myLayout;
|
var myLayout;
|
||||||
var input_component = null;
|
var input_component = null;
|
||||||
var known_types = ['all', 'untagged'];
|
var known_types = ["all", "untagged"];
|
||||||
var untagged = [];
|
var untagged = [];
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
content: [{
|
content: [{
|
||||||
type: 'column',
|
type: "column",
|
||||||
content: [{
|
content: [{
|
||||||
type: 'row',
|
type: "row",
|
||||||
content: [{
|
content: [{
|
||||||
type: 'column',
|
type: "column",
|
||||||
content: [{
|
content: [{
|
||||||
type: 'component',
|
type: "component",
|
||||||
componentName: 'Main',
|
componentName: "Main",
|
||||||
isClosable: false,
|
isClosable: false,
|
||||||
tooltip: 'Main - drag to desird position.',
|
tooltip: "Main - drag to desird position.",
|
||||||
componentState: {
|
componentState: {
|
||||||
types: 'untagged',
|
types: "untagged",
|
||||||
update_method: 'newlines',
|
update_method: "newlines",
|
||||||
},
|
},
|
||||||
}]
|
}]
|
||||||
}],
|
}],
|
||||||
}, {
|
}, {
|
||||||
type: 'component',
|
type: "component",
|
||||||
componentName: 'input',
|
componentName: "input",
|
||||||
id: 'inputComponent',
|
id: "inputComponent",
|
||||||
height: 12,
|
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',
|
type: "component",
|
||||||
componentName: 'input',
|
componentName: "input",
|
||||||
id: 'inputComponent',
|
id: "inputComponent",
|
||||||
height: 12,
|
height: 12,
|
||||||
isClosable: false,
|
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 = {
|
var newTabConfig = {
|
||||||
title: 'Untitled',
|
title: "Untitled",
|
||||||
type: 'component',
|
type: "component",
|
||||||
componentName: 'evennia',
|
componentName: "evennia",
|
||||||
componentState: {
|
componentState: {
|
||||||
types: 'all',
|
types: "all",
|
||||||
update_method: 'newlines',
|
update_method: "newlines",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
var newInputConfig = {
|
var newInputConfig = {
|
||||||
title: 'input',
|
title: "input",
|
||||||
type: 'component',
|
type: "component",
|
||||||
componentName: 'input',
|
componentName: "input",
|
||||||
id: 'inputComponent',
|
id: "inputComponent",
|
||||||
};
|
};
|
||||||
|
|
||||||
// helper function: filter vals out of array
|
// 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.
|
// then filter out all types that have been mapped to a pane.
|
||||||
var calculateUntaggedTypes = function () {
|
var calculateUntaggedTypes = function () {
|
||||||
// set initial untagged list
|
// set initial untagged list
|
||||||
untagged = filter( ['all', 'untagged'], known_types);
|
untagged = filter( ["all", "untagged"], known_types);
|
||||||
// for each .content pane
|
// for each .content pane
|
||||||
$('.content').each( function () {
|
$(".content").each( function () {
|
||||||
let types = $(this).attr('types');
|
let types = $(this).attr("types");
|
||||||
if ( typeof types !== "undefined" ) {
|
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 () {
|
var closeRenameDropdown = function () {
|
||||||
let content = $('#renamebox').parent().parent().parent().parent()[0];
|
let content = $("#renamebox").parent().parent().parent().parent()[0];
|
||||||
let title = $('#renameboxin').val();
|
let title = $("#renameboxin").val();
|
||||||
|
|
||||||
let components = myLayout.root.getItemsByType('component');
|
let components = myLayout.root.getItemsByType("component");
|
||||||
|
|
||||||
components.forEach( function (component) {
|
components.forEach( function (component) {
|
||||||
let element = component.tab.header.parent.element[0];
|
let element = component.tab.header.parent.element[0];
|
||||||
|
|
@ -107,8 +107,8 @@ plugin_handler.add('goldenlayout', (function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
myLayout.emit('stateChanged');
|
myLayout.emit("stateChanged");
|
||||||
$('#renamebox').remove();
|
$("#renamebox").remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -116,22 +116,22 @@ plugin_handler.add('goldenlayout', (function () {
|
||||||
// Handle the renameDropdown
|
// Handle the renameDropdown
|
||||||
var renameDropdown = function (evnt) {
|
var renameDropdown = function (evnt) {
|
||||||
let element = $(evnt.data.contentItem.element);
|
let element = $(evnt.data.contentItem.element);
|
||||||
let content = element.find('.content');
|
let content = element.find(".content");
|
||||||
let title = evnt.data.contentItem.config.title;
|
let title = evnt.data.contentItem.config.title;
|
||||||
let renamebox = document.getElementById('renamebox');
|
let renamebox = document.getElementById("renamebox");
|
||||||
|
|
||||||
// check that no other dropdown is open
|
// check that no other dropdown is open
|
||||||
if( document.getElementById('typelist') ) {
|
if( document.getElementById("typelist") ) {
|
||||||
closeTypelistDropdown();
|
closeTypelistDropdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( document.getElementById('updatelist') ) {
|
if( document.getElementById("updatelist") ) {
|
||||||
closeUpdatelistDropdown();
|
closeUpdatelistDropdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !renamebox ) {
|
if( !renamebox ) {
|
||||||
renamebox = $('<div id="renamebox">');
|
renamebox = $("<div id='renamebox'>");
|
||||||
renamebox.append('<input type="textbox" id="renameboxin" value="'+title+'">');
|
renamebox.append("<input type='textbox' id='renameboxin' value='"+title+"'>");
|
||||||
renamebox.insertBefore( content );
|
renamebox.insertBefore( content );
|
||||||
} else {
|
} else {
|
||||||
closeRenameDropdown();
|
closeRenameDropdown();
|
||||||
|
|
@ -142,22 +142,22 @@ plugin_handler.add('goldenlayout', (function () {
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
var closeTypelistDropdown = function () {
|
var closeTypelistDropdown = function () {
|
||||||
let content = $('#typelist').parent().find('.content');
|
let content = $("#typelist").parent().find(".content");
|
||||||
let checkboxes = $('#typelist :input');
|
let checkboxes = $("#typelist :input");
|
||||||
|
|
||||||
let types = [];
|
let types = [];
|
||||||
for (let i=0; i<checkboxes.length; i++ ) {
|
for (let i=0; i<checkboxes.length; i++ ) {
|
||||||
let box = checkboxes[i];
|
let box = checkboxes[i];
|
||||||
if( $(box).prop('checked') ) {
|
if( $(box).prop("checked") ) {
|
||||||
types.push( $(box).val() );
|
types.push( $(box).val() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
content.attr('types', types.join(' '));
|
content.attr("types", types.join(" "));
|
||||||
myLayout.emit('stateChanged');
|
myLayout.emit("stateChanged");
|
||||||
|
|
||||||
calculateUntaggedTypes();
|
calculateUntaggedTypes();
|
||||||
$('#typelist').remove();
|
$("#typelist").remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -165,21 +165,21 @@ plugin_handler.add('goldenlayout', (function () {
|
||||||
//
|
//
|
||||||
var onSelectTypesClicked = function (evnt) {
|
var onSelectTypesClicked = function (evnt) {
|
||||||
let element = $(evnt.data.contentItem.element);
|
let element = $(evnt.data.contentItem.element);
|
||||||
let content = element.find('.content');
|
let content = element.find(".content");
|
||||||
let selected_types = content.attr('types');
|
let selected_types = content.attr("types");
|
||||||
let menu = $('<div id="typelist">');
|
let menu = $("<div id='typelist'>");
|
||||||
let div = $('<div class="typelistsub">');
|
let div = $("<div class='typelistsub'>");
|
||||||
|
|
||||||
if( selected_types ) {
|
if( selected_types ) {
|
||||||
selected_types = selected_types.split(' ');
|
selected_types = selected_types.split(" ");
|
||||||
}
|
}
|
||||||
for (let i=0; i<known_types.length;i++) {
|
for (let i=0; i<known_types.length;i++) {
|
||||||
let type = known_types[i];
|
let itype = known_types[i];
|
||||||
let choice;
|
let choice;
|
||||||
if( selected_types && selected_types.includes(type) ) {
|
if( selected_types && selected_types.includes(itype) ) {
|
||||||
choice = $('<label><input type="checkbox" value="'+type+'" checked="checked"/>'+type+'</label>');
|
choice = $("<label><input type='checkbox' value='"+itype+"' checked='checked'/>"+itype+"</label>");
|
||||||
} else {
|
} else {
|
||||||
choice = $('<label><input type="checkbox" value="'+type+'"/>'+type+'</label>');
|
choice = $("<label><input type='checkbox' value='"+itype+"'/>"+itype+"</label>");
|
||||||
}
|
}
|
||||||
choice.appendTo(div);
|
choice.appendTo(div);
|
||||||
}
|
}
|
||||||
|
|
@ -192,14 +192,14 @@ plugin_handler.add('goldenlayout', (function () {
|
||||||
//
|
//
|
||||||
// Handle the typeDropdown
|
// Handle the typeDropdown
|
||||||
var typeDropdown = function (evnt) {
|
var typeDropdown = function (evnt) {
|
||||||
let typelist = document.getElementById('typelist');
|
let typelist = document.getElementById("typelist");
|
||||||
|
|
||||||
// check that no other dropdown is open
|
// check that no other dropdown is open
|
||||||
if( document.getElementById('renamebox') ) {
|
if( document.getElementById("renamebox") ) {
|
||||||
closeRenameDropdown();
|
closeRenameDropdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( document.getElementById('updatelist') ) {
|
if( document.getElementById("updatelist") ) {
|
||||||
closeUpdatelistDropdown();
|
closeUpdatelistDropdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -214,12 +214,12 @@ plugin_handler.add('goldenlayout', (function () {
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
var closeUpdatelistDropdown = function () {
|
var closeUpdatelistDropdown = function () {
|
||||||
let content = $('#updatelist').parent().find('.content');
|
let content = $("#updatelist").parent().find(".content");
|
||||||
let value = $('input[name=upmethod]:checked').val();
|
let value = $("input[name=upmethod]:checked").val();
|
||||||
|
|
||||||
content.attr('update_method', value );
|
content.attr("update_method", value );
|
||||||
myLayout.emit('stateChanged');
|
myLayout.emit("stateChanged");
|
||||||
$('#updatelist').remove();
|
$("#updatelist").remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -227,18 +227,18 @@ plugin_handler.add('goldenlayout', (function () {
|
||||||
//
|
//
|
||||||
var onUpdateMethodClicked = function (evnt) {
|
var onUpdateMethodClicked = function (evnt) {
|
||||||
let element = $(evnt.data.contentItem.element);
|
let element = $(evnt.data.contentItem.element);
|
||||||
let content = element.find('.content');
|
let content = element.find(".content");
|
||||||
let update_method = content.attr('update_method');
|
let update_method = content.attr("update_method");
|
||||||
let nlchecked = (update_method == 'newlines') ? 'checked="checked"' : '';
|
let nlchecked = (update_method == "newlines") ? "checked="checked"" : "";
|
||||||
let apchecked = (update_method == 'append') ? 'checked="checked"' : '';
|
let apchecked = (update_method == "append") ? "checked="checked"" : "";
|
||||||
let rpchecked = (update_method == 'replace') ? 'checked="checked"' : '';
|
let rpchecked = (update_method == "replace") ? "checked="checked"" : "";
|
||||||
|
|
||||||
let menu = $('<div id="updatelist">');
|
let menu = $("<div id='updatelist'>");
|
||||||
let div = $('<div class="updatelistsub">');
|
let div = $("<div class='updatelistsub'>");
|
||||||
|
|
||||||
let newlines = $('<label><input type="radio" name="upmethod" value="newlines" '+nlchecked+'/>Newlines</label>');
|
let newlines = $("<label><input type='radio' name='upmethod' value='newlines' "+nlchecked+"/>Newlines</label>");
|
||||||
let append = $('<label><input type="radio" name="upmethod" value="append" '+apchecked+'/>Append</label>');
|
let append = $("<label><input type='radio' name='upmethod' value='append' "+apchecked+"/>Append</label>");
|
||||||
let replace = $('<label><input type="radio" name="upmethod" value="replace" '+rpchecked+'/>Replace</label>');
|
let replace = $("<label><input type='radio' name='upmethod' value='replace' "+rpchecked+"/>Replace</label>");
|
||||||
|
|
||||||
newlines.appendTo(div);
|
newlines.appendTo(div);
|
||||||
append.appendTo(div);
|
append.appendTo(div);
|
||||||
|
|
@ -253,14 +253,14 @@ plugin_handler.add('goldenlayout', (function () {
|
||||||
//
|
//
|
||||||
// Handle the updateDropdown
|
// Handle the updateDropdown
|
||||||
var updateDropdown = function (evnt) {
|
var updateDropdown = function (evnt) {
|
||||||
let updatelist = document.getElementById('updatelist');
|
let updatelist = document.getElementById("updatelist");
|
||||||
|
|
||||||
// check that no other dropdown is open
|
// check that no other dropdown is open
|
||||||
if( document.getElementById('renamebox') ) {
|
if( document.getElementById("renamebox") ) {
|
||||||
closeRenameDropdown();
|
closeRenameDropdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( document.getElementById('typelist') ) {
|
if( document.getElementById("typelist") ) {
|
||||||
closeTypelistDropdown();
|
closeTypelistDropdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -275,9 +275,9 @@ plugin_handler.add('goldenlayout', (function () {
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
var onActiveTabChange = function (tab) {
|
var onActiveTabChange = function (tab) {
|
||||||
let renamebox = document.getElementById('renamebox');
|
let renamebox = document.getElementById("renamebox");
|
||||||
let typelist = document.getElementById('typelist');
|
let typelist = document.getElementById("typelist");
|
||||||
let updatelist = document.getElementById('updatelist');
|
let updatelist = document.getElementById("updatelist");
|
||||||
|
|
||||||
if( renamebox ) {
|
if( renamebox ) {
|
||||||
closeRenameDropdown();
|
closeRenameDropdown();
|
||||||
|
|
@ -296,18 +296,18 @@ plugin_handler.add('goldenlayout', (function () {
|
||||||
//
|
//
|
||||||
// Save the GoldenLayout state to localstorage whenever it changes.
|
// Save the GoldenLayout state to localstorage whenever it changes.
|
||||||
var onStateChanged = function () {
|
var onStateChanged = function () {
|
||||||
let components = myLayout.root.getItemsByType('component');
|
let components = myLayout.root.getItemsByType("component");
|
||||||
components.forEach( function (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 text_div = component.container.getElement().children(".content");
|
||||||
let types = text_div.attr('types');
|
let types = text_div.attr("types");
|
||||||
let update_method = text_div.attr('update_method');
|
let update_method = text_div.attr("update_method");
|
||||||
component.container.extendState({ 'types': types, 'update_method': update_method });
|
component.container.extendState({ "types": types, "update_method": update_method });
|
||||||
});
|
});
|
||||||
|
|
||||||
var state = JSON.stringify( myLayout.toConfig() );
|
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) {
|
var onTabCreate = function (tab) {
|
||||||
//HTML for the typeDropdown
|
//HTML for the typeDropdown
|
||||||
let renameDropdownControl = $('<span class="lm_title" style="font-size: 1em;width: 1.5em;">\u2B57</span>');
|
let renameDropdownControl = $("<span class='lm_title' style='font-size: 1em;width: 1.5em;'>\u2B57</span>");
|
||||||
let typeDropdownControl = $('<span class="lm_title" style="font-size: 1.5em;width: 1em;">⮛</span>');
|
let typeDropdownControl = $("<span class='lm_title' style='font-size: 1.5em;width: 1em;'>⮛</span>");
|
||||||
let updateDropdownControl = $('<span class="lm_title" style="font-size: 1.5em;width: 1em;">⮛</span>');
|
let updateDropdownControl = $("<span class='lm_title' style='font-size: 1.5em;width: 1em;'>⮛</span>");
|
||||||
let splitControl = $('<span class="lm_title" style="font-size: 2em;width: 1em;">+</span>');
|
let splitControl = $("<span class='lm_title' style='font-size: 2em;width: 1em;'>+</span>");
|
||||||
|
|
||||||
// track dropdowns when the associated control is clicked
|
// track dropdowns when the associated control is clicked
|
||||||
renameDropdownControl.click( tab, renameDropdown );
|
renameDropdownControl.click( tab, renameDropdown );
|
||||||
|
|
@ -339,10 +339,10 @@ plugin_handler.add('goldenlayout', (function () {
|
||||||
tab.element.append( splitControl );
|
tab.element.append( splitControl );
|
||||||
|
|
||||||
if( tab.contentItem.config.componentName == "Main" ) {
|
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) {
|
var onInputCreate = function (tab) {
|
||||||
//HTML for the typeDropdown
|
//HTML for the typeDropdown
|
||||||
let splitControl = $('<span class="lm_title" style="font-size: 2em;width: 1em;">+</span>');
|
let splitControl = $("<span class='lm_title' style='font-size: 2em;width: 1em;'>+</span>");
|
||||||
|
|
||||||
// track adding a new tab
|
// track adding a new tab
|
||||||
splitControl.click( tab, function (evnt) {
|
splitControl.click( tab, function (evnt) {
|
||||||
|
|
@ -360,19 +360,19 @@ plugin_handler.add('goldenlayout', (function () {
|
||||||
// Add the typeDropdown to the header
|
// Add the typeDropdown to the header
|
||||||
tab.element.append( splitControl );
|
tab.element.append( splitControl );
|
||||||
|
|
||||||
tab.header.parent.on( 'activeContentItemChanged', onActiveTabChange );
|
tab.header.parent.on( "activeContentItemChanged", onActiveTabChange );
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
var scrollAll = function () {
|
var scrollAll = function () {
|
||||||
let components = myLayout.root.getItemsByType('component');
|
let components = myLayout.root.getItemsByType("component");
|
||||||
components.forEach( function (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 text_div = component.container.getElement().children(".content");
|
||||||
let scrollHeight = text_div.prop('scrollHeight');
|
let scrollHeight = text_div.prop("scrollHeight");
|
||||||
let clientHeight = text_div.prop('clientHeight');
|
let clientHeight = text_div.prop("clientHeight");
|
||||||
text_div.scrollTop( scrollHeight - clientHeight );
|
text_div.scrollTop( scrollHeight - clientHeight );
|
||||||
});
|
});
|
||||||
myLayout.updateSize();
|
myLayout.updateSize();
|
||||||
|
|
@ -382,15 +382,15 @@ plugin_handler.add('goldenlayout', (function () {
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
var routeMsg = function (text_div, txt, update_method) {
|
var routeMsg = function (text_div, txt, update_method) {
|
||||||
if ( update_method == 'replace' ) {
|
if ( update_method == "replace" ) {
|
||||||
text_div.html(txt)
|
text_div.html(txt)
|
||||||
} else if ( update_method == 'append' ) {
|
} else if ( update_method == "append" ) {
|
||||||
text_div.append(txt);
|
text_div.append(txt);
|
||||||
} else { // line feed
|
} else { // line feed
|
||||||
text_div.append('<div class="out">' + txt + '</div>');
|
text_div.append("<div class='out'>" + txt + "</div>");
|
||||||
}
|
}
|
||||||
let scrollHeight = text_div.prop('scrollHeight');
|
let scrollHeight = text_div.prop("scrollHeight");
|
||||||
let clientHeight = text_div.prop('clientHeight');
|
let clientHeight = text_div.prop("clientHeight");
|
||||||
text_div.scrollTop( scrollHeight - 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) {
|
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 ) {
|
if( state ) {
|
||||||
div.attr('types', state.types);
|
div.attr("types", state.types);
|
||||||
div.attr('update_method', state.update_method);
|
div.attr("update_method", state.update_method);
|
||||||
} else {
|
} else {
|
||||||
div.attr('types', default_types);
|
div.attr("types", default_types);
|
||||||
div.attr('update_method', update_method);
|
div.attr("update_method", update_method);
|
||||||
}
|
}
|
||||||
div.appendTo( container.getElement() );
|
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 onKeydown = function(evnt) {
|
||||||
var renamebox = document.getElementById('renamebox');
|
var renamebox = document.getElementById("renamebox");
|
||||||
if( renamebox ) {
|
if( renamebox ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -430,39 +430,39 @@ plugin_handler.add('goldenlayout', (function () {
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
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' and 'untagged' set
|
// should go into any panes with "all" and "untagged" set
|
||||||
var msgtype = 'untagged';
|
var msgtype = "untagged";
|
||||||
|
|
||||||
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);
|
||||||
untagged.push(msgtype);
|
untagged.push(msgtype);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let message_delivered = false;
|
let message_delivered = false;
|
||||||
let components = myLayout.root.getItemsByType('component');
|
let components = myLayout.root.getItemsByType("component");
|
||||||
|
|
||||||
components.forEach( function (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 text_div = component.container.getElement().children(".content");
|
||||||
let attr_types = text_div.attr('types');
|
let attr_types = text_div.attr("types");
|
||||||
let pane_types = attr_types ? attr_types.split(' ') : [];
|
let pane_types = attr_types ? attr_types.split(" ") : [];
|
||||||
let update_method = text_div.attr('update_method');
|
let update_method = text_div.attr("update_method");
|
||||||
let txt = args[0];
|
let txt = args[0];
|
||||||
|
|
||||||
// is this message type listed in this pane's types (or is this pane catching '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') ) {
|
if( pane_types.includes(msgtype) || pane_types.includes("all") ) {
|
||||||
routeMsg( text_div, txt, update_method );
|
routeMsg( text_div, txt, update_method );
|
||||||
message_delivered = true;
|
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?
|
// And is this message type listed in the untagged types array?
|
||||||
if( pane_types.includes("untagged") && untagged.includes(msgtype) ) {
|
if( pane_types.includes("untagged") && untagged.includes(msgtype) ) {
|
||||||
routeMsg( text_div, txt, update_method );
|
routeMsg( text_div, txt, update_method );
|
||||||
|
|
@ -488,9 +488,9 @@ plugin_handler.add('goldenlayout', (function () {
|
||||||
$(window).bind("resize", scrollAll);
|
$(window).bind("resize", scrollAll);
|
||||||
|
|
||||||
// Set Save State callback
|
// 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
|
// required Init me
|
||||||
var init = function (options) {
|
var init = function (options) {
|
||||||
// Set up our GoldenLayout instance built off of the default main-sub div
|
// Set up our GoldenLayout instance built off of the default main-sub div
|
||||||
var savedState = localStorage.getItem( 'evenniaGoldenLayoutSavedState' );
|
var savedState = localStorage.getItem( "evenniaGoldenLayoutSavedState" );
|
||||||
var mainsub = document.getElementById('main-sub');
|
var mainsub = document.getElementById("main-sub");
|
||||||
|
|
||||||
if( savedState !== null ) {
|
if( savedState !== null ) {
|
||||||
config = JSON.parse( savedState );
|
config = JSON.parse( savedState );
|
||||||
|
|
@ -507,40 +507,40 @@ plugin_handler.add('goldenlayout', (function () {
|
||||||
|
|
||||||
myLayout = new GoldenLayout( config, mainsub );
|
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
|
// register our component and replace the default messagewindow with the Main component
|
||||||
myLayout.registerComponent( 'Main', function (container, componentState) {
|
myLayout.registerComponent( "Main", function (container, componentState) {
|
||||||
let main = $('#messagewindow').addClass('content');
|
let main = $("#messagewindow").addClass("content");
|
||||||
initComponent(main, container, componentState, 'untagged', 'newlines' );
|
initComponent(main, container, componentState, "untagged", "newlines" );
|
||||||
});
|
});
|
||||||
|
|
||||||
// register our new input component
|
// register our new input component
|
||||||
myLayout.registerComponent( 'input', function (container, componentState) {
|
myLayout.registerComponent( "input", function (container, componentState) {
|
||||||
var inputfield = $('<textarea type="text" class="inputfield form-control"></textarea>');
|
var inputfield = $("<textarea type='text' class='inputfield form-control'></textarea>");
|
||||||
var button = $('<button type="button" class="inputsend">></button>');
|
var button = $("<button type='button' class='inputsend'>></button>");
|
||||||
|
|
||||||
$('<div class="inputwrap">')
|
$("<div class='inputwrap'>")
|
||||||
.append( button )
|
.append( button )
|
||||||
.append( inputfield )
|
.append( inputfield )
|
||||||
.appendTo( container.getElement() );
|
.appendTo( container.getElement() );
|
||||||
|
|
||||||
button.bind('click', function (evnt) {
|
button.bind("click", function (evnt) {
|
||||||
// focus our textarea
|
// focus our textarea
|
||||||
$( $(evnt.target).siblings('.inputfield')[0] ).focus();
|
$( $(evnt.target).siblings(".inputfield")[0] ).focus();
|
||||||
// fake a carriage return event
|
// fake a carriage return event
|
||||||
var e = $.Event('keydown');
|
var e = $.Event("keydown");
|
||||||
e.which = 13;
|
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) {
|
myLayout.registerComponent( "evennia", function (container, componentState) {
|
||||||
let div = $('<div class="content"></div>');
|
let div = $("<div class='content'></div>");
|
||||||
initComponent(div, container, componentState, 'all', 'newlines');
|
initComponent(div, container, componentState, "all", "newlines");
|
||||||
container.on('destroy', calculateUntaggedTypes);
|
container.on("destroy", calculateUntaggedTypes);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -555,4 +555,5 @@ plugin_handler.add('goldenlayout', (function () {
|
||||||
setConfig: function (newconfig) { config = newconfig },
|
setConfig: function (newconfig) { config = newconfig },
|
||||||
addKnownType: function (newtype) { known_types.push(newtype) },
|
addKnownType: function (newtype) { known_types.push(newtype) },
|
||||||
}
|
}
|
||||||
})());
|
})();
|
||||||
|
window.plugin_handler.add("goldenlayout", goldenlayout);
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ let history_plugin = (function () {
|
||||||
var history = new Array();
|
var history = new Array();
|
||||||
var history_pos = 0;
|
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
|
// move back in the history
|
||||||
|
|
@ -37,7 +37,7 @@ let history_plugin = (function () {
|
||||||
history.shift(); // kill oldest entry
|
history.shift(); // kill oldest entry
|
||||||
}
|
}
|
||||||
history[history.length-1] = input;
|
history[history.length-1] = input;
|
||||||
history[history.length] = '';
|
history[history.length] = "";
|
||||||
}
|
}
|
||||||
history_pos = 0;
|
history_pos = 0;
|
||||||
}
|
}
|
||||||
|
|
@ -62,11 +62,11 @@ let history_plugin = (function () {
|
||||||
if (history_entry !== null) {
|
if (history_entry !== null) {
|
||||||
// Doing a history navigation; replace the text in the input and
|
// Doing a history navigation; replace the text in the input and
|
||||||
// move the cursor to the end of the new value
|
// 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
|
if( inputfield.length < 1 ) { // pre-goldenlayout backwards compatibility
|
||||||
inputfield = $('#inputfield');
|
inputfield = $("#inputfield");
|
||||||
}
|
}
|
||||||
inputfield.val('');
|
inputfield.val("");
|
||||||
inputfield.blur().focus().val(history_entry);
|
inputfield.blur().focus().val(history_entry);
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -85,7 +85,7 @@ let history_plugin = (function () {
|
||||||
//
|
//
|
||||||
// Init function
|
// Init function
|
||||||
var init = function () {
|
var init = function () {
|
||||||
console.log('History Plugin Initialized.');
|
console.log("History Plugin Initialized.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
@ -94,4 +94,4 @@ let history_plugin = (function () {
|
||||||
onSend: onSend,
|
onSend: onSend,
|
||||||
}
|
}
|
||||||
})()
|
})()
|
||||||
plugin_handler.add('history', history_plugin);
|
plugin_handler.add("history", history_plugin);
|
||||||
|
|
|
||||||
|
|
@ -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
|
* 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.
|
* 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 @@
|
||||||
* <script src={% static "webclient/js/plugins/hotbuttons.js" %} language="javascript" type="text/javascript"></script>
|
* <script src={% static "webclient/js/plugins/hotbuttons.js" %} language="javascript" type="text/javascript"></script>
|
||||||
* after the other <script></script> plugin tags.
|
* after the other <script></script> plugin tags.
|
||||||
*
|
*
|
||||||
* Run: evennia collectstatic (say 'yes' to the overwrite prompt)
|
* Run: evennia collectstatic (say "yes" to the overwrite prompt)
|
||||||
* Start Evennia
|
* 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 dependencies_met = true; // To start, assume either splithandler or goldenlayout plugin is enabled.
|
||||||
|
|
||||||
var num_buttons = 9;
|
var num_buttons = 9;
|
||||||
|
|
@ -29,41 +29,41 @@ plugin_handler.add('hotbuttons', (function () {
|
||||||
|
|
||||||
var hotButtonConfig = {
|
var hotButtonConfig = {
|
||||||
content: [{
|
content: [{
|
||||||
type: 'column',
|
type: "column",
|
||||||
content: [{
|
content: [{
|
||||||
type: 'row',
|
type: "row",
|
||||||
content: [{
|
content: [{
|
||||||
type: 'column',
|
type: "column",
|
||||||
content: [{
|
content: [{
|
||||||
type: 'component',
|
type: "component",
|
||||||
componentName: 'Main',
|
componentName: "Main",
|
||||||
isClosable: false,
|
isClosable: false,
|
||||||
tooltip: 'Main - drag to desird position.',
|
tooltip: "Main - drag to desird position.",
|
||||||
componentState: {
|
componentState: {
|
||||||
types: 'untagged',
|
types: "untagged",
|
||||||
update_method: 'newlines',
|
update_method: "newlines",
|
||||||
},
|
},
|
||||||
}]
|
}]
|
||||||
}],
|
}],
|
||||||
}, {
|
}, {
|
||||||
type: 'component',
|
type: "component",
|
||||||
componentName: 'hotbuttons',
|
componentName: "hotbuttons",
|
||||||
id: 'inputComponent',
|
id: "inputComponent",
|
||||||
height: 12,
|
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',
|
type: "component",
|
||||||
componentName: 'input',
|
componentName: "input",
|
||||||
id: 'inputComponent',
|
id: "inputComponent",
|
||||||
height: 12,
|
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',
|
type: "component",
|
||||||
componentName: 'input',
|
componentName: "input",
|
||||||
id: 'inputComponent',
|
id: "inputComponent",
|
||||||
height: 12,
|
height: 12,
|
||||||
isClosable: false,
|
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
|
// Add Buttons UI for SplitHandler
|
||||||
var addButtonsUI = function () {
|
var addButtonsUI = function () {
|
||||||
var buttons = $( [
|
var buttons = $( [
|
||||||
'<div id="buttons" class="split split-vertical">',
|
"<div id='buttons' class='split split-vertical'>",
|
||||||
' <div id="buttonsform">',
|
" <div id='buttonsform'>",
|
||||||
' <div id="buttonscontrol" class="input-group">',
|
" <div id='buttonscontrol' class='input-group'>",
|
||||||
' <button class="btn" id="assign_button0" type="button" value="button0">unassigned</button>',
|
" <button class='btn' id='assign_button0' type='button' value='button0'>unassigned</button>",
|
||||||
' <button class="btn" id="assign_button1" type="button" value="button1">unassigned</button>',
|
" <button class='btn' id='assign_button1' type='button' value='button1'>unassigned</button>",
|
||||||
' <button class="btn" id="assign_button2" type="button" value="button2">unassigned</button>',
|
" <button class='btn' id='assign_button2' type='button' value='button2'>unassigned</button>",
|
||||||
' <button class="btn" id="assign_button3" type="button" value="button3">unassigned</button>',
|
" <button class='btn' id='assign_button3' type='button' value='button3'>unassigned</button>",
|
||||||
' <button class="btn" id="assign_button4" type="button" value="button4">unassigned</button>',
|
" <button class='btn' id='assign_button4' type='button' value='button4'>unassigned</button>",
|
||||||
' <button class="btn" id="assign_button5" type="button" value="button5">unassigned</button>',
|
" <button class='btn' id='assign_button5' type='button' value='button5'>unassigned</button>",
|
||||||
' <button class="btn" id="assign_button6" type="button" value="button6">unassigned</button>',
|
" <button class='btn' id='assign_button6' type='button' value='button6'>unassigned</button>",
|
||||||
' <button class="btn" id="assign_button7" type="button" value="button7">unassigned</button>',
|
" <button class='btn' id='assign_button7' type='button' value='button7'>unassigned</button>",
|
||||||
' <button class="btn" id="assign_button8" type="button" value="button8">unassigned</button>',
|
" <button class='btn' id='assign_button8' type='button' value='button8'>unassigned</button>",
|
||||||
' </div>',
|
" </div>",
|
||||||
' </div>',
|
" </div>",
|
||||||
'</div>',
|
"</div>",
|
||||||
].join("\n") );
|
].join("\n") );
|
||||||
|
|
||||||
// Add buttons in front of the existing #inputform
|
// 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],
|
sizes: [85,5,10],
|
||||||
direction: 'vertical',
|
direction: "vertical",
|
||||||
gutterSize: 4,
|
gutterSize: 4,
|
||||||
minSize: [150,20,50],
|
minSize: [150,20,50],
|
||||||
});
|
});
|
||||||
|
|
@ -150,9 +150,9 @@ plugin_handler.add('hotbuttons', (function () {
|
||||||
console.log("button " + e.data + " clicked");
|
console.log("button " + e.data + " clicked");
|
||||||
if( button.text() == "unassigned" ) {
|
if( button.text() == "unassigned" ) {
|
||||||
// Assign the button and send the full button state to the server using a Webclient_Options event
|
// 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 ) {
|
if( input.length < 1 ) {
|
||||||
input = $('#inputfield');
|
input = $("#inputfield");
|
||||||
}
|
}
|
||||||
assignButton( e.data, input.val() );
|
assignButton( e.data, input.val() );
|
||||||
Evennia.msg("webclient_options", [], { "HotButtons": command_cache });
|
Evennia.msg("webclient_options", [], { "HotButtons": command_cache });
|
||||||
|
|
@ -171,20 +171,20 @@ plugin_handler.add('hotbuttons', (function () {
|
||||||
//
|
//
|
||||||
// Create and register the hotbuttons golden-layout component
|
// Create and register the hotbuttons golden-layout component
|
||||||
var buildComponent = function () {
|
var buildComponent = function () {
|
||||||
var myLayout = plugins['goldenlayout'].getGL();
|
var myLayout = plugins["goldenlayout"].getGL();
|
||||||
|
|
||||||
myLayout.registerComponent( 'hotbuttons', function (container, componentState) {
|
myLayout.registerComponent( "hotbuttons", function (container, componentState) {
|
||||||
console.log('hotbuttons');
|
console.log("hotbuttons");
|
||||||
|
|
||||||
// build the buttons
|
// build the buttons
|
||||||
var div = $('<div class="input-group">');
|
var div = $("<div class='input-group'>");
|
||||||
|
|
||||||
var len = command_cache.length;
|
var len = command_cache.length;
|
||||||
for( var x=len; x < len + num_buttons; x++ ) {
|
for( var x=len; x < len + num_buttons; x++ ) {
|
||||||
command_cache.push("unassigned");
|
command_cache.push("unassigned");
|
||||||
|
|
||||||
// initialize button command cache and onClick handler
|
// initialize button command cache and onClick handler
|
||||||
button = $('<button class="btn" id="assign_button'+x+'" type="button" value="button'+x+'">');
|
button = $("<button class='btn' id='assign_button"+x+"' type='button' value='button"+x+"'>");
|
||||||
button.html("unassigned");
|
button.html("unassigned");
|
||||||
button.click( x, hotButtonClicked );
|
button.click( x, hotButtonClicked );
|
||||||
|
|
||||||
|
|
@ -201,8 +201,8 @@ plugin_handler.add('hotbuttons', (function () {
|
||||||
//
|
//
|
||||||
// Handle the HotButtons part of a Webclient_Options event
|
// Handle the HotButtons part of a Webclient_Options event
|
||||||
var onGotOptions = function(args, kwargs) {
|
var onGotOptions = function(args, kwargs) {
|
||||||
if( dependencies_met && kwargs['HotButtons'] ) {
|
if( dependencies_met && kwargs["HotButtons"] ) {
|
||||||
var button_options = kwargs['HotButtons'];
|
var button_options = kwargs["HotButtons"];
|
||||||
$.each( button_options, function( key, value ) {
|
$.each( button_options, function( key, value ) {
|
||||||
assignButton(key, value);
|
assignButton(key, value);
|
||||||
});
|
});
|
||||||
|
|
@ -214,15 +214,15 @@ plugin_handler.add('hotbuttons', (function () {
|
||||||
// Initialize me
|
// Initialize me
|
||||||
var init = function() {
|
var init = function() {
|
||||||
// Are we using GoldenLayout?
|
// Are we using GoldenLayout?
|
||||||
if( plugins['goldenlayout'] ) {
|
if( plugins["goldenlayout"] ) {
|
||||||
// update goldenlayout's global config
|
// update goldenlayout"s global config
|
||||||
plugins['goldenlayout'].setConfig( hotButtonConfig );
|
plugins["goldenlayout"].setConfig( hotButtonConfig );
|
||||||
// wait for postInit() to create the required component
|
// wait for postInit() to create the required component
|
||||||
dependencies_met = true;
|
dependencies_met = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Are we using splithandler?
|
// Are we using splithandler?
|
||||||
if( plugins['splithandler'] ) {
|
if( plugins["splithandler"] ) {
|
||||||
addButtonsUI();
|
addButtonsUI();
|
||||||
dependencies_met = true;
|
dependencies_met = true;
|
||||||
}
|
}
|
||||||
|
|
@ -233,7 +233,7 @@ plugin_handler.add('hotbuttons', (function () {
|
||||||
//
|
//
|
||||||
var postInit = function() {
|
var postInit = function() {
|
||||||
if( dependencies_met ) {
|
if( dependencies_met ) {
|
||||||
if( plugins['goldenlayout'] ) {
|
if( plugins["goldenlayout"] ) {
|
||||||
buildComponent();
|
buildComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -248,4 +248,5 @@ plugin_handler.add('hotbuttons', (function () {
|
||||||
postInit: postInit,
|
postInit: postInit,
|
||||||
onGotOptions: onGotOptions,
|
onGotOptions: onGotOptions,
|
||||||
}
|
}
|
||||||
})());
|
})();
|
||||||
|
window.plugin_handler.add("hotbuttons", hotbuttons);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue