X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=gallery%2Fannotation.js;h=358c2a9c4675adccdd32a2b5492e5b1889a412f5;hb=3c10a0f3519355ee651d04bf2972bd31298eff18;hp=c520090599f10fc2075bf20e558089d07ba2ddf1;hpb=795b16307db2a673ba7aa3452f6f6b0e93baeb3a;p=dygraphs.git diff --git a/gallery/annotation.js b/gallery/annotation.js index c520090..358c2a9 100644 --- a/gallery/annotation.js +++ b/gallery/annotation.js @@ -6,8 +6,8 @@ Gallery.register( setup: function(parent) { parent.innerHTML = "

Click any point to add an annotation to it or click 'Add Annotation'.

" + - "" + - "" + + "" + + "" + "
" + "
" + "
"; @@ -79,7 +79,7 @@ Gallery.register( } ); g.setAnnotations(annotations); - window.add = function() { + document.getElementById('add').onclick = function() { var x = last_ann + 2; var annnotations = g.annotations(); annotations.push( { @@ -92,10 +92,11 @@ Gallery.register( last_ann = x; g.setAnnotations(annotations); } - - window.bottom = function(el) { - var to_bottom = true; - if (el.value != 'Shove to bottom') to_bottom = false; + + var bottom = document.getElementById('bottom'); + + bottom.onclick = function() { + var to_bottom = bottom.textContent == 'Shove to bottom'; var anns = g.annotations(); for (var i = 0; i < anns.length; i++) { @@ -104,9 +105,9 @@ Gallery.register( g.setAnnotations(anns); if (to_bottom) { - el.value = 'Lift back up'; + bottom.textContent = 'Lift back up'; } else { - el.value = 'Shove to bottom'; + bottom.textContent = 'Shove to bottom'; } }