Skip to content
Snippets Groups Projects
Commit 526016b8 authored by Michael Fairchild's avatar Michael Fairchild
Browse files

Load the facstaff news feed form news.unl.edu

parent c1c2c5fb
No related branches found
No related tags found
1 merge request!12Fix Facstaff News Feed
...@@ -33,52 +33,33 @@ ...@@ -33,52 +33,33 @@
<script type="text/javascript"> <script type="text/javascript">
WDN.jQuery('document').ready(function() { 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 display_amount = 5;
var i = 0; var i = 0;
function objectSize(obj) { WDN.jQuery.get('http://news.unl.edu/free-tags/facultystaff/?format=partial', function(data) {
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++;
}
if (objectSize(data.stories) > 0) {
WDN.jQuery("#newsAndEvents a").remove();
WDN.jQuery("#newsAndEvents").append('<ul id="newsList" />'); WDN.jQuery("#newsAndEvents").append('<ul id="newsList" />');
WDN.jQuery.each( var articles = WDN.jQuery(WDN.jQuery.parseHTML(data)).find('article').each(function() {
data.stories, //Only pull in the display amount
function(uri, value) { if (i >= display_amount) {
if (i < display_amount && value['id'] != '1604') { //1604 is an ad (http://newsroom.unl.edu/announce/stories/1604) return;
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>';
}
} }
);
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 { } else {
list_item = '<li><a href="' + uri + '"><span class="newsTitle">'+ title +'</span></a></li>'; list_item = '<li><a href="' + uri + '"><span class="newsTitle">'+ title +'</span></a></li>';
} }
WDN.jQuery('#newsList').append(list_item); WDN.jQuery('#newsList').append(list_item);
i++; i++;
}; });
} });
);
};
}
);
}); });
</script> </script>
<link rel="stylesheet" href="/ucomm/sharedcode/css/3.1.css" /> <link rel="stylesheet" href="/ucomm/sharedcode/css/3.1.css" />
...@@ -234,7 +215,7 @@ ...@@ -234,7 +215,7 @@
</section> </section>
<div id="newsAndEvents" class="grid2"> <div id="newsAndEvents" class="grid2">
<span class="subTitle" style="padding:4px;">Latest Faculty / Staff News</span> <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> </div>
<section id="university-structure" class="grid10 first"> <section id="university-structure" class="grid10 first">
<div class="grid5 first"> <div class="grid5 first">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment