From 616729be9c49479d60d5e497c6a8b6acbca11ffb Mon Sep 17 00:00:00 2001 From: wei <> Date: Mon, 15 Jan 2007 00:28:31 +0000 Subject: more js errors --- .../quickstart/protected/controls/Comments/comments.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'demos/quickstart/protected/controls') diff --git a/demos/quickstart/protected/controls/Comments/comments.js b/demos/quickstart/protected/controls/Comments/comments.js index 6364903a..5df3bdf2 100644 --- a/demos/quickstart/protected/controls/Comments/comments.js +++ b/demos/quickstart/protected/controls/Comments/comments.js @@ -74,9 +74,9 @@ function show_comments(block) function show_block(block) { - while(block && block.className.indexOf("block-content") < 0) + while(block && block.className && block.className.indexOf("block-content") < 0) block = block.parentNode; - if(block && block.className.indexOf("block-content") >= 0) + if(block && block.className && block.className.indexOf("block-content") >= 0) { block.addClassName('block-hover'); var tag = $('tag-'+block.id); @@ -87,9 +87,9 @@ function show_block(block) function hide_block(block) { - while(block && block.className.indexOf("block-hover") < 0) + while(block && block.className && block.className.indexOf("block-hover") < 0) block = block.parentNode; - if(block && block.className.indexOf("block-hover") >= 0) + if(block && block.className && block.className.indexOf("block-hover") >= 0) { block.removeClassName('block-hover'); var tag = $('tag-'+block.id); @@ -118,9 +118,9 @@ function add_comment_tag(el) var tag = "
"+comments+"
 
"; new Insertion.Before(el, tag); var tag_div = $(id); - Event.observe(tag_div, "mouseover", function(e){ if(show_block) show_block(el); }); - Event.observe(tag_div, "mouseout", function(e){ if(hide_block) hide_block(el); }); - Event.observe(tag_div, "click", function(e) { if(show_comments) show_comments(el); Event.stop(e); }); + Event.observe(tag_div, "mouseover", function(e){ if(typeof(show_block)!="undefined") show_block(el); }); + Event.observe(tag_div, "mouseout", function(e){ if(typeof(hide_block) !="undefined") hide_block(el); }); + Event.observe(tag_div, "click", function(e) { if(typeof(show_comments) !="undefined") show_comments(el); Event.stop(e); }); } function increment_count_tag(id) @@ -167,8 +167,8 @@ function get_comment_count(id) $$('#content .block-content').each(function(el) { - Event.observe(el, 'mouseover', function(e){ if(show_block) show_block(Event.element(e)); }); - Event.observe(el, 'mouseout', function(e){ if(hide_block) hide_block(Event.element(e)); }); + Event.observe(el, 'mouseover', function(e){ if(typeof(show_block)!="undefined") show_block(Event.element(e)); }); + Event.observe(el, 'mouseout', function(e){ if(typeof(hide_block)!="undefined") hide_block(Event.element(e)); }); add_comment_tag(el); }); -- cgit v1.2.3