src/js/theme/toolbar.js
function insertAt(parent, selector, index, element) {
    var lastIndex = parent.children(selector).length;
    if (index < 0) {
        index = Math.max(0, lastIndex + 1 + index);
    }
    parent.append(element);

    if (index < lastIndex) {
        parent.children(selector).eq(index).before(parent.children(selector).last());
    }
}
function insertAt(parent, selector, index, element) {
    var lastIndex = parent.children(selector).length;
    if (index < 0) {
        index = Math.max(0, lastIndex + 1 + index);
    }
    parent.append(element);

    if (index < lastIndex) {
        parent.children(selector).eq(index).before(parent.children(selector).last());
    }
}
Insert a jquery element at a specific position