<commit_before>Object.forEach = function (object, callback) {
    for (var key in object) {
        if (object.hasOwnProperty(key))
            callback.call(object, key, object[key]);
    }
};
Object.every = function (object, callback) {
    for (var key in object) {
        if (object.hasOwnProperty(key))
            if (callback.call(object, key, object[key]) === false) return false;
    }
    return true;
};
Object.some = function (object, callback) {
    var status = false;
    for (var key in object) {
        if (object.hasOwnProperty(key))
            status = callback.call(object, key, object[key]) || status;
    }
    return status;
};
Object.clone = function (o) {
    if (o === null || typeof(o) !== 'object') return o;

    var objNew = o.constructor();

    for (var key in o)
        objNew[key] = Object.clone(o[key]);

    return objNew;
};
Object.merge = function (o1, o2) {
    var objNew = Object.clone(o1);
    for (var p in o2) {
        if (o2[p] && o2[p].constructor === Object) {
            if (!o1[p]) o1[p] = {};
            objNew[p] = Object.merge(o1[p], o2[p]);
        } else {
            objNew[p] = o2[p];
        }
    }
    return objNew;
};
document.elem = function (elemname, attributes, text) {
    if (typeof attributes === 'string') {
        text = attributes;
        attributes = null;
    }
    if (elemname === 'textElem') return document.createTextNode(text);
    return document.createElement(elemname).attrib(attributes).setText(text);
};
document.getElem = document.querySelector;
document.getElemAll = document.querySelectorAll;
document.delElem = function (element) {
    if (typeof element === 'string') {
        element = document.getElemAll(element);
    }
    if (element.forEach) {
        element.forEach(function (node) {
            if (node.parentNode) node.parentNode.removeChild(node);
        });
    } else if (element && element.parentNode) {
        element.parentNode.removeChild(element);
    }
};
document.ready = function (callback) {
    if (document.readyState == "complete" || document.readyState == "loaded" || document.readyState == "interactive") {
        setTimeout(callback, 1);
    } else if (document.addEventListener) {
        document.addEventListener("DOMContentLoaded", callback);
    } else {
        document.onreadystatechange = function () {
            if (document.readyState == "interactive") callback();
        }
    }
};
Element.prototype.getElem = Element.prototype.querySelector;
Element.prototype.getElemAll = Element.prototype.querySelectorAll;
Element.prototype.del = function () {
    var parent = this.parentNode;
    if (parent) parent.removeChild(this);
    return parent;
};
Element.prototype.elem = function (elemname, attr, text, returnparent) {
    if (typeof elemname !== 'string') {
        var _that = this;
        [].concat(elemname).forEach(function (element) {
            _that.appendChild(element);
        });
        return this;
    }
    var elem = document.elem(elemname, attr, text);
    this.appendChild(elem);
    return (returnparent !== null && returnparent) ? this : ['br', 'hr', 'textElem'].indexOf(elemname) === -1 ? elem : returnparent === false ? elem : this;
};
Element.prototype.siblings = function () {
    return this.parentElement.children;
};
Element.prototype.up = function () {
    return this.parentElement;
};
Element.prototype.attrib = function (attribute, value) {
    if (attribute) {
        var _this = this;
        var setOrRemove = function (key, value) {
            value !== null ? _this.setAttribute(key, value) : _this.removeAttribute(key);
        };
        if (typeof attribute === "object") {
            Object.forEach(attribute, setOrRemove);
        } else if (typeof attribute === 'string') {
            setOrRemove(attribute, value);
        }
    }
    return this;
};
Element.prototype.setText = function (text) {
    if (text) {
        this.textContent = text;
    }
    return this;
};
Element.prototype.clearElem = function () {
    if (this.textContent !== null) {
        this.textContent = '';
    }
    while (this.firstChild) {
        this.removeChild(this.firstChild);
    }
    return this;
};
Element.prototype.on = function (event, listener, useCapture) {
    if (this.attachEvent) {
        this.attachEvent(event, listener);
    } else {
        this.addEventListener(event, listener, useCapture);
    }
    return this;
};
Element.prototype.off = function (event, listener, useCapture) {
    if (this.detachEvent) {
        this.detachEvent(event, listener);
    } else {
        this.removeEventListener(event, listener, useCapture);
    }
    return this;
};
Element.prototype.addClass = function (className) {
    if (this.classList) {
        this.classList.add(className);
    } else {
        var classes = this.className.split(' ');
        if (classes.indexOf(className) === -1) {
            classes.push(className);
            this.className = classes.join(' ');
        }
    }
    return this;
};
Element.prototype.removeClass = function (className) {
    if (this.classList) {
        this.classList.remove(className);
    } else {
        var classes = this.className.split(' ');
        var index = classes.indexOf(className);
        if (index !== -1) {
            classes.splice(index, 1);
            this.className = classes.join(' ');
        }
    }
    return this;
};
Element.prototype.toggleClass = function (className) {
    if (this.classList) {
        this.classList.toggle(className);
    } else if (this.className.split(' ').indexOf(className) !== -1) {
        this.removeClass(className);
    } else {
        this.addClass(className);
    }
    return this;
};
Element.prototype.hasClass = function (className) {
    if (this.classList) {
        return this.classList.contains(className);
    } else {
        return this.className.split(' ').indexOf(className) !== -1;
    }
};
NodeList.prototype.forEach = function (callback) {
    for (var i = 0; i < this.length; i++) {
        callback(this[i], i);
    }
};
NodeList.prototype.every = function (callback) {
    for (var i = 0; i < this.length; i++) {
        if (callback(this[i], i) === false) return false;
    }
    return true;
};
NodeList.prototype.some = function (callback) {
    var status = false;
    for (var i = 0; i < this.length; i++) {
        status = callback(this[i], i) || status;
    }
    return status;
};
NodeList.prototype.attrib = function (attribute, value) {
    this.forEach(function (node) {
        node.attrib(attribute, value)
    });
    return this;
};
NodeList.prototype.elem = function (elemname, attr, text, returnparent) {
    var rand = Math.random() * 10000, name = "data-elemjs-NL-elem";
    this.forEach(function (node) {
        node.elem(elemname, attr, text, returnparent).attrib(name, rand);
    });
    return document.getElemAll("[" + name + "='" + rand + "']").attrib(name, null);
};
NodeList.prototype.del = function () {
    var rand = Math.random() * 10000, name = "data-elemjs-NL-del";
    this.forEach(function (node) {
        node.del().attrib(name, rand);
    });
    return document.getElemAll("[" + name + "='" + rand + "']").attrib(name, null);
};
NodeList.prototype.getElem = function (selector) {
    var rand = Math.random() * 10000, name = "data-elemjs-NL-getElem";
    this.forEach(function (node) {
        var temp = node.getElem(selector);
        if (temp !== null)temp.attrib(name, rand);
    });
    return document.getElemAll("[" + name + "='" + rand + "']").attrib(name, null);
};
NodeList.prototype.getElemAll = function (selector) {
    var rand = Math.random() * 10000, name = "data-elemjs-NL-getElemAll";
    this.forEach(function (node) {
        node.getElemAll(selector).attrib(name, rand);
    });
    return document.getElemAll("[" + name + "='" + rand + "']").attrib(name, null);
};
NodeList.prototype.on = function (event, listener, useCapture) {
    this.forEach(function (node) {
        node.on(event, listener, useCapture);
    });
    return this;
};
NodeList.prototype.off = function (event, listener, useCapture) {
    this.forEach(function (node) {
        node.off(event, listener, useCapture);
    });
    return this;
};
NodeList.prototype.addClass = function (className) {
    this.forEach(function (node) {
        node.addClass(className);
    });
    return this;
};
NodeList.prototype.removeClass = function (className) {
    this.forEach(function (node) {
        node.removeClass(className);
    });
    return this;
};
NodeList.prototype.toggleClass = function (className) {
    this.forEach(function (node) {
        node.toggleClass(className);
    });
    return this;
};
NodeList.prototype.hasClass = function (className) {
    var rand = Math.random() * 10000, name = "data-elemjs-NL-hasClass";
    this.forEach(function (node) {
        if (node.hasClass(className)) {
            node.attrib(name, rand);
        }
    });
    return document.getElemAll("[" + name + "='" + rand + "']").attrib(name, null);
};
NodeList.prototype.toArray = function () {
    var arr = [];
    for (var i = this.length; i--; arr.unshift(this[i]));
    return arr;
};
['section', 'nav', 'article', 'aside', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'footer', 'address', 'main', 'p', 'hr', 'pre', 'ol', 'ul', 'li', 'div', 'a', 'em', 'strong', 'code', 'span', 'br', 'img', 'svg', 'table', 'tbody', 'thead', 'tfoot', 'tr', 'td', 'th', 'form', 'label', 'input', 'button', 'select', 'option', 'textarea', 'textElem'].map(function (elemname) {
    Element.prototype[elemname] = function (attr, text, returnparent) {
        return this.elem(elemname, attr, text, returnparent);
    };
    document[elemname] = function (attr, text) {
        return this.elem(elemname, attr, text);
    };
    NodeList.prototype[elemname] = function (attr, text, returnparent) {
        return this.elem(elemname, attr, text, returnparent);
    }
});
Window.http = {
    defaults: { method: 'GET', async: true, headers: {} },
    request: function (config) {
        var options = Object.merge(Window.http.defaults, config);
        Window.http._callback(options.before);
        var xhr = new XMLHttpRequest();
        xhr.onload = function () {
            if (this.status >= 200 && this.status < 300) {
                Window.http._callback(options.success, this.responseText, this.status, this.statusText, this);
            } else {
                Window.http._callback(options.error, this.responseText, this.status, this.statusText, this);
            }
        };
        xhr.onerror = function () {
            Window.http._callback(options.error, this.responseText, this.status, this.statusText, this);
        };
        xhr.onloadend = function () {
            Window.http._callback(options.loadEnd);
        };
        xhr.onprogress = function (event) {
            if (event.lengthComputable) {
                Window.http._callback(options.progress, event.loaded, event.total);
            } else {
                Window.http._callback(options.progress, event.loaded, null);
            }
        };
        xhr.open(options.method, options.url, options.async);
        if (options.headers !== null && typeof options.headers === 'object')
            Object.forEach(options.headers, function (key, value) {
                xhr.setRequestHeader(key, value);
            });
        if (options.data && typeof options.data === "object" && config.headers["Content-type"] === "application/x-www-form-urlencoded") {
            options.data = Window.http.serialize(options.data);
        }
        xhr.send(options.data);
        return xhr;
    },
    _callback: function (callbackObject) {
        if (callbackObject && typeof callbackObject === 'function') {
            var args = [].slice.call(arguments).slice(1);
            setTimeout(function () {
                callbackObject.apply(document, args)
            }, 0);
        }
    },
    GET: function (config) {
        config = (typeof config === "string") ? {url: config} : config || {};
        config.method = "GET";
        if (config.data && typeof config.data === 'object') {
            config.url += document.a({href: config.url}).search ? '&' : '?';
            config.url += Window.http.serialize(config.data);
            delete config.data;
        }
        return Window.http.request(config);
    },
    POST: function (config) {
        config = (typeof config === "string") ? {url: config} : config || {};
        config.method = "POST";
        config.headers = config.headers || {};
        config.headers["Content-type"] = config.headers["Content-type"] || "application/x-www-form-urlencoded";
        return Window.http.request(config);
    },
    PUT: function (config) {
        config = (typeof config === "string") ? {url: config} : config || {};
        config.method = "PUT";
        config.headers = config.headers || {};
        config.headers["Content-type"] = config.headers["Content-type"] || "application/x-www-form-urlencoded";
        return Window.http.request(config);
    },
    DELETE: function (config) {
        config = (typeof config === "string") ? {url: config} : config || {};
        config.method = "DELETE";
        return Window.http.request(config);
    },
    serialize: function (obj, prefix) {
        var str = [];
        var appendValue = function(key, value) {
            if (Array.isArray(value)) {
                value.forEach(function(arrValue) { appendValue(key, arrValue) });
            } else {
                str.push(typeof value == "object" ? Window.http.serialize(value, key) : encodeURIComponent(key) + "=" + encodeURIComponent(value));
            }
        }
        Object.forEach(obj, function (key, value) {
            var k = prefix ? prefix + "[" + key + "]" : key;
            appendValue(k, value);
        });
        return str.join("&");
    },
    load: function (config) {
        config = (typeof config === "string") ? {url: config} : config || {};
        config.src = config.src || config.url;
        delete config.url;
        if (config.data && typeof config.data === 'object') {
            config.src += document.a({href: config.src}).search ? '&' : '?';
            config.src += Window.http.serialize(config.data);
            delete config.data;
        }
        if (config.id) {
            var toDelete = document.getElem("#" + config.id);
            if (toDelete !== null) {
                toDelete.del();
            }
        }
        return document.getElem("head").elem("script", config);
    }
};
<commit_msg>http serialize: ignore undefined values<commit_after>Object.forEach = function (object, callback) {
    for (var key in object) {
        if (object.hasOwnProperty(key))
            callback.call(object, key, object[key]);
    }
};
Object.every = function (object, callback) {
    for (var key in object) {
        if (object.hasOwnProperty(key))
            if (callback.call(object, key, object[key]) === false) return false;
    }
    return true;
};
Object.some = function (object, callback) {
    var status = false;
    for (var key in object) {
        if (object.hasOwnProperty(key))
            status = callback.call(object, key, object[key]) || status;
    }
    return status;
};
Object.clone = function (o) {
    if (o === null || typeof(o) !== 'object') return o;

    var objNew = o.constructor();

    for (var key in o)
        objNew[key] = Object.clone(o[key]);

    return objNew;
};
Object.merge = function (o1, o2) {
    var objNew = Object.clone(o1);
    for (var p in o2) {
        if (o2[p] && o2[p].constructor === Object) {
            if (!o1[p]) o1[p] = {};
            objNew[p] = Object.merge(o1[p], o2[p]);
        } else {
            objNew[p] = o2[p];
        }
    }
    return objNew;
};
document.elem = function (elemname, attributes, text) {
    if (typeof attributes === 'string') {
        text = attributes;
        attributes = null;
    }
    if (elemname === 'textElem') return document.createTextNode(text);
    return document.createElement(elemname).attrib(attributes).setText(text);
};
document.getElem = document.querySelector;
document.getElemAll = document.querySelectorAll;
document.delElem = function (element) {
    if (typeof element === 'string') {
        element = document.getElemAll(element);
    }
    if (element.forEach) {
        element.forEach(function (node) {
            if (node.parentNode) node.parentNode.removeChild(node);
        });
    } else if (element && element.parentNode) {
        element.parentNode.removeChild(element);
    }
};
document.ready = function (callback) {
    if (document.readyState == "complete" || document.readyState == "loaded" || document.readyState == "interactive") {
        setTimeout(callback, 1);
    } else if (document.addEventListener) {
        document.addEventListener("DOMContentLoaded", callback);
    } else {
        document.onreadystatechange = function () {
            if (document.readyState == "interactive") callback();
        }
    }
};
Element.prototype.getElem = Element.prototype.querySelector;
Element.prototype.getElemAll = Element.prototype.querySelectorAll;
Element.prototype.del = function () {
    var parent = this.parentNode;
    if (parent) parent.removeChild(this);
    return parent;
};
Element.prototype.elem = function (elemname, attr, text, returnparent) {
    if (typeof elemname !== 'string') {
        var _that = this;
        [].concat(elemname).forEach(function (element) {
            _that.appendChild(element);
        });
        return this;
    }
    var elem = document.elem(elemname, attr, text);
    this.appendChild(elem);
    return (returnparent !== null && returnparent) ? this : ['br', 'hr', 'textElem'].indexOf(elemname) === -1 ? elem : returnparent === false ? elem : this;
};
Element.prototype.siblings = function () {
    return this.parentElement.children;
};
Element.prototype.up = function () {
    return this.parentElement;
};
Element.prototype.attrib = function (attribute, value) {
    if (attribute) {
        var _this = this;
        var setOrRemove = function (key, value) {
            value !== null ? _this.setAttribute(key, value) : _this.removeAttribute(key);
        };
        if (typeof attribute === "object") {
            Object.forEach(attribute, setOrRemove);
        } else if (typeof attribute === 'string') {
            setOrRemove(attribute, value);
        }
    }
    return this;
};
Element.prototype.setText = function (text) {
    if (text) {
        this.textContent = text;
    }
    return this;
};
Element.prototype.clearElem = function () {
    if (this.textContent !== null) {
        this.textContent = '';
    }
    while (this.firstChild) {
        this.removeChild(this.firstChild);
    }
    return this;
};
Element.prototype.on = function (event, listener, useCapture) {
    if (this.attachEvent) {
        this.attachEvent(event, listener);
    } else {
        this.addEventListener(event, listener, useCapture);
    }
    return this;
};
Element.prototype.off = function (event, listener, useCapture) {
    if (this.detachEvent) {
        this.detachEvent(event, listener);
    } else {
        this.removeEventListener(event, listener, useCapture);
    }
    return this;
};
Element.prototype.addClass = function (className) {
    if (this.classList) {
        this.classList.add(className);
    } else {
        var classes = this.className.split(' ');
        if (classes.indexOf(className) === -1) {
            classes.push(className);
            this.className = classes.join(' ');
        }
    }
    return this;
};
Element.prototype.removeClass = function (className) {
    if (this.classList) {
        this.classList.remove(className);
    } else {
        var classes = this.className.split(' ');
        var index = classes.indexOf(className);
        if (index !== -1) {
            classes.splice(index, 1);
            this.className = classes.join(' ');
        }
    }
    return this;
};
Element.prototype.toggleClass = function (className) {
    if (this.classList) {
        this.classList.toggle(className);
    } else if (this.className.split(' ').indexOf(className) !== -1) {
        this.removeClass(className);
    } else {
        this.addClass(className);
    }
    return this;
};
Element.prototype.hasClass = function (className) {
    if (this.classList) {
        return this.classList.contains(className);
    } else {
        return this.className.split(' ').indexOf(className) !== -1;
    }
};
NodeList.prototype.forEach = function (callback) {
    for (var i = 0; i < this.length; i++) {
        callback(this[i], i);
    }
};
NodeList.prototype.every = function (callback) {
    for (var i = 0; i < this.length; i++) {
        if (callback(this[i], i) === false) return false;
    }
    return true;
};
NodeList.prototype.some = function (callback) {
    var status = false;
    for (var i = 0; i < this.length; i++) {
        status = callback(this[i], i) || status;
    }
    return status;
};
NodeList.prototype.attrib = function (attribute, value) {
    this.forEach(function (node) {
        node.attrib(attribute, value)
    });
    return this;
};
NodeList.prototype.elem = function (elemname, attr, text, returnparent) {
    var rand = Math.random() * 10000, name = "data-elemjs-NL-elem";
    this.forEach(function (node) {
        node.elem(elemname, attr, text, returnparent).attrib(name, rand);
    });
    return document.getElemAll("[" + name + "='" + rand + "']").attrib(name, null);
};
NodeList.prototype.del = function () {
    var rand = Math.random() * 10000, name = "data-elemjs-NL-del";
    this.forEach(function (node) {
        node.del().attrib(name, rand);
    });
    return document.getElemAll("[" + name + "='" + rand + "']").attrib(name, null);
};
NodeList.prototype.getElem = function (selector) {
    var rand = Math.random() * 10000, name = "data-elemjs-NL-getElem";
    this.forEach(function (node) {
        var temp = node.getElem(selector);
        if (temp !== null)temp.attrib(name, rand);
    });
    return document.getElemAll("[" + name + "='" + rand + "']").attrib(name, null);
};
NodeList.prototype.getElemAll = function (selector) {
    var rand = Math.random() * 10000, name = "data-elemjs-NL-getElemAll";
    this.forEach(function (node) {
        node.getElemAll(selector).attrib(name, rand);
    });
    return document.getElemAll("[" + name + "='" + rand + "']").attrib(name, null);
};
NodeList.prototype.on = function (event, listener, useCapture) {
    this.forEach(function (node) {
        node.on(event, listener, useCapture);
    });
    return this;
};
NodeList.prototype.off = function (event, listener, useCapture) {
    this.forEach(function (node) {
        node.off(event, listener, useCapture);
    });
    return this;
};
NodeList.prototype.addClass = function (className) {
    this.forEach(function (node) {
        node.addClass(className);
    });
    return this;
};
NodeList.prototype.removeClass = function (className) {
    this.forEach(function (node) {
        node.removeClass(className);
    });
    return this;
};
NodeList.prototype.toggleClass = function (className) {
    this.forEach(function (node) {
        node.toggleClass(className);
    });
    return this;
};
NodeList.prototype.hasClass = function (className) {
    var rand = Math.random() * 10000, name = "data-elemjs-NL-hasClass";
    this.forEach(function (node) {
        if (node.hasClass(className)) {
            node.attrib(name, rand);
        }
    });
    return document.getElemAll("[" + name + "='" + rand + "']").attrib(name, null);
};
NodeList.prototype.toArray = function () {
    var arr = [];
    for (var i = this.length; i--; arr.unshift(this[i]));
    return arr;
};
['section', 'nav', 'article', 'aside', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'footer', 'address', 'main', 'p', 'hr', 'pre', 'ol', 'ul', 'li', 'div', 'a', 'em', 'strong', 'code', 'span', 'br', 'img', 'svg', 'table', 'tbody', 'thead', 'tfoot', 'tr', 'td', 'th', 'form', 'label', 'input', 'button', 'select', 'option', 'textarea', 'textElem'].map(function (elemname) {
    Element.prototype[elemname] = function (attr, text, returnparent) {
        return this.elem(elemname, attr, text, returnparent);
    };
    document[elemname] = function (attr, text) {
        return this.elem(elemname, attr, text);
    };
    NodeList.prototype[elemname] = function (attr, text, returnparent) {
        return this.elem(elemname, attr, text, returnparent);
    }
});
Window.http = {
    defaults: { method: 'GET', async: true, headers: {} },
    request: function (config) {
        var options = Object.merge(Window.http.defaults, config);
        Window.http._callback(options.before);
        var xhr = new XMLHttpRequest();
        xhr.onload = function () {
            if (this.status >= 200 && this.status < 300) {
                Window.http._callback(options.success, this.responseText, this.status, this.statusText, this);
            } else {
                Window.http._callback(options.error, this.responseText, this.status, this.statusText, this);
            }
        };
        xhr.onerror = function () {
            Window.http._callback(options.error, this.responseText, this.status, this.statusText, this);
        };
        xhr.onloadend = function () {
            Window.http._callback(options.loadEnd);
        };
        xhr.onprogress = function (event) {
            if (event.lengthComputable) {
                Window.http._callback(options.progress, event.loaded, event.total);
            } else {
                Window.http._callback(options.progress, event.loaded, null);
            }
        };
        xhr.open(options.method, options.url, options.async);
        if (options.headers !== null && typeof options.headers === 'object')
            Object.forEach(options.headers, function (key, value) {
                xhr.setRequestHeader(key, value);
            });
        if (options.data && typeof options.data === "object" && config.headers["Content-type"] === "application/x-www-form-urlencoded") {
            options.data = Window.http.serialize(options.data);
        }
        xhr.send(options.data);
        return xhr;
    },
    _callback: function (callbackObject) {
        if (callbackObject && typeof callbackObject === 'function') {
            var args = [].slice.call(arguments).slice(1);
            setTimeout(function () {
                callbackObject.apply(document, args)
            }, 0);
        }
    },
    GET: function (config) {
        config = (typeof config === "string") ? {url: config} : config || {};
        config.method = "GET";
        if (config.data && typeof config.data === 'object') {
            config.url += document.a({href: config.url}).search ? '&' : '?';
            config.url += Window.http.serialize(config.data);
            delete config.data;
        }
        return Window.http.request(config);
    },
    POST: function (config) {
        config = (typeof config === "string") ? {url: config} : config || {};
        config.method = "POST";
        config.headers = config.headers || {};
        config.headers["Content-type"] = config.headers["Content-type"] || "application/x-www-form-urlencoded";
        return Window.http.request(config);
    },
    PUT: function (config) {
        config = (typeof config === "string") ? {url: config} : config || {};
        config.method = "PUT";
        config.headers = config.headers || {};
        config.headers["Content-type"] = config.headers["Content-type"] || "application/x-www-form-urlencoded";
        return Window.http.request(config);
    },
    DELETE: function (config) {
        config = (typeof config === "string") ? {url: config} : config || {};
        config.method = "DELETE";
        return Window.http.request(config);
    },
    serialize: function (obj, prefix) {
        var str = [];
        var appendValue = function(key, value) {
            if (Array.isArray(value)) {
                value.forEach(function(arrValue) { appendValue(key, arrValue) });
            } else {
                str.push(typeof value == "object" ? Window.http.serialize(value, key) : encodeURIComponent(key) + "=" + encodeURIComponent(value));
            }
        }
        Object.forEach(obj, function (key, value) {
            var k = prefix ? prefix + "[" + key + "]" : key;
            if (typeof value !== 'undefined') appendValue(k, value);
        });
        return str.join("&");
    },
    load: function (config) {
        config = (typeof config === "string") ? {url: config} : config || {};
        config.src = config.src || config.url;
        delete config.url;
        if (config.data && typeof config.data === 'object') {
            config.src += document.a({href: config.src}).search ? '&' : '?';
            config.src += Window.http.serialize(config.data);
            delete config.data;
        }
        if (config.id) {
            var toDelete = document.getElem("#" + config.id);
            if (toDelete !== null) {
                toDelete.del();
            }
        }
        return document.getElem("head").elem("script", config);
    }
};
<|endoftext|>


<commit_before>#!/usr/bin/env node

/**
 * Git COMMIT-MSG hook for validating commit message
 * See https://docs.google.com/document/d/1rk04jEuGfk9kYzfqCuOlPTSJw3hEDZJTBN5E5f1SALo/edit
 *
 * Installation:
 * >> cd <angular-repo>
 * >> ln -s validate-commit-msg.js .git/hooks/commit-msg
 */
var fs = require('fs');
var util = require('util');

var MAX_LENGTH = 70;
var PATTERN = /^(?:fixup!\s*)?(\w*)(\((\w+|\*)\))?\: (.*)$/;
var IGNORED = /^WIP\:/;
var TYPES = {
    chore: true,
    demo: true,
    docs: true,
    feat: true,
    fix: true,
    refactor: true,
    revert: true,
    style: true,
    test: true
};

var error = function () {
    // gitx does not display it
    // http://gitx.lighthouseapp.com/projects/17830/tickets/294-feature-display-hook-error-message-when-hook-fails
    // https://groups.google.com/group/gitx/browse_thread/thread/a03bcab60844b812
    console.error('INVALID COMMIT MSG: ' + util.format.apply(null, arguments));
};

var validateMessage = function (message) {
    var isValid = true;

    if (IGNORED.test(message)) {
        console.log('Commit message validation ignored.');
        return true;
    }

    if (message.length > MAX_LENGTH) {
        error('is longer than %d characters !', MAX_LENGTH);
        isValid = false;
    }

    var match = PATTERN.exec(message);

    if (!match) {
        error('does not match "<type>(<scope>): <subject>" ! was: "' + message + '"\nNote: <scope> must be only letters.');
        return false;
    }

    var type = match[1];
    var scope = match[3];
    var subject = match[4];

    if (!TYPES.hasOwnProperty(type)) {
        error('"%s" is not allowed type !', type);
        return false;
    }

    // Some more ideas, do want anything like this ?
    // - allow only specific scopes (eg. fix(docs) should not be allowed ?
    // - auto correct the type to lower case ?
    // - auto correct first letter of the subject to lower case ?
    // - auto add empty line after subject ?
    // - auto remove empty () ?
    // - auto correct typos in type ?
    // - store incorrect messages, so that we can learn

    return isValid;
};

