Commit ee41126f authored by Pascal Hartig's avatar Pascal Hartig

AngularJS Perf: Update to 1.3.2

parent 6a65d06f
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"name": "todomvc-angular-perf", "name": "todomvc-angular-perf",
"version": "0.0.0", "version": "0.0.0",
"dependencies": { "dependencies": {
"angular": "1.2.9", "angular": "1.3.2",
"todomvc-common": "~0.3.0" "todomvc-common": "~0.3.0"
} }
} }
...@@ -171,25 +171,42 @@ ...@@ -171,25 +171,42 @@
framework = document.querySelector('[data-framework]').dataset.framework; framework = document.querySelector('[data-framework]').dataset.framework;
} }
if (template && learnJSON[framework]) {
this.frameworkJSON = learnJSON[framework];
this.template = template; this.template = template;
if (learnJSON.backend) {
this.frameworkJSON = learnJSON.backend;
this.append({
backend: true
});
} else if (learnJSON[framework]) {
this.frameworkJSON = learnJSON[framework];
this.append(); this.append();
} }
} }
Learn.prototype.append = function () { Learn.prototype.append = function (opts) {
var aside = document.createElement('aside'); var aside = document.createElement('aside');
aside.innerHTML = _.template(this.template, this.frameworkJSON); aside.innerHTML = _.template(this.template, this.frameworkJSON);
aside.className = 'learn'; aside.className = 'learn';
if (opts && opts.backend) {
// Remove demo link
var sourceLinks = aside.querySelector('.source-links');
var heading = sourceLinks.firstElementChild;
var sourceLink = sourceLinks.lastElementChild;
// Correct link path
var href = sourceLink.getAttribute('href');
sourceLink.setAttribute('href', href.substr(href.lastIndexOf('http')));
sourceLinks.innerHTML = heading.outerHTML + sourceLink.outerHTML;
} else {
// Localize demo links // Localize demo links
var demoLinks = aside.querySelectorAll('.demo-link'); var demoLinks = aside.querySelectorAll('.demo-link');
Array.prototype.forEach.call(demoLinks, function (demoLink) { Array.prototype.forEach.call(demoLinks, function (demoLink) {
if (demoLink.getAttribute('href').substr(0, 4) !== 'http') {
demoLink.setAttribute('href', findRoot() + demoLink.getAttribute('href')); demoLink.setAttribute('href', findRoot() + demoLink.getAttribute('href'));
}
}); });
}
document.body.className = (document.body.className + ' learn-bar').trim(); document.body.className = (document.body.className + ' learn-bar').trim();
document.body.insertAdjacentHTML('afterBegin', aside.outerHTML); document.body.insertAdjacentHTML('afterBegin', aside.outerHTML);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment