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
| (function(window){
var _version= "0.0.1",
_canvas;
AnimatedGraph = function (className){
return new AnimatedGraph.fn.init(className);
};
AnimatedGraph.fn = AnimatedGraph.prototype = {
constructor: AnimatedGraph,
init: function(className){
_canvas = AnimatedGraph.search(className);
_canvas.innerHTML = "Youpi";
},
search: function(className){
var elm = document.getElementsByTagName("div");
for(i=0;i<elm.length;i++){
if(elm[i].className == className)
return elm[i];
}
},
createGraph: function(width,height){
var title = document.createElement("div");
title.innerHTML="tutu";
_canvas.appendChild(title);
}
};
return (function(){
var ret = new AnimatedGraph();
ret.createGraph = createGraph;
return ret;
});
AnimatedGraph.search = AnimatedGraph.fn.search;
function createGraph(width,height){
var title = document.createElement("div");
title.innerHTML="tutu";
_canvas.appendChild(title);
};
window.Graph = AnimatedGraph;
})(window); |
Partager