var firstLineFromBuffer = function (buffer) {
    return buffer.toString().split('\n').shift();
};

// publish for testing
exports.validateMessage = validateMessage;

// hacky start if not run by jasmine :-D
if (process.argv.join('').indexOf('jasmine-node') === -1) {
    var commitMsgFile = process.argv[2];
    var incorrectLogFile = commitMsgFile.replace('COMMIT_EDITMSG', 'logs/incorrect-commit-msgs');

    fs.readFile(commitMsgFile, function (err, buffer) {
        var msg = firstLineFromBuffer(buffer);

        if (!validateMessage(msg)) {
            fs.appendFile(incorrectLogFile, msg + '\n', function () {
                process.exit(1);
            });
        } else {
            process.exit(0);
        }
    });
}
<commit_msg>chore(git): commit message title max length 80<commit_after>#!/usr/bin/env node

/**
 * Git COMMIT-MSG hook for validating commit message
 * See https://docs.google.com/document/d/1rk04jEuGfk9kYzfqCuOlPTSJw3hEDZJTBN5E5f1SALo/edit
 *
 * Installation:
 * >> cd <angular-repo>
 * >> ln -s validate-commit-msg.js .git/hooks/commit-msg
 */
var fs = require('fs');
var util = require('util');

var MAX_LENGTH = 80;
var PATTERN = /^(?:fixup!\s*)?(\w*)(\((\w+|\*)\))?\: (.*)$/;
var IGNORED = /^WIP\:/;
var TYPES = {
    chore: true,
    demo: true,
    docs: true,
    feat: true,
    fix: true,
    refactor: true,
    revert: true,
    style: true,
    test: true
};

var error = function () {
    // gitx does not display it
    // http://gitx.lighthouseapp.com/projects/17830/tickets/294-feature-display-hook-error-message-when-hook-fails
    // https://groups.google.com/group/gitx/browse_thread/thread/a03bcab60844b812
    console.error('INVALID COMMIT MSG: ' + util.format.apply(null, arguments));
};

var validateMessage = function (message) {
    var isValid = true;

    if (IGNORED.test(message)) {
        console.log('Commit message validation ignored.');
        return true;
    }

    if (message.length > MAX_LENGTH) {
        error('is longer than %d characters !', MAX_LENGTH);
        isValid = false;
    }

    var match = PATTERN.exec(message);

    if (!match) {
        error('does not match "<type>(<scope>): <subject>" ! was: "' + message + '"\nNote: <scope> must be only letters.');
        return false;
    }

    var type = match[1];
    var scope = match[3];
    var subject = match[4];

    if (!TYPES.hasOwnProperty(type)) {
        error('"%s" is not allowed type !', type);
        return false;
    }

    // Some more ideas, do want anything like this ?
    // - allow only specific scopes (eg. fix(docs) should not be allowed ?
    // - auto correct the type to lower case ?
    // - auto correct first letter of the subject to lower case ?
    // - auto add empty line after subject ?
    // - auto remove empty () ?
    // - auto correct typos in type ?
    // - store incorrect messages, so that we can learn

    return isValid;
};

var firstLineFromBuffer = function (buffer) {
    return buffer.toString().split('\n').shift();
};

// publish for testing
exports.validateMessage = validateMessage;

// hacky start if not run by jasmine :-D
if (process.argv.join('').indexOf('jasmine-node') === -1) {
    var commitMsgFile = process.argv[2];
    var incorrectLogFile = commitMsgFile.replace('COMMIT_EDITMSG', 'logs/incorrect-commit-msgs');

    fs.readFile(commitMsgFile, function (err, buffer) {
        var msg = firstLineFromBuffer(buffer);

        if (!validateMessage(msg)) {
            fs.appendFile(incorrectLogFile, msg + '\n', function () {
                process.exit(1);
            });
        } else {
            process.exit(0);
        }
    });
}
<|endoftext|>


<commit_before>import webpack from 'DEV_ARCHETYPE/webpack';
import HtmlWebpackPlugin from 'DEV_ARCHETYPE/html-webpack-plugin';
import ExtractTextPlugin from 'DEV_ARCHETYPE/extract-text-webpack-plugin';
import { defaultsDeep } from 'DEV_ARCHETYPE/lodash';
import path from 'path';
import os from 'os';

const USER = os.hostname();

// Environment settings
let {
    DEV = 'true',                               // Toggles the hot reloading
    DEV_SERVER_HOST = 'localhost',              // Dev server hostname
    DEV_SERVER_PORT = 3000,                     // Dev server port
    ENTRY_FILE_PATH = './src',                  // Entry file to build the application
    npm_package_name = 'your-project',          // Project name, automatically set by npm
    OUTPUT_DIR = './dist',                      // Output directory
    PAGE_TITLE = 'You project landing page',    // Generated HTML page title
    ANCHOR_CLASS = 'your-project',              // Generated HTML div's class
    PUBLIC_PATH = '/',                          // Output public path
    GENERATE_HTML = 'true',                     // Toggle index.html auto generation
    BABELIFIED_PATH = './src',                  // Directory that will be babelified
    MINIMIFY = 'false',                         // Toggles sources minification
    LIBRARY_NAME = 'YourProject',               // Name of the bundled project, when set on the window (for brunch projects)
    SOURCE_MAPS = 'true',                       // Toggles source maps generation
    DEBUG = 'true',                             // Toggles webpack debug
    PACKAGE_JSON_PATH = './',                   // package.json path inside of focus packages, as seen from their root file
    OUTPUT_PUBLIC_PATH,                         // Output directory, as seen from the index.html
    BROWSERS,                                   // Browsers that should be taken into account by the autoprefixer-loader
    DROP_CONSOLE = 'false'                      // If console statement should be dropped when MINIMIFY
} = process.env;
// Parse json settings
DEV = JSON.parse(DEV);
GENERATE_HTML = JSON.parse(GENERATE_HTML);
MINIMIFY = JSON.parse(MINIMIFY);
DROP_CONSOLE = JSON.parse(DROP_CONSOLE);
SOURCE_MAPS = JSON.parse(SOURCE_MAPS);
DEBUG = JSON.parse(DEBUG);
OUTPUT_PUBLIC_PATH = OUTPUT_PUBLIC_PATH !== undefined ? OUTPUT_PUBLIC_PATH : `http://${DEV_SERVER_HOST}:${DEV_SERVER_PORT}/`;
BABELIFIED_PATH = [].concat(BABELIFIED_PATH);
const babelifiedIncludes = BABELIFIED_PATH.map((relativePath) => {
    return path.resolve(process.cwd(), relativePath);
});
/*************************************
********* Webpack config *************
**************************************/
const defaultConfig = definedVariables => ({
    entry: [
        path.resolve(process.cwd(), ENTRY_FILE_PATH)
    ].concat(DEV ? [                                                                    // In dev mode, add hot reloading
        `webpack-dev-server/client?http://${DEV_SERVER_HOST}:${DEV_SERVER_PORT}`,
        'webpack/hot/only-dev-server'
    ] : []),
    output: {
        path: path.resolve(process.cwd(), OUTPUT_DIR),
        publicPath: OUTPUT_PUBLIC_PATH,
        filename: `${npm_package_name}.js`,                                             // Generated file will hold the package name
        libraryTarget: 'umd',
        library: LIBRARY_NAME
    },
    devtool: SOURCE_MAPS ? 'source-map' : false,
    debug: DEBUG,
    stats: {                                                                            // Sets webpack to quieter setting, to leave a clean console on build
        colors: true,
        version: false,
        timings: false,
        assets: false,
        chunks: false,
        modules: false,
        reasons: false,
        children: false,
        source: false,
        errors: true,
        errorDetails: true,
        warnings: true
    },
    plugins: [
        new webpack.DefinePlugin({                                                      // Define several global variables to be used in the project
            __DEV__: DEV ? 'true' : 'false',
            __ANCHOR_CLASS__: JSON.stringify(ANCHOR_CLASS),
            __PACKAGE_JSON_PATH__: JSON.stringify(PACKAGE_JSON_PATH),
            __USER__: JSON.stringify(USER),
            __PROJECT__: JSON.stringify(npm_package_name),
            ...definedVariables                                                         // Add user defined variables
        }),
        new webpack.optimize.DedupePlugin(),
        new ExtractTextPlugin(`${npm_package_name}.css`)                                // Generated a CSS file
    ].concat(DEV ? [
        new webpack.HotModuleReplacementPlugin()
    ] : []).concat(GENERATE_HTML ? [
        new HtmlWebpackPlugin({
            inject: 'body',
            templateContent: `

        <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
        <meta charset="UTF-8">
        <title>${PAGE_TITLE}</title>

`
        })
    ] : []).concat(MINIMIFY ? [
        new webpack.optimize.UglifyJsPlugin({
            compressor: {
                screw_ie8: true,
                warnings: false,
                drop_console: DROP_CONSOLE,
                drop_debugger: true,
                passes: 2
            }
        })
    ] : []),
    resolve: {
        extensions: ['', '.webpack.js', '.web.js', '.js', '.jsx']
    },
    module: {
        preLoaders: [
            {
                test: /\.js$/,
                loader: require.resolve('source-map-loader')
            }
        ],
        loaders: [
            {
                test: /\.(js|jsx)$/,
                loader: require.resolve('webpack-alternate-require-loader'),
                include: babelifiedIncludes,
                query: JSON.stringify({
                    'webpack-focus/require': require.resolve('webpack-focus/require')
                })
            },
            {
                test: /\.(js|jsx)$/,
                loader: require.resolve('babel-loader'),
                include: babelifiedIncludes,
                query: {
                    presets: [require.resolve('babel-preset-focus')],
                    plugins: [
                        [
                            'replace-require',
                            {
                                DEV_ARCHETYPE: "require('webpack-focus/require')"
                            }
                        ]
                    ]
                }
            },

            {
                test: /\.json$/,
                loaders: [require.resolve('json-loader')]
            },
            {
                test: /\.scss$/,
                loader: ExtractTextPlugin.extract(require.resolve('style-loader'), require.resolve('css-loader') + '!' + require.resolve('postcss-loader') + `${BROWSERS ? '?{browsers:' + JSON.stringify(BROWSERS.split(',')) + '}' : ''}` + '!' + require.resolve('sass-loader'))
            },
            {
                test: /\.css$/,
                loader: ExtractTextPlugin.extract(require.resolve('style-loader'), require.resolve('css-loader'), require.resolve('postcss-loader') + `${BROWSERS ? '?{browsers:' + JSON.stringify(BROWSERS.split(',')) + '}' : ''}`)
            },
            {
                test: /\.png(\?.*)?$/,
                loader: require.resolve('url-loader'),
                query: { mimetype: 'image/png' }
            },
            {
                test: /\.jpg(\?.*)?$/,
                loader: require.resolve('url-loader'),
                query: { mimetype: 'image/jpg' }
            },
            {
                test: /\.gif(\?.*)?$/,
                loader: require.resolve('url-loader'),
                query: { mimetype: 'image/gif' }
            },
            {
                test: /\.ttf(\?.*)?$/,
                loader: require.resolve('url-loader'),
                query: { limit: 50000, mimetype: 'application/octet-stream' }
            },
            {
                test: /\.eot(\?.*)?$/,
                loader: require.resolve('file-loader')
            },
            {
                test: /\.woff2(\?.*)?$/,
                loader: require.resolve('url-loader'),
                query: { limit: 50000, mimetype: 'application/font-woff' }
            },
            {
                test: /\.woff(\?.*)?$/,
                loader: require.resolve('base64-font-loader')
            },
            {
                test: /\.svg(\?.*)?$/,
                loader: require.resolve('url-loader'),
                query: { limit: 50000, mimetype: 'image/svg+xml' }
            }
        ]
    }
});

export const configBuilder = (customConf = {}, definedVariables = {}) => defaultsDeep(customConf, defaultConfig(definedVariables));
<commit_msg>Taking in account multiple src folder<commit_after>import webpack from 'DEV_ARCHETYPE/webpack';
import HtmlWebpackPlugin from 'DEV_ARCHETYPE/html-webpack-plugin';
import ExtractTextPlugin from 'DEV_ARCHETYPE/extract-text-webpack-plugin';
import { defaultsDeep } from 'DEV_ARCHETYPE/lodash';
import path from 'path';
import os from 'os';

const USER = os.hostname();

// Environment settings
let {
    DEV = 'true',                               // Toggles the hot reloading
    DEV_SERVER_HOST = 'localhost',              // Dev server hostname
    DEV_SERVER_PORT = 3000,                     // Dev server port
    ENTRY_FILE_PATH = './src',                  // Entry file to build the application
    npm_package_name = 'your-project',          // Project name, automatically set by npm
    OUTPUT_DIR = './dist',                      // Output directory
    PAGE_TITLE = 'You project landing page',    // Generated HTML page title
    ANCHOR_CLASS = 'your-project',              // Generated HTML div's class
    PUBLIC_PATH = '/',                          // Output public path
    GENERATE_HTML = 'true',                     // Toggle index.html auto generation
    BABELIFIED_PATH = './src',                  // Directory that will be babelified
    MINIMIFY = 'false',                         // Toggles sources minification
    LIBRARY_NAME = 'YourProject',               // Name of the bundled project, when set on the window (for brunch projects)
    SOURCE_MAPS = 'true',                       // Toggles source maps generation
    DEBUG = 'true',                             // Toggles webpack debug
    PACKAGE_JSON_PATH = './',                   // package.json path inside of focus packages, as seen from their root file
    OUTPUT_PUBLIC_PATH,                         // Output directory, as seen from the index.html
    BROWSERS,                                   // Browsers that should be taken into account by the autoprefixer-loader
    DROP_CONSOLE = 'false'                      // If console statement should be dropped when MINIMIFY
} = process.env;
// Parse json settings
DEV = JSON.parse(DEV);
GENERATE_HTML = JSON.parse(GENERATE_HTML);
MINIMIFY = JSON.parse(MINIMIFY);
DROP_CONSOLE = JSON.parse(DROP_CONSOLE);
SOURCE_MAPS = JSON.parse(SOURCE_MAPS);
DEBUG = JSON.parse(DEBUG);
OUTPUT_PUBLIC_PATH = OUTPUT_PUBLIC_PATH !== undefined ? OUTPUT_PUBLIC_PATH : `http://${DEV_SERVER_HOST}:${DEV_SERVER_PORT}/`;
BABELIFIED_PATH = BABELIFIED_PATH.split(',');
const babelifiedIncludes = BABELIFIED_PATH.map((relativePath) => {
    return path.resolve(process.cwd(), relativePath.trim());
});
/*************************************
********* Webpack config *************
**************************************/
const defaultConfig = definedVariables => ({
    entry: [
        path.resolve(process.cwd(), ENTRY_FILE_PATH)
    ].concat(DEV ? [                                                                    // In dev mode, add hot reloading
        `webpack-dev-server/client?http://${DEV_SERVER_HOST}:${DEV_SERVER_PORT}`,
        'webpack/hot/only-dev-server'
    ] : []),
    output: {
        path: path.resolve(process.cwd(), OUTPUT_DIR),
        publicPath: OUTPUT_PUBLIC_PATH,
        filename: `${npm_package_name}.js`,                                             // Generated file will hold the package name
        libraryTarget: 'umd',
        library: LIBRARY_NAME
    },
    devtool: SOURCE_MAPS ? 'source-map' : false,
    debug: DEBUG,
    stats: {                                                                            // Sets webpack to quieter setting, to leave a clean console on build
        colors: true,
        version: false,
        timings: false,
        assets: false,
        chunks: false,
        modules: false,
        reasons: false,
        children: false,
        source: false,
        errors: true,
        errorDetails: true,
        warnings: true
    },
    plugins: [
        new webpack.DefinePlugin({                                                      // Define several global variables to be used in the project
            __DEV__: DEV ? 'true' : 'false',
            __ANCHOR_CLASS__: JSON.stringify(ANCHOR_CLASS),
            __PACKAGE_JSON_PATH__: JSON.stringify(PACKAGE_JSON_PATH),
            __USER__: JSON.stringify(USER),
            __PROJECT__: JSON.stringify(npm_package_name),
            ...definedVariables                                                         // Add user defined variables
        }),
        new webpack.optimize.DedupePlugin(),
        new ExtractTextPlugin(`${npm_package_name}.css`)                                // Generated a CSS file
    ].concat(DEV ? [
        new webpack.HotModuleReplacementPlugin()
    ] : []).concat(GENERATE_HTML ? [
        new HtmlWebpackPlugin({
            inject: 'body',
            templateContent: `

        <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
        <meta charset="UTF-8">
        <title>${PAGE_TITLE}</title>

`
        })
    ] : []).concat(MINIMIFY ? [
        new webpack.optimize.UglifyJsPlugin({
            compressor: {
                screw_ie8: true,
                warnings: false,
                drop_console: DROP_CONSOLE,
                drop_debugger: true,
                passes: 2
            }
        })
    ] : []),
    resolve: {
        extensions: ['', '.webpack.js', '.web.js', '.js', '.jsx']
    },
    module: {
        preLoaders: [
            {
                test: /\.js$/,
                loader: require.resolve('source-map-loader')
            }
        ],
        loaders: [
            {
                test: /\.(js|jsx)$/,
                loader: require.resolve('webpack-alternate-require-loader'),
                include: babelifiedIncludes,
                query: JSON.stringify({
                    'webpack-focus/require': require.resolve('webpack-focus/require')
                })
            },
            {
                test: /\.(js|jsx)$/,
                loader: require.resolve('babel-loader'),
                include: babelifiedIncludes,
                query: {
                    presets: [require.resolve('babel-preset-focus')],
                    plugins: [
                        [
                            'replace-require',
                            {
                                DEV_ARCHETYPE: "require('webpack-focus/require')"
                            }
                        ]
                    ]
                }
            },

            {
                test: /\.json$/,
                loaders: [require.resolve('json-loader')]
            },
            {
                test: /\.scss$/,
                loader: ExtractTextPlugin.extract(require.resolve('style-loader'), require.resolve('css-loader') + '!' + require.resolve('postcss-loader') + `${BROWSERS ? '?{browsers:' + JSON.stringify(BROWSERS.split(',')) + '}' : ''}` + '!' + require.resolve('sass-loader'))
            },
            {
                test: /\.css$/,
                loader: ExtractTextPlugin.extract(require.resolve('style-loader'), require.resolve('css-loader'), require.resolve('postcss-loader') + `${BROWSERS ? '?{browsers:' + JSON.stringify(BROWSERS.split(',')) + '}' : ''}`)
            },
            {
                test: /\.png(\?.*)?$/,
                loader: require.resolve('url-loader'),
                query: { mimetype: 'image/png' }
            },
            {
                test: /\.jpg(\?.*)?$/,
                loader: require.resolve('url-loader'),
                query: { mimetype: 'image/jpg' }
            },
            {
                test: /\.gif(\?.*)?$/,
                loader: require.resolve('url-loader'),
                query: { mimetype: 'image/gif' }
            },
            {
                test: /\.ttf(\?.*)?$/,
                loader: require.resolve('url-loader'),
                query: { limit: 50000, mimetype: 'application/octet-stream' }
            },
            {
                test: /\.eot(\?.*)?$/,
                loader: require.resolve('file-loader')
            },
            {
                test: /\.woff2(\?.*)?$/,
                loader: require.resolve('url-loader'),
                query: { limit: 50000, mimetype: 'application/font-woff' }
            },
            {
                test: /\.woff(\?.*)?$/,
                loader: require.resolve('base64-font-loader')
            },
            {
                test: /\.svg(\?.*)?$/,
                loader: require.resolve('url-loader'),
                query: { limit: 50000, mimetype: 'image/svg+xml' }
            }
        ]
    }
});

