Note that there are some explanatory texts on larger screens.

plurals
  1. POJSON and Tumblr
    primarykey
    data
    text
    <p>Okay, so I'm trying to create a "Order Posts by Type" using jQuery JSON to get the data... All the post types works in Chrome, Safari, FF. But in IE, video / audio posts will not display (perhaps something to do with the embedding?) when I filter through the posts using JSON.</p> <p>Does anyone have a clue what's going on?! Here's the code:</p> <pre><code>&lt;script&gt; $('#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 + '&amp;callback=?', function(data) { var article = []; $.each(data.posts, function(i, item) { // i = index // item = data for a particular post switch(item.type) { case 'photo': article[i] = '&lt;div class="post_wrap"&gt;&lt;div class="photo"&gt;&lt;a href="' + item.url + '" title="View Full Post" class="type_icon"&gt;&lt;img src="http://static.tumblr.com/ewjv7ap/0yplawef6/link_photo.png" /&gt;&lt;/a&gt;&lt;a href="' + item.url + '"&gt;&lt;img src="' + item['photo-url-1280'] + '"alt="image" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;'; count = 1; break; case 'video': article[i] = '&lt;div class="post_wrap"&gt;&lt;div class="video"&gt;&lt;a href="' + item.url + '" title="View Full Post" class="type_icon"&gt;&lt;img src="http://static.tumblr.com/ewjv7ap/FWAlawenw/link_video.png" /&gt;&lt;/a&gt;&lt;span&gt;&lt;br /&gt;' + item['video-player'] + '&lt;/span&gt;&lt;div class="video_desc"&gt;' + item['video-caption'] + '&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;'; count = 1; console.log(article[i]); break; case 'audio': article[i] = '&lt;div class="post_wrap"&gt;&lt;div class="audio"&gt;&lt;a href="' + item.url + '" title="View Full Post" class="type_icon"&gt;&lt;img src="http://static.tumblr.com/ewjv7ap/e8Zlawemi/link_audio.png" /&gt;&lt;/a&gt;&lt;h2 class="heading"&gt;&lt;a href="' + item.url + '"&gt;' + item['id3-artist'] +' - ' + item['id3-title'] + '&lt;/a&gt;&lt;/h2&gt;&lt;div class="player"&gt;&lt;br /&gt;' + item['audio-player'] + '&lt;p&gt;' + item['id3-artist'] + ' - ' + item['id3-title'] + '&lt;/p&gt;' + '&lt;p&gt;' + item['audio-plays'] + ' plays&lt;/p&gt;' + '&lt;/div&gt;&lt;div class="audio_desc"&gt;' + item['audio-caption'] + '&lt;/div&gt;&lt;div class="clear"&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;'; count = 1; break; case 'regular': article[i] = '&lt;div class="post_wrap"&gt;&lt;div class="regular"&gt;&lt;a href="' + item.url + '" title="View Full Post" class="type_icon"&gt;&lt;img src="http://static.tumblr.com/ewjv7ap/LH3laweb7/link_text.png" /&gt;&lt;/a&gt;&lt;h2 class="heading"&gt;&lt;a href="' + item.url + '"&gt;' + item['regular-title'] + '&lt;/a&gt;&lt;div class="description_container"&gt;' + item['regular-body'] + '&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;'; count = 1; break; case 'quote': article[i] = '&lt;div class="post_wrap"&gt;&lt;div class="quote"&gt;&lt;a href="' + item.url + '" title="View Full Post" class="type_icon"&gt;&lt;img src="http://static.tumblr.com/ewjv7ap/1Lwlaweh7/link_quote.png" /&gt;&lt;/a&gt;&lt;blockquote&gt;' + item['quote-text'] + '&lt;/blockquote&gt;&lt;cite&gt;- ' + item['quote-source'] + '&lt;/cite&gt;&lt;/div&gt;&lt;/div&gt;'; count = 1; break; case 'conversation': article[i] = '&lt;div class="post_wrap"&gt;&lt;div class="chat"&gt;&lt;a href="' + item.url + '" title="View Full Post" class="type_icon"&gt;&lt;img src="http://static.tumblr.com/ewjv7ap/NZ9lawekt/link_chat.png" /&gt;&lt;/a&gt;&lt;h2 class="heading"&gt;&lt;a href="' + item.url + '"&gt;' + item['conversation-title'] + '&lt;/a&gt;&lt;/h2&gt;&lt;/div&gt;&lt;/div&gt;'; count = 1; break; case 'link': article[i] = '&lt;div class="post_wrap"&gt;&lt;div class="link"&gt;&lt;a href="' + item.url + '" title="View Full Post" class="type_icon"&gt;&lt;img src="http://static.tumblr.com/ewjv7ap/G1zlaweir/link_link.png" /&gt;&lt;/a&gt;&lt;h2 class="heading"&gt;&lt;a href="' + item['link-url'] + '"&gt;' + item['link-text'] + '&lt;/a&gt;&lt;/h2&gt;&lt;/div&gt;&lt;/div&gt;'; count = 1; break; default: alert('No Entries Found.'); }; }) // end each if (!(count == 0)) { $('#main_content') .fadeOut('fast') .html('&lt;div class="post_wrap"&gt;&lt;div class="regular"&gt;&lt;h2 class="heading"&gt;Displaying ' + postType + ' Posts Only&lt;/h2&gt;&lt;/div&gt;&lt;/div&gt;' + '&lt;div class="post_wrap"' + article.join('') + '&lt;/div&gt;' ).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 the left and right margin*/)}) .jScrollPane({ verticalGutter: 25 }); }); } else { $('#main_content') .fadeOut('fast') .html('&lt;div class="post_wrap"&gt;&lt;div class="regular"&gt;&lt;h2 class="heading"&gt;Whoops! There are no ' + postType + ' Posts To Display&lt;/h2&gt;&lt;/div&gt;&lt;/div&gt;' ).fadeIn('fast') } // end IF }); // end getJSON }; // end byCategory }); // end click &lt;/script&gt; </code></pre> <p>To check out the live version, head on over to <a href="http://minimus.tumblr.com" rel="nofollow">http://minimus.tumblr.com</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload