Comparing version 0.0.13 to 0.0.14
(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){ | ||
class Trollbox { | ||
constructor(config) { | ||
this.config = config; | ||
this.config = config || {}; | ||
this.scriptId = 'FirebaseScript'; | ||
@@ -47,2 +47,7 @@ if (document.querySelector(`#${this.scriptId}`)) { | ||
const channel = (this.config.channel || '').replace(/[^a-zA-Z\d]/gi, '_'); | ||
if (!this.db) { | ||
return false; | ||
} | ||
this.ref = this.db.ref(`trollbox/${channel}`); | ||
@@ -65,2 +70,6 @@ | ||
post(message) { | ||
if (!this.ref) { | ||
return false; | ||
} | ||
this.ref.push().set({ | ||
@@ -116,2 +125,6 @@ user: this.config.user, | ||
bindForm(post) { | ||
if (!this.container) { | ||
return false; | ||
} | ||
const form = this.container.querySelector('.TrollboxForm'); | ||
@@ -137,5 +150,13 @@ this.form = form; | ||
if (!this.container) { | ||
return false; | ||
} | ||
const box = this.container.querySelector('.TrollboxMessages'); | ||
const list = this.container.querySelector('.TrollboxMessagesList'); | ||
if (!(box && list)) { | ||
return false; | ||
} | ||
list.innerHTML += `<li><strong>${this.escapeHtml(user)}:</strong> ${this.escapeHtml(message)}</li>`; | ||
@@ -142,0 +163,0 @@ |
23
index.js
class Trollbox { | ||
constructor (config) { | ||
this.config = config | ||
this.config = config || {} | ||
this.scriptId = 'FirebaseScript' | ||
@@ -46,2 +46,7 @@ if (document.querySelector(`#${this.scriptId}`)) { | ||
const channel = (this.config.channel || '').replace(/[^a-zA-Z\d]/gi, '_') | ||
if (!this.db) { | ||
return false | ||
} | ||
this.ref = this.db.ref(`trollbox/${channel}`) | ||
@@ -65,2 +70,6 @@ | ||
post (message) { | ||
if (!this.ref) { | ||
return false | ||
} | ||
this.ref.push().set({ | ||
@@ -116,2 +125,6 @@ user: this.config.user, | ||
bindForm (post) { | ||
if (!this.container) { | ||
return false | ||
} | ||
const form = this.container.querySelector('.TrollboxForm') | ||
@@ -137,5 +150,13 @@ this.form = form | ||
if (!this.container) { | ||
return false | ||
} | ||
const box = this.container.querySelector('.TrollboxMessages') | ||
const list = this.container.querySelector('.TrollboxMessagesList') | ||
if (!(box && list)) { | ||
return false | ||
} | ||
list.innerHTML += `<li><strong>${this.escapeHtml(user)}:</strong> ${this.escapeHtml(message)}</li>` | ||
@@ -142,0 +163,0 @@ |
{ | ||
"name": "trollbox", | ||
"version": "0.0.13", | ||
"version": "0.0.14", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
317074
403
0