export const configBuilder = (customConf = {}, definedVariables = {}) => defaultsDeep(customConf, defaultConfig(definedVariables));
<|endoftext|>


<commit_before>const webpack = require('webpack');

const devConfig = require('./webpack.config.dev');
const version = require('./package.json').version;

module.exports = Object.assign({}, devConfig, {
    watch: false,
    plugins: [
        new webpack.DefinePlugin({
            __SCROLLBAR_VERSION__: JSON.stringify(version),
        }),
        new webpack.optimize.UglifyJsPlugin({
            compress: {
                warnings: false,
            },
        }),
    ],
});
<commit_msg>fix(deploy): remove `webpack-dev-server` from webpack entries<commit_after>const webpack = require('webpack');

const devConfig = require('./webpack.config.dev');
const version = require('./package.json').version;

module.exports = Object.assign({}, devConfig, {
    watch: false,
    entry: [
        './test/scripts/index.js',
    ],
    plugins: [
        new webpack.DefinePlugin({
            __SCROLLBAR_VERSION__: JSON.stringify(version),
        }),
        new webpack.optimize.UglifyJsPlugin({
            compress: {
                warnings: false,
            },
        }),
    ],
});
<|endoftext|>


<commit_before>const webpack = require('webpack');
const { BaseHrefWebpackPlugin } = require('base-href-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MergeJsonWebpackPlugin = require("merge-jsons-webpack-plugin");
const utils = require('./utils.js');

module.exports = (options) => ({
    resolve: {
        extensions: ['.ts', '.js'],
        modules: ['node_modules'],
        mainFields: [ 'es2015', 'browser', 'module', 'main'],
        alias: utils.mapTypescriptAliasToWebpackAlias()
    },
    stats: {
    children: false
},
module: {
    rules: [
        {
            test: /\.html$/,
            loader: 'html-loader',
            options: {
                minimize: true,
                caseSensitive: true,
                removeAttributeQuotes: false,
                minifyJS: false,
                minifyCSS: false
            },
            exclude: '/src/main/webapp/index.html'
        },
        {
            test: /\.(jpe?g|png|gif|svg)$/i,
            loader: 'file-loader',
            options: {
                digest: 'hex',
                hash: 'sha512',
                name: 'content/[hash].[ext]'
            }
        },
        {
            test: /\.(woff|eot|ttf)$/,
            use: ['url-loader?limit=100000']
        },
        {
            test: /manifest.webapp$/,
            loader: 'file-loader',
            options: {
                name: 'manifest.webapp'
            }
        },
        // Ignore warnings about System.import in Angular
        { test: /[\/\\]@angular[\/\\].+\.js$/, parser: { system: true } },
    ]
},
plugins: [
    new webpack.DefinePlugin({
        'process.env': {
            NODE_ENV: `'${options.env}'`,
            BUILD_TIMESTAMP: `'${new Date().getTime()}'`,
            // APP_VERSION is passed as an environment variable from the Gradle / Maven build tasks.
            VERSION: `'${process.env.hasOwnProperty('APP_VERSION') && process.env.APP_VERSION !== "unspecified" ? process.env.APP_VERSION : utils.parseVersion()}'`,
            DEBUG_INFO_ENABLED: options.env === 'development',
            // The root URL for API calls, ending with a '/' - for example: `"https://www.jhipster.tech:8081/myservice/"`.
            // If this URL is left empty (""), then it will be relative to the current context.
            // If you use an API server, in `prod` mode, you will need to enable CORS
            // (see the `jhipster.cors` common JHipster property in the `application-*.yml` configurations)
            SERVER_API_URL: `''`
        }
    }),
    new CopyWebpackPlugin([
        { from: './src/main/webapp/content/', to: 'content' },
        { from: './src/main/webapp/favicon.ico', to: 'favicon.ico' },
        { from: './src/main/webapp/manifest.webapp', to: 'manifest.webapp' },
        // jhipster-needle-add-assets-to-webpack - JHipster will add/remove third-party resources in this array
        { from: './src/main/webapp/robots.txt', to: 'robots.txt' }
    ]),
    new MergeJsonWebpackPlugin({
        output: {
            groupBy: [
                { pattern: "./src/main/webapp/i18n/en/*.json", fileName: "./i18n/en.json" },
                { pattern: "./src/main/webapp/i18n/de/*.json", fileName: "./i18n/de.json" }
                // jhipster-needle-i18n-language-webpack - JHipster will add/remove languages in this array
            ]
        }
    }),
    new HtmlWebpackPlugin({
        template: './src/main/webapp/index.html',
        chunks: ['polyfills', 'main', 'global'],
        chunksSortMode: 'manual',
        inject: 'body'
    }),
    new BaseHrefWebpackPlugin({ baseHref: '/' })
]
});
<commit_msg>add woff2 to file loader again<commit_after>const webpack = require('webpack');
const { BaseHrefWebpackPlugin } = require('base-href-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MergeJsonWebpackPlugin = require("merge-jsons-webpack-plugin");
const utils = require('./utils.js');

module.exports = (options) => ({
    resolve: {
        extensions: ['.ts', '.js'],
        modules: ['node_modules'],
        mainFields: [ 'es2015', 'browser', 'module', 'main'],
        alias: utils.mapTypescriptAliasToWebpackAlias()
    },
    stats: {
    children: false
},
module: {
    rules: [
        {
            test: /\.html$/,
            loader: 'html-loader',
            options: {
                minimize: true,
                caseSensitive: true,
                removeAttributeQuotes: false,
                minifyJS: false,
                minifyCSS: false
            },
            exclude: '/src/main/webapp/index.html'
        },
        {
            test: /\.(jpe?g|png|gif|svg|woff2?)$/i,
            loader: 'file-loader',
            options: {
                digest: 'hex',
                hash: 'sha512',
                name: 'content/[hash].[ext]'
            }
        },
        {
            test: /\.(woff|eot|ttf)$/,
            use: ['url-loader?limit=100000']
        },
        {
            test: /manifest.webapp$/,
            loader: 'file-loader',
            options: {
                name: 'manifest.webapp'
            }
        },
        // Ignore warnings about System.import in Angular
        { test: /[\/\\]@angular[\/\\].+\.js$/, parser: { system: true } },
    ]
},
plugins: [
    new webpack.DefinePlugin({
        'process.env': {
            NODE_ENV: `'${options.env}'`,
            BUILD_TIMESTAMP: `'${new Date().getTime()}'`,
            // APP_VERSION is passed as an environment variable from the Gradle / Maven build tasks.
            VERSION: `'${process.env.hasOwnProperty('APP_VERSION') && process.env.APP_VERSION !== "unspecified" ? process.env.APP_VERSION : utils.parseVersion()}'`,
            DEBUG_INFO_ENABLED: options.env === 'development',
            // The root URL for API calls, ending with a '/' - for example: `"https://www.jhipster.tech:8081/myservice/"`.
            // If this URL is left empty (""), then it will be relative to the current context.
            // If you use an API server, in `prod` mode, you will need to enable CORS
            // (see the `jhipster.cors` common JHipster property in the `application-*.yml` configurations)
            SERVER_API_URL: `''`
        }
    }),
    new CopyWebpackPlugin([
        { from: './src/main/webapp/content/', to: 'content' },
        { from: './src/main/webapp/favicon.ico', to: 'favicon.ico' },
        { from: './src/main/webapp/manifest.webapp', to: 'manifest.webapp' },
        // jhipster-needle-add-assets-to-webpack - JHipster will add/remove third-party resources in this array
        { from: './src/main/webapp/robots.txt', to: 'robots.txt' }
    ]),
    new MergeJsonWebpackPlugin({
        output: {
            groupBy: [
                { pattern: "./src/main/webapp/i18n/en/*.json", fileName: "./i18n/en.json" },
                { pattern: "./src/main/webapp/i18n/de/*.json", fileName: "./i18n/de.json" }
                // jhipster-needle-i18n-language-webpack - JHipster will add/remove languages in this array
            ]
        }
    }),
    new HtmlWebpackPlugin({
        template: './src/main/webapp/index.html',
        chunks: ['polyfills', 'main', 'global'],
        chunksSortMode: 'manual',
        inject: 'body'
    }),
    new BaseHrefWebpackPlugin({ baseHref: '/' })
]
});
<|endoftext|>


<commit_before>var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var helpers = require('./helpers');

module.exports = {
	entry: {
		'polyfills': helpers.root('app') + '/polyfills.ts',
		'vendor': helpers.root('app') + '/vendor.ts',
		'app': helpers.root('app') + '/app.ts',
		'css': helpers.root('app') + '/app.css'
	},

	resolve: {
		extensions: ['.ts', '.js']
	},

	module: {
		rules: [
			{
				test: /\.(html|php)$/,
				loader: 'html-loader'
			},
			{
				test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico)$/,
				loader: 'url file-loader?name=/assets/[name].[hash].[ext]'
			},
			{
				test: /\.css$/,
				loader: ExtractTextPlugin.extract({ fallbackLoader: 'style-loader', loader: 'css-loader?minimize=true' })
			},
			{
				test: /\.ts$/,
				loaders: ['awesome-typescript-loader']
			}
		]
	},

	plugins: [
		new webpack.optimize.CommonsChunkPlugin({
			name: ['app', 'vendor', 'polyfills']
		}),

		new webpack.ProvidePlugin({
			$: "jquery",
			jQuery: "jquery",
			"window.jQuery": "jquery"
		}),

		new HtmlWebpackPlugin({
			inject: 'head',
			filename: helpers.root('public_html') + '/index.php',
			template: helpers.root('webpack') + '/index.php'
		})
	]
};<commit_msg>edited to reflect Rochelle's bug fix<commit_after>var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var helpers = require('./helpers');

module.exports = {
	entry: {
		'polyfills': helpers.root('app') + '/polyfills.ts',
		'vendor': helpers.root('app') + '/vendor.ts',
		'app': helpers.root('app') + '/app.ts',
		'css': helpers.root('app') + '/app.css'
	},

	resolve: {
		extensions: ['.ts', '.js']
	},

	module: {
		rules: [
			{
				test: /\.(html|php)$/,
				loader: 'html-loader'
			},
			{
				test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico)$/,
				loader: 'url-loader?name=/assets/[name].[hash].[ext]'
			},
			{
				test: /\.css$/,
				loader: ExtractTextPlugin.extract({ fallbackLoader: 'style-loader', loader: 'css-loader?minimize=true' })
			},
			{
				test: /\.ts$/,
				loaders: ['awesome-typescript-loader']
			}
		]
	},

	plugins: [
		new webpack.optimize.CommonsChunkPlugin({
			name: ['app', 'vendor', 'polyfills']
		}),

		new webpack.ProvidePlugin({
			$: "jquery",
			jQuery: "jquery",
			"window.jQuery": "jquery"
		}),

		new HtmlWebpackPlugin({
			inject: 'head',
			filename: helpers.root('public_html') + '/index.php',
			template: helpers.root('webpack') + '/index.php'
		})
	]
};<|endoftext|>


