fix: allow constructor with 1 arguement
This commit is contained in:
		@@ -39,14 +39,14 @@
 | 
			
		||||
        <script src="js/wterminal.js"></script></code>
 | 
			
		||||
    </p>
 | 
			
		||||
    <p>Then add a script ellement with:<br>
 | 
			
		||||
      <code>WTerminal.instalDropdownTerminal();</code>
 | 
			
		||||
      Or
 | 
			
		||||
      <code>new WTerminal("dropdown", null, null);</code>
 | 
			
		||||
        <code>WTerminal.instalDropdownTerminal();</code><br>
 | 
			
		||||
      Or<br>
 | 
			
		||||
      <code>new WTerminal("dropdown");</code><br>
 | 
			
		||||
    </p>
 | 
			
		||||
    <script>
 | 
			
		||||
      WTerminal.instalDropdownTerminal();
 | 
			
		||||
      // WTerminal.instalDropdownTerminal();
 | 
			
		||||
      // Or
 | 
			
		||||
      //new WTerminal("dropdown", null, null);
 | 
			
		||||
      new WTerminal("dropdown");
 | 
			
		||||
    </script>
 | 
			
		||||
  </main>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,7 @@
 | 
			
		||||
*/
 | 
			
		||||
class WTerminal {
 | 
			
		||||
  //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:
 | 
			
		||||
  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.
 | 
			
		||||
@@ -198,7 +198,7 @@ class WTerminal {
 | 
			
		||||
 | 
			
		||||
  constructor(name, locationId, options) {
 | 
			
		||||
    this.name = name;
 | 
			
		||||
    this.locationId = location;
 | 
			
		||||
    this.locationId = locationId;
 | 
			
		||||
    // use name in static storage of terminals
 | 
			
		||||
    WTerminal.terminals[name] = this;
 | 
			
		||||
    // Todo: use options variable ... 
 | 
			
		||||
@@ -276,7 +276,7 @@ class WTerminal {
 | 
			
		||||
    controls.appendChild(btnScrollBottom);
 | 
			
		||||
    container.appendChild(output);
 | 
			
		||||
    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" });
 | 
			
		||||
      this.backgroundEl = background;
 | 
			
		||||
 | 
			
		||||
@@ -1297,7 +1297,7 @@ class WTerminal {
 | 
			
		||||
    if (document.body) {
 | 
			
		||||
      new WTerminal('dropdown', null, null);
 | 
			
		||||
    } else {
 | 
			
		||||
      window.addEventListener("load", () => new WTerminal('dropdown', null, null));
 | 
			
		||||
      window.addEventListener("load", () => new WTerminal('dropdown'));
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user