javascript - JSON and Tumblr -


okay, i'm trying create "order posts type" using jquery json data... post types works in chrome, safari, ff. in ie, video / audio posts not display (perhaps embedding?) when filter through posts using json.

does have clue what's going on?! here's code:

<script>   $('#order_by ul li').find('a').click(function() {   var posttype = this.classname;   var count = 0;   bycategory(posttype);   return false;    function bycategory(posttype, callback) {     $.getjson('{url}/api/read/json?type=' + posttype + '&callback=?', function(data) {     var article = [];      $.each(data.posts, function(i, item) {      // = index      // item = data particular post      switch(item.type) {      case 'photo':      article[i] = '<div class="post_wrap"><div class="photo"><a href="'           + item.url         + '" title="view full post" class="type_icon"><img src="http://static.tumblr.com/ewjv7ap/0yplawef6/link_photo.png" /></a><a href="'         + item.url         + '"><img src="'         + item['photo-url-1280']         + '"alt="image" /></a></div></div>';      count = 1;      break;      case 'video':      article[i] = '<div class="post_wrap"><div class="video"><a href="'         + item.url         + '" title="view full post" class="type_icon"><img src="http://static.tumblr.com/ewjv7ap/fwalawenw/link_video.png" /></a><span><br />'         + item['video-player']         + '</span><div class="video_desc">'         + item['video-caption']         + '</div></div></div>';      count = 1;      console.log(article[i]);      break;      case 'audio':      article[i] = '<div class="post_wrap"><div class="audio"><a href="'           + item.url         + '" title="view full post" class="type_icon"><img src="http://static.tumblr.com/ewjv7ap/e8zlawemi/link_audio.png" /></a><h2 class="heading"><a href="'         + item.url + '">'         + item['id3-artist']         +' - '         + item['id3-title']         + '</a></h2><div class="player"><br />'         + item['audio-player']        + '<p>' + item['id3-artist'] + ' - ' + item['id3-title'] + '</p>'        + '<p>' + item['audio-plays'] + ' plays</p>'         + '</div><div class="audio_desc">'         + item['audio-caption']         + '</div><div class="clear"></div></div></div>';      count = 1;      break;      case 'regular':      article[i] = '<div class="post_wrap"><div class="regular"><a href="'           + item.url         + '" title="view full post" class="type_icon"><img src="http://static.tumblr.com/ewjv7ap/lh3laweb7/link_text.png" /></a><h2 class="heading"><a href="'         + item.url         + '">' + item['regular-title']        + '</a><div class="description_container">'        + item['regular-body']         + '</div></div></div>';      count = 1;      break;      case 'quote':      article[i] = '<div class="post_wrap"><div class="quote"><a href="'           + item.url         + '" title="view full post" class="type_icon"><img src="http://static.tumblr.com/ewjv7ap/1lwlaweh7/link_quote.png" /></a><blockquote>'         + item['quote-text']        + '</blockquote><cite>- '        + item['quote-source']         + '</cite></div></div>';      count = 1;      break;      case 'conversation':      article[i] = '<div class="post_wrap"><div class="chat"><a href="'           + item.url         + '" title="view full post" class="type_icon"><img src="http://static.tumblr.com/ewjv7ap/nz9lawekt/link_chat.png" /></a><h2 class="heading"><a href="'         + item.url         + '">' + item['conversation-title']        + '</a></h2></div></div>';      count = 1;      break;      case 'link':      article[i] = '<div class="post_wrap"><div class="link"><a href="'           + item.url         + '" title="view full post" class="type_icon"><img src="http://static.tumblr.com/ewjv7ap/g1zlaweir/link_link.png" /></a><h2 class="heading"><a href="'         + item['link-url']         + '">' + item['link-text']        + '</a></h2></div></div>';      count = 1;      break;      default:      alert('no entries found.');      };      }) // end each       if (!(count == 0)) {      $('#main_content')       .fadeout('fast')       .html('<div class="post_wrap"><div class="regular"><h2 class="heading">displaying '        + posttype        + ' posts only</h2></div></div>'       + '<div class="post_wrap"'        + article.join('')        + '</div>'       ).fadein('fast')                $('div.video').each(function() {        var video_container_height = $(this).innerheight();           video_container_height = (video_container_height - 60)        $(this).children('div.video_desc').css(         {'position': 'absolute',         'top': '40px',         'right': '20px',         'width': '380px',         'height': video_container_height}        ).jscrollpane({         verticalgutter: 25        });       });              $('div.audio div.audio_desc').each(function() {         var container_width = $('div.audio').outerwidth(true);       var player_width = $('div.audio div.player').outerwidth(true);       var audio_desc_width = (container_width - player_width);        $(this).css(        {'position': 'absolute',        'top': '75px',        'right': '20px',        'height': '125px',        'width': (audio_desc_width - 50 /*the size of left , right margin*/)})       .jscrollpane({        verticalgutter: 25       });      });         } else {       $('#main_content')       .fadeout('fast')       .html('<div class="post_wrap"><div class="regular"><h2 class="heading">whoops! there no '        + posttype        + ' posts display</h2></div></div>'       ).fadein('fast')      } // end if     }); // end getjson    }; // end bycategory     });  // end click        </script> 

to check out live version, head on over http://minimus.tumblr.com

i think problem caused tiny error @ line 1690:

$('#main_content')     .fadeout('fast')     .html('<div class="post_wrap"><div class="regular"><h2 class="heading">displaying '         + posttype         + ' posts only</h2></div></div>'         + '<div class="post_wrap"' // line 1690: missing '>'         + article.join('')         + '</div>'     ).fadein('fast') 

Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -