projects
/
dygraphs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of github.com:danvk/dygraphs
[dygraphs.git]
/
gallery
/
gallery.js
diff --git
a/gallery/gallery.js
b/gallery/gallery.js
index
dc50813
..
0c0034c
100644
(file)
--- a/
gallery/gallery.js
+++ b/
gallery/gallery.js
@@
-17,11
+17,16
@@
Gallery.create = function(type, parent, className) {
};
Gallery.start = function() {
};
Gallery.start = function() {
- google.load('visualization', '1', {'packages':['annotatedtimeline']});
Gallery.toc = document.getElementById("toc");
Gallery.workarea = document.getElementById("workarea");
Gallery.toc = document.getElementById("toc");
Gallery.workarea = document.getElementById("workarea");
+ Gallery.subtitle = Gallery.create("div", Gallery.workarea);
+ Gallery.subtitle.id = "subtitle";
Gallery.workareaChild = Gallery.create("div", Gallery.workarea);
Gallery.workareaChild = Gallery.create("div", Gallery.workarea);
- Gallery.workarea.style.visibility = "hidden";
+ Gallery.demotitle = document.getElementById("demotitle");
+ Gallery.textarea = new TextArea();
+ Gallery.textarea.width = 600;
+ Gallery.textarea.height = 400;
+
for (var idx in Gallery.entryOrder) {
var id = Gallery.entryOrder[idx];
var demo = Gallery.entries[id];
for (var idx in Gallery.entryOrder) {
var id = Gallery.entryOrder[idx];
var demo = Gallery.entries[id];
@@
-42,15
+47,23
@@
Gallery.start = function() {
Gallery.runningDemo.clean(Gallery.workareaChild);
}
}
Gallery.runningDemo.clean(Gallery.workareaChild);
}
}
- Gallery.workarea.style.visibility = "visible";
- document.getElementById("title").textContent = demo.title ? demo.title : "";
+ Gallery.subtitle.innerHTML = "";
+ var codeLink = Gallery.create("a", Gallery.subtitle);
+ codeLink.textContent = "code";
+ codeLink.href = "#";
+ Gallery.demotitle.textContent = demo.title ? demo.title : "";
demo.innerDiv.className = "selected";
Gallery.workareaChild.id = id;
demo.innerDiv.className = "selected";
Gallery.workareaChild.id = id;
- location.hash = id;
+ location.hash =
"g/" +
id;
Gallery.workareaChild.innerHTML='';
if (demo.setup) {
demo.setup(Gallery.workareaChild);
}
Gallery.workareaChild.innerHTML='';
if (demo.setup) {
demo.setup(Gallery.workareaChild);
}
+ var html = Gallery.workareaChild.innerHTML;
+ codeLink.onclick = function() {
+ var javascript = demo.run.toString();
+ Gallery.textarea.show("Code", "HTML\n\n" + html + "\n\njavascript\n\n" + javascript);
+ };
demo.run(Gallery.workareaChild);
Gallery.runningDemo = demo;
}; }(demo, id);
demo.run(Gallery.workareaChild);
Gallery.runningDemo = demo;
}; }(demo, id);
@@
-70,7
+83,13
@@
Gallery.register = function(id, demo) {
};
Gallery.hashChange = function(event) {
};
Gallery.hashChange = function(event) {
- var id = location.hash.substring(1) + "-toc";
- var elem = document.getElementById(id);
- elem.onclick();
-};
\ No newline at end of file
+ if (location.hash) {
+ if (location.hash.indexOf("#g/") == 0) {
+ var id = location.hash.substring(3) + "-toc";
+ var elem = document.getElementById(id);
+ elem.onclick();
+ return;
+ }
+ }
+ Gallery.workareaChild.innerHTML = "<h3>Select a demo from the gallery on the left</h3>"
+};