Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

trollbox

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

trollbox - npm Package Compare versions

Comparing version 0.0.13 to 0.0.14

23

dist/trollbox.js
(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 @@

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 @@

2

package.json
{
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc