Comparing version 0.0.18 to 0.0.19
@@ -59,2 +59,6 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
setChannel(channel) { | ||
if (channel === this.config.channel) { | ||
return false; | ||
} | ||
this.config.channel = channel; | ||
@@ -65,2 +69,6 @@ this.onLoad(); | ||
setUser(user) { | ||
if (user === this.config.user) { | ||
return false; | ||
} | ||
this.config.user = user; | ||
@@ -106,3 +114,3 @@ this.onLoad(); | ||
// ugly, quick, and dirty | ||
this.container.innerHTML = ` | ||
const html = ` | ||
<div class="TrollboxContainer"> | ||
@@ -123,2 +131,8 @@ <div class="TrollboxHeader"> | ||
`; | ||
const doc = document.createDocumentFragment(); | ||
const div = document.createElement('div'); | ||
div.innerHTML = html; | ||
while (div.firstChild) doc.appendChild(div.firstChild); | ||
this.container.appendChild(doc); | ||
} | ||
@@ -162,4 +176,10 @@ | ||
list.innerHTML += `<li><strong>${this.escapeHtml(user)}:</strong> ${this.escapeHtml(message)}</li>`; | ||
const html = `<strong>${this.escapeHtml(user)}:</strong> ${this.escapeHtml(message)}`; | ||
const doc = document.createDocumentFragment(); | ||
const listItem = document.createElement('li'); | ||
listItem.innerHTML = html; | ||
doc.appendChild(listItem); | ||
list.appendChild(doc); | ||
box.scrollTop = box.scrollHeight; | ||
@@ -166,0 +186,0 @@ } |
16
index.js
@@ -112,3 +112,3 @@ class Trollbox { | ||
// ugly, quick, and dirty | ||
this.container.innerHTML = ` | ||
const html = ` | ||
<div class="TrollboxContainer"> | ||
@@ -129,2 +129,8 @@ <div class="TrollboxHeader"> | ||
` | ||
const doc = document.createDocumentFragment() | ||
const div = document.createElement('div') | ||
div.innerHTML = html | ||
while (div.firstChild) doc.appendChild(div.firstChild) | ||
this.container.appendChild(doc) | ||
} | ||
@@ -168,4 +174,10 @@ | ||
list.innerHTML += `<li><strong>${this.escapeHtml(user)}:</strong> ${this.escapeHtml(message)}</li>` | ||
const html = `<strong>${this.escapeHtml(user)}:</strong> ${this.escapeHtml(message)}` | ||
const doc = document.createDocumentFragment() | ||
const listItem = document.createElement('li') | ||
listItem.innerHTML = html | ||
doc.appendChild(listItem) | ||
list.appendChild(doc) | ||
box.scrollTop = box.scrollHeight | ||
@@ -172,0 +184,0 @@ } |
{ | ||
"name": "trollbox", | ||
"version": "0.0.18", | ||
"version": "0.0.19", | ||
"description": "Instant trollbox using Firebase.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
318165
435