1.10.2 • Published 9 years ago

dailymotion-live-chat v1.10.2

Weekly downloads
3
License
MIT
Repository
-
Last release
9 years ago

Dailymotion Chat javascript plugin

Import via CDN

<script src="https://npmcdn.com/dailymotion-live-chat/dist/embed/js/dailymotion-live-chat.js"></script>

Usage

Instanciate chat plugin:

var c = new window.DmChat(options);

Here is an overview of defaults values for options:

var c = new window.DmChat({
  owner: null,                          // Username of chat owner (required)
  name: null,                           // Name of your room (required)
  placeholder: document.body,           // Chat placeholder (DOM element)
  styles: 'live',                       // Chat's styling (live || games)
  api_key: null,                        // Dailymotion API key
  mobile: false,                        // Mobile version
  onLogged: null,                       // After login callback function
  onLogin: null,                        // Function provided to handle login
  access_token: null,                   // DM access_token (to prevent popup login)
  api_endpoint: null,                   // Api endpoint (ex: stage-01.dailymotion.com)
  grosminet_endpoint: null,             // Grosminet endpoint (ex: http://dmchat.dailymotion.com:80)
  wordsBlacklist: ['word1', 'word2'],   // Array of words to blacklist (will appear as *****)
  debug: false                          // Enable or disable console.log with debug
});

Available function:

c.changeSkin(skin);

skin parameter should be equal to 'light' or 'dark'

Commands

Mute user

/mute username
/mute @username

Unmute

/unmute username
/unmute @username

Ban

/ban username
/ban @username

Unban

/unban username
/unban @username

Reply to last mention

/r

Dailymotion Chat React component

Install

npm install dailymotion-live-chat --save

Usage

See example, in example/ folder.

let React = require('react');
let DmChat = require ('dailymotion-live-chat');

React.render(
  <DmChat
    name="x2ns1iw"
    ownerUsername="httpete"
    styles="games"
  />
, document.querySelector('.chat-placeholder'));

Development

Install

Install all dependencies...

$ npm install

...and rename sample.config.js to dev.config.js

cp app/scripts/config/sample.config.js app/scripts/config/dev.config.js

Run development server

$ gulp dev

Gulp will start a webpack dev server with hot-reload at port 9099. You can define a port with $ gulp --port 3333.

An online version of grominet backend is available at 'http://dmchat.dailymotion.com:80 You can still build grominet locally (live-chat backend https://github.com/dailymotion/grosminet), and specify the right url in config.js (GROMINET_ENDPOINT)

Build

Builds a minified version of the js plugin + react component + embed version (with assets from npmcdn.com)

$ gulp build
1.10.2

9 years ago

1.10.1

9 years ago

1.10.0

9 years ago

1.9.12

9 years ago

1.9.11

9 years ago

1.9.10

9 years ago

1.9.9

10 years ago

1.9.8

10 years ago

1.9.7

10 years ago

1.9.6

10 years ago

1.9.5

10 years ago

1.9.3

10 years ago

1.9.2

10 years ago

1.9.1

10 years ago

1.9.0

10 years ago

1.8.6

10 years ago

1.8.4

10 years ago

1.8.3

10 years ago

1.8.2

10 years ago

1.8.1

10 years ago

1.6.13

10 years ago

1.3.7

10 years ago

1.2.4

10 years ago

1.1.10

10 years ago