Dramatic news generator
<script type="text/javascript" src="https://unpkg.com/mad-news/lib/index.js"></script>
var navigatorLang = navigator.language || navigator.userLanguage || '';
var language = navigatorLang.toLowerCase().indexOf('ru') > -1 ? 'ru' : 'en';
document.addEventListener('DOMContentLoaded', function (event) {
var madness = new MadNews(language);
document.querySelector('.person').innerText = madness.person;
document.querySelector('.action').innerText = madness.action;
document.querySelector('.conclusion').innerText = madness.conclusion;
});
npm install mad-news
const navigatorLang = navigator.language || navigator.userLanguage || '';
const language = navigatorLang.toLowerCase().indexOf('ru') > -1 ? 'ru' : 'en';
const MadNews = require('mad-news');
const madness = new MadNews(language);
console.log(madness.person);
console.log(madness.action);
console.log(madness.conclusion);
// or
console.log(madness.fullString);
// Generate new Madness:
madness.generate();
import MadNews from 'mad-news';
const language = 'en'; // currently there are only 'ru' and 'en' dictionaries
const madness = new MadNews(language);
console.log(madness.person);
console.log(madness.action);
console.log(madness.conclusion);
// or
console.log(madness.fullString);
// Generate new Madness:
madness.generate();