fix: allow constructor with 1 arguement
This commit is contained in:
@@ -39,14 +39,14 @@
|
|||||||
<script src="js/wterminal.js"></script></code>
|
<script src="js/wterminal.js"></script></code>
|
||||||
</p>
|
</p>
|
||||||
<p>Then add a script ellement with:<br>
|
<p>Then add a script ellement with:<br>
|
||||||
<code>WTerminal.instalDropdownTerminal();</code>
|
<code>WTerminal.instalDropdownTerminal();</code><br>
|
||||||
Or
|
Or<br>
|
||||||
<code>new WTerminal("dropdown", null, null);</code>
|
<code>new WTerminal("dropdown");</code><br>
|
||||||
</p>
|
</p>
|
||||||
<script>
|
<script>
|
||||||
WTerminal.instalDropdownTerminal();
|
// WTerminal.instalDropdownTerminal();
|
||||||
// Or
|
// Or
|
||||||
//new WTerminal("dropdown", null, null);
|
new WTerminal("dropdown");
|
||||||
</script>
|
</script>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
class WTerminal {
|
class WTerminal {
|
||||||
//TERMINAL const
|
//TERMINAL const
|
||||||
static get VERSION() { return "1.3.2"; }; // terminal version, duh.
|
static get VERSION() { return "1.3.3"; }; // terminal version, duh.
|
||||||
//css & html element relations:
|
//css & html element relations:
|
||||||
static get BACKGROUND_CLASS() { return "wterminal-background"; }; // blurred background div class, contains it all, hides it all.
|
static get BACKGROUND_CLASS() { return "wterminal-background"; }; // blurred background div class, contains it all, hides it all.
|
||||||
static get CONTAINER_CLASS() { return "wterminal-container"; }; // container div class for all the terminal elements.
|
static get CONTAINER_CLASS() { return "wterminal-container"; }; // container div class for all the terminal elements.
|
||||||
@@ -198,7 +198,7 @@ class WTerminal {
|
|||||||
|
|
||||||
constructor(name, locationId, options) {
|
constructor(name, locationId, options) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.locationId = location;
|
this.locationId = locationId;
|
||||||
// use name in static storage of terminals
|
// use name in static storage of terminals
|
||||||
WTerminal.terminals[name] = this;
|
WTerminal.terminals[name] = this;
|
||||||
// Todo: use options variable ...
|
// Todo: use options variable ...
|
||||||
@@ -276,7 +276,7 @@ class WTerminal {
|
|||||||
controls.appendChild(btnScrollBottom);
|
controls.appendChild(btnScrollBottom);
|
||||||
container.appendChild(output);
|
container.appendChild(output);
|
||||||
container.appendChild(inputForm);
|
container.appendChild(inputForm);
|
||||||
if (locationId === null) { // use location to insert terminal in a div(string id) or dropdown (null)
|
if (locationId === null || typeof locationId === 'undefined') { // use location to insert terminal in a div(string id) or dropdown (null)
|
||||||
const background = WTerminal.createElement('div', { class: WTerminal.BACKGROUND_CLASS, title: "Close terminal" });
|
const background = WTerminal.createElement('div', { class: WTerminal.BACKGROUND_CLASS, title: "Close terminal" });
|
||||||
this.backgroundEl = background;
|
this.backgroundEl = background;
|
||||||
|
|
||||||
@@ -1297,7 +1297,7 @@ class WTerminal {
|
|||||||
if (document.body) {
|
if (document.body) {
|
||||||
new WTerminal('dropdown', null, null);
|
new WTerminal('dropdown', null, null);
|
||||||
} else {
|
} else {
|
||||||
window.addEventListener("load", () => new WTerminal('dropdown', null, null));
|
window.addEventListener("load", () => new WTerminal('dropdown'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user