diff --git a/facstaff/index.shtml b/facstaff/index.shtml index 967b79faea49e081c1c1f99d0f8538752232c4cb..c3d66b8bf7066ea52c3921d75561e54a1b886042 100644 --- a/facstaff/index.shtml +++ b/facstaff/index.shtml @@ -33,53 +33,34 @@ <script type="text/javascript"> WDN.jQuery('document').ready(function() { - var title, list_item, uri, value, file_uri, file_value; + var title, list_item, uri, img_uri; var display_amount = 5; var i = 0; - function objectSize(obj) { - var size = 0, key; - for (key in obj) { - if (obj.hasOwnProperty(key)) size++; - } - return size; - }; - // For the student news stories from today@unl - WDN.jQuery.getJSON('http://newsroom.unl.edu/announce/todayatunl/latest?format=json', - function(data) { - var size = 0, key; - for (key in data.stories) { - if (data.stories.hasOwnProperty(key)) size++; + WDN.jQuery.get('http://news.unl.edu/free-tags/facultystaff/?format=partial', function(data) { + WDN.jQuery("#newsAndEvents").append('<ul id="newsList" />'); + var articles = WDN.jQuery(WDN.jQuery.parseHTML(data)).find('article').each(function() { + //Only pull in the display amount + if (i >= display_amount) { + return; } - if (objectSize(data.stories) > 0) { - WDN.jQuery("#newsAndEvents a").remove(); - WDN.jQuery("#newsAndEvents").append('<ul id="newsList" />'); - WDN.jQuery.each( - data.stories, - function(uri, value) { - if (i < display_amount && value['id'] != '1604') { //1604 is an ad (http://newsroom.unl.edu/announce/stories/1604) - title = value['title']; - WDN.log(value['files']); - if (objectSize(value['files']) > 0){ - WDN.jQuery.each( - value['files'], - function(file_uri, file_value) { - if (file_value['use_for'] == "thumbnail") { - list_item = '<li><a href="' + uri + '"><img src="'+file_uri+'" alt="" /><span class="newsTitle">'+ title +'</span></a></li>'; - } - } - ); - } else { - list_item = '<li><a href="' + uri + '"><span class="newsTitle">'+ title +'</span></a></li>'; - } - WDN.jQuery('#newsList').append(list_item); - i++; - }; - } - ); - }; - } - ); - }); + + var $article = WDN.jQuery(this); + title = $article.find('.field-name-title').text().trim(); + uri = 'http://news.unl.edu' + $article.find('.field-name-title a').attr('href'); + img_uri = $article.find('.content img').attr('src'); + + if (img_uri) { + list_item = '<li><a href="' + uri + '"><img src="'+img_uri+'" alt="" /><span class="newsTitle">'+ title +'</span></a></li>'; + } else { + list_item = '<li><a href="' + uri + '"><span class="newsTitle">'+ title +'</span></a></li>'; + } + + WDN.jQuery('#newsList').append(list_item); + + i++; + }); + }); + }); </script> <link rel="stylesheet" href="/ucomm/sharedcode/css/3.1.css" /> <link rel="stylesheet" href="/ucomm/current/currentstudents.css" /> @@ -234,7 +215,7 @@ </section> <div id="newsAndEvents" class="grid2"> <span class="subTitle" style="padding:4px;">Latest Faculty / Staff News</span> - <a href="http://newsroom.unl.edu/announce/todayatunl/">Today@UNL is your source for the latest faculty/staff news.</a> + <a href="http://news.unl.edu/newsrooms/unltoday/">UNL Today is your source for the latest faculty/staff news.</a> </div> <section id="university-structure" class="grid10 first"> <div class="grid5 first">