JSFiddle - React, Tailwind, and code Playground

by Kevin Faulhaber

HTML

<div id="container"></div>

JavaScript

/*

    Created by Grimbode --
        functions with "return this" are chainable functions. 
        For example: bored().start().stop();

*/

(function () {
    var bored = function (o) {
        if (!(this instanceof bored)) {
            return new bored(o);
        }

        if (typeof o === 'undefined') {
            o = {};
        }

        //attributes
        this.target = o.target || document.body;
        this.url = 'http://subfusion.net/cgi-bin/quote.pl&number=1&quote=cookie';
    };

    bored.fn = bored.prototype = {
        init: function () {}
    };
    //exporting
    window.bored = bored;

    //bored functions here
    bored.fn.start = function () {
        return this;
    };
    bored.fn.stop = function () {
        return this;
    };
    bored.fn.getQuote = function () {
        var $this = this,
            xmlhttp = new XMLHttpRequest();;
        xmlhttp.onreadystatechange = function () {
            if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                $this.target.innerHTML = xmlhttp.responseText;
            }
        }
        xmlhttp.open("GET", this.url, true);
        xmlhttp.send();

    };
})();

bored({
    target: document.getElementById('container'),
    level: 9000,
}).getQuote();