Skip to content

Commit

Permalink
Remove old code which was chrome dependent
Browse files Browse the repository at this point in the history
remove unsued libs (sparkline and mustache)
  • Loading branch information
milafrerichs committed Sep 3, 2015
1 parent 46a0a43 commit 63ddc29
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 767 deletions.
1 change: 0 additions & 1 deletion public/index.html
Expand Up @@ -76,7 +76,6 @@ <h2 class="brick-heading">Most popular pages</h2>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.4/raphael-min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/morris.js/0.5.1/morris.min.js"></script>
<script src="javascripts/vendor/mustache.js"></script>
<script src="javascripts/vendor/handlebars-v3.0.3.js"></script>
<script src="javascripts/vendor/pretty.js"></script>
<script src="javascripts/vendor/bezier.js"></script>
Expand Down
112 changes: 0 additions & 112 deletions public/javascripts/manager.js
Expand Up @@ -6,118 +6,6 @@
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
};


var templateStrings = {};

var template =
root.matrix.template =
function(node, id, context){
var templ = templateStrings[id];
if (!templ) {
templateStrings[id] = templ = document.getElementById(id).textContent;
}
node.innerHTML = Mustache.render(templ, context);
};

var def = function(o, p, v) {
Object.defineProperty(o, p, {
writable: true,
enumerable: false,
configurable: true,
value: v,
});
}

def(HTMLElement.prototype, "prepend", function(e) {
if(this.childNodes.length) {
this.insertBefore(e, this.firstChild);
} else {
this.appendChild(e);
}
return this;
});
def(HTMLElement.prototype, "append", function(e) {
this.appendChild(e);
return this;
});
def(HTMLElement.prototype, "remove", function(e) {
this.removeChild(e);
return this;
});
def(HTMLElement.prototype, "kids", function() {
return [].slice.call(this.children, 0);
});

def(HTMLElement.prototype, "maxChildren", function(count) {
var c = this.children;
if (c.length < count) return;
while(c.length > count) { this.removeChild(c[c.length-1]); }
});

var setElementProperties = function(e, args) {
Object.keys(args).forEach(function(key) {
switch(key) {
case "innerHTML":
e.innerHTML = args.innerHTML; break;
case "className":
e.setAttribute("class", args.className); break;
case "classList":
args.classList.forEach(function(cn) { e.classList.add(cn); });
break;
case "children":
args.children.forEach(function(child) {
e.appendChild(child);
});
break;
default:
e.setAttribute(key, args[key]);
break;
}
});
};

var makeElement = function(en, args) {
var e = document.createElement(en);
if(args) { setElementProperties(e, args); }
return e;
};

["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "base", "bdi", "bdo", "blockquote", "body", "br", "button", "canvas", "caption", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "del", "details", "dfn", "dir", "div", "dl", "dt", "element", "em", "embed", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "menu", "menuitem", "meta", "meter", "nav", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "script", "section", "select", "shadow", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "u", "ul", "var", "video", "wbr"].forEach(function(en) {
def(HTMLElement.prototype, en, makeElement.bind(document, en));
});

def(HTMLElement.prototype, "template", function(id, context) {
template(this, id, context);
return this;
});

var now = function() { return window.performance.now(); };

var animationDuration = 500;
var animateDownBy = function(elements, height) {
var start = now();
var prev = start;
var last = 0;
var lasty = 0;
var _animateDownBy = function() {
var current = now();
var dt = current - start;
var x = Math.min(dt / animationDuration, 1);
var y = Bezier.cubicBezier(0.4, 0, 0.2, 1, x, animationDuration);
var topDelta = (y - lasty) * height;
elements.forEach(function(e) {
var t = parseFloat(e.style.top);
e.style.top = (t+topDelta)+"px";
});
var prev = current;
lasty = y;
if (dt <= animationDuration) {
window.requestAnimationFrame(_animateDownBy);
}
};
window.requestAnimationFrame(_animateDownBy);
};

root.addEvent = function(evnt, elem, myfunc) {
if (elem.addEventListener){
elem.addEventListener(evnt, myfunc);
Expand Down
119 changes: 0 additions & 119 deletions public/javascripts/sparkline.js

This file was deleted.

0 comments on commit 63ddc29

Please sign in to comment.