<commit_before>function getDocUrl(filename) {
  return `https://raw.githubusercontent.com/uber/deck.gl/master/docs/${filename}`;
}
function getCodeUrl(pathname) {
  return `https://github.com/uber/deck.gl/tree/master/${pathname}`;
}

// mapping from file path in source to generated page url
export const markdownFiles = {};

function generatePath(tree, parentPath = '', depth = 0) {
  if (Array.isArray(tree)) {
    tree.forEach(branch => generatePath(branch, parentPath, depth));
    return tree;
  }

  tree.depth = depth;
  if (tree.name) {
    tree.path = tree.name.match(/(GeoJson|3D|API|DeckGL|[A-Z]?[a-z'0-9\.]+|\d+)/g)
      .join('-').toLowerCase().replace(/[^\w-]/g, '');
  }
  if (tree.children) {
    generatePath(tree.children, `${parentPath}/${tree.path}`, depth + 1);
  }
  if (typeof tree.content === 'string') {
    const i = tree.content.indexOf('docs/');
    if (i >= 0) {
      markdownFiles[tree.content.slice(i)] = `${parentPath}/${tree.path}`;
    }
  }

  return tree;
}

export const examplePages = generatePath([
  {
    name: 'Overview',
    content: 'markdown/examples.md'
  },
  {
    name: 'Core Layers',
    expanded: true,
    children: [
      {
        name: 'LineLayer',
        content: {
          demo: 'LineDemo',
          code: getCodeUrl('examples/website/line')
        }
      },
      {
        name: 'HexagonLayer',
        content: {
          demo: 'HeatmapDemo',
          code: getCodeUrl('examples/website/3d-heatmap')
        }
      },
      {
        name: 'IconLayer',
        content: {
          demo: 'IconDemo',
          code: getCodeUrl('examples/website/icon')
        }
      },
      {
        name: 'GeoJsonLayer (Polygons)',
        content: {
          demo: 'GeoJsonDemo',
          code: getCodeUrl('examples/website/geojson')
        }
      },
      {
        name: 'GeoJsonLayer (Paths)',
        content: {
          demo: 'HighwayDemo',
          code: getCodeUrl('examples/website/highway')
        }
      },
      {
        name: 'ScreenGridLayer',
        content: {
          demo: 'ScreenGridDemo',
          code: getCodeUrl('examples/website/screen-grid')
        }
      },
      {
        name: 'ArcLayer',
        content: {
          demo: 'ArcDemo',
          code: getCodeUrl('examples/website/arc')
        }
      },
      {
        name: 'ScatterplotLayer',
        content: {
          demo: 'ScatterplotDemo',
          code: getCodeUrl('examples/website/scatterplot')
        }
      },
      {
        name: 'PointCloudLayer',
        content: {
          demo: 'PointCloudDemo',
          code: getCodeUrl('examples/website/point-cloud-laz')
        }
      },
      {
        name: 'TextLayer',
        content: {
          demo: 'TextDemo',
          code: getCodeUrl('examples/website/tagmap')
        }
      }
    ]
  },
  {
    name: 'Custom Layers',
    expanded: true,
    children: [
      {
        name: 'Brushing Layer',
        content: {
          demo: 'BrushingDemo',
          code: getCodeUrl('examples/website/brushing')
        }
      },
      {
        name: 'Trip Routes',
        content: {
          demo: 'TripsDemo',
          code: getCodeUrl('examples/website/trips')
        }
      },
      {
        name: '3D Surface Explorer',
        content: {
          demo: 'PlotDemo',
          code: getCodeUrl('examples/website/plot')
        }
      }
    ]
  }
]);

export const showcasePages = generatePath([
  {
    name: 'Overview',
    content: 'markdown/showcase.md'
  },
  {
    name: 'Kepler.gl',
    external: 'https://uber.github.io/kepler.gl/'
  },
  {
    name: 'Wind Map',
    external: 'http://uber.github.io/deck.gl/examples/wind'
  },
  {
    name: 'Ascii Video Player',
    external: 'http://pessimistress.github.io/ascii/'
  },
  {
    name: 'Minecraft Chunk Viewer',
    external: 'http://pessimistress.github.io/minecraft/'
  }
]);

export const docPages = generatePath([
  {
    name: 'Overview',
    children: [
      {
        name: 'Introduction',
        content: getDocUrl('README.md')
      },
      {
        name: 'What\'s New',
        content: getDocUrl('whats-new.md')
      },
      {
        name: 'Upgrade Guide',
        content: getDocUrl('upgrade-guide.md')
      },
      {
        name: 'Roadmap',
        content: getDocUrl('roadmap.md')
      },
      {
        name: 'Contributing',
        content: getDocUrl('contributing.md')
      }
    ]
  },
  {
    name: 'Getting Started',
    children: [
      {
        name: 'Installation',
        content: getDocUrl('get-started/getting-started.md')
      },
      {
        name: 'Using Standalone',
        content: getDocUrl('get-started/using-standalone.md')
      },
      {
        name: 'Using With React',
        content: getDocUrl('get-started/using-with-react.md')
      },
      {
        name: 'Using With Mapbox GL',
        content: getDocUrl('get-started/using-with-mapbox-gl.md')
      },
      {
        name: 'Learning Resources',
        content: getDocUrl('get-started/learning-resources.md')
      }
    ]
  },
  {
    name: 'Developer Guide',
    children: [
      {
        name: 'Using Layers',
        content: getDocUrl('get-started/using-layers.md')
      },
      {
        name: 'Adding Interactivity',
        content: getDocUrl('get-started/interactivity.md')
      },
      {
        name: 'About View States',
        content: getDocUrl('developer-guide/view-state.md')
      },
      {
        name: 'Using Views',
        content: getDocUrl('developer-guide/views.md')
      },
      {
        name: 'Coordinate Systems',
        content: getDocUrl('developer-guide/coordinate-systems.md')
      },
      {
        name: 'Viewports and Projections',
        content: getDocUrl('developer-guide/viewports.md')
      },
      {
        name: 'Optimizing Updates',
        content: getDocUrl('developer-guide/updates.md')
      },
      {
        name: 'Performance Notes',
        content: getDocUrl('developer-guide/performance.md')
      },
      {
        name: 'About 64 bit Layers',
        content: getDocUrl('developer-guide/64-bits.md')
      },
      {
        name: 'Tips and Tricks',
        content: getDocUrl('developer-guide/tips-and-tricks.md')
      },
      {
        name: 'Building Apps',
        content: getDocUrl('developer-guide/building-apps.md')
      },
      {
        name: 'Debugging',
        content: getDocUrl('developer-guide/debugging.md')
      },
      {
        name: 'JSON',
        children: [
          {
            name: 'Using the JSON API',
            content: getDocUrl('developer-guide/json/using-json-api.md')
          },
          {
            name: 'Configuring the JSON API',
            content: getDocUrl('developer-guide/json/configuring-json-layers.md')
          }
        ]
      },
      {
        name: 'Testing',
        children: [
          {
            name: 'Overview',
            content: getDocUrl('developer-guide/testing/README.md')
          },
          {
            name: 'Testing',
            content: getDocUrl('developer-guide/testing/testing.md')
          },
          {
            name: 'Using with Unit Test Frameworks',
            content: getDocUrl('developer-guide/testing/using-with-unit-test-frameworks.md')
          }
        ]
      },
      {
        name: 'Writing Custom Layers',
        children: [
          {
            name: 'Writing Your Own Layer',
            content: getDocUrl('developer-guide/custom-layers.md')
          },
          {
            name: 'Layer Lifecycle',
            content: getDocUrl('developer-guide/layer-lifecycle.md')
          },
          {
            name: 'Picking',
            content: getDocUrl('developer-guide/picking.md')
          },
          {
            name: 'Composite Layers',
            content: getDocUrl('developer-guide/composite-layers.md')
          },
          {
            name: 'Subclassed Layers',
            content: getDocUrl('developer-guide/subclassed-layers.md')
          },
          {
            name: 'Primitive Layers',
            content: getDocUrl('developer-guide/primitive-layers.md')
          },
          {
            name: 'Attribute Management',
            content: getDocUrl('developer-guide/attribute-management.md')
          },
          {
            name: 'Writing Shaders',
            content: getDocUrl('developer-guide/writing-shaders.md')
          }
        ]
      }
    ]
  },
  {
    name: 'deck.gl API Reference',
    children: [
      {
        name: 'AttributeManager',
        tag: 'advanced',
        content: getDocUrl('api-reference/attribute-manager.md')
      },
      {
        name: 'Deck',
        content: getDocUrl('api-reference/deck.md')
      },
      {
        name: 'Layers',
        children: [
          {
            name: 'Layer',
            content: getDocUrl('api-reference/layer.md')
          },
          {
            name: 'CompositeLayer',
            content: getDocUrl('api-reference/composite-layer.md')
          },
          {
            name: 'ArcLayer',
            content: getDocUrl('layers/arc-layer.md')
          },
          {
            name: 'GeoJsonLayer',
            content: getDocUrl('layers/geojson-layer.md')
          },
          {
            name: 'GridLayer',
            content: getDocUrl('layers/grid-layer.md')
          },
          {
            name: 'HexagonLayer',
            content: getDocUrl('layers/hexagon-layer.md')
          },
          {
            name: 'IconLayer',
            content: getDocUrl('layers/icon-layer.md')
          },
          {
            name: 'LineLayer',
            content: getDocUrl('layers/line-layer.md')
          },
          {
            name: 'PathLayer',
            content: getDocUrl('layers/path-layer.md')
          },
          {
            name: 'PointCloudLayer',
            content: getDocUrl('layers/point-cloud-layer.md')
          },
          {
            name: 'PolygonLayer',
            content: getDocUrl('layers/polygon-layer.md')
          },
          {
            name: 'ScatterplotLayer',
            content: getDocUrl('layers/scatterplot-layer.md')
          },
          {
            name: 'ScreenGridLayer',
            content: getDocUrl('layers/screen-grid-layer.md')
          },
          {
            name: 'TextLayer',
            content: getDocUrl('layers/text-layer.md')
          }
        ]
      },
      {
        name: 'React',
        children: [
          {
            name: 'DeckGL',
            content: getDocUrl('api-reference/react/deckgl.md')
          }
        ]
      },
      {
        name: 'Standalone',
        children: [
          {
            name: 'DeckGL',
            content: getDocUrl('api-reference/standalone/deckgl.md')
          }
        ]
      },
      {
        name: 'Shader Modules',
        children: [
          {
            name: 'project',
            content: getDocUrl('shader-modules/project.md')
          },
          {
            name: 'project32',
            content: getDocUrl('shader-modules/project32.md')
          },
          {
            name: 'project64',
            content: getDocUrl('shader-modules/project64.md')
          },
          {
            name: 'lighting',
            content: getDocUrl('shader-modules/lighting.md')
          }
        ]
      },
      {
        name: 'Viewports',
        children: [
          {
            name: 'Viewport',
            content: getDocUrl('api-reference/viewport.md')
          },
          {
            name: 'WebMercatorViewport',
            content: getDocUrl('api-reference/web-mercator-viewport.md')
          }
        ]
      },
      {
        name: 'Views',
        children: [
          {
            name: 'View',
            content: getDocUrl('api-reference/view.md')
          },
          {
            name: 'MapView',
            content: getDocUrl('api-reference/map-view.md')
          },
          {
            name: 'FirstPersonView',
            content: getDocUrl('api-reference/first-person-view.md')
          },
          {
            name: 'ThirdPersonView',
            content: getDocUrl('api-reference/third-person-view.md')
          },
          {
            name: 'OrthographicView',
            content: getDocUrl('api-reference/orthographic-view.md')
          },
          {
            name: 'PerspectiveView',
            content: getDocUrl('api-reference/perspective-view.md')
          },
          {
            name: 'OrbitView',
            content: getDocUrl('api-reference/orbit-view.md')
          },
          {
            name: 'View State Transitions',
            content: getDocUrl('api-reference/view-state-transitions.md')
          }
        ]
      },
      {
        name: 'Controllers',
        children: [
          {
            name: 'Controller',
            content: getDocUrl('api-reference/controller.md')
          },
          {
            name: 'MapController',
            content: getDocUrl('api-reference/map-controller.md')
          }
        ]
      }
    ]
  },
  {
    name: 'JSON API Reference (Experimental)',
    children: [
      {
        name: 'JSONDeck (Experimental)',
        content: getDocUrl('api-reference/json/json-deck.md')
      },
      {
        name: 'JSONLayer (Experimental)',
        content: getDocUrl('api-reference/json/json-layer.md')
      }
    ]
  },
  {
    name: 'test-utils API Reference',
    children: [
      {
        name: 'testLayer',
        content: getDocUrl('api-reference/test-utils/test-layer.md')
      },
      {
        name: 'SceneRenderer',
        content: getDocUrl('api-reference/test-utils/scene-renderer.md')
      },
      {
        name: 'RenderTest',
        content: getDocUrl('api-reference/test-utils/render-test.md')
      }
    ]
  }
]);
<commit_msg>Fix website build (#2195)<commit_after>function getDocUrl(filename) {
  return `https://raw.githubusercontent.com/uber/deck.gl/master/docs/${filename}`;
}
function getCodeUrl(pathname) {
  return `https://github.com/uber/deck.gl/tree/master/${pathname}`;
}

// mapping from file path in source to generated page url
export const markdownFiles = {};

function generatePath(tree, parentPath = '', depth = 0) {
  if (Array.isArray(tree)) {
    tree.forEach(branch => generatePath(branch, parentPath, depth));
    return tree;
  }

  tree.depth = depth;
  if (tree.name) {
    tree.path = tree.name
      .match(/(GeoJson|3D|API|DeckGL|JSON|[A-Z]?[a-z'0-9\.]+|\d+)/g)
      .join('-')
      .toLowerCase()
      .replace(/[^\w-]/g, '');
  }
  if (tree.children) {
    generatePath(tree.children, `${parentPath}/${tree.path}`, depth + 1);
  }
  if (typeof tree.content === 'string') {
    const i = tree.content.indexOf('docs/');
    if (i >= 0) {
      markdownFiles[tree.content.slice(i)] = `${parentPath}/${tree.path}`;
    }
  }

  return tree;
}

export const examplePages = generatePath([
  {
    name: 'Overview',
    content: 'markdown/examples.md'
  },
  {
    name: 'Core Layers',
    expanded: true,
    children: [
      {
        name: 'LineLayer',
        content: {
          demo: 'LineDemo',
          code: getCodeUrl('examples/website/line')
        }
      },
      {
        name: 'HexagonLayer',
        content: {
          demo: 'HeatmapDemo',
          code: getCodeUrl('examples/website/3d-heatmap')
        }
      },
      {
        name: 'IconLayer',
        content: {
          demo: 'IconDemo',
          code: getCodeUrl('examples/website/icon')
        }
      },
      {
        name: 'GeoJsonLayer (Polygons)',
        content: {
          demo: 'GeoJsonDemo',
          code: getCodeUrl('examples/website/geojson')
        }
      },
      {
        name: 'GeoJsonLayer (Paths)',
        content: {
          demo: 'HighwayDemo',
          code: getCodeUrl('examples/website/highway')
        }
      },
      {
        name: 'ScreenGridLayer',
        content: {
          demo: 'ScreenGridDemo',
          code: getCodeUrl('examples/website/screen-grid')
        }
      },
      {
        name: 'ArcLayer',
        content: {
          demo: 'ArcDemo',
          code: getCodeUrl('examples/website/arc')
        }
      },
      {
        name: 'ScatterplotLayer',
        content: {
          demo: 'ScatterplotDemo',
          code: getCodeUrl('examples/website/scatterplot')
        }
      },
      {
        name: 'PointCloudLayer',
        content: {
          demo: 'PointCloudDemo',
          code: getCodeUrl('examples/website/point-cloud-laz')
        }
      },
      {
        name: 'TextLayer',
        content: {
          demo: 'TextDemo',
          code: getCodeUrl('examples/website/tagmap')
        }
      }
    ]
  },
  {
    name: 'Custom Layers',
    expanded: true,
    children: [
      {
        name: 'Brushing Layer',
        content: {
          demo: 'BrushingDemo',
          code: getCodeUrl('examples/website/brushing')
        }
      },
      {
        name: 'Trip Routes',
        content: {
          demo: 'TripsDemo',
          code: getCodeUrl('examples/website/trips')
        }
      },
      {
        name: '3D Surface Explorer',
        content: {
          demo: 'PlotDemo',
          code: getCodeUrl('examples/website/plot')
        }
      }
    ]
  }
]);

export const showcasePages = generatePath([
  {
    name: 'Overview',
    content: 'markdown/showcase.md'
  },
  {
    name: 'Kepler.gl',
    external: 'https://uber.github.io/kepler.gl/'
  },
  {
    name: 'Wind Map',
    external: 'http://uber.github.io/deck.gl/examples/wind'
  },
  {
    name: 'Ascii Video Player',
    external: 'http://pessimistress.github.io/ascii/'
  },
  {
    name: 'Minecraft Chunk Viewer',
    external: 'http://pessimistress.github.io/minecraft/'
  }
]);

export const docPages = generatePath([
  {
    name: 'Overview',
    children: [
      {
        name: 'Introduction',
        content: getDocUrl('README.md')
      },
      {
        name: "What's New",
        content: getDocUrl('whats-new.md')
      },
      {
        name: 'Upgrade Guide',
        content: getDocUrl('upgrade-guide.md')
      },
      {
        name: 'Roadmap',
        content: getDocUrl('roadmap.md')
      },
      {
        name: 'Contributing',
        content: getDocUrl('contributing.md')
      }
    ]
  },
  {
    name: 'Getting Started',
    children: [
      {
        name: 'Installation',
        content: getDocUrl('get-started/getting-started.md')
      },
      {
        name: 'Using Standalone',
        content: getDocUrl('get-started/using-standalone.md')
      },
      {
        name: 'Using With React',
        content: getDocUrl('get-started/using-with-react.md')
      },
      {
        name: 'Using With Mapbox GL',
        content: getDocUrl('get-started/using-with-mapbox-gl.md')
      },
      {
        name: 'Learning Resources',
        content: getDocUrl('get-started/learning-resources.md')
      }
    ]
  },
  {
    name: 'Developer Guide',
    children: [
      {
        name: 'Using Layers',
        content: getDocUrl('get-started/using-layers.md')
      },
      {
        name: 'Adding Interactivity',
        content: getDocUrl('get-started/interactivity.md')
      },
      {
        name: 'About View States',
        content: getDocUrl('developer-guide/view-state.md')
      },
      {
        name: 'Using Views',
        content: getDocUrl('developer-guide/views.md')
      },
      {
        name: 'Coordinate Systems',
        content: getDocUrl('developer-guide/coordinate-systems.md')
      },
      {
        name: 'Viewports and Projections',
        content: getDocUrl('developer-guide/viewports.md')
      },
      {
        name: 'Optimizing Updates',
        content: getDocUrl('developer-guide/updates.md')
      },
      {
        name: 'Performance Notes',
        content: getDocUrl('developer-guide/performance.md')
      },
      {
        name: 'About 64 bit Layers',
        content: getDocUrl('developer-guide/64-bits.md')
      },
      {
        name: 'Tips and Tricks',
        content: getDocUrl('developer-guide/tips-and-tricks.md')
      },
      {
        name: 'Building Apps',
        content: getDocUrl('developer-guide/building-apps.md')
      },
      {
        name: 'Debugging',
        content: getDocUrl('developer-guide/debugging.md')
      },
      {
        name: 'JSON',
        children: [
          {
            name: 'Using the JSON API',
            content: getDocUrl('developer-guide/json/using-json-api.md')
          },
          {
            name: 'Configuring the JSON API',
            content: getDocUrl('developer-guide/json/configuring-json-layers.md')
          }
        ]
      },
      {
        name: 'Testing',
        children: [
          {
            name: 'Overview',
            content: getDocUrl('developer-guide/testing/README.md')
          },
          {
            name: 'Testing',
            content: getDocUrl('developer-guide/testing/testing.md')
          },
          {
            name: 'Using with Unit Test Frameworks',
            content: getDocUrl('developer-guide/testing/using-with-unit-test-frameworks.md')
          }
        ]
      },
      {
        name: 'Writing Custom Layers',
        children: [
          {
            name: 'Writing Your Own Layer',
            content: getDocUrl('developer-guide/custom-layers.md')
          },
          {
            name: 'Layer Lifecycle',
            content: getDocUrl('developer-guide/layer-lifecycle.md')
          },
          {
            name: 'Picking',
            content: getDocUrl('developer-guide/picking.md')
          },
          {
            name: 'Composite Layers',
            content: getDocUrl('developer-guide/composite-layers.md')
          },
          {
            name: 'Subclassed Layers',
            content: getDocUrl('developer-guide/subclassed-layers.md')
          },
          {
            name: 'Primitive Layers',
            content: getDocUrl('developer-guide/primitive-layers.md')
          },
          {
            name: 'Attribute Management',
            content: getDocUrl('developer-guide/attribute-management.md')
          },
          {
            name: 'Writing Shaders',
            content: getDocUrl('developer-guide/writing-shaders.md')
          }
        ]
      }
    ]
  },
  {
    name: 'deck.gl API Reference',
    children: [
      {
        name: 'AttributeManager',
        tag: 'advanced',
        content: getDocUrl('api-reference/attribute-manager.md')
      },
      {
        name: 'Deck',
        content: getDocUrl('api-reference/deck.md')
      },
      {
        name: 'Layers',
        children: [
          {
            name: 'Layer',
            content: getDocUrl('api-reference/layer.md')
          },
          {
            name: 'CompositeLayer',
            content: getDocUrl('api-reference/composite-layer.md')
          },
          {
            name: 'ArcLayer',
            content: getDocUrl('layers/arc-layer.md')
          },
          {
            name: 'GeoJsonLayer',
            content: getDocUrl('layers/geojson-layer.md')
          },
          {
            name: 'GridLayer',
            content: getDocUrl('layers/grid-layer.md')
          },
          {
            name: 'HexagonLayer',
            content: getDocUrl('layers/hexagon-layer.md')
          },
          {
            name: 'IconLayer',
            content: getDocUrl('layers/icon-layer.md')
          },
          {
            name: 'LineLayer',
            content: getDocUrl('layers/line-layer.md')
          },
          {
            name: 'PathLayer',
            content: getDocUrl('layers/path-layer.md')
          },
          {
            name: 'PointCloudLayer',
            content: getDocUrl('layers/point-cloud-layer.md')
          },
          {
            name: 'PolygonLayer',
            content: getDocUrl('layers/polygon-layer.md')
          },
          {
            name: 'ScatterplotLayer',
            content: getDocUrl('layers/scatterplot-layer.md')
          },
          {
            name: 'ScreenGridLayer',
            content: getDocUrl('layers/screen-grid-layer.md')
          },
          {
            name: 'TextLayer',
            content: getDocUrl('layers/text-layer.md')
          }
        ]
      },
      {
        name: 'React',
        children: [
          {
            name: 'DeckGL',
            content: getDocUrl('api-reference/react/deckgl.md')
          }
        ]
      },
      {
        name: 'Standalone',
        children: [
          {
            name: 'DeckGL',
            content: getDocUrl('api-reference/standalone/deckgl.md')
          }
        ]
      },
      {
        name: 'Shader Modules',
        children: [
          {
            name: 'project',
            content: getDocUrl('shader-modules/project.md')
          },
          {
            name: 'project32',
            content: getDocUrl('shader-modules/project32.md')
          },
          {
            name: 'project64',
            content: getDocUrl('shader-modules/project64.md')
          },
          {
            name: 'lighting',
            content: getDocUrl('shader-modules/lighting.md')
          }
        ]
      },
      {
        name: 'Viewports',
        children: [
          {
            name: 'Viewport',
            content: getDocUrl('api-reference/viewport.md')
          },
          {
            name: 'WebMercatorViewport',
            content: getDocUrl('api-reference/web-mercator-viewport.md')
          }
        ]
      },
      {
        name: 'Views',
        children: [
          {
            name: 'View',
            content: getDocUrl('api-reference/view.md')
          },
          {
            name: 'MapView',
            content: getDocUrl('api-reference/map-view.md')
          },
          {
            name: 'FirstPersonView',
            content: getDocUrl('api-reference/first-person-view.md')
          },
          {
            name: 'ThirdPersonView',
            content: getDocUrl('api-reference/third-person-view.md')
          },
          {
            name: 'OrthographicView',
            content: getDocUrl('api-reference/orthographic-view.md')
          },
          {
            name: 'PerspectiveView',
            content: getDocUrl('api-reference/perspective-view.md')
          },
          {
            name: 'OrbitView',
            content: getDocUrl('api-reference/orbit-view.md')
          },
          {
            name: 'View State Transitions',
            content: getDocUrl('api-reference/view-state-transitions.md')
          }
        ]
      },
      {
        name: 'Controllers',
        children: [
          {
            name: 'Controller',
            content: getDocUrl('api-reference/controller.md')
          },
          {
            name: 'MapController',
            content: getDocUrl('api-reference/map-controller.md')
          }
        ]
      }
    ]
  },
  {
    name: 'JSON API Reference (Experimental)',
    children: [
      {
        name: 'JSONDeck (Experimental)',
        content: getDocUrl('api-reference/json/json-deck.md')
      },
      {
        name: 'JSONLayer (Experimental)',
        content: getDocUrl('api-reference/json/json-layer.md')
      }
    ]
  },
  {
    name: 'test-utils API Reference',
    children: [
      {
        name: 'testLayer',
        content: getDocUrl('api-reference/test-utils/test-layer.md')
      },
      {
        name: 'SceneRenderer',
        content: getDocUrl('api-reference/test-utils/scene-renderer.md')
      },
      {
        name: 'RenderTest',
        content: getDocUrl('api-reference/test-utils/render-test.md')
      }
    ]
  }
]);
<|endoftext|>


<commit_before>/* Copyright 2016 Streampunk Media Ltd.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/

var SDP = require('../model/SDP.js');
var url = require('url');
var http = require('http');
var fs = require('fs');

var sdpToTags = function(sdp, config) {
  if (typeof sdp === 'string') {
    sdp = new SDP(sdp);
  }
  this.setTag('format', sdp, sdp.getMedia, config);
  this.setTag('encodingName', sdp, sdp.getEncodingName, config);
  this.setTag('clockRate', sdp, sdp.getClockRate, config);
  if (this.tags.format[0].endsWith('video')) {
    this.setTag('height', sdp, sdp.getHeight, config);
    this.setTag('width', sdp, sdp.getWidth, config);
    this.setTag('sampling', sdp, sdp.getSampling, config);
    this.setTag('depth', sdp, sdp.getDepth, config);
    this.setTag('colorimetry', sdp, sdp.getColorimetry, config);
    this.setTag('interlace', sdp, sdp.getInterlace, config);
    this.tags.packing = [ 'pgroup' ];
  } else if (this.tags.format[0].endsWith('audio')) {
    this.setTag('channels', sdp, sdp.getEncodingParameters, config);
  }
  // console.log(this.tags);
  this.sdpToExt(sdp);
  return this.tags;
}

var setTag = function (name, sdp, valueFn, config) {
  if (!name) return;
  var value = (valueFn) ? valueFn.call(sdp, 0) : undefined;
  if (value === undefined) {
    value = config[name];
    if (value === undefined) {
      this.warn(`Did not set property ${name} as it is not defined by SDP or config.`);
      return;
    }
  }
  if (typeof value === 'number') {
    this.tags[name] = [ `${value}` ];
  } else if (typeof value === 'string') {
    this.tags[name] = [ value ];
  } else if (typeof value === 'boolean') {
    this.tags[name] = value ? [ '1' ] : [ '0' ];
  } else {
    this.warn(`Cannot set property ${name} because value is of unsupported type ${typeof value}.`);
  }
}

var sdpURLReader = function (config, cb) {
  var self = this;
  var sdpUrl = config.sdpURL;
  if (!sdpUrl || typeof sdpUrl !== 'string' || sdpUrl.length === 0)
    return cb(null, self.sdpToTags({}, config));
  var sdpDetails = url.parse(sdpUrl);
  if (sdpDetails.protocol.startsWith('file')) {
    return fs.readFile(sdpDetails.path, 'utf8', function (err, data) {
      if (err) return cb(err);
      else return cb(null, this.sdpToTags(data, config), sdp);
    }.bind(this));
  } else if (sdpDetails.protocol.startsWith('http:')) {
    http.get(sdpDetails.href, function (res) {
      if (res.statusCode !== 200) return cb(new Error(
        'SDP file request resulted in non-200 response code.'));
      res.setEncoding('utf8');
      res.on('data', function (data) {
        cb(null, this.sdpToTags(data, config), sdp);
      });
    }.bind(this));
  } else {
    cb(new Error('Cannot read an SDP file with protocols other than http or file.'));
  }
}

var sdpToExt = function (sdp) {
  if (!SDP.isSDP(sdp)) return;
  var revExtMap = sdp.getExtMapReverse(0);
  this.exts = {}; // Don't overwrite defaults by accident
  this.exts.origin_timestamp_id = revExtMap['urn:x-nmos:rtp-hdrext:origin-timestamp'];
  this.exts.smpte_tc_id = revExtMap['urn:ietf:params:rtp-hdrext:smpte-tc'];
  this.exts.flow_id_id = revExtMap['urn:x-nmos:rtp-hdrext:flow-id'];
  this.exts.source_id_id = revExtMap['urn:x-nmos:rtp-hdrext:source-id'];
  this.exts.grain_flags_id = revExtMap['urn:x-nmos:rtp-hdrext:grain-flags'];
  this.exts.sync_timestamp_id = revExtMap['urn:x-nmos:rtp-hdrext:sync-timestamp'];
  this.exts.grain_duration_id = revExtMap['urn:x-nmos:rtp-hdrext:grain-duration'];
  this.exts.ts_refclk = sdp.getTimestampReferenceClock(0);
  this.exts.smpte_tc_param = sdp.getSMPTETimecodeParameters(0);
  return this.exts;
}

module.exports = {
  sdpToTags : sdpToTags,
  setTag : setTag,
  sdpURLReader : sdpURLReader,
  sdpToExt : sdpToExt
};
<commit_msg>Experimenting with fixing this references 3.<commit_after>/* Copyright 2016 Streampunk Media Ltd.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/

var SDP = require('../model/SDP.js');
var url = require('url');
var http = require('http');
var fs = require('fs');

var sdpToTags = function(sdp, config) {
  if (typeof sdp === 'string') {
    sdp = new SDP(sdp);
  }
  this.setTag('format', sdp, sdp.getMedia, config);
  this.setTag('encodingName', sdp, sdp.getEncodingName, config);
  this.setTag('clockRate', sdp, sdp.getClockRate, config);
  if (this.tags.format[0].endsWith('video')) {
    this.setTag('height', sdp, sdp.getHeight, config);
    this.setTag('width', sdp, sdp.getWidth, config);
    this.setTag('sampling', sdp, sdp.getSampling, config);
    this.setTag('depth', sdp, sdp.getDepth, config);
    this.setTag('colorimetry', sdp, sdp.getColorimetry, config);
    this.setTag('interlace', sdp, sdp.getInterlace, config);
    this.tags.packing = [ 'pgroup' ];
  } else if (this.tags.format[0].endsWith('audio')) {
    this.setTag('channels', sdp, sdp.getEncodingParameters, config);
  }
  // console.log(this.tags);
  this.sdpToExt(sdp);
  return this.tags;
}

var setTag = function (name, sdp, valueFn, config) {
  if (!name) return;
  var value = (valueFn) ? valueFn.call(sdp, 0) : undefined;
  if (value === undefined) {
    value = config[name];
    if (value === undefined) {
      this.warn(`Did not set property ${name} as it is not defined by SDP or config.`);
      return;
    }
  }
  if (typeof value === 'number') {
    this.tags[name] = [ `${value}` ];
  } else if (typeof value === 'string') {
    this.tags[name] = [ value ];
  } else if (typeof value === 'boolean') {
    this.tags[name] = value ? [ '1' ] : [ '0' ];
  } else {
    this.warn(`Cannot set property ${name} because value is of unsupported type ${typeof value}.`);
  }
}

var sdpURLReader = function (config, cb) {
  var self = this;
  var sdpUrl = config.sdpURL;
  if (!sdpUrl || typeof sdpUrl !== 'string' || sdpUrl.length === 0)
    return cb(null, self.sdpToTags({}, config));
  var sdpDetails = url.parse(sdpUrl);
  if (sdpDetails.protocol.startsWith('file')) {
    return fs.readFile(sdpDetails.path, 'utf8', function (err, data) {
      if (err) return cb(err);
      else return cb(null, self.sdpToTags(data, config), sdp);
    }.bind(this));
  } else if (sdpDetails.protocol.startsWith('http:')) {
    http.get(sdpDetails.href, function (res) {
      if (res.statusCode !== 200) return cb(new Error(
        'SDP file request resulted in non-200 response code.'));
      res.setEncoding('utf8');
      res.on('data', function (data) {
        cb(null, self.sdpToTags(data, config), sdp);
      });
    }.bind(this));
  } else {
    cb(new Error('Cannot read an SDP file with protocols other than http or file.'));
  }
}

var sdpToExt = function (sdp) {
  if (!SDP.isSDP(sdp)) return;
  var revExtMap = sdp.getExtMapReverse(0);
  this.exts = {}; // Don't overwrite defaults by accident
  this.exts.origin_timestamp_id = revExtMap['urn:x-nmos:rtp-hdrext:origin-timestamp'];
  this.exts.smpte_tc_id = revExtMap['urn:ietf:params:rtp-hdrext:smpte-tc'];
  this.exts.flow_id_id = revExtMap['urn:x-nmos:rtp-hdrext:flow-id'];
  this.exts.source_id_id = revExtMap['urn:x-nmos:rtp-hdrext:source-id'];
  this.exts.grain_flags_id = revExtMap['urn:x-nmos:rtp-hdrext:grain-flags'];
  this.exts.sync_timestamp_id = revExtMap['urn:x-nmos:rtp-hdrext:sync-timestamp'];
  this.exts.grain_duration_id = revExtMap['urn:x-nmos:rtp-hdrext:grain-duration'];
  this.exts.ts_refclk = sdp.getTimestampReferenceClock(0);
  this.exts.smpte_tc_param = sdp.getSMPTETimecodeParameters(0);
  return this.exts;
}

module.exports = {
  sdpToTags : sdpToTags,
  setTag : setTag,
  sdpURLReader : sdpURLReader,
  sdpToExt : sdpToExt
};
<|endoftext|>