forked from kolaelys/Projet_TalentsThree
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindexTest.dnd.js
47 lines (39 loc) · 1.24 KB
/
indexTest.dnd.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
(function($, ko){
(function(ns) {
var TalentTree = ns.TalentTree = function(_e){
var e = _e || {};
var self = function(){};
self.skills = ko.observableArray(ko.utils.arrayMap(e.skills, function(item){
return new Skill(item, self.skills);
}));
function getSkillById(id) {
return ko.utils.arrayFirst(self.skills(), function(item){
return item.id == id;
});
}
//Wire up dependency references
ko.utils.arrayForEach(e.skills, function(item){
if(item.dependsOn) {
var dependent = getSkillById(item.id);
ko.utils.arrayForEach(item.dependsOn, function(dependencyId){
var dependency = getSkillById(dependencyId);
dependent.dependencies.push(dependency);
dependency.dependents.push(dependent);
});
}
});
}
}) (namespace('tft.dnd'));
$(function () {
if (isInvalidIEVersion())
return;
;
var vm = new tft.dnd.TalentTree(tft.dnd.data); //Make a new Talent Tree VM based on the data in tft.dnd.data.js
ko.applyBindings(vm);
//Allow a split second for binding before turning on animated transitions for the UI
setTimeout(function(){
$('.page').addClass('animated');
}, 50);
});
})
(window.jQuery, window.ko);